2006-12-28 22:18:35 +01:00
|
|
|
// 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.
|
|
|
|
//
|
2009-07-29 07:43:02 +02:00
|
|
|
// Aegisub Project http://www.aegisub.org/
|
|
|
|
|
|
|
|
/// @file auto4_lua.h
|
|
|
|
/// @see auto4_lua.cpp
|
|
|
|
/// @ingroup scripting
|
|
|
|
///
|
2006-12-28 22:18:35 +01:00
|
|
|
|
2013-06-08 06:19:40 +02:00
|
|
|
#include "auto4_base.h"
|
|
|
|
|
|
|
|
#include "command/command.h"
|
|
|
|
|
2011-09-28 21:50:14 +02:00
|
|
|
#include <deque>
|
|
|
|
|
2006-12-28 22:18:35 +01:00
|
|
|
#include <wx/event.h>
|
2009-09-11 04:36:34 +02:00
|
|
|
#include <wx/thread.h>
|
|
|
|
|
2011-09-28 21:47:03 +02:00
|
|
|
class AssEntry;
|
2006-12-28 22:18:35 +01:00
|
|
|
class wxWindow;
|
2011-09-28 21:48:47 +02:00
|
|
|
struct lua_State;
|
2010-07-08 06:29:04 +02:00
|
|
|
namespace agi { namespace vfr { class Framerate; } }
|
2006-12-28 22:18:35 +01:00
|
|
|
|
|
|
|
namespace Automation4 {
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
/// @class LuaAssFile
|
2010-06-24 21:32:23 +02:00
|
|
|
/// @brief Object wrapping an AssFile object for modification through Lua
|
2006-12-28 22:18:35 +01:00
|
|
|
class LuaAssFile {
|
2011-09-28 21:50:14 +02:00
|
|
|
struct PendingCommit {
|
|
|
|
wxString mesage;
|
|
|
|
int modification_type;
|
2012-10-12 23:06:41 +02:00
|
|
|
std::vector<AssEntry*> lines;
|
2011-09-28 21:50:14 +02:00
|
|
|
};
|
|
|
|
|
2010-06-24 21:32:23 +02:00
|
|
|
/// Pointer to file being modified
|
2006-12-28 22:18:35 +01:00
|
|
|
AssFile *ass;
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
2010-06-24 21:32:23 +02:00
|
|
|
/// Lua state the object exists in
|
2006-12-28 22:18:35 +01:00
|
|
|
lua_State *L;
|
|
|
|
|
2010-06-24 21:32:23 +02:00
|
|
|
/// Is the feature this object is created for read-only?
|
2006-12-28 22:18:35 +01:00
|
|
|
bool can_modify;
|
2011-09-28 21:47:03 +02:00
|
|
|
/// Is the feature allowed to set undo points?
|
2006-12-28 22:18:35 +01:00
|
|
|
bool can_set_undo;
|
2011-09-28 21:47:03 +02:00
|
|
|
/// throws an error if modification is disallowed
|
|
|
|
void CheckAllowModify();
|
2012-10-12 23:06:41 +02:00
|
|
|
/// throws an error if the line index is out of bounds
|
|
|
|
void CheckBounds(int idx);
|
2011-09-28 21:47:03 +02:00
|
|
|
|
2011-09-28 21:47:12 +02:00
|
|
|
/// How ass file been modified by the script since the last commit
|
|
|
|
int modification_type;
|
|
|
|
|
2011-09-28 21:47:03 +02:00
|
|
|
/// Reference count used to avoid deleting this until both lua and the
|
|
|
|
/// calling C++ code are done with it
|
|
|
|
int references;
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
2011-09-28 21:50:14 +02:00
|
|
|
/// Set of subtitle lines being modified; initially a shallow copy of ass->Line
|
2012-10-12 23:06:41 +02:00
|
|
|
std::vector<AssEntry*> lines;
|
2011-09-28 21:50:14 +02:00
|
|
|
/// Commits to apply once processing completes successfully
|
|
|
|
std::deque<PendingCommit> pending_commits;
|
|
|
|
/// Lines to delete once processing complete successfully
|
2013-10-27 15:15:39 +01:00
|
|
|
std::deque<std::unique_ptr<AssEntry>> lines_to_delete;
|
2011-09-28 21:50:14 +02:00
|
|
|
|
2011-09-28 21:47:03 +02:00
|
|
|
int ObjectIndexRead(lua_State *L);
|
|
|
|
void ObjectIndexWrite(lua_State *L);
|
|
|
|
int ObjectGetLen(lua_State *L);
|
|
|
|
void ObjectDelete(lua_State *L);
|
|
|
|
void ObjectDeleteRange(lua_State *L);
|
|
|
|
void ObjectAppend(lua_State *L);
|
|
|
|
void ObjectInsert(lua_State *L);
|
|
|
|
void ObjectGarbageCollect(lua_State *L);
|
2013-05-02 05:51:17 +02:00
|
|
|
int ObjectIPairs(lua_State *L);
|
|
|
|
int IterNext(lua_State *L);
|
2011-09-28 21:47:03 +02:00
|
|
|
|
|
|
|
int LuaParseKaraokeData(lua_State *L);
|
|
|
|
|
|
|
|
void LuaSetUndoPoint(lua_State *L);
|
|
|
|
|
|
|
|
// LuaAssFile can only be deleted by the reference count hitting zero
|
2013-10-27 15:15:39 +01:00
|
|
|
~LuaAssFile();
|
2006-12-28 22:18:35 +01:00
|
|
|
public:
|
2011-09-28 21:47:03 +02:00
|
|
|
static LuaAssFile *GetObjPointer(lua_State *L, int idx);
|
2006-12-28 22:18:35 +01:00
|
|
|
|
2011-09-28 21:47:03 +02:00
|
|
|
/// makes a Lua representation of AssEntry and places on the top of the stack
|
|
|
|
static void AssEntryToLua(lua_State *L, AssEntry *e);
|
|
|
|
/// assumes a Lua representation of AssEntry on the top of the stack, and creates an AssEntry object of it
|
2013-06-10 15:58:13 +02:00
|
|
|
static std::unique_ptr<AssEntry> LuaToAssEntry(lua_State *L);
|
2011-09-28 21:47:03 +02:00
|
|
|
|
|
|
|
/// @brief Signal that the script using this file is now done running
|
|
|
|
/// @param set_undo If there's any uncommitted changes to the file,
|
|
|
|
/// they will be automatically committed with this
|
|
|
|
/// description
|
2012-01-31 01:44:43 +01:00
|
|
|
void ProcessingComplete(wxString const& undo_description = wxString());
|
2011-09-28 21:47:03 +02:00
|
|
|
|
2011-09-28 21:50:14 +02:00
|
|
|
/// End processing without applying any changes made
|
|
|
|
void Cancel();
|
|
|
|
|
2011-09-28 21:47:03 +02:00
|
|
|
/// Constructor
|
|
|
|
/// @param L lua state
|
|
|
|
/// @param ass File to wrap
|
|
|
|
/// @param can_modify Is modifying the file allowed?
|
|
|
|
/// @param can_set_undo Is setting undo points allowed?
|
|
|
|
LuaAssFile(lua_State *L, AssFile *ass, bool can_modify = false, bool can_set_undo = false);
|
2006-12-28 22:18:35 +01:00
|
|
|
};
|
|
|
|
|
2011-09-28 21:47:40 +02:00
|
|
|
class LuaProgressSink {
|
2006-12-28 22:18:35 +01:00
|
|
|
lua_State *L;
|
|
|
|
|
|
|
|
static int LuaSetProgress(lua_State *L);
|
|
|
|
static int LuaSetTask(lua_State *L);
|
|
|
|
static int LuaSetTitle(lua_State *L);
|
|
|
|
static int LuaGetCancelled(lua_State *L);
|
|
|
|
static int LuaDebugOut(lua_State *L);
|
|
|
|
static int LuaDisplayDialog(lua_State *L);
|
2012-02-22 05:17:16 +01:00
|
|
|
static int LuaDisplayOpenDialog(lua_State *L);
|
|
|
|
static int LuaDisplaySaveDialog(lua_State *L);
|
2006-12-28 22:18:35 +01:00
|
|
|
|
|
|
|
public:
|
2011-09-28 21:47:40 +02:00
|
|
|
LuaProgressSink(lua_State *L, ProgressSink *ps, bool allow_config_dialog = true);
|
|
|
|
~LuaProgressSink();
|
2006-12-28 22:18:35 +01:00
|
|
|
|
2011-09-28 21:47:40 +02:00
|
|
|
static ProgressSink* GetObjPointer(lua_State *L, int idx);
|
2006-12-28 22:18:35 +01:00
|
|
|
};
|
|
|
|
|
2011-09-28 21:49:27 +02:00
|
|
|
/// Base class for controls in dialogs
|
|
|
|
class LuaDialogControl {
|
2006-12-28 22:18:35 +01:00
|
|
|
public:
|
2011-09-28 21:49:27 +02:00
|
|
|
/// Name of this control in the output table
|
2013-01-04 16:01:50 +01:00
|
|
|
std::string name;
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
2011-09-28 21:49:27 +02:00
|
|
|
/// Tooltip of this control
|
2013-01-04 16:01:50 +01:00
|
|
|
std::string hint;
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
2006-12-28 22:18:35 +01:00
|
|
|
int x, y, width, height;
|
|
|
|
|
2011-09-28 21:49:27 +02:00
|
|
|
/// Create the associated wxControl
|
2006-12-28 22:18:35 +01:00
|
|
|
virtual wxControl *Create(wxWindow *parent) = 0;
|
2011-09-28 21:49:27 +02:00
|
|
|
|
|
|
|
/// Get the default flags to use when inserting this control into a sizer
|
|
|
|
virtual int GetSizerFlags() const { return wxEXPAND; }
|
|
|
|
|
|
|
|
/// Push the current value of the control onto the lua stack. Must not
|
|
|
|
/// touch the GUI as this may be called on a background thread.
|
|
|
|
virtual void LuaReadBack(lua_State *L) = 0;
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
2011-09-28 21:49:27 +02:00
|
|
|
/// Does this control have any user-changeable data that can be serialized?
|
|
|
|
virtual bool CanSerialiseValue() const { return false; }
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
2011-09-28 21:49:27 +02:00
|
|
|
/// Serialize the control's current value so that it can be stored
|
|
|
|
/// in the script
|
2013-01-04 16:01:50 +01:00
|
|
|
virtual std::string SerialiseValue() const { return ""; }
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
2011-09-28 21:49:27 +02:00
|
|
|
/// Restore the control's value from a saved value in the script
|
2013-01-04 16:01:50 +01:00
|
|
|
virtual void UnserialiseValue(const std::string &serialised) { }
|
2007-04-04 02:01:17 +02:00
|
|
|
|
2011-09-28 21:49:27 +02:00
|
|
|
LuaDialogControl(lua_State *L);
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
2011-09-28 21:49:27 +02:00
|
|
|
/// Virtual destructor so this can safely be inherited from
|
|
|
|
virtual ~LuaDialogControl() { }
|
2006-12-28 22:18:35 +01:00
|
|
|
};
|
|
|
|
|
2011-09-28 21:49:27 +02:00
|
|
|
/// A lua-generated dialog or panel in the export options dialog
|
|
|
|
class LuaDialog : public ScriptDialog {
|
|
|
|
/// Controls in this dialog
|
2013-06-10 15:58:13 +02:00
|
|
|
std::vector<std::unique_ptr<LuaDialogControl>> controls;
|
Add support for using standard button IDs from automation
Some example uses:
-- ~special snowflake~ OK/Cancel
aegisub.dialog.display(config, {ok='Accept', cancel='Cancel'})
-- On OS X the 'Help' button will be just a left-aligned ?
aegisub.dialog.display(config, {ok='OK', cancel='Cancel', help='Help'})
-- Each button in its own subtable to preserve passed order
-- Unnecessary when using only IDed buttons since the passed order will
-- be ignored in favor of the platform-standard order
aegisub.dialog.display(config,
{{ok='Accept'}, {cancel='Cancel'}, {help='Help'}, 'Another Button'})
In some cases the passed labels will be ignored in favor of the
platform-standard labels.
Available IDs:
ok
yes
save
apply
close
no
cancel
help
context_help
Note that many combinations of button IDs do not make sense and may have
strange effects.
Buttons with an ID of 'cancel' return false, as if ESC was pressed. A
button with an ID of 'close' results in that button being triggered on
ESC rather than cancel.
Buttons with an ID of 'ok', 'yes' and 'save' are set as the default
affirmative button for the dialog.
Closes #1609.
2013-05-23 03:58:53 +02:00
|
|
|
/// The names and IDs of buttons in this dialog if non-default ones were used
|
|
|
|
std::vector<std::pair<int, std::string>> buttons;
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
2011-09-28 21:49:27 +02:00
|
|
|
/// Does the dialog contain any buttons
|
2006-12-28 22:18:35 +01:00
|
|
|
bool use_buttons;
|
|
|
|
|
2011-09-28 21:49:27 +02:00
|
|
|
/// Id of the button pushed (once a button has been pushed)
|
2006-12-28 22:18:35 +01:00
|
|
|
int button_pushed;
|
|
|
|
|
2012-03-07 02:30:52 +01:00
|
|
|
wxWindow *window;
|
|
|
|
|
2006-12-28 22:18:35 +01:00
|
|
|
public:
|
2011-09-28 21:49:27 +02:00
|
|
|
LuaDialog(lua_State *L, bool include_buttons);
|
2006-12-28 22:18:35 +01:00
|
|
|
|
2011-09-28 21:49:27 +02:00
|
|
|
/// Push the values of the controls in this dialog onto the lua stack
|
|
|
|
/// in a single table
|
|
|
|
int LuaReadBack(lua_State *L);
|
|
|
|
|
|
|
|
// ScriptDialog implementation
|
2013-11-21 18:13:36 +01:00
|
|
|
wxWindow* CreateWindow(wxWindow *parent) override;
|
|
|
|
std::string Serialise() override;
|
|
|
|
void Unserialise(const std::string &serialised) override;
|
2006-12-28 22:18:35 +01:00
|
|
|
};
|
|
|
|
|
2011-09-28 21:48:47 +02:00
|
|
|
class LuaFeature {
|
|
|
|
int myid;
|
2006-12-28 22:18:35 +01:00
|
|
|
protected:
|
|
|
|
lua_State *L;
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
2006-12-28 22:18:35 +01:00
|
|
|
void RegisterFeature();
|
2011-09-28 21:48:47 +02:00
|
|
|
void UnregisterFeature();
|
2006-12-28 22:18:35 +01:00
|
|
|
|
2012-01-20 22:33:39 +01:00
|
|
|
void GetFeatureFunction(const char *function) const;
|
2011-09-28 21:48:47 +02:00
|
|
|
|
|
|
|
LuaFeature(lua_State *L);
|
2006-12-28 22:18:35 +01:00
|
|
|
};
|
|
|
|
|
2011-09-28 21:50:14 +02:00
|
|
|
/// Run a lua function on a background thread
|
|
|
|
/// @param L Lua state
|
|
|
|
/// @param nargs Number of arguments the function takes
|
|
|
|
/// @param nresults Number of values the function returns
|
|
|
|
/// @param title Title to use for the progress dialog
|
|
|
|
/// @param parent Parent window for the progress dialog
|
|
|
|
/// @param can_open_config Can the function open its own dialogs?
|
|
|
|
/// @throws agi::UserCancelException if the function fails to run to completion (either due to cancelling or errors)
|
2013-01-04 16:01:50 +01:00
|
|
|
void LuaThreadedCall(lua_State *L, int nargs, int nresults, std::string const& title, wxWindow *parent, bool can_open_config);
|
2006-12-28 22:18:35 +01:00
|
|
|
|
2011-09-28 21:48:47 +02:00
|
|
|
class LuaCommand : public cmd::Command, private LuaFeature {
|
|
|
|
std::string cmd_name;
|
|
|
|
wxString display;
|
|
|
|
wxString help;
|
|
|
|
int cmd_type;
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
2006-12-28 22:18:35 +01:00
|
|
|
public:
|
2013-06-08 06:19:40 +02:00
|
|
|
LuaCommand(lua_State *L);
|
2011-09-28 21:48:47 +02:00
|
|
|
~LuaCommand();
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
2013-11-21 18:13:36 +01:00
|
|
|
const char* name() const override { return cmd_name.c_str(); }
|
|
|
|
wxString StrMenu(const agi::Context *) const override { return display; }
|
|
|
|
wxString StrDisplay(const agi::Context *) const override { return display; }
|
|
|
|
wxString StrHelp() const override { return help; }
|
2006-12-28 22:18:35 +01:00
|
|
|
|
2013-11-21 18:13:36 +01:00
|
|
|
int Type() const override { return cmd_type; }
|
2006-12-28 22:18:35 +01:00
|
|
|
|
2013-11-21 18:13:36 +01:00
|
|
|
void operator()(agi::Context *c) override;
|
|
|
|
bool Validate(const agi::Context *c) override;
|
|
|
|
virtual bool IsActive(const agi::Context *c) override;
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
2011-09-28 21:48:47 +02:00
|
|
|
static int LuaRegister(lua_State *L);
|
|
|
|
};
|
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
|
|
|
|
2011-09-28 21:48:47 +02:00
|
|
|
class LuaExportFilter : public ExportFilter, private LuaFeature {
|
|
|
|
bool has_config;
|
2011-09-28 21:49:27 +02:00
|
|
|
LuaDialog *config_dialog;
|
2006-12-28 22:18:35 +01:00
|
|
|
|
|
|
|
protected:
|
2013-11-21 18:13:36 +01:00
|
|
|
ScriptDialog* GenerateConfigDialog(wxWindow *parent, agi::Context *c) override;
|
2013-06-08 06:19:40 +02:00
|
|
|
|
2006-12-28 22:18:35 +01:00
|
|
|
public:
|
2013-06-08 06:19:40 +02:00
|
|
|
LuaExportFilter(lua_State *L);
|
2006-12-28 22:18:35 +01:00
|
|
|
static int LuaRegister(lua_State *L);
|
|
|
|
|
2013-11-21 18:13:36 +01:00
|
|
|
void ProcessSubs(AssFile *subs, wxWindow *export_dialog) override;
|
2006-12-28 22:18:35 +01:00
|
|
|
};
|
2011-12-28 22:27:06 +01:00
|
|
|
}
|