diff options
Diffstat (limited to 'vchat-ui.c')
| -rwxr-xr-x | vchat-ui.c | 70 |
1 files changed, 35 insertions, 35 deletions
| @@ -174,8 +174,8 @@ linecomplete (char *line) | |||
| 174 | 174 | ||
| 175 | /* wipe input line and reset cursor */ | 175 | /* wipe input line and reset cursor */ |
| 176 | wmove (input, 0, 0); | 176 | wmove (input, 0, 0); |
| 177 | for (i = 0; i < input->_maxx; i++) | 177 | for (i = 0; i < getmaxx(input); i++) |
| 178 | waddch (input, ' '); | 178 | waddch (input, ' '); |
| 179 | wmove (input, 0, 0); | 179 | wmove (input, 0, 0); |
| 180 | wrefresh (input); | 180 | wrefresh (input); |
| 181 | } | 181 | } |
| @@ -198,22 +198,22 @@ vciredraw (void) | |||
| 198 | /* calculate horizontal scrolling offset */ | 198 | /* calculate horizontal scrolling offset */ |
| 199 | if (rl_point - scroff < 0) | 199 | if (rl_point - scroff < 0) |
| 200 | scroff = rl_point - 4; | 200 | scroff = rl_point - 4; |
| 201 | if (rl_point - scroff > input->_maxx) | 201 | if (rl_point - scroff > getmaxx(input)) |
| 202 | scroff = rl_point - input->_maxx + 2; | 202 | scroff = rl_point - getmaxx(input) + 2; |
| 203 | if (rl_point - scroff > input->_maxx - (hscroll - 2)) | 203 | if (rl_point - scroff > getmaxx(input) - (hscroll - 2)) |
| 204 | scroff += hscroll; | 204 | scroff += hscroll; |
| 205 | else if (rl_point - scroff < input->_maxx - (hscroll + 2)) | 205 | else if (rl_point - scroff < getmaxx(input) - (hscroll + 2)) |
| 206 | scroff -= hscroll; | 206 | scroff -= hscroll; |
| 207 | if (scroff < 0) | 207 | if (scroff < 0) |
| 208 | scroff = 0; | 208 | scroff = 0; |
| 209 | 209 | ||
| 210 | /* wipe input line */ | 210 | /* wipe input line */ |
| 211 | wmove (input, 0, 0); | 211 | wmove (input, 0, 0); |
| 212 | for (i = 0; i < input->_maxx; i++) | 212 | for (i = 0; i < getmaxx(input); i++) |
| 213 | waddch (input, ' '); | 213 | waddch (input, ' '); |
| 214 | 214 | ||
| 215 | /* show current line, move cursor, redraw! */ | 215 | /* show current line, move cursor, redraw! */ |
| 216 | mvwaddnstr (input, 0, 0, &rl_line_buffer[scroff], input->_maxx); | 216 | mvwaddnstr (input, 0, 0, &rl_line_buffer[scroff], getmaxx(input)); |
| 217 | wmove (input, 0, rl_point - scroff); | 217 | wmove (input, 0, rl_point - scroff); |
| 218 | wrefresh (input); | 218 | wrefresh (input); |
| 219 | } | 219 | } |
| @@ -488,15 +488,15 @@ writescr ( WINDOW *win, struct sb_entry *entry ) { | |||
| 488 | } | 488 | } |
| 489 | } | 489 | } |
| 490 | 490 | ||
| 491 | if (win->_curx) waddch(win,'\n'); | 491 | if (getcurx(win)) waddch(win,'\n'); |
| 492 | 492 | ||
| 493 | for( i = 0; i < charcount; i++ ) { | 493 | for( i = 0; i < charcount; i++ ) { |
| 494 | /* on start of line or attribute changes set new attribute */ | 494 | /* on start of line or attribute changes set new attribute */ |
| 495 | if( !i || memcmp( attrbuffer+i, attrbuffer+i-1, sizeof(ncurs_attr))) | 495 | if( !i || memcmp( attrbuffer+i, attrbuffer+i-1, sizeof(ncurs_attr))) |
| 496 | WATTR_SET( win, attrbuffer[i]); | 496 | WATTR_SET( win, attrbuffer[i]); |
| 497 | if( textbuffer[ i ] == ' ') { | 497 | if( textbuffer[ i ] == ' ') { |
| 498 | if ((calcdrawcus(textbuffer+i+1) + win->_curx > win->_maxx - 1)&& | 498 | if ((calcdrawcus(textbuffer+i+1) + getcurx(win) > getmaxx(win) - 1)&& |
| 499 | (calcdrawcus(textbuffer+i+1) < win->_maxx)) { | 499 | (calcdrawcus(textbuffer+i+1) < getmaxx(win))) { |
| 500 | /* line wrap found */ | 500 | /* line wrap found */ |
| 501 | WATTR_SET( win, orgattr); | 501 | WATTR_SET( win, orgattr); |
| 502 | waddstr( win, "\n "); | 502 | waddstr( win, "\n "); |
| @@ -532,7 +532,7 @@ doscroll ( int up ) { | |||
| 532 | WINDOW *destwin = (sb_win && private) ? private : channel; | 532 | WINDOW *destwin = (sb_win && private) ? private : channel; |
| 533 | struct sb_data *sb = (sb_win && private) ? sb_priv : sb_pub; | 533 | struct sb_data *sb = (sb_win && private) ? sb_priv : sb_pub; |
| 534 | struct sb_entry *now = sb->entries, *prev = NULL, *tmp; | 534 | struct sb_entry *now = sb->entries, *prev = NULL, *tmp; |
| 535 | int lines = destwin->_maxy>>1; | 535 | int lines = getmaxy(destwin)>>1; |
| 536 | 536 | ||
| 537 | if( sb->scroll != sb->count ) | 537 | if( sb->scroll != sb->count ) |
| 538 | while( now && (now->id != sb->scroll) ) { | 538 | while( now && (now->id != sb->scroll) ) { |
| @@ -547,7 +547,7 @@ doscroll ( int up ) { | |||
| 547 | while( now && (lines > 0)) { | 547 | while( now && (lines > 0)) { |
| 548 | if ( (!filtertype) || ( (now->stamp != currentstamp) && ( (now->stamp == (currentstamp | (1<<15))) || testfilter( now ) ) ) ) | 548 | if ( (!filtertype) || ( (now->stamp != currentstamp) && ( (now->stamp == (currentstamp | (1<<15))) || testfilter( now ) ) ) ) |
| 549 | { | 549 | { |
| 550 | lines -= getsbeheight( now, destwin->_maxx, usetime ); | 550 | lines -= getsbeheight( now, getmaxx(destwin), usetime ); |
| 551 | } | 551 | } |
| 552 | tmp = now; now = (struct sb_entry*)((unsigned long)now->link ^ (unsigned long)prev); prev = tmp; | 552 | tmp = now; now = (struct sb_entry*)((unsigned long)now->link ^ (unsigned long)prev); prev = tmp; |
| 553 | } | 553 | } |
| @@ -674,7 +674,7 @@ clearpriv () | |||
| 674 | 674 | ||
| 675 | /* clear window, move cursor to bottom, redraw */ | 675 | /* clear window, move cursor to bottom, redraw */ |
| 676 | wclear (dest); | 676 | wclear (dest); |
| 677 | wmove (dest, dest->_maxy, dest->_maxx); | 677 | wmove (dest, getmaxy(dest), getmaxx(dest)); |
| 678 | wrefresh (dest); | 678 | wrefresh (dest); |
| 679 | 679 | ||
| 680 | } | 680 | } |
| @@ -685,7 +685,7 @@ clearchan () | |||
| 685 | { | 685 | { |
| 686 | /* clear window, move cursor to bottom, redraw */ | 686 | /* clear window, move cursor to bottom, redraw */ |
| 687 | wclear (channel); | 687 | wclear (channel); |
| 688 | wmove (channel, channel->_maxy, channel->_maxx); | 688 | wmove (channel, getmaxy(channel), getmaxx(channel)); |
| 689 | wrefresh (channel); | 689 | wrefresh (channel); |
| 690 | } | 690 | } |
| 691 | 691 | ||
| @@ -972,7 +972,7 @@ drawwin (WINDOW *win, struct sb_data *sb ) | |||
| 972 | { | 972 | { |
| 973 | if (win) { | 973 | if (win) { |
| 974 | struct sb_entry *now = sb->entries, *prev = NULL, *tmp; | 974 | struct sb_entry *now = sb->entries, *prev = NULL, *tmp; |
| 975 | struct sb_entry *vis[win->_maxy + 1]; | 975 | struct sb_entry *vis[getmaxy(win) + 1]; |
| 976 | int sumlines = 0, sumbuffers = 0; | 976 | int sumlines = 0, sumbuffers = 0; |
| 977 | 977 | ||
| 978 | /* public scrollback */ | 978 | /* public scrollback */ |
| @@ -982,13 +982,13 @@ drawwin (WINDOW *win, struct sb_data *sb ) | |||
| 982 | } | 982 | } |
| 983 | 983 | ||
| 984 | if( (win == output) || (filtertype == 0)) { | 984 | if( (win == output) || (filtertype == 0)) { |
| 985 | while( now && (sumlines <= win->_maxy )) { | 985 | while( now && (sumlines <= getmaxy(win) )) { |
| 986 | sumlines += getsbeheight( now, win->_maxx, ((win == channel)||(win == private)) && usetime ); | 986 | sumlines += getsbeheight( now, getmaxx(win), ((win == channel)||(win == private)) && usetime ); |
| 987 | vis[ sumbuffers++ ] = now; | 987 | vis[ sumbuffers++ ] = now; |
| 988 | tmp = now; now = (struct sb_entry*)((unsigned long)now->link ^ (unsigned long)prev); prev = tmp; | 988 | tmp = now; now = (struct sb_entry*)((unsigned long)now->link ^ (unsigned long)prev); prev = tmp; |
| 989 | } | 989 | } |
| 990 | } else { | 990 | } else { |
| 991 | while( now && (sumlines <= win->_maxy )) { | 991 | while( now && (sumlines <= getmaxy(win) )) { |
| 992 | 992 | ||
| 993 | /* If stamp matches exactly, line has been filtered out, since top | 993 | /* If stamp matches exactly, line has been filtered out, since top |
| 994 | bit off means hidden */ | 994 | bit off means hidden */ |
| @@ -999,7 +999,7 @@ drawwin (WINDOW *win, struct sb_data *sb ) | |||
| 999 | tested against filters, which updates stamp. */ | 999 | tested against filters, which updates stamp. */ |
| 1000 | if( (now->stamp == (currentstamp | 0x8000) ) || testfilter( now )) | 1000 | if( (now->stamp == (currentstamp | 0x8000) ) || testfilter( now )) |
| 1001 | { | 1001 | { |
| 1002 | sumlines += getsbeheight( now, win->_maxx, ((win == channel)||(win == private)) && usetime ); | 1002 | sumlines += getsbeheight( now, getmaxx(win), ((win == channel)||(win == private)) && usetime ); |
| 1003 | vis[ sumbuffers++ ] = now; | 1003 | vis[ sumbuffers++ ] = now; |
| 1004 | } | 1004 | } |
| 1005 | 1005 | ||
| @@ -1009,11 +1009,11 @@ drawwin (WINDOW *win, struct sb_data *sb ) | |||
| 1009 | } | 1009 | } |
| 1010 | 1010 | ||
| 1011 | /* If buffer is not completely filled, clear window */ | 1011 | /* If buffer is not completely filled, clear window */ |
| 1012 | if( sumlines < win->_maxy + 1 ) | 1012 | if( sumlines < getmaxy(win) + 1 ) |
| 1013 | wclear(win); | 1013 | wclear(win); |
| 1014 | 1014 | ||
| 1015 | /* Move pointer to bottom to let curses scroll */ | 1015 | /* Move pointer to bottom to let curses scroll */ |
| 1016 | wmove(win, win->_maxy, win->_maxx); | 1016 | wmove(win, getmaxy(win), getmaxx(win)); |
| 1017 | 1017 | ||
| 1018 | /* Plot visible lines */ | 1018 | /* Plot visible lines */ |
| 1019 | while (sumbuffers--) writescr( win, vis[sumbuffers] ); | 1019 | while (sumbuffers--) writescr( win, vis[sumbuffers] ); |
| @@ -1275,7 +1275,7 @@ consoleline (char *message) | |||
| 1275 | WATTR_GET( console, old_att); | 1275 | WATTR_GET( console, old_att); |
| 1276 | if(sb_pub->scroll!=sb_pub->count) WATTR_SET( console, new_att); | 1276 | if(sb_pub->scroll!=sb_pub->count) WATTR_SET( console, new_att); |
| 1277 | 1277 | ||
| 1278 | for (i = 0; i < console->_maxx; i++) | 1278 | for (i = 0; i < getmaxx(console); i++) |
| 1279 | waddch (console, ' '); | 1279 | waddch (console, ' '); |
| 1280 | 1280 | ||
| 1281 | if( !message && usetime ) | 1281 | if( !message && usetime ) |
| @@ -1284,14 +1284,14 @@ consoleline (char *message) | |||
| 1284 | time_t now = time(NULL); | 1284 | time_t now = time(NULL); |
| 1285 | strftime( date, sizeof(date), getformatstr(FS_CONSOLETIME), localtime(&now)); | 1285 | strftime( date, sizeof(date), getformatstr(FS_CONSOLETIME), localtime(&now)); |
| 1286 | snprintf( tmpstr, TMPSTRSIZE, "%s%s", date, consolestr); | 1286 | snprintf( tmpstr, TMPSTRSIZE, "%s%s", date, consolestr); |
| 1287 | mvwaddnstr (console, 0, 0, tmpstr, console->_maxx); | 1287 | mvwaddnstr (console, 0, 0, tmpstr, getmaxx(console)); |
| 1288 | } else { | 1288 | } else { |
| 1289 | mvwaddnstr (console, 0, 0, message ? message : consolestr, console->_maxx); | 1289 | mvwaddnstr (console, 0, 0, message ? message : consolestr, getmaxx(console)); |
| 1290 | } | 1290 | } |
| 1291 | 1291 | ||
| 1292 | snprintf(tmpstr,TMPSTRSIZE,getformatstr(FS_SBINF),sb_pub->scroll,sb_pub->count); | 1292 | snprintf(tmpstr,TMPSTRSIZE,getformatstr(FS_SBINF),sb_pub->scroll,sb_pub->count); |
| 1293 | mvwaddstr (console, 0, console->_maxx - (strlen(tmpstr)-1),tmpstr); | 1293 | mvwaddstr (console, 0, getmaxx(console) - (strlen(tmpstr)-1),tmpstr); |
| 1294 | if (sb_win == 0) mvwaddch (console, 0, console->_maxx,'*'); | 1294 | if (sb_win == 0) mvwaddch (console, 0, getmaxx(console),'*'); |
| 1295 | 1295 | ||
| 1296 | WATTR_SET( console, old_att); | 1296 | WATTR_SET( console, old_att); |
| 1297 | 1297 | ||
| @@ -1328,13 +1328,13 @@ topicline (char *message) | |||
| 1328 | if( private && (sb_priv->scroll!=sb_priv->count)) | 1328 | if( private && (sb_priv->scroll!=sb_priv->count)) |
| 1329 | WATTR_SET( topic, new_att); | 1329 | WATTR_SET( topic, new_att); |
| 1330 | 1330 | ||
| 1331 | for (i = 0; i < topic->_maxx; i++) | 1331 | for (i = 0; i < getmaxx(topic); i++) |
| 1332 | waddch (topic, ' '); | 1332 | waddch (topic, ' '); |
| 1333 | mvwaddnstr (topic, 0, 0, message ? message : topicstr, topic->_maxx); | 1333 | mvwaddnstr (topic, 0, 0, message ? message : topicstr, getmaxx(topic)); |
| 1334 | if (private) { | 1334 | if (private) { |
| 1335 | snprintf(tmpstr,TMPSTRSIZE,getformatstr(FS_SBINF),sb_priv->scroll,sb_priv->count); | 1335 | snprintf(tmpstr,TMPSTRSIZE,getformatstr(FS_SBINF),sb_priv->scroll,sb_priv->count); |
| 1336 | mvwaddstr (topic, 0, topic->_maxx - (strlen(tmpstr)-1),tmpstr); | 1336 | mvwaddstr (topic, 0, getmaxx(topic) - (strlen(tmpstr)-1),tmpstr); |
| 1337 | if (sb_win == 1) mvwaddch (topic, 0, topic->_maxx,'*'); | 1337 | if (sb_win == 1) mvwaddch (topic, 0, getmaxx(topic),'*'); |
| 1338 | } | 1338 | } |
| 1339 | WATTR_SET( topic, old_att); | 1339 | WATTR_SET( topic, old_att); |
| 1340 | 1340 | ||
| @@ -1403,13 +1403,13 @@ vcnredraw (void) | |||
| 1403 | 1403 | ||
| 1404 | /* wipe input line and reset cursor */ | 1404 | /* wipe input line and reset cursor */ |
| 1405 | wmove(input, 0, 0); | 1405 | wmove(input, 0, 0); |
| 1406 | for (i = 0; i < input->_maxx; i++) | 1406 | for (i = 0; i < getmaxx(input); i++) |
| 1407 | waddch(input, ' '); | 1407 | waddch(input, ' '); |
| 1408 | wmove(input, 0, 0); | 1408 | wmove(input, 0, 0); |
| 1409 | 1409 | ||
| 1410 | /* draw as many stars as there are characters */ | 1410 | /* draw as many stars as there are characters */ |
| 1411 | mvwaddnstr(input, 0, 0, &passbof[rl_point%2], 12); | 1411 | mvwaddnstr(input, 0, 0, &passbof[rl_point%2], 12); |
| 1412 | wmove(input, 0, input->_maxx); | 1412 | wmove(input, 0, getmaxx(input)); |
| 1413 | wrefresh(input); | 1413 | wrefresh(input); |
| 1414 | } | 1414 | } |
| 1415 | 1415 | ||
| @@ -1451,7 +1451,7 @@ passprompt (char *buf, int size, int rwflag, void *userdata) | |||
| 1451 | 1451 | ||
| 1452 | /* wipe input line and reset cursor */ | 1452 | /* wipe input line and reset cursor */ |
| 1453 | wmove (input, 0, 0); | 1453 | wmove (input, 0, 0); |
| 1454 | for (i = 0; i < input->_maxx; i++) | 1454 | for (i = 0; i < getmaxx(input); i++) |
| 1455 | waddch (input, ' '); | 1455 | waddch (input, ' '); |
| 1456 | wmove (input, 0, 0); | 1456 | wmove (input, 0, 0); |
| 1457 | wrefresh (input); | 1457 | wrefresh (input); |
| @@ -1563,7 +1563,7 @@ removefilter( char *tail ) { | |||
| 1563 | if(!rmv) { | 1563 | if(!rmv) { |
| 1564 | val = strtol(tail, &end, 10); | 1564 | val = strtol(tail, &end, 10); |
| 1565 | if( (tail != end) && (!*end) ) | 1565 | if( (tail != end) && (!*end) ) |
| 1566 | rmv = removefromfilterlist( test_numericrm, (void *)val, 0); | 1566 | rmv = removefromfilterlist( test_numericrm, (void *)(uintptr_t)val, 0); |
| 1567 | } | 1567 | } |
| 1568 | 1568 | ||
| 1569 | if( rmv ) { | 1569 | if( rmv ) { |
