mirror of
https://github.com/irssi/irssi.git
synced 2024-11-03 04:27:19 -05:00
/WINDOW command now prints all information related to window.
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1699 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
af7eb94043
commit
79ae6fceb3
@ -43,6 +43,22 @@ FORMAT_REC fecommon_core_formats[] = {
|
||||
{ "windowlist_footer", "", 0 },
|
||||
{ "windows_layout_saved", "Layout of windows is now remembered next time you start irssi", 0 },
|
||||
{ "windows_layout_reset", "Layout of windows reset to defaults", 0 },
|
||||
{ "window_info_header", "", 0 },
|
||||
{ "window_info_footer", "", 0 },
|
||||
{ "window_info_refnum", "Window : {hilight #$0}", 1, { 1 } },
|
||||
{ "window_info_refnum_sticky", "Window : {hilight #$0 (sticky)}", 1, { 1 } },
|
||||
{ "window_info_name", "Name : $0", 1, { 0 } },
|
||||
{ "window_info_size", "Size : $0x$1", 2, { 1, 1 } },
|
||||
{ "window_info_level", "Level : $0", 1, { 0 } },
|
||||
{ "window_info_server", "Server : $0", 1, { 0 } },
|
||||
{ "window_info_server_sticky", "Server : $0 (sticky)", 1, { 0 } },
|
||||
{ "window_info_theme", "Theme : $0$1", 2, { 0, 0 } },
|
||||
{ "window_info_bound_items_header", "Bounds : {hilight Name Server tag}", 0 },
|
||||
{ "window_info_bound_item", " : $[!30]0 $[!15]1 $2", 3, { 0, 0, 0 } },
|
||||
{ "window_info_bound_items_footer", "", 0 },
|
||||
{ "window_info_items_header", "Items : {hilight Name Server tag}", 0 },
|
||||
{ "window_info_item", " $[7]0: $[!30]1 $2", 3, { 0, 0, 0 } },
|
||||
{ "window_info_items_footer", "", 0 },
|
||||
|
||||
/* ---- */
|
||||
{ NULL, "Server", 0 },
|
||||
|
@ -21,6 +21,22 @@ enum {
|
||||
TXT_WINDOWLIST_FOOTER,
|
||||
TXT_WINDOWS_LAYOUT_SAVED,
|
||||
TXT_WINDOWS_LAYOUT_RESET,
|
||||
TXT_WINDOW_INFO_HEADER,
|
||||
TXT_WINDOW_INFO_FOOTER,
|
||||
TXT_WINDOW_INFO_REFNUM,
|
||||
TXT_WINDOW_INFO_REFNUM_STICKY,
|
||||
TXT_WINDOW_INFO_NAME,
|
||||
TXT_WINDOW_INFO_SIZE,
|
||||
TXT_WINDOW_INFO_LEVEL,
|
||||
TXT_WINDOW_INFO_SERVER,
|
||||
TXT_WINDOW_INFO_SERVER_STICKY,
|
||||
TXT_WINDOW_INFO_THEME,
|
||||
TXT_WINDOW_INFO_BOUND_ITEMS_HEADER,
|
||||
TXT_WINDOW_INFO_BOUND_ITEM,
|
||||
TXT_WINDOW_INFO_BOUND_ITEMS_FOOTER,
|
||||
TXT_WINDOW_INFO_ITEMS_HEADER,
|
||||
TXT_WINDOW_INFO_ITEM,
|
||||
TXT_WINDOW_INFO_ITEMS_FOOTER,
|
||||
|
||||
TXT_FILL_2,
|
||||
|
||||
|
@ -33,13 +33,125 @@
|
||||
#include "windows-layout.h"
|
||||
#include "printtext.h"
|
||||
|
||||
static void cmd_window(const char *data, void *server, WI_ITEM_REC *item)
|
||||
static void window_print_binds(WINDOW_REC *win)
|
||||
{
|
||||
if (is_numeric(data, 0)) {
|
||||
signal_emit("command window refnum", 3, data, server, item);
|
||||
return;
|
||||
GSList *tmp;
|
||||
|
||||
printformat_window(win, MSGLEVEL_CLIENTCRAP,
|
||||
TXT_WINDOW_INFO_BOUND_ITEMS_HEADER);
|
||||
for (tmp = win->bound_items; tmp != NULL; tmp = tmp->next) {
|
||||
WINDOW_BIND_REC *bind = tmp->data;
|
||||
|
||||
printformat_window(win, MSGLEVEL_CLIENTCRAP,
|
||||
TXT_WINDOW_INFO_BOUND_ITEM,
|
||||
bind->name, bind->servertag,
|
||||
bind->sticky ? "sticky" : "");
|
||||
}
|
||||
printformat_window(win, MSGLEVEL_CLIENTCRAP,
|
||||
TXT_WINDOW_INFO_BOUND_ITEMS_FOOTER);
|
||||
}
|
||||
|
||||
static void window_print_items(WINDOW_REC *win)
|
||||
{
|
||||
GSList *tmp;
|
||||
const char *type;
|
||||
|
||||
printformat_window(win, MSGLEVEL_CLIENTCRAP,
|
||||
TXT_WINDOW_INFO_ITEMS_HEADER);
|
||||
for (tmp = win->items; tmp != NULL; tmp = tmp->next) {
|
||||
WI_ITEM_REC *item = tmp->data;
|
||||
|
||||
type = module_find_id_str("WINDOW ITEM TYPE", item->type);
|
||||
printformat_window(win, MSGLEVEL_CLIENTCRAP,
|
||||
TXT_WINDOW_INFO_ITEM,
|
||||
type == NULL ? "??" : type, item->name,
|
||||
item->server == NULL ? "" :
|
||||
item->server->tag);
|
||||
}
|
||||
printformat_window(win, MSGLEVEL_CLIENTCRAP,
|
||||
TXT_WINDOW_INFO_ITEMS_FOOTER);
|
||||
}
|
||||
|
||||
static void cmd_window_info(void)
|
||||
{
|
||||
WINDOW_REC *win;
|
||||
char *levelstr;
|
||||
|
||||
win = active_win;
|
||||
|
||||
printformat_window(win, MSGLEVEL_CLIENTCRAP,
|
||||
TXT_WINDOW_INFO_HEADER);
|
||||
|
||||
/* Window reference number + sticky status */
|
||||
if (!win->sticky_refnum) {
|
||||
printformat_window(win, MSGLEVEL_CLIENTCRAP,
|
||||
TXT_WINDOW_INFO_REFNUM, win->refnum);
|
||||
} else {
|
||||
printformat_window(win, MSGLEVEL_CLIENTCRAP,
|
||||
TXT_WINDOW_INFO_REFNUM_STICKY, win->refnum);
|
||||
}
|
||||
|
||||
/* Window name */
|
||||
if (win->name != NULL) {
|
||||
printformat_window(win, MSGLEVEL_CLIENTCRAP,
|
||||
TXT_WINDOW_INFO_NAME, win->name);
|
||||
}
|
||||
|
||||
/* Window width / height */
|
||||
printformat_window(win, MSGLEVEL_CLIENTCRAP, TXT_WINDOW_INFO_SIZE,
|
||||
win->width, win->height);
|
||||
|
||||
/* Window level */
|
||||
levelstr = win->level == 0 ?
|
||||
g_strdup("NONE") : bits2level(win->level);
|
||||
printformat_window(win, MSGLEVEL_CLIENTCRAP, TXT_WINDOW_INFO_LEVEL,
|
||||
levelstr);
|
||||
g_free(levelstr);
|
||||
|
||||
/* Active window server + sticky status */
|
||||
if (win->servertag == NULL) {
|
||||
printformat_window(win, MSGLEVEL_CLIENTCRAP,
|
||||
TXT_WINDOW_INFO_SERVER,
|
||||
win->active_server != NULL ?
|
||||
win->active_server->tag : "NONE");
|
||||
} else {
|
||||
if (win->active_server != NULL &&
|
||||
strcmp(win->active_server->tag, win->servertag) != 0)
|
||||
g_warning("Active server isn't the sticky server!");
|
||||
|
||||
printformat_window(win, MSGLEVEL_CLIENTCRAP,
|
||||
TXT_WINDOW_INFO_SERVER_STICKY,
|
||||
win->servertag);
|
||||
}
|
||||
|
||||
/* Window theme + error status */
|
||||
if (win->theme_name != NULL) {
|
||||
printformat_window(win, MSGLEVEL_CLIENTCRAP,
|
||||
TXT_WINDOW_INFO_THEME, win->theme_name,
|
||||
win->theme != NULL ? "" : "(not loaded)");
|
||||
}
|
||||
|
||||
/* Bound items in window */
|
||||
if (win->bound_items != NULL)
|
||||
window_print_binds(win);
|
||||
|
||||
/* Item */
|
||||
if (win->items != NULL)
|
||||
window_print_items(win);
|
||||
|
||||
printformat_window(win, MSGLEVEL_CLIENTCRAP,
|
||||
TXT_WINDOW_INFO_FOOTER);
|
||||
}
|
||||
|
||||
static void cmd_window(const char *data, void *server, WI_ITEM_REC *item)
|
||||
{
|
||||
while (*data == ' ') data++;
|
||||
|
||||
if (*data == '\0')
|
||||
cmd_window_info();
|
||||
else if (is_numeric(data, 0))
|
||||
signal_emit("command window refnum", 3, data, server, item);
|
||||
else
|
||||
command_runsub("window", data, server, item);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user