Commit Graph

70 Commits

Author SHA1 Message Date
Thomas Goyne 67df64e879 Use range-based for loops in a bunch of places 2012-11-12 18:35:25 -08:00
Thomas Goyne 1531ef88bd Visual Studio 2012 compilation fixes
VS11 only defines pseudo-variadic template stuff for up to 5 arguments,
so use lambdas rather than bind.
2012-11-12 18:35:23 -08:00
Thomas Goyne ebd56f2163 Include cstdint rather than stdint.h 2012-11-10 18:05:57 -08:00
Thomas Goyne 0893ed3f0a Remove references to tr1 2012-11-10 18:05:57 -08:00
Thomas Goyne ea5428b65f Replace AssColor with agi::Color
Add agi::Color, and replace AssColor and all uses of wxColor that are
not immediately passed to/from wx with it.
2012-11-10 18:05:56 -08:00
Thomas Goyne 83761d881a Convert AssFile::Line to an intrusive list
Gives O(1) pointer -> iterator conversions, better memory usage, better
performance, and overall slightly simplifies the code using it.
2012-11-10 18:05:56 -08:00
Thomas Goyne e44c47c863 Remove $Id$ markers since git doesn't support them 2012-10-25 17:39:49 -07:00
Thomas Goyne df60c2e7a4 Factor out a bunch of duplicated code for clipboard stuff 2012-10-25 17:39:49 -07:00
Thomas Goyne 53433426bb Fix some stuff from Coverity Scan
Mostly just bugs in unreachable code and stylistic things, but there's a
few incorrect reachable things that were working by coincidence and
gratuitous dynamic_casts.
2012-10-15 18:16:09 -07:00
Thomas Goyne e4a6092b36 Use signals for selection change notifications 2012-10-12 14:54:07 -07:00
Thomas Goyne 4208fa362c Fix stack check failure when a script fails to load in a debug build 2012-08-19 20:32:18 -07:00
Thomas Goyne 06e23b9296 Use SetSelectionAndActive whenever both are set at once
I'm not sure if this fixes any current actual problems as using slightly
stale data is normally only a problem when lines are being deleted, but
it's easier to fix it across the board than to figure out where it is
and isn't needed, and the speed impact of batching is trivial.

Originally committed to SVN as r6753.
2012-05-05 02:11:09 +00:00
Thomas Goyne b32515da80 Strip trailing whitespace from all cpp and h files
Originally committed to SVN as r6600.
2012-03-25 04:05:06 +00:00
Thomas Goyne 55eb230ef6 Add aegisub.gettext to get translations of strings
Originally committed to SVN as r6583.
2012-03-12 23:35:29 +00:00
Thomas Goyne 5f82f5b2d7 OS X compilation fixes
Originally committed to SVN as r6512.
2012-02-23 19:28:19 +00:00
Thomas Goyne c4daf860e5 Add a lua module for reading from/writing to the clipboard
Originally committed to SVN as r6501.
2012-02-22 20:47:34 +00:00
Thomas Goyne 048fc44cfa Add aegisub.file_name() to get the file name of the subtitles file
If called during a macro processing or validation function when the
subtitles have a valid file name (i.e. they've been saved and are not
Untitled), this returns the name of the file, without the path. If
called at any other time, it returns nil.

Originally committed to SVN as r6498.
2012-02-21 23:32:58 +00:00
Thomas Goyne ffa7e70f5c Fix compilation on 64-bit linux with clang
Originally committed to SVN as r6487.
2012-02-20 05:15:00 +00:00
Thomas Goyne 5bf7342019 Add a Lua binding for wxRegEx
Lua's built in regular expression engine is rather limited in features
compared to wx's, and operates on bytes rather than characters due to
not being unicode-aware.

Originally committed to SVN as r6473.
2012-02-15 21:23:42 +00:00
Thomas Goyne 952bc02c07 Enable lua stack checking in debug builds
Originally committed to SVN as r6465.
2012-02-10 02:16:49 +00:00
Thomas Goyne 3fd457ac68 Fix memory corruption after automation macro errors
Originally committed to SVN as r6464.
2012-02-10 01:41:22 +00:00
Thomas Goyne 725820efc0 Add support for setting the active line from automation macros
The macro processing function can now return a second value, which is
the index of the line to make active, which must be one of the lines in
the selection. If it is not, or if the value is not present, then the
active line is left unchanged if it is in the new selection, or set to
the first line of the new selection if it is not.

Closes #1435.

Originally committed to SVN as r6398.
2012-01-31 00:44:16 +00:00
Thomas Goyne a24f1692be Let macros update their help string from the validate function
If the second return value from the validate function exists and is a
non-empty string, replace the macro's help text with that string.

Revert r6327, as this is a better solution to the same problem.

Closes #1413.

Originally committed to SVN as r6352.
2012-01-25 00:21:37 +00:00
Thomas Goyne a939732d9c Add auto4lua support for dynamic help strings
Rather than passing a string as the second argument to
aegisub.register_macro, they can now pass a function which will be
called (with no arguments) to get a help string.

