mirror of
https://github.com/weechat/weechat.git
synced 2026-07-06 09:43:13 +02:00
core: add "hdata" (direct access to WeeChat/plugin data)
This commit is contained in:
@@ -26,12 +26,14 @@
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "../core/weechat.h"
|
||||
#include "../core/wee-config.h"
|
||||
#include "../core/wee-hashtable.h"
|
||||
#include "../core/wee-hdata.h"
|
||||
#include "../core/wee-hook.h"
|
||||
#include "../core/wee-infolist.h"
|
||||
#include "../core/wee-log.h"
|
||||
@@ -78,6 +80,8 @@ char *gui_bar_items_default_for_bars[][2] =
|
||||
struct t_gui_bar_item_hook *gui_bar_item_hooks = NULL;
|
||||
struct t_hook *gui_bar_item_timer = NULL;
|
||||
|
||||
struct t_hdata *gui_bar_item_hdata_bar_item = NULL;
|
||||
|
||||
|
||||
/*
|
||||
* gui_bar_item_valid: check if a bar item pointer exists
|
||||
@@ -1685,6 +1689,37 @@ gui_bar_item_end ()
|
||||
gui_bar_item_free_all ();
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_bar_item_hdata_bar_item_cb: return hdata for bar item
|
||||
*/
|
||||
|
||||
struct t_hdata *
|
||||
gui_bar_item_hdata_bar_item_cb (void *data, const char *hdata_name)
|
||||
{
|
||||
struct t_hdata *hdata;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
|
||||
if (gui_bar_item_hdata_bar_item)
|
||||
return gui_bar_item_hdata_bar_item;
|
||||
|
||||
hdata = hdata_new (hdata_name, "prev_item", "next_item");
|
||||
if (hdata)
|
||||
{
|
||||
gui_bar_item_hdata_bar_item = hdata;
|
||||
HDATA_VAR(struct t_gui_bar_item, plugin, POINTER);
|
||||
HDATA_VAR(struct t_gui_bar_item, name, STRING);
|
||||
HDATA_VAR(struct t_gui_bar_item, build_callback, POINTER);
|
||||
HDATA_VAR(struct t_gui_bar_item, build_callback_data, POINTER);
|
||||
HDATA_VAR(struct t_gui_bar_item, prev_item, POINTER);
|
||||
HDATA_VAR(struct t_gui_bar_item, next_item, POINTER);
|
||||
HDATA_LIST(gui_bar_items);
|
||||
HDATA_LIST(last_gui_bar_item);
|
||||
}
|
||||
return gui_bar_item_hdata_bar_item;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_bar_item_add_to_infolist: add a bar item in an infolist
|
||||
* return 1 if ok, 0 if error
|
||||
|
||||
@@ -93,6 +93,8 @@ extern void gui_bar_item_free_all ();
|
||||
extern void gui_bar_item_free_all_plugin (struct t_weechat_plugin *plugin);
|
||||
extern void gui_bar_item_init ();
|
||||
extern void gui_bar_item_end ();
|
||||
extern struct t_hdata *gui_bar_item_hdata_bar_item_cb (void *data,
|
||||
const char *hdata_name);
|
||||
extern int gui_bar_item_add_to_infolist (struct t_infolist *infolist,
|
||||
struct t_gui_bar_item *bar_item);
|
||||
extern void gui_bar_item_print_log ();
|
||||
|
||||
@@ -26,11 +26,13 @@
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include "../core/weechat.h"
|
||||
#include "../core/wee-config.h"
|
||||
#include "../core/wee-hdata.h"
|
||||
#include "../core/wee-hook.h"
|
||||
#include "../core/wee-infolist.h"
|
||||
#include "../core/wee-log.h"
|
||||
@@ -66,6 +68,8 @@ struct t_gui_bar *last_gui_bar = NULL; /* last bar */
|
||||
struct t_gui_bar *gui_temp_bars = NULL; /* bars used when reading config */
|
||||
struct t_gui_bar *last_gui_temp_bar = NULL;
|
||||
|
||||
struct t_hdata *gui_bar_hdata_bar = NULL;
|
||||
|
||||
|
||||
void gui_bar_free_bar_windows (struct t_gui_bar *bar);
|
||||
|
||||
@@ -2142,6 +2146,42 @@ gui_bar_free_bar_windows (struct t_gui_bar *bar)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_bar_hdata_bar_cb: return hdata for bar
|
||||
*/
|
||||
|
||||
struct t_hdata *
|
||||
gui_bar_hdata_bar_cb (void *data, const char *hdata_name)
|
||||
{
|
||||
struct t_hdata *hdata;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
|
||||
if (gui_bar_hdata_bar)
|
||||
return gui_bar_hdata_bar;
|
||||
|
||||
hdata = hdata_new (hdata_name, "prev_bar", "next_bar");
|
||||
if (hdata)
|
||||
{
|
||||
gui_bar_hdata_bar = hdata;
|
||||
HDATA_VAR(struct t_gui_bar, name, STRING);
|
||||
HDATA_VAR(struct t_gui_bar, options, POINTER);
|
||||
HDATA_VAR(struct t_gui_bar, conditions_count, INTEGER);
|
||||
HDATA_VAR(struct t_gui_bar, conditions_array, POINTER);
|
||||
HDATA_VAR(struct t_gui_bar, items_count, INTEGER);
|
||||
HDATA_VAR(struct t_gui_bar, items_subcount, POINTER);
|
||||
HDATA_VAR(struct t_gui_bar, items_array, POINTER);
|
||||
HDATA_VAR(struct t_gui_bar, bar_window, POINTER);
|
||||
HDATA_VAR(struct t_gui_bar, bar_refresh_needed, INTEGER);
|
||||
HDATA_VAR(struct t_gui_bar, prev_bar, POINTER);
|
||||
HDATA_VAR(struct t_gui_bar, next_bar, POINTER);
|
||||
HDATA_LIST(gui_bars);
|
||||
HDATA_LIST(last_gui_bar);
|
||||
}
|
||||
return gui_bar_hdata_bar;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_bar_add_to_infolist: add a bar in an infolist
|
||||
* return 1 if ok, 0 if error
|
||||
|
||||
@@ -151,6 +151,8 @@ extern int gui_bar_scroll (struct t_gui_bar *bar, struct t_gui_buffer *buffer,
|
||||
const char *scroll);
|
||||
extern void gui_bar_free (struct t_gui_bar *bar);
|
||||
extern void gui_bar_free_all ();
|
||||
extern struct t_hdata *gui_bar_hdata_bar_cb (void *data,
|
||||
const char *hdata_name);
|
||||
extern int gui_bar_add_to_infolist (struct t_infolist *infolist,
|
||||
struct t_gui_bar *bar);
|
||||
extern void gui_bar_print_log ();
|
||||
|
||||
+174
-23
@@ -26,6 +26,7 @@
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <unistd.h>
|
||||
@@ -37,6 +38,7 @@
|
||||
#include "../core/weechat.h"
|
||||
#include "../core/wee-config.h"
|
||||
#include "../core/wee-hashtable.h"
|
||||
#include "../core/wee-hdata.h"
|
||||
#include "../core/wee-hook.h"
|
||||
#include "../core/wee-infolist.h"
|
||||
#include "../core/wee-list.h"
|
||||
@@ -69,6 +71,10 @@ int gui_buffers_visited_index = -1; /* index of pointer in list */
|
||||
int gui_buffers_visited_count = 0; /* number of visited buffers*/
|
||||
int gui_buffers_visited_frozen = 0; /* 1 to forbid list updates */
|
||||
|
||||
struct t_hdata *gui_buffer_hdata_buffer = NULL;
|
||||
struct t_hdata *gui_buffer_hdata_input_undo = NULL;
|
||||
struct t_hdata *gui_buffer_hdata_buffer_visited = NULL;
|
||||
|
||||
char *gui_buffer_notify_string[GUI_BUFFER_NUM_NOTIFY] =
|
||||
{ "none", "highlight", "message", "all" };
|
||||
|
||||
@@ -426,10 +432,11 @@ gui_buffer_new (struct t_weechat_plugin *plugin,
|
||||
gui_buffer_input_buffer_init (new_buffer);
|
||||
|
||||
/* undo for input */
|
||||
(new_buffer->input_undo_snap).data = NULL;
|
||||
(new_buffer->input_undo_snap).pos = 0;
|
||||
(new_buffer->input_undo_snap).prev_undo = NULL; /* not used */
|
||||
(new_buffer->input_undo_snap).next_undo = NULL; /* not used */
|
||||
new_buffer->input_undo_snap = malloc (sizeof (*(new_buffer->input_undo_snap)));
|
||||
(new_buffer->input_undo_snap)->data = NULL;
|
||||
(new_buffer->input_undo_snap)->pos = 0;
|
||||
(new_buffer->input_undo_snap)->prev_undo = NULL; /* not used */
|
||||
(new_buffer->input_undo_snap)->next_undo = NULL; /* not used */
|
||||
new_buffer->input_undo = NULL;
|
||||
new_buffer->last_input_undo = NULL;
|
||||
new_buffer->ptr_input_undo = NULL;
|
||||
@@ -2058,6 +2065,8 @@ gui_buffer_close (struct t_gui_buffer *buffer)
|
||||
if (buffer->input_buffer)
|
||||
free (buffer->input_buffer);
|
||||
gui_buffer_undo_free_all (buffer);
|
||||
if (buffer->input_undo_snap)
|
||||
free (buffer->input_undo_snap);
|
||||
if (buffer->completion)
|
||||
gui_completion_free (buffer->completion);
|
||||
gui_history_buffer_free (buffer);
|
||||
@@ -2523,18 +2532,18 @@ gui_buffer_unmerge (struct t_gui_buffer *buffer, int number)
|
||||
void
|
||||
gui_buffer_undo_snap (struct t_gui_buffer *buffer)
|
||||
{
|
||||
if ((buffer->input_undo_snap).data)
|
||||
if ((buffer->input_undo_snap)->data)
|
||||
{
|
||||
free ((buffer->input_undo_snap).data);
|
||||
(buffer->input_undo_snap).data = NULL;
|
||||
free ((buffer->input_undo_snap)->data);
|
||||
(buffer->input_undo_snap)->data = NULL;
|
||||
}
|
||||
(buffer->input_undo_snap).pos = 0;
|
||||
(buffer->input_undo_snap)->pos = 0;
|
||||
|
||||
if (CONFIG_INTEGER(config_look_input_undo_max) > 0)
|
||||
{
|
||||
(buffer->input_undo_snap).data = (buffer->input_buffer) ?
|
||||
(buffer->input_undo_snap)->data = (buffer->input_buffer) ?
|
||||
strdup (buffer->input_buffer) : NULL;
|
||||
(buffer->input_undo_snap).pos = buffer->input_buffer_pos;
|
||||
(buffer->input_undo_snap)->pos = buffer->input_buffer_pos;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2545,12 +2554,12 @@ gui_buffer_undo_snap (struct t_gui_buffer *buffer)
|
||||
void
|
||||
gui_buffer_undo_snap_free (struct t_gui_buffer *buffer)
|
||||
{
|
||||
if ((buffer->input_undo_snap).data)
|
||||
if ((buffer->input_undo_snap)->data)
|
||||
{
|
||||
free ((buffer->input_undo_snap).data);
|
||||
(buffer->input_undo_snap).data = NULL;
|
||||
free ((buffer->input_undo_snap)->data);
|
||||
(buffer->input_undo_snap)->data = NULL;
|
||||
}
|
||||
(buffer->input_undo_snap).pos = 0;
|
||||
(buffer->input_undo_snap)->pos = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2572,8 +2581,8 @@ gui_buffer_undo_add (struct t_gui_buffer *buffer)
|
||||
* if nothing has changed since snapshot of input buffer, then do nothing
|
||||
* (just discard snapshot)
|
||||
*/
|
||||
if ((buffer->input_undo_snap).data
|
||||
&& (strcmp (buffer->input_buffer, (buffer->input_undo_snap).data) == 0))
|
||||
if ((buffer->input_undo_snap)->data
|
||||
&& (strcmp (buffer->input_buffer, (buffer->input_undo_snap)->data) == 0))
|
||||
{
|
||||
goto end;
|
||||
}
|
||||
@@ -2598,8 +2607,8 @@ gui_buffer_undo_add (struct t_gui_buffer *buffer)
|
||||
/* if input is the same as current undo, then do not add it */
|
||||
if (buffer->ptr_input_undo
|
||||
&& (buffer->ptr_input_undo)->data
|
||||
&& (buffer->input_undo_snap).data
|
||||
&& (strcmp ((buffer->input_undo_snap).data, (buffer->ptr_input_undo)->data) == 0))
|
||||
&& (buffer->input_undo_snap)->data
|
||||
&& (strcmp ((buffer->input_undo_snap)->data, (buffer->ptr_input_undo)->data) == 0))
|
||||
{
|
||||
goto end;
|
||||
}
|
||||
@@ -2608,10 +2617,10 @@ gui_buffer_undo_add (struct t_gui_buffer *buffer)
|
||||
if (!new_undo)
|
||||
goto end;
|
||||
|
||||
if ((buffer->input_undo_snap).data)
|
||||
if ((buffer->input_undo_snap)->data)
|
||||
{
|
||||
new_undo->data = strdup ((buffer->input_undo_snap).data);
|
||||
new_undo->pos = (buffer->input_undo_snap).pos;
|
||||
new_undo->data = strdup ((buffer->input_undo_snap)->data);
|
||||
new_undo->pos = (buffer->input_undo_snap)->pos;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2873,6 +2882,148 @@ gui_buffer_visited_get_index_next ()
|
||||
return gui_buffers_visited_index + 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_buffer_hdata_buffer_cb: return hdata for buffer
|
||||
*/
|
||||
|
||||
struct t_hdata *
|
||||
gui_buffer_hdata_buffer_cb (void *data, const char *hdata_name)
|
||||
{
|
||||
struct t_hdata *hdata;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
|
||||
if (gui_buffer_hdata_buffer)
|
||||
return gui_buffer_hdata_buffer;
|
||||
|
||||
hdata = hdata_new (hdata_name, "prev_buffer", "next_buffer");
|
||||
if (hdata)
|
||||
{
|
||||
gui_buffer_hdata_buffer = hdata;
|
||||
HDATA_VAR(struct t_gui_buffer, plugin, POINTER);
|
||||
HDATA_VAR(struct t_gui_buffer, plugin_name_for_upgrade, STRING);
|
||||
HDATA_VAR(struct t_gui_buffer, merge_for_upgrade, POINTER);
|
||||
HDATA_VAR(struct t_gui_buffer, number, INTEGER);
|
||||
HDATA_VAR(struct t_gui_buffer, layout_number, INTEGER);
|
||||
HDATA_VAR(struct t_gui_buffer, layout_applied, INTEGER);
|
||||
HDATA_VAR(struct t_gui_buffer, name, STRING);
|
||||
HDATA_VAR(struct t_gui_buffer, short_name, STRING);
|
||||
HDATA_VAR(struct t_gui_buffer, type, INTEGER);
|
||||
HDATA_VAR(struct t_gui_buffer, notify, INTEGER);
|
||||
HDATA_VAR(struct t_gui_buffer, num_displayed, INTEGER);
|
||||
HDATA_VAR(struct t_gui_buffer, active, INTEGER);
|
||||
HDATA_VAR(struct t_gui_buffer, print_hooks_enabled, INTEGER);
|
||||
HDATA_VAR(struct t_gui_buffer, close_callback, POINTER);
|
||||
HDATA_VAR(struct t_gui_buffer, close_callback_data, POINTER);
|
||||
HDATA_VAR(struct t_gui_buffer, title, STRING);
|
||||
HDATA_VAR(struct t_gui_buffer, own_lines, POINTER);
|
||||
HDATA_VAR(struct t_gui_buffer, mixed_lines, POINTER);
|
||||
HDATA_VAR(struct t_gui_buffer, lines, POINTER);
|
||||
HDATA_VAR(struct t_gui_buffer, time_for_each_line, INTEGER);
|
||||
HDATA_VAR(struct t_gui_buffer, chat_refresh_needed, INTEGER);
|
||||
HDATA_VAR(struct t_gui_buffer, nicklist, INTEGER);
|
||||
HDATA_VAR(struct t_gui_buffer, nicklist_case_sensitive, INTEGER);
|
||||
HDATA_VAR(struct t_gui_buffer, nicklist_root, POINTER);
|
||||
HDATA_VAR(struct t_gui_buffer, nicklist_max_length, INTEGER);
|
||||
HDATA_VAR(struct t_gui_buffer, nicklist_display_groups, INTEGER);
|
||||
HDATA_VAR(struct t_gui_buffer, nicklist_visible_count, INTEGER);
|
||||
HDATA_VAR(struct t_gui_buffer, input, INTEGER);
|
||||
HDATA_VAR(struct t_gui_buffer, input_callback, POINTER);
|
||||
HDATA_VAR(struct t_gui_buffer, input_callback_data, POINTER);
|
||||
HDATA_VAR(struct t_gui_buffer, input_get_unknown_commands, INTEGER);
|
||||
HDATA_VAR(struct t_gui_buffer, input_buffer, STRING);
|
||||
HDATA_VAR(struct t_gui_buffer, input_buffer_alloc, INTEGER);
|
||||
HDATA_VAR(struct t_gui_buffer, input_buffer_size, INTEGER);
|
||||
HDATA_VAR(struct t_gui_buffer, input_buffer_length, INTEGER);
|
||||
HDATA_VAR(struct t_gui_buffer, input_buffer_pos, INTEGER);
|
||||
HDATA_VAR(struct t_gui_buffer, input_buffer_1st_display, INTEGER);
|
||||
HDATA_VAR(struct t_gui_buffer, input_undo_snap, POINTER);
|
||||
HDATA_VAR(struct t_gui_buffer, input_undo, POINTER);
|
||||
HDATA_VAR(struct t_gui_buffer, last_input_undo, POINTER);
|
||||
HDATA_VAR(struct t_gui_buffer, ptr_input_undo, POINTER);
|
||||
HDATA_VAR(struct t_gui_buffer, input_undo_count, INTEGER);
|
||||
HDATA_VAR(struct t_gui_buffer, completion, POINTER);
|
||||
HDATA_VAR(struct t_gui_buffer, history, POINTER);
|
||||
HDATA_VAR(struct t_gui_buffer, last_history, POINTER);
|
||||
HDATA_VAR(struct t_gui_buffer, ptr_history, POINTER);
|
||||
HDATA_VAR(struct t_gui_buffer, num_history, INTEGER);
|
||||
HDATA_VAR(struct t_gui_buffer, text_search, INTEGER);
|
||||
HDATA_VAR(struct t_gui_buffer, text_search_exact, INTEGER);
|
||||
HDATA_VAR(struct t_gui_buffer, text_search_found, INTEGER);
|
||||
HDATA_VAR(struct t_gui_buffer, text_search_input, STRING);
|
||||
HDATA_VAR(struct t_gui_buffer, highlight_words, STRING);
|
||||
HDATA_VAR(struct t_gui_buffer, highlight_tags, STRING);
|
||||
HDATA_VAR(struct t_gui_buffer, highlight_tags_count, INTEGER);
|
||||
HDATA_VAR(struct t_gui_buffer, highlight_tags_array, POINTER);
|
||||
HDATA_VAR(struct t_gui_buffer, hotlist_max_level_nicks, POINTER);
|
||||
HDATA_VAR(struct t_gui_buffer, keys, POINTER);
|
||||
HDATA_VAR(struct t_gui_buffer, last_key, POINTER);
|
||||
HDATA_VAR(struct t_gui_buffer, keys_count, INTEGER);
|
||||
HDATA_VAR(struct t_gui_buffer, local_variables, POINTER);
|
||||
HDATA_VAR(struct t_gui_buffer, prev_buffer, POINTER);
|
||||
HDATA_VAR(struct t_gui_buffer, next_buffer, POINTER);
|
||||
HDATA_LIST(gui_buffers);
|
||||
HDATA_LIST(last_gui_buffer);
|
||||
}
|
||||
return gui_buffer_hdata_buffer;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_buffer_hdata_input_undo_cb: return hdata for input undo
|
||||
*/
|
||||
|
||||
struct t_hdata *
|
||||
gui_buffer_hdata_input_undo_cb (void *data, const char *hdata_name)
|
||||
{
|
||||
struct t_hdata *hdata;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
|
||||
if (gui_buffer_hdata_input_undo)
|
||||
return gui_buffer_hdata_input_undo;
|
||||
|
||||
hdata = hdata_new (hdata_name, "prev_undo", "next_undo");
|
||||
if (hdata)
|
||||
{
|
||||
gui_buffer_hdata_input_undo = hdata;
|
||||
HDATA_VAR(struct t_gui_input_undo, data, STRING);
|
||||
HDATA_VAR(struct t_gui_input_undo, pos, INTEGER);
|
||||
HDATA_VAR(struct t_gui_input_undo, prev_undo, POINTER);
|
||||
HDATA_VAR(struct t_gui_input_undo, next_undo, POINTER);
|
||||
}
|
||||
return gui_buffer_hdata_input_undo;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_buffer_hdata_buffer_visited_cb: return hdata for buffer visited
|
||||
*/
|
||||
|
||||
struct t_hdata *
|
||||
gui_buffer_hdata_buffer_visited_cb (void *data, const char *hdata_name)
|
||||
{
|
||||
struct t_hdata *hdata;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
|
||||
if (gui_buffer_hdata_buffer_visited)
|
||||
return gui_buffer_hdata_buffer_visited;
|
||||
|
||||
hdata = hdata_new (hdata_name, "prev_buffer", "next_buffer");
|
||||
if (hdata)
|
||||
{
|
||||
gui_buffer_hdata_buffer_visited = hdata;
|
||||
HDATA_VAR(struct t_gui_buffer_visited, buffer, POINTER);
|
||||
HDATA_VAR(struct t_gui_buffer_visited, prev_buffer, POINTER);
|
||||
HDATA_VAR(struct t_gui_buffer_visited, next_buffer, POINTER);
|
||||
HDATA_LIST(gui_buffers_visited);
|
||||
HDATA_LIST(last_gui_buffer_visited);
|
||||
}
|
||||
return gui_buffer_hdata_buffer_visited;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_buffer_add_to_infolist: add a buffer in an infolist
|
||||
* return 1 if ok, 0 if error
|
||||
@@ -3118,8 +3269,8 @@ gui_buffer_print_log ()
|
||||
log_printf (" input_buffer_length. . : %d", ptr_buffer->input_buffer_length);
|
||||
log_printf (" input_buffer_pos . . . : %d", ptr_buffer->input_buffer_pos);
|
||||
log_printf (" input_buffer_1st_disp. : %d", ptr_buffer->input_buffer_1st_display);
|
||||
log_printf (" input_undo_snap.data . : '%s'", (ptr_buffer->input_undo_snap).data);
|
||||
log_printf (" input_undo_snap.pos. . : %d", (ptr_buffer->input_undo_snap).pos);
|
||||
log_printf (" input_undo_snap->data. : '%s'", (ptr_buffer->input_undo_snap)->data);
|
||||
log_printf (" input_undo_snap->pos . : %d", (ptr_buffer->input_undo_snap)->pos);
|
||||
log_printf (" input_undo . . . . . . : 0x%lx", ptr_buffer->input_undo);
|
||||
log_printf (" last_input_undo. . . . : 0x%lx", ptr_buffer->last_input_undo);
|
||||
log_printf (" ptr_input_undo . . . . : 0x%lx", ptr_buffer->ptr_input_undo);
|
||||
|
||||
@@ -137,7 +137,7 @@ struct t_gui_buffer
|
||||
int input_buffer_1st_display; /* first char displayed on screen */
|
||||
|
||||
/* undo/redo for input */
|
||||
struct t_gui_input_undo input_undo_snap; /* snapshot of input buffer */
|
||||
struct t_gui_input_undo *input_undo_snap; /* snapshot of input buffer */
|
||||
struct t_gui_input_undo *input_undo; /* undo for input */
|
||||
struct t_gui_input_undo *last_input_undo; /* last undo for input */
|
||||
struct t_gui_input_undo *ptr_input_undo; /* pointer to current undo */
|
||||
@@ -284,6 +284,10 @@ extern void gui_buffer_visited_remove_by_buffer (struct t_gui_buffer *buffer);
|
||||
extern struct t_gui_buffer_visited *gui_buffer_visited_add (struct t_gui_buffer *buffer);
|
||||
extern int gui_buffer_visited_get_index_previous ();
|
||||
extern int gui_buffer_visited_get_index_next ();
|
||||
extern struct t_hdata *gui_buffer_hdata_buffer_cb (void *data,
|
||||
const char *hdata_name);
|
||||
extern struct t_hdata *gui_buffer_hdata_input_undo_cb (void *data,
|
||||
const char *hdata_name);
|
||||
extern int gui_buffer_add_to_infolist (struct t_infolist *infolist,
|
||||
struct t_gui_buffer *buffer);
|
||||
extern void gui_buffer_dump_hexa (struct t_gui_buffer *buffer);
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
#include <sys/stat.h>
|
||||
@@ -37,6 +38,7 @@
|
||||
#include "../core/weechat.h"
|
||||
#include "../core/wee-completion.h"
|
||||
#include "../core/wee-config.h"
|
||||
#include "../core/wee-hdata.h"
|
||||
#include "../core/wee-hook.h"
|
||||
#include "../core/wee-list.h"
|
||||
#include "../core/wee-log.h"
|
||||
@@ -46,6 +48,10 @@
|
||||
#include "gui-completion.h"
|
||||
|
||||
|
||||
struct t_hdata *gui_completion_hdata_completion = NULL;
|
||||
struct t_hdata *gui_completion_hdata_completion_partial = NULL;
|
||||
|
||||
|
||||
/*
|
||||
* gui_completion_buffer_init: init completion for a buffer
|
||||
*/
|
||||
@@ -1181,6 +1187,76 @@ gui_completion_get_string (struct t_gui_completion *completion,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_completion_hdata_completion_cb: return hdata for completion
|
||||
*/
|
||||
|
||||
struct t_hdata *
|
||||
gui_completion_hdata_completion_cb (void *data, const char *hdata_name)
|
||||
{
|
||||
struct t_hdata *hdata;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
|
||||
if (gui_completion_hdata_completion)
|
||||
return gui_completion_hdata_completion;
|
||||
|
||||
hdata = hdata_new (hdata_name, NULL, NULL);
|
||||
if (hdata)
|
||||
{
|
||||
gui_completion_hdata_completion = hdata;
|
||||
HDATA_VAR(struct t_gui_completion, buffer, POINTER);
|
||||
HDATA_VAR(struct t_gui_completion, context, INTEGER);
|
||||
HDATA_VAR(struct t_gui_completion, base_command, STRING);
|
||||
HDATA_VAR(struct t_gui_completion, base_command_arg_index, INTEGER);
|
||||
HDATA_VAR(struct t_gui_completion, base_word, STRING);
|
||||
HDATA_VAR(struct t_gui_completion, base_word_pos, INTEGER);
|
||||
HDATA_VAR(struct t_gui_completion, position, INTEGER);
|
||||
HDATA_VAR(struct t_gui_completion, args, STRING);
|
||||
HDATA_VAR(struct t_gui_completion, direction, INTEGER);
|
||||
HDATA_VAR(struct t_gui_completion, add_space, INTEGER);
|
||||
HDATA_VAR(struct t_gui_completion, force_partial_completion, INTEGER);
|
||||
HDATA_VAR(struct t_gui_completion, completion_list, POINTER);
|
||||
HDATA_VAR(struct t_gui_completion, word_found, STRING);
|
||||
HDATA_VAR(struct t_gui_completion, word_found_is_nick, INTEGER);
|
||||
HDATA_VAR(struct t_gui_completion, position_replace, INTEGER);
|
||||
HDATA_VAR(struct t_gui_completion, diff_size, INTEGER);
|
||||
HDATA_VAR(struct t_gui_completion, diff_length, INTEGER);
|
||||
HDATA_VAR(struct t_gui_completion, partial_completion_list, POINTER);
|
||||
HDATA_VAR(struct t_gui_completion, last_partial_completion, POINTER);
|
||||
}
|
||||
return gui_completion_hdata_completion;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_completion_hdata_completion_partial_cb: return hdata for partial
|
||||
* completion
|
||||
*/
|
||||
|
||||
struct t_hdata *
|
||||
gui_completion_hdata_completion_partial_cb (void *data, const char *hdata_name)
|
||||
{
|
||||
struct t_hdata *hdata;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
|
||||
if (gui_completion_hdata_completion_partial)
|
||||
return gui_completion_hdata_completion_partial;
|
||||
|
||||
hdata = hdata_new (hdata_name, "prev_item", "next_item");
|
||||
if (hdata)
|
||||
{
|
||||
gui_completion_hdata_completion_partial = hdata;
|
||||
HDATA_VAR(struct t_gui_completion_partial, word, STRING);
|
||||
HDATA_VAR(struct t_gui_completion_partial, count, INTEGER);
|
||||
HDATA_VAR(struct t_gui_completion_partial, prev_item, POINTER);
|
||||
HDATA_VAR(struct t_gui_completion_partial, next_item, POINTER);
|
||||
}
|
||||
return gui_completion_hdata_completion_partial;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_completion_print_log: print completion list in log (usually for crash dump)
|
||||
*/
|
||||
|
||||
@@ -78,6 +78,10 @@ extern void gui_completion_search (struct t_gui_completion *completion,
|
||||
int pos);
|
||||
extern const char *gui_completion_get_string (struct t_gui_completion *completion,
|
||||
const char *property);
|
||||
extern struct t_hdata *gui_completion_hdata_completion_cb (void *data,
|
||||
const char *hdata_name);
|
||||
extern struct t_hdata *gui_completion_hdata_completion_partial_cb (void *data,
|
||||
const char *hdata_name);
|
||||
extern void gui_completion_print_log (struct t_gui_completion *completion);
|
||||
|
||||
#endif /* __WEECHAT_GUI_COMPLETION_H */
|
||||
|
||||
@@ -26,11 +26,13 @@
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include <regex.h>
|
||||
|
||||
#include "../core/weechat.h"
|
||||
#include "../core/wee-config.h"
|
||||
#include "../core/wee-hdata.h"
|
||||
#include "../core/wee-hook.h"
|
||||
#include "../core/wee-infolist.h"
|
||||
#include "../core/wee-log.h"
|
||||
@@ -45,6 +47,8 @@ struct t_gui_filter *gui_filters = NULL; /* first filter */
|
||||
struct t_gui_filter *last_gui_filter = NULL; /* last filter */
|
||||
int gui_filters_enabled = 1; /* filters enabled? */
|
||||
|
||||
struct t_hdata *gui_filter_hdata_filter = NULL;
|
||||
|
||||
|
||||
/*
|
||||
* gui_filter_line_has_tag_no_filter: return 1 if line has tag "no_filter",
|
||||
@@ -473,6 +477,44 @@ gui_filter_free_all ()
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_filter_hdata_filter_cb: return hdata for filter
|
||||
*/
|
||||
|
||||
struct t_hdata *
|
||||
gui_filter_hdata_filter_cb (void *data, const char *hdata_name)
|
||||
{
|
||||
struct t_hdata *hdata;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
|
||||
if (gui_filter_hdata_filter)
|
||||
return gui_filter_hdata_filter;
|
||||
|
||||
hdata = hdata_new (hdata_name, "prev_filter", "next_filter");
|
||||
if (hdata)
|
||||
{
|
||||
gui_filter_hdata_filter = hdata;
|
||||
HDATA_VAR(struct t_gui_filter, enabled, INTEGER);
|
||||
HDATA_VAR(struct t_gui_filter, name, STRING);
|
||||
HDATA_VAR(struct t_gui_filter, buffer_name, STRING);
|
||||
HDATA_VAR(struct t_gui_filter, num_buffers, INTEGER);
|
||||
HDATA_VAR(struct t_gui_filter, buffers, POINTER);
|
||||
HDATA_VAR(struct t_gui_filter, tags, STRING);
|
||||
HDATA_VAR(struct t_gui_filter, tags_count, INTEGER);
|
||||
HDATA_VAR(struct t_gui_filter, tags_array, POINTER);
|
||||
HDATA_VAR(struct t_gui_filter, regex, STRING);
|
||||
HDATA_VAR(struct t_gui_filter, regex_prefix, POINTER);
|
||||
HDATA_VAR(struct t_gui_filter, regex_message, POINTER);
|
||||
HDATA_VAR(struct t_gui_filter, prev_filter, POINTER);
|
||||
HDATA_VAR(struct t_gui_filter, next_filter, POINTER);
|
||||
HDATA_LIST(gui_filters);
|
||||
HDATA_LIST(last_gui_filter);
|
||||
}
|
||||
return gui_filter_hdata_filter;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_filter_add_to_infolist: add a filter in an infolist
|
||||
* return 1 if ok, 0 if error
|
||||
|
||||
@@ -69,6 +69,8 @@ extern int gui_filter_rename (struct t_gui_filter *filter,
|
||||
const char *new_name);
|
||||
extern void gui_filter_free (struct t_gui_filter *filter);
|
||||
extern void gui_filter_free_all ();
|
||||
extern struct t_hdata *gui_filter_hdata_filter_cb (void *data,
|
||||
const char *hdata_name);
|
||||
extern int gui_filter_add_to_infolist (struct t_infolist *infolist,
|
||||
struct t_gui_filter *filter);
|
||||
extern void gui_filter_print_log ();
|
||||
|
||||
@@ -27,13 +27,16 @@
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../core/weechat.h"
|
||||
#include "../core/wee-config.h"
|
||||
#include "../core/wee-hdata.h"
|
||||
#include "../core/wee-hook.h"
|
||||
#include "../core/wee-infolist.h"
|
||||
#include "../core/wee-string.h"
|
||||
#include "../plugins/plugin.h"
|
||||
#include "gui-history.h"
|
||||
#include "gui-buffer.h"
|
||||
|
||||
@@ -43,6 +46,8 @@ struct t_gui_history *last_history_global = NULL;
|
||||
struct t_gui_history *history_global_ptr = NULL;
|
||||
int num_history_global = 0;
|
||||
|
||||
struct t_hdata *gui_history_hdata_history = NULL;
|
||||
|
||||
|
||||
/*
|
||||
* gui_history_buffer_add: add a text/command to buffer's history
|
||||
@@ -212,6 +217,32 @@ gui_history_buffer_free (struct t_gui_buffer *buffer)
|
||||
buffer->num_history = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_history_hdata_history_cb: return hdata for history
|
||||
*/
|
||||
|
||||
struct t_hdata *
|
||||
gui_history_hdata_history_cb (void *data, const char *hdata_name)
|
||||
{
|
||||
struct t_hdata *hdata;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
|
||||
if (gui_history_hdata_history)
|
||||
return gui_history_hdata_history;
|
||||
|
||||
hdata = hdata_new (hdata_name, "prev_history", "next_history");
|
||||
if (hdata)
|
||||
{
|
||||
gui_history_hdata_history = hdata;
|
||||
HDATA_VAR(struct t_gui_history, text, STRING);
|
||||
HDATA_VAR(struct t_gui_history, prev_history, POINTER);
|
||||
HDATA_VAR(struct t_gui_history, next_history, POINTER);
|
||||
}
|
||||
return gui_history_hdata_history;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_history_add_to_infolist: add history of commands in an infolist
|
||||
* if buffer is NULL, global history is returned
|
||||
|
||||
@@ -39,6 +39,8 @@ extern void gui_history_global_add (const char *string);
|
||||
extern void gui_history_add (struct t_gui_buffer *buffer, const char *string);
|
||||
extern void gui_history_global_free ();
|
||||
extern void gui_history_buffer_free (struct t_gui_buffer *buffer);
|
||||
extern struct t_hdata *gui_history_hdata_history_cb (void *data,
|
||||
const char *hdata_name);
|
||||
extern int gui_history_add_to_infolist (struct t_infolist *infolist,
|
||||
struct t_gui_history *history);
|
||||
|
||||
|
||||
+4
-4
@@ -275,14 +275,14 @@ gui_input_move_to_buffer (struct t_gui_buffer *from_buffer,
|
||||
|
||||
/* move undo data */
|
||||
gui_buffer_undo_free_all (to_buffer);
|
||||
(to_buffer->input_undo_snap).data = (from_buffer->input_undo_snap).data;
|
||||
(to_buffer->input_undo_snap).pos = (from_buffer->input_undo_snap).pos;
|
||||
(to_buffer->input_undo_snap)->data = (from_buffer->input_undo_snap)->data;
|
||||
(to_buffer->input_undo_snap)->pos = (from_buffer->input_undo_snap)->pos;
|
||||
to_buffer->input_undo = from_buffer->input_undo;
|
||||
to_buffer->last_input_undo = from_buffer->last_input_undo;
|
||||
to_buffer->ptr_input_undo = from_buffer->ptr_input_undo;
|
||||
to_buffer->input_undo_count = from_buffer->input_undo_count;
|
||||
(from_buffer->input_undo_snap).data = NULL;
|
||||
(from_buffer->input_undo_snap).pos = 0;
|
||||
(from_buffer->input_undo_snap)->data = NULL;
|
||||
(from_buffer->input_undo_snap)->pos = 0;
|
||||
from_buffer->input_undo = NULL;
|
||||
from_buffer->last_input_undo = NULL;
|
||||
from_buffer->ptr_input_undo = NULL;
|
||||
|
||||
@@ -26,11 +26,13 @@
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "../core/weechat.h"
|
||||
#include "../core/wee-hdata.h"
|
||||
#include "../core/wee-hook.h"
|
||||
#include "../core/wee-infolist.h"
|
||||
#include "../core/wee-input.h"
|
||||
@@ -72,6 +74,8 @@ int gui_keyboard_paste_lines = 0; /* number of lines for pending paste */
|
||||
|
||||
time_t gui_keyboard_last_activity_time = 0; /* last activity time (key) */
|
||||
|
||||
struct t_hdata *gui_keyboard_hdata_key = NULL;
|
||||
|
||||
|
||||
/*
|
||||
* gui_keyboard_init: init keyboard
|
||||
@@ -745,6 +749,37 @@ gui_keyboard_end ()
|
||||
&gui_default_keys_count);
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_keyboard_hdata_key_cb: return hdata for key
|
||||
*/
|
||||
|
||||
struct t_hdata *
|
||||
gui_keyboard_hdata_key_cb (void *data, const char *hdata_name)
|
||||
{
|
||||
struct t_hdata *hdata;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
|
||||
if (gui_keyboard_hdata_key)
|
||||
return gui_keyboard_hdata_key;
|
||||
|
||||
hdata = hdata_new (hdata_name, "prev_key", "next_key");
|
||||
if (hdata)
|
||||
{
|
||||
gui_keyboard_hdata_key = hdata;
|
||||
HDATA_VAR(struct t_gui_key, key, STRING);
|
||||
HDATA_VAR(struct t_gui_key, command, STRING);
|
||||
HDATA_VAR(struct t_gui_key, prev_key, POINTER);
|
||||
HDATA_VAR(struct t_gui_key, next_key, POINTER);
|
||||
HDATA_LIST(gui_keys);
|
||||
HDATA_LIST(last_gui_key);
|
||||
HDATA_LIST(gui_default_keys);
|
||||
HDATA_LIST(last_gui_default_key);
|
||||
}
|
||||
return gui_keyboard_hdata_key;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_keyboard_add_to_infolist: add a key in an infolist
|
||||
* return 1 if ok, 0 if error
|
||||
|
||||
@@ -80,6 +80,8 @@ extern int gui_keyboard_get_paste_lines ();
|
||||
extern void gui_keyboard_paste_accept ();
|
||||
extern void gui_keyboard_paste_cancel ();
|
||||
extern void gui_keyboard_end ();
|
||||
extern struct t_hdata *gui_keyboard_hdata_key_cb (void *data,
|
||||
const char *hdata_name);
|
||||
extern int gui_keyboard_add_to_infolist (struct t_infolist *infolist,
|
||||
struct t_gui_key *key);
|
||||
extern void gui_keyboard_print_log (struct t_gui_buffer *buffer);
|
||||
|
||||
@@ -26,11 +26,13 @@
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../core/weechat.h"
|
||||
#include "../core/wee-config.h"
|
||||
#include "../core/wee-hashtable.h"
|
||||
#include "../core/wee-hdata.h"
|
||||
#include "../core/wee-hook.h"
|
||||
#include "../core/wee-infolist.h"
|
||||
#include "../core/wee-log.h"
|
||||
@@ -45,6 +47,11 @@
|
||||
#include "gui-window.h"
|
||||
|
||||
|
||||
struct t_hdata *gui_line_hdata_lines = NULL;
|
||||
struct t_hdata *gui_line_hdata_line = NULL;
|
||||
struct t_hdata *gui_line_hdata_line_data = NULL;
|
||||
|
||||
|
||||
/*
|
||||
* gui_lines_alloc: alloc structure "t_gui_lines" and initialize it
|
||||
*/
|
||||
@@ -1132,6 +1139,99 @@ gui_line_mix_buffers (struct t_gui_buffer *buffer)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_line_hdata_lines_cb: return hdata for lines
|
||||
*/
|
||||
|
||||
struct t_hdata *
|
||||
gui_line_hdata_lines_cb (void *data, const char *hdata_name)
|
||||
{
|
||||
struct t_hdata *hdata;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
|
||||
if (gui_line_hdata_lines)
|
||||
return gui_line_hdata_lines;
|
||||
|
||||
hdata = hdata_new (hdata_name, NULL, NULL);
|
||||
if (hdata)
|
||||
{
|
||||
gui_line_hdata_lines = hdata;
|
||||
HDATA_VAR(struct t_gui_lines, first_line, POINTER);
|
||||
HDATA_VAR(struct t_gui_lines, last_line, POINTER);
|
||||
HDATA_VAR(struct t_gui_lines, last_read_line, POINTER);
|
||||
HDATA_VAR(struct t_gui_lines, lines_count, INTEGER);
|
||||
HDATA_VAR(struct t_gui_lines, first_line_not_read, INTEGER);
|
||||
HDATA_VAR(struct t_gui_lines, lines_hidden, INTEGER);
|
||||
HDATA_VAR(struct t_gui_lines, buffer_max_length, INTEGER);
|
||||
HDATA_VAR(struct t_gui_lines, prefix_max_length, INTEGER);
|
||||
}
|
||||
return gui_line_hdata_lines;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_line_hdata_line_cb: return hdata for line
|
||||
*/
|
||||
|
||||
struct t_hdata *
|
||||
gui_line_hdata_line_cb (void *data, const char *hdata_name)
|
||||
{
|
||||
struct t_hdata *hdata;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
|
||||
if (gui_line_hdata_line)
|
||||
return gui_line_hdata_line;
|
||||
|
||||
hdata = hdata_new (hdata_name, "prev_line", "next_line");
|
||||
if (hdata)
|
||||
{
|
||||
gui_line_hdata_line = hdata;
|
||||
HDATA_VAR(struct t_gui_line, data, POINTER);
|
||||
HDATA_VAR(struct t_gui_line, prev_line, POINTER);
|
||||
HDATA_VAR(struct t_gui_line, next_line, POINTER);
|
||||
}
|
||||
return gui_line_hdata_line;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_line_hdata_line_data_cb: return hdata for line data
|
||||
*/
|
||||
|
||||
struct t_hdata *
|
||||
gui_line_hdata_line_data_cb (void *data, const char *hdata_name)
|
||||
{
|
||||
struct t_hdata *hdata;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
|
||||
if (gui_line_hdata_line_data)
|
||||
return gui_line_hdata_line_data;
|
||||
|
||||
hdata = hdata_new (hdata_name, NULL, NULL);
|
||||
if (hdata)
|
||||
{
|
||||
gui_line_hdata_line_data = hdata;
|
||||
HDATA_VAR(struct t_gui_line_data, buffer, POINTER);
|
||||
HDATA_VAR(struct t_gui_line_data, y, INTEGER);
|
||||
HDATA_VAR(struct t_gui_line_data, date, TIME);
|
||||
HDATA_VAR(struct t_gui_line_data, date_printed, TIME);
|
||||
HDATA_VAR(struct t_gui_line_data, str_time, STRING);
|
||||
HDATA_VAR(struct t_gui_line_data, tags_count, INTEGER);
|
||||
HDATA_VAR(struct t_gui_line_data, tags_array, POINTER);
|
||||
HDATA_VAR(struct t_gui_line_data, displayed, INTEGER);
|
||||
HDATA_VAR(struct t_gui_line_data, highlight, INTEGER);
|
||||
HDATA_VAR(struct t_gui_line_data, refresh_needed, INTEGER);
|
||||
HDATA_VAR(struct t_gui_line_data, prefix, STRING);
|
||||
HDATA_VAR(struct t_gui_line_data, prefix_length, INTEGER);
|
||||
HDATA_VAR(struct t_gui_line_data, message, STRING);
|
||||
}
|
||||
return gui_line_hdata_line_data;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_buffer_line_add_to_infolist: add a buffer line in an infolist
|
||||
* return 1 if ok, 0 if error
|
||||
|
||||
@@ -102,6 +102,12 @@ extern void gui_line_add_y (struct t_gui_buffer *buffer, int y,
|
||||
const char *message);
|
||||
extern void gui_line_clear (struct t_gui_line *line);
|
||||
extern void gui_line_mix_buffers (struct t_gui_buffer *buffer);
|
||||
extern struct t_hdata *gui_line_hdata_lines_cb (void *data,
|
||||
const char *hdata_name);
|
||||
extern struct t_hdata *gui_line_hdata_line_cb (void *data,
|
||||
const char *hdata_name);
|
||||
extern struct t_hdata *gui_line_hdata_line_data_cb (void *data,
|
||||
const char *hdata_name);
|
||||
extern int gui_line_add_to_infolist (struct t_infolist *infolist,
|
||||
struct t_gui_lines *lines,
|
||||
struct t_gui_line *line);
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <unistd.h>
|
||||
@@ -35,6 +36,7 @@
|
||||
#include <ctype.h>
|
||||
|
||||
#include "../core/weechat.h"
|
||||
#include "../core/wee-hdata.h"
|
||||
#include "../core/wee-hook.h"
|
||||
#include "../core/wee-infolist.h"
|
||||
#include "../core/wee-log.h"
|
||||
@@ -46,6 +48,10 @@
|
||||
#include "gui-color.h"
|
||||
|
||||
|
||||
struct t_hdata *gui_nicklist_hdata_nick_group = NULL;
|
||||
struct t_hdata *gui_nicklist_hdata_nick = NULL;
|
||||
|
||||
|
||||
/*
|
||||
* gui_nicklist_send_signal: send a signal when something has changed in
|
||||
* nicklist
|
||||
@@ -939,6 +945,71 @@ gui_nicklist_nick_set (struct t_gui_buffer *buffer,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_nicklist_hdata_nick_group_cb: return hdata for nick_group
|
||||
*/
|
||||
|
||||
struct t_hdata *
|
||||
gui_nicklist_hdata_nick_group_cb (void *data, const char *hdata_name)
|
||||
{
|
||||
struct t_hdata *hdata;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
|
||||
if (gui_nicklist_hdata_nick_group)
|
||||
return gui_nicklist_hdata_nick_group;
|
||||
|
||||
hdata = hdata_new (hdata_name, "prev_group", "next_group");
|
||||
if (hdata)
|
||||
{
|
||||
gui_nicklist_hdata_nick_group = hdata;
|
||||
HDATA_VAR(struct t_gui_nick_group, name, STRING);
|
||||
HDATA_VAR(struct t_gui_nick_group, color, STRING);
|
||||
HDATA_VAR(struct t_gui_nick_group, visible, INTEGER);
|
||||
HDATA_VAR(struct t_gui_nick_group, level, INTEGER);
|
||||
HDATA_VAR(struct t_gui_nick_group, parent, POINTER);
|
||||
HDATA_VAR(struct t_gui_nick_group, childs, POINTER);
|
||||
HDATA_VAR(struct t_gui_nick_group, last_child, POINTER);
|
||||
HDATA_VAR(struct t_gui_nick_group, nicks, POINTER);
|
||||
HDATA_VAR(struct t_gui_nick_group, last_nick, POINTER);
|
||||
HDATA_VAR(struct t_gui_nick_group, prev_group, POINTER);
|
||||
HDATA_VAR(struct t_gui_nick_group, next_group, POINTER);
|
||||
}
|
||||
return gui_nicklist_hdata_nick_group;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_nicklist_hdata_nick_cb: return hdata for nick
|
||||
*/
|
||||
|
||||
struct t_hdata *
|
||||
gui_nicklist_hdata_nick_cb (void *data, const char *hdata_name)
|
||||
{
|
||||
struct t_hdata *hdata;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
|
||||
if (gui_nicklist_hdata_nick)
|
||||
return gui_nicklist_hdata_nick;
|
||||
|
||||
hdata = hdata_new (hdata_name, "prev_nick", "next_nick");
|
||||
if (hdata)
|
||||
{
|
||||
gui_nicklist_hdata_nick = hdata;
|
||||
HDATA_VAR(struct t_gui_nick, group, POINTER);
|
||||
HDATA_VAR(struct t_gui_nick, name, STRING);
|
||||
HDATA_VAR(struct t_gui_nick, color, STRING);
|
||||
HDATA_VAR(struct t_gui_nick, prefix, STRING);
|
||||
HDATA_VAR(struct t_gui_nick, prefix_color, STRING);
|
||||
HDATA_VAR(struct t_gui_nick, visible, INTEGER);
|
||||
HDATA_VAR(struct t_gui_nick, prev_nick, POINTER);
|
||||
HDATA_VAR(struct t_gui_nick, next_nick, POINTER);
|
||||
}
|
||||
return gui_nicklist_hdata_nick;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_nicklist_add_group_to_infolist: add a group in an infolist
|
||||
* return 1 if ok, 0 if error
|
||||
|
||||
@@ -108,6 +108,10 @@ extern void *gui_nicklist_nick_get_pointer (struct t_gui_buffer *buffer,
|
||||
extern void gui_nicklist_nick_set (struct t_gui_buffer *buffer,
|
||||
struct t_gui_nick *nick,
|
||||
const char *property, const char *value);
|
||||
extern struct t_hdata *gui_nicklist_hdata_nick_group_cb (void *data,
|
||||
const char *hdata_name);
|
||||
extern struct t_hdata *gui_nicklist_hdata_nick_cb (void *data,
|
||||
const char *hdata_name);
|
||||
extern int gui_nicklist_add_to_infolist (struct t_infolist *infolist,
|
||||
struct t_gui_buffer *buffer,
|
||||
const char *name);
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <unistd.h>
|
||||
@@ -36,6 +37,7 @@
|
||||
|
||||
#include "../core/weechat.h"
|
||||
#include "../core/wee-config.h"
|
||||
#include "../core/wee-hdata.h"
|
||||
#include "../core/wee-hook.h"
|
||||
#include "../core/wee-infolist.h"
|
||||
#include "../core/wee-log.h"
|
||||
@@ -69,6 +71,10 @@ struct t_gui_layout_window *gui_window_layout_before_zoom = NULL;
|
||||
int gui_window_layout_id_current_window = -1;
|
||||
/* current window id before zoom */
|
||||
|
||||
struct t_hdata *gui_window_hdata_window = NULL;
|
||||
struct t_hdata *gui_window_hdata_window_scroll = NULL;
|
||||
struct t_hdata *gui_window_hdata_window_tree = NULL;
|
||||
|
||||
|
||||
/*
|
||||
* gui_window_ask_refresh: set "gui_window_refresh_needed" flag
|
||||
@@ -1263,6 +1269,118 @@ gui_window_zoom (struct t_gui_window *window)
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_window_hdata_window_cb: return hdata for window
|
||||
*/
|
||||
|
||||
struct t_hdata *
|
||||
gui_window_hdata_window_cb (void *data, const char *hdata_name)
|
||||
{
|
||||
struct t_hdata *hdata;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
|
||||
if (gui_window_hdata_window)
|
||||
return gui_window_hdata_window;
|
||||
|
||||
hdata = hdata_new (hdata_name, "prev_window", "next_window");
|
||||
if (hdata)
|
||||
{
|
||||
gui_window_hdata_window = hdata;
|
||||
HDATA_VAR(struct t_gui_window, win_x, INTEGER);
|
||||
HDATA_VAR(struct t_gui_window, win_y, INTEGER);
|
||||
HDATA_VAR(struct t_gui_window, win_width, INTEGER);
|
||||
HDATA_VAR(struct t_gui_window, win_height, INTEGER);
|
||||
HDATA_VAR(struct t_gui_window, win_width_pct, INTEGER);
|
||||
HDATA_VAR(struct t_gui_window, win_height_pct, INTEGER);
|
||||
HDATA_VAR(struct t_gui_window, win_chat_x, INTEGER);
|
||||
HDATA_VAR(struct t_gui_window, win_chat_y, INTEGER);
|
||||
HDATA_VAR(struct t_gui_window, win_chat_width, INTEGER);
|
||||
HDATA_VAR(struct t_gui_window, win_chat_height, INTEGER);
|
||||
HDATA_VAR(struct t_gui_window, win_chat_cursor_x, INTEGER);
|
||||
HDATA_VAR(struct t_gui_window, win_chat_cursor_y, INTEGER);
|
||||
HDATA_VAR(struct t_gui_window, bar_windows, POINTER);
|
||||
HDATA_VAR(struct t_gui_window, last_bar_window, POINTER);
|
||||
HDATA_VAR(struct t_gui_window, refresh_needed, INTEGER);
|
||||
HDATA_VAR(struct t_gui_window, gui_objects, POINTER);
|
||||
HDATA_VAR(struct t_gui_window, buffer, POINTER);
|
||||
HDATA_VAR(struct t_gui_window, layout_plugin_name, STRING);
|
||||
HDATA_VAR(struct t_gui_window, layout_buffer_name, STRING);
|
||||
HDATA_VAR(struct t_gui_window, scroll, POINTER);
|
||||
HDATA_VAR(struct t_gui_window, ptr_tree, POINTER);
|
||||
HDATA_VAR(struct t_gui_window, prev_window, POINTER);
|
||||
HDATA_VAR(struct t_gui_window, next_window, POINTER);
|
||||
HDATA_LIST(gui_windows);
|
||||
HDATA_LIST(last_gui_window);
|
||||
HDATA_LIST(gui_current_window);
|
||||
}
|
||||
return gui_window_hdata_window;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_window_hdata_window_scroll_cb: return hdata for window scroll
|
||||
*/
|
||||
|
||||
struct t_hdata *
|
||||
gui_window_hdata_window_scroll_cb (void *data, const char *hdata_name)
|
||||
{
|
||||
struct t_hdata *hdata;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
|
||||
if (gui_window_hdata_window_scroll)
|
||||
return gui_window_hdata_window_scroll;
|
||||
|
||||
hdata = hdata_new (hdata_name, "prev_scroll", "next_scroll");
|
||||
if (hdata)
|
||||
{
|
||||
gui_window_hdata_window_scroll = hdata;
|
||||
HDATA_VAR(struct t_gui_window_scroll, buffer, POINTER);
|
||||
HDATA_VAR(struct t_gui_window_scroll, first_line_displayed, INTEGER);
|
||||
HDATA_VAR(struct t_gui_window_scroll, start_line, POINTER);
|
||||
HDATA_VAR(struct t_gui_window_scroll, start_line_pos, INTEGER);
|
||||
HDATA_VAR(struct t_gui_window_scroll, scrolling, INTEGER);
|
||||
HDATA_VAR(struct t_gui_window_scroll, start_col, INTEGER);
|
||||
HDATA_VAR(struct t_gui_window_scroll, lines_after, INTEGER);
|
||||
HDATA_VAR(struct t_gui_window_scroll, reset_allowed, INTEGER);
|
||||
HDATA_VAR(struct t_gui_window_scroll, prev_scroll, POINTER);
|
||||
HDATA_VAR(struct t_gui_window_scroll, next_scroll, POINTER);
|
||||
}
|
||||
return gui_window_hdata_window_scroll;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_window_hdata_window_tree_cb: return hdata for window tree
|
||||
*/
|
||||
|
||||
struct t_hdata *
|
||||
gui_window_hdata_window_tree_cb (void *data, const char *hdata_name)
|
||||
{
|
||||
struct t_hdata *hdata;
|
||||
|
||||
/* make C compiler happy */
|
||||
(void) data;
|
||||
|
||||
if (gui_window_hdata_window_tree)
|
||||
return gui_window_hdata_window_tree;
|
||||
|
||||
hdata = hdata_new (hdata_name, NULL, NULL);
|
||||
if (hdata)
|
||||
{
|
||||
gui_window_hdata_window_tree = hdata;
|
||||
HDATA_VAR(struct t_gui_window_tree, parent_node, POINTER);
|
||||
HDATA_VAR(struct t_gui_window_tree, split_pct, INTEGER);
|
||||
HDATA_VAR(struct t_gui_window_tree, split_horizontal, INTEGER);
|
||||
HDATA_VAR(struct t_gui_window_tree, child1, POINTER);
|
||||
HDATA_VAR(struct t_gui_window_tree, child2, POINTER);
|
||||
HDATA_VAR(struct t_gui_window_tree, window, POINTER);
|
||||
HDATA_LIST(gui_windows_tree);
|
||||
}
|
||||
return gui_window_hdata_window_tree;
|
||||
}
|
||||
|
||||
/*
|
||||
* gui_window_add_to_infolist: add a window in an infolist
|
||||
* return 1 if ok, 0 if error
|
||||
|
||||
@@ -155,6 +155,12 @@ extern void gui_window_search_restart (struct t_gui_window *window);
|
||||
extern void gui_window_search_stop (struct t_gui_window *window);
|
||||
extern int gui_window_search_text (struct t_gui_window *window);
|
||||
extern void gui_window_zoom (struct t_gui_window *window);
|
||||
extern struct t_hdata *gui_window_hdata_window_cb (void *data,
|
||||
const char *hdata_name);
|
||||
extern struct t_hdata *gui_window_hdata_window_scroll_cb (void *data,
|
||||
const char *hdata_name);
|
||||
extern struct t_hdata *gui_window_hdata_window_tree_cb (void *data,
|
||||
const char *hdata_name);
|
||||
extern int gui_window_add_to_infolist (struct t_infolist *infolist,
|
||||
struct t_gui_window *window);
|
||||
extern void gui_window_print_log ();
|
||||
|
||||
Reference in New Issue
Block a user