Unconditionally enable building automation even if there are no enabled engines as there isn't really any reason not to and the defines uglify the code.

Originally committed to SVN as r5621.
This commit is contained in:
Thomas Goyne 2011-09-28 19:45:35 +00:00
parent 66e826edb3
commit 0a91be1c7c
11 changed files with 2 additions and 54 deletions

View file

@ -3,7 +3,6 @@
######################### #########################
HAVE_ALSA = @with_alsa@ HAVE_ALSA = @with_alsa@
HAVE_AUTO4_LUA = @with_auto4_lua@ HAVE_AUTO4_LUA = @with_auto4_lua@
HAVE_AUTOMATION = @with_automation@
HAVE_HUNSPELL = @with_hunspell@ HAVE_HUNSPELL = @with_hunspell@
HAVE_OPENAL = @with_openal@ HAVE_OPENAL = @with_openal@
HAVE_OPENMP = @with_openmp@ HAVE_OPENMP = @with_openmp@

View file

@ -134,7 +134,7 @@
<!-- Automation Lua support --> <!-- Automation Lua support -->
<ItemDefinitionGroup Condition="'$(AegisubUseAutomationLua)'=='true'"> <ItemDefinitionGroup Condition="'$(AegisubUseAutomationLua)'=='true'">
<ClCompile> <ClCompile>
<PreprocessorDefinitions Condition="'$(AegisubUseConfigWindowsH)'=='false'">WITH_AUTOMATION;WITH_AUTO4_LUA;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions Condition="'$(AegisubUseConfigWindowsH)'=='false'">WITH_AUTO4_LUA;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(AegisubContribBase)lua51\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <AdditionalIncludeDirectories>$(AegisubContribBase)lua51\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile> </ClCompile>
<Link> <Link>
@ -294,4 +294,4 @@
<ProjectTools Include="SubWCRev;CreateDefaultConfigurationHeader" /> <ProjectTools Include="SubWCRev;CreateDefaultConfigurationHeader" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View file

@ -760,11 +760,9 @@ fi
LIBS="$aegisub_save_LIBS" LIBS="$aegisub_save_LIBS"
if test "$agi_cv_with_lua" = "yes"; then if test "$agi_cv_with_lua" = "yes"; then
with_automation="yes"
with_auto4_lua="yes" with_auto4_lua="yes"
AC_DEFINE(WITH_AUTO4_LUA, 1, [Enable Automation (auto4), requires lua]) AC_DEFINE(WITH_AUTO4_LUA, 1, [Enable Automation (auto4), requires lua])
else else
with_automation="no"
with_auto4_lua="no" with_auto4_lua="no"
fi fi
@ -772,14 +770,6 @@ AC_SUBST(with_auto4_lua)
AC_SUBST(LUA_CFLAGS) AC_SUBST(LUA_CFLAGS)
AC_SUBST(LUA_LDFLAGS) AC_SUBST(LUA_LDFLAGS)
# Automation setup
if test "$with_automation" = "yes"; then
AC_DEFINE(WITH_AUTOMATION, 1, [Enable Automation support, requires any automation language.])
fi
AC_SUBST(with_automation)
################ ################
# Widget support # Widget support
################ ################

View file

@ -36,8 +36,6 @@
#include "config.h" #include "config.h"
#ifdef WITH_AUTOMATION
#ifndef AGI_PRE #ifndef AGI_PRE
#ifdef __WINDOWS__ #ifdef __WINDOWS__
#include <tchar.h> #include <tchar.h>
@ -1059,7 +1057,3 @@ namespace Automation4 {
} }
}; };
#endif // WITH_AUTOMATION

View file

@ -64,7 +64,6 @@ struct am_manager : public Command {
STR_HELP("Open automation manager.") STR_HELP("Open automation manager.")
void operator()(agi::Context *c) { void operator()(agi::Context *c) {
#ifdef WITH_AUTOMATION
#ifdef __APPLE__ #ifdef __APPLE__
if (wxGetMouseState().CmdDown()) { if (wxGetMouseState().CmdDown()) {
#else #else
@ -94,7 +93,6 @@ struct am_manager : public Command {
c->videoController->Stop(); c->videoController->Stop();
DialogAutomation(c->parent, c->local_scripts).ShowModal(); DialogAutomation(c->parent, c->local_scripts).ShowModal();
} }
#endif
} }
}; };

