diff options
author | Timo Sirainen <cras@irssi.org> | 2000-05-09 11:42:42 +0000 |
---|---|---|
committer | cras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564> | 2000-05-09 11:42:42 +0000 |
commit | 93d603215114093b92837df0604c5fe285cc04a6 (patch) | |
tree | f128c498946922199a426d46574612b22c539f66 /src/fe-text | |
parent | 90ff30fcd01cd15323a6d2d5fd9797660021b475 (diff) | |
download | irssi-93d603215114093b92837df0604c5fe285cc04a6.zip |
- Compiling fixes
- GNOME version isn't anymore build here so you don't need all that GTK and
GNOME crap to compile irssi-text.
- Some fixes to compile with -ansi -pedantic
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@200 dbcabf3a-b0e7-0310-adc4-f8d773084564
Diffstat (limited to 'src/fe-text')
-rw-r--r-- | src/fe-text/Makefile.am | 7 | ||||
-rw-r--r-- | src/fe-text/gui-statusbar.c | 237 | ||||
-rw-r--r-- | src/fe-text/module-formats.h | 2 | ||||
-rw-r--r-- | src/fe-text/screen.h | 14 | ||||
-rw-r--r-- | src/fe-text/statusbar.c | 8 |
5 files changed, 15 insertions, 253 deletions
diff --git a/src/fe-text/Makefile.am b/src/fe-text/Makefile.am index 0120a4d9..fc8d7302 100644 --- a/src/fe-text/Makefile.am +++ b/src/fe-text/Makefile.am @@ -13,10 +13,9 @@ irssi_text_DEPENDENCIES = @COMMON_LIBS@ irssi_text_LDADD = \ @COMMON_LIBS@ \ - $(PROG_LIBS) \ - $(CURSES_LIBS) \ - $(INTLLIBS) \ - $(PERL_LDFLAGS) + $(PROG_LIBS) \ + $(PERL_LDFLAGS) \ + $(CURSES_LIBS) irssi_text_SOURCES = \ gui-entry.c \ diff --git a/src/fe-text/gui-statusbar.c b/src/fe-text/gui-statusbar.c deleted file mode 100644 index 130993c2..00000000 --- a/src/fe-text/gui-statusbar.c +++ /dev/null @@ -1,237 +0,0 @@ -/* - gui-statusbar.c : irssi - - Copyright (C) 1999 Timo Sirainen - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -*/ - -#include "module.h" -#include "signals.h" -#include "server.h" - -#include "windows.h" - -#include "screen.h" -#include "gui-statusbar.h" -#include "gui-mainwindows.h" -#include "gui-windows.h" - -typedef struct -{ - gint tag; - - gint xpos, ypos; - gint size; - gboolean right_justify, up; - STATUSBAR_FUNC func; -} -STATUSBAR_REC; - -static GList *sbars; -static gint sbars_tag; - -static void gui_statusbar_redraw_line(gboolean up, gint ypos) -{ - GList *tmp; - gint xpos, rxpos; - - xpos = 1; - for (tmp = sbars; tmp != NULL; tmp = tmp->next) - { - STATUSBAR_REC *rec = tmp->data; - - if (!rec->right_justify) - { - if (rec->up == up && rec->ypos == ypos && xpos+rec->size < COLS) - { - rec->xpos = xpos; - rec->func(xpos, rec->ypos + (rec->up ? 0 : last_text_line), rec->size); - if (rec->size > 0) xpos += rec->size+1; - } - } - } - - rxpos = COLS-1; - for (tmp = sbars; tmp != NULL; tmp = tmp->next) - { - STATUSBAR_REC *rec = tmp->data; - - if (rec->right_justify) - { - if (rec->up == up && rec->ypos == ypos && rxpos-rec->size > xpos) - { - rec->xpos = rxpos-rec->size; - rec->func(rec->xpos, rec->ypos + (rec->up ? 0 : last_text_line), rec->size); - if (rec->size > 0) rxpos -= rec->size+1; - } - } - } -} - -static void gui_statusbar_redraw_all(void) -{ - gint n; - - screen_refresh_freeze(); - set_bg((1<<4)+15); - for (n = 0; n < first_text_line; n++) - { - move(n, 0); clrtoeol(); - } - for (n = last_text_line; n < LINES-1; n++) - { - move(n, 0); clrtoeol(); - } - set_bg(0); - - for (n = 0; n < LINES-1; n++) - { - gui_statusbar_redraw_line(FALSE, n); - gui_statusbar_redraw_line(TRUE, n); - } - screen_refresh_thaw(); -} - -void gui_statusbar_redraw(gint tag) -{ - GList *tmp; - - if (tag == -1) - { - gui_statusbar_redraw_all(); - return; - } - - for (tmp = sbars; tmp != NULL; tmp = tmp->next) - { - STATUSBAR_REC *rec = tmp->data; - - if (rec->tag == tag) - { - rec->func(rec->xpos, rec->ypos + (rec->up ? 0 : last_text_line), rec->size); - break; - } - } -} - -/* create new statusbar, return position */ -gint gui_statusbar_create(gboolean up) -{ - gint pos; - - pos = up ? first_text_line++ : - (LINES-2)-last_text_line--; - - set_bg((1<<4)+15); - move(up ? pos : last_text_line+pos, 0); clrtoeol(); - set_bg(0); - - gui_windows_resize(-1, FALSE); - return pos; -} - -void gui_statusbar_delete(gboolean up, gint ypos) -{ - GList *tmp, *next; - - if (up && first_text_line > 0) - first_text_line--; - else if (!up && last_text_line < LINES-1) - last_text_line++; - - for (tmp = sbars; tmp != NULL; tmp = next) - { - STATUSBAR_REC *rec = tmp->data; - - next = tmp->next; - if (rec->up == up && rec->ypos == ypos) - gui_statusbar_remove(rec->tag); - else if (rec->up == up && rec->ypos > ypos) - rec->ypos--; - } - - gui_windows_resize(1, FALSE); -} - -/* allocate area in statusbar, returns tag or -1 if failed */ -gint gui_statusbar_allocate(gint size, gboolean right_justify, gboolean up, gint ypos, STATUSBAR_FUNC func) -{ - STATUSBAR_REC *rec; - - g_return_val_if_fail(func != NULL, -1); - - rec = g_new0(STATUSBAR_REC, 1); - sbars = g_list_append(sbars, rec); - - rec->tag = ++sbars_tag; - rec->xpos = -1; - rec->up = up; - rec->ypos = ypos; - rec->size = size; - rec->right_justify = right_justify; - rec->func = func; - - gui_statusbar_redraw_all(); - return rec->tag; -} - -void gui_statusbar_resize(gint tag, gint size) -{ - GList *tmp; - - for (tmp = sbars; tmp != NULL; tmp = tmp->next) - { - STATUSBAR_REC *rec = tmp->data; - - if (rec->tag == tag) - { - rec->size = size; - gui_statusbar_redraw_all(); - break; - } - } -} - -void gui_statusbar_remove(gint tag) -{ - GList *tmp; - - for (tmp = sbars; tmp != NULL; tmp = tmp->next) - { - STATUSBAR_REC *rec = tmp->data; - - if (rec->tag == tag) - { - g_free(rec); - sbars = g_list_remove(sbars, rec); - if (!quitting) gui_statusbar_redraw_all(); - break; - } - } -} - -void gui_statusbar_init(void) -{ - sbars = NULL; - sbars_tag = 0; - - gui_statusbar_create(FALSE); -} - -void gui_statusbar_deinit(void) -{ - gui_statusbar_delete(FALSE, 0); -} diff --git a/src/fe-text/module-formats.h b/src/fe-text/module-formats.h index 32f219e2..39d29182 100644 --- a/src/fe-text/module-formats.h +++ b/src/fe-text/module-formats.h @@ -12,3 +12,5 @@ enum { extern FORMAT_REC gui_text_formats[]; #define MODULE_FORMATS gui_text_formats + +#include "printformat.h" diff --git a/src/fe-text/screen.h b/src/fe-text/screen.h index 3fc5694e..cdb543c1 100644 --- a/src/fe-text/screen.h +++ b/src/fe-text/screen.h @@ -11,18 +11,16 @@ #define ATTR_COLOR8 0x200 #define ATTR_REVERSE 0x400 -extern gboolean use_colors; - -gint init_screen(void); /* Initialize screen, detect screen length */ +int init_screen(void); /* Initialize screen, detect screen length */ void deinit_screen(void); /* Deinitialize screen */ -void set_color(gint col); -void set_bg(gint col); +void set_color(int col); +void set_bg(int col); -void scroll_up(gint y1, gint y2); /* Scroll area up */ -void scroll_down(gint y1, gint y2); /* Scroll area down */ +void scroll_up(int y1, int y2); /* Scroll area up */ +void scroll_down(int y1, int y2); /* Scroll area down */ -void move_cursor(gint y, gint x); +void move_cursor(int y, int x); void screen_refresh_freeze(void); void screen_refresh_thaw(void); diff --git a/src/fe-text/statusbar.c b/src/fe-text/statusbar.c index 24e89107..9e83438c 100644 --- a/src/fe-text/statusbar.c +++ b/src/fe-text/statusbar.c @@ -58,7 +58,7 @@ static void statusbar_redraw_line(STATUSBAR_REC *bar) if (!rec->right_justify && xpos+rec->size < COLS) { rec->xpos = xpos; - func = rec->func; + func = (STATUSBAR_FUNC) rec->func; func(rec, bar->ypos); if (resized) break; @@ -73,7 +73,7 @@ static void statusbar_redraw_line(STATUSBAR_REC *bar) if (rec->right_justify && rxpos-rec->size > xpos) { rec->xpos = rxpos-rec->size; - func = rec->func; + func = (STATUSBAR_FUNC) rec->func; func(rec, bar->ypos); if (resized) break; @@ -131,7 +131,7 @@ void statusbar_item_redraw(SBAR_ITEM_REC *item) g_return_if_fail(item != NULL); - func = item->func; + func = (STATUSBAR_FUNC) item->func; func(item, item->bar->ypos); } @@ -215,7 +215,7 @@ SBAR_ITEM_REC *statusbar_item_create(STATUSBAR_REC *bar, int size, int right_jus rec->xpos = -1; rec->size = size; rec->right_justify = right_justify; - rec->func = func; + rec->func = (void *) func; return rec; } |