diff options
Diffstat (limited to 'vchat-ui.c')
-rwxr-xr-x | vchat-ui.c | 101 |
1 files changed, 86 insertions, 15 deletions
@@ -780,21 +780,30 @@ redraw (void) | |||
780 | resize(0); | 780 | resize(0); |
781 | } | 781 | } |
782 | 782 | ||
783 | /* resize display on SIGWINCH */ | 783 | /* resize display on SIGWINCH |
784 | Nowadays used as our main redraw trigger engine */ | ||
784 | void | 785 | void |
785 | resize (int signal) | 786 | resize (int signal) |
786 | { | 787 | { |
787 | int xsize,ysize,topicheight=topic?1:0; | 788 | int xsize,ysize,topicheight=topic?1:0; |
788 | //errmsg ("! SIGWINCH raised without code for it, hope you didn't make it smaller ;)"); | 789 | |
789 | //endwin(); | ||
790 | ttgtsz(&xsize,&ysize); | 790 | ttgtsz(&xsize,&ysize); |
791 | resizeterm(ysize,xsize); | 791 | resizeterm(ysize,xsize); |
792 | //refresh(); | 792 | |
793 | /* store screen-dimensions to local functions */ | 793 | /* store screen-dimensions to local functions */ |
794 | getmaxyx (stdscr, screensy, screensx); | 794 | getmaxyx (stdscr, screensy, screensx); |
795 | 795 | ||
796 | if (!privheight_desired) privheight_desired = getintoption(CF_PRIVHEIGHT); | 796 | /* desired height of PM window is user controllable, |
797 | if ( privheight_desired > screensy - 5) privheight = screensy - 5; else privheight = privheight_desired; | 797 | actual size depends on space available on screen */ |
798 | if (!privheight_desired) | ||
799 | privheight_desired = getintoption(CF_PRIVHEIGHT); | ||
800 | |||
801 | /* Leave at least 5 lines for input, console and | ||
802 | pubchannel */ | ||
803 | if ( privheight_desired > screensy - 5) | ||
804 | privheight = screensy - 5; | ||
805 | else | ||
806 | privheight = privheight_desired; | ||
798 | 807 | ||
799 | /* check dimensions or bump user */ | 808 | /* check dimensions or bump user */ |
800 | if (screensy - privheight < 4) | 809 | if (screensy - privheight < 4) |
@@ -810,31 +819,68 @@ resize (int signal) | |||
810 | cleanup (0); | 819 | cleanup (0); |
811 | } | 820 | } |
812 | 821 | ||
822 | /***** | ||
823 | * Arrange windows on screen | ||
824 | *****/ | ||
825 | |||
826 | /* console and input are always there and always 1 line tall */ | ||
813 | wresize(console,1,screensx); | 827 | wresize(console,1,screensx); |
814 | wresize(input,1,screensx); | 828 | wresize(input,1,screensx); |
829 | |||
830 | /* If we got a private window and it is not hidden, set its size */ | ||
815 | if (private && !privwinhidden) | 831 | if (private && !privwinhidden) |
816 | wresize(private,privheight,screensx); | 832 | wresize(private,privheight,screensx); |
833 | |||
834 | /* If oldschool vchat is not enabled, we have a topic line */ | ||
817 | if( topic ) | 835 | if( topic ) |
818 | wresize(topic,1,screensx); | 836 | wresize(topic,1,screensx); |
819 | wresize(channel, privwinhidden ? screensy - ( topicheight + 2 ) : screensy - (privheight + ( topicheight + 2 )), screensx); | ||
820 | 837 | ||
838 | /* public channel is always their and its height depends on: | ||
839 | * existence and visibility of priv window | ||
840 | * existence of a topic line (oldschool vchat style) | ||
841 | */ | ||
842 | wresize(channel, ( !private || privwinhidden ) ? screensy - ( topicheight + 2 ) : screensy - (privheight + ( topicheight + 2 )), screensx); | ||
843 | |||
844 | /* Console and input alway take bottommost lines */ | ||
821 | mvwin(console,screensy-2,0); | 845 | mvwin(console,screensy-2,0); |
822 | mvwin(input,screensy-1,0); | 846 | mvwin(input,screensy-1,0); |
847 | |||
848 | /* Private window always is top left */ | ||
823 | if(private && !privwinhidden) | 849 | if(private && !privwinhidden) |
824 | mvwin(private,0,0); | 850 | mvwin(private,0,0); |
851 | |||
852 | /* Topic window may not exist without priv window, so it is | ||
853 | safe to assume sane values for privwinhidden and privheight */ | ||
825 | if( topic ) | 854 | if( topic ) |
826 | mvwin(topic,privwinhidden ? 0 : privheight, 0); | 855 | mvwin(topic,privwinhidden ? 0 : privheight, 0); |
827 | mvwin(channel,privwinhidden ? topicheight : privheight + topicheight, 0); | ||
828 | 856 | ||
857 | /* chan window starts below private window and topic line */ | ||
858 | mvwin(channel, ( !private || privwinhidden ) ? topicheight : privheight + topicheight, 0); | ||
859 | |||
860 | /******* | ||
861 | * Now actual redraw starts, note, that we only fill | ||
862 | * curses *WINDOW* buffers, changes reflect on screen | ||
863 | * only, after they've been drawn to curses virtual | ||
864 | * screen buffers by wnoutrefresh and this offscreen | ||
865 | * buffer gets painted to terminal. This is triggered | ||
866 | * by consoleline(), traditionally last window to be | ||
867 | * drawn | ||
868 | ******/ | ||
869 | |||
870 | /* pub channel is always there, paint scrollback buffers */ | ||
829 | drawwin(channel, sb_pub); | 871 | drawwin(channel, sb_pub); |
872 | /* if priv exists and is visible, paint scrollback buffers */ | ||
830 | if(private && !privwinhidden ) | 873 | if(private && !privwinhidden ) |
831 | drawwin(private, sb_priv); | 874 | drawwin(private, sb_priv); |
875 | /* Send window's contents to curses virtual buffers */ | ||
832 | wnoutrefresh(channel); | 876 | wnoutrefresh(channel); |
833 | if(private && !privwinhidden ) | 877 | if(private && !privwinhidden ) |
834 | wnoutrefresh(private); | 878 | wnoutrefresh(private); |
835 | 879 | ||
880 | /* Resize and draw our message window, render topic and | ||
881 | console line */ | ||
836 | if(outputshown) resize_output(); | 882 | if(outputshown) resize_output(); |
837 | topicline(NULL); | 883 | if(topic) topicline(NULL); |
838 | consoleline(NULL); | 884 | consoleline(NULL); |
839 | if(loggedin) vciredraw(); | 885 | if(loggedin) vciredraw(); |
840 | } | 886 | } |
@@ -912,14 +958,31 @@ getsbeheight (struct sb_entry *entry, const int xwidth, int needstime ) | |||
912 | 958 | ||
913 | } | 959 | } |
914 | 960 | ||
961 | /* Check, which kind of filter we have to apply: | ||
962 | white or black listing. As white listing always | ||
963 | superseeds black listing, a single white listing | ||
964 | rule makes the whole filtering type 1. | ||
965 | If no, or only colouring rules have been found, | ||
966 | no line filtering applies. | ||
967 | */ | ||
915 | static int | 968 | static int |
916 | analyzefilters( void ) { | 969 | analyzefilters( void ) { |
917 | filt *filters = filterlist; | 970 | filt *filters = filterlist; |
918 | int type = 0; | 971 | int type = 0; |
919 | 972 | ||
973 | /* Analyzefilters is only being called | ||
974 | after filter list has changed. This | ||
975 | also reflects in resetting the scroll | ||
976 | offset */ | ||
920 | sb_pub->scroll = sb_pub->count; | 977 | sb_pub->scroll = sb_pub->count; |
921 | sb_priv->scroll = sb_priv->count; | 978 | sb_priv->scroll = sb_priv->count; |
922 | 979 | ||
980 | /* To avoid filtering the same line for | ||
981 | identical filter sets, we keep a per | ||
982 | line indicator, which ruleset we | ||
983 | tested the line against. This Stamp | ||
984 | is updated for each change to the | ||
985 | filter list */ | ||
923 | if( ++currentstamp == 0x3fff ) currentstamp = 1; | 986 | if( ++currentstamp == 0x3fff ) currentstamp = 1; |
924 | 987 | ||
925 | while( (type!=1) && filters ) { | 988 | while( (type!=1) && filters ) { |
@@ -969,12 +1032,20 @@ drawwin (WINDOW *win, struct sb_data *sb ) | |||
969 | } | 1032 | } |
970 | } else { | 1033 | } else { |
971 | while( now && (sumlines <= win->_maxy )) { | 1034 | while( now && (sumlines <= win->_maxy )) { |
972 | if ( (now->stamp != currentstamp) && | 1035 | |
973 | ( (now->stamp == (currentstamp | (1<<15))) || testfilter( now ) ) | 1036 | /* If stamp matches exactly, line has been filtered out, since top |
974 | ) | 1037 | bit off means hidden */ |
975 | { | 1038 | if( now->stamp != currentstamp) { |
976 | sumlines += getsbeheight( now, win->_maxx, ((win == channel)||(win == private)) && usetime ); | 1039 | |
977 | vis[ sumbuffers++ ] = now; | 1040 | /* If stamp matches and has top bit set, it has been identified |
1041 | positively. Else stamp does not match and line has to be | ||
1042 | tested against filters, which updates stamp. */ | ||
1043 | if( (now->stamp == (currentstamp | 0x8000) ) || testfilter( now )) | ||
1044 | { | ||
1045 | sumlines += getsbeheight( now, win->_maxx, ((win == channel)||(win == private)) && usetime ); | ||
1046 | vis[ sumbuffers++ ] = now; | ||
1047 | } | ||
1048 | |||
978 | } | 1049 | } |
979 | tmp = now; now = (struct sb_entry*)((unsigned long)now->link ^ (unsigned long)prev); prev = tmp; | 1050 | tmp = now; now = (struct sb_entry*)((unsigned long)now->link ^ (unsigned long)prev); prev = tmp; |
980 | } | 1051 | } |