81 static char *multiline, *multimode_subj; |
81 static char *multiline, *multimode_subj; |
82 int update_roster; |
82 int update_roster; |
83 int utf8_mode = 0; |
83 int utf8_mode = 0; |
84 static bool Autoaway; |
84 static bool Autoaway; |
85 static bool Curses; |
85 static bool Curses; |
|
86 static bool log_win_on_top; |
86 static time_t LastActivity; |
87 static time_t LastActivity; |
87 |
88 |
88 static char inputLine[INPUTLINE_LENGTH+1]; |
89 static char inputLine[INPUTLINE_LENGTH+1]; |
89 static char *ptr_inputline; |
90 static char *ptr_inputline; |
90 static short int inputline_offset; |
91 static short int inputline_offset; |
421 |
422 |
422 tmp = g_new0(winbuf, 1); |
423 tmp = g_new0(winbuf, 1); |
423 |
424 |
424 // Dimensions |
425 // Dimensions |
425 x = Roster_Width; |
426 x = Roster_Width; |
426 y = 0; |
427 if (log_win_on_top) |
|
428 y = Log_Win_Height-1; |
|
429 else |
|
430 y = 0; |
427 lines = CHAT_WIN_HEIGHT; |
431 lines = CHAT_WIN_HEIGHT; |
428 cols = maxX - Roster_Width; |
432 cols = maxX - Roster_Width; |
429 if (cols < 1) cols = 1; |
433 if (cols < 1) cols = 1; |
430 |
434 |
431 tmp->win = newwin(lines, cols, y, x); |
435 tmp->win = newwin(lines, cols, y, x); |
768 // |
772 // |
769 void scr_DrawMainWindow(unsigned int fullinit) |
773 void scr_DrawMainWindow(unsigned int fullinit) |
770 { |
774 { |
771 int requested_size; |
775 int requested_size; |
772 gchar *ver, *message; |
776 gchar *ver, *message; |
|
777 int chat_y_pos, chatstatus_y_pos, log_y_pos; |
773 |
778 |
774 Log_Win_Height = DEFAULT_LOG_WIN_HEIGHT; |
779 Log_Win_Height = DEFAULT_LOG_WIN_HEIGHT; |
775 requested_size = settings_opt_get_int("log_win_height"); |
780 requested_size = settings_opt_get_int("log_win_height"); |
776 if (requested_size > 0) { |
781 if (requested_size > 0) { |
777 if (maxY > requested_size + 3) |
782 if (maxY > requested_size + 3) |
801 Roster_Width = 2; |
806 Roster_Width = 2; |
802 else |
807 else |
803 Roster_Width = DEFAULT_ROSTER_WIDTH; |
808 Roster_Width = DEFAULT_ROSTER_WIDTH; |
804 } |
809 } |
805 |
810 |
|
811 log_win_on_top = (settings_opt_get_int("log_win_on_top") == 1); |
|
812 |
|
813 if (log_win_on_top) { |
|
814 chat_y_pos = Log_Win_Height-1; |
|
815 log_y_pos = 0; |
|
816 chatstatus_y_pos = Log_Win_Height-2; |
|
817 } else { |
|
818 chat_y_pos = 0; |
|
819 log_y_pos = CHAT_WIN_HEIGHT+1; |
|
820 chatstatus_y_pos = CHAT_WIN_HEIGHT; |
|
821 } |
|
822 |
806 if (fullinit) { |
823 if (fullinit) { |
807 /* Create windows */ |
824 /* Create windows */ |
808 rosterWnd = newwin(CHAT_WIN_HEIGHT, Roster_Width, 0, 0); |
825 rosterWnd = newwin(CHAT_WIN_HEIGHT, Roster_Width, chat_y_pos, 0); |
809 chatWnd = newwin(CHAT_WIN_HEIGHT, maxX - Roster_Width, 0, Roster_Width); |
826 chatWnd = newwin(CHAT_WIN_HEIGHT, maxX - Roster_Width, chat_y_pos, |
810 logWnd = newwin(Log_Win_Height-2, maxX, CHAT_WIN_HEIGHT+1, 0); |
827 Roster_Width); |
811 chatstatusWnd = newwin(1, maxX, CHAT_WIN_HEIGHT, 0); |
828 logWnd = newwin(Log_Win_Height-2, maxX, log_y_pos, 0); |
|
829 chatstatusWnd = newwin(1, maxX, chatstatus_y_pos, 0); |
812 mainstatusWnd = newwin(1, maxX, maxY-2, 0); |
830 mainstatusWnd = newwin(1, maxX, maxY-2, 0); |
813 inputWnd = newwin(1, maxX, maxY-1, 0); |
831 inputWnd = newwin(1, maxX, maxY-1, 0); |
814 if (!rosterWnd || !chatWnd || !logWnd || !inputWnd) { |
832 if (!rosterWnd || !chatWnd || !logWnd || !inputWnd) { |
815 scr_TerminateCurses(); |
833 scr_TerminateCurses(); |
816 fprintf(stderr, "Cannot create windows!\n"); |
834 fprintf(stderr, "Cannot create windows!\n"); |
823 wbkgd(mainstatusWnd, get_color(COLOR_STATUS)); |
841 wbkgd(mainstatusWnd, get_color(COLOR_STATUS)); |
824 } else { |
842 } else { |
825 /* Resize/move windows */ |
843 /* Resize/move windows */ |
826 wresize(rosterWnd, CHAT_WIN_HEIGHT, Roster_Width); |
844 wresize(rosterWnd, CHAT_WIN_HEIGHT, Roster_Width); |
827 wresize(chatWnd, CHAT_WIN_HEIGHT, maxX - Roster_Width); |
845 wresize(chatWnd, CHAT_WIN_HEIGHT, maxX - Roster_Width); |
828 mvwin(chatWnd, 0, Roster_Width); |
|
829 |
|
830 wresize(logWnd, Log_Win_Height-2, maxX); |
846 wresize(logWnd, Log_Win_Height-2, maxX); |
831 mvwin(logWnd, CHAT_WIN_HEIGHT+1, 0); |
847 |
|
848 mvwin(chatWnd, chat_y_pos, Roster_Width); |
|
849 mvwin(rosterWnd, chat_y_pos, 0); |
|
850 mvwin(logWnd, log_y_pos, 0); |
832 |
851 |
833 // Resize & move chat status window |
852 // Resize & move chat status window |
834 wresize(chatstatusWnd, 1, maxX); |
853 wresize(chatstatusWnd, 1, maxX); |
835 mvwin(chatstatusWnd, CHAT_WIN_HEIGHT, 0); |
854 mvwin(chatstatusWnd, chatstatus_y_pos, 0); |
836 // Resize & move main status window |
855 // Resize & move main status window |
837 wresize(mainstatusWnd, 1, maxX); |
856 wresize(mainstatusWnd, 1, maxX); |
838 mvwin(mainstatusWnd, maxY-2, 0); |
857 mvwin(mainstatusWnd, maxY-2, 0); |
839 // Resize & move input line window |
858 // Resize & move input line window |
840 wresize(inputWnd, 1, maxX); |
859 wresize(inputWnd, 1, maxX); |
896 } |
915 } |
897 |
916 |
898 static inline void resize_win_buffer(winbuf *wbp, int x, int y, |
917 static inline void resize_win_buffer(winbuf *wbp, int x, int y, |
899 int lines, int cols) |
918 int lines, int cols) |
900 { |
919 { |
|
920 int chat_y_pos; |
|
921 |
|
922 if (log_win_on_top) |
|
923 chat_y_pos = Log_Win_Height-1; |
|
924 else |
|
925 chat_y_pos = 0; |
|
926 |
901 // Resize/move buddy window |
927 // Resize/move buddy window |
902 wresize(wbp->win, lines, cols); |
928 wresize(wbp->win, lines, cols); |
903 mvwin(wbp->win, 0, Roster_Width); |
929 mvwin(wbp->win, chat_y_pos, Roster_Width); |
904 werase(wbp->win); |
930 werase(wbp->win); |
905 // If a panel exists, replace the old window with the new |
931 // If a panel exists, replace the old window with the new |
906 if (wbp->panel) |
932 if (wbp->panel) |
907 replace_panel(wbp->panel, wbp->win); |
933 replace_panel(wbp->panel, wbp->win); |
908 // Redo line wrapping |
934 // Redo line wrapping |