View file

@ -51,11 +51,6 @@
////////////// HIGH PRIORITY ///////////// ////////////// HIGH PRIORITY /////////////
// Enable Automation
// Requires: Nothing
#define WITH_AUTOMATION
// Enable Automation 4 Lua // Enable Automation 4 Lua
// Requires: Lua 5.1 (in repository) // Requires: Lua 5.1 (in repository)
#define WITH_AUTO4_LUA #define WITH_AUTO4_LUA

View file

@ -37,8 +37,6 @@
#include "config.h" #include "config.h"
#ifdef WITH_AUTOMATION
#ifndef AGI_PRE #ifndef AGI_PRE
#include <wx/filedlg.h> #include <wx/filedlg.h>
#include <wx/filename.h> #include <wx/filename.h>
@ -371,7 +369,3 @@ void DialogAutomation::OnSelectionChange(wxListEvent &evt)
{ {
UpdateDisplay(); UpdateDisplay();
} }
#endif // WITH_AUTOMATION

View file

@ -58,9 +58,7 @@
#include "ass_file.h" #include "ass_file.h"
#include "audio_controller.h" #include "audio_controller.h"
#include "audio_box.h" #include "audio_box.h"
#ifdef WITH_AUTOMATION
#include "auto4_base.h" #include "auto4_base.h"
#endif
#include "compat.h" #include "compat.h"
#include "command/command.h" #include "command/command.h"
#include "dialog_search_replace.h" #include "dialog_search_replace.h"
@ -124,9 +122,7 @@ FrameMain::FrameMain (wxArrayString args)
context->ass->AddFileOpenListener(&FrameMain::OnSubtitlesOpen, this); context->ass->AddFileOpenListener(&FrameMain::OnSubtitlesOpen, this);
context->ass->AddFileSaveListener(&FrameMain::UpdateTitle, this); context->ass->AddFileSaveListener(&FrameMain::UpdateTitle, this);
#ifdef WITH_AUTOMATION
context->local_scripts = new Automation4::ScriptManager(); context->local_scripts = new Automation4::ScriptManager();
#endif
StartupLog("Initializing context controls"); StartupLog("Initializing context controls");
context->audioController = new AudioController; context->audioController = new AudioController;
@ -232,9 +228,7 @@ FrameMain::~FrameMain () {
delete context->ass; delete context->ass;
HelpButton::ClearPages(); HelpButton::ClearPages();
delete context->audioController; delete context->audioController;
#ifdef WITH_AUTOMATION
delete context->local_scripts; delete context->local_scripts;
#endif
SubsGrid->Destroy(); SubsGrid->Destroy();
} }
@ -684,9 +678,7 @@ void FrameMain::OnSubtitlesOpen() {
curSubsVFR != context->videoController->GetTimecodesName() || curSubsVFR != context->videoController->GetTimecodesName() ||
curSubsVideo != context->videoController->videoName || curSubsVideo != context->videoController->videoName ||
curSubsKeyframes != context->videoController->GetKeyFramesName() curSubsKeyframes != context->videoController->GetKeyFramesName()
#ifdef WITH_AUTOMATION
|| !AutoScriptString.IsEmpty() || context->local_scripts->GetScripts().size() > 0 || !AutoScriptString.IsEmpty() || context->local_scripts->GetScripts().size() > 0
#endif
) )
{ {
if (autoLoadMode == 1) { if (autoLoadMode == 1) {
@ -734,7 +726,6 @@ void FrameMain::OnSubtitlesOpen() {
} }
// Automation scripts // Automation scripts
#ifdef WITH_AUTOMATION
context->local_scripts->RemoveAll(); context->local_scripts->RemoveAll();
wxStringTokenizer tok(AutoScriptString, "|", wxTOKEN_STRTOK); wxStringTokenizer tok(AutoScriptString, "|", wxTOKEN_STRTOK);
wxFileName assfn(context->ass->filename); wxFileName assfn(context->ass->filename);
@ -765,7 +756,6 @@ void FrameMain::OnSubtitlesOpen() {
sfnamel, sfnames, basepath, sfname.GetFullPath()); sfnamel, sfnames, basepath, sfname.GetFullPath());
} }
} }
#endif
} }
// Display // Display
@ -781,7 +771,6 @@ void FrameMain::OnSubtitlesSave() {
// 2. Otherwise try making it relative to the ass filename // 2. Otherwise try making it relative to the ass filename
// 3. If step 2 failed, or absolute path is shorter than path relative to ass, use absolute path ("/") // 3. If step 2 failed, or absolute path is shorter than path relative to ass, use absolute path ("/")
// 4. Otherwise, use path relative to ass ("~") // 4. Otherwise, use path relative to ass ("~")
#ifdef WITH_AUTOMATION
wxString scripts_string; wxString scripts_string;
wxString autobasefn(lagi_wxString(OPT_GET("Path/Automation/Base")->GetString())); wxString autobasefn(lagi_wxString(OPT_GET("Path/Automation/Base")->GetString()));
@ -808,7 +797,6 @@ void FrameMain::OnSubtitlesSave() {
scripts_string += scriptfn; scripts_string += scriptfn;
} }
context->ass->SetScriptInfo("Automation Scripts", scripts_string); context->ass->SetScriptInfo("Automation Scripts", scripts_string);
#endif
} }
void FrameMain::OnKeyDown(wxKeyEvent &event) { void FrameMain::OnKeyDown(wxKeyEvent &event) {

View file

@ -61,9 +61,7 @@
#include "ass_file.h" #include "ass_file.h"
#include "ass_time.h" #include "ass_time.h"
#include "audio_box.h" #include "audio_box.h"
#ifdef WITH_AUTOMATION
#include "auto4_base.h" #include "auto4_base.h"
#endif
#include "charset_conv.h" #include "charset_conv.h"
#include "compat.h" #include "compat.h"
#include "export_clean_info.h" #include "export_clean_info.h"
@ -276,10 +274,8 @@ bool AegisubApp::OnInit() {
plugins->RegisterBuiltInPlugins(); plugins->RegisterBuiltInPlugins();
// Load Automation scripts // Load Automation scripts
#ifdef WITH_AUTOMATION
StartupLog("Load global Automation scripts"); StartupLog("Load global Automation scripts");
global_scripts = new Automation4::AutoloadScriptManager(lagi_wxString(OPT_GET("Path/Automation/Autoload")->GetString())); global_scripts = new Automation4::AutoloadScriptManager(lagi_wxString(OPT_GET("Path/Automation/Autoload")->GetString()));
#endif
// Load export filters // Load export filters
StartupLog("Register export filters"); StartupLog("Register export filters");
@ -335,9 +331,7 @@ int AegisubApp::OnExit() {
delete config::path; delete config::path;
cmd::clear(); cmd::clear();
#ifdef WITH_AUTOMATION
delete global_scripts; delete global_scripts;
#endif
AssExportFilterChain::Clear(); AssExportFilterChain::Clear();

View file

@ -116,10 +116,8 @@ public:
/// DOCME /// DOCME
FrameMain *frame; FrameMain *frame;
#ifdef WITH_AUTOMATION
/// DOCME /// DOCME
Automation4::AutoloadScriptManager *global_scripts; Automation4::AutoloadScriptManager *global_scripts;
#endif
/// @brief DOCME /// @brief DOCME

View file

@ -281,10 +281,8 @@ void process_menu_item(wxMenu *parent, agi::Context *c, json::Object const& ele,
} }
if (special == "automation") { if (special == "automation") {
#ifdef WITH_AUTOMATION
/// @todo Actually implement this /// @todo Actually implement this
parent->Append(-1, _("No Automation macros loaded"))->Enable(false); parent->Append(-1, _("No Automation macros loaded"))->Enable(false);
#endif
return; return;
} }