diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2010-12-20 15:08:30 +0100 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2010-12-20 15:08:30 +0100 |
commit | 2ee9f7b0fcac460fca5597ec349309e83de64d00 (patch) | |
tree | 2a2648efc0a638ad534c747a30d5874aa72065f1 /src/gui | |
parent | 1340ce6b41cfb0fa1f69d4d1c5c3000eac3e6f61 (diff) | |
download | weechat-2ee9f7b0fcac460fca5597ec349309e83de64d00.zip |
Replace the 10 nick color options and number of nick colors by a single option "weechat.color.chat_nick_colors" (comma separated list of colors)
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/curses/gui-curses-color.c | 28 | ||||
-rw-r--r-- | src/gui/gui-color.h | 26 |
2 files changed, 36 insertions, 18 deletions
diff --git a/src/gui/curses/gui-curses-color.c b/src/gui/curses/gui-curses-color.c index fd66f6816..2f44518ef 100644 --- a/src/gui/curses/gui-curses-color.c +++ b/src/gui/curses/gui-curses-color.c @@ -225,6 +225,11 @@ gui_color_get_name (int num_color) void gui_color_build (int number, int foreground, int background) { + if (foreground < 0) + foreground = 0; + if (background < 0) + background = 0; + if (!gui_color[number]) { gui_color[number] = malloc (sizeof (*gui_color[number])); @@ -370,8 +375,6 @@ gui_color_init_pairs () void gui_color_init_weechat () { - int i; - gui_color_build (GUI_COLOR_SEPARATOR, CONFIG_COLOR(config_color_separator), CONFIG_COLOR(config_color_chat_bg)); gui_color_build (GUI_COLOR_CHAT, CONFIG_COLOR(config_color_chat), CONFIG_COLOR(config_color_chat_bg)); @@ -390,10 +393,6 @@ gui_color_init_weechat () gui_color_build (GUI_COLOR_CHAT_NICK, CONFIG_COLOR(config_color_chat_nick), CONFIG_COLOR(config_color_chat_bg)); gui_color_build (GUI_COLOR_CHAT_NICK_SELF, CONFIG_COLOR(config_color_chat_nick_self), CONFIG_COLOR(config_color_chat_bg)); gui_color_build (GUI_COLOR_CHAT_NICK_OTHER, CONFIG_COLOR(config_color_chat_nick_other), CONFIG_COLOR(config_color_chat_bg)); - for (i = 0; i < GUI_COLOR_NICK_NUMBER; i++) - { - gui_color_build (GUI_COLOR_CHAT_NICK1 + i, CONFIG_COLOR(config_color_chat_nick_colors[i]), CONFIG_COLOR(config_color_chat_bg)); - } gui_color_build (GUI_COLOR_CHAT_HOST, CONFIG_COLOR(config_color_chat_host), CONFIG_COLOR(config_color_chat_bg)); gui_color_build (GUI_COLOR_CHAT_DELIMITERS, CONFIG_COLOR(config_color_chat_delimiters), CONFIG_COLOR(config_color_chat_bg)); gui_color_build (GUI_COLOR_CHAT_HIGHLIGHT, CONFIG_COLOR(config_color_chat_highlight), CONFIG_COLOR(config_color_chat_highlight_bg)); @@ -401,6 +400,23 @@ gui_color_init_weechat () 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_CHAT_VALUE, CONFIG_COLOR(config_color_chat_value), CONFIG_COLOR(config_color_chat_bg)); gui_color_build (GUI_COLOR_CHAT_PREFIX_BUFFER, CONFIG_COLOR(config_color_chat_prefix_buffer), CONFIG_COLOR(config_color_chat_bg)); + + /* + * define old nick colors for compatibility on /upgrade with previous + * versions: these colors have been removed in version 0.3.4 and replaced + * by new option "weechat.color.chat_nick_colors", which is a list of + * colors (without limit on number of colors) + */ + gui_color_build (GUI_COLOR_CHAT_NICK1_OBSOLETE, gui_color_search ("cyan"), CONFIG_COLOR(config_color_chat_bg)); + gui_color_build (GUI_COLOR_CHAT_NICK2_OBSOLETE, gui_color_search ("magenta"), CONFIG_COLOR(config_color_chat_bg)); + gui_color_build (GUI_COLOR_CHAT_NICK3_OBSOLETE, gui_color_search ("green"), CONFIG_COLOR(config_color_chat_bg)); + gui_color_build (GUI_COLOR_CHAT_NICK4_OBSOLETE, gui_color_search ("brown"), CONFIG_COLOR(config_color_chat_bg)); + gui_color_build (GUI_COLOR_CHAT_NICK5_OBSOLETE, gui_color_search ("lightblue"), CONFIG_COLOR(config_color_chat_bg)); + gui_color_build (GUI_COLOR_CHAT_NICK6_OBSOLETE, gui_color_search ("default"), CONFIG_COLOR(config_color_chat_bg)); + gui_color_build (GUI_COLOR_CHAT_NICK7_OBSOLETE, gui_color_search ("lightcyan"), CONFIG_COLOR(config_color_chat_bg)); + gui_color_build (GUI_COLOR_CHAT_NICK8_OBSOLETE, gui_color_search ("lightmagenta"), CONFIG_COLOR(config_color_chat_bg)); + gui_color_build (GUI_COLOR_CHAT_NICK9_OBSOLETE, gui_color_search ("lightgreen"), CONFIG_COLOR(config_color_chat_bg)); + gui_color_build (GUI_COLOR_CHAT_NICK10_OBSOLETE, gui_color_search ("blue"), CONFIG_COLOR(config_color_chat_bg)); } /* diff --git a/src/gui/gui-color.h b/src/gui/gui-color.h index a9262d782..853fcd79d 100644 --- a/src/gui/gui-color.h +++ b/src/gui/gui-color.h @@ -20,8 +20,6 @@ #ifndef __WEECHAT_GUI_COLOR_H #define __WEECHAT_GUI_COLOR_H 1 -#define GUI_COLOR_NICK_NUMBER 10 - enum t_gui_color_enum { GUI_COLOR_SEPARATOR = 0, @@ -42,16 +40,20 @@ enum t_gui_color_enum GUI_COLOR_CHAT_NICK, GUI_COLOR_CHAT_NICK_SELF, GUI_COLOR_CHAT_NICK_OTHER, - GUI_COLOR_CHAT_NICK1, - GUI_COLOR_CHAT_NICK2, - GUI_COLOR_CHAT_NICK3, - GUI_COLOR_CHAT_NICK4, - GUI_COLOR_CHAT_NICK5, - GUI_COLOR_CHAT_NICK6, - GUI_COLOR_CHAT_NICK7, - GUI_COLOR_CHAT_NICK8, - GUI_COLOR_CHAT_NICK9, - GUI_COLOR_CHAT_NICK10, + /* + * following obsolete colors are kept here for compatibility + * with WeeChat <= 0.3.3 + */ + GUI_COLOR_CHAT_NICK1_OBSOLETE, /* not used any more since WeeChat 0.3.4 */ + GUI_COLOR_CHAT_NICK2_OBSOLETE, /* not used any more since WeeChat 0.3.4 */ + GUI_COLOR_CHAT_NICK3_OBSOLETE, /* not used any more since WeeChat 0.3.4 */ + GUI_COLOR_CHAT_NICK4_OBSOLETE, /* not used any more since WeeChat 0.3.4 */ + GUI_COLOR_CHAT_NICK5_OBSOLETE, /* not used any more since WeeChat 0.3.4 */ + GUI_COLOR_CHAT_NICK6_OBSOLETE, /* not used any more since WeeChat 0.3.4 */ + GUI_COLOR_CHAT_NICK7_OBSOLETE, /* not used any more since WeeChat 0.3.4 */ + GUI_COLOR_CHAT_NICK8_OBSOLETE, /* not used any more since WeeChat 0.3.4 */ + GUI_COLOR_CHAT_NICK9_OBSOLETE, /* not used any more since WeeChat 0.3.4 */ + GUI_COLOR_CHAT_NICK10_OBSOLETE, /* not used any more since WeeChat 0.3.4 */ GUI_COLOR_CHAT_HOST, GUI_COLOR_CHAT_DELIMITERS, GUI_COLOR_CHAT_HIGHLIGHT, |