More messing around with Lua.
Originally committed to SVN as r2001.
This commit is contained in:
parent
777242fce3
commit
ed7a434a9e
|
@ -36,6 +36,7 @@
|
||||||
#ifdef WITH_AUTO4_LUA
|
#ifdef WITH_AUTO4_LUA
|
||||||
|
|
||||||
#include "auto4_lua.h"
|
#include "auto4_lua.h"
|
||||||
|
#include "auto4_lua_factory.h"
|
||||||
#include "auto4_lua_scriptreader.h"
|
#include "auto4_lua_scriptreader.h"
|
||||||
#include "ass_dialogue.h"
|
#include "ass_dialogue.h"
|
||||||
#include "ass_style.h"
|
#include "ass_style.h"
|
||||||
|
@ -898,6 +899,28 @@ namespace Automation4 {
|
||||||
return dlg.LuaReadBack(L);
|
return dlg.LuaReadBack(L);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Factory methods
|
||||||
|
LuaScriptFactory::LuaScriptFactory() {}
|
||||||
|
LuaScriptFactory::~LuaScriptFactory() {}
|
||||||
|
|
||||||
|
void LuaScriptFactory::RegisterFactory ()
|
||||||
|
{
|
||||||
|
engine_name = _T("Lua");
|
||||||
|
filename_pattern = _T("*.lua");
|
||||||
|
Register(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
Script* LuaScriptFactory::Produce(const wxString &filename) const
|
||||||
|
{
|
||||||
|
// Just check if file extension is .lua
|
||||||
|
// Reject anything else
|
||||||
|
if (filename.Right(4).Lower() == _T(".lua")) {
|
||||||
|
return new LuaScript(filename);
|
||||||
|
} else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // WITH_AUTO4_LUA
|
#endif // WITH_AUTO4_LUA
|
||||||
|
|
|
@ -252,32 +252,6 @@ namespace Automation4 {
|
||||||
void ProcessSubs(AssFile *subs, wxWindow *export_dialog);
|
void ProcessSubs(AssFile *subs, wxWindow *export_dialog);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Factory class for Lua scripts
|
|
||||||
class LuaScriptFactory : public ScriptFactory {
|
|
||||||
public:
|
|
||||||
LuaScriptFactory() { }
|
|
||||||
|
|
||||||
~LuaScriptFactory() { }
|
|
||||||
|
|
||||||
void RegisterFactory ()
|
|
||||||
{
|
|
||||||
engine_name = _T("Lua");
|
|
||||||
filename_pattern = _T("*.lua");
|
|
||||||
Register(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual Script* Produce(const wxString &filename) const
|
|
||||||
{
|
|
||||||
// Just check if file extension is .lua
|
|
||||||
// Reject anything else
|
|
||||||
if (filename.Right(4).Lower() == _T(".lua")) {
|
|
||||||
return new LuaScript(filename);
|
|
||||||
} else {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
56
aegisub/auto4_lua_factory.h
Normal file
56
aegisub/auto4_lua_factory.h
Normal file
|
@ -0,0 +1,56 @@
|
||||||
|
// Copyright (c) 2006, Niels Martin Hansen
|
||||||
|
// 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
|
||||||
|
//
|
||||||
|
// Website: http://aegisub.cellosoft.com
|
||||||
|
// Contact: mailto:jiifurusu@gmail.com
|
||||||
|
//
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef _AUTO4_LUA_FACTORY_H
|
||||||
|
#define _AUTO4_LUA_FACTORY_H
|
||||||
|
|
||||||
|
#include "auto4_base.h"
|
||||||
|
|
||||||
|
namespace Automation4 {
|
||||||
|
|
||||||
|
// Factory class for Lua scripts
|
||||||
|
class LuaScriptFactory : public ScriptFactory {
|
||||||
|
public:
|
||||||
|
LuaScriptFactory();
|
||||||
|
~LuaScriptFactory();
|
||||||
|
void RegisterFactory ();
|
||||||
|
Script* Produce(const wxString &filename) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
|
@ -43,7 +43,7 @@
|
||||||
#include "subtitles_provider_manager.h"
|
#include "subtitles_provider_manager.h"
|
||||||
#include "spellchecker_manager.h"
|
#include "spellchecker_manager.h"
|
||||||
#ifdef WITH_AUTO4_LUA
|
#ifdef WITH_AUTO4_LUA
|
||||||
#include "auto4_lua.h"
|
#include "auto4_lua_factory.h"
|
||||||
#endif
|
#endif
|
||||||
#ifdef WITH_PERL
|
#ifdef WITH_PERL
|
||||||
#include "auto4_perl.h"
|
#include "auto4_perl.h"
|
||||||
|
|
|
@ -650,6 +650,10 @@
|
||||||
RelativePath="..\..\aegisub\auto4_lua_dialog.cpp"
|
RelativePath="..\..\aegisub\auto4_lua_dialog.cpp"
|
||||||
>
|
>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\..\aegisub\auto4_lua_factory.h"
|
||||||
|
>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\..\aegisub\auto4_lua_scriptreader.cpp"
|
RelativePath="..\..\aegisub\auto4_lua_scriptreader.cpp"
|
||||||
>
|
>
|
||||||
|
|
Loading…
Reference in a new issue