summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/wee-config.c7
-rw-r--r--src/core/wee-config.h1
-rw-r--r--src/gui/gui-bar-item.c50
-rw-r--r--src/gui/gui-bar-item.h1
-rw-r--r--src/gui/gui-input.c6
5 files changed, 61 insertions, 4 deletions
diff --git a/src/core/wee-config.c b/src/core/wee-config.c
index 6d213f19f..b9815641a 100644
--- a/src/core/wee-config.c
+++ b/src/core/wee-config.c
@@ -129,6 +129,7 @@ struct t_config_option *config_look_input_share_overwrite;
struct t_config_option *config_look_input_undo_max;
struct t_config_option *config_look_item_time_format;
struct t_config_option *config_look_item_buffer_filter;
+struct t_config_option *config_look_item_buffer_zoom;
struct t_config_option *config_look_jump_current_to_previous_buffer;
struct t_config_option *config_look_jump_previous_buffer_when_closing;
struct t_config_option *config_look_jump_smart_back_to_buffer;
@@ -2273,6 +2274,12 @@ config_weechat_init_options ()
N_("string used to show that some lines are filtered in current buffer "
"(bar item \"buffer_filter\")"),
NULL, 0, 0, "*", NULL, 0, NULL, NULL, &config_change_buffer_content, NULL, NULL, NULL);
+ config_look_item_buffer_zoom = config_file_new_option (
+ weechat_config_file, ptr_section,
+ "item_buffer_zoom", "string",
+ N_("string used to show zoom on merged buffer "
+ "(bar item \"buffer_zoom\")"),
+ NULL, 0, 0, "!", NULL, 0, NULL, NULL, &config_change_buffer_content, NULL, NULL, NULL);
config_look_jump_current_to_previous_buffer = config_file_new_option (
weechat_config_file, ptr_section,
"jump_current_to_previous_buffer", "boolean",
diff --git a/src/core/wee-config.h b/src/core/wee-config.h
index f78a8749e..db943e601 100644
--- a/src/core/wee-config.h
+++ b/src/core/wee-config.h
@@ -153,6 +153,7 @@ extern struct t_config_option *config_look_input_share_overwrite;
extern struct t_config_option *config_look_input_undo_max;
extern struct t_config_option *config_look_item_time_format;
extern struct t_config_option *config_look_item_buffer_filter;
+extern struct t_config_option *config_look_item_buffer_zoom;
extern struct t_config_option *config_look_jump_current_to_previous_buffer;
extern struct t_config_option *config_look_jump_previous_buffer_when_closing;
extern struct t_config_option *config_look_jump_smart_back_to_buffer;
diff --git a/src/gui/gui-bar-item.c b/src/gui/gui-bar-item.c
index 8300e007c..1ea72a931 100644
--- a/src/gui/gui-bar-item.c
+++ b/src/gui/gui-bar-item.c
@@ -59,8 +59,9 @@ struct t_gui_bar_item *last_gui_bar_item = NULL; /* last bar item */
char *gui_bar_item_names[GUI_BAR_NUM_ITEMS] =
{ "input_paste", "input_prompt", "input_search", "input_text", "time",
"buffer_count", "buffer_plugin", "buffer_number", "buffer_name",
- "buffer_modes", "buffer_filter", "buffer_nicklist_count", "scroll",
- "hotlist", "completion", "buffer_title", "buffer_nicklist", "window_number"
+ "buffer_modes", "buffer_filter", "buffer_zoom", "buffer_nicklist_count",
+ "scroll", "hotlist", "completion", "buffer_title", "buffer_nicklist",
+ "window_number"
};
char *gui_bar_items_default_for_bars[][2] =
{ { GUI_BAR_DEFAULT_NAME_INPUT,
@@ -69,8 +70,8 @@ char *gui_bar_items_default_for_bars[][2] =
"buffer_title" },
{ GUI_BAR_DEFAULT_NAME_STATUS,
"[time],[buffer_count],[buffer_plugin],buffer_number+:+"
- "buffer_name+(buffer_modes)+{buffer_nicklist_count}+buffer_filter,[lag],"
- "[hotlist],completion,scroll" },
+ "buffer_name+(buffer_modes)+{buffer_nicklist_count}+buffer_zoom+"
+ "buffer_filter,[lag],[hotlist],completion,scroll" },
{ GUI_BAR_DEFAULT_NAME_NICKLIST,
"buffer_nicklist" },
{ NULL,
@@ -1120,6 +1121,38 @@ gui_bar_item_default_buffer_nicklist_count (void *data,
}
/*
+ * Default item for zoom on merged buffer.
+ */
+
+char *
+gui_bar_item_buffer_zoom (void *data, struct t_gui_bar_item *item,
+ struct t_gui_window *window,
+ struct t_gui_buffer *buffer,
+ struct t_hashtable *extra_info)
+
+{
+ char buf[512];
+
+ /* make C compiler happy */
+ (void) data;
+ (void) item;
+ (void) window;
+ (void) extra_info;
+
+ if (!buffer)
+ return NULL;
+
+ /* don't display item if current buffer is not merged + zoomed */
+ if (buffer->active != 2)
+ return NULL;
+
+ snprintf (buf, sizeof (buf), "%s",
+ CONFIG_STRING(config_look_item_buffer_zoom));
+
+ return strdup (buf);
+}
+
+/*
* Default item for scrolling indicator.
*/
@@ -1921,6 +1954,15 @@ gui_bar_item_init ()
gui_bar_item_hook_signal ("filters_*",
gui_bar_item_names[GUI_BAR_ITEM_BUFFER_FILTER]);
+ /* buffer zoom */
+ gui_bar_item_new (NULL,
+ gui_bar_item_names[GUI_BAR_ITEM_BUFFER_ZOOM],
+ &gui_bar_item_buffer_zoom, NULL);
+ gui_bar_item_hook_signal ("buffer_zoomed",
+ gui_bar_item_names[GUI_BAR_ITEM_BUFFER_ZOOM]);
+ gui_bar_item_hook_signal ("buffer_unzoomed",
+ gui_bar_item_names[GUI_BAR_ITEM_BUFFER_ZOOM]);
+
/* buffer nicklist count */
gui_bar_item_new (NULL,
gui_bar_item_names[GUI_BAR_ITEM_BUFFER_NICKLIST_COUNT],
diff --git a/src/gui/gui-bar-item.h b/src/gui/gui-bar-item.h
index 1c8405b2e..df75be82a 100644
--- a/src/gui/gui-bar-item.h
+++ b/src/gui/gui-bar-item.h
@@ -33,6 +33,7 @@ enum t_gui_bar_item_weechat
GUI_BAR_ITEM_BUFFER_NAME,
GUI_BAR_ITEM_BUFFER_MODES,
GUI_BAR_ITEM_BUFFER_FILTER,
+ GUI_BAR_ITEM_BUFFER_ZOOM,
GUI_BAR_ITEM_BUFFER_NICKLIST_COUNT,
GUI_BAR_ITEM_SCROLL,
GUI_BAR_ITEM_HOTLIST,
diff --git a/src/gui/gui-input.c b/src/gui/gui-input.c
index a97f485f7..708e31e92 100644
--- a/src/gui/gui-input.c
+++ b/src/gui/gui-input.c
@@ -1605,11 +1605,14 @@ void
gui_input_zoom_merged_buffer (struct t_gui_buffer *buffer)
{
struct t_gui_window *ptr_window;
+ int buffer_was_zoomed;
/* do nothing if current buffer is not merged with another buffer */
if (gui_buffer_count_merged_buffers (buffer->number) < 2)
return;
+ buffer_was_zoomed = (buffer->active == 2);
+
/* reset scroll in all windows displaying this buffer number */
for (ptr_window = gui_windows; ptr_window;
ptr_window = ptr_window->next_window)
@@ -1646,6 +1649,9 @@ gui_input_zoom_merged_buffer (struct t_gui_buffer *buffer)
}
gui_buffer_ask_chat_refresh (buffer, 2);
+
+ hook_signal_send ((buffer_was_zoomed) ? "buffer_unzoomed" : "buffer_zoomed",
+ WEECHAT_HOOK_SIGNAL_POINTER, buffer);
}
/*