diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2008-10-12 19:20:26 +0200 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2008-10-12 19:20:26 +0200 |
commit | c83eef6e82ab85fba79b2043282c6b185cbef9db (patch) | |
tree | c0d02282f6de0706bbc2fa6eaaef0b32db1a7da0 /src | |
parent | f6073c80765cda45af6b4518fd3b3d4c3506b1d3 (diff) | |
download | weechat-c83eef6e82ab85fba79b2043282c6b185cbef9db.zip |
Remove old title/nicklist/status/input, use of new bars
Diffstat (limited to 'src')
39 files changed, 173 insertions, 2311 deletions
diff --git a/src/core/wee-command.c b/src/core/wee-command.c index f9a2037c6..3fdc1a836 100644 --- a/src/core/wee-command.c +++ b/src/core/wee-command.c @@ -53,7 +53,6 @@ #include "../gui/gui-keyboard.h" #include "../gui/gui-layout.h" #include "../gui/gui-main.h" -#include "../gui/gui-status.h" #include "../gui/gui-window.h" #include "../plugins/plugin.h" #include "../plugins/plugin-config.h" @@ -303,7 +302,7 @@ command_bar (void *data, struct t_gui_buffer *buffer, { gui_bar_free_all (); gui_chat_printf (NULL, _("All bars have been deleted")); - //gui_bar_create_default (); + gui_bar_create_default_input (); } else { @@ -318,6 +317,7 @@ command_bar (void *data, struct t_gui_buffer *buffer, } gui_bar_free (ptr_bar); gui_chat_printf (NULL, _("Bar deleted")); + gui_bar_create_default_input (); } return WEECHAT_RC_OK; @@ -589,7 +589,6 @@ command_buffer (void *data, struct t_gui_buffer *buffer, return WEECHAT_RC_ERROR; } gui_buffer_close (buffer, 1); - gui_status_refresh_needed = 1; gui_buffer_ask_input_refresh (gui_current_window->buffer, 1); return WEECHAT_RC_OK; @@ -685,7 +684,6 @@ command_buffer (void *data, struct t_gui_buffer *buffer, { gui_window_switch_to_buffer (gui_current_window, ptr_buffer); - gui_status_refresh_needed = 1; } } @@ -2709,48 +2707,6 @@ command_window (void *data, struct t_gui_buffer *buffer, return WEECHAT_RC_OK; } - /* scroll topic left for current window */ - if (string_strcasecmp (argv[1], "scroll_topic_left") == 0) - { - gui_window_scroll_topic_left (gui_current_window); - return WEECHAT_RC_OK; - } - - /* scroll topic right for current window */ - if (string_strcasecmp (argv[1], "scroll_topic_right") == 0) - { - gui_window_scroll_topic_right (gui_current_window); - return WEECHAT_RC_OK; - } - - /* page up for nicklist in current window */ - if (string_strcasecmp (argv[1], "nicklist_page_up") == 0) - { - gui_window_nicklist_page_up (gui_current_window); - return WEECHAT_RC_OK; - } - - /* page down for nicklist in current window */ - if (string_strcasecmp (argv[1], "nicklist_page_down") == 0) - { - gui_window_nicklist_page_down (gui_current_window); - return WEECHAT_RC_OK; - } - - /* beginning of nicklist for current window */ - if (string_strcasecmp (argv[1], "nicklist_beginning") == 0) - { - gui_window_nicklist_beginning (gui_current_window); - return WEECHAT_RC_OK; - } - - /* end of nicklist for current window */ - if (string_strcasecmp (argv[1], "nicklist_end") == 0) - { - gui_window_nicklist_end (gui_current_window); - return WEECHAT_RC_OK; - } - /* refresh screen */ if (string_strcasecmp (argv[1], "refresh") == 0) { @@ -2967,8 +2923,9 @@ command_init () " scroll to end of nicklist on current buffer:\n" " /bar scroll nicklist * ye"), "add|default|del|set|hide|show|scroll|list|listfull|" - "listitems %r name|priority|conditions|position|filling|" - "size|separator|items", + "listitems %r name|hidden|priority|conditions|position|" + "filling_top_bottom|filling_left_right|size|size_max|" + "color_fg|color_delim|color_bg|separator|items", &command_bar, NULL); hook_command (NULL, "buffer", N_("manage buffers"), diff --git a/src/core/wee-config.c b/src/core/wee-config.c index 5c721efc9..730f03549 100644 --- a/src/core/wee-config.c +++ b/src/core/wee-config.c @@ -50,7 +50,6 @@ #include "../gui/gui-keyboard.h" #include "../gui/gui-layout.h" #include "../gui/gui-nicklist.h" -#include "../gui/gui-status.h" #include "../gui/gui-window.h" #include "../plugins/plugin.h" @@ -294,7 +293,6 @@ config_change_hotlist (void *data, struct t_config_option *option) (void) option; gui_hotlist_resort (); - gui_status_refresh_needed = 1; } /* @@ -481,7 +479,7 @@ config_weechat_reload (void *data, struct t_config_file *config_file) if (rc == WEECHAT_CONFIG_READ_OK) { gui_bar_use_temp_bars (); - //gui_bar_create_default (); + gui_bar_create_default (); } return rc; @@ -1107,7 +1105,7 @@ config_weechat_init () weechat_config_file, ptr_section, "title", "color", N_("text color for title bar"), - NULL, GUI_COLOR_TITLE, 0, "default", + NULL, -1, 0, "default", NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_title_bg = config_file_new_option ( weechat_config_file, ptr_section, @@ -1331,7 +1329,7 @@ config_weechat_init () weechat_config_file, ptr_section, "status", "color", N_("text color for status bar"), - NULL, GUI_COLOR_STATUS, 0, "default", + NULL, -1, 0, "default", NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_status_bg = config_file_new_option ( weechat_config_file, ptr_section, @@ -1343,57 +1341,57 @@ config_weechat_init () weechat_config_file, ptr_section, "status_delimiters", "color", N_("text color for status bar delimiters"), - NULL, GUI_COLOR_STATUS_DELIMITERS, 0, "cyan", + NULL, -1, 0, "cyan", NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_status_number = config_file_new_option ( weechat_config_file, ptr_section, "status_number", "color", N_("text color for current buffer number in status bar"), - NULL, GUI_COLOR_STATUS_NUMBER, 0, "yellow", + NULL, -1, 0, "yellow", NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_status_name = config_file_new_option ( weechat_config_file, ptr_section, "status_name", "color", N_("text color for current buffer name in status bar"), - NULL, GUI_COLOR_STATUS_NAME, 0, "white", + NULL, -1, 0, "white", NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_status_data_msg = config_file_new_option ( weechat_config_file, ptr_section, "status_data_msg", "color", N_("text color for buffer with new messages (status bar)"), - NULL, GUI_COLOR_STATUS_DATA_MSG, 0, "yellow", + NULL, -1, 0, "yellow", NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_status_data_private = config_file_new_option ( weechat_config_file, ptr_section, "status_data_private", "color", N_("text color for buffer with private message (status bar)"), - NULL, GUI_COLOR_STATUS_DATA_PRIVATE, 0, "lightgreen", + NULL, -1, 0, "lightgreen", NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_status_data_highlight = config_file_new_option ( weechat_config_file, ptr_section, "status_data_highlight", "color", N_("text color for buffer with highlight (status bar)"), - NULL, GUI_COLOR_STATUS_DATA_HIGHLIGHT, 0, "lightmagenta", + NULL, -1, 0, "lightmagenta", NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_status_data_other = config_file_new_option ( weechat_config_file, ptr_section, "status_data_other", "color", N_("text color for buffer with new data (not messages) " "(status bar)"), - NULL, GUI_COLOR_STATUS_DATA_OTHER, 0, "default", + NULL, -1, 0, "default", NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_status_more = config_file_new_option ( weechat_config_file, ptr_section, "status_more", "color", N_("text color for buffer with new data (status bar)"), - NULL, GUI_COLOR_STATUS_MORE, 0, "yellow", + NULL, -1, 0, "yellow", NULL, NULL, &config_change_color, NULL, NULL, NULL); /* input window */ config_color_input = config_file_new_option ( weechat_config_file, ptr_section, "input", "color", N_("text color for input line"), - NULL, GUI_COLOR_INPUT, 0, "default", + NULL, -1, 0, "default", NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_input_bg = config_file_new_option ( weechat_config_file, ptr_section, @@ -1405,44 +1403,44 @@ config_weechat_init () weechat_config_file, ptr_section, "input_server", "color", N_("text color for server name in input line"), - NULL, GUI_COLOR_INPUT_SERVER, 0, "brown", + NULL, -1, 0, "brown", NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_input_channel = config_file_new_option ( weechat_config_file, ptr_section, "input_channel", "color", N_("text color for channel name in input line"), - NULL, GUI_COLOR_INPUT_CHANNEL, 0, "white", + NULL, -1, 0, "white", NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_input_nick = config_file_new_option ( weechat_config_file, ptr_section, "input_nick", "color", N_("text color for nick name in input line"), - NULL, GUI_COLOR_INPUT_NICK, 0, "lightcyan", + NULL, -1, 0, "lightcyan", NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_input_delimiters = config_file_new_option ( weechat_config_file, ptr_section, "input_delimiters", "color", N_("text color for delimiters in input line"), - NULL, GUI_COLOR_INPUT_DELIMITERS, 0, "cyan", + NULL, -1, 0, "cyan", NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_input_text_not_found = config_file_new_option ( weechat_config_file, ptr_section, "input_text_not_found", "color", N_("text color for unsucessful text search in input line"), - NULL, GUI_COLOR_INPUT_TEXT_NOT_FOUND, 0, "red", + NULL, -1, 0, "red", NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_input_actions = config_file_new_option ( weechat_config_file, ptr_section, "input_actions", "color", N_("text color for actions in input line"), - NULL, GUI_COLOR_INPUT_ACTIONS, 0, "lightgreen", + NULL, -1, 0, "lightgreen", NULL, NULL, &config_change_color, NULL, NULL, NULL); /* nicklist window */ config_color_nicklist = config_file_new_option ( weechat_config_file, ptr_section, "nicklist", "color", N_("text color for nicklist"), - NULL, GUI_COLOR_NICKLIST, 0, "default", + NULL, -1, 0, "default", NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_nicklist_bg = config_file_new_option ( weechat_config_file, ptr_section, @@ -1454,55 +1452,55 @@ config_weechat_init () weechat_config_file, ptr_section, "nicklist_group", "color", N_("text color for groups in nicklist"), - NULL, GUI_COLOR_NICKLIST_GROUP, 0, "green", + NULL, -1, 0, "green", NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_nicklist_away = config_file_new_option ( weechat_config_file, ptr_section, "nicklist_away", "color", N_("text color for away nicknames"), - NULL, GUI_COLOR_NICKLIST_AWAY, 0, "cyan", + NULL, -1, 0, "cyan", NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_nicklist_prefix1 = config_file_new_option ( weechat_config_file, ptr_section, "nicklist_prefix1", "color", N_("text color for prefix #1 in nicklist"), - NULL, GUI_COLOR_NICKLIST_PREFIX1, 0, "lightgreen", + NULL, -1, 0, "lightgreen", NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_nicklist_prefix2 = config_file_new_option ( weechat_config_file, ptr_section, "nicklist_prefix2", "color", N_("text color for prefix #2 in nicklist"), - NULL, GUI_COLOR_NICKLIST_PREFIX2, 0, "lightmagenta", + NULL, -1, 0, "lightmagenta", NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_nicklist_prefix3 = config_file_new_option ( weechat_config_file, ptr_section, "nicklist_prefix3", "color", N_("text color for prefix #3 in nicklist"), - NULL, GUI_COLOR_NICKLIST_PREFIX3, 0, "yellow", + NULL, -1, 0, "yellow", NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_nicklist_prefix4 = config_file_new_option ( weechat_config_file, ptr_section, "nicklist_prefix4", "color", N_("text color for prefix #4 in nicklist"), - NULL, GUI_COLOR_NICKLIST_PREFIX4, 0, "blue", + NULL, -1, 0, "blue", NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_nicklist_prefix5 = config_file_new_option ( weechat_config_file, ptr_section, "nicklist_prefix5", "color", N_("text color for prefix #5 in nicklist"), - NULL, GUI_COLOR_NICKLIST_PREFIX5, 0, "brown", + NULL, -1, 0, "brown", NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_nicklist_more = config_file_new_option ( weechat_config_file, ptr_section, "nicklist_more", "color", N_("text color for '+' when scrolling nicks in nicklist"), - NULL, GUI_COLOR_NICKLIST_MORE, 0, "lightmagenta", + NULL, -1, 0, "lightmagenta", NULL, NULL, &config_change_color, NULL, NULL, NULL); config_color_nicklist_separator = config_file_new_option ( weechat_config_file, ptr_section, "nicklist_separator", "color", N_("text color for nicklist separator"), - NULL, GUI_COLOR_NICKLIST_SEPARATOR, 0, "blue", + NULL, -1, 0, "blue", NULL, NULL, &config_change_color, NULL, NULL, NULL); /* completion */ @@ -1761,7 +1759,7 @@ config_weechat_read () { config_change_day_change (NULL, NULL); gui_bar_use_temp_bars (); - //gui_bar_create_default (); + gui_bar_create_default (); } return rc; diff --git a/src/core/wee-upgrade.c b/src/core/wee-upgrade.c index 3df61740d..3d32cdd2d 100644 --- a/src/core/wee-upgrade.c +++ b/src/core/wee-upgrade.c @@ -419,7 +419,7 @@ upgrade_weechat_read_cb (int object_id, case UPGRADE_WEECHAT_TYPE_HOTLIST: if (!hotlist_reset) { - gui_hotlist_free_all (&gui_hotlist, &last_gui_hotlist); + gui_hotlist_clear (); hotlist_reset = 1; } ptr_buffer = gui_buffer_search_by_number (infolist_integer (infolist, "buffer_number")); diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt index b4e044a58..b2c7ea39e 100644 --- a/src/gui/CMakeLists.txt +++ b/src/gui/CMakeLists.txt @@ -29,7 +29,6 @@ gui-keyboard.c gui-keyboard.h gui-layout.c gui-layout.h gui-main.h gui-nicklist.c gui-nicklist.h -gui-status.c gui-status.h gui-window.c gui-window.h) INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}) diff --git a/src/gui/Makefile.am b/src/gui/Makefile.am index 707c0d5b6..203b85ff9 100644 --- a/src/gui/Makefile.am +++ b/src/gui/Makefile.am @@ -43,12 +43,10 @@ lib_weechat_gui_common_a_SOURCES = gui-bar.c \ gui-layout.c \ gui-layout.h \ gui-main.h \ - gui-status.c \ - gui-status.h \ - gui-window.c \ - gui-window.h \ gui-nicklist.c \ - gui-nicklist.h + gui-nicklist.h \ + gui-window.c \ + gui-window.h if GUI_NCURSES curses_dir=curses diff --git a/src/gui/curses/CMakeLists.txt b/src/gui/curses/CMakeLists.txt index bdfd9d256..1b7a779bc 100644 --- a/src/gui/curses/CMakeLists.txt +++ b/src/gui/curses/CMakeLists.txt @@ -19,8 +19,7 @@ if(COMMAND cmake_policy) endif(COMMAND cmake_policy) SET(WEECHAT_CURSES_SRC gui-curses-bar.c gui-curses-chat.c gui-curses-color.c -gui-curses-input.c gui-curses-keyboard.c gui-curses-main.c -gui-curses-nicklist.c gui-curses-status.c gui-curses-window.c gui-curses.h) +gui-curses-keyboard.c gui-curses-main.c gui-curses-window.c gui-curses.h) SET(EXECUTABLE weechat-curses) diff --git a/src/gui/curses/Makefile.am b/src/gui/curses/Makefile.am index 19bc31384..8ea78e799 100644 --- a/src/gui/curses/Makefile.am +++ b/src/gui/curses/Makefile.am @@ -31,10 +31,7 @@ weechat_curses_LDADD = ./../../core/lib_weechat_core.a \ weechat_curses_SOURCES = gui-curses-bar.c \ gui-curses-chat.c \ gui-curses-color.c \ - gui-curses-input.c \ gui-curses-keyboard.c \ gui-curses-main.c \ - gui-curses-nicklist.c \ - gui-curses-status.c \ gui-curses-window.c \ gui-curses.h diff --git a/src/gui/curses/gui-curses-chat.c b/src/gui/curses/gui-curses-chat.c index ac2dc76cb..709c230dc 100644 --- a/src/gui/curses/gui-curses-chat.c +++ b/src/gui/curses/gui-curses-chat.c @@ -43,91 +43,6 @@ /* - * gui_chat_draw_title: draw title window for a buffer - */ - -void -gui_chat_draw_title (struct t_gui_buffer *buffer, int erase) -{ - struct t_gui_window *ptr_win; - char format[32], *buf, *title_decoded, *ptr_title; - - if (!gui_ok) - return; - - title_decoded = (buffer->title) ? - (char *)gui_color_decode ((unsigned char *)buffer->title) : NULL; - - for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window) - { - if (ptr_win->buffer == buffer) - { - if (erase) - gui_window_clear_weechat (GUI_CURSES(ptr_win)->win_title, - GUI_COLOR_TITLE); - - snprintf (format, sizeof (format), "%%-%ds", ptr_win->win_title_width); - wmove (GUI_CURSES(ptr_win)->win_title, 0, 0); - - if (title_decoded) - { - ptr_title = utf8_add_offset (title_decoded, - ptr_win->win_title_start); - if (!ptr_title || !ptr_title[0]) - { - ptr_win->win_title_start = 0; - ptr_title = title_decoded; - } - buf = string_iconv_from_internal (NULL, - ptr_title); - if (buf) - ptr_title = buf; - - if (ptr_win->win_title_start > 0) - { - //gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_title, - // GUI_COLOR_TITLE_MORE); - wprintw (GUI_CURSES(ptr_win)->win_title, "%s", "++"); - } - - if (utf8_strlen_screen (ptr_title) > ptr_win->win_width) - { - gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_title, - GUI_COLOR_TITLE); - wprintw (GUI_CURSES(ptr_win)->win_title, "%s", ptr_title); - //gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_title, - // GUI_COLOR_TITLE_MORE); - mvwprintw (GUI_CURSES(ptr_win)->win_title, 0, - ptr_win->win_width - 2, - "%s", "++"); - } - else - { - gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_title, - GUI_COLOR_TITLE); - wprintw (GUI_CURSES(ptr_win)->win_title, "%s", ptr_title); - } - if (buf) - free (buf); - } - else - { - gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_title, - GUI_COLOR_TITLE); - wprintw (GUI_CURSES(ptr_win)->win_title, format, " "); - } - wnoutrefresh (GUI_CURSES(ptr_win)->win_title); - refresh (); - } - } - - if (title_decoded) - free (title_decoded); - - buffer->title_refresh_needed = 0; -} - -/* * gui_chat_get_real_width: return real width: width - 1 if nicklist is at right, * for good copy/paste (without nicklist separator) */ @@ -417,13 +332,15 @@ gui_chat_string_next_char (struct t_gui_window *window, /* * gui_chat_display_word_raw: display word on chat buffer, letter by letter * special chars like color, bold, .. are interpreted + * return number of chars displayed on screen */ -void +int gui_chat_display_word_raw (struct t_gui_window *window, const char *string, int max_chars_on_screen, int display) { - char *next_char, *output, utf_char[16], chars_displayed, size_on_screen; + char *next_char, *output, utf_char[16]; + int chars_displayed, size_on_screen; if (display) wmove (GUI_CURSES(window)->win_chat, @@ -437,7 +354,7 @@ gui_chat_display_word_raw (struct t_gui_window *window, const char *string, string = gui_chat_string_next_char (window, (unsigned char *)string, 1); if (!string) - return; + return chars_displayed; next_char = utf8_next_char (string); if (display && next_char) @@ -450,7 +367,7 @@ gui_chat_display_word_raw (struct t_gui_window *window, const char *string, if (max_chars_on_screen > 0) { if (chars_displayed + size_on_screen > max_chars_on_screen) - return; + return chars_displayed; chars_displayed += size_on_screen; } if (size_on_screen > 0) @@ -467,7 +384,7 @@ gui_chat_display_word_raw (struct t_gui_window *window, const char *string, if (max_chars_on_screen > 0) { if (chars_displayed + 1 > max_chars_on_screen) - return; + return chars_displayed; chars_displayed++; } wprintw (GUI_CURSES(window)->win_chat, "."); @@ -476,6 +393,8 @@ gui_chat_display_word_raw (struct t_gui_window *window, const char *string, string = next_char; } + + return chars_displayed; } /* @@ -971,10 +890,11 @@ gui_chat_display_line_y (struct t_gui_window *window, struct t_gui_line *line, window->win_chat_cursor_x); wclrtoeol (GUI_CURSES(window)->win_chat); - gui_chat_display_word_raw (window, line->message, - window->win_chat_width, 1); - - gui_window_clrtoeol_with_current_bg (GUI_CURSES(window)->win_chat); + if (gui_chat_display_word_raw (window, line->message, + window->win_chat_width, 1) < window->win_chat_width) + { + gui_window_clrtoeol_with_current_bg (GUI_CURSES(window)->win_chat); + } } /* @@ -1196,7 +1116,7 @@ gui_chat_draw (struct t_gui_buffer *buffer, int erase) WEECHAT_HOOK_SIGNAL_POINTER, ptr_win); } - if (!ptr_win->scroll) + if (!ptr_win->scroll && ptr_win->scroll_reset_allowed) { ptr_win->start_line = NULL; ptr_win->start_line_pos = 0; @@ -1209,6 +1129,9 @@ gui_chat_draw (struct t_gui_buffer *buffer, int erase) ptr_win->win_chat_cursor_x = 0; ptr_win->win_chat_cursor_y = ptr_win->win_chat_height - 1; } + + ptr_win->scroll_reset_allowed = 0; + break; case GUI_BUFFER_TYPE_FREE: /* display at position of scrolling */ diff --git a/src/gui/curses/gui-curses-color.c b/src/gui/curses/gui-curses-color.c index e0ace0a4f..a22553e93 100644 --- a/src/gui/curses/gui-curses-color.c +++ b/src/gui/curses/gui-curses-color.c @@ -356,8 +356,6 @@ gui_color_init_weechat () gui_color_build (GUI_COLOR_SEPARATOR, CONFIG_COLOR(config_color_separator), CONFIG_COLOR(config_color_chat_bg)); - gui_color_build (GUI_COLOR_TITLE, CONFIG_COLOR(config_color_title), CONFIG_COLOR(config_color_title_bg)); - gui_color_build (GUI_COLOR_CHAT, CONFIG_COLOR(config_color_chat), CONFIG_COLOR(config_color_chat_bg)); gui_color_build (GUI_COLOR_CHAT_TIME, CONFIG_COLOR(config_color_chat_time), CONFIG_COLOR(config_color_chat_bg)); gui_color_build (GUI_COLOR_CHAT_TIME_DELIMITERS, CONFIG_COLOR(config_color_chat_time_delimiters), CONFIG_COLOR(config_color_chat_bg)); @@ -383,35 +381,6 @@ gui_color_init_weechat () gui_color_build (GUI_COLOR_CHAT_HIGHLIGHT, CONFIG_COLOR(config_color_chat_highlight), CONFIG_COLOR(config_color_chat_highlight_bg)); gui_color_build (GUI_COLOR_CHAT_READ_MARKER, CONFIG_COLOR(config_color_chat_read_marker), CONFIG_COLOR(config_color_chat_read_marker_bg)); gui_color_build (GUI_COLOR_CHAT_TEXT_FOUND, CONFIG_COLOR(config_color_chat_text_found), CONFIG_COLOR(config_color_chat_text_found_bg)); - - gui_color_build (GUI_COLOR_STATUS, CONFIG_COLOR(config_color_status), CONFIG_COLOR(config_color_status_bg)); - gui_color_build (GUI_COLOR_STATUS_DELIMITERS, CONFIG_COLOR(config_color_status_delimiters), CONFIG_COLOR(config_color_status_bg)); - gui_color_build (GUI_COLOR_STATUS_NUMBER, CONFIG_COLOR(config_color_status_number), CONFIG_COLOR(config_color_status_bg)); - gui_color_build (GUI_COLOR_STATUS_NAME, CONFIG_COLOR(config_color_status_name), CONFIG_COLOR(config_color_status_bg)); - gui_color_build (GUI_COLOR_STATUS_DATA_MSG, CONFIG_COLOR(config_color_status_data_msg), CONFIG_COLOR(config_color_status_bg)); - gui_color_build (GUI_COLOR_STATUS_DATA_PRIVATE, CONFIG_COLOR(config_color_status_data_private), CONFIG_COLOR(config_color_status_bg)); - gui_color_build (GUI_COLOR_STATUS_DATA_HIGHLIGHT, CONFIG_COLOR(config_color_status_data_highlight), CONFIG_COLOR(config_color_status_bg)); - gui_color_build (GUI_COLOR_STATUS_DATA_OTHER, CONFIG_COLOR(config_color_status_data_other), CONFIG_COLOR(config_color_status_bg)); - gui_color_build (GUI_COLOR_STATUS_MORE, CONFIG_COLOR(config_color_status_more), CONFIG_COLOR(config_color_status_bg)); - - gui_color_build (GUI_COLOR_INPUT, CONFIG_COLOR(config_color_input), CONFIG_COLOR(config_color_input_bg)); - gui_color_build (GUI_COLOR_INPUT_SERVER, CONFIG_COLOR(config_color_input_server), CONFIG_COLOR(config_color_input_bg)); - gui_color_build (GUI_COLOR_INPUT_CHANNEL, CONFIG_COLOR(config_color_input_channel), CONFIG_COLOR(config_color_input_bg)); - gui_color_build (GUI_COLOR_INPUT_NICK, CONFIG_COLOR(config_color_input_nick), CONFIG_COLOR(config_color_input_bg)); - gui_color_build (GUI_COLOR_INPUT_DELIMITERS, CONFIG_COLOR(config_color_input_delimiters), CONFIG_COLOR(config_color_input_bg)); - gui_color_build (GUI_COLOR_INPUT_TEXT_NOT_FOUND, CONFIG_COLOR(config_color_input_text_not_found), CONFIG_COLOR(config_color_input_bg)); - gui_color_build (GUI_COLOR_INPUT_ACTIONS, CONFIG_COLOR(config_color_input_actions), CONFIG_COLOR(config_color_input_bg)); - - gui_color_build (GUI_COLOR_NICKLIST, CONFIG_COLOR(config_color_nicklist), CONFIG_COLOR(config_color_nicklist_bg)); - gui_color_build (GUI_COLOR_NICKLIST_GROUP, CONFIG_COLOR(config_color_nicklist_group), CONFIG_COLOR(config_color_nicklist_bg)); - gui_color_build (GUI_COLOR_NICKLIST_AWAY, CONFIG_COLOR(config_color_nicklist_away), CONFIG_COLOR(config_color_nicklist_bg)); - gui_color_build (GUI_COLOR_NICKLIST_PREFIX1, CONFIG_COLOR(config_color_nicklist_prefix1), CONFIG_COLOR(config_color_nicklist_bg)); - gui_color_build (GUI_COLOR_NICKLIST_PREFIX2, CONFIG_COLOR(config_color_nicklist_prefix2), CONFIG_COLOR(config_color_nicklist_bg)); - gui_color_build (GUI_COLOR_NICKLIST_PREFIX3, CONFIG_COLOR(config_color_nicklist_prefix3), CONFIG_COLOR(config_color_nicklist_bg)); - gui_color_build (GUI_COLOR_NICKLIST_PREFIX4, CONFIG_COLOR(config_color_nicklist_prefix4), CONFIG_COLOR(config_color_nicklist_bg)); - gui_color_build (GUI_COLOR_NICKLIST_PREFIX5, CONFIG_COLOR(config_color_nicklist_prefix5), CONFIG_COLOR(config_color_nicklist_bg)); - gui_color_build (GUI_COLOR_NICKLIST_MORE, CONFIG_COLOR(config_color_nicklist_more), CONFIG_COLOR(config_color_nicklist_bg)); - gui_color_build (GUI_COLOR_NICKLIST_SEPARATOR, CONFIG_COLOR(config_color_nicklist_separator), CONFIG_COLOR(config_color_nicklist_bg)); } /* diff --git a/src/gui/curses/gui-curses-input.c b/src/gui/curses/gui-curses-input.c deleted file mode 100644 index be0a79da5..000000000 --- a/src/gui/curses/gui-curses-input.c +++ /dev/null @@ -1,374 +0,0 @@ -/* - * Copyright (c) 2003-2008 by FlashCode <flashcode@flashtux.org> - * See README for License detail, AUTHORS for developers list. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -/* gui-curses-input: input display functions for Curses GUI */ - - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <stdlib.h> -#include <string.h> - -#include "../../core/weechat.h" -#include "../../core/wee-config.h" -#include "../../core/wee-string.h" -#include "../../core/wee-utf8.h" -#include "../../plugins/plugin.h" -#include "../gui-input.h" -#include "../gui-buffer.h" -#include "../gui-color.h" -#include "../gui-keyboard.h" -#include "../gui-main.h" -#include "../gui-window.h" -#include "gui-curses.h" - - -/* - * gui_input_set_color: set color for an input window - */ - -void -gui_input_set_color (struct t_gui_window *window, int color) -{ - int fg, bg; - - fg = gui_weechat_colors[color].foreground; - bg = gui_color[GUI_COLOR_INPUT]->background; - - if (gui_weechat_colors[color].attributes & A_BOLD) - wattron (GUI_CURSES(window)->win_input, A_BOLD); - - if (((fg == -1) || (fg == 99)) - && ((bg == -1) || (bg == 99))) - wattron (GUI_CURSES(window)->win_input, COLOR_PAIR(63)); - else - { - if ((fg == -1) || (fg == 99)) - fg = COLOR_WHITE; - if ((bg == -1) || (bg == 99)) - bg = 0; - wattron (GUI_CURSES(window)->win_input, COLOR_PAIR((bg * 8) + fg)); - } -} - -/* - * gui_input_draw_prompt: display input prompt - * return: # chars displayed on screen (one UTF-8 char - * may be displayed on more than 1 char on screen) - */ - -void -gui_input_draw_prompt (struct t_gui_window *window) -{ - char *pos, saved_char, *buf; - int char_size; - - wmove (GUI_CURSES(window)->win_input, 0, 0); - - if (window->buffer->text_search != GUI_TEXT_SEARCH_DISABLED) - { - gui_window_set_weechat_color (GUI_CURSES(window)->win_input, - GUI_COLOR_INPUT); - wprintw (GUI_CURSES(window)->win_input, "%s", - (window->buffer->text_search_exact) ? - _("Text search (exact): ") : _("Text search: ")); - return; - } - - pos = CONFIG_STRING(config_look_input_format); - while (pos && pos[0]) - { - switch (pos[0]) - { - case '%': - pos++; - switch (pos[0]) - { - case 'c': /* buffer name */ - if (window->buffer->name) - { - gui_window_set_weechat_color (GUI_CURSES(window)->win_input, - GUI_COLOR_INPUT_CHANNEL); - buf = string_iconv_from_internal (NULL, - window->buffer->name); - wprintw (GUI_CURSES(window)->win_input, "%s", - (buf) ? buf : window->buffer->name); - if (buf) - free (buf); - } - pos++; - break; - case 'm': /* nick modes */ - /*if (GUI_SERVER(window->buffer) && GUI_SERVER(window->buffer)->is_connected) - { - if (GUI_SERVER(window->buffer)->nick_modes - && GUI_SERVER(window->buffer)->nick_modes[0]) - { - gui_window_set_weechat_color (GUI_CURSES(window)->win_input, - GUI_COLOR_WIN_INPUT); - wprintw (GUI_CURSES(window)->win_input, "%s", - GUI_SERVER(window->buffer)->nick_modes); - } - }*/ - pos++; - break; - case 'n': /* nick */ - if (window->buffer->input_nick) - { - gui_window_set_weechat_color (GUI_CURSES(window)->win_input, - GUI_COLOR_INPUT_NICK); - buf = string_iconv_from_internal (NULL, - window->buffer->input_nick); - wprintw (GUI_CURSES(window)->win_input, "%s", - (buf) ? buf : window->buffer->input_nick); - if (buf) - free (buf); - } - pos++; - break; - default: - if (pos[0]) - { - char_size = utf8_char_size (pos); - saved_char = pos[char_size]; - pos[char_size] = '\0'; - gui_window_set_weechat_color (GUI_CURSES(window)->win_input, - GUI_COLOR_INPUT_DELIMITERS); - wprintw (GUI_CURSES(window)->win_input, "%%%s", pos); - pos[char_size] = saved_char; - pos += char_size; - } - else - { - wprintw (GUI_CURSES(window)->win_input, "%%"); - pos++; - } - break; - } - break; - default: - char_size = utf8_char_size (pos); - saved_char = pos[char_size]; - pos[char_size] = '\0'; - gui_window_set_weechat_color (GUI_CURSES(window)->win_input, - GUI_COLOR_INPUT_DELIMITERS); - wprintw (GUI_CURSES(window)->win_input, "%s", pos); - pos[char_size] = saved_char; - pos += char_size; - break; - } - } -} - -/* - * gui_input_draw_text: display text in input buffer, according to color mask - * return: offset for cursor position on screen (one UTF-8 - * char may be displayed on more than 1 char on screen) - */ - -int -gui_input_draw_text (struct t_gui_window *window, int input_width) -{ - char *ptr_start, *ptr_next, saved_char, *output, *ptr_string; - int pos_mask, size, last_color, color, count_cursor, offset_cursor; - - ptr_start = utf8_add_offset (window->buffer->input_buffer, - window->buffer->input_buffer_1st_display); - pos_mask = ptr_start - window->buffer->input_buffer; - last_color = -1; - count_cursor = window->buffer->input_buffer_pos - - window->buffer->input_buffer_1st_display; - offset_cursor = 0; - if (window->buffer->text_search != GUI_TEXT_SEARCH_DISABLED) - { - if (window->buffer->text_search_found) - gui_window_set_weechat_color (GUI_CURSES(window)->win_input, - GUI_COLOR_INPUT); - else - gui_window_set_weechat_color (GUI_CURSES(window)->win_input, - GUI_COLOR_INPUT_TEXT_NOT_FOUND); - } - while ((input_width > 0) && ptr_start && ptr_start[0]) - { - ptr_next = utf8_next_char (ptr_start); - if (ptr_next) - { - saved_char = ptr_next[0]; - ptr_next[0] = '\0'; - size = ptr_next - ptr_start; - if (window->buffer->text_search == GUI_TEXT_SEARCH_DISABLED) - { - if (window->buffer->input_buffer_color_mask[pos_mask] != ' ') - color = window->buffer->input_buffer_color_mask[pos_mask] - '0'; - else - color = -1; - if (color != last_color) - { - if (color == -1) - gui_window_set_weechat_color (GUI_CURSES(window)->win_input, - GUI_COLOR_INPUT); - else - gui_input_set_color (window, color); - } - last_color = color; - } - output = string_iconv_from_internal (NULL, ptr_start); - - ptr_string = (output) ? output : ptr_start; - - if ((((unsigned char)ptr_string[0]) < 32) && (!ptr_string[1])) - { - wattron (GUI_CURSES(window)->win_input, A_REVERSE); - wprintw (GUI_CURSES(window)->win_input, "%c", - 'A' + ((unsigned char)ptr_string[0]) - 1); - wattroff (GUI_CURSES(window)->win_input, A_REVERSE); - if (count_cursor > 0) - { - offset_cursor++; - count_cursor--; - } - } - else - { - wprintw (GUI_CURSES(window)->win_input, "%s", ptr_string); - if (count_cursor > 0) - { - offset_cursor += utf8_strlen_screen (ptr_start); - count_cursor--; - } - } - - if (output) - free (output); - - ptr_next[0] = saved_char; - ptr_start = ptr_next; - pos_mask += size; - } - else - ptr_start = NULL; - input_width--; - } - return offset_cursor; -} - -/* - * gui_input_draw: draw input window for a buffer - */ - -void -gui_input_draw (struct t_gui_buffer *buffer, int erase) -{ - struct t_gui_window *ptr_win; - char format[32]; - int prompt_length, display_prompt, offset_cursor; - - if (!gui_ok) - return; - - for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window) - { - if (ptr_win->buffer == buffer) - { - if (erase) - gui_window_clear_weechat (GUI_CURSES(ptr_win)->win_input, - GUI_COLOR_INPUT); - - if (gui_keyboard_paste_pending) - { - wmove (GUI_CURSES(ptr_win)->win_input, 0, 0); - gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_input, - GUI_COLOR_INPUT_ACTIONS); - gui_window_wprintw (GUI_CURSES(ptr_win)->win_input, - _(" Paste %d lines ? [ctrl-Y] Yes " - "[ctrl-N] No"), - gui_keyboard_get_paste_lines ()); - wclrtoeol (GUI_CURSES(ptr_win)->win_input); - ptr_win->win_input_cursor_x = 0; - if (ptr_win == gui_current_window) - move (ptr_win->win_input_y, ptr_win->win_input_x); - } - else - { - if (buffer->input) - { - if (buffer->input_buffer_length == 0) - buffer->input_buffer[0] = '\0'; - - prompt_length = gui_input_get_prompt_length (ptr_win->buffer); - - if (ptr_win->win_input_width - prompt_length < 3) - { - prompt_length = 0; - display_prompt = 0; - } - else - display_prompt = 1; - - if (buffer->input_buffer_pos - buffer->input_buffer_1st_display + 1 > - ptr_win->win_input_width - prompt_length) - buffer->input_buffer_1st_display = buffer->input_buffer_pos - - (ptr_win->win_input_width - prompt_length) + 1; - else - { - if (buffer->input_buffer_pos < buffer->input_buffer_1st_display) - buffer->input_buffer_1st_display = buffer->input_buffer_pos; - else - { - if ((buffer->input_buffer_1st_display > 0) && - (buffer->input_buffer_pos - - buffer->input_buffer_1st_display + 1) - < ptr_win->win_input_width - prompt_length) - { - buffer->input_buffer_1st_display = - buffer->input_buffer_pos - - (ptr_win->win_input_width - prompt_length) + 1; - if (buffer->input_buffer_1st_display < 0) - buffer->input_buffer_1st_display = 0; - } - } - } - if (display_prompt) - gui_input_draw_prompt (ptr_win); - - gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_input, - GUI_COLOR_INPUT); - snprintf (format, sizeof (format), "%%-%ds", - ptr_win->win_input_width - prompt_length); - offset_cursor = 0; - if (ptr_win == gui_current_window) - offset_cursor = gui_input_draw_text (ptr_win, - ptr_win->win_input_width - prompt_length); - else - wprintw (GUI_CURSES(ptr_win)->win_input, format, " "); - wclrtoeol (GUI_CURSES(ptr_win)->win_input); - ptr_win->win_input_cursor_x = prompt_length + offset_cursor; - if (ptr_win == gui_current_window) - move (ptr_win->win_input_y, - ptr_win->win_input_x + ptr_win->win_input_cursor_x); - } - } - wrefresh (GUI_CURSES(ptr_win)->win_input); - refresh (); - } - } - - buffer->input_refresh_needed = 0; -} diff --git a/src/gui/curses/gui-curses-keyboard.c b/src/gui/curses/gui-curses-keyboard.c index dfb9b57d2..81de93748 100644 --- a/src/gui/curses/gui-curses-keyboard.c +++ b/src/gui/curses/gui-curses-keyboard.c @@ -121,8 +121,8 @@ gui_keyboard_default_bindings () gui_keyboard_bind (NULL, /* m-end */ "meta-meta2-8~", "/window scroll_bottom"); gui_keyboard_bind (NULL, /* m-n */ "meta-n", "/window scroll_next_highlight"); gui_keyboard_bind (NULL, /* m-p */ "meta-p", "/window scroll_previous_highlight"); - gui_keyboard_bind (NULL, /* F9 */ "meta2-20~", "/window scroll_topic_left"); - gui_keyboard_bind (NULL, /* F10 */ "meta2-21~", "/window scroll_topic_right"); + gui_keyboard_bind (NULL, /* F9 */ "meta2-20~", "/bar scroll title * x-50%"); + gui_keyboard_bind (NULL, /* F10 */ "meta2-21~", "/bar scroll title * x+50%"); gui_keyboard_bind (NULL, /* F11 */ "meta2-23~", "/bar scroll nicklist * y-100%"); gui_keyboard_bind (NULL, /* F12 */ "meta2-24~", "/bar scroll nicklist * y+100%"); gui_keyboard_bind (NULL, /* m-F11 */ "meta-meta2-23~", "/bar scroll nicklist * yb"); @@ -162,7 +162,7 @@ gui_keyboard_default_bindings () void gui_keyboard_flush () { - int i, key, insert_ok, input_draw; + int i, key, insert_ok; char key_str[32], *key_utf, *input_old; /* if there's no paste pending, then we use buffer and do actions @@ -286,8 +286,6 @@ gui_keyboard_flush () else input_old = NULL; - input_draw = 0; - if ((gui_keyboard_pressed (key_str) != 0) && (insert_ok)) { if (strcmp (key_str, "^^") == 0) @@ -298,7 +296,6 @@ gui_keyboard_flush () if (gui_current_window->buffer->completion) gui_completion_stop (gui_current_window->buffer->completion, 0); gui_input_text_changed_signal (); - input_draw = 1; } /* incremental text search in buffer */ @@ -307,12 +304,8 @@ gui_keyboard_flush () || (strcmp (input_old, gui_current_window->buffer->input_buffer) != 0))) { gui_window_search_restart (gui_current_window); - input_draw = 1; } - if (input_draw) - gui_input_draw (gui_current_window->buffer, 0); - if (input_old) free (input_old); } @@ -389,18 +382,12 @@ gui_keyboard_read_cb (void *data) { /* user is ok for pasting text, let's paste! */ if (accept_paste) - { gui_keyboard_paste_accept (); - gui_input_draw (gui_current_window->buffer, 1); - } /* user doesn't want to paste text: clear whole buffer! */ else if (cancel_paste) - { gui_keyboard_paste_cancel (); - gui_input_draw (gui_current_window->buffer, 1); - } else if (text_added_to_buffer) - gui_input_draw (gui_current_window->buffer, 1); + gui_input_text_changed_signal (); } else { @@ -412,7 +399,6 @@ gui_keyboard_read_cb (void *data) if (paste_lines > CONFIG_INTEGER(config_look_paste_max_lines)) { gui_keyboard_paste_pending = 1; - gui_input_draw (gui_current_window->buffer, 1); gui_input_paste_pending_signal (); } } diff --git a/src/gui/curses/gui-curses-main.c b/src/gui/curses/gui-curses-main.c index 636f374e6..3215499f8 100644 --- a/src/gui/curses/gui-curses-main.c +++ b/src/gui/curses/gui-curses-main.c @@ -48,7 +48,6 @@ #include "../gui-input.h" #include "../gui-history.h" #include "../gui-nicklist.h" -#include "../gui-status.h" #include "../gui-window.h" #include "gui-curses.h" @@ -273,30 +272,14 @@ gui_main_loop () for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer) { - /* refresh title if needed */ - if (ptr_buffer->title_refresh_needed) - gui_chat_draw_title (ptr_buffer, 1); - - /* refresh nicklist if needed */ - if (ptr_buffer->nicklist_refresh_needed) - gui_nicklist_draw (ptr_buffer, 1); - /* refresh chat if needed */ if (ptr_buffer->chat_refresh_needed) { gui_chat_draw (ptr_buffer, (ptr_buffer->chat_refresh_needed) > 1 ? 1 : 0); } - - /* refresh input if needed */ - if (ptr_buffer->input_refresh_needed) - gui_input_draw (ptr_buffer, 1); } - /* refresh status bar if needed */ - if (gui_status_refresh_needed) - gui_status_draw (1); - /* refresh bars if needed */ for (ptr_bar = gui_bars; ptr_bar; ptr_bar = ptr_bar->next_bar) { diff --git a/src/gui/curses/gui-curses-nicklist.c b/src/gui/curses/gui-curses-nicklist.c deleted file mode 100644 index 4882363a5..000000000 --- a/src/gui/curses/gui-curses-nicklist.c +++ /dev/null @@ -1,350 +0,0 @@ -/* - * Copyright (c) 2003-2008 by FlashCode <flashcode@flashtux.org> - * See README for License detail, AUTHORS for developers list. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -/* gui-curses-nicklist.c: nicklist display functions for Curses GUI */ - - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <stdlib.h> - -#include "../../core/weechat.h" -#include "../../core/wee-config.h" -#include "../../core/wee-string.h" -#include "../../core/wee-utf8.h" -#include "../gui-nicklist.h" -#include "../gui-buffer.h" -#include "../gui-chat.h" -#include "../gui-color.h" -#include "../gui-main.h" -#include "../gui-window.h" -#include "gui-curses.h" - - -/* - * gui_nicklist_draw: draw nick window for a buffer - * return 1 if chat window has been refreshed, 0 if only - * nicklist has been refreshed - */ - -int -gui_nicklist_draw (struct t_gui_buffer *buffer, int erase) -{ - struct t_gui_window *ptr_win; - struct t_gui_nick_group *ptr_group, *save_ptr_group; - struct t_gui_nick *ptr_nick, *save_ptr_nick; - struct t_config_option *ptr_option; - int rc, i, j, k, x, y, x2, max_y, column, max_length, max_chars; - int nicks_displayed, num_to_display, chars_left; - char format_empty[32], *buf, *ptr_buf, *ptr_next, saved_char; - - rc = 0; - - if (!gui_ok) - return 0; - - if (!buffer->nicklist) - { - buffer->nicklist_refresh_needed = 0; - return 0; - } - - for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window) - { - if ((ptr_win->buffer == buffer) && (buffer->num_displayed > 0)) - { - max_length = gui_nicklist_get_max_length (buffer, NULL); - if ((max_length != buffer->nicklist_max_length) - || (buffer->nicklist && !GUI_CURSES(ptr_win)->win_nick) - || (!buffer->nicklist && GUI_CURSES(ptr_win)->win_nick)) - { - buffer->nicklist_max_length = max_length; - if (gui_window_calculate_pos_size (ptr_win, 0)) - { - delwin (GUI_CURSES(ptr_win)->win_chat); - delwin (GUI_CURSES(ptr_win)->win_nick); - GUI_CURSES(ptr_win)->win_chat = newwin (ptr_win->win_chat_height, - ptr_win->win_chat_width, - ptr_win->win_chat_y, - ptr_win->win_chat_x); - GUI_CURSES(ptr_win)->win_nick = newwin (ptr_win->win_nick_height, - ptr_win->win_nick_width, - ptr_win->win_nick_y, - ptr_win->win_nick_x); - gui_chat_draw (buffer, 1); - erase = 1; - rc = 1; - } - } - - if (erase) - { - gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_nick, - GUI_COLOR_NICKLIST); - - snprintf (format_empty, 32, "%%-%ds", ptr_win->win_nick_width); - for (i = 0; i < ptr_win->win_nick_height; i++) - { - mvwprintw (GUI_CURSES(ptr_win)->win_nick, i, 0, - format_empty, " "); - } - } - - if ((CONFIG_INTEGER(config_look_nicklist_position) == CONFIG_LOOK_NICKLIST_TOP) || - (CONFIG_INTEGER(config_look_nicklist_position) == CONFIG_LOOK_NICKLIST_BOTTOM)) - max_chars = max_length; - else - max_chars = ((CONFIG_INTEGER(config_look_nicklist_min_size) > 0) - && (max_length < CONFIG_INTEGER(config_look_nicklist_min_size))) ? - CONFIG_INTEGER(config_look_nicklist_min_size) : - (((CONFIG_INTEGER(config_look_nicklist_max_size) > 0) - && (max_length > CONFIG_INTEGER(config_look_nicklist_max_size))) ? - CONFIG_INTEGER(config_look_nicklist_max_size) : max_length); - - if (CONFIG_BOOLEAN(config_look_nicklist_separator) && has_colors ()) - { - gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_nick, - GUI_COLOR_NICKLIST_SEPARATOR); - switch (CONFIG_INTEGER(config_look_nicklist_position)) - { - case CONFIG_LOOK_NICKLIST_LEFT: - mvwvline (GUI_CURSES(ptr_win)->win_nick, - 0, ptr_win->win_nick_width - 1, ACS_VLINE, - ptr_win->win_chat_height); - break; - case CONFIG_LOOK_NICKLIST_RIGHT: - mvwvline (GUI_CURSES(ptr_win)->win_nick, - 0, 0, ACS_VLINE, - ptr_win->win_chat_height); - break; - case CONFIG_LOOK_NICKLIST_TOP: - mvwhline (GUI_CURSES(ptr_win)->win_nick, - ptr_win->win_nick_height - 1, 0, ACS_HLINE, - ptr_win->win_chat_width); - break; - case CONFIG_LOOK_NICKLIST_BOTTOM: - mvwhline (GUI_CURSES(ptr_win)->win_nick, - 0, 0, ACS_HLINE, - ptr_win->win_chat_width); - break; - } - } - - x = 0; - y = (CONFIG_BOOLEAN(config_look_nicklist_separator) - && (CONFIG_INTEGER(config_look_nicklist_position) == CONFIG_LOOK_NICKLIST_BOTTOM)) ? - 1 : 0; - max_y = 0; - switch (CONFIG_INTEGER(config_look_nicklist_position)) - { - case CONFIG_LOOK_NICKLIST_LEFT: - case CONFIG_LOOK_NICKLIST_RIGHT: - max_y = 0; - break; - case CONFIG_LOOK_NICKLIST_TOP: - max_y = ptr_win->win_nick_height - - ((CONFIG_BOOLEAN(config_look_nicklist_separator)) ? 1 : 0); - break; - case CONFIG_LOOK_NICKLIST_BOTTOM: - max_y = ptr_win->win_nick_height; - break; - } - column = 0; - - if ((CONFIG_INTEGER(config_look_nicklist_position) == CONFIG_LOOK_NICKLIST_TOP) || - (CONFIG_INTEGER(config_look_nicklist_position) == CONFIG_LOOK_NICKLIST_BOTTOM)) - nicks_displayed = (ptr_win->win_width / (max_length + 2)) * - (ptr_win->win_nick_height - - ((CONFIG_BOOLEAN(config_look_nicklist_separator)) ? 1 : 0)); - else - nicks_displayed = ptr_win->win_nick_height; - - ptr_group = NULL; - ptr_nick = NULL; - gui_nicklist_get_next_item (buffer, &ptr_group, &ptr_nick); - i = 0; - while ((ptr_group || ptr_nick) && (i < ptr_win->win_nick_start)) - { - if ((ptr_nick && ptr_nick->visible) - || (ptr_group && buffer->nicklist_display_groups - && ptr_group->visible)) - i++; - gui_nicklist_get_next_item (buffer, &ptr_group, &ptr_nick); - } - - save_ptr_group = ptr_group; - save_ptr_nick = ptr_nick; - while (ptr_group || ptr_nick) - { - if ((ptr_nick && ptr_nick->visible) - || (ptr_group && buffer->nicklist_display_groups)) - { - num_to_display++; - } - gui_nicklist_get_next_item (buffer, &ptr_group, &ptr_nick); - } - ptr_group = save_ptr_group; - ptr_nick = save_ptr_nick; - - i = 0; - while ((ptr_group || ptr_nick) && (i < nicks_displayed)) - { - if ((ptr_nick && ptr_nick->visible) - || (ptr_group && buffer->nicklist_display_groups - && ptr_group->visible)) - { - switch (CONFIG_INTEGER(config_look_nicklist_position)) - { - case CONFIG_LOOK_NICKLIST_LEFT: - x = 0; - break; - case CONFIG_LOOK_NICKLIST_RIGHT: - x = (CONFIG_BOOLEAN(config_look_nicklist_separator)) ? 1 : 0; - break; - case CONFIG_LOOK_NICKLIST_TOP: - case CONFIG_LOOK_NICKLIST_BOTTOM: - x = column; - break; - } - if (((i == 0) && (ptr_win->win_nick_start > 0)) - || ((i == nicks_displayed - 1) && (i < num_to_display - 1))) - { - gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_nick, - GUI_COLOR_NICKLIST_MORE); - j = (max_length + 1) >= 4 ? 4 : max_length + 1; - for (x2 = 1; x2 <= j; x2++) - { - mvwprintw (GUI_CURSES(ptr_win)->win_nick, - y, x + x2, "+"); - } - } - else - { - gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_nick, - GUI_COLOR_NICKLIST); - chars_left = max_chars; - if (ptr_nick) - { - /* display spaces and prefix for nick */ - if (buffer->nicklist_display_groups) - { - for (k = 0; k < ptr_nick->group->level; k++) - { - mvwprintw (GUI_CURSES(ptr_win)->win_nick, - y, x, " "); - x++; - } - chars_left -= ptr_nick->group->level; - } - - //gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_nick, - // ptr_nick->prefix_color); - config_file_search_with_string (ptr_nick->prefix_color, - NULL, NULL, &ptr_option, - NULL); - if (ptr_option) - gui_window_set_custom_color_fg (GUI_CURSES(ptr_win)->win_nick, - CONFIG_COLOR(ptr_option)); - - mvwprintw (GUI_CURSES(ptr_win)->win_nick, - y, x, "%c", ptr_nick->prefix); - x++; - chars_left--; - - //gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_nick, - // ptr_nick->color); - config_file_search_with_string (ptr_nick->color, - NULL, NULL, &ptr_option, - NULL); - if (ptr_option) - gui_window_set_custom_color_fg (GUI_CURSES(ptr_win)->win_nick, - CONFIG_COLOR(ptr_option)); - - ptr_buf = ptr_nick->name; - } - else - { - /* display group name */ - for (k = 0; k < ptr_group->level - 1; k++) - { - mvwprintw (GUI_CURSES(ptr_win)->win_nick, - y, x, " "); - x++; - } - chars_left -= ptr_group->level; - //gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_nick, - // ptr_group->color); - //wattron (GUI_CURSES(ptr_win)->win_nick, A_UNDERLINE); - ptr_buf = gui_nicklist_get_group_start (ptr_group->name); - } - wmove (GUI_CURSES(ptr_win)->win_nick, y, x); - saved_char = '\0'; - for (k = 0; k < chars_left; k++) - { - if (ptr_buf && ptr_buf[0]) - { - ptr_next = utf8_next_char (ptr_buf); - if (ptr_next) - { - saved_char = ptr_next[0]; - ptr_next[0] = '\0'; - } - buf = string_iconv_from_internal (NULL, - ptr_buf); - wprintw (GUI_CURSES(ptr_win)->win_nick, "%s", - (buf) ? buf : "?"); - if (buf) - free (buf); - if (ptr_next) - ptr_next[0] = saved_char; - ptr_buf = ptr_next; - //if (!ptr_buf || !ptr_buf[0]) - // wattroff (GUI_CURSES(ptr_win)->win_nick, - // A_UNDERLINE); - } - else - wprintw (GUI_CURSES(ptr_win)->win_nick, " "); - } - } - y++; - i++; - if ((CONFIG_INTEGER(config_look_nicklist_position) == CONFIG_LOOK_NICKLIST_TOP) || - (CONFIG_INTEGER(config_look_nicklist_position) == CONFIG_LOOK_NICKLIST_BOTTOM)) - { - if (y >= max_y) - { - column += max_length + 2; - y = (CONFIG_BOOLEAN(config_look_nicklist_separator) - && (CONFIG_INTEGER(config_look_nicklist_position) == CONFIG_LOOK_NICKLIST_BOTTOM)) ? - 1 : 0; - } - } - } - gui_nicklist_get_next_item (buffer, &ptr_group, &ptr_nick); - } - wnoutrefresh (GUI_CURSES(ptr_win)->win_nick); - refresh (); - } - } - - buffer->nicklist_refresh_needed = 0; - - return rc; -} diff --git a/src/gui/curses/gui-curses-status.c b/src/gui/curses/gui-curses-status.c deleted file mode 100644 index ad9bfde11..000000000 --- a/src/gui/curses/gui-curses-status.c +++ /dev/null @@ -1,249 +0,0 @@ -/* - * Copyright (c) 2003-2008 by FlashCode <flashcode@flashtux.org> - * See README for License detail, AUTHORS for developers list. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -/* gui-curses-status.c: status display functions for Curses GUI */ - - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <stdlib.h> -#include <string.h> - -#include "../../core/weechat.h" -#include "../../core/wee-config.h" -#include "../../core/wee-utf8.h" -#include "../../plugins/plugin.h" -#include "../gui-status.h" -#include "../gui-buffer.h" -#include "../gui-color.h" -#include "../gui-main.h" -#include "../gui-hotlist.h" -#include "../gui-window.h" -#include "gui-curses.h" - - -/* - * gui_status_draw: draw status window - */ - -void -gui_status_draw (int erase) -{ - struct t_gui_window *ptr_win; - struct t_gui_hotlist *ptr_hotlist; - char format[32], *more, *pos_point; - int x; - int display_name, names_count; - - if (!gui_ok) - return; - - for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window) - { - if (erase) - gui_window_clear_weechat (GUI_CURSES(ptr_win)->win_status, - GUI_COLOR_STATUS); - - gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_status, - GUI_COLOR_STATUS); - - /* display number of buffers */ - gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_status, - GUI_COLOR_STATUS_DELIMITERS); - mvwprintw (GUI_CURSES(ptr_win)->win_status, 0, 0, "["); - gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_status, - GUI_COLOR_STATUS); - wprintw (GUI_CURSES(ptr_win)->win_status, "%d", - (last_gui_buffer) ? last_gui_buffer->number : 0); - gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_status, - GUI_COLOR_STATUS_DELIMITERS); - wprintw (GUI_CURSES(ptr_win)->win_status, "] "); - - /* display buffer plugin */ - wprintw (GUI_CURSES(ptr_win)->win_status, "["); - gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_status, - GUI_COLOR_STATUS); - wprintw (GUI_CURSES(ptr_win)->win_status, "%s", - plugin_get_name (ptr_win->buffer->plugin)); - gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_status, - GUI_COLOR_STATUS_DELIMITERS); - wprintw (GUI_CURSES(ptr_win)->win_status, "] "); - - /* display buffer number/name */ - gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_status, - GUI_COLOR_STATUS_NUMBER); - wprintw (GUI_CURSES(ptr_win)->win_status, "%d", - ptr_win->buffer->number); - gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_status, - GUI_COLOR_STATUS_DELIMITERS); - wprintw (GUI_CURSES(ptr_win)->win_status, ":"); - gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_status, - GUI_COLOR_STATUS_NAME); - gui_window_wprintw (GUI_CURSES(ptr_win)->win_status, "%s ", - ptr_win->buffer->name); - - /* display list of other active windows (if any) with numbers */ - if (gui_hotlist) - { - gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_status, - GUI_COLOR_STATUS_DELIMITERS); - wprintw (GUI_CURSES(ptr_win)->win_status, "["); - gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_status, - GUI_COLOR_STATUS); - gui_window_wprintw (GUI_CURSES(ptr_win)->win_status, _("Act: ")); - - names_count = 0; - for (ptr_hotlist = gui_hotlist; ptr_hotlist; - ptr_hotlist = ptr_hotlist->next_hotlist) - { - switch (ptr_hotlist->priority) - { - case GUI_HOTLIST_LOW: - gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_status, - GUI_COLOR_STATUS_DATA_OTHER); - display_name = ((CONFIG_INTEGER(config_look_hotlist_names_level) & 1) != 0); - break; - case GUI_HOTLIST_MESSAGE: - gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_status, - GUI_COLOR_STATUS_DATA_MSG); - display_name = ((CONFIG_INTEGER(config_look_hotlist_names_level) & 2) != 0); - break; - case GUI_HOTLIST_PRIVATE: - gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_status, - GUI_COLOR_STATUS_DATA_PRIVATE); - display_name = ((CONFIG_INTEGER(config_look_hotlist_names_level) & 4) != 0); - break; - case GUI_HOTLIST_HIGHLIGHT: - gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_status, - GUI_COLOR_STATUS_DATA_HIGHLIGHT); - display_name = ((CONFIG_INTEGER(config_look_hotlist_names_level) & 8) != 0); - break; - default: - display_name = 0; - break; - } - - wprintw (GUI_CURSES(ptr_win)->win_status, "%d", - ptr_hotlist->buffer->number); - - if (display_name - && (CONFIG_INTEGER(config_look_hotlist_names_count) != 0) - && (names_count < CONFIG_INTEGER(config_look_hotlist_names_count))) - { - names_count++; - - gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_status, - GUI_COLOR_STATUS_DELIMITERS); - wprintw (GUI_CURSES(ptr_win)->win_status, ":"); - - gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_status, - GUI_COLOR_STATUS); - if (CONFIG_INTEGER(config_look_hotlist_names_length) == 0) - snprintf (format, sizeof (format) - 1, "%%s"); - else - snprintf (format, sizeof (format) - 1, - "%%.%ds", - CONFIG_INTEGER(config_look_hotlist_names_length)); - pos_point = NULL; - if (CONFIG_BOOLEAN(config_look_hotlist_short_names)) - pos_point = strchr (ptr_hotlist->buffer->name, '.'); - gui_window_wprintw (GUI_CURSES(ptr_win)->win_status, - format, - (pos_point) ? pos_point + 1 : ptr_hotlist->buffer->name); - } - - if (ptr_hotlist->next_hotlist) - wprintw (GUI_CURSES(ptr_win)->win_status, ","); - } - gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_status, - GUI_COLOR_STATUS_DELIMITERS); - wprintw (GUI_CURSES(ptr_win)->win_status, "] "); - } - - /* display lag */ - /*if (GUI_SERVER(ptr_win->buffer)) - { - if (GUI_SERVER(ptr_win->buffer)->lag / 1000 >= config_irc_lag_min_show) - { - gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_status, - GUI_COLOR_STATUS_DELIMITERS); - wprintw (GUI_CURSES(ptr_win)->win_status, "["); - gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_status, - GUI_COLOR_STATUS); - gui_window_wprintw (GUI_CURSES(ptr_win)->win_status, - _("Lag: %.1f"), - ((float)(GUI_SERVER(ptr_win->buffer)->lag)) / 1000); - gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_status, - GUI_COLOR_STATUS_DELIMITERS); - wprintw (GUI_CURSES(ptr_win)->win_status, "]"); - } - }*/ - - /* display "-MORE-" (if last line is not displayed) & nicks count */ - /*if (ptr_win->buffer->attribs & GUI_BUFFER_ATTRIB_NICKLIST) - { - snprintf (str_nicks, sizeof (str_nicks) - 1, "%d", - GUI_CHANNEL(ptr_win->buffer)->nicks_count); - x = ptr_win->win_status_width - utf8_strlen (str_nicks) - 4; - } - else*/ - x = ptr_win->win_status_width - 1; - more = strdup (_("-MORE-")); - if (more) - { - x -= utf8_strlen (more) - 1; - if (x < 0) - x = 0; - gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_status, - GUI_COLOR_STATUS_MORE); - if (ptr_win->scroll) - { - wmove (GUI_CURSES(ptr_win)->win_status, 0, x); - gui_window_wprintw (GUI_CURSES(ptr_win)->win_status, "%s", more); - } - else - { - /*snprintf (format, sizeof (format) - 1, - "%%-%ds", (int)(utf8_strlen (more))); - wmove (GUI_CURSES(ptr_win)->win_status, 0, x); - gui_window_wprintw (GUI_CURSES(ptr_win)->win_status, format, " "); - */ - } - /*if (ptr_win->buffer->attribs & GUI_BUFFER_ATTRIB_NICKLIST) - { - gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_status, - GUI_COLOR_STATUS_DELIMITERS); - wprintw (GUI_CURSES(ptr_win)->win_status, " ["); - gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_status, - GUI_COLOR_STATUS); - wprintw (GUI_CURSES(ptr_win)->win_status, "%s", str_nicks); - gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_status, - GUI_COLOR_STATUS_DELIMITERS); - wprintw (GUI_CURSES(ptr_win)->win_status, "]"); - }*/ - free (more); - } - - wnoutrefresh (GUI_CURSES(ptr_win)->win_status); - refresh (); - } - - gui_status_refresh_needed = 0; -} diff --git a/src/gui/curses/gui-curses-window.c b/src/gui/curses/gui-curses-window.c index 326129640..c5942e8d5 100644 --- a/src/gui/curses/gui-curses-window.c +++ b/src/gui/curses/gui-curses-window.c @@ -42,7 +42,6 @@ #include "../gui-input.h" #include "../gui-main.h" #include "../gui-nicklist.h" -#include "../gui-status.h" #include "gui-curses.h" @@ -85,11 +84,7 @@ gui_window_objects_init (struct t_gui_window *window) if (new_objects) { window->gui_objects = new_objects; - GUI_CURSES(window)->win_title = NULL; GUI_CURSES(window)->win_chat = NULL; - GUI_CURSES(window)->win_nick = NULL; - GUI_CURSES(window)->win_status = NULL; - GUI_CURSES(window)->win_input = NULL; GUI_CURSES(window)->win_separator = NULL; GUI_CURSES(window)->bar_windows = NULL; GUI_CURSES(window)->last_bar_window = NULL; @@ -106,31 +101,11 @@ void gui_window_objects_free (struct t_gui_window *window, int free_separator, int free_bar_windows) { - if (GUI_CURSES(window)->win_title) - { - delwin (GUI_CURSES(window)->win_title); - GUI_CURSES(window)->win_title = NULL; - } if (GUI_CURSES(window)->win_chat) { delwin (GUI_CURSES(window)->win_chat); GUI_CURSES(window)->win_chat = NULL; } - if (GUI_CURSES(window)->win_nick) - { - delwin (GUI_CURSES(window)->win_nick); - GUI_CURSES(window)->win_nick = NULL; - } - if (GUI_CURSES(window)->win_status) - { - delwin (GUI_CURSES(window)->win_status); - GUI_CURSES(window)->win_status = NULL; - } - if (GUI_CURSES(window)->win_input) - { - delwin (GUI_CURSES(window)->win_input); - GUI_CURSES(window)->win_input = NULL; - } if (free_separator && GUI_CURSES(window)->win_separator) { delwin (GUI_CURSES(window)->win_separator); @@ -380,19 +355,18 @@ gui_window_clrtoeol_with_current_bg (WINDOW *window) } /* - * gui_window_calculate_pos_size: calculate position and size for a buffer & subwindows - * return 1 if pos/size changed, 0 if no change + * gui_window_calculate_pos_size: calculate position and size for a buffer and + * subwindows */ -int -gui_window_calculate_pos_size (struct t_gui_window *window, int force_calculate) +void +gui_window_calculate_pos_size (struct t_gui_window *window) { struct t_gui_bar_window *ptr_bar_win; - int max_length, max_height, lines, width_used; int add_top, add_bottom, add_left, add_right; if (!gui_ok) - return 0; + return; for (ptr_bar_win = GUI_CURSES(window)->bar_windows; ptr_bar_win; ptr_bar_win = ptr_bar_win->next_bar_window) @@ -405,148 +379,12 @@ gui_window_calculate_pos_size (struct t_gui_window *window, int force_calculate) add_left = gui_bar_window_get_size (NULL, window, GUI_BAR_POSITION_LEFT); add_right = gui_bar_window_get_size (NULL, window, GUI_BAR_POSITION_RIGHT); - /* init chat & nicklist settings */ - if (window->buffer->nicklist) - { - max_length = window->buffer->nicklist_max_length; - - lines = 0; - - if ((CONFIG_INTEGER(config_look_nicklist_position) == CONFIG_LOOK_NICKLIST_LEFT) || - (CONFIG_INTEGER(config_look_nicklist_position) == CONFIG_LOOK_NICKLIST_RIGHT)) - { - if ((CONFIG_INTEGER(config_look_nicklist_min_size) > 0) - && (max_length < CONFIG_INTEGER(config_look_nicklist_min_size))) - max_length = CONFIG_INTEGER(config_look_nicklist_min_size); - else if ((CONFIG_INTEGER(config_look_nicklist_max_size) > 0) - && (max_length > CONFIG_INTEGER(config_look_nicklist_max_size))) - max_length = CONFIG_INTEGER(config_look_nicklist_max_size); - if (!force_calculate - && (window->win_nick_width == - max_length + ((CONFIG_BOOLEAN(config_look_nicklist_separator)) ? 1 : 0))) - return 0; - } - else - { - width_used = (window->win_width - add_left - add_right) - - ((window->win_width - add_left - add_right) % (max_length + 2)); - if (((max_length + 2) * window->buffer->nicklist_visible_count) % width_used == 0) - lines = ((max_length + 2) * window->buffer->nicklist_visible_count) / width_used; - else - lines = (((max_length + 2) * window->buffer->nicklist_visible_count) / width_used) + 1; - if ((CONFIG_INTEGER(config_look_nicklist_max_size) > 0) - && (lines > CONFIG_INTEGER(config_look_nicklist_max_size))) - lines = CONFIG_INTEGER(config_look_nicklist_max_size); - if ((CONFIG_INTEGER(config_look_nicklist_min_size) > 0) - && (lines < CONFIG_INTEGER(config_look_nicklist_min_size))) - lines = CONFIG_INTEGER(config_look_nicklist_min_size); - max_height = window->win_height - add_top - add_bottom - 2 - 4; - if (lines > max_height) - lines = max_height; - if (!force_calculate - && (window->win_nick_height == - lines + ((CONFIG_BOOLEAN(config_look_nicklist_separator)) ? 1 : 0))) - return 0; - } - - switch (CONFIG_INTEGER(config_look_nicklist_position)) - { - case CONFIG_LOOK_NICKLIST_LEFT: - window->win_chat_x = window->win_x + add_left + max_length + - ((CONFIG_BOOLEAN(config_look_nicklist_separator)) ? 1 : 0); - window->win_chat_y = window->win_y + add_top + 1; - window->win_chat_width = window->win_width - max_length - - ((CONFIG_BOOLEAN(config_look_nicklist_separator)) ? 1 : 0); - window->win_nick_x = window->win_x + add_left + 0; - window->win_nick_y = window->win_y + add_top + 1; - window->win_nick_width = max_length + - ((CONFIG_BOOLEAN(config_look_nicklist_separator)) ? 1 : 0); - window->win_chat_height = window->win_height - add_top - add_bottom - 3; - window->win_nick_height = window->win_height - add_top - add_bottom - 3; - window->win_nick_num_max = window->win_nick_height; - break; - case CONFIG_LOOK_NICKLIST_RIGHT: - window->win_chat_x = window->win_x + add_left; - window->win_chat_y = window->win_y + add_top + 1; - window->win_chat_width = window->win_width - add_left - add_right - max_length - - ((CONFIG_BOOLEAN(config_look_nicklist_separator)) ? 1 : 0); - window->win_nick_x = window->win_x + window->win_width - add_right - max_length - - ((CONFIG_BOOLEAN(config_look_nicklist_separator)) ? 1 : 0); - window->win_nick_y = window->win_y + add_top + 1; - window->win_nick_width = max_length + - ((CONFIG_BOOLEAN(config_look_nicklist_separator)) ? 1 : 0); - window->win_chat_height = window->win_height - add_top - add_bottom - 3; - window->win_nick_height = window->win_height - add_top - add_bottom - 3; - window->win_nick_num_max = window->win_nick_height; - break; - case CONFIG_LOOK_NICKLIST_TOP: - window->win_chat_x = window->win_x + add_left; - window->win_chat_y = window->win_y + add_top + 1 + lines + - ((CONFIG_BOOLEAN(config_look_nicklist_separator)) ? 1 : 0); - window->win_chat_width = window->win_width - add_left - add_right; - window->win_chat_height = window->win_height - add_top - add_bottom - 3 - lines - - ((CONFIG_BOOLEAN(config_look_nicklist_separator)) ? 1 : 0); - window->win_nick_x = window->win_x + add_left; - window->win_nick_y = window->win_y + add_top + 1; - window->win_nick_width = window->win_width - add_left - add_right; - window->win_nick_height = lines + - ((CONFIG_BOOLEAN(config_look_nicklist_separator)) ? 1 : 0); - window->win_nick_num_max = lines * (window->win_nick_width / (max_length + 1)); - break; - case CONFIG_LOOK_NICKLIST_BOTTOM: - window->win_chat_x = window->win_x + add_left; - window->win_chat_y = window->win_y + add_top + 1; - window->win_chat_width = window->win_width - add_left - add_right; - window->win_chat_height = window->win_height - add_top - add_bottom - 3 - lines - - ((CONFIG_BOOLEAN(config_look_nicklist_separator)) ? 1 : 0); - window->win_nick_x = window->win_x; - window->win_nick_y = window->win_y + window->win_height - add_bottom - - 2 - lines - - ((CONFIG_BOOLEAN(config_look_nicklist_separator)) ? 1 : 0); - window->win_nick_width = window->win_width; - window->win_nick_height = lines + - ((CONFIG_BOOLEAN(config_look_nicklist_separator)) ? 1 : 0); - window->win_nick_num_max = lines * (window->win_nick_width / (max_length + 1)); - break; - } - - window->win_chat_cursor_x = window->win_x + add_left; - window->win_chat_cursor_y = window->win_y + add_top; - } - else - { - window->win_chat_x = window->win_x + add_left; - window->win_chat_y = window->win_y + add_top + 1; - window->win_chat_width = window->win_width - add_left - add_right; - window->win_chat_height = window->win_height - add_top - add_bottom - 3; - window->win_chat_cursor_x = window->win_x + add_left; - window->win_chat_cursor_y = window->win_y + add_top; - window->win_nick_x = -1; - window->win_nick_y = -1; - window->win_nick_width = -1; - window->win_nick_height = -1; - window->win_nick_num_max = -1; - } - - /* title window */ - window->win_title_x = window->win_x + add_left; - window->win_title_y = window->win_y + add_top; - window->win_title_width = window->win_width - add_left - add_right; - window->win_title_height = 1; - - /* status window */ - window->win_status_x = window->win_x + add_left; - window->win_status_y = window->win_y + window->win_height - add_bottom - 2; - window->win_status_width = window->win_width - add_left - add_right; - window->win_status_height = 1; - - /* input window */ - window->win_input_x = window->win_x + add_left; - window->win_input_y = window->win_y + window->win_height - add_bottom - 1; - window->win_input_width = window->win_width - add_left - add_right; - window->win_input_height = 1; - - return 1; + window->win_chat_x = window->win_x + add_left; + window->win_chat_y = window->win_y + add_top; + window->win_chat_width = window->win_width - add_left - add_right; + window->win_chat_height = window->win_height - add_top - add_bottom; + window->win_chat_cursor_x = window->win_x + add_left; + window->win_chat_cursor_y = window->win_y + add_top; } /* @@ -584,11 +422,7 @@ gui_window_redraw_buffer (struct t_gui_buffer *buffer) if (!gui_ok) return; - gui_chat_draw_title (buffer, 1); - if (!gui_nicklist_draw (buffer, 1)) - gui_chat_draw (buffer, 1); - gui_status_draw (1); - gui_input_draw (buffer, 1); + gui_chat_draw (buffer, 1); } /* @@ -641,8 +475,6 @@ gui_window_switch_to_buffer (struct t_gui_window *window, } window->buffer = buffer; - window->win_title_start = 0; - window->win_nick_start = 0; if (old_buffer == buffer) { @@ -650,7 +482,7 @@ gui_window_switch_to_buffer (struct t_gui_window *window, gui_bar_window_add_missing_bars (window); } - gui_window_calculate_pos_size (window, 1); + gui_window_calculate_pos_size (window); /* create bar windows */ for (ptr_bar_win = GUI_CURSES(window)->bar_windows; ptr_bar_win; @@ -663,42 +495,12 @@ gui_window_switch_to_buffer (struct t_gui_window *window, gui_window_objects_free (window, 0, 0); /* create Curses windows */ - GUI_CURSES(window)->win_title = newwin (window->win_title_height, - window->win_title_width, - window->win_title_y, - window->win_title_x); - GUI_CURSES(window)->win_input = newwin (window->win_input_height, - window->win_input_width, - window->win_input_y, - window->win_input_x); - if (buffer->nicklist) - { - if (GUI_CURSES(window)->win_chat) - delwin (GUI_CURSES(window)->win_chat); - GUI_CURSES(window)->win_chat = newwin (window->win_chat_height, - window->win_chat_width, - window->win_chat_y, - window->win_chat_x); - GUI_CURSES(window)->win_nick = newwin (window->win_nick_height, - window->win_nick_width, - window->win_nick_y, - window->win_nick_x); - } - else - { - if (GUI_CURSES(window)->win_chat) - delwin (GUI_CURSES(window)->win_chat); - GUI_CURSES(window)->win_chat = newwin (window->win_chat_height, - window->win_chat_width, - window->win_chat_y, - window->win_chat_x); - } - - /* create status window */ - GUI_CURSES(window)->win_status = newwin (window->win_status_height, - window->win_status_width, - window->win_status_y, - window->win_status_x); + if (GUI_CURSES(window)->win_chat) + delwin (GUI_CURSES(window)->win_chat); + GUI_CURSES(window)->win_chat = newwin (window->win_chat_height, + window->win_chat_width, + window->win_chat_y, + window->win_chat_x); buffer->num_displayed++; @@ -785,8 +587,8 @@ gui_window_page_up (struct t_gui_window *window) (window->start_line) ? (-1) * (num_lines) : (-1) * (num_lines + window->win_chat_height - 1)); + window->scroll_reset_allowed = 1; gui_buffer_ask_chat_refresh (window->buffer, 2); - gui_status_refresh_needed = 1; } break; case GUI_BUFFER_TYPE_FREE: @@ -845,8 +647,8 @@ gui_window_page_down (struct t_gui_window *window) window->start_line = NULL; window->start_line_pos = 0; } + window->scroll_reset_allowed = 1; gui_buffer_ask_chat_refresh (window->buffer, 2); - gui_status_refresh_needed = 1; } break; case GUI_BUFFER_TYPE_FREE: @@ -884,8 +686,8 @@ gui_window_scroll_up (struct t_gui_window *window) (-1) * CONFIG_INTEGER(config_look_scroll_amount) : (-1) * ( (window->win_chat_height - 1) + CONFIG_INTEGER(config_look_scroll_amount))); + window->scroll_reset_allowed = 1; gui_buffer_ask_chat_refresh (window->buffer, 2); - gui_status_refresh_needed = 1; } break; case GUI_BUFFER_TYPE_FREE: @@ -938,9 +740,8 @@ gui_window_scroll_down (struct t_gui_window *window) window->start_line = NULL; window->start_line_pos = 0; } - + window->scroll_reset_allowed = 1; gui_buffer_ask_chat_refresh (window->buffer, 2); - gui_status_refresh_needed = 1; } break; case GUI_BUFFER_TYPE_FREE: @@ -972,8 +773,8 @@ gui_window_scroll_top (struct t_gui_window *window) { window->start_line = gui_chat_get_first_line_displayed (window->buffer); window->start_line_pos = 0; + window->scroll_reset_allowed = 1; gui_buffer_ask_chat_refresh (window->buffer, 2); - gui_status_refresh_needed = 1; } break; case GUI_BUFFER_TYPE_FREE: @@ -1009,8 +810,8 @@ gui_window_scroll_bottom (struct t_gui_window *window) { window->start_line = NULL; window->start_line_pos = 0; + window->scroll_reset_allowed = 1; gui_buffer_ask_chat_refresh (window->buffer, 2); - gui_status_refresh_needed = 1; } break; case GUI_BUFFER_TYPE_FREE: @@ -1024,7 +825,6 @@ gui_window_scroll_bottom (struct t_gui_window *window) else { gui_buffer_ask_chat_refresh (window->buffer, 2); - gui_status_refresh_needed = 1; } hook_signal_send ("window_scrolled", WEECHAT_HOOK_SIGNAL_POINTER, window); @@ -1035,133 +835,6 @@ gui_window_scroll_bottom (struct t_gui_window *window) } /* - * gui_window_scroll_topic_left: scroll left topic - */ - -void -gui_window_scroll_topic_left (struct t_gui_window *window) -{ - if (!gui_ok) - return; - - if (window->win_title_start > 0) - window->win_title_start -= (window->win_width * 3) / 4; - if (window->win_title_start < 0) - window->win_title_start = 0; - gui_buffer_ask_title_refresh (window->buffer, 1); -} - -/* - * gui_window_scroll_topic_right: scroll right topic - */ - -void -gui_window_scroll_topic_right (struct t_gui_window *window) -{ - if (!gui_ok) - return; - - window->win_title_start += (window->win_width * 3) / 4; - gui_buffer_ask_title_refresh (window->buffer, 1); -} - -/* - * gui_window_nicklist_page_up: scroll one page up in nicklist - */ - -void -gui_window_nicklist_page_up (struct t_gui_window *window) -{ - if (!gui_ok) - return; - - if (window->buffer->nicklist) - { - if (window->win_nick_start > 0) - { - window->win_nick_start -= (window->win_nick_num_max - 1); - if (window->win_nick_start <= 1) - window->win_nick_start = 0; - gui_buffer_ask_nicklist_refresh (window->buffer, 1); - } - } -} - -/* - * gui_window_nicklist_page_down: scroll one page down in nicklist - */ - -void -gui_window_nicklist_page_down (struct t_gui_window *window) -{ - if (!gui_ok) - return; - - if (window->buffer->nicklist) - { - if ((window->buffer->nicklist_visible_count > window->win_nick_num_max) - && (window->win_nick_start + window->win_nick_num_max - 1 - < window->buffer->nicklist_visible_count)) - { - if (window->win_nick_start == 0) - window->win_nick_start += (window->win_nick_num_max - 1); - else - window->win_nick_start += (window->win_nick_num_max - 2); - gui_buffer_ask_nicklist_refresh (window->buffer, 1); - } - } -} - -/* - * gui_window_nicklist_beginning: go to beginning of nicklist - */ - -void -gui_window_nicklist_beginning (struct t_gui_window *window) -{ - if (!gui_ok) - return; - - if (window->buffer->nicklist) - { - if (window->win_nick_start > 0) - { - window->win_nick_start = 0; - gui_buffer_ask_nicklist_refresh (window->buffer, 1); - } - } -} - -/* - * gui_window_nicklist_end: go to the end of nicklist - */ - -void -gui_window_nicklist_end (struct t_gui_window *window) -{ - int new_start; - - if (!gui_ok) - return; - - if (window->buffer->nicklist) - { - new_start = - window->buffer->nicklist_visible_count - window->win_nick_num_max; - if (new_start < 0) - new_start = 0; - else if (new_start >= 1) - new_start++; - - if (new_start != window->win_nick_start) - { - window->win_nick_start = new_start; - gui_buffer_ask_nicklist_refresh (window->buffer, 1); - } - } -} - -/* * gui_window_auto_resize: auto-resize all windows, according to % of global size * This function is called after a terminal resize. * Returns 0 if ok, -1 if all window should be merged @@ -1770,11 +1443,7 @@ gui_window_objects_print_log (struct t_gui_window *window) log_printf (""); log_printf (" window specific objects:"); - log_printf (" win_title . . . . . : 0x%x", GUI_CURSES(window)->win_title); log_printf (" win_chat. . . . . . : 0x%x", GUI_CURSES(window)->win_chat); - log_printf (" win_nick. . . . . . : 0x%x", GUI_CURSES(window)->win_nick); - log_printf (" win_status. . . . . : 0x%x", GUI_CURSES(window)->win_status); - log_printf (" win_input . . . . . : 0x%x", GUI_CURSES(window)->win_input); log_printf (" win_separator . . . : 0x%x", GUI_CURSES(window)->win_separator); log_printf (" bar_windows . . . . : 0x%x", GUI_CURSES(window)->bar_windows); log_printf (" last_bar_windows. . : 0x%x", GUI_CURSES(window)->last_bar_window); diff --git a/src/gui/curses/gui-curses.h b/src/gui/curses/gui-curses.h index bd817c873..56f1ba597 100644 --- a/src/gui/curses/gui-curses.h +++ b/src/gui/curses/gui-curses.h @@ -59,11 +59,7 @@ struct t_gui_bar_window struct t_gui_curses_objects { - WINDOW *win_title; /* title window */ WINDOW *win_chat; /* chat window (example: channel) */ - WINDOW *win_nick; /* nick window */ - WINDOW *win_status; /* status window */ - WINDOW *win_input; /* input window */ WINDOW *win_separator; /* separation between 2 splited (V) win */ struct t_gui_bar_window *bar_windows; /* bar windows */ struct t_gui_bar_window *last_bar_window; /* last bar window */ diff --git a/src/gui/gtk/CMakeLists.txt b/src/gui/gtk/CMakeLists.txt index a95cb3376..bc255f51a 100644 --- a/src/gui/gtk/CMakeLists.txt +++ b/src/gui/gtk/CMakeLists.txt @@ -15,8 +15,7 @@ # SET(WEECHAT_GTK_SRC gui-gtk-bar.c gui-gtk-chat.c gui-gtk-color.c -gui-gtk-input.c gui-gtk-keyboard.c gui-gtk-main.c -gui-gtk-nicklist.c gui-gtk-status.c gui-gtk-window.c gui-gtk.h) +gui-gtk-keyboard.c gui-gtk-main.c gui-gtk-window.c gui-gtk.h) SET(EXECUTABLE weechat-gtk) diff --git a/src/gui/gtk/Makefile.am b/src/gui/gtk/Makefile.am index 80faac7e4..a6c1d9f9b 100644 --- a/src/gui/gtk/Makefile.am +++ b/src/gui/gtk/Makefile.am @@ -31,10 +31,7 @@ weechat_gtk_LDADD = ./../../core/lib_weechat_core.a \ weechat_gtk_SOURCES = gui-gtk-bar.c \ gui-gtk-chat.c \ gui-gtk-color.c \ - gui-gtk-input.c \ gui-gtk-keyboard.c \ gui-gtk-main.c \ - gui-gtk-nicklist.c \ - gui-gtk-status.c \ gui-gtk-window.c \ gui-gtk.h diff --git a/src/gui/gtk/gui-gtk-chat.c b/src/gui/gtk/gui-gtk-chat.c index 5366d1ebc..6899fb2b5 100644 --- a/src/gui/gtk/gui-gtk-chat.c +++ b/src/gui/gtk/gui-gtk-chat.c @@ -176,18 +176,6 @@ gui_chat_set_weechat_color (struct t_gui_window *window, int weechat_color) } /* - * gui_chat_draw_title: draw title window for a buffer - */ - -void -gui_chat_draw_title (struct t_gui_buffer *buffer, int erase) -{ - /* TODO: write this function for Gtk */ - (void) buffer; - (void) erase; -} - -/* * gui_chat_string_next_char: returns next char of a word (for display) * special chars like colors, bold, .. are skipped * and optionaly applied diff --git a/src/gui/gtk/gui-gtk-input.c b/src/gui/gtk/gui-gtk-input.c deleted file mode 100644 index 3c4df768c..000000000 --- a/src/gui/gtk/gui-gtk-input.c +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 2003-2008 by FlashCode <flashcode@flashtux.org> - * See README for License detail, AUTHORS for developers list. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -/* gui-gtk-input: user input functions for Gtk GUI */ - - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <stdlib.h> - -#include "../../core/weechat.h" -#include "../../core/wee-config.h" -#include "../../core/wee-utf8.h" -#include "../../plugins/plugin.h" -#include "../gui-input.h" -#include "../gui-window.h" -#include "gui-gtk.h" - - -/* - * gui_input_set_color: set color for an input window - */ - -void -gui_input_set_color (struct t_gui_window *window, int irc_color) -{ - /*int fg, bg;*/ - - /* TODO: write this function for Gtk */ - (void) window; - (void) irc_color; -} - -/* - * gui_input_draw_prompt: display input prompt - */ - -void -gui_input_draw_prompt (struct t_gui_window *window, const char *nick) -{ - /*char *pos, saved_char, *modes; - int char_size, mode_found;*/ - - /* TODO: write this function for Gtk */ - (void) window; - (void) nick; -} - -/* - * gui_input_draw_text: display text in input buffer, according to color mask - */ - -void -gui_input_draw_text (struct t_gui_window *window, int input_width) -{ - /*char *ptr_start, *ptr_next, saved_char; - int pos_mask, size, last_color, color;*/ - - /* TODO: write this function for Gtk */ - (void) window; - (void) input_width; -} - -/* - * gui_input_draw: draw input window for a buffer - */ - -void -gui_input_draw (struct t_gui_buffer *buffer, int erase) -{ - /*struct t_gui_window *ptr_win; - char format[32]; - char *ptr_nickname; - int input_width; - t_irc_dcc *dcc_selected;*/ - - if (!gui_ok) - return; - - /* TODO: write this function for Gtk */ - (void) buffer; - (void) erase; -} diff --git a/src/gui/gtk/gui-gtk-nicklist.c b/src/gui/gtk/gui-gtk-nicklist.c deleted file mode 100644 index 16f4819d3..000000000 --- a/src/gui/gtk/gui-gtk-nicklist.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2003-2008 by FlashCode <flashcode@flashtux.org> - * See README for License detail, AUTHORS for developers list. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -/* gui-gtk-nicklist.c: nicklist display functions for Gtk GUI */ - - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include "../../core/weechat.h" -#include "../../core/wee-config.h" -#include "../gui-nicklist.h" -#include "gui-gtk.h" - - -/* - * gui_nicklist_draw: draw nick window for a buffer - * return 1 if chat window has been refreshed, 0 if only - * nicklist has been refreshed - */ - -int -gui_nicklist_draw (struct t_gui_buffer *buffer, int erase) -{ - /* TODO: write this function for Gtk */ - (void) buffer; - (void) erase; - - return 0; -} diff --git a/src/gui/gtk/gui-gtk-status.c b/src/gui/gtk/gui-gtk-status.c deleted file mode 100644 index 88745be0b..000000000 --- a/src/gui/gtk/gui-gtk-status.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (c) 2003-2008 by FlashCode <flashcode@flashtux.org> - * See README for License detail, AUTHORS for developers list. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -/* gui-gtk-status.c: status display functions for Gtk GUI */ - - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <stdlib.h> -#include <string.h> - -#include "../../core/weechat.h" -#include "../../core/wee-config.h" -#include "../gui-status.h" -#include "gui-gtk.h" - - -/* - * gui_status_draw: draw status window - */ - -void -gui_status_draw (int erase) -{ - /* TODO: write this function for Gtk */ - (void) erase; -} diff --git a/src/gui/gtk/gui-gtk-window.c b/src/gui/gtk/gui-gtk-window.c index ede8ccf33..b7a683ea6 100644 --- a/src/gui/gtk/gui-gtk-window.c +++ b/src/gui/gtk/gui-gtk-window.c @@ -36,7 +36,6 @@ #include "../gui-hotlist.h" #include "../gui-nicklist.h" #include "../gui-main.h" -#include "../gui-status.h" #include "gui-gtk.h" @@ -75,8 +74,6 @@ gui_window_objects_init (struct t_gui_window *window) GUI_GTK(window)->textview_chat = NULL; GUI_GTK(window)->textbuffer_chat = NULL; GUI_GTK(window)->texttag_chat = NULL; - GUI_GTK(window)->textview_nicklist = NULL; - GUI_GTK(window)->textbuffer_nicklist = NULL; GUI_GTK(window)->bar_windows = NULL; GUI_GTK(window)->last_bar_window = NULL; return 1; @@ -118,14 +115,11 @@ gui_window_set_weechat_color (WINDOW *window, int num_color) * gui_window_calculate_pos_size: calculate position and size for a window & sub-win */ -int -gui_window_calculate_pos_size (struct t_gui_window *window, int force_calculate) +void +gui_window_calculate_pos_size (struct t_gui_window *window) { /* TODO: write this function for Gtk */ (void) window; - (void) force_calculate; - - return 0; } /* @@ -214,8 +208,7 @@ gui_window_switch_to_buffer (struct t_gui_window *window, struct t_gui_buffer *b } window->buffer = buffer; - window->win_nick_start = 0; - gui_window_calculate_pos_size (window, 1); + gui_window_calculate_pos_size (window); if (!GUI_GTK(window)->textview_chat) { @@ -233,17 +226,6 @@ gui_window_switch_to_buffer (struct t_gui_window *window, struct t_gui_buffer *b gtk_text_buffer_get_bounds (GUI_GTK(window)->textbuffer_chat, &start, &end); gtk_text_buffer_apply_tag (GUI_GTK(window)->textbuffer_chat, GUI_GTK(window)->texttag_chat, &start, &end); } - if (buffer->nicklist && !GUI_GTK(window)->textbuffer_nicklist) - { - GUI_GTK(window)->textview_nicklist = gtk_text_view_new (); - gtk_widget_show (GUI_GTK(window)->textview_nicklist); - gtk_container_add (GTK_CONTAINER (gui_gtk_scrolledwindow_nick), GUI_GTK(window)->textview_nicklist); - gtk_text_view_set_editable (GTK_TEXT_VIEW (GUI_GTK(window)->textview_nicklist), FALSE); - gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (GUI_GTK(window)->textview_nicklist), FALSE); - - GUI_GTK(window)->textbuffer_nicklist = gtk_text_buffer_new (NULL); - gtk_text_view_set_buffer (GTK_TEXT_VIEW (GUI_GTK(window)->textview_nicklist), GUI_GTK(window)->textbuffer_nicklist); - } window->start_line = NULL; window->start_line_pos = 0; @@ -271,7 +253,6 @@ gui_window_page_up (struct t_gui_window *window) (-1) * (window->win_chat_height - 1) : (-1) * ((window->win_chat_height - 1) * 2)); gui_chat_draw (window->buffer, 0); - gui_status_refresh_needed = 1; } } @@ -307,7 +288,6 @@ gui_window_page_down (struct t_gui_window *window) } gui_chat_draw (window->buffer, 0); - gui_status_refresh_needed = 1; } } @@ -330,7 +310,6 @@ gui_window_scroll_up (struct t_gui_window *window) (-1) * ( (window->win_chat_height - 1) + CONFIG_INTEGER(config_look_scroll_amount))); gui_chat_draw (window->buffer, 0); - gui_status_refresh_needed = 1; } } @@ -367,7 +346,6 @@ gui_window_scroll_down (struct t_gui_window *window) } gui_chat_draw (window->buffer, 0); - gui_status_refresh_needed = 1; } } @@ -386,7 +364,6 @@ gui_window_scroll_top (struct t_gui_window *window) window->start_line = window->buffer->lines; window->start_line_pos = 0; gui_chat_draw (window->buffer, 0); - gui_status_refresh_needed = 1; } } @@ -405,134 +382,6 @@ gui_window_scroll_bottom (struct t_gui_window *window) window->start_line = NULL; window->start_line_pos = 0; gui_chat_draw (window->buffer, 0); - gui_status_refresh_needed = 1; - } -} - -/* - * gui_window_scroll_topic_left: scroll left topic - */ - -void -gui_window_scroll_topic_left (struct t_gui_window *window) -{ - if (!gui_ok) - return; - - if (window->win_title_start > 0) - window->win_title_start -= (window->win_width * 3) / 4; - if (window->win_title_start < 0) - window->win_title_start = 0; - gui_chat_draw_title (window->buffer, 1); -} - -/* - * gui_window_scroll_topic_right: scroll right topic - */ - -void -gui_window_scroll_topic_right (struct t_gui_window *window) -{ - if (!gui_ok) - return; - - window->win_title_start += (window->win_width * 3) / 4; - gui_chat_draw_title (window->buffer, 1); -} - -/* - * gui_window_nicklist_page_up: scroll one page up in nicklist - */ - -void -gui_window_nicklist_page_up (struct t_gui_window *window) -{ - if (!gui_ok) - return; - - if (window->buffer->nicklist) - { - if (window->win_nick_start > 0) - { - window->win_nick_start -= (window->win_nick_height - 1); - if (window->win_nick_start <= 1) - window->win_nick_start = 0; - gui_nicklist_draw (window->buffer, 1); - } - } -} - -/* - * gui_window_nicklist_page_down: scroll one page down in nicklist - */ - -void -gui_window_nicklist_page_down (struct t_gui_window *window) -{ - if (!gui_ok) - return; - - if (window->buffer->nicklist) - { - if ((window->buffer->nicklist_visible_count > window->win_nick_height) - && (window->win_nick_start + window->win_nick_height - 1 - < window->buffer->nicklist_visible_count)) - { - if (window->win_nick_start == 0) - window->win_nick_start += (window->win_nick_height - 1); - else - window->win_nick_start += (window->win_nick_height - 2); - gui_nicklist_draw (window->buffer, 1); - } - } -} - -/* - * gui_window_nicklist_beginning: go to beginning of nicklist - */ - -void -gui_window_nicklist_beginning (struct t_gui_window *window) -{ - if (!gui_ok) - return; - - if (window->buffer->nicklist) - { - if (window->win_nick_start > 0) - { - window->win_nick_start = 0; - gui_nicklist_draw (window->buffer, 1); - } - } -} - -/* - * gui_window_nicklist_end: go to the end of nicklist - */ - -void -gui_window_nicklist_end (struct t_gui_window *window) -{ - int new_start; - - if (!gui_ok) - return; - - if (window->buffer->nicklist) - { - new_start = - window->buffer->nicklist_visible_count - window->win_nick_height; - if (new_start < 0) - new_start = 0; - else if (new_start >= 1) - new_start++; - - if (new_start != window->win_nick_start) - { - window->win_nick_start = new_start; - gui_nicklist_draw (window->buffer, 1); - } } } @@ -958,8 +807,6 @@ gui_window_objects_print_log (struct t_gui_window *window) log_printf (" textview_chat . . . : 0x%x", GUI_GTK(window)->textview_chat); log_printf (" textbuffer_chat . . : 0x%x", GUI_GTK(window)->textbuffer_chat); log_printf (" texttag_chat. . . . : 0x%x", GUI_GTK(window)->texttag_chat); - log_printf (" textview_nicklist . : 0x%x", GUI_GTK(window)->textview_nicklist); - log_printf (" textbuffer_nicklist : 0x%x", GUI_GTK(window)->textbuffer_nicklist); log_printf (" bar_windows . . . . : 0x%x", GUI_GTK(window)->bar_windows); log_printf (" last_bar_windows. . : 0x%x", GUI_GTK(window)->last_bar_window); log_printf (" current_style_fg. . : %d", GUI_GTK(window)->current_style_fg); diff --git a/src/gui/gtk/gui-gtk.h b/src/gui/gtk/gui-gtk.h index 5513f29a5..7665a725d 100644 --- a/src/gui/gtk/gui-gtk.h +++ b/src/gui/gtk/gui-gtk.h @@ -73,8 +73,6 @@ struct t_gui_gtk_objects GtkWidget *textview_chat; /* textview widget for chat */ GtkTextBuffer *textbuffer_chat; /* textbuffer widget for chat */ GtkTextTag *texttag_chat; /* texttag widget for chat */ - GtkWidget *textview_nicklist; /* textview widget for nicklist */ - GtkTextBuffer *textbuffer_nicklist; /* textbuffer widget for nicklist */ struct t_gui_bar_window *bar_windows; /* bar windows */ struct t_gui_bar_window *last_bar_window; /* last bar window */ int current_style_fg; /* current foreground color */ @@ -85,13 +83,11 @@ struct t_gui_gtk_objects extern GtkWidget *gui_gtk_main_window; extern GtkWidget *gui_gtk_vbox1; -extern GtkWidget *gui_gtk_entry_topic; extern GtkWidget *gui_gtk_notebook1; extern GtkWidget *gui_gtk_vbox2; extern GtkWidget *gui_gtk_hbox1; extern GtkWidget *gui_gtk_hpaned1; extern GtkWidget *gui_gtk_scrolledwindow_chat; -extern GtkWidget *gui_gtk_scrolledwindow_nick; extern GtkWidget *gui_gtk_entry_input; extern GtkWidget *gui_gtk_label1; diff --git a/src/gui/gui-buffer.c b/src/gui/gui-buffer.c index 01d373035..1df8fca4c 100644 --- a/src/gui/gui-buffer.c +++ b/src/gui/gui-buffer.c @@ -51,7 +51,6 @@ #include "gui-layout.h" #include "gui-main.h" #include "gui-nicklist.h" -#include "gui-status.h" #include "gui-window.h" @@ -180,7 +179,6 @@ gui_buffer_new (struct t_weechat_plugin *plugin, /* title */ new_buffer->title = NULL; - new_buffer->title_refresh_needed = 1; /* chat lines (formated) */ new_buffer->lines = NULL; @@ -198,7 +196,6 @@ gui_buffer_new (struct t_weechat_plugin *plugin, new_buffer->nicklist_max_length = 0; new_buffer->nicklist_display_groups = 1; new_buffer->nicklist_visible_count = 0; - new_buffer->nicklist_refresh_needed = 1; gui_nicklist_add_group (new_buffer, NULL, "root", NULL, 0); /* input */ @@ -257,7 +254,7 @@ gui_buffer_new (struct t_weechat_plugin *plugin, gui_current_window->first_line_displayed = 1; gui_current_window->start_line = NULL; gui_current_window->start_line_pos = 0; - gui_window_calculate_pos_size (gui_current_window, 1); + gui_window_calculate_pos_size (gui_current_window); gui_window_switch_to_buffer (gui_current_window, new_buffer); } @@ -383,17 +380,6 @@ gui_buffer_get_pointer (struct t_gui_buffer *buffer, const char *property) } /* - * gui_buffer_ask_title_refresh: set "title_refresh_needed" flag - */ - -void -gui_buffer_ask_title_refresh (struct t_gui_buffer *buffer, int refresh) -{ - if (refresh > buffer->title_refresh_needed) - buffer->title_refresh_needed = refresh; -} - -/* * gui_buffer_ask_chat_refresh: set "chat_refresh_needed" flag */ @@ -405,17 +391,6 @@ gui_buffer_ask_chat_refresh (struct t_gui_buffer *buffer, int refresh) } /* - * gui_buffer_ask_nicklist_refresh: set "nicklist_refresh_needed" flag - */ - -void -gui_buffer_ask_nicklist_refresh (struct t_gui_buffer *buffer, int refresh) -{ - if (refresh > buffer->nicklist_refresh_needed) - buffer->nicklist_refresh_needed = refresh; -} - -/* * gui_buffer_ask_input_refresh: set "input_refresh_needed" flag */ @@ -439,8 +414,6 @@ gui_buffer_set_name (struct t_gui_buffer *buffer, const char *name) free (buffer->name); buffer->name = strdup (name); - gui_status_refresh_needed = 1; - hook_signal_send ("buffer_renamed", WEECHAT_HOOK_SIGNAL_POINTER, buffer); } @@ -472,7 +445,6 @@ gui_buffer_set_title (struct t_gui_buffer *buffer, const char *new_title) if (buffer->title) free (buffer->title); buffer->title = (new_title && new_title[0]) ? strdup (new_title) : NULL; - gui_buffer_ask_title_refresh (buffer, 1); hook_signal_send ("buffer_title_changed", WEECHAT_HOOK_SIGNAL_STRING, NULL); } @@ -509,7 +481,6 @@ gui_buffer_set_nicklist_display_groups (struct t_gui_buffer *buffer, buffer->nicklist_display_groups = (display_groups) ? 1 : 0; buffer->nicklist_visible_count = 0; gui_nicklist_compute_visible_count (buffer, buffer->nicklist_root); - gui_buffer_ask_nicklist_refresh (buffer, 1); } /* @@ -651,7 +622,6 @@ gui_buffer_set (struct t_gui_buffer *buffer, const char *property, else if (string_strcasecmp (property, "display") == 0) { gui_window_switch_to_buffer (gui_current_window, buffer); - gui_status_refresh_needed = 1; } else if (string_strcasecmp (property, "name") == 0) { @@ -954,7 +924,6 @@ gui_buffer_clear (struct t_gui_buffer *buffer) } gui_buffer_ask_chat_refresh (buffer, 2); - gui_status_refresh_needed = 1; } /* @@ -1061,9 +1030,6 @@ gui_buffer_close (struct t_gui_buffer *buffer, int switch_to_another) WEECHAT_HOOK_SIGNAL_POINTER, buffer); free (buffer); - - if (gui_windows && gui_current_window && gui_current_window->buffer) - gui_status_refresh_needed = 1; } /* @@ -1084,8 +1050,6 @@ gui_buffer_switch_previous (struct t_gui_window *window) gui_window_switch_to_buffer (window, window->buffer->prev_buffer); else gui_window_switch_to_buffer (window, last_gui_buffer); - - gui_status_refresh_needed = 1; } /* @@ -1106,8 +1070,6 @@ gui_buffer_switch_next (struct t_gui_window *window) gui_window_switch_to_buffer (window, window->buffer->next_buffer); else gui_window_switch_to_buffer (window, gui_buffers); - - gui_status_refresh_needed = 1; } /* @@ -1133,7 +1095,6 @@ gui_buffer_switch_by_number (struct t_gui_window *window, int number) if ((ptr_buffer != window->buffer) && (number == ptr_buffer->number)) { gui_window_switch_to_buffer (window, ptr_buffer); - gui_status_refresh_needed = 1; return; } } @@ -1227,8 +1188,6 @@ gui_buffer_move_to_number (struct t_gui_buffer *buffer, int number) ptr_buffer->number = i++; } - gui_status_refresh_needed = 1; - snprintf (buf1_str, sizeof (buf1_str) - 1, "%d", buffer->number); argv[0] = buf1_str; argv[1] = buf2_str; @@ -1472,7 +1431,6 @@ gui_buffer_print_log () log_printf (" close_callback . . . . : 0x%x", ptr_buffer->close_callback); log_printf (" close_callback_data. . : 0x%x", ptr_buffer->close_callback_data); log_printf (" title. . . . . . . . . : '%s'", ptr_buffer->title); - log_printf (" title_refresh_needed . : %d", ptr_buffer->title_refresh_needed); log_printf (" lines. . . . . . . . . : 0x%x", ptr_buffer->lines); log_printf (" last_line. . . . . . . : 0x%x", ptr_buffer->last_line); log_printf (" last_read_line . . . . : 0x%x", ptr_buffer->last_read_line); @@ -1486,7 +1444,6 @@ gui_buffer_print_log () log_printf (" nicklist_max_length. . : %d", ptr_buffer->nicklist_max_length); log_printf (" nicklist_display_groups: %d", ptr_buffer->nicklist_display_groups); log_printf (" nicklist_visible_count.: %d", ptr_buffer->nicklist_visible_count); - log_printf (" nicklist_refresh_needed: %d", ptr_buffer->nicklist_refresh_needed); log_printf (" input. . . . . . . . . : %d", ptr_buffer->input); log_printf (" input_callback . . . . : 0x%x", ptr_buffer->input_callback); log_printf (" input_callback_data. . : 0x%x", ptr_buffer->input_callback_data); diff --git a/src/gui/gui-buffer.h b/src/gui/gui-buffer.h index d293c8d44..966447c9f 100644 --- a/src/gui/gui-buffer.h +++ b/src/gui/gui-buffer.h @@ -93,7 +93,6 @@ struct t_gui_buffer /* buffer title */ char *title; /* buffer title */ - int title_refresh_needed; /* refresh for title is needed ? */ /* chat content */ struct t_gui_line *lines; /* lines of chat window */ @@ -112,7 +111,6 @@ struct t_gui_buffer int nicklist_max_length; /* max length for a nick */ int nicklist_display_groups; /* display groups ? */ int nicklist_visible_count; /* number of nicks/groups to display */ - int nicklist_refresh_needed; /* refresh for nicklist is needed ? */ /* inupt */ int input; /* = 1 if input is enabled */ @@ -189,8 +187,6 @@ extern char *gui_buffer_get_string (struct t_gui_buffer *buffer, const char *property); extern void *gui_buffer_get_pointer (struct t_gui_buffer *buffer, const char *property); -extern void gui_buffer_ask_title_refresh (struct t_gui_buffer *buffer, - int refresh); extern void gui_buffer_ask_chat_refresh (struct t_gui_buffer *buffer, int refresh); extern void gui_buffer_ask_nicklist_refresh (struct t_gui_buffer *buffer, diff --git a/src/gui/gui-chat.c b/src/gui/gui-chat.c index c52164e56..cac78bd17 100644 --- a/src/gui/gui-chat.c +++ b/src/gui/gui-chat.c @@ -43,7 +43,6 @@ #include "gui-filter.h" #include "gui-hotlist.h" #include "gui-main.h" -#include "gui-status.h" #include "gui-window.h" @@ -666,7 +665,6 @@ gui_chat_line_free (struct t_gui_buffer *buffer, struct t_gui_line *line) ptr_win->start_line = ptr_win->start_line->next_line; ptr_win->start_line_pos = 0; gui_buffer_ask_chat_refresh (buffer, 2); - gui_status_refresh_needed = 1; } } diff --git a/src/gui/gui-chat.h b/src/gui/gui-chat.h index 35c20530e..01e3535a8 100644 --- a/src/gui/gui-chat.h +++ b/src/gui/gui-chat.h @@ -90,7 +90,6 @@ extern void gui_chat_printf_y (struct t_gui_buffer *buffer, int y, /* chat functions (GUI dependent) */ -extern void gui_chat_draw_title (struct t_gui_buffer *buffer, int erase); extern char *gui_chat_string_next_char (struct t_gui_window *window, const unsigned char *string, int apply_style); diff --git a/src/gui/gui-color.h b/src/gui/gui-color.h index 54f3d12f7..9408f3dcf 100644 --- a/src/gui/gui-color.h +++ b/src/gui/gui-color.h @@ -26,8 +26,6 @@ enum t_gui_color_enum { GUI_COLOR_SEPARATOR = 0, - GUI_COLOR_TITLE, - GUI_COLOR_CHAT, GUI_COLOR_CHAT_TIME, GUI_COLOR_CHAT_TIME_DELIMITERS, @@ -60,35 +58,6 @@ enum t_gui_color_enum GUI_COLOR_CHAT_READ_MARKER, GUI_COLOR_CHAT_TEXT_FOUND, - GUI_COLOR_STATUS, - GUI_COLOR_STATUS_DELIMITERS, - GUI_COLOR_STATUS_NUMBER, - GUI_COLOR_STATUS_NAME, - GUI_COLOR_STATUS_DATA_MSG, - GUI_COLOR_STATUS_DATA_PRIVATE, - GUI_COLOR_STATUS_DATA_HIGHLIGHT, - GUI_COLOR_STATUS_DATA_OTHER, - GUI_COLOR_STATUS_MORE, - - GUI_COLOR_INPUT, - GUI_COLOR_INPUT_SERVER, - GUI_COLOR_INPUT_CHANNEL, - GUI_COLOR_INPUT_NICK, - GUI_COLOR_INPUT_DELIMITERS, - GUI_COLOR_INPUT_TEXT_NOT_FOUND, - GUI_COLOR_INPUT_ACTIONS, - - GUI_COLOR_NICKLIST, - GUI_COLOR_NICKLIST_GROUP, - GUI_COLOR_NICKLIST_AWAY, - GUI_COLOR_NICKLIST_PREFIX1, - GUI_COLOR_NICKLIST_PREFIX2, - GUI_COLOR_NICKLIST_PREFIX3, - GUI_COLOR_NICKLIST_PREFIX4, - GUI_COLOR_NICKLIST_PREFIX5, - GUI_COLOR_NICKLIST_MORE, - GUI_COLOR_NICKLIST_SEPARATOR, - /* number of colors */ GUI_COLOR_NUM_COLORS, }; diff --git a/src/gui/gui-hotlist.c b/src/gui/gui-hotlist.c index b1649118f..494a86008 100644 --- a/src/gui/gui-hotlist.c +++ b/src/gui/gui-hotlist.c @@ -36,7 +36,6 @@ #include "gui-hotlist.h" #include "gui-buffer.h" #include "gui-color.h" -#include "gui-status.h" #include "gui-window.h" @@ -49,6 +48,16 @@ int gui_add_hotlist = 1; /* 0 is for temporarly disable */ /* + * gui_hotlist_changed_signal: send signal "hotlist_changed" + */ + +void +gui_hotlist_changed_signal () +{ + hook_signal_send ("hotlist_changed", WEECHAT_HOOK_SIGNAL_STRING, NULL); +} + +/* * gui_hotlist_search: find hotlist with buffer pointer */ @@ -67,6 +76,50 @@ gui_hotlist_search (struct t_gui_hotlist *hotlist, struct t_gui_buffer *buffer) } /* + * gui_hotlist_free: free a hotlist and remove it from hotlist queue + */ + +void +gui_hotlist_free (struct t_gui_hotlist **hotlist, + struct t_gui_hotlist **last_hotlist, + struct t_gui_hotlist *ptr_hotlist) +{ + struct t_gui_hotlist *new_hotlist; + + /* remove hotlist from queue */ + if (*last_hotlist == ptr_hotlist) + *last_hotlist = ptr_hotlist->prev_hotlist; + if (ptr_hotlist->prev_hotlist) + { + (ptr_hotlist->prev_hotlist)->next_hotlist = ptr_hotlist->next_hotlist; + new_hotlist = *hotlist; + } + else + new_hotlist = ptr_hotlist->next_hotlist; + + if (ptr_hotlist->next_hotlist) + (ptr_hotlist->next_hotlist)->prev_hotlist = ptr_hotlist->prev_hotlist; + + free (ptr_hotlist); + *hotlist = new_hotlist; +} + +/* + * gui_hotlist_free_all: free all hotlists + */ + +void +gui_hotlist_free_all (struct t_gui_hotlist **hotlist, + struct t_gui_hotlist **last_hotlist) +{ + /* remove all hotlists */ + while (*hotlist) + { + gui_hotlist_free (hotlist, last_hotlist, *hotlist); + } +} + +/* * gui_hotlist_check_buffer_notify: return: 1 if buffer notify is ok according * to priority (buffer will be added * to hotlist) @@ -206,8 +259,6 @@ gui_hotlist_add_hotlist (struct t_gui_hotlist **hotlist, *hotlist = new_hotlist; *last_hotlist = new_hotlist; } - - hook_signal_send ("hotlist_changed", WEECHAT_HOOK_SIGNAL_STRING, NULL); } /* @@ -267,7 +318,7 @@ gui_hotlist_add (struct t_gui_buffer *buffer, int priority, gui_hotlist_add_hotlist (&gui_hotlist, &last_gui_hotlist, new_hotlist); - gui_status_refresh_needed = 1; + gui_hotlist_changed_signal (); } /* @@ -312,57 +363,24 @@ gui_hotlist_resort () element = gui_hotlist_dup (ptr_hotlist); gui_hotlist_add_hotlist (&new_hotlist, &last_new_hotlist, element); } - + gui_hotlist_free_all (&gui_hotlist, &last_gui_hotlist); - + gui_hotlist = new_hotlist; last_gui_hotlist = last_new_hotlist; -} - -/* - * gui_hotlist_free: free a hotlist and remove it from hotlist queue - */ - -void -gui_hotlist_free (struct t_gui_hotlist **hotlist, - struct t_gui_hotlist **last_hotlist, - struct t_gui_hotlist *ptr_hotlist) -{ - struct t_gui_hotlist *new_hotlist; - - /* remove hotlist from queue */ - if (*last_hotlist == ptr_hotlist) - *last_hotlist = ptr_hotlist->prev_hotlist; - if (ptr_hotlist->prev_hotlist) - { - (ptr_hotlist->prev_hotlist)->next_hotlist = ptr_hotlist->next_hotlist; - new_hotlist = *hotlist; - } - else - new_hotlist = ptr_hotlist->next_hotlist; - - if (ptr_hotlist->next_hotlist) - (ptr_hotlist->next_hotlist)->prev_hotlist = ptr_hotlist->prev_hotlist; - - free (ptr_hotlist); - *hotlist = new_hotlist; - hook_signal_send ("hotlist_changed", WEECHAT_HOOK_SIGNAL_STRING, NULL); + gui_hotlist_changed_signal (); } /* - * gui_hotlist_free_all: free all hotlists + * gui_hotlist_clear: clear hotlist */ void -gui_hotlist_free_all (struct t_gui_hotlist **hotlist, - struct t_gui_hotlist **last_hotlist) +gui_hotlist_clear () { - /* remove all hotlists */ - while (*hotlist) - { - gui_hotlist_free (hotlist, last_hotlist, *hotlist); - } + gui_hotlist_free_all (&gui_hotlist, &last_gui_hotlist); + gui_hotlist_changed_signal (); } /* @@ -376,7 +394,10 @@ gui_hotlist_remove_buffer (struct t_gui_buffer *buffer) pos_hotlist = gui_hotlist_search (gui_hotlist, buffer); if (pos_hotlist) + { gui_hotlist_free (&gui_hotlist, &last_gui_hotlist, pos_hotlist); + gui_hotlist_changed_signal (); + } } /* diff --git a/src/gui/gui-hotlist.h b/src/gui/gui-hotlist.h index 486e8bab6..88372cc74 100644 --- a/src/gui/gui-hotlist.h +++ b/src/gui/gui-hotlist.h @@ -47,15 +47,12 @@ extern int gui_add_hotlist; /* hotlist functions */ +extern void gui_hotlist_changed_signal (); extern void gui_hotlist_add (struct t_gui_buffer *buffer, int priority, struct timeval *creation_time, int allow_current_buffer); extern void gui_hotlist_resort (); -extern void gui_hotlist_free (struct t_gui_hotlist **hotlist, - struct t_gui_hotlist **last_hotlist, - struct t_gui_hotlist *ptr_hotlist); -extern void gui_hotlist_free_all (struct t_gui_hotlist **hotlist, - struct t_gui_hotlist **last_hotlist); +extern void gui_hotlist_clear (); extern void gui_hotlist_remove_buffer (struct t_gui_buffer *buffer); extern int gui_hotlist_add_to_infolist (struct t_infolist *infolist, struct t_gui_hotlist *hotlist); diff --git a/src/gui/gui-input.c b/src/gui/gui-input.c index 8a3f21a21..890d13c66 100644 --- a/src/gui/gui-input.c +++ b/src/gui/gui-input.c @@ -40,7 +40,6 @@ #include "gui-history.h" #include "gui-hotlist.h" #include "gui-keyboard.h" -#include "gui-status.h" #include "gui-window.h" @@ -1280,7 +1279,6 @@ gui_input_jump_smart () gui_window_switch_to_buffer (gui_current_window, gui_hotlist->buffer); gui_window_scroll_bottom (gui_current_window); - gui_status_refresh_needed = 1; } else { @@ -1289,7 +1287,6 @@ gui_input_jump_smart () gui_window_switch_to_buffer (gui_current_window, gui_hotlist_initial_buffer); gui_window_scroll_bottom (gui_current_window); - gui_status_refresh_needed = 1; gui_hotlist_initial_buffer = NULL; } } @@ -1336,11 +1333,7 @@ gui_input_jump_previous_buffer () void gui_input_hotlist_clear () { - if (gui_hotlist) - { - gui_hotlist_free_all (&gui_hotlist, &last_gui_hotlist); - gui_status_refresh_needed = 1; - } + gui_hotlist_clear (); gui_hotlist_initial_buffer = gui_current_window->buffer; } @@ -1378,7 +1371,6 @@ gui_input_scroll_unread () gui_current_window->first_line_displayed = (gui_current_window->start_line == gui_chat_get_first_line_displayed (gui_current_window->buffer)); gui_buffer_ask_chat_refresh (gui_current_window->buffer, 2); - gui_status_refresh_needed = 1; } } } diff --git a/src/gui/gui-input.h b/src/gui/gui-input.h index 1bc6ef2b5..601b62ce0 100644 --- a/src/gui/gui-input.h +++ b/src/gui/gui-input.h @@ -72,8 +72,4 @@ extern void gui_input_set_unread (); extern void gui_input_set_unread_current_buffer (); extern void gui_input_insert (); -/* input functions (GUI dependent) */ - -extern void gui_input_draw (struct t_gui_buffer *buffer, int erase); - #endif /* gui-input.h */ diff --git a/src/gui/gui-keyboard.c b/src/gui/gui-keyboard.c index d93d49748..50803952a 100644 --- a/src/gui/gui-keyboard.c +++ b/src/gui/gui-keyboard.c @@ -115,7 +115,6 @@ gui_keyboard_grab_end () gui_input_insert_string (gui_current_window->buffer, expanded_key, -1); if (gui_current_window->buffer->completion) gui_completion_stop (gui_current_window->buffer->completion, 1); - gui_input_draw (gui_current_window->buffer, 0); gui_input_text_changed_signal (); } free (expanded_key); diff --git a/src/gui/gui-nicklist.c b/src/gui/gui-nicklist.c index e851e008b..37cfcae18 100644 --- a/src/gui/gui-nicklist.c +++ b/src/gui/gui-nicklist.c @@ -42,7 +42,6 @@ #include "gui-nicklist.h" #include "gui-buffer.h" #include "gui-color.h" -#include "gui-status.h" /* @@ -197,11 +196,7 @@ gui_nicklist_add_group (struct t_gui_buffer *buffer, } if (buffer->nicklist_display_groups && visible) - { - gui_buffer_ask_nicklist_refresh (buffer, 1); buffer->nicklist_visible_count++; - gui_status_refresh_needed = 1; - } gui_nicklist_changed_signal (); @@ -322,11 +317,7 @@ gui_nicklist_add_nick (struct t_gui_buffer *buffer, gui_nicklist_insert_nick_sorted (new_nick->group, new_nick); if (visible) - { - gui_buffer_ask_nicklist_refresh (buffer, 1); buffer->nicklist_visible_count++; - gui_status_refresh_needed = 1; - } gui_nicklist_changed_signal (); @@ -364,10 +355,8 @@ gui_nicklist_remove_nick (struct t_gui_buffer *buffer, if (nick->visible) { - gui_buffer_ask_nicklist_refresh (buffer, 1); if (buffer->nicklist_visible_count > 0) buffer->nicklist_visible_count--; - gui_status_refresh_needed = 1; } free (nick); @@ -423,11 +412,9 @@ gui_nicklist_remove_group (struct t_gui_buffer *buffer, if (group->visible) { - gui_buffer_ask_nicklist_refresh (buffer, 1); if (buffer->nicklist_display_groups && (buffer->nicklist_visible_count > 0)) buffer->nicklist_visible_count--; - gui_status_refresh_needed = 1; } free (group); diff --git a/src/gui/gui-status.c b/src/gui/gui-status.c deleted file mode 100644 index 1347b5bc2..000000000 --- a/src/gui/gui-status.c +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright (c) 2003-2008 by FlashCode <flashcode@flashtux.org> - * See README for License detail, AUTHORS for developers list. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -/* gui-status.c: status functions, used by all GUI */ - - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - - -int gui_status_refresh_needed = 0; /* refresh needed for status bar ? */ diff --git a/src/gui/gui-status.h b/src/gui/gui-status.h deleted file mode 100644 index e41b63a7e..000000000 --- a/src/gui/gui-status.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2003-2008 by FlashCode <flashcode@flashtux.org> - * See README for License detail, AUTHORS for developers list. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - - -#ifndef __WEECHAT_GUI_STATUS_H -#define __WEECHAT_GUI_STATUS_H 1 - -extern int gui_status_refresh_needed; - -/* statusbar functions (GUI dependent) */ - -extern void gui_status_draw (int erase); - -#endif /* gui-status.h */ diff --git a/src/gui/gui-window.c b/src/gui/gui-window.c index b7dbbfead..967333a5f 100644 --- a/src/gui/gui-window.c +++ b/src/gui/gui-window.c @@ -47,7 +47,6 @@ #include "gui-filter.h" #include "gui-input.h" #include "gui-hotlist.h" -#include "gui-status.h" int gui_init_ok = 0; /* = 1 if GUI is initialized*/ @@ -209,11 +208,6 @@ gui_window_new (struct t_gui_window *parent, int x, int y, int width, int height new_window->win_width_pct = width_pct; new_window->win_height_pct = height_pct; - new_window->new_x = -1; - new_window->new_y = -1; - new_window->new_width = -1; - new_window->new_height = -1; - /* chat window */ new_window->win_chat_x = 0; new_window->win_chat_y = 0; @@ -221,34 +215,6 @@ gui_window_new (struct t_gui_window *parent, int x, int y, int width, int height new_window->win_chat_height = 0; new_window->win_chat_cursor_x = 0; new_window->win_chat_cursor_y = 0; - - /* nicklist */ - new_window->win_nick_x = 0; - new_window->win_nick_y = 0; - new_window->win_nick_width = 0; - new_window->win_nick_height = 0; - new_window->win_nick_num_max = 0; - new_window->win_nick_start = 0; - - /* title */ - new_window->win_title_x = 0; - new_window->win_title_y = 0; - new_window->win_title_width = 0; - new_window->win_title_height = 0; - new_window->win_title_start = 0; - - /* status */ - new_window->win_status_x = 0; - new_window->win_status_y = 0; - new_window->win_status_width = 0; - new_window->win_status_height = 0; - - /* input */ - new_window->win_input_x = 0; - new_window->win_input_y = 0; - new_window->win_input_width = 0; - new_window->win_input_height = 0; - new_window->win_input_cursor_x = 0; /* refresh */ new_window->refresh_needed = 0; @@ -264,6 +230,7 @@ gui_window_new (struct t_gui_window *parent, int x, int y, int width, int height new_window->start_line_pos = 0; new_window->scroll = 0; new_window->scroll_lines_after = 0; + new_window->scroll_reset_allowed = 0; new_window->ptr_tree = ptr_leaf; ptr_leaf->window = new_window; @@ -712,7 +679,6 @@ gui_window_scroll (struct t_gui_window *window, char *scroll) window->first_line_displayed = (window->start_line == gui_chat_get_first_line_displayed (window->buffer)); gui_buffer_ask_chat_refresh (window->buffer, 2); - gui_status_refresh_needed = 1; return; } } @@ -810,11 +776,8 @@ gui_window_search_text (struct t_gui_window *window) && window->buffer->input_buffer && window->buffer->input_buffer[0]) { ptr_line = (window->start_line) ? - window->start_line->prev_line : window->buffer->last_line; - while (ptr_line && !gui_chat_line_displayed (ptr_line)) - { - ptr_line = ptr_line->prev_line; - } + gui_chat_get_prev_line_displayed (window->start_line) : + gui_chat_get_last_line_displayed (window->buffer); while (ptr_line) { if (gui_chat_line_search (ptr_line, @@ -826,7 +789,6 @@ gui_window_search_text (struct t_gui_window *window) window->first_line_displayed = (window->start_line == gui_chat_get_first_line_displayed (window->buffer)); gui_buffer_ask_chat_refresh (window->buffer, 2); - gui_status_refresh_needed = 1; return 1; } ptr_line = gui_chat_get_prev_line_displayed (ptr_line); @@ -839,11 +801,8 @@ gui_window_search_text (struct t_gui_window *window) && window->buffer->input_buffer && window->buffer->input_buffer[0]) { ptr_line = (window->start_line) ? - window->start_line->next_line : window->buffer->lines->next_line; - while (ptr_line && !gui_chat_line_displayed (ptr_line)) - { - ptr_line = ptr_line->next_line; - } + gui_chat_get_next_line_displayed (window->start_line) : + gui_chat_get_first_line_displayed (window->buffer); while (ptr_line) { if (gui_chat_line_search (ptr_line, @@ -855,7 +814,6 @@ gui_window_search_text (struct t_gui_window *window) window->first_line_displayed = (window->start_line == window->buffer->lines); gui_buffer_ask_chat_refresh (window->buffer, 2); - gui_status_refresh_needed = 1; return 1; } ptr_line = gui_chat_get_next_line_displayed (ptr_line); @@ -884,7 +842,6 @@ gui_window_search_start (struct t_gui_window *window) window->buffer->text_search_input = strdup (window->buffer->input_buffer); gui_input_delete_line (window->buffer); - gui_status_refresh_needed = 1; gui_buffer_ask_input_refresh (window->buffer, 1); } @@ -903,10 +860,7 @@ gui_window_search_restart (struct t_gui_window *window) if (gui_window_search_text (window)) window->buffer->text_search_found = 1; else - { gui_buffer_ask_chat_refresh (window->buffer, 2); - gui_status_refresh_needed = 1; - } } /* @@ -931,7 +885,6 @@ gui_window_search_stop (struct t_gui_window *window) window->start_line_pos = 0; gui_hotlist_remove_buffer (window->buffer); gui_buffer_ask_chat_refresh (window->buffer, 2); - gui_status_refresh_needed = 1; gui_buffer_ask_input_refresh (window->buffer, 1); } @@ -975,42 +928,6 @@ gui_window_add_to_infolist (struct t_infolist *infolist, return 0; if (!infolist_new_var_integer (ptr_item, "chat_height", window->win_chat_height)) return 0; - if (!infolist_new_var_integer (ptr_item, "nick_x", window->win_nick_x)) - return 0; - if (!infolist_new_var_integer (ptr_item, "nick_y", window->win_nick_y)) - return 0; - if (!infolist_new_var_integer (ptr_item, "nick_width", window->win_nick_width)) - return 0; - if (!infolist_new_var_integer (ptr_item, "nick_height", window->win_nick_height)) - return 0; - if (!infolist_new_var_integer (ptr_item, "nick_start", window->win_nick_start)) - return 0; - if (!infolist_new_var_integer (ptr_item, "title_x", window->win_title_x)) - return 0; - if (!infolist_new_var_integer (ptr_item, "title_y", window->win_title_y)) - return 0; - if (!infolist_new_var_integer (ptr_item, "title_width", window->win_title_width)) - return 0; - if (!infolist_new_var_integer (ptr_item, "title_start", window->win_title_start)) - return 0; - if (!infolist_new_var_integer (ptr_item, "status_x", window->win_status_x)) - return 0; - if (!infolist_new_var_integer (ptr_item, "status_y", window->win_status_y)) - return 0; - if (!infolist_new_var_integer (ptr_item, "status_width", window->win_status_width)) - return 0; - if (!infolist_new_var_integer (ptr_item, "status_height", window->win_status_height)) - return 0; - if (!infolist_new_var_integer (ptr_item, "input_x", window->win_input_x)) - return 0; - if (!infolist_new_var_integer (ptr_item, "input_y", window->win_input_y)) - return 0; - if (!infolist_new_var_integer (ptr_item, "input_width", window->win_input_width)) - return 0; - if (!infolist_new_var_integer (ptr_item, "input_height", window->win_input_height)) - return 0; - if (!infolist_new_var_integer (ptr_item, "input_cursor_x", window->win_input_cursor_x)) - return 0; if (!infolist_new_var_pointer (ptr_item, "buffer", window->buffer)) return 0; if (!infolist_new_var_integer (ptr_item, "start_line_y", @@ -1050,31 +967,18 @@ gui_window_print_log () log_printf (" win_chat_height . . : %d", ptr_window->win_chat_height); log_printf (" win_chat_cursor_x . : %d", ptr_window->win_chat_cursor_x); log_printf (" win_chat_cursor_y . : %d", ptr_window->win_chat_cursor_y); - log_printf (" win_nick_x. . . . . : %d", ptr_window->win_nick_x); - log_printf (" win_nick_y. . . . . : %d", ptr_window->win_nick_y); - log_printf (" win_nick_width. . . : %d", ptr_window->win_nick_width); - log_printf (" win_nick_height . . : %d", ptr_window->win_nick_height); - log_printf (" win_nick_start. . . : %d", ptr_window->win_nick_start); - log_printf (" win_title_x . . . . : %d", ptr_window->win_title_x); - log_printf (" win_title_y . . . . : %d", ptr_window->win_title_y); - log_printf (" win_title_width . . : %d", ptr_window->win_title_width); - log_printf (" win_title_height. . : %d", ptr_window->win_title_height); - log_printf (" win_title_start . . : %d", ptr_window->win_title_start); - log_printf (" win_status_x. . . . : %d", ptr_window->win_status_x); - log_printf (" win_status_y. . . . : %d", ptr_window->win_status_y); - log_printf (" win_status_width. . : %d", ptr_window->win_status_width); - log_printf (" win_status_height . : %d", ptr_window->win_status_height); - log_printf (" win_input_x . . . . : %d", ptr_window->win_input_x); - log_printf (" win_input_y . . . . : %d", ptr_window->win_input_y); - log_printf (" win_input_width . . : %d", ptr_window->win_input_width); - log_printf (" win_input_height. . : %d", ptr_window->win_input_height); - log_printf (" win_input_cursor_x. : %d", ptr_window->win_input_cursor_x); + log_printf (" refresh_needed. . . : %d", ptr_window->refresh_needed); + log_printf (" gui_objects . . . . : 0x%x", ptr_window->gui_objects); log_printf (" buffer. . . . . . . : 0x%x", ptr_window->buffer); log_printf (" layout_plugin_name. : '%s'", ptr_window->layout_plugin_name); log_printf (" layout_buffer_name. : '%s'", ptr_window->layout_buffer_name); log_printf (" first_line_displayed: %d", ptr_window->first_line_displayed); log_printf (" start_line. . . . . : 0x%x", ptr_window->start_line); log_printf (" start_line_pos. . . : %d", ptr_window->start_line_pos); + log_printf (" scroll. . . . . . . : %d", ptr_window->scroll); + log_printf (" scroll_lines_after. : %d", ptr_window->scroll_lines_after); + log_printf (" scroll_reset_allowed: %d", ptr_window->scroll_reset_allowed); + log_printf (" ptr_tree. . . . . . : 0x%x", ptr_window->ptr_tree); log_printf (" prev_window . . . . : 0x%x", ptr_window->prev_window); log_printf (" next_window . . . . : 0x%x", ptr_window->next_window); gui_window_objects_print_log (ptr_window); diff --git a/src/gui/gui-window.h b/src/gui/gui-window.h index 4f4fc7ea5..82ca05beb 100644 --- a/src/gui/gui-window.h +++ b/src/gui/gui-window.h @@ -36,9 +36,6 @@ struct t_gui_window int win_width_pct; /* % of width (compared to win size) */ int win_height_pct; /* % of height (compared to win size)*/ - int new_x, new_y; /* used for computing new position */ - int new_width, new_height; /* used for computing new size */ - /* chat window settings */ int win_chat_x, win_chat_y; /* chat window position */ int win_chat_width; /* width of chat window */ @@ -46,33 +43,6 @@ struct t_gui_window int win_chat_cursor_x; /* position of cursor in chat window */ int win_chat_cursor_y; /* position of cursor in chat window */ - /* nicklist window settings */ - int win_nick_x, win_nick_y; /* nick window position */ - int win_nick_width; /* width of nick window */ - int win_nick_height; /* height of nick window */ - int win_nick_num_max; /* maximum number of nicks displayed */ - int win_nick_start; /* # of 1st nick for display (scroll)*/ - - /* title window settings */ - int win_title_x; /* title window position */ - int win_title_y; /* title window position */ - int win_title_width; /* width of title window */ - int win_title_height; /* height of title window */ - int win_title_start; /* first char of title for display */ - - /* status bar settings */ - int win_status_x; /* status window position */ - int win_status_y; /* status window position */ - int win_status_width; /* width of status window */ - int win_status_height; /* height of status window */ - - /* input window settings */ - int win_input_x; /* input window position */ - int win_input_y; /* input window position */ - int win_input_width; /* width of input window */ - int win_input_height; /* height of input window */ - int win_input_cursor_x; /* position of cursor in input win */ - /* refresh */ int refresh_needed; /* 1 if refresh needed for window */ @@ -93,6 +63,8 @@ struct t_gui_window int scroll; /* = 1 if "MORE" should be displayed */ int scroll_lines_after; /* number of lines after last line */ /* displayed (with scrolling) */ + int scroll_reset_allowed; /* reset scroll allowed (when using */ + /* keys like page_up/down, end, .. */ struct t_gui_window_tree *ptr_tree;/* pointer to leaf in windows tree */ struct t_gui_window *prev_window; /* link to previous window */ @@ -165,8 +137,7 @@ extern int gui_window_objects_init (struct t_gui_window *window); extern void gui_window_objects_free (struct t_gui_window *window, int free_separator, int free_bar_windows); -extern int gui_window_calculate_pos_size (struct t_gui_window *window, - int force_calculate); +extern void gui_window_calculate_pos_size (struct t_gui_window *window); extern void gui_window_switch_to_buffer (struct t_gui_window *window, struct t_gui_buffer *buffer); extern void gui_window_switch (struct t_gui_window *window); @@ -176,12 +147,6 @@ extern void gui_window_scroll_up (struct t_gui_window *window); extern void gui_window_scroll_down (struct t_gui_window *window); extern void gui_window_scroll_top (struct t_gui_window *window); extern void gui_window_scroll_bottom (struct t_gui_window *window); -extern void gui_window_scroll_topic_left (struct t_gui_window *window); -extern void gui_window_scroll_topic_right (struct t_gui_window *window); -extern void gui_window_nicklist_page_up (struct t_gui_window *window); -extern void gui_window_nicklist_page_down (struct t_gui_window *window); -extern void gui_window_nicklist_beginning (struct t_gui_window *window); -extern void gui_window_nicklist_end (struct t_gui_window *window); extern void gui_window_init_subwindows (struct t_gui_window *window); extern void gui_window_refresh_windows (); extern struct t_gui_window *gui_window_split_horiz (struct t_gui_window *window, |