1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-26 12:56:37 +02:00

core: add new option weechat.look.separator_vertical, rename option weechat.look.hline_char to weechat.look.separator_horizontal

This commit is contained in:
Sebastien Helleu
2011-06-29 10:33:08 +02:00
parent 56a39bc8c8
commit 0f5b4dbecb
20 changed files with 278 additions and 145 deletions
+16 -8
View File
@@ -90,7 +90,6 @@ struct t_config_option *config_look_eat_newline_glitch;
struct t_config_option *config_look_highlight;
struct t_config_option *config_look_highlight_regex;
struct t_config_option *config_look_highlight_tags;
struct t_config_option *config_look_hline_char;
struct t_config_option *config_look_hotlist_add_buffer_if_away;
struct t_config_option *config_look_hotlist_buffer_separator;
struct t_config_option *config_look_hotlist_count_max;
@@ -129,6 +128,8 @@ struct t_config_option *config_look_save_layout_on_exit;
struct t_config_option *config_look_scroll_amount;
struct t_config_option *config_look_scroll_page_percent;
struct t_config_option *config_look_search_text_not_found_alert;
struct t_config_option *config_look_separator_horizontal;
struct t_config_option *config_look_separator_vertical;
struct t_config_option *config_look_set_title;
struct t_config_option *config_look_time_format;
@@ -1652,13 +1653,6 @@ config_weechat_init_options ()
"comparison, examples: \"irc_notice\" for IRC notices, "
"\"nick_flashcode\" for messages from nick \"FlashCode\")"),
NULL, 0, 0, "", NULL, 0, NULL, NULL, &config_change_highlight_tags, NULL, NULL, NULL);
config_look_hline_char = config_file_new_option (
weechat_config_file, ptr_section,
"hline_char", "string",
N_("char used to draw horizontal separators around bars (empty value "
"will draw a real line with ncurses, but may cause bugs with URL "
"selection under some terminals), wide chars are NOT allowed here"),
NULL, 0, 0, "-", NULL, 0, NULL, NULL, &config_change_buffers, NULL, NULL, NULL);
config_look_hotlist_add_buffer_if_away = config_file_new_option (
weechat_config_file, ptr_section,
"hotlist_add_buffer_if_away", "boolean",
@@ -1898,6 +1892,20 @@ config_weechat_init_options ()
"search_text_not_found_alert", "boolean",
N_("alert user when text sought is not found in buffer"),
NULL, 0, 0, "on", NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL);
config_look_separator_horizontal = config_file_new_option (
weechat_config_file, ptr_section,
"separator_horizontal", "string",
N_("char used to draw horizontal separators around bars (empty value "
"will draw a real line with ncurses, but may cause bugs with URL "
"selection under some terminals), wide chars are NOT allowed here"),
NULL, 0, 0, "-", NULL, 0, NULL, NULL, &config_change_buffers, NULL, NULL, NULL);
config_look_separator_vertical = config_file_new_option (
weechat_config_file, ptr_section,
"separator_vertical", "string",
N_("char used to draw vertical separators around bars (empty value "
"will draw a real line with ncurses), wide chars are NOT allowed "
"here"),
NULL, 0, 0, "", NULL, 0, NULL, NULL, &config_change_buffers, NULL, NULL, NULL);
config_look_set_title = config_file_new_option (
weechat_config_file, ptr_section,
"set_title", "boolean",
+2 -1
View File
@@ -115,7 +115,6 @@ extern struct t_config_option *config_look_day_change_time_format;
extern struct t_config_option *config_look_eat_newline_glitch;
extern struct t_config_option *config_look_highlight;
extern struct t_config_option *config_look_highlight_regex;
extern struct t_config_option *config_look_hline_char;
extern struct t_config_option *config_look_hotlist_add_buffer_if_away;
extern struct t_config_option *config_look_hotlist_buffer_separator;
extern struct t_config_option *config_look_hotlist_count_max;
@@ -154,6 +153,8 @@ extern struct t_config_option *config_look_save_layout_on_exit;
extern struct t_config_option *config_look_scroll_amount;
extern struct t_config_option *config_look_scroll_page_percent;
extern struct t_config_option *config_look_search_text_not_found_alert;
extern struct t_config_option *config_look_separator_horizontal;
extern struct t_config_option *config_look_separator_vertical;
extern struct t_config_option *config_look_set_title;
extern struct t_config_option *config_look_time_format;
+19 -12
View File
@@ -352,7 +352,7 @@ gui_bar_window_draw (struct t_gui_bar_window *bar_window,
int chars_available, index, size;
int length_screen_before_cursor, length_screen_after_cursor;
int diff, max_length, optimal_number_of_lines;
int some_data_not_displayed, hline_char;
int some_data_not_displayed, separator_horizontal, separator_vertical;
if (!gui_init_ok)
return;
@@ -639,40 +639,47 @@ gui_bar_window_draw (struct t_gui_bar_window *bar_window,
if (CONFIG_INTEGER(bar_window->bar->options[GUI_BAR_OPTION_SEPARATOR]))
{
if (CONFIG_STRING(config_look_hline_char)
&& CONFIG_STRING(config_look_hline_char)[0])
separator_horizontal = ACS_HLINE;
separator_vertical = ACS_VLINE;
if (CONFIG_STRING(config_look_separator_horizontal)
&& CONFIG_STRING(config_look_separator_horizontal)[0])
{
hline_char = utf8_char_int (CONFIG_STRING(config_look_hline_char));
if (hline_char > 127)
hline_char = ACS_HLINE;
separator_horizontal = utf8_char_int (CONFIG_STRING(config_look_separator_horizontal));
if (separator_horizontal > 127)
separator_horizontal = ACS_HLINE;
}
if (CONFIG_STRING(config_look_separator_vertical)
&& CONFIG_STRING(config_look_separator_vertical)[0])
{
separator_vertical = utf8_char_int (CONFIG_STRING(config_look_separator_vertical));
if (separator_vertical > 127)
separator_vertical = ACS_VLINE;
}
else
hline_char = ACS_HLINE;
switch (CONFIG_INTEGER(bar_window->bar->options[GUI_BAR_OPTION_POSITION]))
{
case GUI_BAR_POSITION_BOTTOM:
gui_window_set_weechat_color (GUI_BAR_WINDOW_OBJECTS(bar_window)->win_separator,
GUI_COLOR_SEPARATOR);
mvwhline (GUI_BAR_WINDOW_OBJECTS(bar_window)->win_separator,
0, 0, hline_char, bar_window->width);
0, 0, separator_horizontal, bar_window->width);
break;
case GUI_BAR_POSITION_TOP:
gui_window_set_weechat_color (GUI_BAR_WINDOW_OBJECTS(bar_window)->win_separator,
GUI_COLOR_SEPARATOR);
mvwhline (GUI_BAR_WINDOW_OBJECTS(bar_window)->win_separator,
0, 0, hline_char, bar_window->width);
0, 0, separator_horizontal, bar_window->width);
break;
case GUI_BAR_POSITION_LEFT:
gui_window_set_weechat_color (GUI_BAR_WINDOW_OBJECTS(bar_window)->win_separator,
GUI_COLOR_SEPARATOR);
mvwvline (GUI_BAR_WINDOW_OBJECTS(bar_window)->win_separator,
0, 0, ACS_VLINE, bar_window->height);
0, 0, separator_vertical, bar_window->height);
break;
case GUI_BAR_POSITION_RIGHT:
gui_window_set_weechat_color (GUI_BAR_WINDOW_OBJECTS(bar_window)->win_separator,
GUI_COLOR_SEPARATOR);
mvwvline (GUI_BAR_WINDOW_OBJECTS(bar_window)->win_separator,
0, 0, ACS_VLINE, bar_window->height);
0, 0, separator_vertical, bar_window->height);
break;
case GUI_BAR_NUM_POSITIONS:
break;
+12 -2
View File
@@ -942,6 +942,8 @@ gui_window_calculate_pos_size (struct t_gui_window *window)
void
gui_window_draw_separator (struct t_gui_window *window)
{
int separator_vertical;
if (GUI_WINDOW_OBJECTS(window)->win_separator)
{
delwin (GUI_WINDOW_OBJECTS(window)->win_separator);
@@ -956,8 +958,16 @@ gui_window_draw_separator (struct t_gui_window *window)
window->win_x - 1);
gui_window_set_weechat_color (GUI_WINDOW_OBJECTS(window)->win_separator,
GUI_COLOR_SEPARATOR);
mvwvline (GUI_WINDOW_OBJECTS(window)->win_separator, 0, 0, ACS_VLINE,
window->win_height);
separator_vertical = ACS_VLINE;
if (CONFIG_STRING(config_look_separator_vertical)
&& CONFIG_STRING(config_look_separator_vertical)[0])
{
separator_vertical = utf8_char_int (CONFIG_STRING(config_look_separator_vertical));
if (separator_vertical > 127)
separator_vertical = ACS_VLINE;
}
mvwvline (GUI_WINDOW_OBJECTS(window)->win_separator, 0, 0,
separator_vertical, window->win_height);
wnoutrefresh (GUI_WINDOW_OBJECTS(window)->win_separator);
refresh ();
}