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/
2006-12-28 22:18:35 +01:00
//
2009-07-29 07:43:02 +02:00
// $Id$
/// @file auto4_base.cpp
/// @brief Baseclasses for Automation 4 scripting framework
/// @ingroup scripting
///
2006-12-28 22:18:35 +01:00
2009-01-04 07:31:48 +01:00
# include "config.h"
2009-09-10 15:06:40 +02:00
# ifndef AGI_PRE
# ifdef __WINDOWS__
# include <tchar.h>
# include <windows.h>
# endif
# include <wx/button.h>
# include <wx/dcmemory.h>
# include <wx/dir.h>
# include <wx/filefn.h>
# include <wx/filename.h>
# include <wx/log.h>
# include <wx/msgdlg.h>
2006-12-28 22:18:35 +01:00
# include <wx/thread.h>
# include <wx/tokenzr.h>
2009-09-10 15:06:40 +02:00
# endif
2006-12-28 22:18:35 +01:00
2009-09-10 15:06:40 +02:00
# ifndef __WINDOWS__
2006-12-28 22:18:35 +01:00
# include <ft2build.h>
# include FT_FREETYPE_H
# endif
2009-09-10 15:06:40 +02:00
# include "ass_file.h"
# include "ass_style.h"
# include "auto4_base.h"
2010-05-21 03:13:36 +02:00
# include "compat.h"
2011-09-28 21:47:40 +02:00
# include "dialog_progress.h"
2011-09-28 21:45:55 +02:00
# include "include/aegisub/context.h"
2010-05-21 03:13:36 +02:00
# include "main.h"
2009-09-10 15:06:40 +02:00
# include "standard_paths.h"
# include "string_codec.h"
2011-09-28 21:45:55 +02:00
# include "utils.h"
2009-09-10 15:06:40 +02:00
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
/// DOCME
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
/// @brief DOCME
/// @param style
/// @param text
/// @param width
/// @param height
/// @param descent
/// @param extlead
/// @return
///
2007-01-15 18:02:39 +01:00
bool CalculateTextExtents ( AssStyle * style , wxString & text , double & width , double & height , double & descent , double & extlead )
2006-12-28 22:18:35 +01:00
{
width = height = descent = extlead = 0 ;
2007-01-15 18:02:39 +01:00
double fontsize = style - > fontsize * 64 ;
double spacing = style - > spacing * 64 ;
2006-12-28 22:18:35 +01:00
# ifdef WIN32
// This is almost copypasta from TextSub
HDC thedc = CreateCompatibleDC ( 0 ) ;
if ( ! thedc ) return false ;
SetMapMode ( thedc , MM_TEXT ) ;
2007-01-10 02:36:05 +01:00
LOGFONTW lf ;
2006-12-28 22:18:35 +01:00
ZeroMemory ( & lf , sizeof ( lf ) ) ;
2007-01-15 16:27:13 +01:00
lf . lfHeight = ( LONG ) fontsize ;
2006-12-28 22:18:35 +01:00
lf . lfWeight = style - > bold ? FW_BOLD : FW_NORMAL ;
lf . lfItalic = style - > italic ;
lf . lfUnderline = style - > underline ;
lf . lfStrikeOut = style - > strikeout ;
lf . lfCharSet = style - > encoding ;
lf . lfOutPrecision = OUT_TT_PRECIS ;
lf . lfClipPrecision = CLIP_DEFAULT_PRECIS ;
lf . lfQuality = ANTIALIASED_QUALITY ;
lf . lfPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE ;
2011-09-28 21:43:48 +02:00
wcsncpy ( lf . lfFaceName , style - > font . wc_str ( ) , 32 ) ;
2006-12-28 22:18:35 +01:00
HFONT thefont = CreateFontIndirect ( & lf ) ;
if ( ! thefont ) return false ;
SelectObject ( thedc , thefont ) ;
SIZE sz ;
size_t thetextlen = text . length ( ) ;
2007-01-10 02:36:05 +01:00
const TCHAR * thetext = text . wc_str ( ) ;
2007-01-15 18:02:39 +01:00
if ( spacing ! = 0 ) {
2006-12-28 22:18:35 +01:00
width = 0 ;
for ( unsigned int i = 0 ; i < thetextlen ; i + + ) {
GetTextExtentPoint32 ( thedc , & thetext [ i ] , 1 , & sz ) ;
2007-01-15 18:02:39 +01:00
width + = sz . cx + spacing ;
2006-12-28 22:18:35 +01:00
height = sz . cy ;
}
} else {
GetTextExtentPoint32 ( thedc , thetext , ( int ) thetextlen , & sz ) ;
width = sz . cx ;
height = sz . cy ;
}
// HACKISH FIX! This seems to work, but why? It shouldn't be needed?!?
2007-01-15 18:02:39 +01:00
//fontsize = style->fontsize;
//width = (int)(width * fontsize/height + 0.5);
//height = (int)(fontsize + 0.5);
2006-12-28 22:18:35 +01:00
TEXTMETRIC tm ;
GetTextMetrics ( thedc , & tm ) ;
descent = tm . tmDescent ;
extlead = tm . tmExternalLeading ;
DeleteObject ( thedc ) ;
DeleteObject ( thefont ) ;
# else // not WIN32
wxMemoryDC thedc ;
// fix fontsize to be 72 DPI
2007-01-15 18:02:39 +01:00
//fontsize = -FT_MulDiv((int)(fontsize+0.5), 72, thedc.GetPPI().y);
2006-12-28 22:18:35 +01:00
// now try to get a font!
// use the font list to get some caching... (chance is the script will need the same font very often)
// USING wxTheFontList SEEMS TO CAUSE BAD LEAKS!
//wxFont *thefont = wxTheFontList->FindOrCreateFont(
wxFont thefont (
2007-01-15 16:27:13 +01:00
( int ) fontsize ,
2006-12-28 22:18:35 +01:00
wxFONTFAMILY_DEFAULT ,
style - > italic ? wxFONTSTYLE_ITALIC : wxFONTSTYLE_NORMAL ,
style - > bold ? wxFONTWEIGHT_BOLD : wxFONTWEIGHT_NORMAL ,
style - > underline ,
style - > font ,
wxFONTENCODING_SYSTEM ) ; // FIXME! make sure to get the right encoding here, make some translation table between windows and wx encodings
thedc . SetFont ( thefont ) ;
2007-01-15 18:02:39 +01:00
if ( spacing ) {
2006-12-28 22:18:35 +01:00
// If there's inter-character spacing, kerning info must not be used, so calculate width per character
// NOTE: Is kerning actually done either way?!
2007-01-03 19:51:25 +01:00
for ( unsigned int i = 0 ; i < text . length ( ) ; i + + ) {
2006-12-28 22:18:35 +01:00
int a , b , c , d ;
2007-01-03 19:51:25 +01:00
thedc . GetTextExtent ( text [ i ] , & a , & b , & c , & d ) ;
2007-08-16 18:02:52 +02:00
double scaling = fontsize / ( double ) ( b > 0 ? b : 1 ) ; // semi-workaround for missing OS/2 table data for scaling
width + = ( a + spacing ) * scaling ;
height = b > height ? b * scaling : height ;
descent = c > descent ? c * scaling : descent ;
extlead = d > extlead ? d * scaling : extlead ;
2006-12-28 22:18:35 +01:00
}
} else {
// If the inter-character spacing should be zero, kerning info can (and must) be used, so calculate everything in one go
2009-09-02 10:45:09 +02:00
wxCoord lwidth , lheight , ldescent , lextlead ;
2007-01-24 03:35:09 +01:00
thedc . GetTextExtent ( text , & lwidth , & lheight , & ldescent , & lextlead ) ;
2007-08-16 18:02:52 +02:00
double scaling = fontsize / ( double ) ( lheight > 0 ? lheight : 1 ) ; // semi-workaround for missing OS/2 table data for scaling
width = lwidth * scaling ; height = lheight * scaling ; descent = ldescent * scaling ; extlead = lextlead * scaling ;
2006-12-28 22:18:35 +01:00
}
# endif
// Compensate for scaling
2007-01-15 18:02:39 +01:00
width = style - > scalex / 100 * width / 64 ;
2007-08-16 18:02:52 +02:00
height = style - > scaley / 100 * height / 64 ;
descent = style - > scaley / 100 * descent / 64 ;
extlead = style - > scaley / 100 * extlead / 64 ;
2006-12-28 22:18:35 +01:00
return true ;
}
// Feature
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
/// @brief DOCME
/// @param _featureclass
/// @param _name
///
2006-12-28 22:18:35 +01:00
Feature : : Feature ( ScriptFeatureClass _featureclass , const wxString & _name )
: featureclass ( _featureclass )
, name ( _name )
{
// nothing to do
}
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
/// @brief DOCME
/// @return
///
2006-12-28 22:18:35 +01:00
ScriptFeatureClass Feature : : GetClass ( ) const
{
return featureclass ;
}
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
/// @brief DOCME
/// @return
///
2006-12-28 22:18:35 +01:00
FeatureMacro * Feature : : AsMacro ( )
{
if ( featureclass = = SCRIPTFEATURE_MACRO )
// For VS, remember to enable building with RTTI, otherwise dynamic_cast<> won't work
return dynamic_cast < FeatureMacro * > ( this ) ;
return 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
/// @brief DOCME
/// @return
///
2006-12-28 22:18:35 +01:00
FeatureFilter * Feature : : AsFilter ( )
{
if ( featureclass = = SCRIPTFEATURE_FILTER )
return dynamic_cast < FeatureFilter * > ( this ) ;
return 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
/// @brief DOCME
/// @return
///
2006-12-28 22:18:35 +01:00
FeatureSubtitleFormat * Feature : : AsSubFormat ( )
{
if ( featureclass = = SCRIPTFEATURE_SUBFORMAT )
return dynamic_cast < FeatureSubtitleFormat * > ( this ) ;
return 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
/// @brief DOCME
/// @return
///
2006-12-28 22:18:35 +01:00
const wxString & Feature : : GetName ( ) const
{
return name ;
}
// FeatureMacro
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
/// @brief DOCME
/// @param _name
/// @param _description
///
2007-01-03 05:31:17 +01:00
FeatureMacro : : FeatureMacro ( const wxString & _name , const wxString & _description )
2006-12-28 22:18:35 +01:00
: Feature ( SCRIPTFEATURE_MACRO , _name )
, description ( _description )
{
// nothing to do
}
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
/// @brief DOCME
/// @return
///
2006-12-28 22:18:35 +01:00
const wxString & FeatureMacro : : GetDescription ( ) const
{
return description ;
}
// FeatureFilter
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
/// @brief DOCME
/// @param _name
/// @param _description
/// @param _priority
///
2006-12-28 22:18:35 +01:00
FeatureFilter : : FeatureFilter ( const wxString & _name , const wxString & _description , int _priority )
: Feature ( SCRIPTFEATURE_FILTER , _name )
2011-01-21 07:09:04 +01:00
, AssExportFilter ( _name , _description , _priority )
2011-09-28 21:48:28 +02:00
, config_dialog ( 0 )
2006-12-28 22:18:35 +01:00
{
2011-01-21 07:09:04 +01:00
AssExportFilterChain : : Register ( this ) ;
2006-12-28 22:18:35 +01:00
}
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
/// @brief DOCME
///
2006-12-28 22:18:35 +01:00
FeatureFilter : : ~ FeatureFilter ( )
{
2011-01-21 07:09:04 +01:00
AssExportFilterChain : : Unregister ( this ) ;
2006-12-28 22:18:35 +01:00
}
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
/// @brief DOCME
/// @return
///
2007-04-04 02:01:17 +02:00
wxString FeatureFilter : : GetScriptSettingsIdentifier ( )
{
2011-09-28 21:47:40 +02:00
return inline_string_encode ( wxString : : Format ( " Automation Settings %s " , AssExportFilter : : GetName ( ) ) ) ;
2007-04-04 02:01:17 +02:00
}
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
/// @brief DOCME
/// @param parent
/// @return
///
2006-12-28 22:18:35 +01:00
wxWindow * FeatureFilter : : GetConfigDialogWindow ( wxWindow * parent ) {
if ( config_dialog ) {
delete config_dialog ;
config_dialog = 0 ;
}
2007-01-24 04:54:32 +01:00
if ( ( config_dialog = GenerateConfigDialog ( parent ) ) ! = NULL ) {
2007-04-04 02:01:17 +02:00
wxString val = AssFile : : top - > GetScriptInfo ( GetScriptSettingsIdentifier ( ) ) ;
if ( ! val . IsEmpty ( ) ) {
config_dialog - > Unserialise ( val ) ;
}
2006-12-28 22:18:35 +01:00
return config_dialog - > GetWindow ( parent ) ;
} else {
return 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
/// @brief DOCME
/// @param IsDefault
///
2006-12-28 22:18:35 +01:00
void FeatureFilter : : LoadSettings ( bool IsDefault ) {
if ( config_dialog ) {
config_dialog - > ReadBack ( ) ;
2007-04-04 02:01:17 +02:00
wxString val = config_dialog - > Serialise ( ) ;
if ( ! val . IsEmpty ( ) ) {
AssFile : : top - > SetScriptInfo ( GetScriptSettingsIdentifier ( ) , val ) ;
}
2006-12-28 22:18:35 +01:00
}
}
// FeatureSubtitleFormat
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
/// @brief DOCME
/// @param _name
/// @param _extension
///
2006-12-28 22:18:35 +01:00
FeatureSubtitleFormat : : FeatureSubtitleFormat ( const wxString & _name , const wxString & _extension )
: Feature ( SCRIPTFEATURE_SUBFORMAT , _name )
2011-09-28 21:44:53 +02:00
, SubtitleFormat ( _name )
2006-12-28 22:18:35 +01:00
, extension ( _extension )
{
// nothing to do
}
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
/// @brief DOCME
/// @return
///
2006-12-28 22:18:35 +01:00
const wxString & FeatureSubtitleFormat : : GetExtension ( ) const
{
return extension ;
}
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
/// @brief DOCME
/// @param filename
/// @return
///
2006-12-28 22:18:35 +01:00
bool FeatureSubtitleFormat : : CanWriteFile ( wxString filename )
{
return ! filename . Right ( extension . Length ( ) ) . CmpNoCase ( extension ) ;
}
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
/// @brief DOCME
/// @param filename
/// @return
///
2006-12-28 22:18:35 +01:00
bool FeatureSubtitleFormat : : CanReadFile ( wxString filename )
{
return ! filename . Right ( extension . Length ( ) ) . CmpNoCase ( extension ) ;
}
// ScriptConfigDialog
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
/// @brief DOCME
/// @param parent
/// @return
///
2006-12-28 22:18:35 +01:00
wxWindow * ScriptConfigDialog : : GetWindow ( wxWindow * parent )
{
if ( win ) return win ;
return win = CreateWindow ( parent ) ;
}
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
/// @brief DOCME
///
2006-12-28 22:18:35 +01:00
void ScriptConfigDialog : : DeleteWindow ( )
{
if ( win ) delete win ;
win = 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
/// @brief DOCME
/// @return
///
2007-04-04 02:01:17 +02:00
wxString ScriptConfigDialog : : Serialise ( )
{
2011-09-28 21:43:11 +02:00
return " " ;
2007-04-04 02:01:17 +02:00
}
2006-12-28 22:18:35 +01:00
// ProgressSink
2011-09-28 21:47:40 +02:00
wxDEFINE_EVENT ( EVT_SHOW_CONFIG_DIALOG , wxThreadEvent ) ;
2006-12-28 22:18:35 +01:00
2011-09-28 21:47:40 +02:00
ProgressSink : : ProgressSink ( agi : : ProgressSink * impl , BackgroundScriptRunner * bsr )
: impl ( impl )
, bsr ( bsr )
, trace_level ( OPT_GET ( " Automation/Trace Level " ) - > GetInt ( ) )
2006-12-28 22:18:35 +01:00
{
}
2011-09-28 21:47:40 +02:00
void ProgressSink : : ShowConfigDialog ( ScriptConfigDialog * config_dialog )
2006-12-28 22:18:35 +01:00
{
2011-09-28 21:47:40 +02:00
wxSemaphore sema ( 0 , 1 ) ;
wxThreadEvent * evt = new wxThreadEvent ( EVT_SHOW_CONFIG_DIALOG ) ;
evt - > SetPayload ( std : : make_pair ( config_dialog , & sema ) ) ;
bsr - > QueueEvent ( evt ) ;
sema . Wait ( ) ;
2006-12-28 22:18:35 +01:00
}
2011-09-28 21:47:40 +02:00
BackgroundScriptRunner : : BackgroundScriptRunner ( wxWindow * parent , wxString const & title )
: impl ( new DialogProgress ( parent , title ) )
2006-12-28 22:18:35 +01:00
{
2011-09-28 21:47:40 +02:00
impl - > Bind ( EVT_SHOW_CONFIG_DIALOG , & BackgroundScriptRunner : : OnConfigDialog , this ) ;
2006-12-28 22:18:35 +01:00
}
2011-09-28 21:47:40 +02:00
BackgroundScriptRunner : : ~ BackgroundScriptRunner ( )
2006-12-28 22:18:35 +01:00
{
}
2011-09-28 21:47:40 +02:00
void BackgroundScriptRunner : : OnConfigDialog ( wxThreadEvent & evt )
2006-12-28 22:18:35 +01:00
{
2011-09-28 21:47:40 +02:00
std : : pair < ScriptConfigDialog * , wxSemaphore * > payload = evt . GetPayload < std : : pair < ScriptConfigDialog * , wxSemaphore * > > ( ) ;
2006-12-28 22:18:35 +01:00
2011-09-28 21:47:40 +02:00
wxDialog w ( impl . get ( ) , - 1 , impl - > GetTitle ( ) ) ; // container dialog box
wxBoxSizer * s = new wxBoxSizer ( wxHORIZONTAL ) ; // sizer for putting contents in
wxWindow * ww = payload . first - > GetWindow ( & w ) ; // get/generate actual dialog contents
s - > Add ( ww , 0 , wxALL , 5 ) ; // add contents to dialog
w . SetSizerAndFit ( s ) ;
w . CenterOnParent ( ) ;
w . ShowModal ( ) ;
payload . first - > ReadBack ( ) ;
payload . first - > DeleteWindow ( ) ;
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:47:40 +02:00
payload . second - > Post ( ) ;
2006-12-28 22:18:35 +01:00
}
2011-09-28 21:47:40 +02:00
void BackgroundScriptRunner : : QueueEvent ( wxEvent * evt ) {
wxQueueEvent ( impl . get ( ) , evt ) ;
2006-12-28 22:18:35 +01:00
}
2011-09-28 21:47:40 +02:00
// Convert a function taking an Automation4::ProgressSink to one taking an
// agi::ProgressSink so that we can pass it to an agi::BackgroundWorker
static void progress_sink_wrapper ( std : : tr1 : : function < void ( ProgressSink * ) > task , agi : : ProgressSink * ps , BackgroundScriptRunner * bsr )
2006-12-28 22:18:35 +01:00
{
2011-09-28 21:47:40 +02:00
ProgressSink aps ( ps , bsr ) ;
task ( & aps ) ;
2006-12-28 22:18:35 +01:00
}
2011-09-28 21:47:40 +02:00
void BackgroundScriptRunner : : Run ( std : : tr1 : : function < void ( ProgressSink * ) > task )
2006-12-28 22:18:35 +01:00
{
2011-09-28 21:47:40 +02:00
int prio = OPT_GET ( " Automation/Thread Priority " ) - > GetInt ( ) ;
if ( prio = = 0 ) prio = 50 ; // normal
else if ( prio = = 1 ) prio = 30 ; // below normal
else if ( prio = = 2 ) prio = 10 ; // lowest
else prio = 50 ; // fallback normal
2006-12-28 22:18:35 +01:00
2011-09-28 21:47:40 +02:00
impl - > Run ( bind ( progress_sink_wrapper , task , std : : tr1 : : placeholders : : _1 , this ) , prio ) ;
2006-12-28 22:18:35 +01:00
}
// Script
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
/// @brief DOCME
/// @param _filename
///
2006-12-28 22:18:35 +01:00
Script : : Script ( const wxString & _filename )
: filename ( _filename )
2011-09-28 21:43:11 +02:00
, name ( " " )
, description ( " " )
, author ( " " )
, version ( " " )
2006-12-28 22:18:35 +01:00
, loaded ( false )
{
// copied from auto3
include_path . clear ( ) ;
include_path . EnsureFileAccessible ( filename ) ;
2011-09-28 21:43:11 +02:00
wxStringTokenizer toker ( lagi_wxString ( OPT_GET ( " Path/Automation/Include " ) - > GetString ( ) ) , " | " , wxTOKEN_STRTOK ) ;
2006-12-28 22:18:35 +01:00
while ( toker . HasMoreTokens ( ) ) {
// todo? make some error reporting here
2007-06-21 02:46:50 +02:00
wxFileName path ( StandardPaths : : DecodePath ( toker . GetNextToken ( ) ) ) ;
2006-12-28 22:18:35 +01:00
if ( ! path . IsOk ( ) ) continue ;
if ( path . IsRelative ( ) ) continue ;
if ( ! path . DirExists ( ) ) continue ;
include_path . Add ( path . GetLongPath ( ) ) ;
}
}
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
/// @brief DOCME
///
2006-12-28 22:18:35 +01:00
Script : : ~ Script ( )
{
for ( std : : vector < Feature * > : : iterator f = features . begin ( ) ; f ! = features . end ( ) ; + + f ) {
delete * f ;
}
}
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
/// @brief DOCME
/// @return
///
2007-02-14 01:43:01 +01:00
wxString Script : : GetPrettyFilename ( ) const
{
wxFileName fn ( filename ) ;
return fn . GetFullName ( ) ;
}
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
/// @brief DOCME
/// @return
///
2006-12-28 22:18:35 +01:00
const wxString & Script : : GetFilename ( ) const
{
return filename ;
}
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
/// @brief DOCME
/// @return
///
2006-12-28 22:18:35 +01:00
const wxString & Script : : GetName ( ) const
{
return 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
/// @brief DOCME
/// @return
///
2006-12-28 22:18:35 +01:00
const wxString & Script : : GetDescription ( ) const
{
return description ;
}
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
/// @brief DOCME
/// @return
///
2006-12-28 22:18:35 +01:00
const wxString & Script : : GetAuthor ( ) const
{
return author ;
}
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
/// @brief DOCME
/// @return
///
2006-12-28 22:18:35 +01:00
const wxString & Script : : GetVersion ( ) const
{
return version ;
}
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
/// @brief DOCME
/// @return
///
2006-12-28 22:18:35 +01:00
bool Script : : GetLoadedState ( ) const
{
return loaded ;
}
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
/// @brief DOCME
/// @return
///
2006-12-28 22:18:35 +01:00
std : : vector < Feature * > & Script : : GetFeatures ( )
{
return features ;
}
// ScriptManager
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
/// @brief DOCME
///
2006-12-28 22:18:35 +01:00
ScriptManager : : ScriptManager ( )
{
// do nothing...?
}
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
/// @brief DOCME
///
2006-12-28 22:18:35 +01:00
ScriptManager : : ~ ScriptManager ( )
{
RemoveAll ( ) ;
}
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
/// @brief DOCME
/// @param script
/// @return
///
2006-12-28 22:18:35 +01:00
void ScriptManager : : Add ( Script * script )
{
for ( std : : vector < Script * > : : iterator i = scripts . begin ( ) ; i ! = scripts . end ( ) ; + + i ) {
if ( script = = * i ) return ;
}
scripts . push_back ( script ) ;
}
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
/// @brief DOCME
/// @param script
/// @return
///
2006-12-28 22:18:35 +01:00
void ScriptManager : : Remove ( Script * script )
{
for ( std : : vector < Script * > : : iterator i = scripts . begin ( ) ; i ! = scripts . end ( ) ; + + i ) {
if ( script = = * i ) {
delete * i ;
scripts . erase ( i ) ;
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
/// @brief DOCME
///
2006-12-28 22:18:35 +01:00
void ScriptManager : : RemoveAll ( )
{
for ( std : : vector < Script * > : : iterator i = scripts . begin ( ) ; i ! = scripts . end ( ) ; + + i ) {
delete * i ;
}
scripts . clear ( ) ;
}
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
/// @brief DOCME
/// @return
///
2006-12-28 22:18:35 +01:00
const std : : vector < Script * > & ScriptManager : : GetScripts ( ) const
{
return scripts ;
}
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
/// @brief DOCME
/// @return
///
2007-01-03 05:31:17 +01:00
const std : : vector < FeatureMacro * > & ScriptManager : : GetMacros ( )
2006-12-28 22:18:35 +01:00
{
2007-01-03 05:31:17 +01:00
macros . clear ( ) ;
2006-12-28 22:18:35 +01:00
for ( std : : vector < Script * > : : iterator i = scripts . begin ( ) ; i ! = scripts . end ( ) ; + + i ) {
std : : vector < Feature * > & sfs = ( * i ) - > GetFeatures ( ) ;
for ( std : : vector < Feature * > : : iterator j = sfs . begin ( ) ; j ! = sfs . end ( ) ; + + j ) {
FeatureMacro * m = dynamic_cast < FeatureMacro * > ( * j ) ;
if ( ! m ) continue ;
2007-01-03 05:31:17 +01:00
macros . push_back ( m ) ;
2006-12-28 22:18:35 +01:00
}
}
2007-01-03 05:31:17 +01:00
return macros ;
2006-12-28 22:18:35 +01:00
}
// AutoloadScriptManager
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
/// @brief DOCME
/// @param _path
///
2006-12-28 22:18:35 +01:00
AutoloadScriptManager : : AutoloadScriptManager ( const wxString & _path )
: path ( _path )
{
Reload ( ) ;
}
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
/// @brief DOCME
///
2006-12-28 22:18:35 +01:00
void AutoloadScriptManager : : Reload ( )
{
RemoveAll ( ) ;
int error_count = 0 ;
2011-09-28 21:43:11 +02:00
wxStringTokenizer tok ( path , " | " , wxTOKEN_STRTOK ) ;
2007-06-10 03:49:11 +02:00
while ( tok . HasMoreTokens ( ) ) {
wxDir dir ;
2007-06-21 02:46:50 +02:00
wxString dirname = StandardPaths : : DecodePath ( tok . GetNextToken ( ) ) ;
2007-06-10 03:49:11 +02:00
if ( ! dir . Exists ( dirname ) ) {
2011-09-28 21:43:11 +02:00
//wxLogWarning("A directory was specified in the Automation autoload path, but it doesn't exist: %s", dirname.c_str());
2007-06-10 03:49:11 +02:00
continue ;
2006-12-28 22:18:35 +01:00
}
2007-06-10 03:49:11 +02:00
if ( ! dir . Open ( dirname ) ) {
2011-09-28 21:43:11 +02:00
//wxLogWarning("Failed to open a directory in the Automation autoload path: %s", dirname.c_str());
2007-06-10 03:49:11 +02:00
continue ;
2006-12-28 22:18:35 +01:00
}
2007-06-10 03:49:11 +02:00
wxString fn ;
2011-09-28 21:43:11 +02:00
wxFileName script_path ( dirname + " / " , " " ) ;
2007-06-10 03:49:11 +02:00
bool more = dir . GetFirst ( & fn , wxEmptyString , wxDIR_FILES ) ;
while ( more ) {
script_path . SetName ( fn ) ;
2011-09-28 21:48:28 +02:00
wxString fullpath = script_path . GetFullPath ( ) ;
if ( ScriptFactory : : CanHandleScriptFormat ( fullpath ) ) {
Script * s = ScriptFactory : : CreateFromFile ( fullpath , true ) ;
Add ( s ) ;
if ( ! s - > GetLoadedState ( ) ) error_count + + ;
}
2007-06-10 03:49:11 +02:00
more = dir . GetNext ( & fn ) ;
2006-12-28 22:18:35 +01:00
}
}
2007-06-10 03:49:11 +02:00
if ( error_count > 0 ) {
2011-09-28 21:43:11 +02:00
wxLogWarning ( " One or more scripts placed in the Automation autoload directory failed to load \n Please review the errors above, correct them and use the Reload Autoload dir button in Automation Manager to attempt loading the scripts again. " ) ;
2006-12-28 22:18:35 +01:00
}
}
2011-09-28 21:45:55 +02:00
LocalScriptManager : : LocalScriptManager ( agi : : Context * c )
: context ( c )
{
slots . push_back ( c - > ass - > AddFileSaveListener ( & LocalScriptManager : : OnSubtitlesSave , this ) ) ;
slots . push_back ( c - > ass - > AddFileOpenListener ( & LocalScriptManager : : Reload , this ) ) ;
}
void LocalScriptManager : : Reload ( ) {
RemoveAll ( ) ;
wxString local_scripts = context - > ass - > GetScriptInfo ( " Automation Scripts " ) ;
if ( local_scripts . empty ( ) ) return ;
2006-12-28 22:18:35 +01:00
2011-09-28 21:45:55 +02:00
wxStringTokenizer tok ( local_scripts , " | " , wxTOKEN_STRTOK ) ;
wxFileName assfn ( context - > ass - > filename ) ;
wxString autobasefn ( lagi_wxString ( OPT_GET ( " Path/Automation/Base " ) - > GetString ( ) ) ) ;
while ( tok . HasMoreTokens ( ) ) {
wxString trimmed = tok . GetNextToken ( ) . Trim ( true ) . Trim ( false ) ;
char first_char = trimmed [ 0 ] ;
trimmed . Remove ( 0 , 1 ) ;
wxString basepath ;
if ( first_char = = ' ~ ' ) {
basepath = assfn . GetPath ( ) ;
} else if ( first_char = = ' $ ' ) {
basepath = autobasefn ;
} else if ( first_char = = ' / ' ) {
basepath = " " ;
} else {
wxLogWarning ( " Automation Script referenced with unknown location specifier character. \n Location specifier found: %c \n Filename specified: %s " ,
first_char , trimmed ) ;
continue ;
}
wxFileName sfname ( trimmed ) ;
sfname . MakeAbsolute ( basepath ) ;
if ( sfname . FileExists ( ) ) {
wxString err ;
Add ( Automation4 : : ScriptFactory : : CreateFromFile ( sfname . GetFullPath ( ) , true ) ) ;
} else {
wxLogWarning ( " Automation Script referenced could not be found. \n Filename specified: %c%s \n Searched relative to: %s \n Resolved filename: %s " ,
first_char , trimmed , basepath , sfname . GetFullPath ( ) ) ;
}
}
}
void LocalScriptManager : : OnSubtitlesSave ( ) {
// Store Automation script data
// Algorithm:
// 1. If script filename has Automation Base Path as a prefix, the path is relative to that (ie. "$")
// 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 ("/")
// 4. Otherwise, use path relative to ass ("~")
wxString scripts_string ;
wxString autobasefn ( lagi_wxString ( OPT_GET ( " Path/Automation/Base " ) - > GetString ( ) ) ) ;
for ( size_t i = 0 ; i < GetScripts ( ) . size ( ) ; i + + ) {
Script * script = GetScripts ( ) [ i ] ;
if ( i ! = 0 )
scripts_string + = " | " ;
wxString autobase_rel , assfile_rel ;
wxString scriptfn ( script - > GetFilename ( ) ) ;
autobase_rel = MakeRelativePath ( scriptfn , autobasefn ) ;
assfile_rel = MakeRelativePath ( scriptfn , context - > ass - > filename ) ;
if ( autobase_rel . size ( ) < = scriptfn . size ( ) & & autobase_rel . size ( ) < = assfile_rel . size ( ) ) {
scriptfn = " $ " + autobase_rel ;
} else if ( assfile_rel . size ( ) < = scriptfn . size ( ) & & assfile_rel . size ( ) < = autobase_rel . size ( ) ) {
scriptfn = " ~ " + assfile_rel ;
} else {
scriptfn = " / " + wxFileName ( scriptfn ) . GetFullPath ( wxPATH_UNIX ) ;
}
scripts_string + = scriptfn ;
}
context - > ass - > SetScriptInfo ( " Automation Scripts " , scripts_string ) ;
}
2006-12-28 22:18:35 +01:00
// ScriptFactory
2006-12-29 00:03:26 +01:00
std : : vector < ScriptFactory * > * ScriptFactory : : factories = 0 ;
2006-12-28 22:18:35 +01:00
2011-09-28 21:46:05 +02:00
ScriptFactory : : ScriptFactory ( wxString engine_name , wxString filename_pattern )
: engine_name ( engine_name )
, filename_pattern ( filename_pattern )
2006-12-28 22:18:35 +01:00
{
}
void ScriptFactory : : Register ( ScriptFactory * factory )
{
2011-09-28 21:46:05 +02:00
GetFactories ( ) ;
if ( find ( factories - > begin ( ) , factories - > end ( ) , factory ) ! = factories - > end ( ) )
2011-09-28 21:48:28 +02:00
throw agi : : InternalError ( " Automation 4: Attempt to register the same script factory multiple times. This should never happen. " , 0 ) ;
2006-12-29 00:03:26 +01:00
factories - > push_back ( factory ) ;
2006-12-28 22:18:35 +01:00
}
void ScriptFactory : : Unregister ( ScriptFactory * factory )
{
2011-09-28 21:46:05 +02:00
if ( ! factories ) return ;
2006-12-29 00:03:26 +01:00
2011-09-28 21:46:05 +02:00
std : : vector < ScriptFactory * > : : iterator i = find ( factories - > begin ( ) , factories - > end ( ) , factory ) ;
if ( i ! = factories - > end ( ) ) {
delete * i ;
factories - > erase ( i ) ;
2006-12-28 22:18:35 +01:00
}
}
2011-09-28 21:46:05 +02:00
Script * ScriptFactory : : CreateFromFile ( wxString const & filename , bool log_errors )
2006-12-28 22:18:35 +01:00
{
2011-09-28 21:46:05 +02:00
GetFactories ( ) ;
2006-12-29 00:03:26 +01:00
for ( std : : vector < ScriptFactory * > : : iterator i = factories - > begin ( ) ; i ! = factories - > end ( ) ; + + i ) {
2011-09-28 21:46:05 +02:00
Script * s = ( * i ) - > Produce ( filename ) ;
if ( s ) {
if ( ! s - > GetLoadedState ( ) & & log_errors )
wxLogError ( _ ( " An Automation script failed to load. File name: '%s', error reported: %s " ) , filename , s - > GetDescription ( ) ) ;
return s ;
2007-01-15 23:19:50 +01:00
}
2007-06-10 03:49:11 +02:00
}
2011-09-28 21:46:05 +02:00
if ( log_errors )
wxLogError ( _ ( " The file was not recognised as an Automation script: %s " ) , filename ) ;
2006-12-28 22:18:35 +01:00
return new UnknownScript ( filename ) ;
}
2011-09-28 21:46:05 +02:00
bool ScriptFactory : : CanHandleScriptFormat ( wxString const & filename )
2008-01-18 04:45:43 +01:00
{
2011-09-28 21:46:05 +02:00
using std : : tr1 : : placeholders : : _1 ;
2008-01-18 04:45:43 +01:00
// Just make this always return true to bitch about unknown script formats in autoload
2011-09-28 21:46:05 +02:00
GetFactories ( ) ;
return find_if ( factories - > begin ( ) , factories - > end ( ) ,
bind ( & wxString : : Matches , filename , bind ( & ScriptFactory : : GetFilenamePattern , _1 ) ) ) ! = factories - > end ( ) ;
2008-01-18 04:45:43 +01:00
}
2006-12-28 22:18:35 +01:00
const std : : vector < ScriptFactory * > & ScriptFactory : : GetFactories ( )
{
2006-12-29 00:03:26 +01:00
if ( ! factories )
factories = new std : : vector < ScriptFactory * > ( ) ;
return * factories ;
2006-12-28 22:18:35 +01:00
}
2011-09-28 21:46:05 +02:00
wxString ScriptFactory : : GetWildcardStr ( )
{
GetFactories ( ) ;
wxString fnfilter , catchall ;
for ( size_t i = 0 ; i < factories - > size ( ) ; + + i ) {
const ScriptFactory * fact = ( * factories ) [ i ] ;
if ( fact - > GetEngineName ( ) . empty ( ) | | fact - > GetFilenamePattern ( ) . empty ( ) )
continue ;
fnfilter = wxString : : Format ( " %s%s scripts (%s)|%s| " , fnfilter , fact - > GetEngineName ( ) , fact - > GetFilenamePattern ( ) , fact - > GetFilenamePattern ( ) ) ;
catchall + = fact - > GetFilenamePattern ( ) + " ; " ;
}
# ifdef __WINDOWS__
fnfilter + = " All files|*.* " ;
# else
fnfilter + = " All files|* " ;
# endif
if ( ! catchall . empty ( ) )
catchall . RemoveLast ( ) ;
if ( factories - > size ( ) > 1 )
fnfilter = " All supported scripts| " + catchall + " | " + fnfilter ;
return fnfilter ;
}
2006-12-28 22:18:35 +01:00
// UnknownScript
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
/// @brief DOCME
/// @param filename
///
2006-12-28 22:18:35 +01:00
UnknownScript : : UnknownScript ( const wxString & filename )
2011-09-28 21:48:28 +02:00
: Script ( filename )
2006-12-28 22:18:35 +01:00
{
wxFileName fn ( filename ) ;
name = fn . GetName ( ) ;
description = _ ( " File was not recognized as a script " ) ;
loaded = false ;
}
} ;