1
0
mirror of https://github.com/weechat/weechat.git synced 2026-07-08 10:43:13 +02:00

Rename constants GUI_COLOR_PAIR_xxx to GUI_COLOR_EXTENDED_xxx

This commit is contained in:
Sebastien Helleu
2011-02-06 18:18:13 +01:00
parent 96de4e8746
commit 9da63c7170
7 changed files with 64 additions and 60 deletions
+9 -9
View File
@@ -185,7 +185,7 @@ gui_bar_window_print_string (struct t_gui_bar_window *bar_window,
switch (string[0])
{
case GUI_COLOR_FG_CHAR: /* fg color */
if (string[1] == GUI_COLOR_PAIR_CHAR)
if (string[1] == GUI_COLOR_EXTENDED_CHAR)
{
if (string[2] && string[3] && string[4]
&& string[5] && string[6])
@@ -197,7 +197,7 @@ gui_bar_window_print_string (struct t_gui_bar_window *bar_window,
if (error && !error[0])
{
gui_window_set_custom_color_fg (GUI_BAR_WINDOW_OBJECTS(bar_window)->win_bar,
fg | GUI_COLOR_PAIR_FLAG);
fg | GUI_COLOR_EXTENDED_FLAG);
}
string += 7;
}
@@ -221,7 +221,7 @@ gui_bar_window_print_string (struct t_gui_bar_window *bar_window,
}
break;
case GUI_COLOR_BG_CHAR: /* bg color */
if (string[1] == GUI_COLOR_PAIR_CHAR)
if (string[1] == GUI_COLOR_EXTENDED_CHAR)
{
if (string[2] && string[3] && string[4]
&& string[5] && string[6])
@@ -233,7 +233,7 @@ gui_bar_window_print_string (struct t_gui_bar_window *bar_window,
if (error && !error[0])
{
gui_window_set_custom_color_bg (GUI_BAR_WINDOW_OBJECTS(bar_window)->win_bar,
bg | GUI_COLOR_PAIR_FLAG);
bg | GUI_COLOR_EXTENDED_FLAG);
}
string += 7;
}
@@ -261,7 +261,7 @@ gui_bar_window_print_string (struct t_gui_bar_window *bar_window,
str_bg[0] = '\0';
fg = -1;
bg = -1;
if (string[1] == GUI_COLOR_PAIR_CHAR)
if (string[1] == GUI_COLOR_EXTENDED_CHAR)
{
if (string[2] && string[3] && string[4]
&& string[5] && string[6])
@@ -273,7 +273,7 @@ gui_bar_window_print_string (struct t_gui_bar_window *bar_window,
if (!error || error[0])
fg = -1;
else
fg |= GUI_COLOR_PAIR_FLAG;
fg |= GUI_COLOR_EXTENDED_FLAG;
string += 7;
}
}
@@ -294,7 +294,7 @@ gui_bar_window_print_string (struct t_gui_bar_window *bar_window,
if (string[0] == ',')
{
string++;
if (string[0] == GUI_COLOR_PAIR_CHAR)
if (string[0] == GUI_COLOR_EXTENDED_CHAR)
{
if (string[1] && string[2] && string[3]
&& string[4] && string[5])
@@ -306,7 +306,7 @@ gui_bar_window_print_string (struct t_gui_bar_window *bar_window,
if (!error || error[0])
bg = -1;
else
bg |= GUI_COLOR_PAIR_FLAG;
bg |= GUI_COLOR_EXTENDED_FLAG;
string += 6;
}
}
@@ -331,7 +331,7 @@ gui_bar_window_print_string (struct t_gui_bar_window *bar_window,
fg, bg);
}
break;
case GUI_COLOR_PAIR_CHAR: /* pair number */
case GUI_COLOR_EXTENDED_CHAR: /* pair number */
if ((isdigit (string[1])) && (isdigit (string[2]))
&& (isdigit (string[3])) && (isdigit (string[4]))
&& (isdigit (string[5])))
+9 -9
View File
@@ -189,7 +189,7 @@ gui_chat_string_next_char (struct t_gui_window *window,
switch (string[0])
{
case GUI_COLOR_FG_CHAR: /* fg color */
if (string[1] == GUI_COLOR_PAIR_CHAR)
if (string[1] == GUI_COLOR_EXTENDED_CHAR)
{
if (string[2] && string[3] && string[4]
&& string[5] && string[6])
@@ -203,7 +203,7 @@ gui_chat_string_next_char (struct t_gui_window *window,
if (error && !error[0])
{
gui_window_set_custom_color_fg (GUI_WINDOW_OBJECTS(window)->win_chat,
fg | GUI_COLOR_PAIR_FLAG);
fg | GUI_COLOR_EXTENDED_FLAG);
}
}
string += 7;
@@ -231,7 +231,7 @@ gui_chat_string_next_char (struct t_gui_window *window,
}
break;
case GUI_COLOR_BG_CHAR: /* bg color */
if (string[1] == GUI_COLOR_PAIR_CHAR)
if (string[1] == GUI_COLOR_EXTENDED_CHAR)
{
if (string[2] && string[3] && string[4]
&& string[5] && string[6])
@@ -245,7 +245,7 @@ gui_chat_string_next_char (struct t_gui_window *window,
if (error && !error[0])
{
gui_window_set_custom_color_bg (GUI_WINDOW_OBJECTS(window)->win_chat,
bg | GUI_COLOR_PAIR_FLAG);
bg | GUI_COLOR_EXTENDED_FLAG);
}
}
string += 7;
@@ -277,7 +277,7 @@ gui_chat_string_next_char (struct t_gui_window *window,
str_bg[0] = '\0';
fg = -1;
bg = -1;
if (string[1] == GUI_COLOR_PAIR_CHAR)
if (string[1] == GUI_COLOR_EXTENDED_CHAR)
{
if (string[2] && string[3] && string[4]
&& string[5] && string[6])
@@ -291,7 +291,7 @@ gui_chat_string_next_char (struct t_gui_window *window,
if (!error || error[0])
fg = -1;
else
fg |= GUI_COLOR_PAIR_FLAG;
fg |= GUI_COLOR_EXTENDED_FLAG;
}
string += 7;
}
@@ -316,7 +316,7 @@ gui_chat_string_next_char (struct t_gui_window *window,
if (string[0] == ',')
{
string++;
if (string[0] == GUI_COLOR_PAIR_CHAR)
if (string[0] == GUI_COLOR_EXTENDED_CHAR)
{
if (string[1] && string[2] && string[3]
&& string[4] && string[5])
@@ -330,7 +330,7 @@ gui_chat_string_next_char (struct t_gui_window *window,
if (!error || error[0])
bg = -1;
else
bg |= GUI_COLOR_PAIR_FLAG;
bg |= GUI_COLOR_EXTENDED_FLAG;
}
string += 6;
}
@@ -359,7 +359,7 @@ gui_chat_string_next_char (struct t_gui_window *window,
fg, bg);
}
break;
case GUI_COLOR_PAIR_CHAR: /* pair number */
case GUI_COLOR_EXTENDED_CHAR: /* pair number */
if ((isdigit (string[1])) && (isdigit (string[2]))
&& (isdigit (string[3])) && (isdigit (string[4]))
&& (isdigit (string[5])))
+11 -11
View File
@@ -125,7 +125,7 @@ gui_color_assign (int *color, const char *color_name)
pair = gui_color_palette_get_alias (color_name);
if (pair >= 0)
{
*color = GUI_COLOR_PAIR_FLAG | pair;
*color = GUI_COLOR_EXTENDED_FLAG | pair;
return 1;
}
@@ -135,7 +135,7 @@ gui_color_assign (int *color, const char *color_name)
if (color_name[0] && error && !error[0] && (pair >= 0))
{
/* color_name is a number, use this pair number */
*color = GUI_COLOR_PAIR_FLAG | pair;
*color = GUI_COLOR_EXTENDED_FLAG | pair;
return 1;
}
else
@@ -367,10 +367,10 @@ gui_color_weechat_get_pair (int weechat_color)
fg = gui_color[weechat_color]->foreground;
bg = gui_color[weechat_color]->background;
if ((fg > 0) && (fg & GUI_COLOR_PAIR_FLAG))
fg &= GUI_COLOR_PAIR_MASK;
if ((bg > 0) && (bg & GUI_COLOR_PAIR_FLAG))
bg &= GUI_COLOR_PAIR_MASK;
if ((fg > 0) && (fg & GUI_COLOR_EXTENDED_FLAG))
fg &= GUI_COLOR_EXTENDED_MASK;
if ((bg > 0) && (bg & GUI_COLOR_EXTENDED_FLAG))
bg &= GUI_COLOR_EXTENDED_MASK;
}
return gui_color_get_pair (fg, bg);
@@ -387,15 +387,15 @@ gui_color_get_name (int num_color)
static int index_color = 0;
struct t_gui_color_palette *ptr_color_palette;
if (num_color & GUI_COLOR_PAIR_FLAG)
if (num_color & GUI_COLOR_EXTENDED_FLAG)
{
ptr_color_palette = gui_color_palette_get (num_color & GUI_COLOR_PAIR_MASK);
ptr_color_palette = gui_color_palette_get (num_color & GUI_COLOR_EXTENDED_MASK);
if (ptr_color_palette && ptr_color_palette->alias)
return ptr_color_palette->alias;
index_color = (index_color + 1) % 32;
color[index_color][0] = '\0';
snprintf (color[index_color], sizeof (color[index_color]),
"%d", num_color & GUI_COLOR_PAIR_MASK);
"%d", num_color & GUI_COLOR_EXTENDED_MASK);
return color[index_color];
}
@@ -734,7 +734,7 @@ gui_color_buffer_display ()
snprintf (str_color, sizeof (str_color),
"%c%c%05d%c%03d%c",
GUI_COLOR_COLOR_CHAR,
GUI_COLOR_PAIR_CHAR,
GUI_COLOR_EXTENDED_CHAR,
color,
(color == 0) ? '<' : ' ',
color,
@@ -857,7 +857,7 @@ gui_color_buffer_display ()
snprintf (str_color, sizeof (str_color),
"%c%c%05d",
GUI_COLOR_COLOR_CHAR,
GUI_COLOR_PAIR_CHAR,
GUI_COLOR_EXTENDED_CHAR,
i);
}
str_rgb[0] = '\0';
+20 -16
View File
@@ -190,13 +190,13 @@ gui_window_clear (WINDOW *window, int fg, int bg)
if (!gui_ok)
return;
if ((fg > 0) && (fg & GUI_COLOR_PAIR_FLAG))
fg &= GUI_COLOR_PAIR_MASK;
if ((fg > 0) && (fg & GUI_COLOR_EXTENDED_FLAG))
fg &= GUI_COLOR_EXTENDED_MASK;
else
fg = gui_weechat_colors[fg].foreground;
if ((bg > 0) && (bg & GUI_COLOR_PAIR_FLAG))
bg &= GUI_COLOR_PAIR_MASK;
if ((bg > 0) && (bg & GUI_COLOR_EXTENDED_FLAG))
bg &= GUI_COLOR_EXTENDED_MASK;
else
bg = gui_weechat_colors[bg].background;
@@ -284,10 +284,10 @@ gui_window_set_weechat_color (WINDOW *window, int num_color)
fg = -1;
}
if ((fg > 0) && (fg & GUI_COLOR_PAIR_FLAG))
fg &= GUI_COLOR_PAIR_MASK;
if ((bg > 0) && (bg & GUI_COLOR_PAIR_FLAG))
bg &= GUI_COLOR_PAIR_MASK;
if ((fg > 0) && (fg & GUI_COLOR_EXTENDED_FLAG))
fg &= GUI_COLOR_EXTENDED_MASK;
if ((bg > 0) && (bg & GUI_COLOR_EXTENDED_FLAG))
bg &= GUI_COLOR_EXTENDED_MASK;
gui_window_set_color (window, fg, bg);
}
}
@@ -306,8 +306,8 @@ gui_window_set_custom_color_fg_bg (WINDOW *window, int fg, int bg)
{
gui_window_remove_color_style (window, A_BOLD);
if ((fg > 0) && (fg & GUI_COLOR_PAIR_FLAG))
fg &= GUI_COLOR_PAIR_MASK;
if ((fg > 0) && (fg & GUI_COLOR_EXTENDED_FLAG))
fg &= GUI_COLOR_EXTENDED_MASK;
else
{
attributes = gui_weechat_colors[fg].attributes;
@@ -325,8 +325,8 @@ gui_window_set_custom_color_fg_bg (WINDOW *window, int fg, int bg)
}
}
if ((bg > 0) && (bg & GUI_COLOR_PAIR_FLAG))
bg &= GUI_COLOR_PAIR_MASK;
if ((bg > 0) && (bg & GUI_COLOR_EXTENDED_FLAG))
bg &= GUI_COLOR_EXTENDED_MASK;
else
{
bg = (gui_color_num_bg > 8) ?
@@ -351,9 +351,11 @@ gui_window_set_custom_color_fg (WINDOW *window, int fg)
{
current_bg = window_current_style_bg;
if ((fg > 0) && (fg & GUI_COLOR_PAIR_FLAG))
if ((fg > 0) && (fg & GUI_COLOR_EXTENDED_FLAG))
{
gui_window_set_color (window, fg & GUI_COLOR_PAIR_MASK, current_bg);
gui_window_set_color (window,
fg & GUI_COLOR_EXTENDED_MASK,
current_bg);
}
else if (fg < GUI_CURSES_NUM_WEECHAT_COLORS)
{
@@ -392,9 +394,11 @@ gui_window_set_custom_color_bg (WINDOW *window, int bg)
current_attr = window_current_style_attr;
current_fg = window_current_style_fg;
if ((bg > 0) && (bg & GUI_COLOR_PAIR_FLAG))
if ((bg > 0) && (bg & GUI_COLOR_EXTENDED_FLAG))
{
gui_window_set_color (window, current_fg, bg & GUI_COLOR_PAIR_MASK);
gui_window_set_color (window,
current_fg,
bg & GUI_COLOR_EXTENDED_MASK);
}
else if (bg < GUI_CURSES_NUM_WEECHAT_COLORS)
{
+6 -6
View File
@@ -377,14 +377,14 @@ gui_bar_item_get_value (const char *name, struct t_gui_bar *bar,
bar_color[0] = '\0';
if (prefix || suffix)
{
if (CONFIG_COLOR(bar->options[GUI_BAR_OPTION_COLOR_DELIM]) & GUI_COLOR_PAIR_FLAG)
if (CONFIG_COLOR(bar->options[GUI_BAR_OPTION_COLOR_DELIM]) & GUI_COLOR_EXTENDED_FLAG)
{
snprintf (delimiter_color, sizeof (delimiter_color),
"%c%c%c%05d",
GUI_COLOR_COLOR_CHAR,
GUI_COLOR_FG_CHAR,
GUI_COLOR_PAIR_CHAR,
CONFIG_COLOR(bar->options[GUI_BAR_OPTION_COLOR_DELIM]) & GUI_COLOR_PAIR_MASK);
GUI_COLOR_EXTENDED_CHAR,
CONFIG_COLOR(bar->options[GUI_BAR_OPTION_COLOR_DELIM]) & GUI_COLOR_EXTENDED_MASK);
}
else
{
@@ -394,14 +394,14 @@ gui_bar_item_get_value (const char *name, struct t_gui_bar *bar,
GUI_COLOR_FG_CHAR,
CONFIG_COLOR(bar->options[GUI_BAR_OPTION_COLOR_DELIM]));
}
if (CONFIG_COLOR(bar->options[GUI_BAR_OPTION_COLOR_FG]) & GUI_COLOR_PAIR_FLAG)
if (CONFIG_COLOR(bar->options[GUI_BAR_OPTION_COLOR_FG]) & GUI_COLOR_EXTENDED_FLAG)
{
snprintf (bar_color, sizeof (bar_color),
"%c%c%c%05d",
GUI_COLOR_COLOR_CHAR,
GUI_COLOR_FG_CHAR,
GUI_COLOR_PAIR_CHAR,
CONFIG_COLOR(bar->options[GUI_BAR_OPTION_COLOR_FG]) & GUI_COLOR_PAIR_MASK);
GUI_COLOR_EXTENDED_CHAR,
CONFIG_COLOR(bar->options[GUI_BAR_OPTION_COLOR_FG]) & GUI_COLOR_EXTENDED_MASK);
}
else
{
+6 -6
View File
@@ -259,7 +259,7 @@ gui_color_get_custom (const char *color_name)
if (fg_pair >= 0)
{
snprintf (color_fg, sizeof (color_fg), "%c%05d",
GUI_COLOR_PAIR_CHAR,
GUI_COLOR_EXTENDED_CHAR,
fg_pair);
}
else if (fg >= 0)
@@ -271,7 +271,7 @@ gui_color_get_custom (const char *color_name)
if (bg_pair >= 0)
{
snprintf (color_bg, sizeof (color_bg), "%c%05d",
GUI_COLOR_PAIR_CHAR,
GUI_COLOR_EXTENDED_CHAR,
bg_pair);
}
else if (bg >= 0)
@@ -350,7 +350,7 @@ gui_color_decode (const char *string, const char *replacement)
{
case GUI_COLOR_FG_CHAR:
case GUI_COLOR_BG_CHAR:
if (ptr_string[1] == GUI_COLOR_PAIR_CHAR)
if (ptr_string[1] == GUI_COLOR_EXTENDED_CHAR)
{
if (ptr_string[2] && ptr_string[3] && ptr_string[4]
&& ptr_string[5] && ptr_string[6])
@@ -365,7 +365,7 @@ gui_color_decode (const char *string, const char *replacement)
}
break;
case GUI_COLOR_FG_BG_CHAR:
if (ptr_string[1] == GUI_COLOR_PAIR_CHAR)
if (ptr_string[1] == GUI_COLOR_EXTENDED_CHAR)
{
if (ptr_string[2] && ptr_string[3] && ptr_string[4]
&& ptr_string[5] && ptr_string[6])
@@ -380,7 +380,7 @@ gui_color_decode (const char *string, const char *replacement)
}
if (ptr_string[0] == ',')
{
if (ptr_string[1] == GUI_COLOR_PAIR_CHAR)
if (ptr_string[1] == GUI_COLOR_EXTENDED_CHAR)
{
if (ptr_string[2] && ptr_string[3]
&& ptr_string[4] && ptr_string[5]
@@ -396,7 +396,7 @@ gui_color_decode (const char *string, const char *replacement)
}
}
break;
case GUI_COLOR_PAIR_CHAR:
case GUI_COLOR_EXTENDED_CHAR:
if ((isdigit (ptr_string[1])) && (isdigit (ptr_string[2]))
&& (isdigit (ptr_string[3])) && (isdigit (ptr_string[4]))
&& (isdigit (ptr_string[5])))
+3 -3
View File
@@ -89,7 +89,7 @@ enum t_gui_color_enum
#define GUI_COLOR_FG_CHAR 'F'
#define GUI_COLOR_BG_CHAR 'B'
#define GUI_COLOR_FG_BG_CHAR '*'
#define GUI_COLOR_PAIR_CHAR '@'
#define GUI_COLOR_EXTENDED_CHAR '@'
/* color codes specific to bars */
#define GUI_COLOR_BAR_CHAR 'b'
@@ -100,8 +100,8 @@ enum t_gui_color_enum
#define GUI_COLOR_BAR_START_INPUT_HIDDEN_CHAR '-'
#define GUI_COLOR_BAR_MOVE_CURSOR_CHAR '#'
#define GUI_COLOR_PAIR_FLAG 0x10000
#define GUI_COLOR_PAIR_MASK 0xFFFF
#define GUI_COLOR_EXTENDED_FLAG 0x10000
#define GUI_COLOR_EXTENDED_MASK 0xFFFF
/* color structure */