Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
// Copyright (c) 2005-2010, Niels Martin Hansen
|
|
|
|
// Copyright (c) 2005-2010, Rodrigo Braz Monteiro
|
|
|
|
// Copyright (c) 2010, Amar Takhar
|
|
|
|
// All rights reserved.
|
|
|
|
//
|
|
|
|
// Redistribution and use in source and binary forms, with or without
|
|
|
|
// modification, are permitted provided that the following conditions are met:
|
|
|
|
//
|
|
|
|
// * Redistributions of source code must retain the above copyright notice,
|
|
|
|
// this list of conditions and the following disclaimer.
|
|
|
|
// * Redistributions in binary form must reproduce the above copyright notice,
|
|
|
|
// this list of conditions and the following disclaimer in the documentation
|
|
|
|
// and/or other materials provided with the distribution.
|
|
|
|
// * Neither the name of the Aegisub Group nor the names of its contributors
|
|
|
|
// may be used to endorse or promote products derived from this software
|
|
|
|
// without specific prior written permission.
|
|
|
|
//
|
|
|
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
|
|
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
|
|
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
// POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
//
|
|
|
|
// Aegisub Project http://www.aegisub.org/
|
|
|
|
|
|
|
|
#include "command.h"
|
|
|
|
|
2013-01-07 02:50:09 +01:00
|
|
|
#include "../auto4_base.h"
|
2014-05-22 21:07:15 +02:00
|
|
|
#include "../dialogs.h"
|
2011-01-05 19:40:37 +01:00
|
|
|
#include "../frame_main.h"
|
2013-01-07 02:50:09 +01:00
|
|
|
#include "../include/aegisub/context.h"
|
2013-12-25 22:36:37 +01:00
|
|
|
#include "../libresrc/libresrc.h"
|
2014-06-06 17:24:33 +02:00
|
|
|
#include "../options.h"
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
|
2014-04-23 22:53:24 +02:00
|
|
|
#include <libaegisub/make_unique.h>
|
2013-06-08 06:19:40 +02:00
|
|
|
|
2011-07-15 06:05:01 +02:00
|
|
|
namespace {
|
|
|
|
using cmd::Command;
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
|
2014-03-13 02:39:07 +01:00
|
|
|
struct reload_all final : public Command {
|
2012-02-29 02:24:04 +01:00
|
|
|
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")
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
|
2013-11-21 18:13:36 +01:00
|
|
|
void operator()(agi::Context *c) override {
|
2014-06-06 17:24:33 +02:00
|
|
|
config::global_scripts->Reload();
|
2012-02-29 02:24:04 +01:00
|
|
|
c->local_scripts->Reload();
|
2014-03-25 17:51:38 +01:00
|
|
|
c->frame->StatusTimeout(_("Reloaded all Automation scripts"));
|
2012-02-29 02:24:04 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-03-13 02:39:07 +01:00
|
|
|
struct reload_autoload final : public Command {
|
2012-02-29 02:24:04 +01:00
|
|
|
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")
|
|
|
|
|
2013-11-21 18:13:36 +01:00
|
|
|
void operator()(agi::Context *c) override {
|
2014-06-06 17:24:33 +02:00
|
|
|
config::global_scripts->Reload();
|
2014-03-25 17:51:38 +01:00
|
|
|
c->frame->StatusTimeout(_("Reloaded autoload Automation scripts"));
|
2012-02-29 02:24:04 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-03-13 02:39:07 +01:00
|
|
|
struct open_manager final : public Command {
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
CMD_NAME("am/manager")
|
2013-12-25 22:36:37 +01:00
|
|
|
CMD_ICON(automation_toolbutton)
|
2011-09-28 21:48:20 +02:00
|
|
|
STR_MENU("&Automation...")
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
STR_DISP("Automation")
|
2012-02-01 19:47:26 +01:00
|
|
|
STR_HELP("Open automation manager")
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
|
2013-11-21 18:13:36 +01:00
|
|
|
void operator()(agi::Context *c) override {
|
2014-05-22 21:07:15 +02:00
|
|
|
ShowAutomationDialog(c);
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2014-03-13 02:39:07 +01:00
|
|
|
struct meta final : public Command {
|
2012-02-29 02:24:04 +01:00
|
|
|
CMD_NAME("am/meta")
|
2013-12-25 22:36:37 +01:00
|
|
|
CMD_ICON(automation_toolbutton)
|
2012-02-29 02:24:04 +01:00
|
|
|
STR_MENU("&Automation...")
|
|
|
|
STR_DISP("Automation")
|
2013-10-25 22:54:20 +02:00
|
|
|
STR_HELP("Open automation manager. Ctrl: Rescan autoload folder. Ctrl+Shift: Rescan autoload folder and reload all automation scripts")
|
2012-02-29 02:24:04 +01:00
|
|
|
|
2013-11-21 18:13:36 +01:00
|
|
|
void operator()(agi::Context *c) override {
|
2012-02-29 02:24:04 +01:00
|
|
|
if (wxGetMouseState().CmdDown()) {
|
|
|
|
if (wxGetMouseState().ShiftDown())
|
|
|
|
cmd::call("am/reload", c);
|
|
|
|
else
|
|
|
|
cmd::call("am/reload/autoload", c);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
cmd::call("am/manager", c);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
|
|
|
}
|
|
|
|
|
2011-07-15 06:05:01 +02:00
|
|
|
namespace cmd {
|
|
|
|
void init_automation() {
|
2014-04-23 22:53:24 +02:00
|
|
|
reg(agi::make_unique<meta>());
|
|
|
|
reg(agi::make_unique<open_manager>());
|
|
|
|
reg(agi::make_unique<reload_all>());
|
|
|
|
reg(agi::make_unique<reload_autoload>());
|
2011-07-15 06:05:01 +02:00
|
|
|
}
|
|
|
|
}
|