62 int COLOR_ATTRIB[COLOR_max]; |
62 int COLOR_ATTRIB[COLOR_max]; |
63 |
63 |
64 #define get_color(col) (COLOR_PAIR(col)|COLOR_ATTRIB[col]) |
64 #define get_color(col) (COLOR_PAIR(col)|COLOR_ATTRIB[col]) |
65 #define compose_color(col) (COLOR_PAIR(col->color_pair)|col->color_attrib) |
65 #define compose_color(col) (COLOR_PAIR(col->color_pair)|col->color_attrib) |
66 |
66 |
67 #define DEFAULT_LOG_WIN_HEIGHT (5+2) |
67 #define DEFAULT_LOG_WIN_HEIGHT (5) |
68 #define DEFAULT_ROSTER_WIDTH 24 |
68 #define DEFAULT_ROSTER_WIDTH 24 |
69 #define CHAT_WIN_HEIGHT (maxY-1-Log_Win_Height) |
69 #define CHAT_WIN_HEIGHT (maxY-2-1-Log_Win_Height) |
70 |
70 |
71 #define DEFAULT_ATTENTION_CHAR '!' |
71 #define DEFAULT_ATTENTION_CHAR '!' |
72 |
72 |
73 const char *LocaleCharSet = "C"; |
73 const char *LocaleCharSet = "C"; |
74 |
74 |
931 return maxY - Log_Win_Height - 3; |
931 return maxY - Log_Win_Height - 3; |
932 } |
932 } |
933 |
933 |
934 guint scr_getlogwinheight(void) |
934 guint scr_getlogwinheight(void) |
935 { |
935 { |
936 if (Log_Win_Height >= 2) |
936 return Log_Win_Height; |
937 return Log_Win_Height - 2; |
|
938 return 0; |
|
939 } |
937 } |
940 |
938 |
941 // scr_print_logwindow(string) |
939 // scr_print_logwindow(string) |
942 // Display the string in the log window. |
940 // Display the string in the log window. |
943 // Note: The string must be in the user's locale! |
941 // Note: The string must be in the user's locale! |
1687 |
1685 |
1688 Log_Win_Height = DEFAULT_LOG_WIN_HEIGHT; |
1686 Log_Win_Height = DEFAULT_LOG_WIN_HEIGHT; |
1689 requested_size = settings_opt_get_int("log_win_height"); |
1687 requested_size = settings_opt_get_int("log_win_height"); |
1690 if (requested_size > 0) { |
1688 if (requested_size > 0) { |
1691 if (maxY > requested_size + 3) |
1689 if (maxY > requested_size + 3) |
1692 Log_Win_Height = requested_size + 2; |
1690 Log_Win_Height = requested_size; |
1693 else |
1691 else |
1694 Log_Win_Height = ((maxY > 5) ? (maxY - 2) : 3); |
1692 Log_Win_Height = ((maxY > 5) ? (maxY - 4) : 1); |
1695 } else if (requested_size < 0) { |
1693 } else if (requested_size < 0) { |
1696 Log_Win_Height = 3; |
1694 Log_Win_Height = 1; |
1697 } |
1695 } |
1698 |
1696 |
1699 if (maxY < Log_Win_Height+2) { |
1697 if (maxY < Log_Win_Height+4) { |
1700 if (maxY < 5) { |
1698 if (maxY < 5) { |
1701 Log_Win_Height = 3; |
1699 Log_Win_Height = 1; |
1702 maxY = Log_Win_Height+2; |
1700 maxY = 5; |
1703 } else { |
1701 } else { |
1704 Log_Win_Height = maxY - 2; |
1702 Log_Win_Height = maxY - 4; |
1705 } |
1703 } |
1706 } |
1704 } |
1707 |
1705 |
1708 if (roster_hidden) { |
1706 if (roster_hidden) { |
1709 Roster_Width = 0; |
1707 Roster_Width = 0; |
1719 |
1717 |
1720 log_win_on_top = (settings_opt_get_int("log_win_on_top") == 1); |
1718 log_win_on_top = (settings_opt_get_int("log_win_on_top") == 1); |
1721 roster_win_on_right = (settings_opt_get_int("roster_win_on_right") == 1); |
1719 roster_win_on_right = (settings_opt_get_int("roster_win_on_right") == 1); |
1722 |
1720 |
1723 if (log_win_on_top) { |
1721 if (log_win_on_top) { |
1724 chat_y_pos = Log_Win_Height-1; |
|
1725 log_y_pos = 0; |
1722 log_y_pos = 0; |
1726 chatstatus_y_pos = Log_Win_Height-2; |
1723 chatstatus_y_pos = Log_Win_Height; |
|
1724 chat_y_pos = Log_Win_Height + 1; |
1727 } else { |
1725 } else { |
1728 chat_y_pos = 0; |
1726 chat_y_pos = 0; |
1729 log_y_pos = CHAT_WIN_HEIGHT+1; |
|
1730 chatstatus_y_pos = CHAT_WIN_HEIGHT; |
1727 chatstatus_y_pos = CHAT_WIN_HEIGHT; |
|
1728 log_y_pos = CHAT_WIN_HEIGHT + 1; |
1731 } |
1729 } |
1732 |
1730 |
1733 if (roster_win_on_right) { |
1731 if (roster_win_on_right) { |
1734 roster_x_pos = maxX - Roster_Width; |
1732 roster_x_pos = maxX - Roster_Width; |
1735 chat_x_pos = 0; |
1733 chat_x_pos = 0; |
1746 rosterWnd = newwin(CHAT_WIN_HEIGHT, Roster_Width, chat_y_pos, roster_x_pos); |
1744 rosterWnd = newwin(CHAT_WIN_HEIGHT, Roster_Width, chat_y_pos, roster_x_pos); |
1747 chatWnd = newwin(CHAT_WIN_HEIGHT, maxX - Roster_Width, chat_y_pos, |
1745 chatWnd = newwin(CHAT_WIN_HEIGHT, maxX - Roster_Width, chat_y_pos, |
1748 chat_x_pos); |
1746 chat_x_pos); |
1749 activechatWnd = newwin(CHAT_WIN_HEIGHT, maxX - Roster_Width, chat_y_pos, |
1747 activechatWnd = newwin(CHAT_WIN_HEIGHT, maxX - Roster_Width, chat_y_pos, |
1750 chat_x_pos); |
1748 chat_x_pos); |
1751 logWnd = newwin(Log_Win_Height-2, maxX, log_y_pos, 0); |
1749 logWnd = newwin(Log_Win_Height, maxX, log_y_pos, 0); |
1752 chatstatusWnd = newwin(1, maxX, chatstatus_y_pos, 0); |
1750 chatstatusWnd = newwin(1, maxX, chatstatus_y_pos, 0); |
1753 mainstatusWnd = newwin(1, maxX, maxY-2, 0); |
1751 mainstatusWnd = newwin(1, maxX, maxY-2, 0); |
1754 inputWnd = newwin(1, maxX, maxY-1, 0); |
1752 inputWnd = newwin(1, maxX, maxY-1, 0); |
1755 if (!rosterWnd || !chatWnd || !logWnd || !inputWnd) { |
1753 if (!rosterWnd || !chatWnd || !logWnd || !inputWnd) { |
1756 scr_terminate_curses(); |
1754 scr_terminate_curses(); |
1765 wbkgd(mainstatusWnd, get_color(COLOR_STATUS)); |
1763 wbkgd(mainstatusWnd, get_color(COLOR_STATUS)); |
1766 } else { |
1764 } else { |
1767 /* Resize/move windows */ |
1765 /* Resize/move windows */ |
1768 wresize(rosterWnd, CHAT_WIN_HEIGHT, Roster_Width); |
1766 wresize(rosterWnd, CHAT_WIN_HEIGHT, Roster_Width); |
1769 wresize(chatWnd, CHAT_WIN_HEIGHT, maxX - Roster_Width); |
1767 wresize(chatWnd, CHAT_WIN_HEIGHT, maxX - Roster_Width); |
1770 wresize(logWnd, Log_Win_Height-2, maxX); |
1768 wresize(logWnd, Log_Win_Height, maxX); |
1771 |
1769 |
1772 mvwin(chatWnd, chat_y_pos, chat_x_pos); |
1770 mvwin(chatWnd, chat_y_pos, chat_x_pos); |
1773 mvwin(rosterWnd, chat_y_pos, roster_x_pos); |
1771 mvwin(rosterWnd, chat_y_pos, roster_x_pos); |
1774 mvwin(logWnd, log_y_pos, 0); |
1772 mvwin(logWnd, log_y_pos, 0); |
1775 |
1773 |