1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-28 22:06:38 +02:00

added some panel functions, fixed refresh bugs when terminal is resized: too many refreshs, display bug with splited windows

This commit is contained in:
Sebastien Helleu
2006-07-16 11:04:10 +00:00
parent c308b2ec1f
commit 4c4f5ab012
68 changed files with 4256 additions and 2996 deletions
+3 -2
View File
@@ -1,14 +1,15 @@
WeeChat - Wee Enhanced Environment for Chat
===========================================
ChangeLog - 2006-07-07
ChangeLog - 2006-07-16
Version 0.2.0 (under dev!):
* added configure option for doc XSL prefix (bug #16991)
* fixed bug with spaces in script names (bug #16957)
* fixed random crash when "MODE #chan -l" is received
* fixed bug in IRC parser (random crash with malformed IRC messages)
* fixed refresh bug (too many refresh) when terminal is resized
* fixed refresh bugs when terminal is resized: too many refreshs,
display bug with splited windows
* case ignored for channel names in charset options (bug #16858)
* fixed crash when setting look_one_server_buffer to ON (bug #16932)
* added new functions in plugin/script API: get window info,
+235 -182
View File
File diff suppressed because it is too large Load Diff
+235 -182
View File
File diff suppressed because it is too large Load Diff
+235 -182
View File
File diff suppressed because it is too large Load Diff
+243 -188
View File
File diff suppressed because it is too large Load Diff
+234 -183
View File
File diff suppressed because it is too large Load Diff
+235 -182
View File
File diff suppressed because it is too large Load Diff
+234 -188
View File
File diff suppressed because it is too large Load Diff
+2
View File
@@ -145,6 +145,8 @@ weechat_backtrace ()
#endif
weechat_backtrace_printf ("======= WeeChat backtrace =======\n");
weechat_backtrace_printf ("(written by %s, compiled on %s %s)\n",
PACKAGE_STRING, __DATE__, __TIME__);
#ifdef HAVE_BACKTRACE
trace_size = backtrace (trace, BACKTRACE_MAX);
+90 -7
View File
@@ -59,7 +59,7 @@ t_weechat_command weechat_commands[] =
N_(" action: action to do:\n"
" move: move buffer in the list (may be relative, for example -1)\n"
" close: close buffer (optional arg is part message, for a channel)\n"
" list: list opened buffers (no parameter implies this list)\n"
" list: list open buffers (no parameter implies this list)\n"
" notify: set notify level for buffer (0=never, 1=highlight, 2=1+msg, 3=2+join/part)\n"
"server\n"
"channel: jump to buffer by server and/or channel name\n"
@@ -128,6 +128,15 @@ t_weechat_command weechat_commands[] =
" reset: restore bindings to the default values and delete ALL "
"personal bindings (use carefully!)"),
"unbind|functions|reset %k", 0, MAX_ARGS, 0, NULL, weechat_cmd_key },
{ "panel", N_("manage panels"),
N_("[list | add type position size | resize # size | close # | move #1 #2]"),
N_(" list: list open panels (no parameter implies this list)\n"
" add: add a panel, type is global|local, position is top|bottom|left|right\n"
" resize: resize a panel with a new size (may be relative, for example -1)\n"
" close: close a panel by number\n"
" move: move a panel to another number (may be relative, for example -1)"),
"list|add|close|move global|local top|bottom|left|right",
0, MAX_ARGS, 0, weechat_cmd_panel, NULL },
{ "plugin", N_("list/load/unload plugins"),
N_("[load filename] | [autoload] | [reload] | [unload]"),
N_("filename: WeeChat plugin (file) to load\n\n"
@@ -195,7 +204,7 @@ t_weechat_command weechat_commands[] =
{ "window", N_("manage windows"),
N_("[list | -1 | +1 | b# | up | down | left | right | splith [pct] "
"| splitv [pct] | resize pct | merge [all]]"),
N_(" list: list opened windows (no parameter implies this list)\n"
N_(" list: list open windows (no parameter implies this list)\n"
" -1: jump to previous window\n"
" +1: jump to next window\n"
" b#: jump to next window displaying buffer number #\n"
@@ -1363,10 +1372,10 @@ weechat_cmd_buffer (t_irc_server *server, t_irc_channel *channel,
if ((argc == 0) || ((argc == 1) && (ascii_strcasecmp (argv[0], "list") == 0)))
{
/* list opened buffers */
/* list open buffers */
gui_printf (NULL, "\n");
gui_printf (NULL, _("Opened buffers:\n"));
gui_printf (NULL, _("Open buffers:\n"));
for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer)
{
@@ -1440,7 +1449,7 @@ weechat_cmd_buffer (t_irc_server *server, t_irc_channel *channel,
irc_display_prefix (NULL, NULL, PREFIX_ERROR);
gui_printf (NULL,
_("%s can not close server buffer while channels "
"are opened\n"),
"are open\n"),
WEECHAT_ERROR);
free_exploded_string (argv);
return -1;
@@ -2657,6 +2666,80 @@ weechat_cmd_key (t_irc_server *server, t_irc_channel *channel,
return 0;
}
/*
* weechat_cmd_panel_display_info: display infos about a panel
*/
void
weechat_cmd_panel_display_info (t_gui_panel *panel)
{
gui_printf (NULL, " %s%2d%s. ",
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
panel->number,
GUI_COLOR(COLOR_WIN_CHAT));
gui_printf (NULL, "%s%s%s ",
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
panel->name,
GUI_COLOR(COLOR_WIN_CHAT));
gui_printf (NULL, "(%s%s/%s",
(panel->panel_window) ? _("global") : _("local"),
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT));
switch (panel->position)
{
case GUI_PANEL_TOP:
gui_printf (NULL, "%s", _("top"));
break;
case GUI_PANEL_BOTTOM:
gui_printf (NULL, "%s", _("bottom"));
break;
case GUI_PANEL_LEFT:
gui_printf (NULL, "%s", _("left"));
break;
case GUI_PANEL_RIGHT:
gui_printf (NULL, "%s", _("right"));
break;
}
gui_printf (NULL, "%s/%s%d)\n",
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT),
panel->size);
}
/*
* weechat_cmd_panel: manage panels
*/
int
weechat_cmd_panel (t_irc_server *server, t_irc_channel *channel,
int argc, char **argv)
{
t_gui_panel *ptr_panel;
/* make gcc happy */
(void) server;
(void) channel;
gui_printf (NULL, "\n/panel command is under development!\n");
if ((argc == 0) || ((argc == 1) && (ascii_strcasecmp (argv[0], "list") == 0)))
{
/* list open panels */
gui_printf (NULL, "\n");
gui_printf (NULL, _("Open panels:\n"));
for (ptr_panel = gui_panels; ptr_panel; ptr_panel = ptr_panel->next_panel)
{
weechat_cmd_panel_display_info (ptr_panel);
}
}
else
{
}
return 0;
}
/*
* weechat_cmd_plugin: list/load/unload WeeChat plugins
*/
@@ -4006,10 +4089,10 @@ weechat_cmd_window (t_irc_server *server, t_irc_channel *channel,
if ((argc == 0) || ((argc == 1) && (ascii_strcasecmp (argv[0], "list") == 0)))
{
/* list opened windows */
/* list open windows */
gui_printf (NULL, "\n");
gui_printf (NULL, _("Opened windows:\n"));
gui_printf (NULL, _("Open windows:\n"));
i = 1;
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
+1
View File
@@ -89,6 +89,7 @@ extern int weechat_cmd_history (t_irc_server *, t_irc_channel *, int, char **);
extern void weechat_cmd_ignore_display (char *, t_irc_ignore *);
extern int weechat_cmd_ignore (t_irc_server *, t_irc_channel *, int, char **);
extern int weechat_cmd_key (t_irc_server *, t_irc_channel *, char *);
extern int weechat_cmd_panel (t_irc_server *, t_irc_channel *, int, char **);
extern int weechat_cmd_plugin (t_irc_server *, t_irc_channel *, int, char **);
extern int weechat_cmd_save (t_irc_server *, t_irc_channel *, int, char **);
extern int weechat_cmd_server (t_irc_server *, t_irc_channel *, int, char **);
+4 -9
View File
@@ -937,7 +937,6 @@ weechat_dump (int crash)
t_irc_server *ptr_server;
t_irc_channel *ptr_channel;
t_irc_nick *ptr_nick;
t_irc_dcc *ptr_dcc;
t_gui_window *ptr_window;
t_gui_buffer *ptr_buffer;
@@ -984,11 +983,9 @@ weechat_dump (int crash)
}
}
weechat_log_printf ("\n");
for (ptr_dcc = dcc_list; ptr_dcc; ptr_dcc = ptr_dcc->next_dcc)
{
dcc_print_log (ptr_dcc);
}
dcc_print_log ();
gui_panel_print_log ();
weechat_log_printf ("\n");
weechat_log_printf ("[windows/buffers]\n");
@@ -1015,7 +1012,7 @@ weechat_dump (int crash)
weechat_log_printf ("\n");
gui_buffer_print_log (ptr_buffer);
}
weechat_log_printf ("\n");
ignore_print_log ();
@@ -1038,8 +1035,6 @@ weechat_sigsegv ()
fprintf (stderr, "\n");
fprintf (stderr, "*** Very bad! WeeChat is crashing (SIGSEGV received)\n");
fprintf (stderr, "*** (%s, compiled on %s %s)\n",
PACKAGE_STRING, __DATE__, __TIME__);
if (!weechat_log_crash_rename ())
fprintf (stderr, "*** Full crash dump was saved to %s/weechat.log file.\n",
weechat_home);
+2 -2
View File
@@ -174,13 +174,13 @@ gui_chat_draw_title (t_gui_buffer *buffer, int erase)
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
if (ptr_win->buffer == buffer)
if ((ptr_win->buffer == buffer) && (buffer->num_displayed > 0))
{
if (erase)
gui_window_curses_clear (GUI_CURSES(ptr_win)->win_title, COLOR_WIN_TITLE);
gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_title, COLOR_WIN_TITLE);
snprintf (format, 32, "%%-%ds", ptr_win->win_width);
snprintf (format, 32, "%%-%ds", ptr_win->win_title_width);
if (CHANNEL(buffer))
{
if (CHANNEL(buffer)->topic)
+14 -16
View File
@@ -349,7 +349,7 @@ gui_input_draw (t_gui_buffer *buffer, int erase)
prompt_length = gui_input_get_prompt_length (ptr_win, ptr_nickname);
if (ptr_win->win_width - prompt_length < 3)
if (ptr_win->win_input_width - prompt_length < 3)
{
prompt_length = 0;
display_prompt = 0;
@@ -358,9 +358,9 @@ gui_input_draw (t_gui_buffer *buffer, int erase)
display_prompt = 1;
if (buffer->input_buffer_pos - buffer->input_buffer_1st_display + 1 >
ptr_win->win_width - prompt_length)
ptr_win->win_input_width - prompt_length)
buffer->input_buffer_1st_display = buffer->input_buffer_pos -
(ptr_win->win_width - prompt_length) + 1;
(ptr_win->win_input_width - prompt_length) + 1;
else
{
if (buffer->input_buffer_pos < buffer->input_buffer_1st_display)
@@ -370,11 +370,11 @@ gui_input_draw (t_gui_buffer *buffer, int erase)
if ((buffer->input_buffer_1st_display > 0) &&
(buffer->input_buffer_pos -
buffer->input_buffer_1st_display + 1)
< ptr_win->win_width - prompt_length)
< ptr_win->win_input_width - prompt_length)
{
buffer->input_buffer_1st_display =
buffer->input_buffer_pos -
(ptr_win->win_width - prompt_length) + 1;
(ptr_win->win_input_width - prompt_length) + 1;
if (buffer->input_buffer_1st_display < 0)
buffer->input_buffer_1st_display = 0;
}
@@ -384,18 +384,18 @@ gui_input_draw (t_gui_buffer *buffer, int erase)
gui_input_draw_prompt (ptr_win, ptr_nickname);
gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_input, COLOR_WIN_INPUT);
snprintf (format, 32, "%%-%ds", ptr_win->win_width - prompt_length);
snprintf (format, 32, "%%-%ds", ptr_win->win_input_width - prompt_length);
offset_cursor = 0;
if (ptr_win == gui_current_window)
offset_cursor = gui_input_draw_text (ptr_win,
ptr_win->win_width - prompt_length);
ptr_win->win_input_width - prompt_length);
else
wprintw (GUI_CURSES(ptr_win)->win_input, format, "");
wclrtoeol (GUI_CURSES(ptr_win)->win_input);
ptr_win->win_input_x = prompt_length + offset_cursor;
ptr_win->win_input_cursor_x = prompt_length + offset_cursor;
if (ptr_win == gui_current_window)
move (ptr_win->win_y + ptr_win->win_height - 1,
ptr_win->win_x + ptr_win->win_input_x);
move (ptr_win->win_input_y,
ptr_win->win_input_x + ptr_win->win_input_cursor_x);
}
break;
case BUFFER_TYPE_DCC:
@@ -424,18 +424,16 @@ gui_input_draw (t_gui_buffer *buffer, int erase)
wprintw (GUI_CURSES(ptr_win)->win_input, _(" [P] Purge old DCC"));
wprintw (GUI_CURSES(ptr_win)->win_input, _(" [Q] Close DCC view"));
wclrtoeol (GUI_CURSES(ptr_win)->win_input);
ptr_win->win_input_x = 0;
ptr_win->win_input_cursor_x = 0;
if (ptr_win == gui_current_window)
move (ptr_win->win_y + ptr_win->win_height - 1,
ptr_win->win_x);
move (ptr_win->win_input_y, ptr_win->win_input_x);
break;
case BUFFER_TYPE_RAW_DATA:
mvwprintw (GUI_CURSES(ptr_win)->win_input, 0, 0, _(" [Q] Close raw data view"));
wclrtoeol (GUI_CURSES(ptr_win)->win_input);
ptr_win->win_input_x = 0;
ptr_win->win_input_cursor_x = 0;
if (ptr_win == gui_current_window)
move (ptr_win->win_y + ptr_win->win_height - 1,
ptr_win->win_x);
move (ptr_win->win_input_y, ptr_win->win_input_x);
break;
}
doupdate ();
+9 -6
View File
@@ -143,9 +143,12 @@ gui_keyboard_default_bindings ()
void
gui_keyboard_grab_end ()
{
char *expanded_key, *expanded_key2;
int length;
char *expanded_key;
char *buffer_before_key;
#ifdef PLUGINS
char *expanded_key2;
int length;
#endif
/* get expanded name (for example: ^U => ctrl-u) */
expanded_key = gui_keyboard_get_expanded_name (gui_key_buffer);
@@ -193,8 +196,11 @@ void
gui_keyboard_read ()
{
int key, i, insert_ok;
char key_str[32], key_str2[33];
char key_str[32];
char *buffer_before_key;
#ifdef PLUGINS
char key_str2[33];
#endif
i = 0;
/* do not loop too much here (for example when big paste was made),
@@ -215,10 +221,7 @@ gui_keyboard_read ()
}
if (key == KEY_RESIZE)
{
gui_window_refresh_screen ();
continue;
}
gui_last_activity_time = time (NULL);
+3 -3
View File
@@ -73,7 +73,7 @@ gui_main_loop ()
{
/* refresh needed ? */
if (gui_refresh_screen_needed)
gui_window_refresh_screen ();
gui_window_refresh_screen (0);
new_time = time (NULL);
local_time = localtime (&new_time);
@@ -112,7 +112,7 @@ gui_main_loop ()
{
gui_infobar_draw_time (gui_current_window->buffer);
wmove (GUI_CURSES(gui_current_window)->win_input,
0, gui_current_window->win_input_x);
0, gui_current_window->win_input_cursor_x);
wrefresh (GUI_CURSES(gui_current_window)->win_input);
}
@@ -291,7 +291,7 @@ gui_main_init ()
gui_infobar = NULL;
gui_ok = ((COLS > 5) && (LINES > 5));
gui_ok = ((COLS > WINDOW_MIN_WIDTH) && (LINES > WINDOW_MIN_HEIGHT));
refresh ();
+2 -2
View File
@@ -36,7 +36,7 @@
*/
void
gui_nicklist_draw (t_gui_buffer *buffer, int erase)
gui_nicklist_draw (t_gui_buffer *buffer, int erase, int calculate_size)
{
t_gui_window *ptr_win;
int i, j, x, y, x2, column, max_length, nicks_displayed;
@@ -52,7 +52,7 @@ gui_nicklist_draw (t_gui_buffer *buffer, int erase)
{
max_length = nick_get_max_length (CHANNEL(buffer));
if (gui_window_calculate_pos_size (ptr_win, 0))
if (calculate_size && (gui_window_calculate_pos_size (ptr_win, 0)))
{
delwin (GUI_CURSES(ptr_win)->win_chat);
delwin (GUI_CURSES(ptr_win)->win_nick);
+19 -4
View File
@@ -33,11 +33,13 @@
/*
* gui_panel_get_size: get total panel size for a position
* gui_panel_windows_get_size: get total panel size (window panels) for a position
* panel is optional, if not NULL, size is computed
* from panel 1 to panel # - 1
*/
int
gui_panel_get_size (t_gui_window *window, int position)
gui_panel_window_get_size (t_gui_panel *panel, t_gui_window *window, int position)
{
t_gui_panel_window *ptr_panel_win;
int total_size;
@@ -46,6 +48,10 @@ gui_panel_get_size (t_gui_window *window, int position)
for (ptr_panel_win = GUI_CURSES(window)->panel_windows; ptr_panel_win;
ptr_panel_win = ptr_panel_win->next_panel_window)
{
/* stop before panel */
if ((panel) && (ptr_panel_win->panel == panel))
return total_size;
if (ptr_panel_win->panel->position == position)
{
switch (position)
@@ -76,6 +82,7 @@ gui_panel_window_new (t_gui_panel *panel, t_gui_window *window)
{
t_gui_panel_window *new_panel_win;
int x1, y1, x2, y2;
int add_top, add_bottom, add_left, add_right;
if (window)
{
@@ -83,6 +90,10 @@ gui_panel_window_new (t_gui_panel *panel, t_gui_window *window)
y1 = window->win_y + 1;
x2 = x1 + window->win_width - 1;
y2 = y1 + window->win_height - 1 - 4;
add_left = gui_panel_window_get_size (panel, window, GUI_PANEL_LEFT);
add_right = gui_panel_window_get_size (panel, window, GUI_PANEL_RIGHT);
add_top = gui_panel_window_get_size (panel, window, GUI_PANEL_TOP);
add_bottom = gui_panel_window_get_size (panel, window, GUI_PANEL_BOTTOM);
}
else
{
@@ -90,6 +101,10 @@ gui_panel_window_new (t_gui_panel *panel, t_gui_window *window)
y1 = 0;
x2 = gui_window_get_width () - 1;
y2 = gui_window_get_height () - 1;
add_left = gui_panel_global_get_size (panel, GUI_PANEL_LEFT);
add_right = gui_panel_global_get_size (panel, GUI_PANEL_RIGHT);
add_top = gui_panel_global_get_size (panel, GUI_PANEL_TOP);
add_bottom = gui_panel_global_get_size (panel, GUI_PANEL_BOTTOM);
}
if ((new_panel_win = (t_gui_panel_window *) malloc (sizeof (t_gui_panel_window))))
@@ -109,8 +124,8 @@ gui_panel_window_new (t_gui_panel *panel, t_gui_window *window)
switch (panel->position)
{
case GUI_PANEL_TOP:
new_panel_win->x = x1;
new_panel_win->y = y1;
new_panel_win->x = x1 + add_left;
new_panel_win->y = y1 + add_top;
new_panel_win->width = x2 - x1 + 1;
new_panel_win->height = panel->size;
break;
+2 -2
View File
@@ -361,10 +361,10 @@ gui_status_draw (t_gui_buffer *buffer, int erase)
if (BUFFER_HAS_NICKLIST(ptr_win->buffer))
{
snprintf (str_nicks, sizeof (str_nicks) - 1, "%d", CHANNEL(ptr_win->buffer)->nicks_count);
x = ptr_win->win_width - strlen (str_nicks) - 4;
x = ptr_win->win_status_width - strlen (str_nicks) - 4;
}
else
x = ptr_win->win_width - 2;
x = ptr_win->win_status_width - 2;
more = strdup (_("-MORE-"));
x -= strlen (more) - 1;
if (x < 0)
+152 -89
View File
@@ -175,10 +175,10 @@ gui_window_calculate_pos_size (t_gui_window *window, int force_calculate)
if (!gui_ok)
return 0;
add_left = gui_panel_get_size (window, GUI_PANEL_LEFT);
add_right = gui_panel_get_size (window, GUI_PANEL_RIGHT);
add_top = gui_panel_get_size (window, GUI_PANEL_TOP);
add_bottom = gui_panel_get_size (window, GUI_PANEL_BOTTOM);
add_left = gui_panel_window_get_size (NULL, window, GUI_PANEL_LEFT);
add_right = gui_panel_window_get_size (NULL, window, GUI_PANEL_RIGHT);
add_top = gui_panel_window_get_size (NULL, window, GUI_PANEL_TOP);
add_bottom = gui_panel_window_get_size (NULL, window, GUI_PANEL_BOTTOM);
/* init chat & nicklist settings */
if (cfg_look_nicklist && BUFFER_IS_CHANNEL(window->buffer))
@@ -203,16 +203,17 @@ gui_window_calculate_pos_size (t_gui_window *window, int force_calculate)
{
nick_count (CHANNEL(window->buffer), &num_nicks, &num_op,
&num_halfop, &num_voice, &num_normal);
if (((max_length + 2) * num_nicks) % window->win_width == 0)
lines = ((max_length + 2) * num_nicks) / window->win_width;
if (((max_length + 2) * num_nicks) % (window->win_width - add_left - add_right) == 0)
lines = ((max_length + 2) * num_nicks) / (window->win_width - add_left - add_right);
else
lines = (((max_length + 2) * num_nicks) / window->win_width) + 1;
lines = (((max_length + 2) * num_nicks) / (window->win_width - add_left - add_right)) + 1;
if ((cfg_look_nicklist_max_size > 0) && (lines > cfg_look_nicklist_max_size))
lines = cfg_look_nicklist_max_size;
if ((cfg_look_nicklist_min_size > 0) && (lines < cfg_look_nicklist_min_size))
lines = cfg_look_nicklist_min_size;
max_height = (cfg_look_infobar) ?
window->win_height - 3 - 4 : window->win_height - 2 - 4;
window->win_height - add_top - add_bottom - 3 - 4 :
window->win_height - add_top - add_bottom - 2 - 4;
if (lines > max_height)
lines = max_height;
if (!force_calculate && (window->win_nick_height == lines + 1))
@@ -223,95 +224,132 @@ gui_window_calculate_pos_size (t_gui_window *window, int force_calculate)
{
case CFG_LOOK_NICKLIST_LEFT:
window->win_chat_x = window->win_x + add_left + max_length + 2;
window->win_chat_y = window->win_y + 1;
window->win_chat_width = window->win_width - add_left - max_length - 2;
window->win_nick_x = window->win_x + 0;
window->win_nick_y = window->win_y + 1;
window->win_chat_y = window->win_y + add_top + 1;
window->win_chat_width = window->win_width - add_left - add_right - max_length - 2;
window->win_nick_x = window->win_x + add_left + 0;
window->win_nick_y = window->win_y + add_top + 1;
window->win_nick_width = max_length + 2;
if (cfg_look_infobar)
{
window->win_chat_height = window->win_height - 4;
window->win_nick_height = window->win_height - 4;
window->win_chat_height = window->win_height - add_top - add_bottom - 4;
window->win_nick_height = window->win_height - add_top - add_bottom - 4;
}
else
{
window->win_chat_height = window->win_height - 3;
window->win_nick_height = window->win_height - 3;
window->win_chat_height = window->win_height - add_top - add_bottom - 3;
window->win_nick_height = window->win_height - add_top - add_bottom - 3;
}
window->win_nick_num_max = window->win_nick_height;
break;
case CFG_LOOK_NICKLIST_RIGHT:
window->win_chat_x = window->win_x + add_left;
window->win_chat_y = window->win_y + 1;
window->win_chat_width = window->win_width - add_left - max_length - 2;
window->win_nick_x = window->win_x + window->win_width - max_length - 2;
window->win_nick_y = window->win_y + 1;
window->win_chat_y = window->win_y + add_top + 1;
window->win_chat_width = window->win_width - add_left - add_right - max_length - 2;
window->win_nick_x = window->win_x + window->win_width - add_right - max_length - 2;
window->win_nick_y = window->win_y + add_top + 1;
window->win_nick_width = max_length + 2;
if (cfg_look_infobar)
{
window->win_chat_height = window->win_height - 4;
window->win_nick_height = window->win_height - 4;
window->win_chat_height = window->win_height - add_top - add_bottom - 4;
window->win_nick_height = window->win_height - add_top - add_bottom - 4;
}
else
{
window->win_chat_height = window->win_height - 3;
window->win_nick_height = window->win_height - 3;
window->win_chat_height = window->win_height - add_top - add_bottom - 3;
window->win_nick_height = window->win_height - add_top - add_bottom - 3;
}
window->win_nick_num_max = window->win_nick_height;
break;
case CFG_LOOK_NICKLIST_TOP:
window->win_chat_x = window->win_x + add_left;
window->win_chat_y = window->win_y + 1 + (lines + 1);
window->win_chat_width = window->win_width - add_left;
window->win_chat_y = window->win_y + add_top + 1 + (lines + 1);
window->win_chat_width = window->win_width - add_left - add_right;
if (cfg_look_infobar)
window->win_chat_height = window->win_height - 3 - (lines + 1) - 1;
window->win_chat_height = window->win_height - add_top - add_bottom - 3 - (lines + 1) - 1;
else
window->win_chat_height = window->win_height - 3 - (lines + 1);
window->win_nick_x = window->win_x;
window->win_nick_y = window->win_y + 1;
window->win_nick_width = window->win_width;
window->win_chat_height = window->win_height - add_top - add_bottom - 3 - (lines + 1);
window->win_nick_x = window->win_x + add_left;
window->win_nick_y = window->win_y + add_top + 1;
window->win_nick_width = window->win_width - add_left - add_right;
window->win_nick_height = lines + 1;
window->win_nick_num_max = lines * (window->win_nick_width / (max_length + 2));
break;
case CFG_LOOK_NICKLIST_BOTTOM:
window->win_chat_x = window->win_x + add_left;
window->win_chat_y = window->win_y + 1;
window->win_chat_width = window->win_width - add_left;
window->win_chat_y = window->win_y + add_top + 1;
window->win_chat_width = window->win_width - add_left - add_right;
if (cfg_look_infobar)
window->win_chat_height = window->win_height - 3 - (lines + 1) - 1;
window->win_chat_height = window->win_height - add_top - add_bottom - 3 - (lines + 1) - 1;
else
window->win_chat_height = window->win_height - 3 - (lines + 1);
window->win_nick_x = window->win_x;
window->win_chat_height = window->win_height - add_top - add_bottom - 3 - (lines + 1);
window->win_nick_x = window->win_x + add_left;
if (cfg_look_infobar)
window->win_nick_y = window->win_y + window->win_height - 2 - (lines + 1) - 1;
window->win_nick_y = window->win_y + window->win_height - add_bottom - 2 - (lines + 1) - 1;
else
window->win_nick_y = window->win_y + window->win_height - 2 - (lines + 1);
window->win_nick_width = window->win_width;
window->win_nick_y = window->win_y + window->win_height - add_bottom - 2 - (lines + 1);
window->win_nick_width = window->win_width - add_left - add_right;
window->win_nick_height = lines + 1;
window->win_nick_num_max = lines * (window->win_nick_width / (max_length + 2));
break;
}
window->win_chat_cursor_x = window->win_x;
window->win_chat_cursor_y = window->win_y;
window->win_chat_cursor_x = window->win_x + add_left;
window->win_chat_cursor_y = window->win_y + add_top;
}
else
{
window->win_chat_x = window->win_x + add_left;
window->win_chat_y = window->win_y + 1;
window->win_chat_width = window->win_width - add_left;
window->win_chat_y = window->win_y + add_top + 1;
window->win_chat_width = window->win_width - add_left - add_right;
if (cfg_look_infobar)
window->win_chat_height = window->win_height - 4;
window->win_chat_height = window->win_height - add_top - add_bottom - 4;
else
window->win_chat_height = window->win_height - 3;
window->win_chat_height = window->win_height - add_top - add_bottom - 3;
window->win_chat_cursor_x = window->win_x + add_left;
window->win_chat_cursor_y = window->win_y;
window->win_chat_cursor_y = window->win_y + add_top;
window->win_nick_x = -1;
window->win_nick_y = -1;
window->win_nick_width = -1;
window->win_nick_height = -1;
window->win_nick_num_max = -1;
}
/* title window */
window->win_title_x = window->win_x;
window->win_title_y = window->win_y;
window->win_title_width = window->win_width;
window->win_title_height = 1;
/* status window */
window->win_status_x = window->win_x;
if (cfg_look_infobar)
window->win_status_y = window->win_y + window->win_height - 3;
else
window->win_status_y = window->win_y + window->win_height - 2;
window->win_status_width = window->win_width;
window->win_status_height = 1;
/* infobar window */
if (cfg_look_infobar)
{
window->win_infobar_x = window->win_x;
window->win_infobar_y = window->win_y + window->win_height - 2;
window->win_infobar_width = window->win_width;
window->win_infobar_height = 1;
}
else
{
window->win_infobar_x = -1;
window->win_infobar_y = -1;
window->win_infobar_width = -1;
window->win_infobar_height = -1;
}
/* input window */
window->win_input_x = window->win_x;
window->win_input_y = window->win_y + window->win_height - 1;
window->win_input_width = window->win_width;
window->win_input_height = 1;
return 1;
}
@@ -358,7 +396,7 @@ gui_window_redraw_buffer (t_gui_buffer *buffer)
gui_chat_draw_title (buffer, 1);
gui_chat_draw (buffer, 1);
if (GUI_CURSES(ptr_win)->win_nick)
gui_nicklist_draw (buffer, 1);
gui_nicklist_draw (buffer, 1, 0);
gui_status_draw (buffer, 1);
if (cfg_look_infobar)
gui_infobar_draw (buffer, 1);
@@ -377,7 +415,7 @@ gui_window_switch_to_buffer (t_gui_window *window, t_gui_buffer *buffer)
{
if (!gui_ok)
return;
if (window->buffer->num_displayed > 0)
window->buffer->num_displayed--;
@@ -390,20 +428,21 @@ gui_window_switch_to_buffer (t_gui_window *window, t_gui_buffer *buffer)
window->buffer = buffer;
window->win_nick_start = 0;
gui_window_calculate_pos_size (window, 1);
/* destroy Curses windows */
gui_window_objects_free (window, 0);
/* create Curses windows */
GUI_CURSES(window)->win_title = newwin (1,
window->win_width,
window->win_y,
window->win_x);
GUI_CURSES(window)->win_input = newwin (1,
window->win_width,
window->win_y + window->win_height - 1,
window->win_x);
GUI_CURSES(window)->win_title = newwin (window->win_title_height,
window->win_title_width,
window->win_title_y,
window->win_title_x);
GUI_CURSES(window)->win_input = newwin (window->win_input_height,
window->win_input_width,
window->win_input_y,
window->win_input_x);
if (BUFFER_IS_CHANNEL(buffer))
{
if (GUI_CURSES(window)->win_chat)
@@ -432,22 +471,19 @@ gui_window_switch_to_buffer (t_gui_window *window, t_gui_buffer *buffer)
/* create status/infobar windows */
if (cfg_look_infobar)
{
GUI_CURSES(window)->win_infobar = newwin (1, window->win_width,
window->win_y + window->win_height - 2,
window->win_x);
GUI_CURSES(window)->win_status = newwin (1, window->win_width,
window->win_y + window->win_height - 3,
window->win_x);
}
else
GUI_CURSES(window)->win_status = newwin (1, window->win_width,
window->win_y + window->win_height - 2,
window->win_x);
GUI_CURSES(window)->win_infobar = newwin (window->win_infobar_height,
window->win_infobar_width,
window->win_infobar_y,
window->win_infobar_x);
GUI_CURSES(window)->win_status = newwin (window->win_status_height,
window->win_status_width,
window->win_status_y,
window->win_status_x);
window->start_line = NULL;
window->start_line_pos = 0;
buffer->num_displayed++;
hotlist_remove_buffer (buffer);
@@ -623,7 +659,7 @@ gui_window_nick_beginning (t_gui_window *window)
if (window->win_nick_start > 0)
{
window->win_nick_start = 0;
gui_nicklist_draw (window->buffer, 1);
gui_nicklist_draw (window->buffer, 1, 0);
}
}
}
@@ -652,7 +688,7 @@ gui_window_nick_end (t_gui_window *window)
if (new_start != window->win_nick_start)
{
window->win_nick_start = new_start;
gui_nicklist_draw (window->buffer, 1);
gui_nicklist_draw (window->buffer, 1, 0);
}
}
}
@@ -674,7 +710,7 @@ gui_window_nick_page_up (t_gui_window *window)
window->win_nick_start -= (window->win_nick_num_max - 1);
if (window->win_nick_start <= 1)
window->win_nick_start = 0;
gui_nicklist_draw (window->buffer, 1);
gui_nicklist_draw (window->buffer, 1, 0);
}
}
}
@@ -699,7 +735,7 @@ gui_window_nick_page_down (t_gui_window *window)
window->win_nick_start += (window->win_nick_num_max - 1);
else
window->win_nick_start += (window->win_nick_num_max - 2);
gui_nicklist_draw (window->buffer, 1);
gui_nicklist_draw (window->buffer, 1, 0);
}
}
}
@@ -778,17 +814,19 @@ gui_window_refresh_windows ()
gui_window_get_width (),
gui_window_get_height (), 0) < 0)
gui_window_merge_all (gui_current_window);
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
gui_window_switch_to_buffer (ptr_win, ptr_win->buffer);
}
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
gui_window_redraw_buffer (ptr_win->buffer);
gui_window_draw_separator (ptr_win);
}
gui_current_window = old_current_window;
gui_window_switch_to_buffer (gui_current_window, gui_current_window->buffer);
gui_window_redraw_buffer (gui_current_window->buffer);
}
}
@@ -1133,24 +1171,32 @@ gui_window_switch_right (t_gui_window *window)
/*
* gui_window_refresh_screen: called when term size is modified
* force == 1 when Ctrl+L is pressed
*/
void
gui_window_refresh_screen ()
gui_window_refresh_screen (int force)
{
int new_height, new_width;
endwin ();
refresh ();
getmaxyx (stdscr, new_height, new_width);
gui_ok = ((new_width > WINDOW_MIN_WIDTH) && (new_height > WINDOW_MIN_HEIGHT));
if (gui_ok)
gui_window_refresh_windows ();
gui_refresh_screen_needed = 0;
if (force || (gui_refresh_screen_needed == 1))
{
endwin ();
refresh ();
getmaxyx (stdscr, new_height, new_width);
gui_ok = ((new_width > WINDOW_MIN_WIDTH) && (new_height > WINDOW_MIN_HEIGHT));
if (gui_ok)
{
refresh ();
gui_window_refresh_windows ();
}
}
if (!force && (gui_refresh_screen_needed > 0))
gui_refresh_screen_needed--;
}
/*
@@ -1160,7 +1206,8 @@ gui_window_refresh_screen ()
void
gui_window_refresh_screen_sigwinch ()
{
gui_refresh_screen_needed = 1;
if (gui_refresh_screen_needed < 2)
gui_refresh_screen_needed++;
signal (SIGWINCH, gui_window_refresh_screen_sigwinch);
}
@@ -1253,6 +1300,8 @@ gui_window_reset_title ()
void
gui_window_objects_print_log (t_gui_window *window)
{
t_gui_panel_window *ptr_panel_win;
weechat_log_printf (" win_title . . . . . : 0x%X\n", GUI_CURSES(window)->win_title);
weechat_log_printf (" win_chat. . . . . . : 0x%X\n", GUI_CURSES(window)->win_chat);
weechat_log_printf (" win_nick. . . . . . : 0x%X\n", GUI_CURSES(window)->win_nick);
@@ -1260,4 +1309,18 @@ gui_window_objects_print_log (t_gui_window *window)
weechat_log_printf (" win_infobar . . . . : 0x%X\n", GUI_CURSES(window)->win_infobar);
weechat_log_printf (" win_input . . . . . : 0x%X\n", GUI_CURSES(window)->win_input);
weechat_log_printf (" win_separator . . . : 0x%X\n", GUI_CURSES(window)->win_separator);
for (ptr_panel_win = GUI_CURSES(window)->panel_windows;
ptr_panel_win; ptr_panel_win = ptr_panel_win->next_panel_window)
{
weechat_log_printf ("\n");
weechat_log_printf (" [window panel (addr:0x%X)]\n", ptr_panel_win);
weechat_log_printf (" panel . . . . . . : 0x%X\n", ptr_panel_win->panel);
weechat_log_printf (" x . . . . . . . . : %d\n", ptr_panel_win->x);
weechat_log_printf (" y . . . . . . . . : %d\n", ptr_panel_win->y);
weechat_log_printf (" width . . . . . . : %d\n", ptr_panel_win->width);
weechat_log_printf (" height. . . . . . : %d\n", ptr_panel_win->height);
weechat_log_printf (" win_panel . . . . : 0x%X\n", ptr_panel_win->win_panel);
weechat_log_printf (" win_separator . . : 0x%X\n", ptr_panel_win->win_separator);
weechat_log_printf (" next_panel_window : 0x%X\n", ptr_panel_win->next_panel_window);
}
}
+4 -1
View File
@@ -39,6 +39,9 @@
#define WEECHAT_COLOR_CYAN COLOR_YELLOW
#define WEECHAT_COLOR_WHITE COLOR_WHITE
#define WINDOW_MIN_WIDTH 10
#define WINDOW_MIN_HEIGHT 5
#define GUI_CURSES(window) ((t_gui_curses_objects *)(window->gui_objects))
typedef struct t_gui_panel_window t_gui_panel_window;
@@ -92,7 +95,7 @@ extern void gui_window_set_title ();
extern void gui_window_reset_title ();
/* panel functions */
extern int gui_panel_get_size (t_gui_window *, int);
extern int gui_panel_window_get_size (t_gui_panel *, t_gui_window *, int);
extern void gui_panel_redraw_buffer (t_gui_buffer *);
#endif /* gui-curses.h */
+2 -1
View File
@@ -36,7 +36,7 @@
*/
void
gui_nicklist_draw (t_gui_buffer *buffer, int erase)
gui_nicklist_draw (t_gui_buffer *buffer, int erase, int calculate_size)
{
/*t_gui_window *ptr_win;
int i, j, x, y, column, max_length, nicks_displayed;
@@ -49,4 +49,5 @@ gui_nicklist_draw (t_gui_buffer *buffer, int erase)
/* TODO: write this function for Gtk */
(void) buffer;
(void) erase;
(void) calculate_size;
}
+6 -10
View File
@@ -386,7 +386,7 @@ gui_window_nick_beginning (t_gui_window *window)
if (window->win_nick_start > 0)
{
window->win_nick_start = 0;
gui_nicklist_draw (window->buffer, 1);
gui_nicklist_draw (window->buffer, 1, 0);
}
}
}
@@ -415,7 +415,7 @@ gui_window_nick_end (t_gui_window *window)
if (new_start != window->win_nick_start)
{
window->win_nick_start = new_start;
gui_nicklist_draw (window->buffer, 1);
gui_nicklist_draw (window->buffer, 1, 0);
}
}
}
@@ -437,7 +437,7 @@ gui_window_nick_page_up (t_gui_window *window)
window->win_nick_start -= (window->win_nick_height - 1);
if (window->win_nick_start <= 1)
window->win_nick_start = 0;
gui_nicklist_draw (window->buffer, 1);
gui_nicklist_draw (window->buffer, 1, 0);
}
}
}
@@ -462,7 +462,7 @@ gui_window_nick_page_down (t_gui_window *window)
window->win_nick_start += (window->win_nick_height - 1);
else
window->win_nick_start += (window->win_nick_height - 2);
gui_nicklist_draw (window->buffer, 1);
gui_nicklist_draw (window->buffer, 1, 0);
}
}
}
@@ -485,8 +485,6 @@ gui_window_auto_resize (t_gui_window_tree *tree,
{
if (tree->window)
{
if ((width < WINDOW_MIN_WIDTH) || (height < WINDOW_MIN_HEIGHT))
return -1;
if (!simulate)
{
tree->window->win_x = x;
@@ -555,8 +553,7 @@ gui_window_split_horiz (t_gui_window *window, int pourcentage)
height1 = (window->win_height * pourcentage) / 100;
height2 = window->win_height - height1;
if ((height1 >= WINDOW_MIN_HEIGHT) && (height2 >= WINDOW_MIN_HEIGHT)
&& (pourcentage > 0) && (pourcentage <= 100))
if ((pourcentage > 0) && (pourcentage <= 100))
{
if ((new_window = gui_window_new (window,
window->win_x, window->win_y,
@@ -597,8 +594,7 @@ gui_window_split_vertic (t_gui_window *window, int pourcentage)
width1 = (window->win_width * pourcentage) / 100;
width2 = window->win_width - width1 - 1;
if ((width1 >= WINDOW_MIN_WIDTH) && (width2 >= WINDOW_MIN_WIDTH)
&& (pourcentage > 0) && (pourcentage <= 100))
if ((pourcentage > 0) && (pourcentage <= 100))
{
if ((new_window = gui_window_new (window,
window->win_x + width1 + 1, window->win_y,
+1 -1
View File
@@ -1200,7 +1200,7 @@ gui_action_refresh_screen (t_gui_window *window)
/* make gcc happy */
(void) window;
gui_window_refresh_screen ();
gui_window_refresh_screen (1);
}
/*
+63 -2
View File
@@ -35,18 +35,55 @@
#include "../common/weechat.h"
#include "gui.h"
#include "../common/log.h"
t_gui_panel *gui_panels = NULL; /* pointer to first panel */
t_gui_panel *last_gui_panel = NULL; /* pointer to last panel */
/*
* gui_panel_global_get_size: get total panel size (global panels) for a position
*/
int
gui_panel_global_get_size (t_gui_panel *panel, int position)
{
t_gui_panel *ptr_panel;
int total_size;
total_size = 0;
for (ptr_panel = gui_panels; ptr_panel; ptr_panel = ptr_panel->next_panel)
{
if ((panel) && (ptr_panel == panel))
return total_size;
if (ptr_panel->position == position)
{
switch (position)
{
case GUI_PANEL_TOP:
case GUI_PANEL_BOTTOM:
total_size += ptr_panel->size;
break;
case GUI_PANEL_LEFT:
case GUI_PANEL_RIGHT:
total_size += ptr_panel->size;
break;
}
if (ptr_panel->separator)
total_size++;
}
}
return total_size;
}
/*
* gui_panel_new: create a new panel
*/
t_gui_panel *
gui_panel_new (char *name, int position, int type, int size, int separator)
gui_panel_new (char *name, int type, int position, int size, int separator)
{
t_gui_panel *new_panel;
t_gui_window *ptr_win;
@@ -56,8 +93,9 @@ gui_panel_new (char *name, int position, int type, int size, int separator)
if ((new_panel = (t_gui_panel *) malloc (sizeof (t_gui_panel))))
{
new_panel->position = position;
new_panel->number = (last_gui_panel) ? last_gui_panel->number + 1 : 1;
new_panel->name = strdup (name);
new_panel->position = position;
new_panel->separator = separator;
new_panel->size = size;
if (type == GUI_PANEL_WINDOWS)
@@ -111,3 +149,26 @@ gui_panel_free (t_gui_panel *panel)
free (panel);
}
/*
* gui_panel_print_log: print panel infos in log (usually for crash dump)
*/
void
gui_panel_print_log ()
{
t_gui_panel *ptr_panel;
for (ptr_panel = gui_panels; ptr_panel; ptr_panel = ptr_panel->next_panel)
{
weechat_log_printf ("\n");
weechat_log_printf ("[panel (addr:0x%X)]\n", ptr_panel);
weechat_log_printf (" position. . . . . . : %d\n", ptr_panel->position);
weechat_log_printf (" name. . . . . . . . : '%s'\n", ptr_panel->name);
weechat_log_printf (" panel_window. . . . : 0x%X\n", ptr_panel->panel_window);
weechat_log_printf (" separator . . . . . : %d\n", ptr_panel->separator);
weechat_log_printf (" size. . . . . . . . : %d\n", ptr_panel->size);
weechat_log_printf (" prev_panel . .. . . : 0x%X\n", ptr_panel->prev_panel);
weechat_log_printf (" next_panel . .. . . : 0x%X\n", ptr_panel->next_panel);
}
}
+6 -5
View File
@@ -23,11 +23,11 @@
#define GUI_PANEL_TOP 1
#define GUI_PANEL_BOTTOM 2
#define GUI_PANEL_LEFT 3
#define GUI_PANEL_RIGHT 4
#define GUI_PANEL_LEFT 4
#define GUI_PANEL_RIGHT 8
#define GUI_PANEL_GLOBAL 0
#define GUI_PANEL_WINDOWS 1
#define GUI_PANEL_GLOBAL 1
#define GUI_PANEL_WINDOWS 2
/* panel structure */
@@ -36,8 +36,9 @@ typedef struct t_gui_panel t_gui_panel;
struct t_gui_panel
{
int position; /* position (top, bottom, left, right) */
int number; /* panel number */
char *name; /* panel name */
int position; /* position (top, bottom, left, right) */
void *panel_window; /* pointer to panel window, NULL if */
/* displayed on each window (in this */
/* case, pointers are in windows) */
+18 -2
View File
@@ -213,7 +213,7 @@ gui_window_new (t_gui_window *parent, int x, int y, int width, int height,
new_window->win_nick_num_max = 0;
new_window->win_nick_start = 0;
new_window->win_input_x = 0;
new_window->win_input_cursor_x = 0;
new_window->dcc_first = NULL;
new_window->dcc_selected = NULL;
@@ -409,6 +409,23 @@ gui_window_print_log (t_gui_window *window)
weechat_log_printf (" win_nick_width. . . : %d\n", window->win_nick_width);
weechat_log_printf (" win_nick_height . . : %d\n", window->win_nick_height);
weechat_log_printf (" win_nick_start. . . : %d\n", window->win_nick_start);
weechat_log_printf (" win_title_x . . . . : %d\n", window->win_title_x);
weechat_log_printf (" win_title_y . . . . : %d\n", window->win_title_y);
weechat_log_printf (" win_title_width . . : %d\n", window->win_title_width);
weechat_log_printf (" win_title_height. . : %d\n", window->win_title_height);
weechat_log_printf (" win_status_x. . . . : %d\n", window->win_status_x);
weechat_log_printf (" win_status_y. . . . : %d\n", window->win_status_y);
weechat_log_printf (" win_status_width. . : %d\n", window->win_status_width);
weechat_log_printf (" win_status_height . : %d\n", window->win_status_height);
weechat_log_printf (" win_infobar_x . . . : %d\n", window->win_infobar_x);
weechat_log_printf (" win_infobar_y . . . : %d\n", window->win_infobar_y);
weechat_log_printf (" win_infobar_width . : %d\n", window->win_infobar_width);
weechat_log_printf (" win_infobar_height. : %d\n", window->win_infobar_height);
weechat_log_printf (" win_input_x . . . . : %d\n", window->win_input_x);
weechat_log_printf (" win_input_y . . . . : %d\n", window->win_input_y);
weechat_log_printf (" win_input_width . . : %d\n", window->win_input_width);
weechat_log_printf (" win_input_height. . : %d\n", window->win_input_height);
weechat_log_printf (" win_input_cursor_x. : %d\n", window->win_input_cursor_x);
gui_window_objects_print_log (window);
weechat_log_printf (" dcc_first . . . . . : 0x%X\n", window->dcc_first);
weechat_log_printf (" dcc_selected. . . . : 0x%X\n", window->dcc_selected);
@@ -419,5 +436,4 @@ gui_window_print_log (t_gui_window *window)
weechat_log_printf (" start_line_pos. . . : %d\n", window->start_line_pos);
weechat_log_printf (" prev_window . . . . : 0x%X\n", window->prev_window);
weechat_log_printf (" next_window . . . . : 0x%X\n", window->next_window);
}
+24 -5
View File
@@ -21,9 +21,6 @@
#ifndef __WEECHAT_GUI_WINDOW_H
#define __WEECHAT_GUI_WINDOW_H 1
#define WINDOW_MIN_WIDTH 10
#define WINDOW_MIN_HEIGHT 5
/* window structures */
typedef struct t_gui_window_tree t_gui_window_tree;
@@ -54,9 +51,31 @@ struct t_gui_window
int win_nick_num_max; /* maximum number of nicks displayed */
int win_nick_start; /* # of 1st nick for display (scroll) */
/* title window settings */
int win_title_x; /* title window position */
int win_title_y; /* title window position */
int win_title_width; /* width of title window */
int win_title_height; /* height of title window */
/* status bar settings */
int win_status_x; /* status window position */
int win_status_y; /* status window position */
int win_status_width; /* width of status window */
int win_status_height; /* height of status window */
/* infobar bar settings */
int win_infobar_x; /* infobar window position */
int win_infobar_y; /* infobar window position */
int win_infobar_width; /* width of infobar window */
int win_infobar_height; /* height of infobar window */
/* input window settings */
int win_input_x; /* position of cursor in input window */
int win_input_x; /* input window position */
int win_input_y; /* input window position */
int win_input_width; /* width of input window */
int win_input_height; /* height of input window */
int win_input_cursor_x; /* position of cursor in input window */
/* GUI specific objects */
void *gui_objects; /* pointer to a GUI specific struct */
+3 -1
View File
@@ -100,8 +100,10 @@ extern void gui_buffer_move_to_number (t_gui_buffer *, int);
extern void gui_buffer_print_log (t_gui_buffer *);
/* panel */
extern int gui_panel_global_get_size (t_gui_panel *, int);
extern t_gui_panel *gui_panel_new (char *, int, int, int, int);
extern void gui_panel_free (t_gui_panel *);
extern void gui_panel_print_log ();
/* action */
extern void gui_action_clipboard_copy (char *, int);
@@ -220,7 +222,7 @@ extern void gui_status_draw (t_gui_buffer *, int);
extern void gui_input_draw (t_gui_buffer *, int);
/* nicklist */
extern void gui_nicklist_draw (t_gui_buffer *, int);
extern void gui_nicklist_draw (t_gui_buffer *, int, int);
/* window */
extern int gui_window_get_width ();
+1 -1
View File
@@ -403,7 +403,7 @@ channel_remove_away (t_irc_channel *channel)
{
NICK_SET_FLAG(ptr_nick, 0, NICK_AWAY);
}
gui_nicklist_draw (channel->buffer, 0);
gui_nicklist_draw (channel->buffer, 0, 0);
}
}
+34 -28
View File
@@ -1536,33 +1536,39 @@ dcc_end ()
*/
void
dcc_print_log (t_irc_dcc *dcc)
dcc_print_log ()
{
weechat_log_printf ("[DCC (addr:0x%X)]\n", dcc);
weechat_log_printf (" server. . . . . . . : 0x%X\n", dcc->server);
weechat_log_printf (" channel . . . . . . : 0x%X\n", dcc->channel);
weechat_log_printf (" type. . . . . . . . : %d\n", dcc->type);
weechat_log_printf (" status. . . . . . . : %d\n", dcc->status);
weechat_log_printf (" start_time. . . . . : %ld\n", dcc->start_time);
weechat_log_printf (" start_transfer. . . : %ld\n", dcc->start_transfer);
weechat_log_printf (" addr. . . . . . . . : %lu\n", dcc->addr);
weechat_log_printf (" port. . . . . . . . : %d\n", dcc->port);
weechat_log_printf (" nick. . . . . . . . : '%s'\n", dcc->nick);
weechat_log_printf (" sock. . . . . . . . : %d\n", dcc->sock);
weechat_log_printf (" unterminated_message: '%s'\n", dcc->unterminated_message);
weechat_log_printf (" file. . . . . . . . : %d\n", dcc->file);
weechat_log_printf (" filename. . . . . . : '%s'\n", dcc->filename);
weechat_log_printf (" local_filename. . . : '%s'\n", dcc->local_filename);
weechat_log_printf (" filename_suffix . . : %d\n", dcc->filename_suffix);
weechat_log_printf (" size. . . . . . . . : %lu\n", dcc->size);
weechat_log_printf (" pos . . . . . . . . : %lu\n", dcc->pos);
weechat_log_printf (" ack . . . . . . . . : %lu\n", dcc->ack);
weechat_log_printf (" start_resume. . . . : %lu\n", dcc->start_resume);
weechat_log_printf (" last_check_time . . : %ld\n", dcc->last_check_time);
weechat_log_printf (" last_check_pos. . . : %lu\n", dcc->last_check_pos);
weechat_log_printf (" last_activity . . . : %ld\n", dcc->last_activity);
weechat_log_printf (" bytes_per_sec . . . : %lu\n", dcc->bytes_per_sec);
weechat_log_printf (" eta . . . . . . . . : %lu\n", dcc->eta);
weechat_log_printf (" prev_dcc. . . . . . : 0x%X\n", dcc->prev_dcc);
weechat_log_printf (" next_dcc. . . . . . : 0x%X\n", dcc->next_dcc);
t_irc_dcc *ptr_dcc;
for (ptr_dcc = dcc_list; ptr_dcc; ptr_dcc = ptr_dcc->next_dcc)
{
weechat_log_printf ("\n");
weechat_log_printf ("[DCC (addr:0x%X)]\n", ptr_dcc);
weechat_log_printf (" server. . . . . . . : 0x%X\n", ptr_dcc->server);
weechat_log_printf (" channel . . . . . . : 0x%X\n", ptr_dcc->channel);
weechat_log_printf (" type. . . . . . . . : %d\n", ptr_dcc->type);
weechat_log_printf (" status. . . . . . . : %d\n", ptr_dcc->status);
weechat_log_printf (" start_time. . . . . : %ld\n", ptr_dcc->start_time);
weechat_log_printf (" start_transfer. . . : %ld\n", ptr_dcc->start_transfer);
weechat_log_printf (" addr. . . . . . . . : %lu\n", ptr_dcc->addr);
weechat_log_printf (" port. . . . . . . . : %d\n", ptr_dcc->port);
weechat_log_printf (" nick. . . . . . . . : '%s'\n", ptr_dcc->nick);
weechat_log_printf (" sock. . . . . . . . : %d\n", ptr_dcc->sock);
weechat_log_printf (" unterminated_message: '%s'\n", ptr_dcc->unterminated_message);
weechat_log_printf (" file. . . . . . . . : %d\n", ptr_dcc->file);
weechat_log_printf (" filename. . . . . . : '%s'\n", ptr_dcc->filename);
weechat_log_printf (" local_filename. . . : '%s'\n", ptr_dcc->local_filename);
weechat_log_printf (" filename_suffix . . : %d\n", ptr_dcc->filename_suffix);
weechat_log_printf (" size. . . . . . . . : %lu\n", ptr_dcc->size);
weechat_log_printf (" pos . . . . . . . . : %lu\n", ptr_dcc->pos);
weechat_log_printf (" ack . . . . . . . . : %lu\n", ptr_dcc->ack);
weechat_log_printf (" start_resume. . . . : %lu\n", ptr_dcc->start_resume);
weechat_log_printf (" last_check_time . . : %ld\n", ptr_dcc->last_check_time);
weechat_log_printf (" last_check_pos. . . : %lu\n", ptr_dcc->last_check_pos);
weechat_log_printf (" last_activity . . . : %ld\n", ptr_dcc->last_activity);
weechat_log_printf (" bytes_per_sec . . . : %lu\n", ptr_dcc->bytes_per_sec);
weechat_log_printf (" eta . . . . . . . . : %lu\n", ptr_dcc->eta);
weechat_log_printf (" prev_dcc. . . . . . : 0x%X\n", ptr_dcc->prev_dcc);
weechat_log_printf (" next_dcc. . . . . . : 0x%X\n", ptr_dcc->next_dcc);
}
}
+1 -1
View File
@@ -408,7 +408,7 @@ nick_set_away (t_irc_channel *channel, t_irc_nick *nick, int is_away)
((!is_away) && (nick->flags & NICK_AWAY)))
{
NICK_SET_FLAG(nick, is_away, NICK_AWAY);
gui_nicklist_draw (channel->buffer, 0);
gui_nicklist_draw (channel->buffer, 0, 0);
}
}
}
+10 -10
View File
@@ -442,7 +442,7 @@ irc_cmd_recv_join (t_irc_server *server, char *host, char *nick, char *arguments
ptr_nick = nick_new (server, ptr_channel, nick, 0, 0, 0, 0, 0);
if (ptr_nick)
ptr_nick->host = strdup ((pos) ? pos + 1 : host);
gui_nicklist_draw (ptr_channel->buffer, 1);
gui_nicklist_draw (ptr_channel->buffer, 1, 1);
gui_status_draw (ptr_channel->buffer, 1);
return 0;
}
@@ -523,7 +523,7 @@ irc_cmd_recv_kick (t_irc_server *server, char *host, char *nick, char *arguments
{
/* my nick was kicked => free all nicks, channel is not active any more */
nick_free_all (ptr_channel);
gui_nicklist_draw (ptr_channel->buffer, 1);
gui_nicklist_draw (ptr_channel->buffer, 1, 1);
gui_status_draw (ptr_channel->buffer, 1);
if (server->autorejoin)
irc_cmd_send_join (server, NULL, ptr_channel->name);
@@ -534,7 +534,7 @@ irc_cmd_recv_kick (t_irc_server *server, char *host, char *nick, char *arguments
if (ptr_nick)
{
nick_free (ptr_channel, ptr_nick);
gui_nicklist_draw (ptr_channel->buffer, 1);
gui_nicklist_draw (ptr_channel->buffer, 1, 1);
gui_status_draw (ptr_channel->buffer, 1);
}
}
@@ -761,7 +761,7 @@ void irc_get_channel_modes (t_irc_server *server, t_irc_channel *channel,
{
NICK_SET_FLAG(ptr_nick, (set_flag == '+'), NICK_HALFOP);
nick_resort (channel, ptr_nick);
gui_nicklist_draw (channel->buffer, 1);
gui_nicklist_draw (channel->buffer, 1, 1);
}
}
@@ -926,7 +926,7 @@ void irc_get_channel_modes (t_irc_server *server, t_irc_channel *channel,
{
NICK_SET_FLAG(ptr_nick, (set_flag == '+'), NICK_OP);
nick_resort (channel, ptr_nick);
gui_nicklist_draw (channel->buffer, 1);
gui_nicklist_draw (channel->buffer, 1, 1);
}
}
@@ -1025,7 +1025,7 @@ void irc_get_channel_modes (t_irc_server *server, t_irc_channel *channel,
{
NICK_SET_FLAG(ptr_nick, (set_flag == '+'), NICK_VOICE);
nick_resort (channel, ptr_nick);
gui_nicklist_draw (channel->buffer, 1);
gui_nicklist_draw (channel->buffer, 1, 1);
}
}
@@ -1327,7 +1327,7 @@ irc_cmd_recv_nick (t_irc_server *server, char *host, char *nick, char *arguments
GUI_COLOR(COLOR_WIN_CHAT_NICK),
arguments);
}
gui_nicklist_draw (ptr_channel->buffer, 1);
gui_nicklist_draw (ptr_channel->buffer, 1, 1);
gui_add_hotlist = 1;
}
}
@@ -1648,7 +1648,7 @@ irc_cmd_recv_part (t_irc_server *server, char *host, char *nick, char *arguments
if (ptr_channel)
{
gui_nicklist_draw (ptr_channel->buffer, 1);
gui_nicklist_draw (ptr_channel->buffer, 1, 1);
gui_status_draw (ptr_channel->buffer, 1);
}
gui_input_draw (gui_current_window->buffer, 1);
@@ -2591,7 +2591,7 @@ irc_cmd_recv_quit (t_irc_server *server, char *host, char *nick, char *arguments
arguments,
GUI_COLOR(COLOR_WIN_CHAT_DARK));
}
gui_nicklist_draw (ptr_channel->buffer, 1);
gui_nicklist_draw (ptr_channel->buffer, 1, 1);
gui_status_draw (ptr_channel->buffer, 1);
}
}
@@ -4809,7 +4809,7 @@ irc_cmd_recv_353 (t_irc_server *server, char *host, char *nick, char *arguments)
}
if (ptr_channel)
{
gui_nicklist_draw (ptr_channel->buffer, 1);
gui_nicklist_draw (ptr_channel->buffer, 1, 1);
gui_status_draw (ptr_channel->buffer, 1);
}
else
+1 -1
View File
@@ -419,7 +419,7 @@ extern void dcc_send_request (t_irc_server *, int, char *, char *);
extern void dcc_chat_sendf (t_irc_dcc *, char *, ...);
extern void dcc_handle ();
extern void dcc_end ();
extern void dcc_print_log (t_irc_dcc *);
extern void dcc_print_log ();
/* IRC display (irc-diplay.c) */
+3 -2
View File
@@ -1,14 +1,15 @@
WeeChat - Wee Enhanced Environment for Chat
===========================================
ChangeLog - 2006-07-07
ChangeLog - 2006-07-16
Version 0.2.0 (under dev!):
* added configure option for doc XSL prefix (bug #16991)
* fixed bug with spaces in script names (bug #16957)
* fixed random crash when "MODE #chan -l" is received
* fixed bug in IRC parser (random crash with malformed IRC messages)
* fixed refresh bug (too many refresh) when terminal is resized
* fixed refresh bugs when terminal is resized: too many refreshs,
display bug with splited windows
* case ignored for channel names in charset options (bug #16858)
* fixed crash when setting look_one_server_buffer to ON (bug #16932)
* added new functions in plugin/script API: get window info,
+235 -182
View File
File diff suppressed because it is too large Load Diff
+235 -182
View File
File diff suppressed because it is too large Load Diff
+235 -182
View File
File diff suppressed because it is too large Load Diff
+243 -188
View File
File diff suppressed because it is too large Load Diff
+234 -183
View File
File diff suppressed because it is too large Load Diff
+235 -182
View File
File diff suppressed because it is too large Load Diff
+234 -188
View File
File diff suppressed because it is too large Load Diff
+2
View File
@@ -145,6 +145,8 @@ weechat_backtrace ()
#endif
weechat_backtrace_printf ("======= WeeChat backtrace =======\n");
weechat_backtrace_printf ("(written by %s, compiled on %s %s)\n",
PACKAGE_STRING, __DATE__, __TIME__);
#ifdef HAVE_BACKTRACE
trace_size = backtrace (trace, BACKTRACE_MAX);
+90 -7
View File
@@ -59,7 +59,7 @@ t_weechat_command weechat_commands[] =
N_(" action: action to do:\n"
" move: move buffer in the list (may be relative, for example -1)\n"
" close: close buffer (optional arg is part message, for a channel)\n"
" list: list opened buffers (no parameter implies this list)\n"
" list: list open buffers (no parameter implies this list)\n"
" notify: set notify level for buffer (0=never, 1=highlight, 2=1+msg, 3=2+join/part)\n"
"server\n"
"channel: jump to buffer by server and/or channel name\n"
@@ -128,6 +128,15 @@ t_weechat_command weechat_commands[] =
" reset: restore bindings to the default values and delete ALL "
"personal bindings (use carefully!)"),
"unbind|functions|reset %k", 0, MAX_ARGS, 0, NULL, weechat_cmd_key },
{ "panel", N_("manage panels"),
N_("[list | add type position size | resize # size | close # | move #1 #2]"),
N_(" list: list open panels (no parameter implies this list)\n"
" add: add a panel, type is global|local, position is top|bottom|left|right\n"
" resize: resize a panel with a new size (may be relative, for example -1)\n"
" close: close a panel by number\n"
" move: move a panel to another number (may be relative, for example -1)"),
"list|add|close|move global|local top|bottom|left|right",
0, MAX_ARGS, 0, weechat_cmd_panel, NULL },
{ "plugin", N_("list/load/unload plugins"),
N_("[load filename] | [autoload] | [reload] | [unload]"),
N_("filename: WeeChat plugin (file) to load\n\n"
@@ -195,7 +204,7 @@ t_weechat_command weechat_commands[] =
{ "window", N_("manage windows"),
N_("[list | -1 | +1 | b# | up | down | left | right | splith [pct] "
"| splitv [pct] | resize pct | merge [all]]"),
N_(" list: list opened windows (no parameter implies this list)\n"
N_(" list: list open windows (no parameter implies this list)\n"
" -1: jump to previous window\n"
" +1: jump to next window\n"
" b#: jump to next window displaying buffer number #\n"
@@ -1363,10 +1372,10 @@ weechat_cmd_buffer (t_irc_server *server, t_irc_channel *channel,
if ((argc == 0) || ((argc == 1) && (ascii_strcasecmp (argv[0], "list") == 0)))
{
/* list opened buffers */
/* list open buffers */
gui_printf (NULL, "\n");
gui_printf (NULL, _("Opened buffers:\n"));
gui_printf (NULL, _("Open buffers:\n"));
for (ptr_buffer = gui_buffers; ptr_buffer; ptr_buffer = ptr_buffer->next_buffer)
{
@@ -1440,7 +1449,7 @@ weechat_cmd_buffer (t_irc_server *server, t_irc_channel *channel,
irc_display_prefix (NULL, NULL, PREFIX_ERROR);
gui_printf (NULL,
_("%s can not close server buffer while channels "
"are opened\n"),
"are open\n"),
WEECHAT_ERROR);
free_exploded_string (argv);
return -1;
@@ -2657,6 +2666,80 @@ weechat_cmd_key (t_irc_server *server, t_irc_channel *channel,
return 0;
}
/*
* weechat_cmd_panel_display_info: display infos about a panel
*/
void
weechat_cmd_panel_display_info (t_gui_panel *panel)
{
gui_printf (NULL, " %s%2d%s. ",
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
panel->number,
GUI_COLOR(COLOR_WIN_CHAT));
gui_printf (NULL, "%s%s%s ",
GUI_COLOR(COLOR_WIN_CHAT_CHANNEL),
panel->name,
GUI_COLOR(COLOR_WIN_CHAT));
gui_printf (NULL, "(%s%s/%s",
(panel->panel_window) ? _("global") : _("local"),
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT));
switch (panel->position)
{
case GUI_PANEL_TOP:
gui_printf (NULL, "%s", _("top"));
break;
case GUI_PANEL_BOTTOM:
gui_printf (NULL, "%s", _("bottom"));
break;
case GUI_PANEL_LEFT:
gui_printf (NULL, "%s", _("left"));
break;
case GUI_PANEL_RIGHT:
gui_printf (NULL, "%s", _("right"));
break;
}
gui_printf (NULL, "%s/%s%d)\n",
GUI_COLOR(COLOR_WIN_CHAT_DARK),
GUI_COLOR(COLOR_WIN_CHAT),
panel->size);
}
/*
* weechat_cmd_panel: manage panels
*/
int
weechat_cmd_panel (t_irc_server *server, t_irc_channel *channel,
int argc, char **argv)
{
t_gui_panel *ptr_panel;
/* make gcc happy */
(void) server;
(void) channel;
gui_printf (NULL, "\n/panel command is under development!\n");
if ((argc == 0) || ((argc == 1) && (ascii_strcasecmp (argv[0], "list") == 0)))
{
/* list open panels */
gui_printf (NULL, "\n");
gui_printf (NULL, _("Open panels:\n"));
for (ptr_panel = gui_panels; ptr_panel; ptr_panel = ptr_panel->next_panel)
{
weechat_cmd_panel_display_info (ptr_panel);
}
}
else
{
}
return 0;
}
/*
* weechat_cmd_plugin: list/load/unload WeeChat plugins
*/
@@ -4006,10 +4089,10 @@ weechat_cmd_window (t_irc_server *server, t_irc_channel *channel,
if ((argc == 0) || ((argc == 1) && (ascii_strcasecmp (argv[0], "list") == 0)))
{
/* list opened windows */
/* list open windows */
gui_printf (NULL, "\n");
gui_printf (NULL, _("Opened windows:\n"));
gui_printf (NULL, _("Open windows:\n"));
i = 1;
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
+1
View File
@@ -89,6 +89,7 @@ extern int weechat_cmd_history (t_irc_server *, t_irc_channel *, int, char **);
extern void weechat_cmd_ignore_display (char *, t_irc_ignore *);
extern int weechat_cmd_ignore (t_irc_server *, t_irc_channel *, int, char **);
extern int weechat_cmd_key (t_irc_server *, t_irc_channel *, char *);
extern int weechat_cmd_panel (t_irc_server *, t_irc_channel *, int, char **);
extern int weechat_cmd_plugin (t_irc_server *, t_irc_channel *, int, char **);
extern int weechat_cmd_save (t_irc_server *, t_irc_channel *, int, char **);
extern int weechat_cmd_server (t_irc_server *, t_irc_channel *, int, char **);
+4 -9
View File
@@ -937,7 +937,6 @@ weechat_dump (int crash)
t_irc_server *ptr_server;
t_irc_channel *ptr_channel;
t_irc_nick *ptr_nick;
t_irc_dcc *ptr_dcc;
t_gui_window *ptr_window;
t_gui_buffer *ptr_buffer;
@@ -984,11 +983,9 @@ weechat_dump (int crash)
}
}
weechat_log_printf ("\n");
for (ptr_dcc = dcc_list; ptr_dcc; ptr_dcc = ptr_dcc->next_dcc)
{
dcc_print_log (ptr_dcc);
}
dcc_print_log ();
gui_panel_print_log ();
weechat_log_printf ("\n");
weechat_log_printf ("[windows/buffers]\n");
@@ -1015,7 +1012,7 @@ weechat_dump (int crash)
weechat_log_printf ("\n");
gui_buffer_print_log (ptr_buffer);
}
weechat_log_printf ("\n");
ignore_print_log ();
@@ -1038,8 +1035,6 @@ weechat_sigsegv ()
fprintf (stderr, "\n");
fprintf (stderr, "*** Very bad! WeeChat is crashing (SIGSEGV received)\n");
fprintf (stderr, "*** (%s, compiled on %s %s)\n",
PACKAGE_STRING, __DATE__, __TIME__);
if (!weechat_log_crash_rename ())
fprintf (stderr, "*** Full crash dump was saved to %s/weechat.log file.\n",
weechat_home);
+2 -2
View File
@@ -174,13 +174,13 @@ gui_chat_draw_title (t_gui_buffer *buffer, int erase)
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
if (ptr_win->buffer == buffer)
if ((ptr_win->buffer == buffer) && (buffer->num_displayed > 0))
{
if (erase)
gui_window_curses_clear (GUI_CURSES(ptr_win)->win_title, COLOR_WIN_TITLE);
gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_title, COLOR_WIN_TITLE);
snprintf (format, 32, "%%-%ds", ptr_win->win_width);
snprintf (format, 32, "%%-%ds", ptr_win->win_title_width);
if (CHANNEL(buffer))
{
if (CHANNEL(buffer)->topic)
+14 -16
View File
@@ -349,7 +349,7 @@ gui_input_draw (t_gui_buffer *buffer, int erase)
prompt_length = gui_input_get_prompt_length (ptr_win, ptr_nickname);
if (ptr_win->win_width - prompt_length < 3)
if (ptr_win->win_input_width - prompt_length < 3)
{
prompt_length = 0;
display_prompt = 0;
@@ -358,9 +358,9 @@ gui_input_draw (t_gui_buffer *buffer, int erase)
display_prompt = 1;
if (buffer->input_buffer_pos - buffer->input_buffer_1st_display + 1 >
ptr_win->win_width - prompt_length)
ptr_win->win_input_width - prompt_length)
buffer->input_buffer_1st_display = buffer->input_buffer_pos -
(ptr_win->win_width - prompt_length) + 1;
(ptr_win->win_input_width - prompt_length) + 1;
else
{
if (buffer->input_buffer_pos < buffer->input_buffer_1st_display)
@@ -370,11 +370,11 @@ gui_input_draw (t_gui_buffer *buffer, int erase)
if ((buffer->input_buffer_1st_display > 0) &&
(buffer->input_buffer_pos -
buffer->input_buffer_1st_display + 1)
< ptr_win->win_width - prompt_length)
< ptr_win->win_input_width - prompt_length)
{
buffer->input_buffer_1st_display =
buffer->input_buffer_pos -
(ptr_win->win_width - prompt_length) + 1;
(ptr_win->win_input_width - prompt_length) + 1;
if (buffer->input_buffer_1st_display < 0)
buffer->input_buffer_1st_display = 0;
}
@@ -384,18 +384,18 @@ gui_input_draw (t_gui_buffer *buffer, int erase)
gui_input_draw_prompt (ptr_win, ptr_nickname);
gui_window_set_weechat_color (GUI_CURSES(ptr_win)->win_input, COLOR_WIN_INPUT);
snprintf (format, 32, "%%-%ds", ptr_win->win_width - prompt_length);
snprintf (format, 32, "%%-%ds", ptr_win->win_input_width - prompt_length);
offset_cursor = 0;
if (ptr_win == gui_current_window)
offset_cursor = gui_input_draw_text (ptr_win,
ptr_win->win_width - prompt_length);
ptr_win->win_input_width - prompt_length);
else
wprintw (GUI_CURSES(ptr_win)->win_input, format, "");
wclrtoeol (GUI_CURSES(ptr_win)->win_input);
ptr_win->win_input_x = prompt_length + offset_cursor;
ptr_win->win_input_cursor_x = prompt_length + offset_cursor;
if (ptr_win == gui_current_window)
move (ptr_win->win_y + ptr_win->win_height - 1,
ptr_win->win_x + ptr_win->win_input_x);
move (ptr_win->win_input_y,
ptr_win->win_input_x + ptr_win->win_input_cursor_x);
}
break;
case BUFFER_TYPE_DCC:
@@ -424,18 +424,16 @@ gui_input_draw (t_gui_buffer *buffer, int erase)
wprintw (GUI_CURSES(ptr_win)->win_input, _(" [P] Purge old DCC"));
wprintw (GUI_CURSES(ptr_win)->win_input, _(" [Q] Close DCC view"));
wclrtoeol (GUI_CURSES(ptr_win)->win_input);
ptr_win->win_input_x = 0;
ptr_win->win_input_cursor_x = 0;
if (ptr_win == gui_current_window)
move (ptr_win->win_y + ptr_win->win_height - 1,
ptr_win->win_x);
move (ptr_win->win_input_y, ptr_win->win_input_x);
break;
case BUFFER_TYPE_RAW_DATA:
mvwprintw (GUI_CURSES(ptr_win)->win_input, 0, 0, _(" [Q] Close raw data view"));
wclrtoeol (GUI_CURSES(ptr_win)->win_input);
ptr_win->win_input_x = 0;
ptr_win->win_input_cursor_x = 0;
if (ptr_win == gui_current_window)
move (ptr_win->win_y + ptr_win->win_height - 1,
ptr_win->win_x);
move (ptr_win->win_input_y, ptr_win->win_input_x);
break;
}
doupdate ();
+9 -6
View File
@@ -143,9 +143,12 @@ gui_keyboard_default_bindings ()
void
gui_keyboard_grab_end ()
{
char *expanded_key, *expanded_key2;
int length;
char *expanded_key;
char *buffer_before_key;
#ifdef PLUGINS
char *expanded_key2;
int length;
#endif
/* get expanded name (for example: ^U => ctrl-u) */
expanded_key = gui_keyboard_get_expanded_name (gui_key_buffer);
@@ -193,8 +196,11 @@ void
gui_keyboard_read ()
{
int key, i, insert_ok;
char key_str[32], key_str2[33];
char key_str[32];
char *buffer_before_key;
#ifdef PLUGINS
char key_str2[33];
#endif
i = 0;
/* do not loop too much here (for example when big paste was made),
@@ -215,10 +221,7 @@ gui_keyboard_read ()
}
if (key == KEY_RESIZE)
{
gui_window_refresh_screen ();
continue;
}
gui_last_activity_time = time (NULL);
+3 -3
View File
@@ -73,7 +73,7 @@ gui_main_loop ()
{
/* refresh needed ? */
if (gui_refresh_screen_needed)
gui_window_refresh_screen ();
gui_window_refresh_screen (0);
new_time = time (NULL);
local_time = localtime (&new_time);
@@ -112,7 +112,7 @@ gui_main_loop ()
{
gui_infobar_draw_time (gui_current_window->buffer);
wmove (GUI_CURSES(gui_current_window)->win_input,
0, gui_current_window->win_input_x);
0, gui_current_window->win_input_cursor_x);
wrefresh (GUI_CURSES(gui_current_window)->win_input);
}
@@ -291,7 +291,7 @@ gui_main_init ()
gui_infobar = NULL;
gui_ok = ((COLS > 5) && (LINES > 5));
gui_ok = ((COLS > WINDOW_MIN_WIDTH) && (LINES > WINDOW_MIN_HEIGHT));
refresh ();
+2 -2
View File
@@ -36,7 +36,7 @@
*/
void
gui_nicklist_draw (t_gui_buffer *buffer, int erase)
gui_nicklist_draw (t_gui_buffer *buffer, int erase, int calculate_size)
{
t_gui_window *ptr_win;
int i, j, x, y, x2, column, max_length, nicks_displayed;
@@ -52,7 +52,7 @@ gui_nicklist_draw (t_gui_buffer *buffer, int erase)
{
max_length = nick_get_max_length (CHANNEL(buffer));
if (gui_window_calculate_pos_size (ptr_win, 0))
if (calculate_size && (gui_window_calculate_pos_size (ptr_win, 0)))
{
delwin (GUI_CURSES(ptr_win)->win_chat);
delwin (GUI_CURSES(ptr_win)->win_nick);
+19 -4
View File
@@ -33,11 +33,13 @@
/*
* gui_panel_get_size: get total panel size for a position
* gui_panel_windows_get_size: get total panel size (window panels) for a position
* panel is optional, if not NULL, size is computed
* from panel 1 to panel # - 1
*/
int
gui_panel_get_size (t_gui_window *window, int position)
gui_panel_window_get_size (t_gui_panel *panel, t_gui_window *window, int position)
{
t_gui_panel_window *ptr_panel_win;
int total_size;
@@ -46,6 +48,10 @@ gui_panel_get_size (t_gui_window *window, int position)
for (ptr_panel_win = GUI_CURSES(window)->panel_windows; ptr_panel_win;
ptr_panel_win = ptr_panel_win->next_panel_window)
{
/* stop before panel */
if ((panel) && (ptr_panel_win->panel == panel))
return total_size;
if (ptr_panel_win->panel->position == position)
{
switch (position)
@@ -76,6 +82,7 @@ gui_panel_window_new (t_gui_panel *panel, t_gui_window *window)
{
t_gui_panel_window *new_panel_win;
int x1, y1, x2, y2;
int add_top, add_bottom, add_left, add_right;
if (window)
{
@@ -83,6 +90,10 @@ gui_panel_window_new (t_gui_panel *panel, t_gui_window *window)
y1 = window->win_y + 1;
x2 = x1 + window->win_width - 1;
y2 = y1 + window->win_height - 1 - 4;
add_left = gui_panel_window_get_size (panel, window, GUI_PANEL_LEFT);
add_right = gui_panel_window_get_size (panel, window, GUI_PANEL_RIGHT);
add_top = gui_panel_window_get_size (panel, window, GUI_PANEL_TOP);
add_bottom = gui_panel_window_get_size (panel, window, GUI_PANEL_BOTTOM);
}
else
{
@@ -90,6 +101,10 @@ gui_panel_window_new (t_gui_panel *panel, t_gui_window *window)
y1 = 0;
x2 = gui_window_get_width () - 1;
y2 = gui_window_get_height () - 1;
add_left = gui_panel_global_get_size (panel, GUI_PANEL_LEFT);
add_right = gui_panel_global_get_size (panel, GUI_PANEL_RIGHT);
add_top = gui_panel_global_get_size (panel, GUI_PANEL_TOP);
add_bottom = gui_panel_global_get_size (panel, GUI_PANEL_BOTTOM);
}
if ((new_panel_win = (t_gui_panel_window *) malloc (sizeof (t_gui_panel_window))))
@@ -109,8 +124,8 @@ gui_panel_window_new (t_gui_panel *panel, t_gui_window *window)
switch (panel->position)
{
case GUI_PANEL_TOP:
new_panel_win->x = x1;
new_panel_win->y = y1;
new_panel_win->x = x1 + add_left;
new_panel_win->y = y1 + add_top;
new_panel_win->width = x2 - x1 + 1;
new_panel_win->height = panel->size;
break;
+2 -2
View File
@@ -361,10 +361,10 @@ gui_status_draw (t_gui_buffer *buffer, int erase)
if (BUFFER_HAS_NICKLIST(ptr_win->buffer))
{
snprintf (str_nicks, sizeof (str_nicks) - 1, "%d", CHANNEL(ptr_win->buffer)->nicks_count);
x = ptr_win->win_width - strlen (str_nicks) - 4;
x = ptr_win->win_status_width - strlen (str_nicks) - 4;
}
else
x = ptr_win->win_width - 2;
x = ptr_win->win_status_width - 2;
more = strdup (_("-MORE-"));
x -= strlen (more) - 1;
if (x < 0)
+152 -89
View File
@@ -175,10 +175,10 @@ gui_window_calculate_pos_size (t_gui_window *window, int force_calculate)
if (!gui_ok)
return 0;
add_left = gui_panel_get_size (window, GUI_PANEL_LEFT);
add_right = gui_panel_get_size (window, GUI_PANEL_RIGHT);
add_top = gui_panel_get_size (window, GUI_PANEL_TOP);
add_bottom = gui_panel_get_size (window, GUI_PANEL_BOTTOM);
add_left = gui_panel_window_get_size (NULL, window, GUI_PANEL_LEFT);
add_right = gui_panel_window_get_size (NULL, window, GUI_PANEL_RIGHT);
add_top = gui_panel_window_get_size (NULL, window, GUI_PANEL_TOP);
add_bottom = gui_panel_window_get_size (NULL, window, GUI_PANEL_BOTTOM);
/* init chat & nicklist settings */
if (cfg_look_nicklist && BUFFER_IS_CHANNEL(window->buffer))
@@ -203,16 +203,17 @@ gui_window_calculate_pos_size (t_gui_window *window, int force_calculate)
{
nick_count (CHANNEL(window->buffer), &num_nicks, &num_op,
&num_halfop, &num_voice, &num_normal);
if (((max_length + 2) * num_nicks) % window->win_width == 0)
lines = ((max_length + 2) * num_nicks) / window->win_width;
if (((max_length + 2) * num_nicks) % (window->win_width - add_left - add_right) == 0)
lines = ((max_length + 2) * num_nicks) / (window->win_width - add_left - add_right);
else
lines = (((max_length + 2) * num_nicks) / window->win_width) + 1;
lines = (((max_length + 2) * num_nicks) / (window->win_width - add_left - add_right)) + 1;
if ((cfg_look_nicklist_max_size > 0) && (lines > cfg_look_nicklist_max_size))
lines = cfg_look_nicklist_max_size;
if ((cfg_look_nicklist_min_size > 0) && (lines < cfg_look_nicklist_min_size))
lines = cfg_look_nicklist_min_size;
max_height = (cfg_look_infobar) ?
window->win_height - 3 - 4 : window->win_height - 2 - 4;
window->win_height - add_top - add_bottom - 3 - 4 :
window->win_height - add_top - add_bottom - 2 - 4;
if (lines > max_height)
lines = max_height;
if (!force_calculate && (window->win_nick_height == lines + 1))
@@ -223,95 +224,132 @@ gui_window_calculate_pos_size (t_gui_window *window, int force_calculate)
{
case CFG_LOOK_NICKLIST_LEFT:
window->win_chat_x = window->win_x + add_left + max_length + 2;
window->win_chat_y = window->win_y + 1;
window->win_chat_width = window->win_width - add_left - max_length - 2;
window->win_nick_x = window->win_x + 0;
window->win_nick_y = window->win_y + 1;
window->win_chat_y = window->win_y + add_top + 1;
window->win_chat_width = window->win_width - add_left - add_right - max_length - 2;
window->win_nick_x = window->win_x + add_left + 0;
window->win_nick_y = window->win_y + add_top + 1;
window->win_nick_width = max_length + 2;
if (cfg_look_infobar)
{
window->win_chat_height = window->win_height - 4;
window->win_nick_height = window->win_height - 4;
window->win_chat_height = window->win_height - add_top - add_bottom - 4;
window->win_nick_height = window->win_height - add_top - add_bottom - 4;
}
else
{
window->win_chat_height = window->win_height - 3;
window->win_nick_height = window->win_height - 3;
window->win_chat_height = window->win_height - add_top - add_bottom - 3;
window->win_nick_height = window->win_height - add_top - add_bottom - 3;
}
window->win_nick_num_max = window->win_nick_height;
break;
case CFG_LOOK_NICKLIST_RIGHT:
window->win_chat_x = window->win_x + add_left;
window->win_chat_y = window->win_y + 1;
window->win_chat_width = window->win_width - add_left - max_length - 2;
window->win_nick_x = window->win_x + window->win_width - max_length - 2;
window->win_nick_y = window->win_y + 1;
window->win_chat_y = window->win_y + add_top + 1;
window->win_chat_width = window->win_width - add_left - add_right - max_length - 2;
window->win_nick_x = window->win_x + window->win_width - add_right - max_length - 2;
window->win_nick_y = window->win_y + add_top + 1;
window->win_nick_width = max_length + 2;
if (cfg_look_infobar)
{
window->win_chat_height = window->win_height - 4;
window->win_nick_height = window->win_height - 4;
window->win_chat_height = window->win_height - add_top - add_bottom - 4;
window->win_nick_height = window->win_height - add_top - add_bottom - 4;
}
else
{
window->win_chat_height = window->win_height - 3;
window->win_nick_height = window->win_height - 3;
window->win_chat_height = window->win_height - add_top - add_bottom - 3;
window->win_nick_height = window->win_height - add_top - add_bottom - 3;
}
window->win_nick_num_max = window->win_nick_height;
break;
case CFG_LOOK_NICKLIST_TOP:
window->win_chat_x = window->win_x + add_left;
window->win_chat_y = window->win_y + 1 + (lines + 1);
window->win_chat_width = window->win_width - add_left;
window->win_chat_y = window->win_y + add_top + 1 + (lines + 1);
window->win_chat_width = window->win_width - add_left - add_right;
if (cfg_look_infobar)
window->win_chat_height = window->win_height - 3 - (lines + 1) - 1;
window->win_chat_height = window->win_height - add_top - add_bottom - 3 - (lines + 1) - 1;
else
window->win_chat_height = window->win_height - 3 - (lines + 1);
window->win_nick_x = window->win_x;
window->win_nick_y = window->win_y + 1;
window->win_nick_width = window->win_width;
window->win_chat_height = window->win_height - add_top - add_bottom - 3 - (lines + 1);
window->win_nick_x = window->win_x + add_left;
window->win_nick_y = window->win_y + add_top + 1;
window->win_nick_width = window->win_width - add_left - add_right;
window->win_nick_height = lines + 1;
window->win_nick_num_max = lines * (window->win_nick_width / (max_length + 2));
break;
case CFG_LOOK_NICKLIST_BOTTOM:
window->win_chat_x = window->win_x + add_left;
window->win_chat_y = window->win_y + 1;
window->win_chat_width = window->win_width - add_left;
window->win_chat_y = window->win_y + add_top + 1;
window->win_chat_width = window->win_width - add_left - add_right;
if (cfg_look_infobar)
window->win_chat_height = window->win_height - 3 - (lines + 1) - 1;
window->win_chat_height = window->win_height - add_top - add_bottom - 3 - (lines + 1) - 1;
else
window->win_chat_height = window->win_height - 3 - (lines + 1);
window->win_nick_x = window->win_x;
window->win_chat_height = window->win_height - add_top - add_bottom - 3 - (lines + 1);
window->win_nick_x = window->win_x + add_left;
if (cfg_look_infobar)
window->win_nick_y = window->win_y + window->win_height - 2 - (lines + 1) - 1;
window->win_nick_y = window->win_y + window->win_height - add_bottom - 2 - (lines + 1) - 1;
else
window->win_nick_y = window->win_y + window->win_height - 2 - (lines + 1);
window->win_nick_width = window->win_width;
window->win_nick_y = window->win_y + window->win_height - add_bottom - 2 - (lines + 1);
window->win_nick_width = window->win_width - add_left - add_right;
window->win_nick_height = lines + 1;
window->win_nick_num_max = lines * (window->win_nick_width / (max_length + 2));
break;
}
window->win_chat_cursor_x = window->win_x;
window->win_chat_cursor_y = window->win_y;
window->win_chat_cursor_x = window->win_x + add_left;
window->win_chat_cursor_y = window->win_y + add_top;
}
else
{
window->win_chat_x = window->win_x + add_left;
window->win_chat_y = window->win_y + 1;
window->win_chat_width = window->win_width - add_left;
window->win_chat_y = window->win_y + add_top + 1;
window->win_chat_width = window->win_width - add_left - add_right;
if (cfg_look_infobar)
window->win_chat_height = window->win_height - 4;
window->win_chat_height = window->win_height - add_top - add_bottom - 4;
else
window->win_chat_height = window->win_height - 3;
window->win_chat_height = window->win_height - add_top - add_bottom - 3;
window->win_chat_cursor_x = window->win_x + add_left;
window->win_chat_cursor_y = window->win_y;
window->win_chat_cursor_y = window->win_y + add_top;
window->win_nick_x = -1;
window->win_nick_y = -1;
window->win_nick_width = -1;
window->win_nick_height = -1;
window->win_nick_num_max = -1;
}
/* title window */
window->win_title_x = window->win_x;
window->win_title_y = window->win_y;
window->win_title_width = window->win_width;
window->win_title_height = 1;
/* status window */
window->win_status_x = window->win_x;
if (cfg_look_infobar)
window->win_status_y = window->win_y + window->win_height - 3;
else
window->win_status_y = window->win_y + window->win_height - 2;
window->win_status_width = window->win_width;
window->win_status_height = 1;
/* infobar window */
if (cfg_look_infobar)
{
window->win_infobar_x = window->win_x;
window->win_infobar_y = window->win_y + window->win_height - 2;
window->win_infobar_width = window->win_width;
window->win_infobar_height = 1;
}
else
{
window->win_infobar_x = -1;
window->win_infobar_y = -1;
window->win_infobar_width = -1;
window->win_infobar_height = -1;
}
/* input window */
window->win_input_x = window->win_x;
window->win_input_y = window->win_y + window->win_height - 1;
window->win_input_width = window->win_width;
window->win_input_height = 1;
return 1;
}
@@ -358,7 +396,7 @@ gui_window_redraw_buffer (t_gui_buffer *buffer)
gui_chat_draw_title (buffer, 1);
gui_chat_draw (buffer, 1);
if (GUI_CURSES(ptr_win)->win_nick)
gui_nicklist_draw (buffer, 1);
gui_nicklist_draw (buffer, 1, 0);
gui_status_draw (buffer, 1);
if (cfg_look_infobar)
gui_infobar_draw (buffer, 1);
@@ -377,7 +415,7 @@ gui_window_switch_to_buffer (t_gui_window *window, t_gui_buffer *buffer)
{
if (!gui_ok)
return;
if (window->buffer->num_displayed > 0)
window->buffer->num_displayed--;
@@ -390,20 +428,21 @@ gui_window_switch_to_buffer (t_gui_window *window, t_gui_buffer *buffer)
window->buffer = buffer;
window->win_nick_start = 0;
gui_window_calculate_pos_size (window, 1);
/* destroy Curses windows */
gui_window_objects_free (window, 0);
/* create Curses windows */
GUI_CURSES(window)->win_title = newwin (1,
window->win_width,
window->win_y,
window->win_x);
GUI_CURSES(window)->win_input = newwin (1,
window->win_width,
window->win_y + window->win_height - 1,
window->win_x);
GUI_CURSES(window)->win_title = newwin (window->win_title_height,
window->win_title_width,
window->win_title_y,
window->win_title_x);
GUI_CURSES(window)->win_input = newwin (window->win_input_height,
window->win_input_width,
window->win_input_y,
window->win_input_x);
if (BUFFER_IS_CHANNEL(buffer))
{
if (GUI_CURSES(window)->win_chat)
@@ -432,22 +471,19 @@ gui_window_switch_to_buffer (t_gui_window *window, t_gui_buffer *buffer)
/* create status/infobar windows */
if (cfg_look_infobar)
{
GUI_CURSES(window)->win_infobar = newwin (1, window->win_width,
window->win_y + window->win_height - 2,
window->win_x);
GUI_CURSES(window)->win_status = newwin (1, window->win_width,
window->win_y + window->win_height - 3,
window->win_x);
}
else
GUI_CURSES(window)->win_status = newwin (1, window->win_width,
window->win_y + window->win_height - 2,
window->win_x);
GUI_CURSES(window)->win_infobar = newwin (window->win_infobar_height,
window->win_infobar_width,
window->win_infobar_y,
window->win_infobar_x);
GUI_CURSES(window)->win_status = newwin (window->win_status_height,
window->win_status_width,
window->win_status_y,
window->win_status_x);
window->start_line = NULL;
window->start_line_pos = 0;
buffer->num_displayed++;
hotlist_remove_buffer (buffer);
@@ -623,7 +659,7 @@ gui_window_nick_beginning (t_gui_window *window)
if (window->win_nick_start > 0)
{
window->win_nick_start = 0;
gui_nicklist_draw (window->buffer, 1);
gui_nicklist_draw (window->buffer, 1, 0);
}
}
}
@@ -652,7 +688,7 @@ gui_window_nick_end (t_gui_window *window)
if (new_start != window->win_nick_start)
{
window->win_nick_start = new_start;
gui_nicklist_draw (window->buffer, 1);
gui_nicklist_draw (window->buffer, 1, 0);
}
}
}
@@ -674,7 +710,7 @@ gui_window_nick_page_up (t_gui_window *window)
window->win_nick_start -= (window->win_nick_num_max - 1);
if (window->win_nick_start <= 1)
window->win_nick_start = 0;
gui_nicklist_draw (window->buffer, 1);
gui_nicklist_draw (window->buffer, 1, 0);
}
}
}
@@ -699,7 +735,7 @@ gui_window_nick_page_down (t_gui_window *window)
window->win_nick_start += (window->win_nick_num_max - 1);
else
window->win_nick_start += (window->win_nick_num_max - 2);
gui_nicklist_draw (window->buffer, 1);
gui_nicklist_draw (window->buffer, 1, 0);
}
}
}
@@ -778,17 +814,19 @@ gui_window_refresh_windows ()
gui_window_get_width (),
gui_window_get_height (), 0) < 0)
gui_window_merge_all (gui_current_window);
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
gui_window_switch_to_buffer (ptr_win, ptr_win->buffer);
}
for (ptr_win = gui_windows; ptr_win; ptr_win = ptr_win->next_window)
{
gui_window_redraw_buffer (ptr_win->buffer);
gui_window_draw_separator (ptr_win);
}
gui_current_window = old_current_window;
gui_window_switch_to_buffer (gui_current_window, gui_current_window->buffer);
gui_window_redraw_buffer (gui_current_window->buffer);
}
}
@@ -1133,24 +1171,32 @@ gui_window_switch_right (t_gui_window *window)
/*
* gui_window_refresh_screen: called when term size is modified
* force == 1 when Ctrl+L is pressed
*/
void
gui_window_refresh_screen ()
gui_window_refresh_screen (int force)
{
int new_height, new_width;
endwin ();
refresh ();
getmaxyx (stdscr, new_height, new_width);
gui_ok = ((new_width > WINDOW_MIN_WIDTH) && (new_height > WINDOW_MIN_HEIGHT));
if (gui_ok)
gui_window_refresh_windows ();
gui_refresh_screen_needed = 0;
if (force || (gui_refresh_screen_needed == 1))
{
endwin ();
refresh ();
getmaxyx (stdscr, new_height, new_width);
gui_ok = ((new_width > WINDOW_MIN_WIDTH) && (new_height > WINDOW_MIN_HEIGHT));
if (gui_ok)
{
refresh ();
gui_window_refresh_windows ();
}
}
if (!force && (gui_refresh_screen_needed > 0))
gui_refresh_screen_needed--;
}
/*
@@ -1160,7 +1206,8 @@ gui_window_refresh_screen ()
void
gui_window_refresh_screen_sigwinch ()
{
gui_refresh_screen_needed = 1;
if (gui_refresh_screen_needed < 2)
gui_refresh_screen_needed++;
signal (SIGWINCH, gui_window_refresh_screen_sigwinch);
}
@@ -1253,6 +1300,8 @@ gui_window_reset_title ()
void
gui_window_objects_print_log (t_gui_window *window)
{
t_gui_panel_window *ptr_panel_win;
weechat_log_printf (" win_title . . . . . : 0x%X\n", GUI_CURSES(window)->win_title);
weechat_log_printf (" win_chat. . . . . . : 0x%X\n", GUI_CURSES(window)->win_chat);
weechat_log_printf (" win_nick. . . . . . : 0x%X\n", GUI_CURSES(window)->win_nick);
@@ -1260,4 +1309,18 @@ gui_window_objects_print_log (t_gui_window *window)
weechat_log_printf (" win_infobar . . . . : 0x%X\n", GUI_CURSES(window)->win_infobar);
weechat_log_printf (" win_input . . . . . : 0x%X\n", GUI_CURSES(window)->win_input);
weechat_log_printf (" win_separator . . . : 0x%X\n", GUI_CURSES(window)->win_separator);
for (ptr_panel_win = GUI_CURSES(window)->panel_windows;
ptr_panel_win; ptr_panel_win = ptr_panel_win->next_panel_window)
{
weechat_log_printf ("\n");
weechat_log_printf (" [window panel (addr:0x%X)]\n", ptr_panel_win);
weechat_log_printf (" panel . . . . . . : 0x%X\n", ptr_panel_win->panel);
weechat_log_printf (" x . . . . . . . . : %d\n", ptr_panel_win->x);
weechat_log_printf (" y . . . . . . . . : %d\n", ptr_panel_win->y);
weechat_log_printf (" width . . . . . . : %d\n", ptr_panel_win->width);
weechat_log_printf (" height. . . . . . : %d\n", ptr_panel_win->height);
weechat_log_printf (" win_panel . . . . : 0x%X\n", ptr_panel_win->win_panel);
weechat_log_printf (" win_separator . . : 0x%X\n", ptr_panel_win->win_separator);
weechat_log_printf (" next_panel_window : 0x%X\n", ptr_panel_win->next_panel_window);
}
}
+4 -1
View File
@@ -39,6 +39,9 @@
#define WEECHAT_COLOR_CYAN COLOR_YELLOW
#define WEECHAT_COLOR_WHITE COLOR_WHITE
#define WINDOW_MIN_WIDTH 10
#define WINDOW_MIN_HEIGHT 5
#define GUI_CURSES(window) ((t_gui_curses_objects *)(window->gui_objects))
typedef struct t_gui_panel_window t_gui_panel_window;
@@ -92,7 +95,7 @@ extern void gui_window_set_title ();
extern void gui_window_reset_title ();
/* panel functions */
extern int gui_panel_get_size (t_gui_window *, int);
extern int gui_panel_window_get_size (t_gui_panel *, t_gui_window *, int);
extern void gui_panel_redraw_buffer (t_gui_buffer *);
#endif /* gui-curses.h */
+2 -1
View File
@@ -36,7 +36,7 @@
*/
void
gui_nicklist_draw (t_gui_buffer *buffer, int erase)
gui_nicklist_draw (t_gui_buffer *buffer, int erase, int calculate_size)
{
/*t_gui_window *ptr_win;
int i, j, x, y, column, max_length, nicks_displayed;
@@ -49,4 +49,5 @@ gui_nicklist_draw (t_gui_buffer *buffer, int erase)
/* TODO: write this function for Gtk */
(void) buffer;
(void) erase;
(void) calculate_size;
}
+6 -10
View File
@@ -386,7 +386,7 @@ gui_window_nick_beginning (t_gui_window *window)
if (window->win_nick_start > 0)
{
window->win_nick_start = 0;
gui_nicklist_draw (window->buffer, 1);
gui_nicklist_draw (window->buffer, 1, 0);
}
}
}
@@ -415,7 +415,7 @@ gui_window_nick_end (t_gui_window *window)
if (new_start != window->win_nick_start)
{
window->win_nick_start = new_start;
gui_nicklist_draw (window->buffer, 1);
gui_nicklist_draw (window->buffer, 1, 0);
}
}
}
@@ -437,7 +437,7 @@ gui_window_nick_page_up (t_gui_window *window)
window->win_nick_start -= (window->win_nick_height - 1);
if (window->win_nick_start <= 1)
window->win_nick_start = 0;
gui_nicklist_draw (window->buffer, 1);
gui_nicklist_draw (window->buffer, 1, 0);
}
}
}
@@ -462,7 +462,7 @@ gui_window_nick_page_down (t_gui_window *window)
window->win_nick_start += (window->win_nick_height - 1);
else
window->win_nick_start += (window->win_nick_height - 2);
gui_nicklist_draw (window->buffer, 1);
gui_nicklist_draw (window->buffer, 1, 0);
}
}
}
@@ -485,8 +485,6 @@ gui_window_auto_resize (t_gui_window_tree *tree,
{
if (tree->window)
{
if ((width < WINDOW_MIN_WIDTH) || (height < WINDOW_MIN_HEIGHT))
return -1;
if (!simulate)
{
tree->window->win_x = x;
@@ -555,8 +553,7 @@ gui_window_split_horiz (t_gui_window *window, int pourcentage)
height1 = (window->win_height * pourcentage) / 100;
height2 = window->win_height - height1;
if ((height1 >= WINDOW_MIN_HEIGHT) && (height2 >= WINDOW_MIN_HEIGHT)
&& (pourcentage > 0) && (pourcentage <= 100))
if ((pourcentage > 0) && (pourcentage <= 100))
{
if ((new_window = gui_window_new (window,
window->win_x, window->win_y,
@@ -597,8 +594,7 @@ gui_window_split_vertic (t_gui_window *window, int pourcentage)
width1 = (window->win_width * pourcentage) / 100;
width2 = window->win_width - width1 - 1;
if ((width1 >= WINDOW_MIN_WIDTH) && (width2 >= WINDOW_MIN_WIDTH)
&& (pourcentage > 0) && (pourcentage <= 100))
if ((pourcentage > 0) && (pourcentage <= 100))
{
if ((new_window = gui_window_new (window,
window->win_x + width1 + 1, window->win_y,
+1 -1
View File
@@ -1200,7 +1200,7 @@ gui_action_refresh_screen (t_gui_window *window)
/* make gcc happy */
(void) window;
gui_window_refresh_screen ();
gui_window_refresh_screen (1);
}
/*
+63 -2
View File
@@ -35,18 +35,55 @@
#include "../common/weechat.h"
#include "gui.h"
#include "../common/log.h"
t_gui_panel *gui_panels = NULL; /* pointer to first panel */
t_gui_panel *last_gui_panel = NULL; /* pointer to last panel */
/*
* gui_panel_global_get_size: get total panel size (global panels) for a position
*/
int
gui_panel_global_get_size (t_gui_panel *panel, int position)
{
t_gui_panel *ptr_panel;
int total_size;
total_size = 0;
for (ptr_panel = gui_panels; ptr_panel; ptr_panel = ptr_panel->next_panel)
{
if ((panel) && (ptr_panel == panel))
return total_size;
if (ptr_panel->position == position)
{
switch (position)
{
case GUI_PANEL_TOP:
case GUI_PANEL_BOTTOM:
total_size += ptr_panel->size;
break;
case GUI_PANEL_LEFT:
case GUI_PANEL_RIGHT:
total_size += ptr_panel->size;
break;
}
if (ptr_panel->separator)
total_size++;
}
}
return total_size;
}
/*
* gui_panel_new: create a new panel
*/
t_gui_panel *
gui_panel_new (char *name, int position, int type, int size, int separator)
gui_panel_new (char *name, int type, int position, int size, int separator)
{
t_gui_panel *new_panel;
t_gui_window *ptr_win;
@@ -56,8 +93,9 @@ gui_panel_new (char *name, int position, int type, int size, int separator)
if ((new_panel = (t_gui_panel *) malloc (sizeof (t_gui_panel))))
{
new_panel->position = position;
new_panel->number = (last_gui_panel) ? last_gui_panel->number + 1 : 1;
new_panel->name = strdup (name);
new_panel->position = position;
new_panel->separator = separator;
new_panel->size = size;
if (type == GUI_PANEL_WINDOWS)
@@ -111,3 +149,26 @@ gui_panel_free (t_gui_panel *panel)
free (panel);
}
/*
* gui_panel_print_log: print panel infos in log (usually for crash dump)
*/
void
gui_panel_print_log ()
{
t_gui_panel *ptr_panel;
for (ptr_panel = gui_panels; ptr_panel; ptr_panel = ptr_panel->next_panel)
{
weechat_log_printf ("\n");
weechat_log_printf ("[panel (addr:0x%X)]\n", ptr_panel);
weechat_log_printf (" position. . . . . . : %d\n", ptr_panel->position);
weechat_log_printf (" name. . . . . . . . : '%s'\n", ptr_panel->name);
weechat_log_printf (" panel_window. . . . : 0x%X\n", ptr_panel->panel_window);
weechat_log_printf (" separator . . . . . : %d\n", ptr_panel->separator);
weechat_log_printf (" size. . . . . . . . : %d\n", ptr_panel->size);
weechat_log_printf (" prev_panel . .. . . : 0x%X\n", ptr_panel->prev_panel);
weechat_log_printf (" next_panel . .. . . : 0x%X\n", ptr_panel->next_panel);
}
}
+6 -5
View File
@@ -23,11 +23,11 @@
#define GUI_PANEL_TOP 1
#define GUI_PANEL_BOTTOM 2
#define GUI_PANEL_LEFT 3
#define GUI_PANEL_RIGHT 4
#define GUI_PANEL_LEFT 4
#define GUI_PANEL_RIGHT 8
#define GUI_PANEL_GLOBAL 0
#define GUI_PANEL_WINDOWS 1
#define GUI_PANEL_GLOBAL 1
#define GUI_PANEL_WINDOWS 2
/* panel structure */
@@ -36,8 +36,9 @@ typedef struct t_gui_panel t_gui_panel;
struct t_gui_panel
{
int position; /* position (top, bottom, left, right) */
int number; /* panel number */
char *name; /* panel name */
int position; /* position (top, bottom, left, right) */
void *panel_window; /* pointer to panel window, NULL if */
/* displayed on each window (in this */
/* case, pointers are in windows) */
+18 -2
View File
@@ -213,7 +213,7 @@ gui_window_new (t_gui_window *parent, int x, int y, int width, int height,
new_window->win_nick_num_max = 0;
new_window->win_nick_start = 0;
new_window->win_input_x = 0;
new_window->win_input_cursor_x = 0;
new_window->dcc_first = NULL;
new_window->dcc_selected = NULL;
@@ -409,6 +409,23 @@ gui_window_print_log (t_gui_window *window)
weechat_log_printf (" win_nick_width. . . : %d\n", window->win_nick_width);
weechat_log_printf (" win_nick_height . . : %d\n", window->win_nick_height);
weechat_log_printf (" win_nick_start. . . : %d\n", window->win_nick_start);
weechat_log_printf (" win_title_x . . . . : %d\n", window->win_title_x);
weechat_log_printf (" win_title_y . . . . : %d\n", window->win_title_y);
weechat_log_printf (" win_title_width . . : %d\n", window->win_title_width);
weechat_log_printf (" win_title_height. . : %d\n", window->win_title_height);
weechat_log_printf (" win_status_x. . . . : %d\n", window->win_status_x);
weechat_log_printf (" win_status_y. . . . : %d\n", window->win_status_y);
weechat_log_printf (" win_status_width. . : %d\n", window->win_status_width);
weechat_log_printf (" win_status_height . : %d\n", window->win_status_height);
weechat_log_printf (" win_infobar_x . . . : %d\n", window->win_infobar_x);
weechat_log_printf (" win_infobar_y . . . : %d\n", window->win_infobar_y);
weechat_log_printf (" win_infobar_width . : %d\n", window->win_infobar_width);
weechat_log_printf (" win_infobar_height. : %d\n", window->win_infobar_height);
weechat_log_printf (" win_input_x . . . . : %d\n", window->win_input_x);
weechat_log_printf (" win_input_y . . . . : %d\n", window->win_input_y);
weechat_log_printf (" win_input_width . . : %d\n", window->win_input_width);
weechat_log_printf (" win_input_height. . : %d\n", window->win_input_height);
weechat_log_printf (" win_input_cursor_x. : %d\n", window->win_input_cursor_x);
gui_window_objects_print_log (window);
weechat_log_printf (" dcc_first . . . . . : 0x%X\n", window->dcc_first);
weechat_log_printf (" dcc_selected. . . . : 0x%X\n", window->dcc_selected);
@@ -419,5 +436,4 @@ gui_window_print_log (t_gui_window *window)
weechat_log_printf (" start_line_pos. . . : %d\n", window->start_line_pos);
weechat_log_printf (" prev_window . . . . : 0x%X\n", window->prev_window);
weechat_log_printf (" next_window . . . . : 0x%X\n", window->next_window);
}
+24 -5
View File
@@ -21,9 +21,6 @@
#ifndef __WEECHAT_GUI_WINDOW_H
#define __WEECHAT_GUI_WINDOW_H 1
#define WINDOW_MIN_WIDTH 10
#define WINDOW_MIN_HEIGHT 5
/* window structures */
typedef struct t_gui_window_tree t_gui_window_tree;
@@ -54,9 +51,31 @@ struct t_gui_window
int win_nick_num_max; /* maximum number of nicks displayed */
int win_nick_start; /* # of 1st nick for display (scroll) */
/* title window settings */
int win_title_x; /* title window position */
int win_title_y; /* title window position */
int win_title_width; /* width of title window */
int win_title_height; /* height of title window */
/* status bar settings */
int win_status_x; /* status window position */
int win_status_y; /* status window position */
int win_status_width; /* width of status window */
int win_status_height; /* height of status window */
/* infobar bar settings */
int win_infobar_x; /* infobar window position */
int win_infobar_y; /* infobar window position */
int win_infobar_width; /* width of infobar window */
int win_infobar_height; /* height of infobar window */
/* input window settings */
int win_input_x; /* position of cursor in input window */
int win_input_x; /* input window position */
int win_input_y; /* input window position */
int win_input_width; /* width of input window */
int win_input_height; /* height of input window */
int win_input_cursor_x; /* position of cursor in input window */
/* GUI specific objects */
void *gui_objects; /* pointer to a GUI specific struct */
+3 -1
View File
@@ -100,8 +100,10 @@ extern void gui_buffer_move_to_number (t_gui_buffer *, int);
extern void gui_buffer_print_log (t_gui_buffer *);
/* panel */
extern int gui_panel_global_get_size (t_gui_panel *, int);
extern t_gui_panel *gui_panel_new (char *, int, int, int, int);
extern void gui_panel_free (t_gui_panel *);
extern void gui_panel_print_log ();
/* action */
extern void gui_action_clipboard_copy (char *, int);
@@ -220,7 +222,7 @@ extern void gui_status_draw (t_gui_buffer *, int);
extern void gui_input_draw (t_gui_buffer *, int);
/* nicklist */
extern void gui_nicklist_draw (t_gui_buffer *, int);
extern void gui_nicklist_draw (t_gui_buffer *, int, int);
/* window */
extern int gui_window_get_width ();
+1 -1
View File
@@ -403,7 +403,7 @@ channel_remove_away (t_irc_channel *channel)
{
NICK_SET_FLAG(ptr_nick, 0, NICK_AWAY);
}
gui_nicklist_draw (channel->buffer, 0);
gui_nicklist_draw (channel->buffer, 0, 0);
}
}
+34 -28
View File
@@ -1536,33 +1536,39 @@ dcc_end ()
*/
void
dcc_print_log (t_irc_dcc *dcc)
dcc_print_log ()
{
weechat_log_printf ("[DCC (addr:0x%X)]\n", dcc);
weechat_log_printf (" server. . . . . . . : 0x%X\n", dcc->server);
weechat_log_printf (" channel . . . . . . : 0x%X\n", dcc->channel);
weechat_log_printf (" type. . . . . . . . : %d\n", dcc->type);
weechat_log_printf (" status. . . . . . . : %d\n", dcc->status);
weechat_log_printf (" start_time. . . . . : %ld\n", dcc->start_time);
weechat_log_printf (" start_transfer. . . : %ld\n", dcc->start_transfer);
weechat_log_printf (" addr. . . . . . . . : %lu\n", dcc->addr);
weechat_log_printf (" port. . . . . . . . : %d\n", dcc->port);
weechat_log_printf (" nick. . . . . . . . : '%s'\n", dcc->nick);
weechat_log_printf (" sock. . . . . . . . : %d\n", dcc->sock);
weechat_log_printf (" unterminated_message: '%s'\n", dcc->unterminated_message);
weechat_log_printf (" file. . . . . . . . : %d\n", dcc->file);
weechat_log_printf (" filename. . . . . . : '%s'\n", dcc->filename);
weechat_log_printf (" local_filename. . . : '%s'\n", dcc->local_filename);
weechat_log_printf (" filename_suffix . . : %d\n", dcc->filename_suffix);
weechat_log_printf (" size. . . . . . . . : %lu\n", dcc->size);
weechat_log_printf (" pos . . . . . . . . : %lu\n", dcc->pos);
weechat_log_printf (" ack . . . . . . . . : %lu\n", dcc->ack);
weechat_log_printf (" start_resume. . . . : %lu\n", dcc->start_resume);
weechat_log_printf (" last_check_time . . : %ld\n", dcc->last_check_time);
weechat_log_printf (" last_check_pos. . . : %lu\n", dcc->last_check_pos);
weechat_log_printf (" last_activity . . . : %ld\n", dcc->last_activity);
weechat_log_printf (" bytes_per_sec . . . : %lu\n", dcc->bytes_per_sec);
weechat_log_printf (" eta . . . . . . . . : %lu\n", dcc->eta);
weechat_log_printf (" prev_dcc. . . . . . : 0x%X\n", dcc->prev_dcc);
weechat_log_printf (" next_dcc. . . . . . : 0x%X\n", dcc->next_dcc);
t_irc_dcc *ptr_dcc;
for (ptr_dcc = dcc_list; ptr_dcc; ptr_dcc = ptr_dcc->next_dcc)
{
weechat_log_printf ("\n");
weechat_log_printf ("[DCC (addr:0x%X)]\n", ptr_dcc);
weechat_log_printf (" server. . . . . . . : 0x%X\n", ptr_dcc->server);
weechat_log_printf (" channel . . . . . . : 0x%X\n", ptr_dcc->channel);
weechat_log_printf (" type. . . . . . . . : %d\n", ptr_dcc->type);
weechat_log_printf (" status. . . . . . . : %d\n", ptr_dcc->status);
weechat_log_printf (" start_time. . . . . : %ld\n", ptr_dcc->start_time);
weechat_log_printf (" start_transfer. . . : %ld\n", ptr_dcc->start_transfer);
weechat_log_printf (" addr. . . . . . . . : %lu\n", ptr_dcc->addr);
weechat_log_printf (" port. . . . . . . . : %d\n", ptr_dcc->port);
weechat_log_printf (" nick. . . . . . . . : '%s'\n", ptr_dcc->nick);
weechat_log_printf (" sock. . . . . . . . : %d\n", ptr_dcc->sock);
weechat_log_printf (" unterminated_message: '%s'\n", ptr_dcc->unterminated_message);
weechat_log_printf (" file. . . . . . . . : %d\n", ptr_dcc->file);
weechat_log_printf (" filename. . . . . . : '%s'\n", ptr_dcc->filename);
weechat_log_printf (" local_filename. . . : '%s'\n", ptr_dcc->local_filename);
weechat_log_printf (" filename_suffix . . : %d\n", ptr_dcc->filename_suffix);
weechat_log_printf (" size. . . . . . . . : %lu\n", ptr_dcc->size);
weechat_log_printf (" pos . . . . . . . . : %lu\n", ptr_dcc->pos);
weechat_log_printf (" ack . . . . . . . . : %lu\n", ptr_dcc->ack);
weechat_log_printf (" start_resume. . . . : %lu\n", ptr_dcc->start_resume);
weechat_log_printf (" last_check_time . . : %ld\n", ptr_dcc->last_check_time);
weechat_log_printf (" last_check_pos. . . : %lu\n", ptr_dcc->last_check_pos);
weechat_log_printf (" last_activity . . . : %ld\n", ptr_dcc->last_activity);
weechat_log_printf (" bytes_per_sec . . . : %lu\n", ptr_dcc->bytes_per_sec);
weechat_log_printf (" eta . . . . . . . . : %lu\n", ptr_dcc->eta);
weechat_log_printf (" prev_dcc. . . . . . : 0x%X\n", ptr_dcc->prev_dcc);
weechat_log_printf (" next_dcc. . . . . . : 0x%X\n", ptr_dcc->next_dcc);
}
}
+1 -1
View File
@@ -408,7 +408,7 @@ nick_set_away (t_irc_channel *channel, t_irc_nick *nick, int is_away)
((!is_away) && (nick->flags & NICK_AWAY)))
{
NICK_SET_FLAG(nick, is_away, NICK_AWAY);
gui_nicklist_draw (channel->buffer, 0);
gui_nicklist_draw (channel->buffer, 0, 0);
}
}
}
+10 -10
View File
@@ -442,7 +442,7 @@ irc_cmd_recv_join (t_irc_server *server, char *host, char *nick, char *arguments
ptr_nick = nick_new (server, ptr_channel, nick, 0, 0, 0, 0, 0);
if (ptr_nick)
ptr_nick->host = strdup ((pos) ? pos + 1 : host);
gui_nicklist_draw (ptr_channel->buffer, 1);
gui_nicklist_draw (ptr_channel->buffer, 1, 1);
gui_status_draw (ptr_channel->buffer, 1);
return 0;
}
@@ -523,7 +523,7 @@ irc_cmd_recv_kick (t_irc_server *server, char *host, char *nick, char *arguments
{
/* my nick was kicked => free all nicks, channel is not active any more */
nick_free_all (ptr_channel);
gui_nicklist_draw (ptr_channel->buffer, 1);
gui_nicklist_draw (ptr_channel->buffer, 1, 1);
gui_status_draw (ptr_channel->buffer, 1);
if (server->autorejoin)
irc_cmd_send_join (server, NULL, ptr_channel->name);
@@ -534,7 +534,7 @@ irc_cmd_recv_kick (t_irc_server *server, char *host, char *nick, char *arguments
if (ptr_nick)
{
nick_free (ptr_channel, ptr_nick);
gui_nicklist_draw (ptr_channel->buffer, 1);
gui_nicklist_draw (ptr_channel->buffer, 1, 1);
gui_status_draw (ptr_channel->buffer, 1);
}
}
@@ -761,7 +761,7 @@ void irc_get_channel_modes (t_irc_server *server, t_irc_channel *channel,
{
NICK_SET_FLAG(ptr_nick, (set_flag == '+'), NICK_HALFOP);
nick_resort (channel, ptr_nick);
gui_nicklist_draw (channel->buffer, 1);
gui_nicklist_draw (channel->buffer, 1, 1);
}
}
@@ -926,7 +926,7 @@ void irc_get_channel_modes (t_irc_server *server, t_irc_channel *channel,
{
NICK_SET_FLAG(ptr_nick, (set_flag == '+'), NICK_OP);
nick_resort (channel, ptr_nick);
gui_nicklist_draw (channel->buffer, 1);
gui_nicklist_draw (channel->buffer, 1, 1);
}
}
@@ -1025,7 +1025,7 @@ void irc_get_channel_modes (t_irc_server *server, t_irc_channel *channel,
{
NICK_SET_FLAG(ptr_nick, (set_flag == '+'), NICK_VOICE);
nick_resort (channel, ptr_nick);
gui_nicklist_draw (channel->buffer, 1);
gui_nicklist_draw (channel->buffer, 1, 1);
}
}
@@ -1327,7 +1327,7 @@ irc_cmd_recv_nick (t_irc_server *server, char *host, char *nick, char *arguments
GUI_COLOR(COLOR_WIN_CHAT_NICK),
arguments);
}
gui_nicklist_draw (ptr_channel->buffer, 1);
gui_nicklist_draw (ptr_channel->buffer, 1, 1);
gui_add_hotlist = 1;
}
}
@@ -1648,7 +1648,7 @@ irc_cmd_recv_part (t_irc_server *server, char *host, char *nick, char *arguments
if (ptr_channel)
{
gui_nicklist_draw (ptr_channel->buffer, 1);
gui_nicklist_draw (ptr_channel->buffer, 1, 1);
gui_status_draw (ptr_channel->buffer, 1);
}
gui_input_draw (gui_current_window->buffer, 1);
@@ -2591,7 +2591,7 @@ irc_cmd_recv_quit (t_irc_server *server, char *host, char *nick, char *arguments
arguments,
GUI_COLOR(COLOR_WIN_CHAT_DARK));
}
gui_nicklist_draw (ptr_channel->buffer, 1);
gui_nicklist_draw (ptr_channel->buffer, 1, 1);
gui_status_draw (ptr_channel->buffer, 1);
}
}
@@ -4809,7 +4809,7 @@ irc_cmd_recv_353 (t_irc_server *server, char *host, char *nick, char *arguments)
}
if (ptr_channel)
{
gui_nicklist_draw (ptr_channel->buffer, 1);
gui_nicklist_draw (ptr_channel->buffer, 1, 1);
gui_status_draw (ptr_channel->buffer, 1);
}
else
+1 -1
View File
@@ -419,7 +419,7 @@ extern void dcc_send_request (t_irc_server *, int, char *, char *);
extern void dcc_chat_sendf (t_irc_dcc *, char *, ...);
extern void dcc_handle ();
extern void dcc_end ();
extern void dcc_print_log (t_irc_dcc *);
extern void dcc_print_log ();
/* IRC display (irc-diplay.c) */