Split the "am/manager" command into several subcommands so that it can be hotkeyed usefully

Originally committed to SVN as r6525.
This commit is contained in:
Thomas Goyne 2012-02-29 01:24:04 +00:00
parent b9fc28b44d
commit d53bb22d2b
4 changed files with 50 additions and 5 deletions

View file

@ -55,9 +55,32 @@ namespace {
/// @defgroup cmd-am Automation commands
/// @{
struct reload_all : public Command {
CMD_NAME("am/reload")
STR_MENU("&Reload Automation scripts")
STR_DISP("Reload Automation scripts")
STR_HELP("Reload all Automation scripts and rescan the autoload folder")
/// Open automation manager.
struct am_manager : public Command {
void operator()(agi::Context *c) {
wxGetApp().global_scripts->Reload();
c->local_scripts->Reload();
wxGetApp().frame->StatusTimeout(_("Reloaded all Automation scripts"));
}
};
struct reload_autoload : public Command {
CMD_NAME("am/reload/autoload")
STR_MENU("R&eload autoload Automation scripts")
STR_DISP("Reload autoload Automation scripts")
STR_HELP("Rescan the Automation autoload folder")
void operator()(agi::Context *c) {
wxGetApp().global_scripts->Reload();
wxGetApp().frame->StatusTimeout(_("Reloaded autoload Automation scripts"));
}
};
struct open_manager : public Command {
CMD_NAME("am/manager")
STR_MENU("&Automation...")
STR_DISP("Automation")
@ -82,11 +105,32 @@ struct am_manager : public Command {
}
};
struct meta : public Command {
CMD_NAME("am/meta")
STR_MENU("&Automation...")
STR_DISP("Automation")
STR_HELP("Open automation manager")
void operator()(agi::Context *c) {
if (wxGetMouseState().CmdDown()) {
if (wxGetMouseState().ShiftDown())
cmd::call("am/reload", c);
else
cmd::call("am/reload/autoload", c);
}
else
cmd::call("am/manager", c);
}
};
/// @}
}
namespace cmd {
void init_automation() {
reg(new am_manager);
reg(new meta);
reg(new open_manager);
reg(new reload_all);
reg(new reload_autoload);
}
}

View file

@ -79,6 +79,7 @@ void icon_init() {
LOG_D("icon/init") << "Generating 24x24, 16x16 icons";
INSERT_ICON("am/manager", automation_toolbutton)
INSERT_ICON("am/meta", automation_toolbutton)
INSERT_ICON("app/about", about_menu)
INSERT_ICON("app/exit", exit_button)
INSERT_ICON("app/language", languages_menu)

View file

@ -47,7 +47,7 @@
"subtitle/attachment",
"tool/font_collector",
"",
"am/manager",
"am/meta",
"",
"tool/assdraw",
"",

View file

@ -413,7 +413,7 @@ public:
, global_slot(wxGetApp().global_scripts->AddScriptChangeListener(&AutomationMenu::Regenerate, this))
, local_slot(c->local_scripts->AddScriptChangeListener(&AutomationMenu::Regenerate, this))
{
cm->AddCommand(cmd::get("am/manager"), this, "");
cm->AddCommand(cmd::get("am/meta"), this, "");
AppendSeparator();
Regenerate();
}