Add /inputwin top|bottom command

closes #853
This commit is contained in:
James Booth
2016-09-19 23:40:45 +01:00
parent c4d3f19d94
commit 0aa758cbfb
22 changed files with 162 additions and 18 deletions

View File

@@ -194,6 +194,7 @@ static Autocomplete blocked_ac;
static Autocomplete tray_ac;
static Autocomplete presence_ac;
static Autocomplete presence_setting_ac;
static Autocomplete inputwin_ac;
void
cmd_ac_init(void)
@@ -735,6 +736,10 @@ cmd_ac_init(void)
autocomplete_add(presence_setting_ac, "all");
autocomplete_add(presence_setting_ac, "online");
autocomplete_add(presence_setting_ac, "none");
inputwin_ac = autocomplete_new();
autocomplete_add(inputwin_ac, "top");
autocomplete_add(inputwin_ac, "bottom");
}
void
@@ -998,6 +1003,7 @@ cmd_ac_reset(ProfWin *window)
autocomplete_reset(tray_ac);
autocomplete_reset(presence_ac);
autocomplete_reset(presence_setting_ac);
autocomplete_reset(inputwin_ac);
autocomplete_reset(script_ac);
if (script_show_ac) {
@@ -1120,6 +1126,7 @@ cmd_ac_uninit(void)
autocomplete_free(tray_ac);
autocomplete_free(presence_ac);
autocomplete_free(presence_setting_ac);
autocomplete_free(inputwin_ac);
}
static char*
@@ -1200,8 +1207,8 @@ _cmd_ac_complete_params(ProfWin *window, const char *const input)
}
}
gchar *cmds[] = { "/prefs", "/disco", "/room", "/autoping" };
Autocomplete completers[] = { prefs_ac, disco_ac, room_ac, autoping_ac };
gchar *cmds[] = { "/prefs", "/disco", "/room", "/autoping", "/inputwin" };
Autocomplete completers[] = { prefs_ac, disco_ac, room_ac, autoping_ac, inputwin_ac };
for (i = 0; i < ARRAY_SIZE(cmds); i++) {
result = autocomplete_param_with_ac(input, cmds[i], completers[i], TRUE);
@@ -1250,7 +1257,7 @@ _cmd_ac_complete_params(ProfWin *window, const char *const input)
g_hash_table_insert(ac_funcs, "/sendfile", _sendfile_autocomplete);
g_hash_table_insert(ac_funcs, "/blocked", _blocked_autocomplete);
g_hash_table_insert(ac_funcs, "/tray", _tray_autocomplete);
g_hash_table_insert(ac_funcs, "/presence", _presence_autocomplete);
g_hash_table_insert(ac_funcs, "/presence", _presence_autocomplete);
int len = strlen(input);
char parsed[len+1];

View File

@@ -1302,6 +1302,23 @@ static struct cmd_t command_defs[] =
CMD_NOEXAMPLES
},
{ "/inputwin",
parse_args, 1, 1, &cons_inputwin_setting,
CMD_NOSUBFUNCS
CMD_MAINFUNC(cmd_inputwin)
CMD_TAGS(
CMD_TAG_UI)
CMD_SYN(
"/inputwin top",
"/inputwin bottom")
CMD_DESC(
"Where to display the input window.")
CMD_ARGS(
{ "top", "Show the input window at the top of the screen." },
{ "bottom", "Show the input window at the bottom of the screen." })
CMD_NOEXAMPLES
},
{ "/notify",
parse_args_with_freetext, 0, 4, NULL,
CMD_NOSUBFUNCS

View File

@@ -1662,7 +1662,7 @@ cmd_theme(ProfWin *window, const char *const command, gchar **args)
} else {
ui_hide_all_room_rosters();
}
ui_redraw();
ui_resize();
cons_show("Loaded theme: %s", args[1]);
} else {
cons_show("Couldn't find theme: %s", args[1]);
@@ -5522,6 +5522,20 @@ cmd_inpblock(ProfWin *window, const char *const command, gchar **args)
return TRUE;
}
gboolean
cmd_inputwin(ProfWin *window, const char *const command, gchar **args)
{
if ((g_strcmp0(args[0], "top") == 0) || (g_strcmp0(args[0], "bottom") == 0)) {
prefs_set_string(PREF_INPUTWIN, args[0]);
ui_resize();
cons_show("Set input window position to %s", args[0]);
} else {
cons_bad_cmd_usage(command);
}
return TRUE;
}
gboolean
cmd_log(ProfWin *window, const char *const command, gchar **args)
{

View File

@@ -149,6 +149,7 @@ gboolean cmd_wrap(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_time(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_resource(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_inpblock(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_inputwin(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_encwarn(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_script(ProfWin *window, const char *const command, gchar **args);
gboolean cmd_export(ProfWin *window, const char *const command, gchar **args);