Originally committed to SVN as r6327.
2012-01-20 21:33:39 +00:00
Thomas Goyne 64c7043123 Add aegisub.cancel(), which immediates ends macro execution without applying any of the changes that have been made
Originally committed to SVN as r6325.
2012-01-20 21:33:20 +00:00
Thomas Goyne b36c70ca7d Move a pile of things that shouldn't be in headers out of the headers
Originally committed to SVN as r6308.
2012-01-18 20:08:42 +00:00
Thomas Goyne 7dd6cfe37d Derive agi::acs exceptions from agi::FileSystemError and friends rather than having two sets of errors for the same thing
Originally committed to SVN as r6278.
2012-01-12 22:31:54 +00:00
Thomas Goyne 8bfefd356c Return nil from lua functions which require a project context if they're called during script initialization. Closes #1380.
Originally committed to SVN as r6255.
2012-01-09 20:31:19 +00:00
Thomas Goyne 68b2ae8275 Eliminate most clang warnings
Originally committed to SVN as r6183.
2011-12-28 21:27:22 +00:00
Thomas Goyne cae10121ed Fix a bunch of -pedantic stuff
Originally committed to SVN as r6181.
2011-12-28 21:27:06 +00:00
Thomas Goyne 2fdbd86a7f Add aegisub.decode_path, which simply wraps StandardPaths::DecodePath
Originally committed to SVN as r6130.
2011-12-22 21:30:05 +00:00
Thomas Goyne 4a3f2b8412 Add aegisub.keyframes, which returns a table with all of the frame numbers which are keyframes
Originally committed to SVN as r6129.
2011-12-22 21:29:56 +00:00
Thomas Goyne 34a87b1c1e Silence a pile of /W4 warnings
Originally committed to SVN as r6001.
2011-12-22 21:09:31 +00:00
Thomas Goyne a445512970 Remove out-of-date comment in auto4_lua.cpp
Originally committed to SVN as r5929.
2011-11-29 23:17:20 +00:00
Thomas Goyne c04af51c86 Include lua.hpp rather than the .h versions on non-windows as lua is normally compiled as C, not C++
Originally committed to SVN as r5831.
2011-11-08 01:18:16 +00:00
Thomas Goyne 5c487ae75f Don't apply the changes from an automation macro if an error occured
Originally committed to SVN as r5774.
2011-10-25 01:15:03 +00:00
Thomas Goyne dbca576d50 Require that macros defined in a single script have unique names
Originally committed to SVN as r5665.
2011-09-28 19:52:28 +00:00
Thomas Goyne c632a662b2 Change the naming scheme for lua commands to 'automation/lua/[Script File Name]/[Macro Name]'
Originally committed to SVN as r5664.
2011-09-28 19:52:20 +00:00
Thomas Goyne 799c18e22d Remove unused includes in auto4_lua.cpp
Originally committed to SVN as r5663.
2011-09-28 19:52:11 +00:00
Thomas Goyne 1e13670c70 Improve error handling in LuaModuleLoader and don't keep trying to load modules after one has been found
Originally committed to SVN as r5662.
2011-09-28 19:52:02 +00:00
Thomas Goyne b55ff3f803 Switch auto4lua to a transactional model which applies changes to the subtitle file only if a macro runs to completion without errors or the user cancelling. Significantly improves behavior when the user cancels and fixes a race condition caused by committing on threads other than the GUI thread.
Originally committed to SVN as r5650.
2011-09-28 19:50:14 +00:00
Thomas Goyne 5bb5f146a7 Make the project context available to lua C functions so that they can use that instead of VideoContext::Get()
Originally committed to SVN as r5647.
2011-09-28 19:49:47 +00:00
Thomas Goyne a9dc1f045d Remove "Config" from the name of ScriptConfigDialog and friends as they're used for more than just config, and clean up the implementations.
Originally committed to SVN as r5645.
2011-09-28 19:49:27 +00:00
Thomas Goyne 59d11f4cc4 Make it so auto4lua macros can have an IsActive function. Probably not very useful at the moment.
Originally committed to SVN as r5644.
2011-09-28 19:49:18 +00:00
Thomas Goyne 60ea67661a Do a better job of setting the module load path in LuaAssFile
Originally committed to SVN as r5643.
2011-09-28 19:49:09 +00:00
Thomas Goyne eec3d64221 Make automation macros standard commands and remove the Automation4::Feature base class as it's no longer a useful abstraction.
Originally committed to SVN as r5641.
2011-09-28 19:48:47 +00:00
Thomas Goyne 492a0d3046 Make Automation4::Script mostly pure abstract and clean up the implementation of LuaScript
Originally committed to SVN as r5640.
2011-09-28 19:48:37 +00:00
Thomas Goyne c09259c93d Throw typed exceptions in automation rather than strings
Originally committed to SVN as r5639.
2011-09-28 19:48:28 +00:00
Thomas Goyne 53b6765dd8 Redesign DialogProgress
Add agi::ProgressSink and agi::BackgroundRunner interfaces to libaegisub
which represent a generic progress sink and a thing which calls funtions
that need progress sinks. Make DialogProgress implement
agi::BackgroundRunner, invoking the passed function on a worker thread
and giving it a progress sink to update the dialog with.

Rewrite Automation4::ProgressSink, LuaThreadedCall and all related
classes to be based on agi::ProgressSink. Automation now simply uses
DialogProgress (although that's merely an implementation detail) and
adds a single method to route dialog opening from the worker thread to
the GUI thread.

Originally committed to SVN as r5634.
2011-09-28 19:47:40 +00:00
Thomas Goyne 53c0b6ff3a Clean up and document ScriptFactory, and add a function to get the full wildcard string for all registered automation engines
Originally committed to SVN as r5624.
2011-09-28 19:46:05 +00:00