From b8b51815544c2a0ad7a294b4c901594378dc3b98 Mon Sep 17 00:00:00 2001 From: erdgeist <> Date: Sun, 29 Jun 2003 18:54:54 +0000 Subject: Added option 'usetopicbar', which defaults to 1 --- vchat-config.h | 1 + vchat-ui.c | 33 +++++++++++++++++++++------------ vchat.h | 4 ++-- 3 files changed, 24 insertions(+), 14 deletions(-) diff --git a/vchat-config.h b/vchat-config.h index ca938b7..8a680de 100755 --- a/vchat-config.h +++ b/vchat-config.h @@ -43,6 +43,7 @@ static volatile configoption configoptions[] = { {CF_USESSL, CO_INT, "usessl", (char *) 1, (char *)-1, (unsigned char **)&usessl }, {CF_USECERT, CO_INT, "usecert", (char *) 1, (char *)-1, NULL }, {CF_USETIME, CO_INT, "usetime", (char *) 1, (char *)-1, (unsigned char **)&usetime }, + {CF_USETOPIC, CO_INT, "usetopicbar",(char *) 1, (char *)-1, NULL }, {CF_PRIVHEIGHT, CO_INT, "messages", (char *) 0, (char *)-1, NULL }, {CF_HSCROLL, CO_INT, "hscroll", (char *) 5, (char *)-1, (unsigned char **)&hscroll }, {CF_CHANNEL, CO_INT, "channel", (char *) 0, (char *)-1, NULL }, diff --git a/vchat-ui.c b/vchat-ui.c index ffac65e..e2b68d1 100755 --- a/vchat-ui.c +++ b/vchat-ui.c @@ -784,7 +784,7 @@ redraw (void) void resize (int signal) { - int xsize,ysize; + int xsize,ysize,topicheight=topic?1:0; //errmsg ("! SIGWINCH raised without code for it, hope you didn't make it smaller ;)"); //endwin(); ttgtsz(&xsize,&ysize); @@ -813,16 +813,18 @@ resize (int signal) wresize(console,1,screensx); wresize(input,1,screensx); if (private && !privwinhidden) - wresize(private,privheight,screensx); - wresize(topic,1,screensx); - wresize(channel, privwinhidden ? screensy - 3 : screensy - (privheight + 3), screensx); + wresize(private,privheight,screensx); + if( topic ) + wresize(topic,1,screensx); + wresize(channel, privwinhidden ? screensy - ( topicheight + 2 ) : screensy - (privheight + ( topicheight + 2 )), screensx); mvwin(console,screensy-2,0); mvwin(input,screensy-1,0); if(private && !privwinhidden) - mvwin(private,0,0); - mvwin(topic,privwinhidden ? 0 : privheight, 0); - mvwin(channel,privwinhidden ? 1 : privheight + 1, 0); + mvwin(private,0,0); + if( topic ) + mvwin(topic,privwinhidden ? 0 : privheight, 0); + mvwin(channel,privwinhidden ? topicheight : privheight + topicheight, 0); drawwin(channel, sb_pub); if(private && !privwinhidden ) @@ -1070,12 +1072,13 @@ initui (void) console = newwin (1, screensx, screensy - 2, 0); input = newwin (1, screensx, screensy - 1, 0); if (privheight) private = newwin (privheight, screensx, 0, 0); - topic = newwin (1, screensx, privheight, 0); + if( private || getintoption(CF_USETOPIC)) + topic = newwin (1, screensx, privheight, 0); channel = newwin (screensy - (privheight+3), screensx, (privheight+1), 0); output = newwin (1, screensx, 1, 0); /* promblems opening windows? bye! */ - if (!console || !input || !topic || !channel || !output ) + if (!console || !input || (!topic && getintoption(CF_USETOPIC))|| !channel || !output || ( !private && privheight )) { fprintf (stderr, "vchat-client: could not open windows, bailing out.\n"); cleanup (0); @@ -1097,19 +1100,22 @@ initui (void) if (has_colors()) { wattrset (console, COLOR_PAIR (9)); wattrset (input, COLOR_PAIR (0)); - wattrset (topic, COLOR_PAIR (9)); wbkgd (output, COLOR_PAIR(8)); wbkgd (console, COLOR_PAIR (9)); wbkgd (channel, COLOR_PAIR (0)); wbkgd (input, COLOR_PAIR (0)); if (private) wbkgd (private, COLOR_PAIR (0)); - wbkgd (topic, COLOR_PAIR (9)); + if( topic ) { + wattrset (topic, COLOR_PAIR (9)); + wbkgd (topic, COLOR_PAIR (9)); + } } else { wattron (console, A_REVERSE); - wattron (topic, A_REVERSE); wattron (output, A_REVERSE); wbkgd(output, A_REVERSE); + if( topic ) + wattron (topic, A_REVERSE); } /* set some options */ @@ -1293,6 +1299,9 @@ topicline (unsigned char *message) int i; ncurs_attr old_att, new_att; + if( !topic ) + return; + memset( &new_att, 0, sizeof(new_att)); BCOLR_SET( (&new_att), 8 ); diff --git a/vchat.h b/vchat.h index c2821a2..b6c4437 100755 --- a/vchat.h +++ b/vchat.h @@ -38,8 +38,8 @@ typedef enum { CO_NIL, CO_STR, CO_INT } conftype; typedef enum { CF_NIL, CF_NICK, CF_FROM, CF_SERVERHOST, CF_SERVERPORT, CF_CIPHERSUITE, CF_CONFIGFILE, CF_CERTFILE, CF_KEYFILE, CF_FORMFILE, CF_LOGFILE, CF_USESSL, CF_USECERT, CF_PRIVHEIGHT, CF_HSCROLL, CF_CHANNEL, CF_USETIME, -CF_SCROLLBPRIV, CF_SCROLLBACK, CF_SCROLLBPRIVT, CF_SCROLLBACKT, CF_KEEPLOG, -CF_ENCODING } confopt; +CF_USETOPIC, CF_SCROLLBPRIV, CF_SCROLLBACK, CF_SCROLLBPRIVT, CF_SCROLLBACKT, +CF_KEEPLOG, CF_ENCODING } confopt; /* format strings */ typedef enum { FS_PLAIN, FS_CHAN, FS_PRIV, FS_SERV, FS_GLOB, FS_DBG, FS_ERR, -- cgit v1.2.3