2006-01-16 22:02:54 +01:00
// Copyright (c) 2005, Rodrigo Braz Monteiro
// 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-01-16 22:02:54 +01:00
//
2009-07-29 07:43:02 +02:00
// $Id$
/// @file main.cpp
/// @brief Main entry point, as well as crash handling
/// @ingroup main
///
2006-01-16 22:02:54 +01:00
////////////
// Includes
2009-01-04 07:31:48 +01:00
# include "config.h"
2006-01-16 22:02:54 +01:00
# include <wx/wxprec.h>
# include <wx/config.h>
# include <wx/filename.h>
# include <wx/msgdlg.h>
2007-01-07 23:54:04 +01:00
# include <wx/mimetype.h>
2007-04-13 02:04:44 +02:00
# include <wx/utils.h>
2007-06-21 02:46:50 +02:00
# include <wx/stdpaths.h>
2007-06-21 08:52:15 +02:00
# include <wx/filefn.h>
2008-03-10 07:28:21 +01:00
# include <wx/datetime.h>
2008-01-16 19:29:29 +01:00
2006-01-16 22:02:54 +01:00
# include "main.h"
# include "frame_main.h"
# include "options.h"
# include "hotkeys.h"
# include "dialog_associations.h"
# include "ass_file.h"
# include "audio_box.h"
# include "audio_display.h"
# include "export_framerate.h"
# include "ass_export_filter.h"
# include "ass_time.h"
2006-02-27 05:18:00 +01:00
# include "ass_dialogue.h"
2006-02-18 22:55:58 +01:00
# include "subs_grid.h"
2007-01-15 07:56:35 +01:00
# include "subtitle_format.h"
2007-01-21 07:30:19 +01:00
# include "video_context.h"
2007-06-21 02:46:50 +02:00
# include "standard_paths.h"
2007-12-31 07:46:22 +01:00
# ifdef WITH_AUTOMATION
# include "auto4_base.h"
# endif
2008-01-20 05:55:44 +01:00
# include "version.h"
2008-03-07 01:47:57 +01:00
# include "plugin_manager.h"
2009-07-14 23:28:49 +02:00
# include "charset_conv.h"
2006-01-16 22:02:54 +01:00
///////////////////
// wxWidgets macro
IMPLEMENT_APP ( AegisubApp )
2009-06-12 18:59:53 +02:00
# ifdef WITH_STARTUPLOG
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
2009-06-12 18:59:53 +02:00
# define StartupLog(a) MessageBox(0, a, _T("Aegisub startup log"), 0)
2007-07-05 21:11:54 +02:00
# else
# define StartupLog(a)
# endif
2008-03-09 22:00:55 +01:00
# ifdef __VISUALC__
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
2008-03-09 22:00:55 +01:00
# define MS_VC_EXCEPTION 0x406d1388
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
2008-03-09 22:00:55 +01:00
typedef struct tagTHREADNAME_INFO {
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
2008-03-09 22:00:55 +01:00
DWORD dwType ; // must be 0x1000
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
2008-03-09 22:00:55 +01:00
LPCSTR szName ; // pointer to name (in same addr space)
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
2008-03-09 22:00:55 +01:00
DWORD dwThreadID ; // thread ID (-1 caller thread)
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
2008-03-09 22:00:55 +01:00
DWORD dwFlags ; // reserved for future use, most be zero
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
2008-03-09 22:00:55 +01:00
} THREADNAME_INFO ;
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 dwThreadID
/// @param szThreadName
///
2008-03-09 22:00:55 +01:00
void SetThreadName ( DWORD dwThreadID , LPCSTR szThreadName ) {
THREADNAME_INFO info ;
info . dwType = 0x1000 ;
info . szName = szThreadName ;
info . dwThreadID = dwThreadID ;
info . dwFlags = 0 ;
__try {
2008-09-10 16:45:46 +02:00
RaiseException ( MS_VC_EXCEPTION , 0 , sizeof ( info ) / sizeof ( DWORD ) , ( ULONG_PTR * ) & info ) ;
2008-03-09 22:00:55 +01:00
}
__except ( EXCEPTION_CONTINUE_EXECUTION ) { }
}
# endif
2007-07-05 21:11:54 +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 Gets called when application starts, creates MainFrame ----------------------- Initialization function
/// @return
///
2006-01-16 22:02:54 +01:00
bool AegisubApp : : OnInit ( ) {
2008-03-09 22:00:55 +01:00
# ifdef __VISUALC__
2008-03-13 20:12:55 +01:00
SetThreadName ( ( DWORD ) - 1 , " AegiMain " ) ;
2008-03-09 22:00:55 +01:00
# endif
2007-07-05 21:11:54 +02:00
StartupLog ( _T ( " Inside OnInit " ) ) ;
2008-03-07 00:41:27 +01:00
frame = NULL ;
2006-01-16 22:02:54 +01:00
try {
// Initialize randomizer
2007-07-05 21:11:54 +02:00
StartupLog ( _T ( " Initialize random generator " ) ) ;
2006-01-16 22:02:54 +01:00
srand ( time ( NULL ) ) ;
2007-04-03 06:34:56 +02:00
// locale for loading options
2007-07-05 21:11:54 +02:00
StartupLog ( _T ( " Set initial locale " ) ) ;
2007-04-03 06:34:56 +02:00
setlocale ( LC_NUMERIC , " C " ) ;
setlocale ( LC_CTYPE , " C " ) ;
2007-07-01 02:19:55 +02:00
// App name (yeah, this is a little weird to get rid of an odd warning)
# ifdef __WXMSW__
SetAppName ( _T ( " Aegisub " ) ) ;
# else
# ifdef __WXMAC__
2006-01-16 22:02:54 +01:00
SetAppName ( _T ( " Aegisub " ) ) ;
2007-06-22 05:14:25 +02:00
# else
SetAppName ( _T ( " aegisub " ) ) ;
2007-07-01 02:19:55 +02:00
# endif
2007-06-22 05:14:25 +02:00
# endif
// Crash handling
2009-09-02 09:59:17 +02:00
# if !defined(_DEBUG) || defined(WITH_EXCEPTIONS)
2007-07-05 21:11:54 +02:00
StartupLog ( _T ( " Install exception handler " ) ) ;
2006-01-16 22:02:54 +01:00
wxHandleFatalExceptions ( true ) ;
2007-07-01 02:19:55 +02:00
# endif
2006-01-16 22:02:54 +01:00
// Set config file
2007-07-05 21:11:54 +02:00
StartupLog ( _T ( " Load configuration " ) ) ;
2007-06-21 08:52:15 +02:00
Options . LoadDefaults ( ) ;
2009-06-30 07:55:03 +02:00
# ifdef __WXMSW__
2009-07-14 06:51:35 +02:00
// Try loading configuration from the install dir if one exists there
if ( wxFileName : : FileExists ( StandardPaths : : DecodePath ( _T ( " ?data/config.dat " ) ) ) ) {
2009-06-30 07:55:03 +02:00
Options . SetFile ( StandardPaths : : DecodePath ( _T ( " ?data/config.dat " ) ) ) ;
2007-06-21 08:14:49 +02:00
Options . Load ( ) ;
2009-07-14 06:51:35 +02:00
if ( Options . AsBool ( _T ( " Local config " ) ) ) {
// Local config, make ?user mean ?data so all user settings are placed in install dir
StandardPaths : : SetPathValue ( _T ( " ?user " ) , StandardPaths : : DecodePath ( _T ( " ?data " ) ) ) ;
}
else {
// Not local config, we don't want that config.dat file here any more
// It might be a leftover from a really old install
wxRemoveFile ( StandardPaths : : DecodePath ( _T ( " ?data/config.dat " ) ) ) ;
}
2009-07-14 05:02:17 +02:00
}
# endif
2009-07-14 06:51:35 +02:00
// TODO: Check if we can write to config.dat and warn the user if we can't
// If we had local config, ?user now means ?data so this will still be loaded from the correct location
Options . SetFile ( StandardPaths : : DecodePath ( _T ( " ?user/config.dat " ) ) ) ;
Options . Load ( ) ;
2007-07-05 21:11:54 +02:00
StartupLog ( _T ( " Store options back " ) ) ;
2008-01-20 05:55:44 +01:00
Options . SetInt ( _T ( " Last Version " ) , GetSVNRevision ( ) ) ;
2008-01-21 00:57:03 +01:00
Options . LoadDefaults ( false , true ) ; // Override options based on version number
2007-06-21 08:14:49 +02:00
Options . Save ( ) ;
2006-01-16 22:02:54 +01:00
AssTime : : UseMSPrecision = Options . AsBool ( _T ( " Use nonstandard Milisecond Times " ) ) ;
// Set hotkeys file
2007-07-05 21:11:54 +02:00
StartupLog ( _T ( " Load hotkeys " ) ) ;
2007-06-21 02:46:50 +02:00
Hotkeys . SetFile ( StandardPaths : : DecodePath ( _T ( " ?user/hotkeys.dat " ) ) ) ;
2006-01-16 22:02:54 +01:00
Hotkeys . Load ( ) ;
2007-07-05 21:11:54 +02:00
StartupLog ( _T ( " Initialize final locale " ) ) ;
2009-01-02 09:49:43 +01:00
2006-01-16 22:02:54 +01:00
// Set locale
int lang = Options . AsInt ( _T ( " Locale Code " ) ) ;
if ( lang = = - 1 ) {
lang = locale . PickLanguage ( ) ;
Options . SetInt ( _T ( " Locale Code " ) , lang ) ;
Options . Save ( ) ;
}
locale . Init ( lang ) ;
2008-03-07 01:47:57 +01:00
// Load plugins
plugins = new PluginManager ( ) ;
plugins - > RegisterBuiltInPlugins ( ) ;
2007-04-22 17:45:29 +02:00
2006-12-28 23:31:33 +01:00
// Load Automation scripts
2007-12-31 07:46:22 +01:00
# ifdef WITH_AUTOMATION
2007-07-05 21:11:54 +02:00
StartupLog ( _T ( " Load global Automation scripts " ) ) ;
2006-12-28 23:31:33 +01:00
global_scripts = new Automation4 : : AutoloadScriptManager ( Options . AsText ( _T ( " Automation Autoload Path " ) ) ) ;
2007-12-31 07:46:22 +01:00
# endif
2006-12-28 23:31:33 +01:00
2006-01-16 22:02:54 +01:00
// Load export filters
2007-07-05 21:11:54 +02:00
StartupLog ( _T ( " Prepare export filters " ) ) ;
2006-01-16 22:02:54 +01:00
AssExportFilterChain : : PrepareFilters ( ) ;
2008-03-07 01:47:57 +01:00
// Set association
# ifndef _DEBUG
StartupLog ( _T ( " Install file type associations " ) ) ;
2009-07-14 06:51:35 +02:00
if ( ! Options . AsBool ( _T ( " Local config " ) ) )
RegistryAssociate ( ) ;
2008-03-07 01:47:57 +01:00
# endif
2006-01-16 22:02:54 +01:00
// Get parameter subs
2007-07-05 21:11:54 +02:00
StartupLog ( _T ( " Parse command line " ) ) ;
2006-01-16 22:02:54 +01:00
wxArrayString subs ;
for ( int i = 1 ; i < argc ; i + + ) {
subs . Add ( argv [ i ] ) ;
}
// Open main frame
2007-07-05 21:11:54 +02:00
StartupLog ( _T ( " Create main window " ) ) ;
2006-01-16 22:02:54 +01:00
frame = new FrameMain ( subs ) ;
SetTopWindow ( frame ) ;
}
2006-04-14 18:46:38 +02:00
catch ( const wchar_t * err ) {
2006-01-16 22:02:54 +01:00
wxMessageBox ( err , _T ( " Fatal error while initializing " ) ) ;
return false ;
}
catch ( . . . ) {
wxMessageBox ( _T ( " Unhandled exception " ) , _T ( " Fatal error while initializing " ) ) ;
return false ;
}
2007-07-05 21:11:54 +02:00
StartupLog ( _T ( " Initialization complete " ) ) ;
2006-01-16 22:02:54 +01:00
return true ;
}
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 Exit
/// @return
///
2007-01-15 06:38:32 +01:00
int AegisubApp : : OnExit ( ) {
2007-01-15 07:56:35 +01:00
SubtitleFormat : : DestroyFormats ( ) ;
2007-01-21 07:30:19 +01:00
VideoContext : : Clear ( ) ;
2008-03-07 01:47:57 +01:00
delete plugins ;
2007-01-15 06:38:32 +01:00
Options . Clear ( ) ;
2007-12-31 07:46:22 +01:00
# ifdef WITH_AUTOMATION
2007-01-15 07:56:35 +01:00
delete global_scripts ;
2007-12-31 07:46:22 +01:00
# endif
2007-01-15 06:38:32 +01:00
return wxApp : : OnExit ( ) ;
}
2009-09-02 09:59:17 +02:00
# if !defined(_DEBUG) || defined(WITH_EXCEPTIONS)
2009-09-02 22:46:15 +02:00
/// Message displayed when an exception has occurred.
const static wxString exception_message = _ ( " Oops, Aegisub has crashed! \n \n An attempt has been made to save a copy of your file to: \n \n %s \n \n Aegisub will now close. " ) ;
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
2009-09-03 07:27:11 +02:00
/// @brief Called during an unhandled exception
2006-01-16 22:02:54 +01:00
void AegisubApp : : OnUnhandledException ( ) {
2009-09-03 07:27:11 +02:00
// Current filename if any.
wxFileName file ( AssFile : : top - > filename ) ;
if ( ! file . HasName ( ) ) file . SetName ( _T ( " untitled " ) ) ;
// Set path and create if it doesn't exist.
file . SetPath ( StandardPaths : : DecodePath ( _T ( " ?user/recovered " ) ) ) ;
if ( ! file . DirExists ( ) ) file . Mkdir ( ) ;
// Save file
wxString filename = wxString : : Format ( " %s/%s_%s.ass " , file . GetPath ( ) , wxDateTime : : Now ( ) . Format ( " %Y-%m-%d-%H%M%S " ) , file . GetName ( ) ) ;
2006-01-16 22:02:54 +01:00
AssFile : : top - > Save ( filename , false , false ) ;
2006-02-21 06:26:13 +01:00
2009-09-03 07:27:11 +02:00
// Inform user of crash.
2009-09-02 22:46:15 +02:00
wxMessageBox ( wxString : : Format ( exception_message , filename . c_str ( ) ) , _ ( " Program error " ) , wxOK | wxICON_ERROR , NULL ) ;
2006-01-16 22:02:54 +01:00
}
2009-09-03 07:27:11 +02:00
/// @brief Called during a fatal exception.
void AegisubApp : : OnFatalException ( ) {
// Current filename if any.
wxFileName file ( AssFile : : top - > filename ) ;
if ( ! file . HasName ( ) ) file . SetName ( _T ( " untitled " ) ) ;
2006-01-16 22:02:54 +01:00
2009-09-03 07:27:11 +02:00
// Set path and create if it doesn't exist.
file . SetPath ( StandardPaths : : DecodePath ( _T ( " ?user/recovered " ) ) ) ;
if ( ! file . DirExists ( ) ) file . Mkdir ( ) ;
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
2009-09-03 07:27:11 +02:00
// Save file
wxString filename = wxString : : Format ( " %s/%s_%s.ass " , file . GetPath ( ) , wxDateTime : : Now ( ) . Format ( " %Y-%m-%d-%H%M%S " ) , file . GetName ( ) ) ;
2006-01-16 22:02:54 +01:00
AssFile : : top - > Save ( filename , false , false ) ;
2006-02-21 06:26:13 +01:00
2006-04-13 09:09:27 +02:00
# if wxUSE_STACKWALKER == 1
2008-07-02 15:42:34 +02:00
// Stack walk
2008-03-10 07:28:21 +01:00
StackWalker walker ( _T ( " Fatal exception " ) ) ;
2006-02-21 06:26:13 +01:00
walker . WalkFromException ( ) ;
2008-07-02 15:42:34 +02:00
# endif
2009-09-03 07:27:11 +02:00
2009-09-02 22:46:15 +02:00
// Inform user of crash
2009-09-03 07:27:11 +02:00
wxMessageBox ( wxString : : Format ( exception_message , filename . c_str ( ) ) , _ ( " Program error " ) , wxOK | wxICON_ERROR | wxSTAY_ON_TOP , NULL ) ;
2006-02-21 06:26:13 +01:00
}
2006-02-26 23:45:34 +01:00
# endif
2006-02-21 06:26:13 +01:00
2009-09-03 08:03:38 +02:00
# if wxUSE_STACKWALKER == 1
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
2009-09-03 07:27:11 +02:00
/// @brief Callback to format a single frame
/// @param frame frame to parse.
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
///
2006-02-21 06:26:13 +01:00
void StackWalker : : OnStackFrame ( const wxStackFrame & frame ) {
2008-03-10 07:28:21 +01:00
wxString dst = wxString : : Format ( _T ( " %03i - 0x%08X: " ) , frame . GetLevel ( ) , frame . GetAddress ( ) ) + frame . GetName ( ) ;
if ( frame . HasSourceLocation ( ) ) dst + = _T ( " on " ) + frame . GetFileName ( ) + wxString : : Format ( _T ( " :%i " ) , frame . GetLine ( ) ) ;
2006-02-21 06:26:13 +01:00
if ( file . is_open ( ) ) {
2008-03-10 07:28:21 +01:00
file < < dst . mb_str ( ) < < std : : endl ;
2006-02-21 06:26:13 +01:00
}
else wxLogMessage ( dst ) ;
}
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
2009-09-03 07:27:11 +02:00
/// @brief Called at the start of walking the stack.
/// @param cause cause of the crash.
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
///
2008-03-10 07:28:21 +01:00
StackWalker : : StackWalker ( wxString cause ) {
2007-07-23 23:46:56 +02:00
file . open ( wxString ( StandardPaths : : DecodePath ( _T ( " ?user/crashlog.txt " ) ) ) . mb_str ( ) , std : : ios : : out | std : : ios : : app ) ;
2006-02-21 06:26:13 +01:00
if ( file . is_open ( ) ) {
2008-03-10 07:28:21 +01:00
wxDateTime time = wxDateTime : : Now ( ) ;
wxString timeStr = _T ( " --- " ) + time . FormatISODate ( ) + _T ( " " ) + time . FormatISOTime ( ) + _T ( " ------------------ " ) ;
formatLen = timeStr . Length ( ) ;
2009-07-14 23:28:49 +02:00
file < < std : : endl < < timeStr . mb_str ( csConvLocal ) ;
2008-03-10 07:28:21 +01:00
file < < " \n VER - " < < GetAegisubLongVersionString ( ) . mb_str ( wxConvUTF8 ) ;
file < < " \n FTL - Begining stack dump for \" " < < cause . mb_str ( wxConvUTF8 ) < < " \" : \n " ;
2006-02-21 06:26:13 +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
2009-09-03 07:27:11 +02:00
/// @brief Called at the end of walking the stack.
2006-02-21 06:26:13 +01:00
StackWalker : : ~ StackWalker ( ) {
if ( file . is_open ( ) ) {
2008-03-10 07:28:21 +01:00
char dashes [ 1024 ] ;
int i = 0 ;
for ( i = 0 ; i < formatLen ; i + + ) dashes [ i ] = ' - ' ;
dashes [ i ] = 0 ;
file < < " End of stack dump. \n " ;
file < < dashes ;
file < < " \n " ;
2006-02-21 06:26:13 +01:00
file . close ( ) ;
}
2006-01-16 22:02:54 +01:00
}
2006-04-13 09:09:27 +02:00
# endif
2006-01-16 22:02:54 +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 Call main loop
/// @return
///
2006-01-16 22:02:54 +01:00
int AegisubApp : : OnRun ( ) {
2008-03-10 07:28:21 +01:00
wxString error ;
// Run program
2006-01-16 22:02:54 +01:00
try {
if ( m_exitOnFrameDelete = = Later ) m_exitOnFrameDelete = Yes ;
return MainLoop ( ) ;
}
2008-03-10 07:28:21 +01:00
// Catch errors
catch ( wxString & err ) { error = err ; }
catch ( wxChar * err ) { error = err ; }
catch ( std : : exception & e ) { error = wxString ( _T ( " std::exception: " ) ) + wxString ( e . what ( ) , wxConvUTF8 ) ; }
catch ( . . . ) { error = _T ( " Program terminated in error. " ) ; }
// Report errors
if ( ! error . IsEmpty ( ) ) {
std : : ofstream file ;
file . open ( wxString ( StandardPaths : : DecodePath ( _T ( " ?user/crashlog.txt " ) ) ) . mb_str ( ) , std : : ios : : out | std : : ios : : app ) ;
if ( file . is_open ( ) ) {
wxDateTime time = wxDateTime : : Now ( ) ;
wxString timeStr = _T ( " --- " ) + time . FormatISODate ( ) + _T ( " " ) + time . FormatISOTime ( ) + _T ( " ------------------ " ) ;
2009-07-14 23:28:49 +02:00
file < < std : : endl < < timeStr . mb_str ( csConvLocal ) ;
2008-03-10 07:28:21 +01:00
file < < " \n VER - " < < GetAegisubLongVersionString ( ) . mb_str ( wxConvUTF8 ) ;
2009-07-14 23:28:49 +02:00
file < < " \n EXC - Aegisub has crashed with unhandled exception \" " < < error . mb_str ( csConvLocal ) < < " \" . \n " ;
2008-03-10 07:28:21 +01:00
int formatLen = timeStr . Length ( ) ;
char dashes [ 1024 ] ;
int i = 0 ;
for ( i = 0 ; i < formatLen ; i + + ) dashes [ i ] = ' - ' ;
dashes [ i ] = 0 ;
file < < dashes ;
file < < " \n " ;
file . close ( ) ;
}
2006-01-16 22:02:54 +01:00
2008-03-10 07:28:21 +01:00
OnUnhandledException ( ) ;
2006-01-16 22:02:54 +01:00
}
ExitMainLoop ( ) ;
return 1 ;
}
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 Registry program to filetypes
///
2006-01-16 22:02:54 +01:00
void AegisubApp : : RegistryAssociate ( ) {
2007-04-13 03:54:47 +02:00
# if defined(__WINDOWS__)
2006-01-16 22:02:54 +01:00
// Command to open with this
wxString command ;
2007-06-21 02:46:50 +02:00
wxStandardPaths stand ;
wxString fullPath = stand . GetExecutablePath ( ) ;
command = _T ( " \" " ) + fullPath + _T ( " \" \" %1 \" " ) ;
2006-01-16 22:02:54 +01:00
// Main program association
2007-01-19 13:52:02 +01:00
wxRegKey * key = new wxRegKey ( _T ( " HKEY_CURRENT_USER \\ Software \\ Classes \\ Aegisub " ) ) ;
2006-01-16 22:02:54 +01:00
if ( ! key - > Exists ( ) ) key - > Create ( ) ;
key - > SetValue ( _T ( " " ) , _T ( " Aegisub Subtitle Script " ) ) ;
delete key ;
2007-01-19 13:52:02 +01:00
key = new wxRegKey ( _T ( " HKEY_CURRENT_USER \\ Software \\ Classes \\ Aegisub \\ DefaultIcon " ) ) ;
2006-01-16 22:02:54 +01:00
if ( ! key - > Exists ( ) ) key - > Create ( ) ;
2007-01-19 13:52:02 +01:00
key - > SetValue ( _T ( " " ) , fullPath ) ;
2006-01-16 22:02:54 +01:00
delete key ;
2007-01-19 13:52:02 +01:00
key = new wxRegKey ( _T ( " HKEY_CURRENT_USER \\ Software \\ Classes \\ Aegisub \\ Shell " ) ) ;
2006-01-16 22:02:54 +01:00
if ( ! key - > Exists ( ) ) key - > Create ( ) ;
2007-01-19 13:52:02 +01:00
key - > SetValue ( _T ( " " ) , _T ( " open " ) ) ;
2006-01-16 22:02:54 +01:00
delete key ;
2007-01-19 13:52:02 +01:00
key = new wxRegKey ( _T ( " HKEY_CURRENT_USER \\ Software \\ Classes \\ Aegisub \\ Shell \\ Open " ) ) ;
2006-01-16 22:02:54 +01:00
if ( ! key - > Exists ( ) ) key - > Create ( ) ;
2007-01-19 13:52:02 +01:00
key - > SetValue ( _T ( " " ) , _T ( " &Open with Aegisub " ) ) ;
2006-01-16 22:02:54 +01:00
delete key ;
2007-01-19 13:52:02 +01:00
key = new wxRegKey ( _T ( " HKEY_CURRENT_USER \\ Software \\ Classes \\ Aegisub \\ Shell \\ Open \\ Command " ) ) ;
2006-01-16 22:02:54 +01:00
if ( ! key - > Exists ( ) ) key - > Create ( ) ;
2007-01-19 13:52:02 +01:00
key - > SetValue ( _T ( " " ) , command ) ;
2006-01-16 22:02:54 +01:00
delete key ;
// Check associations
if ( Options . AsBool ( _T ( " Show associations " ) ) ) {
2007-06-19 06:04:46 +02:00
bool gotAll = DialogAssociations : : CheckAssociation ( _T ( " ass " ) ) & & DialogAssociations : : CheckAssociation ( _T ( " ssa " ) ) & &
DialogAssociations : : CheckAssociation ( _T ( " srt " ) ) & & DialogAssociations : : CheckAssociation ( _T ( " sub " ) ) & &
DialogAssociations : : CheckAssociation ( _T ( " ttxt " ) ) ;
2006-01-16 22:02:54 +01:00
if ( ! gotAll ) {
DialogAssociations diag ( NULL ) ;
diag . ShowModal ( ) ;
Options . SetBool ( _T ( " Show associations " ) , false ) ;
Options . Save ( ) ;
}
}
2007-04-13 03:54:47 +02:00
# elif defined(__APPLE__)
// This is totally untested and pure guesswork
// I don't know if it should be ".ass" or just "ass"
wxFileName : : MacRegisterDefaultTypeAndCreator ( _T ( " .ass " ) , 0x41535341 /*ASSA*/ , 0x41475355 /*AGSU*/ ) ;
// Technically .ssa isn't ASSA but it makes it so much easier ;)
wxFileName : : MacRegisterDefaultTypeAndCreator ( _T ( " .ssa " ) , 0x53534134 /*SSA4*/ , 0x41475355 /*AGSU*/ ) ;
// Not touching .srt yet, there might be some type already registered for it which we should probably use then
# else
// Is there anything like this for other POSIX compatible systems?
2006-01-16 22:02:54 +01:00
# endif
}
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 Open URL
/// @param url
///
2007-01-07 23:54:04 +01:00
void AegisubApp : : OpenURL ( wxString url ) {
2007-04-13 02:04:44 +02:00
wxLaunchDefaultBrowser ( url , wxBROWSER_NEW_WINDOW ) ;
2007-01-07 23:54:04 +01:00
}
2006-06-19 04:57:27 +02:00
////////////////
// Apple events
# ifdef __WXMAC__
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-06-19 04:57:27 +02:00
void AegisubApp : : MacOpenFile ( const wxString & filename ) {
if ( frame ! = NULL & & ! filename . empty ( ) ) {
frame - > LoadSubtitles ( filename ) ;
wxFileName filepath ( filename ) ;
Options . SetText ( _T ( " Last open subtitles path " ) , filepath . GetPath ( ) ) ;
}
}
# endif
2006-01-16 22:02:54 +01:00
///////////////
// Event table
BEGIN_EVENT_TABLE ( AegisubApp , wxApp )
EVT_MOUSEWHEEL ( AegisubApp : : OnMouseWheel )
EVT_KEY_DOWN ( AegisubApp : : OnKey )
END_EVENT_TABLE ( )
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 Mouse wheel moved
/// @param event
///
2006-01-16 22:02:54 +01:00
void AegisubApp : : OnMouseWheel ( wxMouseEvent & event ) {
wxPoint pt ;
wxWindow * target = wxFindWindowAtPointer ( pt ) ;
2008-03-07 00:41:27 +01:00
if ( frame & & ( target = = frame - > audioBox - > audioDisplay | | target = = frame - > SubsBox ) ) {
2009-06-12 01:30:33 +02:00
if ( target - > IsShownOnScreen ( ) ) target - > GetEventHandler ( ) - > ProcessEvent ( event ) ;
2007-07-03 03:09:39 +02:00
else event . Skip ( ) ;
2006-01-16 22:02:54 +01:00
}
else event . Skip ( ) ;
}
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 Key pressed
/// @param event
///
2006-01-16 22:02:54 +01:00
void AegisubApp : : OnKey ( wxKeyEvent & event ) {
2006-03-05 05:31:09 +01:00
//frame->audioBox->audioDisplay->AddPendingEvent(event);
2006-01-16 22:02:54 +01:00
if ( ! event . GetSkipped ( ) ) {
event . Skip ( ) ;
}
}
2009-07-29 07:43:02 +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