summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/wee-command.c24
-rw-r--r--src/core/wee-config-file.c9
-rw-r--r--src/core/wee-config.c9
-rw-r--r--src/gui/curses/gui-curses-bar.c283
-rw-r--r--src/gui/curses/gui-curses-chat.c268
-rw-r--r--src/gui/curses/gui-curses-infobar.c4
-rw-r--r--src/gui/curses/gui-curses-input.c4
-rw-r--r--src/gui/curses/gui-curses-status.c4
-rw-r--r--src/gui/curses/gui-curses-window.c178
-rw-r--r--src/gui/curses/gui-curses.h15
-rw-r--r--src/gui/gui-bar-item.c14
-rw-r--r--src/gui/gui-bar.c190
-rw-r--r--src/gui/gui-bar.h22
-rw-r--r--src/plugins/plugin-config.c2
-rw-r--r--src/plugins/scripts/lua/weechat-lua-api.c148
-rw-r--r--src/plugins/scripts/perl/weechat-perl-api.c120
-rw-r--r--src/plugins/scripts/python/weechat-python-api.c119
-rw-r--r--src/plugins/scripts/ruby/weechat-ruby-api.c140
-rw-r--r--src/plugins/scripts/script-api.c4
-rw-r--r--src/plugins/weechat-plugin.h13
20 files changed, 1164 insertions, 406 deletions
diff --git a/src/core/wee-command.c b/src/core/wee-command.c
index a736fc02b..b1615fdf9 100644
--- a/src/core/wee-command.c
+++ b/src/core/wee-command.c
@@ -86,26 +86,36 @@ command_bar (void *data, struct t_gui_buffer *buffer,
ptr_bar = ptr_bar->next_bar)
{
gui_chat_printf (NULL,
- _(" %d. %s: %s (cond: %s), %s, %s: "
- "%s%s%d%s, items: %s%s (plugin: %s)"),
+ _(" %3d. %s%s%s: %s (cond: %s), %s, filling: %s, "
+ "%s: %s%s%d%s"),
ptr_bar->number,
+ GUI_COLOR(GUI_COLOR_CHAT_BUFFER),
ptr_bar->name,
+ GUI_COLOR(GUI_COLOR_CHAT),
gui_bar_type_str[CONFIG_INTEGER(ptr_bar->type)],
(CONFIG_STRING(ptr_bar->conditions)
&& CONFIG_STRING(ptr_bar->conditions)[0]) ?
CONFIG_STRING(ptr_bar->conditions) : "-",
gui_bar_position_str[CONFIG_INTEGER(ptr_bar->position)],
+ gui_bar_filling_str[CONFIG_INTEGER(ptr_bar->filling)],
((CONFIG_INTEGER(ptr_bar->position) == GUI_BAR_POSITION_BOTTOM)
|| (CONFIG_INTEGER(ptr_bar->position) == GUI_BAR_POSITION_TOP)) ?
_("height") : _("width"),
(CONFIG_INTEGER(ptr_bar->size) == 0) ? _("auto") : "",
(CONFIG_INTEGER(ptr_bar->size) == 0) ? " (" : "",
ptr_bar->current_size,
- (CONFIG_INTEGER(ptr_bar->size) == 0) ? ")" : "",
- (CONFIG_STRING(ptr_bar->items)) ? CONFIG_STRING(ptr_bar->items) : "-",
+ (CONFIG_INTEGER(ptr_bar->size) == 0) ? ")" : "");
+ gui_chat_printf (NULL,
+ _(" fg: %s, bg: %s, items: %s%s (plugin: "
+ "%s)"),
+ gui_color_get_name (CONFIG_COLOR(ptr_bar->color_fg)),
+ gui_color_get_name (CONFIG_COLOR(ptr_bar->color_bg)),
+ (CONFIG_STRING(ptr_bar->items) && CONFIG_STRING(ptr_bar->items)[0]) ?
+ CONFIG_STRING(ptr_bar->items) : "-",
(CONFIG_INTEGER(ptr_bar->separator)) ?
_(", with separator") : "",
(ptr_bar->plugin) ? ptr_bar->plugin->name : "-");
+
}
}
else
@@ -194,7 +204,11 @@ command_bar (void *data, struct t_gui_buffer *buffer,
{
/* create bar */
if (gui_bar_new (NULL, argv[2], str_type, pos_condition, argv[4],
- argv[5], "0", argv[6], argv_eol[7]))
+ ((position == GUI_BAR_POSITION_LEFT)
+ || (position == GUI_BAR_POSITION_RIGHT)) ?
+ "vertical" : "horizontal",
+ argv[5], "0", "default", "default", argv[6],
+ argv_eol[7]))
{
gui_chat_printf (NULL, _("Bar \"%s\" created"),
argv[2]);
diff --git a/src/core/wee-config-file.c b/src/core/wee-config-file.c
index 34ae60bd0..d33f9703f 100644
--- a/src/core/wee-config-file.c
+++ b/src/core/wee-config-file.c
@@ -454,7 +454,7 @@ config_file_new_option (struct t_config_file *config_file,
new_option->max = min;
new_option->default_value = malloc (sizeof (int));
if (!gui_color_assign (new_option->default_value, default_value))
- new_option->default_value = 0;
+ *((int *)new_option->default_value) = 0;
new_option->value = malloc (sizeof (int));
*((int *)new_option->value) = *((int *)new_option->default_value);
break;
@@ -1187,7 +1187,10 @@ config_file_option_string (struct t_config_option *option)
switch (option->type)
{
case CONFIG_OPTION_TYPE_BOOLEAN:
- return NULL;
+ if (CONFIG_BOOLEAN(option))
+ return config_boolean_true[0];
+ else
+ return config_boolean_false[0];
case CONFIG_OPTION_TYPE_INTEGER:
if (option->string_values)
return option->string_values[CONFIG_INTEGER(option)];
@@ -1195,7 +1198,7 @@ config_file_option_string (struct t_config_option *option)
case CONFIG_OPTION_TYPE_STRING:
return CONFIG_STRING(option);
case CONFIG_OPTION_TYPE_COLOR:
- return NULL;
+ return gui_color_get_name (CONFIG_COLOR(option));
case CONFIG_NUM_OPTION_TYPES:
return NULL;
}
diff --git a/src/core/wee-config.c b/src/core/wee-config.c
index 77c15fdff..d62667351 100644
--- a/src/core/wee-config.c
+++ b/src/core/wee-config.c
@@ -600,12 +600,21 @@ config_weechat_bar_read (void *data, struct t_config_file *config_file,
case GUI_BAR_OPTION_POSITION:
ptr_temp_bar->position = ptr_option;
break;
+ case GUI_BAR_OPTION_FILLING:
+ ptr_temp_bar->filling = ptr_option;
+ break;
case GUI_BAR_OPTION_SIZE:
ptr_temp_bar->size = ptr_option;
break;
case GUI_BAR_OPTION_SIZE_MAX:
ptr_temp_bar->size_max = ptr_option;
break;
+ case GUI_BAR_OPTION_COLOR_FG:
+ ptr_temp_bar->color_fg = ptr_option;
+ break;
+ case GUI_BAR_OPTION_COLOR_BG:
+ ptr_temp_bar->color_bg = ptr_option;
+ break;
case GUI_BAR_OPTION_SEPARATOR:
ptr_temp_bar->separator = ptr_option;
break;
diff --git a/src/gui/curses/gui-curses-bar.c b/src/gui/curses/gui-curses-bar.c
index bc8eeb052..5da3963cb 100644
--- a/src/gui/curses/gui-curses-bar.c
+++ b/src/gui/curses/gui-curses-bar.c
@@ -363,6 +363,13 @@ gui_bar_window_new (struct t_gui_bar *bar, struct t_gui_window *window)
if (window)
window->refresh_needed = 1;
}
+ else
+ {
+ new_bar_window->x = 0;
+ new_bar_window->y = 0;
+ new_bar_window->width = 1;
+ new_bar_window->height = 1;
+ }
return 1;
}
@@ -526,40 +533,84 @@ gui_bar_window_add_missing_bars (struct t_gui_window *window)
/*
* gui_bar_window_print_string: print a string text on a bar window
- * return number of chars displayed on screen
*/
-int
+void
gui_bar_window_print_string (struct t_gui_bar_window *bar_window,
- char *string, int max_chars_on_screen)
+ int *x, int *y, char *string)
{
- int weechat_color, chars_displayed, size_on_screen;
- char str_color[3], utf_char[16], *next_char, *output;
+ int weechat_color, size_on_screen, fg, bg;
+ char str_fg[3], str_bg[3], utf_char[16], *next_char, *output;
if (!string || !string[0])
- return 0;
-
- if ((CONFIG_INTEGER(bar_window->bar->position) == GUI_BAR_POSITION_LEFT)
- || (CONFIG_INTEGER(bar_window->bar->position) == GUI_BAR_POSITION_RIGHT))
- gui_window_set_weechat_color (bar_window->win_bar, GUI_COLOR_CHAT);
- else
- gui_window_set_weechat_color (bar_window->win_bar, GUI_COLOR_STATUS);
+ return;
- chars_displayed = 0;
+ wmove (bar_window->win_bar, *y, *x);
+
+ gui_window_set_custom_color_fg_bg (bar_window->win_bar,
+ CONFIG_COLOR(bar_window->bar->color_fg),
+ CONFIG_COLOR(bar_window->bar->color_bg));
while (string && string[0])
{
if (string[0] == GUI_COLOR_COLOR_CHAR)
{
string++;
- if (isdigit (string[0]) && isdigit (string[1]))
+ switch (string[0])
{
- str_color[0] = string[0];
- str_color[1] = string[1];
- str_color[2] = '\0';
- string += 2;
- sscanf (str_color, "%d", &weechat_color);
- gui_window_set_weechat_color (bar_window->win_bar, weechat_color);
+ case 'F':
+ if (string[1] && string[2])
+ {
+ str_fg[0] = string[1];
+ str_fg[1] = string[2];
+ str_fg[2] = '\0';
+ sscanf (str_fg, "%d", &fg);
+ gui_window_set_custom_color_fg (bar_window->win_bar,
+ fg);
+ string += 3;
+ }
+ break;
+ case 'B':
+ if (string[1] && string[2])
+ {
+ str_bg[0] = string[1];
+ str_bg[1] = string[2];
+ str_bg[2] = '\0';
+ sscanf (str_bg, "%d", &bg);
+ gui_window_set_custom_color_bg (bar_window->win_bar,
+ bg);
+ string += 3;
+ }
+ break;
+ case '*':
+ if (string[1] && string[2] && (string[3] == ',')
+ && string[4] && string[5])
+ {
+ str_fg[0] = string[1];
+ str_fg[1] = string[2];
+ str_fg[2] = '\0';
+ str_bg[0] = string[4];
+ str_bg[1] = string[5];
+ str_bg[2] = '\0';
+ sscanf (str_fg, "%d", &fg);
+ sscanf (str_bg, "%d", &bg);
+ gui_window_set_custom_color_fg_bg (bar_window->win_bar,
+ fg, bg);
+ string += 6;
+ }
+ break;
+ default:
+ if (isdigit (string[0]) && isdigit (string[1]))
+ {
+ str_fg[0] = string[0];
+ str_fg[1] = string[1];
+ str_fg[2] = '\0';
+ sscanf (str_fg, "%d", &weechat_color);
+ gui_window_set_weechat_color (bar_window->win_bar,
+ weechat_color);
+ string += 2;
+ }
+ break;
}
}
else
@@ -571,45 +622,31 @@ gui_bar_window_print_string (struct t_gui_bar_window *bar_window,
memcpy (utf_char, string, next_char - string);
utf_char[next_char - string] = '\0';
- if (gui_window_utf_char_valid (utf_char))
- {
- size_on_screen = utf8_char_size_screen (utf_char);
- if (chars_displayed + size_on_screen > max_chars_on_screen)
- return chars_displayed;
- chars_displayed += size_on_screen;
- output = string_iconv_from_internal (NULL, utf_char);
- wprintw (bar_window->win_bar, "%s",
- (output) ? output : utf_char);
- if (output)
- free (output);
- }
- else
+ if (!gui_window_utf_char_valid (utf_char))
+ snprintf (utf_char, sizeof (utf_char), ".");
+
+ size_on_screen = utf8_char_size_screen (utf_char);
+ if (*x + size_on_screen > bar_window->width)
{
- if (chars_displayed + 1 > max_chars_on_screen)
- return chars_displayed;
- chars_displayed++;
- wprintw (bar_window->win_bar, ".");
+ if (CONFIG_INTEGER(bar_window->bar->filling) == GUI_BAR_FILLING_VERTICAL)
+ return;
+ if (*y >= bar_window->height - 1)
+ return;
+ *x = 0;
+ (*y)++;
+ wmove (bar_window->win_bar, *y, *x);
}
+ output = string_iconv_from_internal (NULL, utf_char);
+ wprintw (bar_window->win_bar, "%s",
+ (output) ? output : utf_char);
+ if (output)
+ free (output);
+
+ *x += size_on_screen;
string = next_char;
}
}
-
- return chars_displayed;
-}
-
-/*
- * gui_bar_window_clear_bg: clear background for a bar window
- */
-
-void
-gui_bar_window_clear_bg (struct t_gui_bar_window *bar_window)
-{
- if ((CONFIG_INTEGER(bar_window->bar->position) == GUI_BAR_POSITION_LEFT)
- || (CONFIG_INTEGER(bar_window->bar->position) == GUI_BAR_POSITION_RIGHT))
- gui_window_curses_clear (bar_window->win_bar, GUI_COLOR_CHAT);
- else
- gui_window_curses_clear (bar_window->win_bar, GUI_COLOR_STATUS);
}
/*
@@ -622,9 +659,13 @@ gui_bar_window_draw (struct t_gui_bar_window *bar_window,
{
int x, y, i, items_count, num_lines, line;
char *content, *item_value, *item_value2, **items;
- int content_length, length, max_length;
+ char space_with_reinit_color[32];
+ int content_length, length, max_length, optimal_number_of_lines;
struct t_gui_bar_item *ptr_item;
+ if (!gui_init_ok)
+ return;
+
if (CONFIG_INTEGER(bar_window->bar->size) == 0)
{
content = NULL;
@@ -641,22 +682,40 @@ gui_bar_window_draw (struct t_gui_bar_window *bar_window,
{
if (item_value[0])
{
+ if (CONFIG_INTEGER(bar_window->bar->filling) == GUI_BAR_FILLING_HORIZONTAL)
+ {
+ snprintf (space_with_reinit_color,
+ sizeof (space_with_reinit_color),
+ "%c*%02d,%02d ",
+ GUI_COLOR_COLOR_CHAR,
+ CONFIG_COLOR(bar_window->bar->color_fg),
+ CONFIG_COLOR(bar_window->bar->color_bg));
+ item_value2 = string_replace (item_value, "\n",
+ space_with_reinit_color);
+ }
+ else
+ item_value2 = NULL;
if (!content)
{
- content_length += strlen (item_value);
- content = strdup (item_value);
+ content_length += strlen ((item_value2) ?
+ item_value2 : item_value);
+ content = strdup ((item_value2) ?
+ item_value2 : item_value);
}
else
{
- content_length += 1 + strlen (item_value);
+ content_length += 1 +
+ strlen ((item_value2) ? item_value2 : item_value);
content = realloc (content, content_length);
- if ((CONFIG_INTEGER(bar_window->bar->position) == GUI_BAR_POSITION_LEFT)
- || (CONFIG_INTEGER(bar_window->bar->position) == GUI_BAR_POSITION_RIGHT))
- {
+ if (CONFIG_INTEGER(bar_window->bar->filling) == GUI_BAR_FILLING_HORIZONTAL)
+ strcat (content, " ");
+ else
strcat (content, "\n");
- }
- strcat (content, item_value);
+ strcat (content,
+ (item_value2) ? item_value2 : item_value);
}
+ if (item_value2)
+ free (item_value2);
}
free (item_value);
}
@@ -669,32 +728,47 @@ gui_bar_window_draw (struct t_gui_bar_window *bar_window,
{
gui_bar_set_current_size (bar_window->bar, 1);
gui_bar_window_recreate_bar_windows (bar_window->bar);
- gui_bar_window_clear_bg (bar_window);
+ gui_window_clear (bar_window->win_bar,
+ CONFIG_COLOR(bar_window->bar->color_bg));
}
else
{
+ /* search longer line and optimal number of lines */
+ max_length = 0;
+ optimal_number_of_lines = 0;
+ for (line = 0; line < items_count; line++)
+ {
+ length = gui_chat_strlen_screen (items[line]);
+ if (length > max_length)
+ max_length = length;
+
+ if (length % bar_window->width == 0)
+ num_lines = length / bar_window->width;
+ else
+ num_lines = (length / bar_window->width) + 1;
+ if (num_lines == 0)
+ num_lines = 1;
+ optimal_number_of_lines += num_lines;
+ }
+ if (max_length == 0)
+ max_length = 1;
+
switch (CONFIG_INTEGER(bar_window->bar->position))
{
case GUI_BAR_POSITION_BOTTOM:
case GUI_BAR_POSITION_TOP:
- if (bar_window->bar->current_size != items_count)
+ if (CONFIG_INTEGER(bar_window->bar->filling) == GUI_BAR_FILLING_HORIZONTAL)
+ num_lines = optimal_number_of_lines;
+ else
+ num_lines = items_count;
+ if (bar_window->bar->current_size != num_lines)
{
- gui_bar_set_current_size (bar_window->bar, items_count);
+ gui_bar_set_current_size (bar_window->bar, num_lines);
gui_bar_window_recreate_bar_windows (bar_window->bar);
}
break;
case GUI_BAR_POSITION_LEFT:
case GUI_BAR_POSITION_RIGHT:
- /* search longer line */
- max_length = 0;
- for (line = 0; line < items_count; line++)
- {
- length = gui_chat_strlen_screen (items[line]);
- if (length > max_length)
- max_length = length;
- }
- if (max_length == 0)
- max_length = 1;
if (bar_window->bar->current_size != max_length)
{
gui_bar_set_current_size (bar_window->bar,
@@ -705,17 +779,21 @@ gui_bar_window_draw (struct t_gui_bar_window *bar_window,
case GUI_BAR_NUM_POSITIONS:
break;
}
- gui_bar_window_clear_bg (bar_window);
+ gui_window_clear (bar_window->win_bar,
+ CONFIG_COLOR(bar_window->bar->color_bg));
x = 0;
y = 0;
- for (line = 0; line < items_count; line++)
+ for (line = 0;
+ (line < items_count) && (y < bar_window->height);
+ line++)
{
- wmove (bar_window->win_bar, y, x);
- x += gui_bar_window_print_string (bar_window,
- items[line],
- bar_window->width);
- x = 0;
- y++;
+ gui_bar_window_print_string (bar_window, &x, &y,
+ items[line]);
+ if (CONFIG_INTEGER(bar_window->bar->filling) == GUI_BAR_FILLING_VERTICAL)
+ {
+ x = 0;
+ y++;
+ }
}
}
if (items)
@@ -726,12 +804,14 @@ gui_bar_window_draw (struct t_gui_bar_window *bar_window,
{
gui_bar_set_current_size (bar_window->bar, 1);
gui_bar_window_recreate_bar_windows (bar_window->bar);
- gui_bar_window_clear_bg (bar_window);
+ gui_window_clear (bar_window->win_bar,
+ CONFIG_COLOR(bar_window->bar->color_bg));
}
}
else
{
- gui_bar_window_clear_bg (bar_window);
+ gui_window_clear (bar_window->win_bar,
+ CONFIG_COLOR(bar_window->bar->color_bg));
x = 0;
y = 0;
@@ -749,21 +829,30 @@ gui_bar_window_draw (struct t_gui_bar_window *bar_window,
{
if (item_value[0])
{
- /* replace \n by spaces when height is 1 */
- item_value2 = (bar_window->height == 1) ?
- string_replace (item_value, "\n", " ") : NULL;
- items = string_explode ((item_value2) ? item_value2 : item_value,
+ if (CONFIG_INTEGER(bar_window->bar->filling) == GUI_BAR_FILLING_HORIZONTAL)
+ {
+ snprintf (space_with_reinit_color,
+ sizeof (space_with_reinit_color),
+ "%c*%02d,%02d ",
+ GUI_COLOR_COLOR_CHAR,
+ CONFIG_COLOR(bar_window->bar->color_fg),
+ CONFIG_COLOR(bar_window->bar->color_bg));
+ item_value2 = string_replace (item_value, "\n",
+ space_with_reinit_color);
+ }
+ else
+ item_value2 = NULL;
+ items = string_explode ((item_value2) ?
+ item_value2 : item_value,
"\n", 0, 0,
&items_count);
- num_lines = (items_count <= bar_window->height) ?
- items_count : bar_window->height;
- for (line = 0; line < num_lines; line++)
+ for (line = 0;
+ (line < items_count) && (y < bar_window->height);
+ line++)
{
- wmove (bar_window->win_bar, y, x);
- x += gui_bar_window_print_string (bar_window,
- items[line],
- bar_window->width);
- if (num_lines > 1)
+ gui_bar_window_print_string (bar_window, &x, &y,
+ items[line]);
+ if (CONFIG_INTEGER(bar_window->bar->filling) == GUI_BAR_FILLING_VERTICAL)
{
x = 0;
y++;
diff --git a/src/gui/curses/gui-curses-chat.c b/src/gui/curses/gui-curses-chat.c
index 98ea32fd1..6855065ab 100644
--- a/src/gui/curses/gui-curses-chat.c
+++ b/src/gui/curses/gui-curses-chat.c
@@ -42,202 +42,6 @@
/*
- * gui_chat_set_style: set style (bold, underline, ..)
- * for a chat window
- */
-
-void
-gui_chat_set_style (struct t_gui_window *window, int style)
-{
- wattron (GUI_CURSES(window)->win_chat, style);
-}
-
-/*
- * gui_chat_remove_style: remove style (bold, underline, ..)
- * for a chat window
- */
-
-void
-gui_chat_remove_style (struct t_gui_window *window, int style)
-{
- wattroff (GUI_CURSES(window)->win_chat, style);
-}
-
-/*
- * gui_chat_toggle_style: toggle a style (bold, underline, ..)
- * for a chat window
- */
-
-void
-gui_chat_toggle_style (struct t_gui_window *window, int style)
-{
- GUI_CURSES(window)->current_style_attr ^= style;
- if (GUI_CURSES(window)->current_style_attr & style)
- gui_chat_set_style (window, style);
- else
- gui_chat_remove_style (window, style);
-}
-
-/*
- * gui_chat_reset_style: reset style (color and attr)
- * for a chat window
- */
-
-void
-gui_chat_reset_style (struct t_gui_window *window)
-{
- GUI_CURSES(window)->current_style_fg = -1;
- GUI_CURSES(window)->current_style_bg = -1;
- GUI_CURSES(window)->current_style_attr = 0;
- GUI_CURSES(window)->current_color_attr = 0;
-
- gui_window_set_weechat_color (GUI_CURSES(window)->win_chat, GUI_COLOR_CHAT);
- gui_chat_remove_style (window,
- A_BOLD | A_UNDERLINE | A_REVERSE);
-}
-
-/*
- * gui_chat_set_color_style: set style for color
- */
-
-void
-gui_chat_set_color_style (struct t_gui_window *window, int style)
-{
- GUI_CURSES(window)->current_color_attr |= style;
- wattron (GUI_CURSES(window)->win_chat, style);
-}
-
-/*
- * gui_chat_remove_color_style: remove style for color
- */
-
-void
-gui_chat_remove_color_style (struct t_gui_window *window, int style)
-{
- GUI_CURSES(window)->current_color_attr &= !style;
- wattroff (GUI_CURSES(window)->win_chat, style);
-}
-
-/*
- * gui_chat_reset_color_style: reset style for color
- */
-
-void
-gui_chat_reset_color_style (struct t_gui_window *window)
-{
- wattroff (GUI_CURSES(window)->win_chat,
- GUI_CURSES(window)->current_color_attr);
- GUI_CURSES(window)->current_color_attr = 0;
-}
-
-/*
- * gui_chat_set_color: set color for a chat window
- */
-
-void
-gui_chat_set_color (struct t_gui_window *window, int fg, int bg)
-{
- GUI_CURSES(window)->current_style_fg = fg;
- GUI_CURSES(window)->current_style_bg = bg;
-
- if (((fg == -1) || (fg == 99))
- && ((bg == -1) || (bg == 99)))
- wattron (GUI_CURSES(window)->win_chat, COLOR_PAIR(63));
- else
- {
- if ((fg == -1) || (fg == 99))
- fg = COLOR_WHITE;
- if ((bg == -1) || (bg == 99))
- bg = 0;
- wattron (GUI_CURSES(window)->win_chat, COLOR_PAIR((bg * 8) + fg));
- }
-}
-
-/*
- * gui_chat_set_weechat_color: set a WeeChat color for a chat window
- */
-
-void
-gui_chat_set_weechat_color (struct t_gui_window *window, int weechat_color)
-{
- if ((weechat_color >= 0) && (weechat_color < GUI_COLOR_NUM_COLORS))
- {
- gui_chat_reset_style (window);
- gui_chat_set_style (window,
- gui_color[weechat_color]->attributes);
- gui_chat_set_color (window,
- gui_color[weechat_color]->foreground,
- gui_color[weechat_color]->background);
- }
-}
-
-/*
- * gui_chat_set_custom_color_fg_bg: set a custom color for a chat window
- * (foreground and background)
- */
-
-void
-gui_chat_set_custom_color_fg_bg (struct t_gui_window *window, int fg, int bg)
-{
- if ((fg >= 0) && (fg < GUI_CURSES_NUM_WEECHAT_COLORS)
- && (bg >= 0) && (bg < GUI_CURSES_NUM_WEECHAT_COLORS))
- {
- gui_chat_reset_style (window);
- gui_chat_set_style (window,
- gui_weechat_colors[fg].attributes);
- gui_chat_set_color (window,
- gui_weechat_colors[fg].foreground,
- gui_weechat_colors[bg].foreground);
- }
-}
-
-/*
- * gui_chat_set_custom_color_fg: set a custom color for a chat window
- * (foreground only)
- */
-
-void
-gui_chat_set_custom_color_fg (struct t_gui_window *window, int fg)
-{
- int current_attr, current_bg;
-
- if ((fg >= 0) && (fg < GUI_CURSES_NUM_WEECHAT_COLORS))
- {
- current_attr = GUI_CURSES(window)->current_style_attr;
- current_bg = GUI_CURSES(window)->current_style_bg;
- gui_chat_reset_style (window);
- gui_chat_set_color_style (window, current_attr);
- gui_chat_remove_color_style (window, A_BOLD);
- gui_chat_set_color_style (window, gui_weechat_colors[fg].attributes);
- gui_chat_set_color (window,
- gui_weechat_colors[fg].foreground,
- current_bg);
- }
-}
-
-/*
- * gui_chat_set_custom_color_bg: set a custom color for a chat window
- * (background only)
- */
-
-void
-gui_chat_set_custom_color_bg (struct t_gui_window *window, int bg)
-{
- int current_attr, current_fg;
-
- if ((bg >= 0) && (bg < GUI_CURSES_NUM_WEECHAT_COLORS))
- {
- current_attr = GUI_CURSES(window)->current_style_attr;
- current_fg = GUI_CURSES(window)->current_style_fg;
- gui_chat_reset_style (window);
- gui_chat_set_color_style (window, current_attr);
- gui_chat_set_color (window,
- current_fg,
- gui_weechat_colors[bg].foreground);
- }
-}
-
-/*
* gui_chat_draw_title: draw title window for a buffer
*/
@@ -258,7 +62,8 @@ gui_chat_draw_title (struct t_gui_buffer *buffer, int erase)
if (ptr_win->buffer == buffer)
{
if (erase)
- gui_window_curses_clear (GUI_CURSES(ptr_win)->win_title, GUI_COLOR_TITLE);
+ 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);
@@ -380,7 +185,7 @@ gui_chat_string_next_char (struct t_gui_window *window, unsigned char *string,
case GUI_COLOR_RESET_CHAR:
string++;
if (apply_style)
- gui_chat_reset_style (window);
+ gui_window_reset_style (GUI_CURSES(window)->win_chat, GUI_COLOR_CHAT);
break;
case GUI_COLOR_COLOR_CHAR:
string++;
@@ -395,7 +200,8 @@ gui_chat_string_next_char (struct t_gui_window *window, unsigned char *string,
str_fg[1] = string[2];
str_fg[2] = '\0';
sscanf (str_fg, "%d", &fg);
- gui_chat_set_custom_color_fg (window, fg);
+ gui_window_set_custom_color_fg (GUI_CURSES(window)->win_chat,
+ fg);
}
string += 3;
}
@@ -409,7 +215,8 @@ gui_chat_string_next_char (struct t_gui_window *window, unsigned char *string,
str_bg[1] = string[2];
str_bg[2] = '\0';
sscanf (str_bg, "%d", &bg);
- gui_chat_set_custom_color_bg (window, bg);
+ gui_window_set_custom_color_bg (GUI_CURSES(window)->win_chat,
+ bg);
}
string += 3;
}
@@ -428,7 +235,8 @@ gui_chat_string_next_char (struct t_gui_window *window, unsigned char *string,
str_bg[2] = '\0';
sscanf (str_fg, "%d", &fg);
sscanf (str_bg, "%d", &bg);
- gui_chat_set_custom_color_fg_bg (window, fg, bg);
+ gui_window_set_custom_color_fg_bg (GUI_CURSES(window)->win_chat,
+ fg, bg);
}
string += 6;
}
@@ -442,7 +250,8 @@ gui_chat_string_next_char (struct t_gui_window *window, unsigned char *string,
str_fg[1] = string[1];
str_fg[2] = '\0';
sscanf (str_fg, "%d", &weechat_color);
- gui_chat_set_weechat_color (window, weechat_color);
+ gui_window_set_weechat_color (GUI_CURSES(window)->win_chat,
+ weechat_color);
}
string += 2;
}
@@ -456,12 +265,14 @@ gui_chat_string_next_char (struct t_gui_window *window, unsigned char *string,
case GUI_COLOR_ATTR_BOLD_CHAR:
string++;
if (apply_style)
- gui_chat_set_color_style (window, A_BOLD);
+ gui_window_set_color_style (GUI_CURSES(window)->win_chat,
+ A_BOLD);
break;
case GUI_COLOR_ATTR_REVERSE_CHAR:
string++;
if (apply_style)
- gui_chat_set_color_style (window, A_REVERSE);
+ gui_window_set_color_style (GUI_CURSES(window)->win_chat,
+ A_REVERSE);
break;
case GUI_COLOR_ATTR_ITALIC_CHAR:
/* not available in Curses GUI */
@@ -470,7 +281,8 @@ gui_chat_string_next_char (struct t_gui_window *window, unsigned char *string,
case GUI_COLOR_ATTR_UNDERLINE_CHAR:
string++;
if (apply_style)
- gui_chat_set_color_style (window, A_UNDERLINE);
+ gui_window_set_color_style (GUI_CURSES(window)->win_chat,
+ A_UNDERLINE);
break;
}
break;
@@ -481,12 +293,14 @@ gui_chat_string_next_char (struct t_gui_window *window, unsigned char *string,
case GUI_COLOR_ATTR_BOLD_CHAR:
string++;
if (apply_style)
- gui_chat_remove_color_style (window, A_BOLD);
+ gui_window_remove_color_style (GUI_CURSES(window)->win_chat,
+ A_BOLD);
break;
case GUI_COLOR_ATTR_REVERSE_CHAR:
string++;
if (apply_style)
- gui_chat_remove_color_style (window, A_REVERSE);
+ gui_window_remove_color_style (GUI_CURSES(window)->win_chat,
+ A_REVERSE);
break;
case GUI_COLOR_ATTR_ITALIC_CHAR:
/* not available in Curses GUI */
@@ -495,7 +309,8 @@ gui_chat_string_next_char (struct t_gui_window *window, unsigned char *string,
case GUI_COLOR_ATTR_UNDERLINE_CHAR:
string++;
if (apply_style)
- gui_chat_remove_color_style (window, A_UNDERLINE);
+ gui_window_remove_color_style (GUI_CURSES(window)->win_chat,
+ A_UNDERLINE);
break;
}
break;
@@ -630,7 +445,8 @@ gui_chat_display_word (struct t_gui_window *window,
{
if (!simulate)
{
- gui_chat_set_weechat_color (window, GUI_COLOR_CHAT_PREFIX_SUFFIX);
+ gui_window_set_weechat_color (GUI_CURSES(window)->win_chat,
+ GUI_COLOR_CHAT_PREFIX_SUFFIX);
gui_chat_display_word_raw (window,
CONFIG_STRING(config_look_prefix_suffix),
0, 1);
@@ -640,7 +456,8 @@ gui_chat_display_word (struct t_gui_window *window,
gui_chat_display_word_raw (window, str_space, 0, 1);
window->win_chat_cursor_x += gui_chat_strlen_screen (str_space);
if (!simulate)
- gui_chat_set_weechat_color (window, GUI_COLOR_CHAT);
+ gui_window_set_weechat_color (GUI_CURSES(window)->win_chat,
+ GUI_COLOR_CHAT);
}
}
@@ -713,7 +530,7 @@ gui_chat_display_time_and_prefix (struct t_gui_window *window,
if (line->str_time && line->str_time[0])
{
if (!simulate)
- gui_chat_reset_style (window);
+ gui_window_reset_style (GUI_CURSES(window)->win_chat, GUI_COLOR_CHAT);
gui_chat_display_word (window, line, line->str_time,
NULL, 1, num_lines, count, lines_displayed,
@@ -729,7 +546,7 @@ gui_chat_display_time_and_prefix (struct t_gui_window *window,
|| (CONFIG_INTEGER(config_look_prefix_align) != CONFIG_LOOK_PREFIX_ALIGN_NONE)))
{
if (!simulate)
- gui_chat_reset_style (window);
+ gui_window_reset_style (GUI_CURSES(window)->win_chat, GUI_COLOR_CHAT);
if (CONFIG_INTEGER(config_look_prefix_align_max) > 0)
{
@@ -770,7 +587,7 @@ gui_chat_display_time_and_prefix (struct t_gui_window *window,
}
if (!simulate)
- gui_chat_reset_style (window);
+ gui_window_reset_style (GUI_CURSES(window)->win_chat, GUI_COLOR_CHAT);
if (CONFIG_INTEGER(config_look_prefix_align) == CONFIG_LOOK_PREFIX_ALIGN_LEFT)
{
@@ -785,7 +602,8 @@ gui_chat_display_time_and_prefix (struct t_gui_window *window,
&& (num_spaces < 0))
{
if (!simulate)
- gui_chat_set_weechat_color (window, GUI_COLOR_CHAT_PREFIX_MORE);
+ gui_window_set_weechat_color (GUI_CURSES(window)->win_chat,
+ GUI_COLOR_CHAT_PREFIX_MORE);
gui_chat_display_word (window, line, str_plus,
NULL, 1, num_lines, count, lines_displayed,
simulate);
@@ -801,7 +619,8 @@ gui_chat_display_time_and_prefix (struct t_gui_window *window,
&& CONFIG_STRING(config_look_prefix_suffix)[0]))
{
if (!simulate)
- gui_chat_set_weechat_color (window, GUI_COLOR_CHAT_PREFIX_SUFFIX);
+ gui_window_set_weechat_color (GUI_CURSES(window)->win_chat,
+ GUI_COLOR_CHAT_PREFIX_SUFFIX);
gui_chat_display_word (window, line,
CONFIG_STRING(config_look_prefix_suffix),
NULL, 1, num_lines, count,
@@ -869,7 +688,7 @@ gui_chat_display_line (struct t_gui_window *window, struct t_gui_line *line,
/* reset color & style for a new line */
if (!simulate)
- gui_chat_reset_style (window);
+ gui_window_reset_style (GUI_CURSES(window)->win_chat, GUI_COLOR_CHAT);
if (!line->message || !line->message[0])
gui_chat_display_new_line (window, num_lines, count,
@@ -969,8 +788,8 @@ gui_chat_display_line (struct t_gui_window *window, struct t_gui_line *line,
if (gui_chat_line_search (line, window->buffer->input_buffer,
window->buffer->text_search_exact))
{
- gui_chat_set_weechat_color (window,
- GUI_COLOR_CHAT_READ_MARKER);
+ gui_window_set_weechat_color (GUI_CURSES(window)->win_chat,
+ GUI_COLOR_CHAT_READ_MARKER);
mvwprintw (GUI_CURSES(window)->win_chat,
read_marker_y, read_marker_x,
"%c", CONFIG_STRING(config_look_read_marker)[0]);
@@ -982,8 +801,8 @@ gui_chat_display_line (struct t_gui_window *window, struct t_gui_line *line,
if (window->buffer->last_read_line &&
(window->buffer->last_read_line == gui_chat_get_prev_line_displayed (line)))
{
- gui_chat_set_weechat_color (window,
- GUI_COLOR_CHAT_READ_MARKER);
+ gui_window_set_weechat_color (GUI_CURSES(window)->win_chat,
+ GUI_COLOR_CHAT_READ_MARKER);
mvwprintw (GUI_CURSES(window)->win_chat,
read_marker_y, read_marker_x,
"%c", CONFIG_STRING(config_look_read_marker)[0]);
@@ -1004,10 +823,8 @@ void
gui_chat_display_line_y (struct t_gui_window *window, struct t_gui_line *line,
int y)
{
- int pair;
-
/* reset color & style for a new line */
- gui_chat_reset_style (window);
+ gui_window_reset_style (GUI_CURSES(window)->win_chat, GUI_COLOR_CHAT);
window->win_chat_cursor_x = 0;
window->win_chat_cursor_y = y;
@@ -1020,10 +837,7 @@ gui_chat_display_line_y (struct t_gui_window *window, struct t_gui_line *line,
gui_chat_display_word_raw (window, line->message,
window->win_chat_width, 1);
- pair = (GUI_CURSES(window)->current_style_bg < 0) ?
- 63 : GUI_CURSES(window)->current_style_bg * 8;
- wbkgdset (GUI_CURSES(window)->win_chat, ' ' | COLOR_PAIR (pair));
- wclrtoeol (GUI_CURSES(window)->win_chat);
+ gui_window_clrtoeol_with_current_bg (GUI_CURSES(window)->win_chat);
}
/*
diff --git a/src/gui/curses/gui-curses-infobar.c b/src/gui/curses/gui-curses-infobar.c
index 94a222136..f4a7d04f8 100644
--- a/src/gui/curses/gui-curses-infobar.c
+++ b/src/gui/curses/gui-curses-infobar.c
@@ -98,8 +98,8 @@ gui_infobar_draw (struct t_gui_buffer *buffer, int erase)
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
if (erase)
- gui_window_curses_clear (GUI_CURSES(ptr_win)->win_infobar,
- GUI_COLOR_INFOBAR);
+ gui_window_clear_weechat (GUI_CURSES(ptr_win)->win_infobar,
+ GUI_COLOR_INFOBAR);
gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_infobar,
GUI_COLOR_INFOBAR);
diff --git a/src/gui/curses/gui-curses-input.c b/src/gui/curses/gui-curses-input.c
index 8a871e19a..dd027e2a3 100644
--- a/src/gui/curses/gui-curses-input.c
+++ b/src/gui/curses/gui-curses-input.c
@@ -289,8 +289,8 @@ gui_input_draw (struct t_gui_buffer *buffer, int erase)
if (ptr_win->buffer == buffer)
{
if (erase)
- gui_window_curses_clear (GUI_CURSES(ptr_win)->win_input,
- GUI_COLOR_INPUT);
+ gui_window_clear_weechat (GUI_CURSES(ptr_win)->win_input,
+ GUI_COLOR_INPUT);
if (gui_keyboard_paste_pending)
{
diff --git a/src/gui/curses/gui-curses-status.c b/src/gui/curses/gui-curses-status.c
index 93125d639..5117752b2 100644
--- a/src/gui/curses/gui-curses-status.c
+++ b/src/gui/curses/gui-curses-status.c
@@ -58,8 +58,8 @@ gui_status_draw (int erase)
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
if (erase)
- gui_window_curses_clear (GUI_CURSES(ptr_win)->win_status,
- GUI_COLOR_STATUS);
+ 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);
diff --git a/src/gui/curses/gui-curses-window.c b/src/gui/curses/gui-curses-window.c
index 68207c6d5..adff0e7fb 100644
--- a/src/gui/curses/gui-curses-window.c
+++ b/src/gui/curses/gui-curses-window.c
@@ -46,6 +46,12 @@
#include "gui-curses.h"
+int current_style_fg; /* current foreground color */
+int current_style_bg; /* current background color */
+int current_style_attr; /* current attributes (bold, ..) */
+int current_color_attr; /* attr sum of last color(s) used */
+
+
/*
* gui_window_get_width: get screen width (terminal width in chars for Curses)
*/
@@ -185,11 +191,11 @@ gui_window_wprintw (WINDOW *window, char *data, ...)
}
/*
- * gui_window_curses_clear: clear a Curses window
+ * gui_window_curses_clear_weechat: clear a Curses window with a weechat color
*/
void
-gui_window_curses_clear (WINDOW *window, int num_color)
+gui_window_clear_weechat (WINDOW *window, int num_color)
{
if (!gui_ok)
return;
@@ -200,6 +206,91 @@ gui_window_curses_clear (WINDOW *window, int num_color)
}
/*
+ * gui_window_clear: clear a Curses window
+ */
+
+void
+gui_window_clear (WINDOW *window, int bg)
+{
+ int color;
+
+ if (!gui_ok)
+ return;
+
+ if ((bg >= 0) && (bg < GUI_CURSES_NUM_WEECHAT_COLORS))
+ {
+ color = gui_weechat_colors[bg].foreground;
+ wbkgdset (window,
+ ' ' | COLOR_PAIR (((color == -1) || (color == 99)) ?
+ 63 : color * 8));
+ werase (window);
+ wmove (window, 0, 0);
+ }
+}
+
+/*
+ * gui_window_reset_style: reset style (color and attr) for a window
+ */
+
+void
+gui_window_reset_style (WINDOW *window, int num_color)
+{
+ current_style_fg = -1;
+ current_style_bg = -1;
+ current_style_attr = 0;
+ current_color_attr = 0;
+
+ wattron (window, COLOR_PAIR(gui_color_get_pair (num_color)) |
+ gui_color[num_color]->attributes);
+ wattroff (window, A_BOLD | A_UNDERLINE | A_REVERSE);
+}
+
+/*
+ * gui_window_set_color_style: set style for color
+ */
+
+void
+gui_window_set_color_style (WINDOW *window, int style)
+{
+ current_color_attr |= style;
+ wattron (window, style);
+}
+
+/*
+ * gui_window_remove_color_style: remove style for color
+ */
+
+void
+gui_window_remove_color_style (WINDOW *window, int style)
+{
+ current_color_attr &= !style;
+ wattroff (window, style);
+}
+
+/*
+ * gui_window_set_color: set color for a window
+ */
+
+void
+gui_window_set_color (WINDOW *window, int fg, int bg)
+{
+ current_style_fg = fg;
+ current_style_bg = bg;
+
+ if (((fg == -1) || (fg == 99))
+ && ((bg == -1) || (bg == 99)))
+ wattron (window, COLOR_PAIR(63));
+ else
+ {
+ if ((fg == -1) || (fg == 99))
+ fg = COLOR_WHITE;
+ if ((bg == -1) || (bg == 99))
+ bg = 0;
+ wattron (window, COLOR_PAIR((bg * 8) + fg));
+ }
+}
+
+/*
* gui_window_set_weechat_color: set WeeChat color for window
*/
@@ -208,13 +299,92 @@ gui_window_set_weechat_color (WINDOW *window, int num_color)
{
if ((num_color >= 0) && (num_color < GUI_COLOR_NUM_COLORS))
{
+ /*
wattroff (window, A_BOLD | A_UNDERLINE | A_REVERSE);
wattron (window, COLOR_PAIR(gui_color_get_pair (num_color)) |
gui_color[num_color]->attributes);
+ */
+ gui_window_reset_style (window, num_color);
+ wattron (window, gui_color[num_color]->attributes);
+ gui_window_set_color (window,
+ gui_color[num_color]->foreground,
+ gui_color[num_color]->background);
}
}
/*
+ * gui_window_set_custom_color_fg_bg: set a custom color for a window
+ * (foreground and background)
+ */
+
+void
+gui_window_set_custom_color_fg_bg (WINDOW *window, int fg, int bg)
+{
+ if ((fg >= 0) && (fg < GUI_CURSES_NUM_WEECHAT_COLORS)
+ && (bg >= 0) && (bg < GUI_CURSES_NUM_WEECHAT_COLORS))
+ {
+ wattron (window, gui_weechat_colors[fg].attributes);
+ gui_window_set_color (window,
+ gui_weechat_colors[fg].foreground,
+ gui_weechat_colors[bg].foreground);
+ }
+}
+
+/*
+ * gui_window_set_custom_color_fg: set a custom color for a window
+ * (foreground only)
+ */
+
+void
+gui_window_set_custom_color_fg (WINDOW *window, int fg)
+{
+ int current_attr, current_bg;
+
+ if ((fg >= 0) && (fg < GUI_CURSES_NUM_WEECHAT_COLORS))
+ {
+ current_attr = current_style_attr;
+ current_bg = current_style_bg;
+ gui_window_remove_color_style (window, A_BOLD);
+ gui_window_set_color_style (window, gui_weechat_colors[fg].attributes);
+ gui_window_set_color (window,
+ gui_weechat_colors[fg].foreground,
+ current_bg);
+ }
+}
+
+/*
+ * gui_window_set_custom_color_bg: set a custom color for a window
+ * (background only)
+ */
+
+void
+gui_window_set_custom_color_bg (WINDOW *window, int bg)
+{
+ int current_attr, current_fg;
+
+ if ((bg >= 0) && (bg < GUI_CURSES_NUM_WEECHAT_COLORS))
+ {
+ current_attr = current_style_attr;
+ current_fg = current_style_fg;
+ gui_window_set_color_style (window, current_attr);
+ gui_window_set_color (window, current_fg,
+ gui_weechat_colors[bg].foreground);
+ }
+}
+
+/*
+ * gui_window_clrtoeol_with_current_bg: clear until end of line with current bg
+ */
+
+void
+gui_window_clrtoeol_with_current_bg (WINDOW *window)
+{
+ wbkgdset (window,
+ ' ' | COLOR_PAIR ((current_style_bg < 0) ? 63 : current_style_bg * 8));
+ wclrtoeol (window);
+}
+
+/*
* gui_window_calculate_pos_size: calculate position and size for a buffer & subwindows
* return 1 if pos/size changed, 0 if no change
*/
@@ -1694,10 +1864,6 @@ gui_window_objects_print_log (struct t_gui_window *window)
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);
- log_printf (" current_style_fg. . : %d", GUI_CURSES(window)->current_style_fg);
- log_printf (" current_style_bg. . : %d", GUI_CURSES(window)->current_style_bg);
- log_printf (" current_style_attr. : %d", GUI_CURSES(window)->current_style_attr);
- log_printf (" current_color_attr. : %d", GUI_CURSES(window)->current_color_attr);
for (ptr_bar_win = GUI_CURSES(window)->bar_windows; ptr_bar_win;
ptr_bar_win = ptr_bar_win->next_bar_window)
diff --git a/src/gui/curses/gui-curses.h b/src/gui/curses/gui-curses.h
index 3a2d9d3e4..02c9d7987 100644
--- a/src/gui/curses/gui-curses.h
+++ b/src/gui/curses/gui-curses.h
@@ -62,10 +62,6 @@ struct t_gui_curses_objects
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 */
- int current_style_fg; /* current foreground color */
- int current_style_bg; /* current background color */
- int current_style_attr; /* current attributes (bold, ..) */
- int current_color_attr; /* attr sum of last color(s) used */
};
extern struct t_gui_color gui_weechat_colors[];
@@ -95,8 +91,17 @@ extern int gui_keyboard_read_cb (void *data);
/* window functions */
extern int gui_window_utf_char_valid (char *utf_char);
extern void gui_window_wprintw (WINDOW *window, char *data, ...);
-extern void gui_window_curses_clear (WINDOW *window, int num_color);
+extern void gui_window_clear_weechat (WINDOW *window, int num_color);
+extern void gui_window_clear (WINDOW *window, int bg);
+extern void gui_window_reset_style (WINDOW *window, int num_color);
+extern void gui_window_set_color_style (WINDOW *window, int style);
+extern void gui_window_remove_color_style (WINDOW *window, int style);
+extern void gui_window_set_color (WINDOW *window, int fg, int bg);
extern void gui_window_set_weechat_color (WINDOW *window, int num_color);
+extern void gui_window_set_custom_color_fg_bg (WINDOW *window, int fg, int bg);
+extern void gui_window_set_custom_color_fg (WINDOW *window, int fg);
+extern void gui_window_set_custom_color_bg (WINDOW *window, int bg);
+extern void gui_window_clrtoeol_with_current_bg (WINDOW *window);
extern void gui_window_refresh_screen_sigwinch ();
extern void gui_window_title_set ();
extern void gui_window_title_reset ();
diff --git a/src/gui/gui-bar-item.c b/src/gui/gui-bar-item.c
index f01f42c8b..cdef4e277 100644
--- a/src/gui/gui-bar-item.c
+++ b/src/gui/gui-bar-item.c
@@ -266,7 +266,7 @@ gui_bar_item_default_time (void *data, struct t_gui_bar_item *item,
local_time) == 0)
return NULL;
- snprintf (buf, sizeof (buf), "%s[%s%s%s] ",
+ snprintf (buf, sizeof (buf), "%s[%s%s%s]",
GUI_COLOR(GUI_COLOR_STATUS_DELIMITERS),
GUI_COLOR(GUI_COLOR_STATUS),
text_time,
@@ -293,7 +293,7 @@ gui_bar_item_default_buffer_count (void *data, struct t_gui_bar_item *item,
(void) max_width;
(void) max_height;
- snprintf (buf, sizeof (buf), "%s[%s%d%s] ",
+ snprintf (buf, sizeof (buf), "%s[%s%d%s]",
GUI_COLOR(GUI_COLOR_STATUS_DELIMITERS),
GUI_COLOR(GUI_COLOR_STATUS),
(last_gui_buffer) ? last_gui_buffer->number : 0,
@@ -322,7 +322,7 @@ gui_bar_item_default_buffer_plugin (void *data, struct t_gui_bar_item *item,
if (!window)
window = gui_current_window;
- snprintf (buf, sizeof (buf), "%s[%s%s%s] ",
+ snprintf (buf, sizeof (buf), "%s[%s%s%s]",
GUI_COLOR(GUI_COLOR_STATUS_DELIMITERS),
GUI_COLOR(GUI_COLOR_STATUS),
(window->buffer->plugin) ? window->buffer->plugin->name : "core",
@@ -351,7 +351,7 @@ gui_bar_item_default_buffer_name (void *data, struct t_gui_bar_item *item,
if (!window)
window = gui_current_window;
- snprintf (buf, sizeof (buf), "%s%d%s:%s%s%s/%s%s ",
+ snprintf (buf, sizeof (buf), "%s%d%s:%s%s%s/%s%s",
GUI_COLOR(GUI_COLOR_STATUS_NUMBER),
window->buffer->number,
GUI_COLOR(GUI_COLOR_STATUS_DELIMITERS),
@@ -422,7 +422,7 @@ gui_bar_item_default_nicklist_count (void *data, struct t_gui_bar_item *item,
if (!window->buffer->nicklist)
return NULL;
- snprintf (buf, sizeof (buf), "%s[%s%d%s] ",
+ snprintf (buf, sizeof (buf), "%s[%s%d%s]",
GUI_COLOR(GUI_COLOR_STATUS_DELIMITERS),
GUI_COLOR(GUI_COLOR_STATUS),
window->buffer->nicklist_visible_count,
@@ -454,7 +454,7 @@ gui_bar_item_default_scroll (void *data, struct t_gui_bar_item *item,
if (!window->scroll)
return NULL;
- snprintf (buf, sizeof (buf), "%s%s ",
+ snprintf (buf, sizeof (buf), "%s%s",
GUI_COLOR(GUI_COLOR_STATUS_MORE),
_("(MORE)"));
@@ -545,7 +545,7 @@ gui_bar_item_default_hotlist (void *data, struct t_gui_bar_item *item,
break;
}
strcat (buf, GUI_COLOR(GUI_COLOR_STATUS_DELIMITERS));
- strcat (buf, "] ");
+ strcat (buf, "]");
return strdup (buf);
}
diff --git a/src/gui/gui-bar.c b/src/gui/gui-bar.c
index 5f995a213..e0873bfb1 100644
--- a/src/gui/gui-bar.c
+++ b/src/gui/gui-bar.c
@@ -34,15 +34,19 @@
#include "gui-bar.h"
#include "gui-buffer.h"
#include "gui-chat.h"
+#include "gui-color.h"
#include "gui-window.h"
char *gui_bar_option_str[GUI_BAR_NUM_OPTIONS] =
-{ "type", "conditions", "position", "size", "size_max", "separator", "items" };
+{ "type", "conditions", "position", "filling", "size", "size_max",
+ "color_fg", "color_bg", "separator", "items" };
char *gui_bar_type_str[GUI_BAR_NUM_TYPES] =
{ "root", "window" };
char *gui_bar_position_str[GUI_BAR_NUM_POSITIONS] =
{ "bottom", "top", "left", "right" };
+char *gui_bar_filling_str[GUI_BAR_NUM_FILLING] =
+{ "horizontal", "vertical" };
struct t_gui_bar *gui_bars = NULL; /* first bar */
struct t_gui_bar *last_gui_bar = NULL; /* last bar */
@@ -341,6 +345,23 @@ gui_bar_config_change_position (void *data, struct t_config_option *option)
}
/*
+ * gui_bar_config_change_filling: callback when filling is changed
+ */
+
+void
+gui_bar_config_change_filling (void *data, struct t_config_option *option)
+{
+ struct t_gui_bar *ptr_bar;
+
+ /* make C compiler happy */
+ (void) data;
+
+ ptr_bar = gui_bar_search_with_option_name (option->name);
+ if (ptr_bar)
+ gui_bar_refresh (ptr_bar);
+}
+
+/*
* gui_bar_config_check_size: callback for checking bar size before changing it
*/
@@ -422,6 +443,23 @@ gui_bar_config_change_size_max (void *data, struct t_config_option *option)
}
/*
+ * gui_bar_config_change_color: callback when color (fg or bg) is changed
+ */
+
+void
+gui_bar_config_change_color (void *data, struct t_config_option *option)
+{
+ struct t_gui_bar *ptr_bar;
+
+ /* make C compiler happy */
+ (void) data;
+
+ ptr_bar = gui_bar_search_with_option_name (option->name);
+ if (ptr_bar)
+ gui_bar_refresh (ptr_bar);
+}
+
+/*
* gui_bar_config_change_separator: callback when separator is changed
*/
@@ -495,10 +533,16 @@ gui_bar_set_name (struct t_gui_bar *bar, char *name)
config_file_option_rename (bar->conditions, option_name);
snprintf (option_name, length, "%s.position", name);
config_file_option_rename (bar->position, option_name);
+ snprintf (option_name, length, "%s.filling", name);
+ config_file_option_rename (bar->filling, option_name);
snprintf (option_name, length, "%s.size", name);
config_file_option_rename (bar->size, option_name);
snprintf (option_name, length, "%s.size_max", name);
config_file_option_rename (bar->size_max, option_name);
+ snprintf (option_name, length, "%s.color_fg", name);
+ config_file_option_rename (bar->color_fg, option_name);
+ snprintf (option_name, length, "%s.color_bg", name);
+ config_file_option_rename (bar->color_bg, option_name);
snprintf (option_name, length, "%s.separator", name);
config_file_option_rename (bar->separator, option_name);
snprintf (option_name, length, "%s.items", name);
@@ -751,6 +795,12 @@ gui_bar_set (struct t_gui_bar *bar, char *property, char *value)
gui_bar_refresh (bar);
return 1;
}
+ else if (string_strcasecmp (property, "filling") == 0)
+ {
+ config_file_option_set (bar->filling, value, 1);
+ gui_bar_refresh (bar);
+ return 1;
+ }
else if (string_strcasecmp (property, "size") == 0)
{
gui_bar_set_size (bar, value);
@@ -763,6 +813,18 @@ gui_bar_set (struct t_gui_bar *bar, char *property, char *value)
gui_bar_refresh (bar);
return 1;
}
+ else if (string_strcasecmp (property, "color_fg") == 0)
+ {
+ config_file_option_set (bar->color_fg, value, 1);
+ gui_bar_refresh (bar);
+ return 1;
+ }
+ else if (string_strcasecmp (property, "color_bg") == 0)
+ {
+ config_file_option_set (bar->color_bg, value, 1);
+ gui_bar_refresh (bar);
+ return 1;
+ }
else if (string_strcasecmp (property, "separator") == 0)
{
config_file_option_set (bar->separator,
@@ -799,8 +861,11 @@ gui_bar_alloc (char *name)
new_bar->type = NULL;
new_bar->conditions = NULL;
new_bar->position = NULL;
+ new_bar->filling = NULL;
new_bar->size = NULL;
new_bar->size_max = NULL;
+ new_bar->color_fg = NULL;
+ new_bar->color_bg = NULL;
new_bar->separator = NULL;
new_bar->items = NULL;
new_bar->current_size = 1;
@@ -863,6 +928,15 @@ gui_bar_create_option (char *bar_name, int index_option, char *value)
"bottom|top|left|right", 0, 0, value,
NULL, NULL, &gui_bar_config_change_position, NULL, NULL, NULL);
break;
+ case GUI_BAR_OPTION_FILLING:
+ ptr_option = config_file_new_option (
+ weechat_config_file, weechat_config_section_bar,
+ option_name, "integer",
+ N_("bar filling direction (\"horizontal\" (from left to "
+ "right) or \"vertical\" (from top to bottom))"),
+ "horizontal|vertical", 0, 0, value,
+ NULL, NULL, &gui_bar_config_change_filling, NULL, NULL, NULL);
+ break;
case GUI_BAR_OPTION_SIZE:
ptr_option = config_file_new_option (
weechat_config_file, weechat_config_section_bar,
@@ -883,6 +957,26 @@ gui_bar_create_option (char *bar_name, int index_option, char *value)
&gui_bar_config_change_size_max, NULL,
NULL, NULL);
break;
+ case GUI_BAR_OPTION_COLOR_FG:
+ ptr_option = config_file_new_option (
+ weechat_config_file, weechat_config_section_bar,
+ option_name, "color",
+ N_("default text color for bar"),
+ NULL, 0, 0, value,
+ NULL, NULL,
+ &gui_bar_config_change_color, NULL,
+ NULL, NULL);
+ break;
+ case GUI_BAR_OPTION_COLOR_BG:
+ ptr_option = config_file_new_option (
+ weechat_config_file, weechat_config_section_bar,
+ option_name, "color",
+ N_("default background color for bar"),
+ NULL, 0, 0, value,
+ NULL, NULL,
+ &gui_bar_config_change_color, NULL,
+ NULL, NULL);
+ break;
case GUI_BAR_OPTION_SEPARATOR:
ptr_option = config_file_new_option (
weechat_config_file, weechat_config_section_bar,
@@ -916,8 +1010,11 @@ gui_bar_new_with_options (struct t_weechat_plugin *plugin, char *name,
struct t_config_option *type,
struct t_config_option *conditions,
struct t_config_option *position,
+ struct t_config_option *filling,
struct t_config_option *size,
struct t_config_option *size_max,
+ struct t_config_option *color_fg,
+ struct t_config_option *color_bg,
struct t_config_option *separator,
struct t_config_option *items)
{
@@ -944,10 +1041,13 @@ gui_bar_new_with_options (struct t_weechat_plugin *plugin, char *name,
new_bar->conditions_array = NULL;
}
new_bar->position = position;
+ new_bar->filling = filling;
new_bar->size = size;
new_bar->current_size = (CONFIG_INTEGER(size) == 0) ?
1 : CONFIG_INTEGER(size);
new_bar->size_max = size_max;
+ new_bar->color_fg = color_fg;
+ new_bar->color_bg = color_bg;
new_bar->separator = separator;
new_bar->items = items;
if (CONFIG_STRING(items) && CONFIG_STRING(items)[0])
@@ -999,12 +1099,14 @@ gui_bar_new_with_options (struct t_weechat_plugin *plugin, char *name,
struct t_gui_bar *
gui_bar_new (struct t_weechat_plugin *plugin, char *name,
- char *type, char *conditions, char *position, char *size,
- char *size_max, char *separators, char *items)
+ char *type, char *conditions, char *position, char *filling,
+ char *size, char *size_max, char *color_fg, char *color_bg,
+ char *separators, char *items)
{
struct t_config_option *option_type, *option_conditions, *option_position;
- struct t_config_option *option_size, *option_size_max, *option_separator;
- struct t_config_option *option_items;
+ struct t_config_option *option_filling, *option_size, *option_size_max;
+ struct t_config_option *option_color_fg, *option_color_bg;
+ struct t_config_option *option_separator, *option_items;
struct t_gui_bar *new_bar;
if (!name || !name[0])
@@ -1028,10 +1130,16 @@ gui_bar_new (struct t_weechat_plugin *plugin, char *name,
conditions);
option_position = gui_bar_create_option (name, GUI_BAR_OPTION_POSITION,
position);
+ option_filling = gui_bar_create_option (name, GUI_BAR_OPTION_FILLING,
+ filling);
option_size = gui_bar_create_option (name, GUI_BAR_OPTION_SIZE,
size);
option_size_max = gui_bar_create_option (name, GUI_BAR_OPTION_SIZE_MAX,
size_max);
+ option_color_fg = gui_bar_create_option (name, GUI_BAR_OPTION_COLOR_FG,
+ color_fg);
+ option_color_bg = gui_bar_create_option (name, GUI_BAR_OPTION_COLOR_BG,
+ color_bg);
option_separator = gui_bar_create_option (name, GUI_BAR_OPTION_SEPARATOR,
(config_file_string_to_boolean (separators)) ?
"on" : "off");
@@ -1039,8 +1147,10 @@ gui_bar_new (struct t_weechat_plugin *plugin, char *name,
items);
new_bar = gui_bar_new_with_options (plugin, name, option_type,
option_conditions, option_position,
- option_size, option_size_max,
- option_separator, option_items);
+ option_filling, option_size,
+ option_size_max, option_color_fg,
+ option_color_bg, option_separator,
+ option_items);
if (!new_bar)
{
if (option_type)
@@ -1049,10 +1159,16 @@ gui_bar_new (struct t_weechat_plugin *plugin, char *name,
config_file_option_free (option_conditions);
if (option_position)
config_file_option_free (option_position);
+ if (option_filling)
+ config_file_option_free (option_filling);
if (option_size)
config_file_option_free (option_size);
if (option_size_max)
config_file_option_free (option_size_max);
+ if (option_color_fg)
+ config_file_option_free (option_color_fg);
+ if (option_color_bg)
+ config_file_option_free (option_color_bg);
if (option_separator)
config_file_option_free (option_separator);
if (option_items)
@@ -1087,7 +1203,15 @@ gui_bar_use_temp_bars ()
ptr_temp_bar->position = gui_bar_create_option (ptr_temp_bar->name,
GUI_BAR_OPTION_POSITION,
"top");
-
+
+ if (!ptr_temp_bar->filling)
+ ptr_temp_bar->filling = gui_bar_create_option (ptr_temp_bar->name,
+ GUI_BAR_OPTION_FILLING,
+ (ptr_temp_bar->position
+ && ((CONFIG_INTEGER(ptr_temp_bar->position) == GUI_BAR_POSITION_LEFT)
+ || (CONFIG_INTEGER(ptr_temp_bar->position) == GUI_BAR_POSITION_RIGHT))) ?
+ "vertical" : "horizontal");
+
if (!ptr_temp_bar->size)
ptr_temp_bar->size = gui_bar_create_option (ptr_temp_bar->name,
GUI_BAR_OPTION_SIZE,
@@ -1098,6 +1222,16 @@ gui_bar_use_temp_bars ()
GUI_BAR_OPTION_SIZE_MAX,
"0");
+ if (!ptr_temp_bar->color_fg)
+ ptr_temp_bar->color_fg = gui_bar_create_option (ptr_temp_bar->name,
+ GUI_BAR_OPTION_COLOR_FG,
+ "default");
+
+ if (!ptr_temp_bar->color_bg)
+ ptr_temp_bar->color_bg = gui_bar_create_option (ptr_temp_bar->name,
+ GUI_BAR_OPTION_COLOR_BG,
+ "default");
+
if (!ptr_temp_bar->separator)
ptr_temp_bar->separator = gui_bar_create_option (ptr_temp_bar->name,
GUI_BAR_OPTION_SEPARATOR,
@@ -1109,16 +1243,20 @@ gui_bar_use_temp_bars ()
"");
if (ptr_temp_bar->type && ptr_temp_bar->conditions
- && ptr_temp_bar->position && ptr_temp_bar->size
- && ptr_temp_bar->size_max && ptr_temp_bar->separator
- && ptr_temp_bar->items)
+ && ptr_temp_bar->position && ptr_temp_bar->filling
+ && ptr_temp_bar->size && ptr_temp_bar->size_max
+ && ptr_temp_bar->color_fg && ptr_temp_bar->color_bg
+ && ptr_temp_bar->separator && ptr_temp_bar->items)
{
gui_bar_new_with_options (NULL, ptr_temp_bar->name,
ptr_temp_bar->type,
ptr_temp_bar->conditions,
ptr_temp_bar->position,
+ ptr_temp_bar->filling,
ptr_temp_bar->size,
ptr_temp_bar->size_max,
+ ptr_temp_bar->color_fg,
+ ptr_temp_bar->color_bg,
ptr_temp_bar->separator,
ptr_temp_bar->items);
}
@@ -1139,6 +1277,11 @@ gui_bar_use_temp_bars ()
config_file_option_free (ptr_temp_bar->position);
ptr_temp_bar->position = NULL;
}
+ if (ptr_temp_bar->filling)
+ {
+ config_file_option_free (ptr_temp_bar->filling);
+ ptr_temp_bar->filling = NULL;
+ }
if (ptr_temp_bar->size)
{
config_file_option_free (ptr_temp_bar->size);
@@ -1149,6 +1292,16 @@ gui_bar_use_temp_bars ()
config_file_option_free (ptr_temp_bar->size_max);
ptr_temp_bar->size_max = NULL;
}
+ if (ptr_temp_bar->color_fg)
+ {
+ config_file_option_free (ptr_temp_bar->color_fg);
+ ptr_temp_bar->color_fg = NULL;
+ }
+ if (ptr_temp_bar->color_bg)
+ {
+ config_file_option_free (ptr_temp_bar->color_bg);
+ ptr_temp_bar->color_bg = NULL;
+ }
if (ptr_temp_bar->separator)
{
config_file_option_free (ptr_temp_bar->separator);
@@ -1227,10 +1380,16 @@ gui_bar_free (struct t_gui_bar *bar)
config_file_option_free (bar->conditions);
if (bar->position)
config_file_option_free (bar->position);
+ if (bar->filling)
+ config_file_option_free (bar->filling);
if (bar->size)
config_file_option_free (bar->size);
if (bar->size_max)
config_file_option_free (bar->size_max);
+ if (bar->color_fg)
+ config_file_option_free (bar->color_fg);
+ if (bar->color_bg)
+ config_file_option_free (bar->color_bg);
if (bar->separator)
config_file_option_free (bar->separator);
if (bar->items)
@@ -1302,8 +1461,17 @@ gui_bar_print_log ()
log_printf (" position . . . . . . . : %d (%s)",
CONFIG_INTEGER(ptr_bar->position),
gui_bar_position_str[CONFIG_INTEGER(ptr_bar->position)]);
+ log_printf (" filling. . . . . . . . : %d (%s)",
+ CONFIG_INTEGER(ptr_bar->filling),
+ gui_bar_filling_str[CONFIG_INTEGER(ptr_bar->filling)]);
log_printf (" size . . . . . . . . . : %d", CONFIG_INTEGER(ptr_bar->size));
log_printf (" size_max . . . . . . . : %d", CONFIG_INTEGER(ptr_bar->size_max));
+ log_printf (" color_fg . . . . . . . : %d",
+ CONFIG_COLOR(ptr_bar->color_fg),
+ gui_color_get_name (CONFIG_COLOR(ptr_bar->color_fg)));
+ log_printf (" color_bg . . . . . . . : %d",
+ CONFIG_COLOR(ptr_bar->color_bg),
+ gui_color_get_name (CONFIG_COLOR(ptr_bar->color_bg)));
log_printf (" current_size . . . . . : %d", ptr_bar->current_size);
log_printf (" separator. . . . . . . : %d", CONFIG_INTEGER(ptr_bar->separator));
log_printf (" items. . . . . . . . . : '%s'", CONFIG_STRING(ptr_bar->items));
diff --git a/src/gui/gui-bar.h b/src/gui/gui-bar.h
index 4cdc91c07..c1621544e 100644
--- a/src/gui/gui-bar.h
+++ b/src/gui/gui-bar.h
@@ -28,8 +28,11 @@ enum t_gui_bar_option
GUI_BAR_OPTION_TYPE = 0,
GUI_BAR_OPTION_CONDITIONS,
GUI_BAR_OPTION_POSITION,
+ GUI_BAR_OPTION_FILLING,
GUI_BAR_OPTION_SIZE,
GUI_BAR_OPTION_SIZE_MAX,
+ GUI_BAR_OPTION_COLOR_FG,
+ GUI_BAR_OPTION_COLOR_BG,
GUI_BAR_OPTION_SEPARATOR,
GUI_BAR_OPTION_ITEMS,
/* number of bar types */
@@ -54,6 +57,14 @@ enum t_gui_bar_position
GUI_BAR_NUM_POSITIONS,
};
+enum t_gui_bar_filling
+{
+ GUI_BAR_FILLING_HORIZONTAL = 0,
+ GUI_BAR_FILLING_VERTICAL,
+ /* number of bar positions */
+ GUI_BAR_NUM_FILLING,
+};
+
struct t_gui_bar
{
/* user choices */
@@ -63,8 +74,11 @@ struct t_gui_bar
struct t_config_option *type; /* type (root or window) */
struct t_config_option *conditions; /* conditions for display */
struct t_config_option *position; /* bottom, top, left, right */
+ struct t_config_option *filling; /* filling (H=horizontal,V=vertical)*/
struct t_config_option *size; /* size of bar (in chars, 0 = auto) */
struct t_config_option *size_max; /* max size of bar (0 = no limit) */
+ struct t_config_option *color_fg; /* default text color for bar */
+ struct t_config_option *color_bg; /* default background color for bar */
struct t_config_option *separator; /* true if separator line displayed */
struct t_config_option *items; /* bar items */
@@ -84,6 +98,7 @@ struct t_gui_bar
extern char *gui_bar_type_str[];
extern char *gui_bar_position_str[];
+extern char *gui_bar_filling_str[];
extern struct t_gui_bar *gui_bars;
extern struct t_gui_bar *last_gui_bar;
extern struct t_gui_bar *gui_temp_bars;
@@ -107,9 +122,10 @@ extern struct t_config_option *gui_bar_create_option (char *bar_name,
char *value);
extern struct t_gui_bar *gui_bar_new (struct t_weechat_plugin *plugin,
char *name, char *type, char *conditions,
- char *position, char *size,
- char *size_max, char *separator,
- char *items);
+ char *position, char *filling,
+ char *size, char *size_max,
+ char *color_fg, char *color_bg,
+ char *separator, char *items);
extern void gui_bar_use_temp_bars ();
extern void gui_bar_update (char *name);
extern void gui_bar_free (struct t_gui_bar *bar);
diff --git a/src/plugins/plugin-config.c b/src/plugins/plugin-config.c
index 73f562796..e6d2c51b5 100644
--- a/src/plugins/plugin-config.c
+++ b/src/plugins/plugin-config.c
@@ -185,7 +185,7 @@ plugin_config_init ()
if (plugin_config_file)
{
plugin_config_section_var = config_file_new_section (
- plugin_config_file, "var", 0, 0,
+ plugin_config_file, "var", 1, 1,
NULL, NULL,
NULL, NULL,
NULL, NULL,
diff --git a/src/plugins/scripts/lua/weechat-lua-api.c b/src/plugins/scripts/lua/weechat-lua-api.c
index e720da46e..9629e9e53 100644
--- a/src/plugins/scripts/lua/weechat-lua-api.c
+++ b/src/plugins/scripts/lua/weechat-lua-api.c
@@ -1852,6 +1852,124 @@ weechat_lua_api_config_free (lua_State *L)
}
/*
+ * weechat_lua_api_config_get: get config option
+ */
+
+static int
+weechat_lua_api_config_get (lua_State *L)
+{
+ const char *option;
+ char *result;
+ int n;
+
+ /* make C compiler happy */
+ (void) L;
+
+ if (!lua_current_script)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_get");
+ LUA_RETURN_EMPTY;
+ }
+
+ option = NULL;
+
+ n = lua_gettop (lua_current_interpreter);
+
+ if (n < 1)
+ {
+ WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_get");
+ LUA_RETURN_EMPTY;
+ }
+
+ option = lua_tostring (lua_current_interpreter, -1);
+
+ result = script_ptr2str (weechat_config_get ((char *)option));
+
+ LUA_RETURN_STRING_FREE(result);
+}
+
+/*
+ * weechat_lua_api_config_get_plugin: get value of a plugin option
+ */
+
+static int
+weechat_lua_api_config_get_plugin (lua_State *L)
+{
+ const char *option;
+ char *value;
+ int n;
+
+ /* make C compiler happy */
+ (void) L;
+
+ if (!lua_current_script)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_get_plugin");
+ LUA_RETURN_EMPTY;
+ }
+
+ option = NULL;
+
+ n = lua_gettop (lua_current_interpreter);
+
+ if (n < 1)
+ {
+ WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_get_plugin");
+ LUA_RETURN_EMPTY;
+ }
+
+ option = lua_tostring (lua_current_interpreter, -1);
+
+ value = script_api_config_get_plugin (weechat_lua_plugin,
+ lua_current_script,
+ (char *)option);
+
+ LUA_RETURN_STRING(value);
+}
+
+/*
+ * weechat_lua_api_config_set_plugin: set value of a plugin option
+ */
+
+static int
+weechat_lua_api_config_set_plugin (lua_State *L)
+{
+ const char *option, *value;
+ int n;
+
+ /* make C compiler happy */
+ (void) L;
+
+ if (!lua_current_script)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_set_plugin");
+ LUA_RETURN_ERROR;
+ }
+
+ option = NULL;
+ value = NULL;
+
+ n = lua_gettop (lua_current_interpreter);
+
+ if (n < 2)
+ {
+ WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_set_plugin");
+ LUA_RETURN_ERROR;
+ }
+
+ option = lua_tostring (lua_current_interpreter, -2);
+ value = lua_tostring (lua_current_interpreter, -1);
+
+ if (script_api_config_set_plugin (weechat_lua_plugin,
+ lua_current_script,
+ (char *)option,
+ (char *)value))
+ LUA_RETURN_OK;
+
+ LUA_RETURN_ERROR;
+}
+
+/*
* weechat_lua_api_prefix: get a prefix, used for display
*/
@@ -3878,8 +3996,8 @@ weechat_lua_api_bar_search (lua_State *L)
static int
weechat_lua_api_bar_new (lua_State *L)
{
- const char *name, *type, *conditions, *position, *size, *size_max;
- const char *separator, *items;
+ const char *name, *type, *conditions, *position, *filling, *size;
+ const char *size_max, *color_fg, *color_bg, *separator, *items;
char *result;
int n;
@@ -3896,25 +4014,31 @@ weechat_lua_api_bar_new (lua_State *L)
type = NULL;
conditions = NULL;
position = NULL;
+ filling = NULL;
size = NULL;
size_max = NULL;
+ color_fg = NULL;
+ color_bg = NULL;
separator = NULL;
items = NULL;
n = lua_gettop (lua_current_interpreter);
- if (n < 8)
+ if (n < 11)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("bar_new");
LUA_RETURN_EMPTY;
}
- name = lua_tostring (lua_current_interpreter, -8);
- type = lua_tostring (lua_current_interpreter, -7);
- conditions = lua_tostring (lua_current_interpreter, -6);
- position = lua_tostring (lua_current_interpreter, -5);
- size = lua_tostring (lua_current_interpreter, -4);
- size_max = lua_tostring (lua_current_interpreter, -3);
+ name = lua_tostring (lua_current_interpreter, -11);
+ type = lua_tostring (lua_current_interpreter, -10);
+ conditions = lua_tostring (lua_current_interpreter, -9);
+ position = lua_tostring (lua_current_interpreter, -8);
+ filling = lua_tostring (lua_current_interpreter, -7);
+ size = lua_tostring (lua_current_interpreter, -6);
+ size_max = lua_tostring (lua_current_interpreter, -5);
+ color_fg = lua_tostring (lua_current_interpreter, -4);
+ color_bg = lua_tostring (lua_current_interpreter, -3);
separator = lua_tostring (lua_current_interpreter, -2);
items = lua_tostring (lua_current_interpreter, -1);
@@ -3922,8 +4046,11 @@ weechat_lua_api_bar_new (lua_State *L)
(char *)type,
(char *)conditions,
(char *)position,
+ (char *)filling,
(char *)size,
(char *)size_max,
+ (char *)color_fg,
+ (char *)color_bg,
(char *)separator,
(char *)items));
@@ -4639,6 +4766,9 @@ const struct luaL_reg weechat_lua_api_funcs[] = {
{ "config_read", &weechat_lua_api_config_read },
{ "config_reload", &weechat_lua_api_config_reload },
{ "config_free", &weechat_lua_api_config_free },
+ { "config_get", &weechat_lua_api_config_get },
+ { "config_get_plugin", &weechat_lua_api_config_get_plugin },
+ { "config_set_plugin", &weechat_lua_api_config_set_plugin },
{ "prefix", &weechat_lua_api_prefix },
{ "color", &weechat_lua_api_color },
{ "print", &weechat_lua_api_print },
diff --git a/src/plugins/scripts/perl/weechat-perl-api.c b/src/plugins/scripts/perl/weechat-perl-api.c
index a833f4125..0ed6308ee 100644
--- a/src/plugins/scripts/perl/weechat-perl-api.c
+++ b/src/plugins/scripts/perl/weechat-perl-api.c
@@ -1531,6 +1531,101 @@ static XS (XS_weechat_config_free)
}
/*
+ * weechat::config_get: get config option
+ */
+
+static XS (XS_weechat_config_get)
+{
+ char *result;
+ dXSARGS;
+
+ /* make C compiler happy */
+ (void) cv;
+
+ if (!perl_current_script)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_get");
+ PERL_RETURN_EMPTY;
+ }
+
+ if (items < 1)
+ {
+ WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_get");
+ PERL_RETURN_EMPTY;
+ }
+
+ result = script_ptr2str (weechat_config_get (SvPV (ST (0), PL_na)));
+
+ PERL_RETURN_STRING_FREE(result);
+}
+
+/*
+ * weechat::config_get_plugin: get value of a plugin option
+ */
+
+static XS (XS_weechat_config_get_plugin)
+{
+ char *value;
+ dXSARGS;
+
+ /* make C compiler happy */
+ (void) cv;
+
+ if (!perl_current_script)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_get_plugin");
+ PERL_RETURN_EMPTY;
+ }
+
+ if (items < 1)
+ {
+ WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_get_plugin");
+ PERL_RETURN_EMPTY;
+ }
+
+ value = script_api_config_get_plugin (weechat_perl_plugin,
+ perl_current_script,
+ SvPV (ST (0), PL_na));
+
+ PERL_RETURN_STRING(value);
+}
+
+/*
+ * weechat::config_set_plugin: set value of a plugin option
+ */
+
+static XS (XS_weechat_config_set_plugin)
+{
+ char *option, *value;
+ dXSARGS;
+
+ /* make C compiler happy */
+ (void) cv;
+
+ if (!perl_current_script)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_set_plugin");
+ PERL_RETURN_ERROR;
+ }
+
+ if (items < 2)
+ {
+ WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_set_plugin");
+ PERL_RETURN_ERROR;
+ }
+
+ option = SvPV (ST (0), PL_na);
+ value = SvPV (ST (1), PL_na);
+ if (script_api_config_set_plugin (weechat_perl_plugin,
+ perl_current_script,
+ option,
+ value))
+ PERL_RETURN_OK;
+
+ PERL_RETURN_ERROR;
+}
+
+/*
* weechat::prefix: get a prefix, used for display
*/
@@ -2764,7 +2859,7 @@ static XS (XS_weechat_buffer_set)
if (!perl_current_script)
{
WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("buffer_set");
- PERL_RETURN_ERROR;
+ PERL_RETURN_ERROR;
}
if (items < 3)
@@ -3219,8 +3314,8 @@ static XS (XS_weechat_bar_search)
static XS (XS_weechat_bar_new)
{
- char *result, *name, *type, *conditions, *position, *size, *size_max;
- char *separator, *bar_items;
+ char *result, *name, *type, *conditions, *position, *filling, *size;
+ char *size_max, *color_fg, *color_bg, *separator, *bar_items;
dXSARGS;
/* make C compiler happy */
@@ -3232,7 +3327,7 @@ static XS (XS_weechat_bar_new)
PERL_RETURN_EMPTY;
}
- if (items < 8)
+ if (items < 11)
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("bar_new");
PERL_RETURN_EMPTY;
@@ -3242,16 +3337,22 @@ static XS (XS_weechat_bar_new)
type = SvPV (ST (1), PL_na);
conditions = SvPV (ST (2), PL_na);
position = SvPV (ST (3), PL_na);
- size = SvPV (ST (4), PL_na);
- size_max = SvPV (ST (5), PL_na);
- separator = SvPV (ST (6), PL_na);
- bar_items = SvPV (ST (7), PL_na);
+ filling = SvPV (ST (4), PL_na);
+ size = SvPV (ST (5), PL_na);
+ size_max = SvPV (ST (6), PL_na);
+ color_fg = SvPV (ST (7), PL_na);
+ color_bg = SvPV (ST (8), PL_na);
+ separator = SvPV (ST (9), PL_na);
+ bar_items = SvPV (ST (10), PL_na);
result = script_ptr2str (weechat_bar_new (name,
type,
conditions,
position,
+ filling,
size,
size_max,
+ color_fg,
+ color_bg,
separator,
bar_items));
@@ -3739,6 +3840,9 @@ weechat_perl_api_init (pTHX)
newXS ("weechat::config_read", XS_weechat_config_read, "weechat");
newXS ("weechat::config_reload", XS_weechat_config_reload, "weechat");
newXS ("weechat::config_free", XS_weechat_config_free, "weechat");
+ newXS ("weechat::config_get", XS_weechat_config_get, "weechat");
+ newXS ("weechat::config_get_plugin", XS_weechat_config_get_plugin, "weechat");
+ newXS ("weechat::config_set_plugin", XS_weechat_config_set_plugin, "weechat");
newXS ("weechat::prefix", XS_weechat_prefix, "weechat");
newXS ("weechat::color", XS_weechat_color, "weechat");
newXS ("weechat::print", XS_weechat_print, "weechat");
diff --git a/src/plugins/scripts/python/weechat-python-api.c b/src/plugins/scripts/python/weechat-python-api.c
index d2723def0..cbd5da57a 100644
--- a/src/plugins/scripts/python/weechat-python-api.c
+++ b/src/plugins/scripts/python/weechat-python-api.c
@@ -1627,6 +1627,107 @@ weechat_python_api_config_free (PyObject *self, PyObject *args)
}
/*
+ * weechat_python_api_config_get: get config option
+ */
+
+static PyObject *
+weechat_python_api_config_get (PyObject *self, PyObject *args)
+{
+ char *option, *result;
+ PyObject *object;
+
+ /* make C compiler happy */
+ (void) self;
+
+ if (!python_current_script)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_get");
+ PYTHON_RETURN_EMPTY;
+ }
+
+ option = NULL;
+
+ if (!PyArg_ParseTuple (args, "s", &option))
+ {
+ WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_get");
+ PYTHON_RETURN_EMPTY;
+ }
+
+ result = script_ptr2str (weechat_config_get (option));
+
+ PYTHON_RETURN_STRING_FREE(result);
+}
+
+/*
+ * weechat_python_api_config_get_plugin: get value of a plugin option
+ */
+
+static PyObject *
+weechat_python_api_config_get_plugin (PyObject *self, PyObject *args)
+{
+ char *option, *value;
+
+ /* make C compiler happy */
+ (void) self;
+
+ if (!python_current_script)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_get_plugin");
+ PYTHON_RETURN_EMPTY;
+ }
+
+ option = NULL;
+
+ if (!PyArg_ParseTuple (args, "s", &option))
+ {
+ WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_get_plugin");
+ PYTHON_RETURN_EMPTY;
+ }
+
+ value = script_api_config_get_plugin (weechat_python_plugin,
+ python_current_script,
+ option);
+
+ PYTHON_RETURN_STRING(value);
+}
+
+/*
+ * weechat_python_api_config_set_plugin: set value of a plugin option
+ */
+
+static PyObject *
+weechat_python_api_config_set_plugin (PyObject *self, PyObject *args)
+{
+ char *option, *value;
+
+ /* make C compiler happy */
+ (void) self;
+
+ if (!python_current_script)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_set_plugin");
+ PYTHON_RETURN_ERROR;
+ }
+
+ option = NULL;
+ value = NULL;
+
+ if (!PyArg_ParseTuple (args, "ss", &option, &value))
+ {
+ WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_set_plugin");
+ PYTHON_RETURN_ERROR;
+ }
+
+ if (script_api_config_set_plugin (weechat_python_plugin,
+ python_current_script,
+ option,
+ value))
+ PYTHON_RETURN_OK;
+
+ PYTHON_RETURN_ERROR;
+}
+
+/*
* weechat_python_api_prefix: get a prefix, used for display
*/
@@ -3426,8 +3527,8 @@ weechat_python_api_bar_search (PyObject *self, PyObject *args)
static PyObject *
weechat_python_api_bar_new (PyObject *self, PyObject *args)
{
- char *name, *type, *conditions, *position, *size, *size_max, *separator;
- char *items, *result;
+ char *name, *type, *conditions, *position, *filling, *size, *size_max;
+ char *color_fg, *color_bg, *separator, *items, *result;
PyObject *object;
/* make C compiler happy */
@@ -3443,13 +3544,17 @@ weechat_python_api_bar_new (PyObject *self, PyObject *args)
type = NULL;
conditions = NULL;
position = NULL;
+ filling = NULL;
size = NULL;
size_max = NULL;
+ color_fg = NULL;
+ color_bg = NULL;
separator = NULL;
items = NULL;
- if (!PyArg_ParseTuple (args, "ssssssss", &name, &conditions, &type,
- &position, &size, &size_max, &separator, &items))
+ if (!PyArg_ParseTuple (args, "sssssssssss", &name, &conditions, &type,
+ &position, &filling, &size, &size_max, &color_fg,
+ &color_bg, &separator, &items))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("bar_new");
PYTHON_RETURN_EMPTY;
@@ -3459,8 +3564,11 @@ weechat_python_api_bar_new (PyObject *self, PyObject *args)
type,
conditions,
position,
+ filling,
size,
size_max,
+ color_fg,
+ color_bg,
separator,
items));
@@ -3975,6 +4083,9 @@ PyMethodDef weechat_python_funcs[] =
{ "config_read", &weechat_python_api_config_read, METH_VARARGS, "" },
{ "config_reload", &weechat_python_api_config_reload, METH_VARARGS, "" },
{ "config_free", &weechat_python_api_config_free, METH_VARARGS, "" },
+ { "config_get", &weechat_python_api_config_get, METH_VARARGS, "" },
+ { "config_get_plugin", &weechat_python_api_config_get_plugin, METH_VARARGS, "" },
+ { "config_set_plugin", &weechat_python_api_config_set_plugin, METH_VARARGS, "" },
{ "prefix", &weechat_python_api_prefix, METH_VARARGS, "" },
{ "color", &weechat_python_api_color, METH_VARARGS, "" },
{ "prnt", &weechat_python_api_prnt, METH_VARARGS, "" },
diff --git a/src/plugins/scripts/ruby/weechat-ruby-api.c b/src/plugins/scripts/ruby/weechat-ruby-api.c
index 4ab36fccb..158601ec0 100644
--- a/src/plugins/scripts/ruby/weechat-ruby-api.c
+++ b/src/plugins/scripts/ruby/weechat-ruby-api.c
@@ -1882,6 +1882,114 @@ weechat_ruby_api_config_free (VALUE class, VALUE config_file)
}
/*
+ * weechat_ruby_api_config_get: get config option
+ */
+
+static VALUE
+weechat_ruby_api_config_get (VALUE class, VALUE option)
+{
+ char *c_option, *result;
+ VALUE return_value;
+
+ /* make C compiler happy */
+ (void) class;
+
+ if (!ruby_current_script)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_get");
+ RUBY_RETURN_EMPTY;
+ }
+
+ if (NIL_P (option))
+ {
+ WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_get");
+ RUBY_RETURN_EMPTY;
+ }
+
+ Check_Type (option, T_STRING);
+
+ c_option = STR2CSTR (option);
+
+ result = script_ptr2str (weechat_config_get (c_option));
+
+ RUBY_RETURN_STRING_FREE(result);
+}
+
+/*
+ * weechat_ruby_api_config_get_plugin: get value of a plugin option
+ */
+
+static VALUE
+weechat_ruby_api_config_get_plugin (VALUE class, VALUE option)
+{
+ char *c_option, *value;
+
+ /* make C compiler happy */
+ (void) class;
+
+ if (!ruby_current_script)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_get_plugin");
+ RUBY_RETURN_EMPTY;
+ }
+
+ if (NIL_P (option))
+ {
+ WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_get_plugin");
+ RUBY_RETURN_EMPTY;
+ }
+
+ Check_Type (option, T_STRING);
+
+ c_option = STR2CSTR (option);
+
+ value = script_api_config_get_plugin (weechat_ruby_plugin,
+ ruby_current_script,
+ c_option);
+
+ RUBY_RETURN_STRING(value);
+}
+
+/*
+ * weechat_ruby_api_config_set_plugin: set value of a plugin option
+ */
+
+static VALUE
+weechat_ruby_api_config_set_plugin (VALUE class, VALUE option, VALUE value)
+{
+ char *c_option, *c_value;
+
+ /* make C compiler happy */
+ (void) class;
+
+ if (!ruby_current_script)
+ {
+ WEECHAT_SCRIPT_MSG_NOT_INITIALIZED("config_set_plugin");
+ RUBY_RETURN_ERROR;
+ }
+
+ if (NIL_P (option) || NIL_P (value))
+ {
+ WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("config_set_plugin");
+ RUBY_RETURN_ERROR;
+ }
+
+ Check_Type (option, T_STRING);
+ Check_Type (value, T_STRING);
+
+ c_option = STR2CSTR (option);
+ c_value = STR2CSTR (value);
+
+ if (script_api_config_set_plugin (weechat_ruby_plugin,
+ ruby_current_script,
+ c_option,
+ c_value))
+ RUBY_RETURN_OK;
+
+ RUBY_RETURN_ERROR;
+}
+
+/*
* weechat_ruby_api_prefix: get a prefix, used for display
*/
@@ -3942,12 +4050,14 @@ weechat_ruby_api_bar_search (VALUE class, VALUE name)
*/
static VALUE
-weechat_ruby_api_bar_new (VALUE class, VALUE name, VALUE type, VALUE conditions,
- VALUE position, VALUE size, VALUE size_max,
- VALUE separator, VALUE items)
+weechat_ruby_api_bar_new (VALUE class, VALUE name, VALUE type,
+ VALUE conditions, VALUE position, VALUE filling,
+ VALUE size, VALUE size_max, VALUE color_fg,
+ VALUE color_bg, VALUE separator, VALUE items)
{
- char *c_name, *c_type, *c_conditions, *c_position, *c_size, *c_size_max;
- char *c_separator, *c_items, *result;
+ char *c_name, *c_type, *c_conditions, *c_position, *c_filling, *c_size;
+ char *c_size_max, *c_color_fg, *c_color_bg, *c_separator, *c_items;
+ char *result;
VALUE return_value;
/* make C compiler happy */
@@ -3963,13 +4073,17 @@ weechat_ruby_api_bar_new (VALUE class, VALUE name, VALUE type, VALUE conditions,
c_type = NULL;
c_conditions = NULL;
c_position = NULL;
+ c_filling = NULL;
c_size = NULL;
c_size_max = NULL;
+ c_color_fg = NULL;
+ c_color_bg = NULL;
c_separator = NULL;
c_items = NULL;
if (NIL_P (name) || NIL_P (type) || NIL_P (conditions) || NIL_P (position)
- || NIL_P (size) || NIL_P (size_max) || NIL_P (separator)
+ || NIL_P (filling) || NIL_P (size) || NIL_P (size_max)
+ || NIL_P (color_fg) || NIL_P (color_bg) || NIL_P (separator)
|| NIL_P (items))
{
WEECHAT_SCRIPT_MSG_WRONG_ARGUMENTS("bar_new");
@@ -3980,8 +4094,11 @@ weechat_ruby_api_bar_new (VALUE class, VALUE name, VALUE type, VALUE conditions,
Check_Type (type, T_STRING);
Check_Type (conditions, T_STRING);
Check_Type (position, T_STRING);
+ Check_Type (filling, T_STRING);
Check_Type (size, T_STRING);
Check_Type (size_max, T_STRING);
+ Check_Type (color_fg, T_STRING);
+ Check_Type (color_bg, T_STRING);
Check_Type (separator, T_STRING);
Check_Type (items, T_STRING);
@@ -3989,8 +4106,11 @@ weechat_ruby_api_bar_new (VALUE class, VALUE name, VALUE type, VALUE conditions,
c_type = STR2CSTR (type);
c_conditions = STR2CSTR (conditions);
c_position = STR2CSTR (position);
+ c_filling = STR2CSTR (filling);
c_size = STR2CSTR (size);
c_size_max = STR2CSTR (size_max);
+ c_color_fg = STR2CSTR (color_fg);
+ c_color_bg = STR2CSTR (color_bg);
c_separator = STR2CSTR (separator);
c_items = STR2CSTR (items);
@@ -3998,8 +4118,11 @@ weechat_ruby_api_bar_new (VALUE class, VALUE name, VALUE type, VALUE conditions,
c_type,
c_conditions,
c_position,
+ c_filling,
c_size,
c_size_max,
+ c_color_fg,
+ c_color_bg,
c_separator,
c_items));
@@ -4561,6 +4684,9 @@ weechat_ruby_api_init (VALUE ruby_mWeechat)
rb_define_module_function (ruby_mWeechat, "config_read", &weechat_ruby_api_config_read, 1);
rb_define_module_function (ruby_mWeechat, "config_reload", &weechat_ruby_api_config_reload, 1);
rb_define_module_function (ruby_mWeechat, "config_free", &weechat_ruby_api_config_free, 1);
+ rb_define_module_function (ruby_mWeechat, "config_get", &weechat_ruby_api_config_get, 1);
+ rb_define_module_function (ruby_mWeechat, "config_get_plugin", &weechat_ruby_api_config_get_plugin, 1);
+ rb_define_module_function (ruby_mWeechat, "config_set_plugin", &weechat_ruby_api_config_set_plugin, 2);
rb_define_module_function (ruby_mWeechat, "prefix", &weechat_ruby_api_prefix, 1);
rb_define_module_function (ruby_mWeechat, "color", &weechat_ruby_api_color, 1);
rb_define_module_function (ruby_mWeechat, "print", &weechat_ruby_api_print, 2);
@@ -4599,7 +4725,7 @@ weechat_ruby_api_init (VALUE ruby_mWeechat)
rb_define_module_function (ruby_mWeechat, "bar_item_update", &weechat_ruby_api_bar_item_update, 1);
rb_define_module_function (ruby_mWeechat, "bar_item_remove", &weechat_ruby_api_bar_item_remove, 1);
rb_define_module_function (ruby_mWeechat, "bar_search", &weechat_ruby_api_bar_search, 1);
- rb_define_module_function (ruby_mWeechat, "bar_new", &weechat_ruby_api_bar_new, 8);
+ rb_define_module_function (ruby_mWeechat, "bar_new", &weechat_ruby_api_bar_new, 11);
rb_define_module_function (ruby_mWeechat, "bar_set", &weechat_ruby_api_bar_set, 3);
rb_define_module_function (ruby_mWeechat, "bar_update", &weechat_ruby_api_bar_update, 1);
rb_define_module_function (ruby_mWeechat, "bar_remove", &weechat_ruby_api_bar_remove, 1);
diff --git a/src/plugins/scripts/script-api.c b/src/plugins/scripts/script-api.c
index b41b113e1..e074b5115 100644
--- a/src/plugins/scripts/script-api.c
+++ b/src/plugins/scripts/script-api.c
@@ -1158,7 +1158,7 @@ script_api_command (struct t_weechat_plugin *weechat_plugin,
/*
* script_api_config_get_plugin: get a value of a script option
- * format in file is: plugin.script.option=value
+ * format in file is: plugin.script.option = value
*/
char *
@@ -1185,7 +1185,7 @@ script_api_config_get_plugin (struct t_weechat_plugin *weechat_plugin,
/*
* script_api_config_set_plugin: set value of a script config option
- * format in file is: plugin.script.option=value
+ * format in file is: plugin.script.option = value
*/
int
diff --git a/src/plugins/weechat-plugin.h b/src/plugins/weechat-plugin.h
index a2df880fa..7eeed8326 100644
--- a/src/plugins/weechat-plugin.h
+++ b/src/plugins/weechat-plugin.h
@@ -377,8 +377,9 @@ struct t_weechat_plugin
struct t_gui_bar *(*bar_search) (char *name);
struct t_gui_bar *(*bar_new) (struct t_weechat_plugin *plugin, char *name,
char *type, char *condition, char *position,
- char *size, char *size_max, char *separator,
- char *items);
+ char *filling, char *size, char *size_max,
+ char *color_fg, char *color_bg,
+ char *separator, char *items);
int (*bar_set) (struct t_gui_bar *bar, char *property, char *value);
void (*bar_update) (char *name);
void (*bar_remove) (struct t_gui_bar *bar);
@@ -773,10 +774,12 @@ extern int weechat_plugin_end (struct t_weechat_plugin *plugin);
#define weechat_bar_search(__name) \
weechat_plugin->bar_search(__name)
#define weechat_bar_new(__name, __type, __condition, __position, \
- __size, __size_max, __separator, __items) \
+ __filling, __size, __size_max, __color_fg, \
+ __color_bg, __separator, __items) \
weechat_plugin->bar_new(weechat_plugin, __name, __type, \
- __condition, __position, __size, \
- __size_max, __separator, __items)
+ __condition, __position, __filling, __size, \
+ __size_max, __color_fg, __color_bg, \
+ __separator, __items)
#define weechat_bar_set(__bar, __property, __value) \
weechat_plugin->bar_set(__bar, __property, __value)
#define weechat_bar_update(__name) \