1222 |
{ |
{ |
1223 |
t_gui_window *ptr_win; |
t_gui_window *ptr_win; |
1224 |
t_weechat_hotlist *ptr_hotlist; |
t_weechat_hotlist *ptr_hotlist; |
1225 |
char format[32], str_nicks[32], *string; |
char format[32], str_nicks[32], *more; |
1226 |
int i, first_mode, x; |
int i, first_mode, x, server_pos, server_total; |
1227 |
int display_name, names_count; |
int display_name, names_count; |
1228 |
|
|
1229 |
/* make gcc happy */ |
/* make gcc happy */ |
1256 |
COLOR_WIN_STATUS_DELIMITERS); |
COLOR_WIN_STATUS_DELIMITERS); |
1257 |
wprintw (ptr_win->win_status, "] "); |
wprintw (ptr_win->win_status, "] "); |
1258 |
|
|
1259 |
/* display current server */ |
/* display "<servers>" or current server */ |
1260 |
if (SERVER(ptr_win->buffer) && SERVER(ptr_win->buffer)->name) |
if (ptr_win->buffer->all_servers) |
1261 |
|
{ |
1262 |
|
wprintw (ptr_win->win_status, "["); |
1263 |
|
gui_window_set_color (ptr_win->win_status, |
1264 |
|
COLOR_WIN_STATUS); |
1265 |
|
wprintw (ptr_win->win_status, _("<servers>")); |
1266 |
|
gui_window_set_color (ptr_win->win_status, |
1267 |
|
COLOR_WIN_STATUS_DELIMITERS); |
1268 |
|
wprintw (ptr_win->win_status, "] "); |
1269 |
|
} |
1270 |
|
else if (SERVER(ptr_win->buffer) && SERVER(ptr_win->buffer)->name) |
1271 |
{ |
{ |
1272 |
wprintw (ptr_win->win_status, "["); |
wprintw (ptr_win->win_status, "["); |
1273 |
gui_window_set_color (ptr_win->win_status, |
gui_window_set_color (ptr_win->win_status, |
1274 |
COLOR_WIN_STATUS); |
COLOR_WIN_STATUS); |
1275 |
wprintw (ptr_win->win_status, "%s", SERVER(ptr_win->buffer)->name); |
wprintw (ptr_win->win_status, "%s", SERVER(ptr_win->buffer)->name); |
1276 |
if (SERVER(ptr_win->buffer)->is_away) |
if (SERVER(ptr_win->buffer)->is_away) |
1277 |
{ |
wprintw (ptr_win->win_status, _("(away)")); |
|
string = weechat_convert_encoding ((local_utf8) ? |
|
|
cfg_look_charset_decode_iso : cfg_look_charset_decode_utf, |
|
|
(cfg_look_charset_internal && cfg_look_charset_internal[0]) ? |
|
|
cfg_look_charset_internal : local_charset, |
|
|
_("(away)")); |
|
|
wprintw (ptr_win->win_status, string); |
|
|
free (string); |
|
|
} |
|
1278 |
gui_window_set_color (ptr_win->win_status, |
gui_window_set_color (ptr_win->win_status, |
1279 |
COLOR_WIN_STATUS_DELIMITERS); |
COLOR_WIN_STATUS_DELIMITERS); |
1280 |
wprintw (ptr_win->win_status, "] "); |
wprintw (ptr_win->win_status, "] "); |
1281 |
} |
} |
1282 |
|
|
1283 |
|
/* infos about current buffer */ |
1284 |
if (SERVER(ptr_win->buffer) && !CHANNEL(ptr_win->buffer)) |
if (SERVER(ptr_win->buffer) && !CHANNEL(ptr_win->buffer)) |
1285 |
{ |
{ |
1286 |
gui_window_set_color (ptr_win->win_status, |
gui_window_set_color (ptr_win->win_status, |
1298 |
else |
else |
1299 |
wprintw (ptr_win->win_status, "(%s) ", |
wprintw (ptr_win->win_status, "(%s) ", |
1300 |
SERVER(ptr_win->buffer)->name); |
SERVER(ptr_win->buffer)->name); |
1301 |
|
if (ptr_win->buffer->all_servers) |
1302 |
|
{ |
1303 |
|
server_get_number_buffer (SERVER(ptr_win->buffer), |
1304 |
|
&server_pos, |
1305 |
|
&server_total); |
1306 |
|
gui_window_set_color (ptr_win->win_status, |
1307 |
|
COLOR_WIN_STATUS_DELIMITERS); |
1308 |
|
wprintw (ptr_win->win_status, "("); |
1309 |
|
gui_window_set_color (ptr_win->win_status, |
1310 |
|
COLOR_WIN_STATUS); |
1311 |
|
wprintw (ptr_win->win_status, "%d", server_pos); |
1312 |
|
gui_window_set_color (ptr_win->win_status, |
1313 |
|
COLOR_WIN_STATUS_DELIMITERS); |
1314 |
|
wprintw (ptr_win->win_status, "/"); |
1315 |
|
gui_window_set_color (ptr_win->win_status, |
1316 |
|
COLOR_WIN_STATUS); |
1317 |
|
wprintw (ptr_win->win_status, "%d", server_total); |
1318 |
|
gui_window_set_color (ptr_win->win_status, |
1319 |
|
COLOR_WIN_STATUS_DELIMITERS); |
1320 |
|
wprintw (ptr_win->win_status, ") "); |
1321 |
|
|
1322 |
|
} |
1323 |
} |
} |
1324 |
if (SERVER(ptr_win->buffer) && CHANNEL(ptr_win->buffer)) |
if (SERVER(ptr_win->buffer) && CHANNEL(ptr_win->buffer)) |
1325 |
{ |
{ |
1408 |
if (ptr_win->buffer->dcc) |
if (ptr_win->buffer->dcc) |
1409 |
wprintw (ptr_win->win_status, "<DCC> "); |
wprintw (ptr_win->win_status, "<DCC> "); |
1410 |
else |
else |
1411 |
{ |
wprintw (ptr_win->win_status, _("[not connected] ")); |
|
string = weechat_convert_encoding ((local_utf8) ? |
|
|
cfg_look_charset_decode_iso : cfg_look_charset_decode_utf, |
|
|
(cfg_look_charset_internal && cfg_look_charset_internal[0]) ? |
|
|
cfg_look_charset_internal : local_charset, |
|
|
_("[not connected]")); |
|
|
wprintw (ptr_win->win_status, "%s " , string); |
|
|
free (string); |
|
|
} |
|
1412 |
} |
} |
1413 |
|
|
1414 |
/* display list of other active windows (if any) with numbers */ |
/* display list of other active windows (if any) with numbers */ |
1418 |
COLOR_WIN_STATUS_DELIMITERS); |
COLOR_WIN_STATUS_DELIMITERS); |
1419 |
wprintw (ptr_win->win_status, "["); |
wprintw (ptr_win->win_status, "["); |
1420 |
gui_window_set_color (ptr_win->win_status, COLOR_WIN_STATUS); |
gui_window_set_color (ptr_win->win_status, COLOR_WIN_STATUS); |
1421 |
string = weechat_convert_encoding ((local_utf8) ? |
wprintw (ptr_win->win_status, _("Act: ")); |
|
cfg_look_charset_decode_iso : cfg_look_charset_decode_utf, |
|
|
(cfg_look_charset_internal && cfg_look_charset_internal[0]) ? |
|
|
cfg_look_charset_internal : local_charset, |
|
|
_("Act: ")); |
|
|
wprintw (ptr_win->win_status, string); |
|
|
free (string); |
|
1422 |
|
|
1423 |
names_count = 0; |
names_count = 0; |
1424 |
for (ptr_hotlist = hotlist; ptr_hotlist; |
for (ptr_hotlist = hotlist; ptr_hotlist; |
1506 |
COLOR_WIN_STATUS_DELIMITERS); |
COLOR_WIN_STATUS_DELIMITERS); |
1507 |
wprintw (ptr_win->win_status, "["); |
wprintw (ptr_win->win_status, "["); |
1508 |
gui_window_set_color (ptr_win->win_status, COLOR_WIN_STATUS); |
gui_window_set_color (ptr_win->win_status, COLOR_WIN_STATUS); |
1509 |
string = weechat_convert_encoding ((local_utf8) ? |
wprintw (ptr_win->win_status, _("Lag: %.1f"), |
|
cfg_look_charset_decode_iso : cfg_look_charset_decode_utf, |
|
|
(cfg_look_charset_internal && cfg_look_charset_internal[0]) ? |
|
|
cfg_look_charset_internal : local_charset, |
|
|
_("Lag: %.1f")); |
|
|
wprintw (ptr_win->win_status, string, |
|
1510 |
((float)(SERVER(ptr_win->buffer)->lag)) / 1000); |
((float)(SERVER(ptr_win->buffer)->lag)) / 1000); |
|
free (string); |
|
1511 |
gui_window_set_color (ptr_win->win_status, |
gui_window_set_color (ptr_win->win_status, |
1512 |
COLOR_WIN_STATUS_DELIMITERS); |
COLOR_WIN_STATUS_DELIMITERS); |
1513 |
wprintw (ptr_win->win_status, "]"); |
wprintw (ptr_win->win_status, "]"); |
1522 |
} |
} |
1523 |
else |
else |
1524 |
x = ptr_win->win_width - 2; |
x = ptr_win->win_width - 2; |
1525 |
string = weechat_convert_encoding ((local_utf8) ? |
more = strdup (_("-MORE-")); |
1526 |
cfg_look_charset_decode_iso : cfg_look_charset_decode_utf, |
x -= strlen (more) - 1; |
|
(cfg_look_charset_internal && cfg_look_charset_internal[0]) ? |
|
|
cfg_look_charset_internal : local_charset, |
|
|
_("-MORE-")); |
|
|
x -= strlen (string) - 1; |
|
1527 |
if (x < 0) |
if (x < 0) |
1528 |
x = 0; |
x = 0; |
1529 |
gui_window_set_color (ptr_win->win_status, COLOR_WIN_STATUS_MORE); |
gui_window_set_color (ptr_win->win_status, COLOR_WIN_STATUS_MORE); |
1530 |
if (ptr_win->start_line) |
if (ptr_win->start_line) |
1531 |
mvwprintw (ptr_win->win_status, 0, x, "%s", string); |
mvwprintw (ptr_win->win_status, 0, x, "%s", more); |
1532 |
else |
else |
1533 |
{ |
{ |
1534 |
snprintf (format, sizeof (format) - 1, "%%-%ds", (int)(strlen (string))); |
snprintf (format, sizeof (format) - 1, "%%-%ds", (int)(strlen (more))); |
1535 |
mvwprintw (ptr_win->win_status, 0, x, format, " "); |
mvwprintw (ptr_win->win_status, 0, x, format, " "); |
1536 |
} |
} |
1537 |
if (gui_buffer_has_nicklist (ptr_win->buffer)) |
if (gui_buffer_has_nicklist (ptr_win->buffer)) |
1545 |
COLOR_WIN_STATUS_DELIMITERS); |
COLOR_WIN_STATUS_DELIMITERS); |
1546 |
wprintw (ptr_win->win_status, "]"); |
wprintw (ptr_win->win_status, "]"); |
1547 |
} |
} |
1548 |
free (string); |
free (more); |
1549 |
|
|
1550 |
wnoutrefresh (ptr_win->win_status); |
wnoutrefresh (ptr_win->win_status); |
1551 |
refresh (); |
refresh (); |
1780 |
wprintw (ptr_win->win_input, format, |
wprintw (ptr_win->win_input, format, |
1781 |
""); |
""); |
1782 |
wclrtoeol (ptr_win->win_input); |
wclrtoeol (ptr_win->win_input); |
1783 |
ptr_win->win_input_x = strlen (CHANNEL(buffer)->name) + |
ptr_win->win_input_x = utf8_strlen (CHANNEL(buffer)->name) + |
1784 |
strlen (SERVER(buffer)->nick) + 3 + |
utf8_strlen (SERVER(buffer)->nick) + 3 + |
1785 |
(buffer->input_buffer_pos - buffer->input_buffer_1st_display); |
(buffer->input_buffer_pos - buffer->input_buffer_1st_display); |
1786 |
if (ptr_win == gui_current_window) |
if (ptr_win == gui_current_window) |
1787 |
move (ptr_win->win_y + ptr_win->win_height - 1, |
move (ptr_win->win_y + ptr_win->win_height - 1, |
1807 |
wprintw (ptr_win->win_input, format, |
wprintw (ptr_win->win_input, format, |
1808 |
""); |
""); |
1809 |
wclrtoeol (ptr_win->win_input); |
wclrtoeol (ptr_win->win_input); |
1810 |
ptr_win->win_input_x = strlen (ptr_nickname) + 2 + |
ptr_win->win_input_x = utf8_strlen (ptr_nickname) + 2 + |
1811 |
(buffer->input_buffer_pos - buffer->input_buffer_1st_display); |
(buffer->input_buffer_pos - buffer->input_buffer_1st_display); |
1812 |
if (ptr_win == gui_current_window) |
if (ptr_win == gui_current_window) |
1813 |
move (ptr_win->win_y + ptr_win->win_height - 1, |
move (ptr_win->win_y + ptr_win->win_height - 1, |
1968 |
} |
} |
1969 |
|
|
1970 |
/* |
/* |
1971 |
* gui_input_page_up: display previous page on buffer |
* gui_window_page_up: display previous page on buffer |
1972 |
*/ |
*/ |
1973 |
|
|
1974 |
void |
void |
1975 |
gui_input_page_up (t_gui_window *window) |
gui_window_page_up (t_gui_window *window) |
1976 |
{ |
{ |
1977 |
if (!gui_ok) |
if (!gui_ok) |
1978 |
return; |
return; |
1990 |
} |
} |
1991 |
|
|
1992 |
/* |
/* |
1993 |
* gui_input_page_down: display next page on buffer |
* gui_window_page_down: display next page on buffer |
1994 |
*/ |
*/ |
1995 |
|
|
1996 |
void |
void |
1997 |
gui_input_page_down (t_gui_window *window) |
gui_window_page_down (t_gui_window *window) |
1998 |
{ |
{ |
1999 |
t_gui_line *ptr_line; |
t_gui_line *ptr_line; |
2000 |
int line_pos; |
int line_pos; |
2026 |
} |
} |
2027 |
|
|
2028 |
/* |
/* |
2029 |
* gui_input_nick_beginning: go to beginning of nicklist |
* gui_window_nick_beginning: go to beginning of nicklist |
2030 |
*/ |
*/ |
2031 |
|
|
2032 |
void |
void |
2033 |
gui_input_nick_beginning (t_gui_window *window) |
gui_window_nick_beginning (t_gui_window *window) |
2034 |
{ |
{ |
2035 |
if (!gui_ok) |
if (!gui_ok) |
2036 |
return; |
return; |
2046 |
} |
} |
2047 |
|
|
2048 |
/* |
/* |
2049 |
* gui_input_nick_end: go to the end of nicklist |
* gui_window_nick_end: go to the end of nicklist |
2050 |
*/ |
*/ |
2051 |
|
|
2052 |
void |
void |
2053 |
gui_input_nick_end (t_gui_window *window) |
gui_window_nick_end (t_gui_window *window) |
2054 |
{ |
{ |
2055 |
int new_start; |
int new_start; |
2056 |
|
|
2075 |
} |
} |
2076 |
|
|
2077 |
/* |
/* |
2078 |
* gui_input_nick_page_up: scroll one page up in nicklist |
* gui_window_nick_page_up: scroll one page up in nicklist |
2079 |
*/ |
*/ |
2080 |
|
|
2081 |
void |
void |
2082 |
gui_input_nick_page_up (t_gui_window *window) |
gui_window_nick_page_up (t_gui_window *window) |
2083 |
{ |
{ |
2084 |
if (!gui_ok) |
if (!gui_ok) |
2085 |
return; |
return; |
2097 |
} |
} |
2098 |
|
|
2099 |
/* |
/* |
2100 |
* gui_input_nick_page_down: scroll one page down in nicklist |
* gui_window_nick_page_down: scroll one page down in nicklist |
2101 |
*/ |
*/ |
2102 |
|
|
2103 |
void |
void |
2104 |
gui_input_nick_page_down (t_gui_window *window) |
gui_window_nick_page_down (t_gui_window *window) |
2105 |
{ |
{ |
2106 |
if (!gui_ok) |
if (!gui_ok) |
2107 |
return; |
return; |
2122 |
} |
} |
2123 |
|
|
2124 |
/* |
/* |
2125 |
* gui_window_init_subviews: init subviews for a WeeChat window |
* gui_window_init_subwindows: init subviews for a WeeChat window |
2126 |
*/ |
*/ |
2127 |
|
|
2128 |
void |
void |
2365 |
} |
} |
2366 |
|
|
2367 |
/* |
/* |
2368 |
* gui_curses_resize_handler: called when term size is modified |
* gui_refresh_screen: called when term size is modified |
2369 |
*/ |
*/ |
2370 |
|
|
2371 |
void |
void |
2372 |
gui_curses_resize_handler () |
gui_refresh_screen () |
2373 |
{ |
{ |
2374 |
t_gui_window *ptr_win, *old_current_window; |
t_gui_window *ptr_win, *old_current_window; |
2375 |
int old_width, old_height; |
int old_width, old_height; |
2462 |
cfg_col_chat_prefix1, cfg_col_chat_bg); |
cfg_col_chat_prefix1, cfg_col_chat_bg); |
2463 |
init_pair (COLOR_WIN_CHAT_PREFIX2, |
init_pair (COLOR_WIN_CHAT_PREFIX2, |
2464 |
cfg_col_chat_prefix2, cfg_col_chat_bg); |
cfg_col_chat_prefix2, cfg_col_chat_bg); |
2465 |
|
init_pair (COLOR_WIN_CHAT_SERVER, |
2466 |
|
cfg_col_chat_server, cfg_col_chat_bg); |
2467 |
init_pair (COLOR_WIN_CHAT_JOIN, |
init_pair (COLOR_WIN_CHAT_JOIN, |
2468 |
cfg_col_chat_join, cfg_col_chat_bg); |
cfg_col_chat_join, cfg_col_chat_bg); |
2469 |
init_pair (COLOR_WIN_CHAT_PART, |
init_pair (COLOR_WIN_CHAT_PART, |
2559 |
color_attr[COLOR_WIN_CHAT_DARK - 1] = (cfg_col_chat_dark >= 0) ? cfg_col_chat_dark & A_BOLD : 0; |
color_attr[COLOR_WIN_CHAT_DARK - 1] = (cfg_col_chat_dark >= 0) ? cfg_col_chat_dark & A_BOLD : 0; |
2560 |
color_attr[COLOR_WIN_CHAT_PREFIX1 - 1] = (cfg_col_chat_prefix1 >= 0) ? cfg_col_chat_prefix1 & A_BOLD : 0; |
color_attr[COLOR_WIN_CHAT_PREFIX1 - 1] = (cfg_col_chat_prefix1 >= 0) ? cfg_col_chat_prefix1 & A_BOLD : 0; |
2561 |
color_attr[COLOR_WIN_CHAT_PREFIX2 - 1] = (cfg_col_chat_prefix2 >= 0) ? cfg_col_chat_prefix2 & A_BOLD : 0; |
color_attr[COLOR_WIN_CHAT_PREFIX2 - 1] = (cfg_col_chat_prefix2 >= 0) ? cfg_col_chat_prefix2 & A_BOLD : 0; |
2562 |
|
color_attr[COLOR_WIN_CHAT_SERVER - 1] = (cfg_col_chat_server >= 0) ? cfg_col_chat_server & A_BOLD : 0; |
2563 |
color_attr[COLOR_WIN_CHAT_JOIN - 1] = (cfg_col_chat_join >= 0) ? cfg_col_chat_join & A_BOLD : 0; |
color_attr[COLOR_WIN_CHAT_JOIN - 1] = (cfg_col_chat_join >= 0) ? cfg_col_chat_join & A_BOLD : 0; |
2564 |
color_attr[COLOR_WIN_CHAT_PART - 1] = (cfg_col_chat_part >= 0) ? cfg_col_chat_part & A_BOLD : 0; |
color_attr[COLOR_WIN_CHAT_PART - 1] = (cfg_col_chat_part >= 0) ? cfg_col_chat_part & A_BOLD : 0; |
2565 |
color_attr[COLOR_WIN_CHAT_NICK - 1] = (cfg_col_chat_nick >= 0) ? cfg_col_chat_nick & A_BOLD : 0; |
color_attr[COLOR_WIN_CHAT_NICK - 1] = (cfg_col_chat_nick >= 0) ? cfg_col_chat_nick & A_BOLD : 0; |
2647 |
gui_current_window = gui_windows; |
gui_current_window = gui_windows; |
2648 |
gui_buffer_new (gui_windows, NULL, NULL, 0, 1); |
gui_buffer_new (gui_windows, NULL, NULL, 0, 1); |
2649 |
|
|
2650 |
signal (SIGWINCH, gui_curses_resize_handler); |
signal (SIGWINCH, gui_refresh_screen); |
2651 |
|
|
2652 |
if (cfg_look_set_title) |
if (cfg_look_set_title) |
2653 |
gui_set_window_title (); |
gui_set_window_title (); |
2814 |
else |
else |
2815 |
buffer = gui_current_window->buffer; |
buffer = gui_current_window->buffer; |
2816 |
|
|
2817 |
if (buffer->dcc) |
if (!buffer || buffer->dcc) |
2818 |
buffer = gui_buffers; |
buffer = gui_buffers; |
2819 |
} |
} |
2820 |
|
|
2821 |
if (buffer == NULL) |
if (buffer == NULL) |
2822 |
{ |
{ |
2823 |
wee_log_printf ("gui_printf without buffer! this is a bug, please send to developers - thanks\n"); |
wee_log_printf ("WARNING: gui_printf_internal without buffer! This is a bug, " |
2824 |
|
"please send to developers - thanks\n"); |
2825 |
return; |
return; |
2826 |
} |
} |
2827 |
|
|