Use LocalScriptManager::Reload rather than looping over the scripts manually in the am/manager command

Originally committed to SVN as r5638.
This commit is contained in:
Thomas Goyne 2011-09-28 19:48:20 +00:00
parent af9315f1aa
commit 6d0e44baad

View file

@ -59,30 +59,16 @@ namespace {
/// Open automation manager. /// Open automation manager.
struct am_manager : public Command { struct am_manager : public Command {
CMD_NAME("am/manager") CMD_NAME("am/manager")
STR_MENU("&Automation..") STR_MENU("&Automation...")
STR_DISP("Automation") STR_DISP("Automation")
STR_HELP("Open automation manager.") STR_HELP("Open automation manager.")
void operator()(agi::Context *c) { void operator()(agi::Context *c) {
#ifdef __APPLE__
if (wxGetMouseState().CmdDown()) { if (wxGetMouseState().CmdDown()) {
#else
if (wxGetMouseState().ControlDown()) {
#endif
wxGetApp().global_scripts->Reload(); wxGetApp().global_scripts->Reload();
if (wxGetMouseState().ShiftDown()) { if (wxGetMouseState().ShiftDown()) {
const std::vector<Automation4::Script*>& scripts = c->local_scripts->GetScripts(); c->local_scripts->Reload();
for (size_t i = 0; i < scripts.size(); ++i) {
try {
scripts[i]->Reload();
} catch (const char *e) {
wxLogError(e);
} catch (...) {
wxLogError("An unknown error occurred reloading Automation script '%s'.", scripts[i]->GetName());
}
}
wxGetApp().frame->StatusTimeout(_("Reloaded all Automation scripts")); wxGetApp().frame->StatusTimeout(_("Reloaded all Automation scripts"));
} }
else { else {