2006-01-16 22:02:54 +01:00
// Copyright (c) 2005, Rodrigo Braz Monteiro, 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-01-16 22:02:54 +01:00
//
2009-07-29 07:43:02 +02:00
// $Id$
/// @file frame_main.cpp
/// @brief Main window creation and control management
/// @ingroup main_ui
2006-01-16 22:02:54 +01:00
2009-01-04 07:31:48 +01:00
# include "config.h"
2009-09-10 15:06:40 +02:00
# ifndef AGI_PRE
2006-01-16 22:02:54 +01:00
# include <wx/filename.h>
2006-12-27 21:16:47 +01:00
# include <wx/image.h>
2009-09-10 15:06:40 +02:00
# include <wx/mimetype.h>
2007-09-12 01:22:26 +02:00
# include <wx/statline.h>
2009-09-10 15:06:40 +02:00
# include <wx/sysopt.h>
# include <wx/tokenzr.h>
# endif
2008-01-16 19:29:29 +01:00
2009-09-10 15:06:40 +02:00
# include "ass_file.h"
# include "audio_box.h"
# include "audio_display.h"
# ifdef WITH_AUTOMATION
# include "auto4_base.h"
# endif
2008-01-22 03:54:16 +01:00
# ifdef WITH_AVISYNTH
2006-02-24 03:54:30 +01:00
# include "avisynth_wrap.h"
2008-01-22 03:54:16 +01:00
# endif
2010-05-21 03:13:36 +02:00
# include "compat.h"
2009-09-10 15:06:40 +02:00
# include "dialog_detached_video.h"
2006-01-16 22:02:54 +01:00
# include "dialog_search_replace.h"
2009-09-10 15:06:40 +02:00
# include "dialog_styling_assistant.h"
# include "dialog_version_check.h"
2006-01-16 22:02:54 +01:00
# include "drop.h"
2009-09-10 15:06:40 +02:00
# include "frame_main.h"
# include "help_button.h"
2006-01-16 22:02:54 +01:00
# include "hotkeys.h"
2007-08-26 02:00:37 +02:00
# include "keyframe.h"
2009-07-24 02:08:25 +02:00
# include "libresrc/libresrc.h"
2009-09-10 15:06:40 +02:00
# include "main.h"
# include "standard_paths.h"
# include "subs_edit_box.h"
2010-07-20 05:11:11 +02:00
# include "subs_edit_ctrl.h"
2009-09-10 15:06:40 +02:00
# include "subs_grid.h"
# include "text_file_reader.h"
# include "text_file_writer.h"
# include "utils.h"
# include "version.h"
# include "video_box.h"
# include "video_context.h"
# include "video_display.h"
# include "video_provider_manager.h"
# include "video_slider.h"
2006-01-16 22:02:54 +01:00
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)
# else
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)
# endif
2010-08-26 20:38:44 +02:00
static void autosave_timer_changed ( wxTimer & timer , const agi : : OptionValue & opt ) ;
2006-01-16 22:02:54 +01:00
FrameMain : : FrameMain ( wxArrayString args )
2007-07-07 05:21:52 +02:00
: wxFrame ( ( wxFrame * ) NULL , - 1 , _T ( " " ) , wxDefaultPosition , wxSize ( 920 , 700 ) , wxDEFAULT_FRAME_STYLE | wxCLIP_CHILDREN )
2006-01-16 22:02:54 +01:00
{
2009-06-12 18:59:53 +02:00
StartupLog ( _T ( " Entering FrameMain constructor " ) ) ;
2007-04-03 06:34:56 +02:00
# ifdef __WXGTK__
/* XXX HACK XXX
* Gtk just got initialized . And if we ' re using the SCIM IME ,
2007-09-12 01:22:26 +02:00
* it just did a setlocale ( LC_ALL , " " ) . so , BOOM .
2007-04-03 06:34:56 +02:00
*/
setlocale ( LC_ALL , " " ) ;
setlocale ( LC_CTYPE , " C " ) ;
setlocale ( LC_NUMERIC , " C " ) ;
/* XXX HACK XXX */
# endif
2007-01-11 06:33:36 +01:00
// Set application's frame
AegisubApp : : Get ( ) - > frame = this ;
2006-01-16 22:02:54 +01:00
// Initialize flags
HasSelection = false ;
menuCreated = false ;
blockAudioLoad = false ;
blockAudioLoad = false ;
2009-06-12 18:59:53 +02:00
StartupLog ( _T ( " Install PNG handler " ) ) ;
2006-12-27 21:16:47 +01:00
// Create PNG handler
wxPNGHandler * png = new wxPNGHandler ;
wxImage : : AddHandler ( png ) ;
2010-06-26 16:16:59 +02:00
wxSafeYield ( ) ;
2006-12-28 23:31:33 +01:00
// Storage for subs-file-local scripts
2007-12-31 07:46:22 +01:00
# ifdef WITH_AUTOMATION
2009-06-12 18:59:53 +02:00
StartupLog ( _T ( " Create local Automation script manager " ) ) ;
2006-12-28 23:31:33 +01:00
local_scripts = new Automation4 : : ScriptManager ( ) ;
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
// Create menu and tool bars
2009-06-12 18:59:53 +02:00
StartupLog ( _T ( " Apply saved Maximized state " ) ) ;
2010-05-21 03:13:36 +02:00
if ( OPT_GET ( " App/Maximized " ) - > GetBool ( ) ) Maximize ( true ) ;
2009-06-12 18:59:53 +02:00
StartupLog ( _T ( " Initialize toolbar " ) ) ;
2006-01-16 22:02:54 +01:00
InitToolbar ( ) ;
2009-06-12 18:59:53 +02:00
StartupLog ( _T ( " Initialize menu bar " ) ) ;
2006-01-16 22:02:54 +01:00
InitMenu ( ) ;
// Create status bar
2009-06-12 18:59:53 +02:00
StartupLog ( _T ( " Create status bar " ) ) ;
2006-12-28 23:31:33 +01:00
CreateStatusBar ( 2 ) ;
2006-01-16 22:02:54 +01:00
// Set icon
2009-06-12 18:59:53 +02:00
StartupLog ( _T ( " Set icon " ) ) ;
2009-07-25 22:32:58 +02:00
# ifdef _WINDOWS
SetIcon ( wxICON ( wxicon ) ) ;
# else
2009-07-25 22:07:07 +02:00
wxIcon icon ;
icon . CopyFromBitmap ( GETIMAGE ( wxicon_misc ) ) ;
SetIcon ( icon ) ;
2009-07-25 22:32:58 +02:00
# endif
2006-01-16 22:02:54 +01:00
// Contents
2007-01-23 05:42:08 +01:00
showVideo = true ;
showAudio = true ;
detachedVideo = NULL ;
2009-05-14 09:02:01 +02:00
stylingAssistant = NULL ;
2009-06-12 18:59:53 +02:00
StartupLog ( _T ( " Initialize inner main window controls " ) ) ;
2006-01-16 22:02:54 +01:00
InitContents ( ) ;
// Set autosave timer
2009-06-12 18:59:53 +02:00
StartupLog ( _T ( " Set up Auto Save " ) ) ;
2006-01-16 22:02:54 +01:00
AutoSave . SetOwner ( this , AutoSave_Timer ) ;
2010-05-21 03:13:36 +02:00
int time = OPT_GET ( " App/Auto/Save Every Seconds " ) - > GetInt ( ) ;
2006-01-16 22:02:54 +01:00
if ( time > 0 ) {
AutoSave . Start ( time * 1000 ) ;
}
2010-08-26 20:38:44 +02:00
OPT_GET ( " App/Auto/Save Every Seconds " ) - > Subscribe ( this , std : : tr1 : : bind ( autosave_timer_changed , std : : tr1 : : ref ( AutoSave ) , std : : tr1 : : placeholders : : _1 ) ) ;
2006-01-16 22:02:54 +01:00
// Set accelerator keys
2009-06-12 18:59:53 +02:00
StartupLog ( _T ( " Install hotkeys " ) ) ;
2006-01-16 22:02:54 +01:00
PreviousFocus = NULL ;
SetAccelerators ( ) ;
// Set drop target
2009-06-12 18:59:53 +02:00
StartupLog ( _T ( " Set up drag/drop target " ) ) ;
2006-01-16 22:02:54 +01:00
SetDropTarget ( new AegisubFileDropTarget ( this ) ) ;
2006-12-26 04:32:48 +01:00
// Parse arguments
2009-06-12 18:59:53 +02:00
StartupLog ( _T ( " Initialize empty file " ) ) ;
2006-12-26 04:32:48 +01:00
LoadSubtitles ( _T ( " " ) ) ;
2009-06-12 18:59:53 +02:00
StartupLog ( _T ( " Load files specified on command line " ) ) ;
2006-12-26 04:32:48 +01:00
LoadList ( args ) ;
2007-01-07 23:54:04 +01:00
// Version checker
2009-06-12 18:59:53 +02:00
StartupLog ( _T ( " Possibly perform automatic updates check " ) ) ;
2010-08-26 20:38:03 +02:00
if ( OPT_GET ( " App/First Start " ) - > GetBool ( ) ) {
OPT_SET ( " App/First Start " ) - > SetBool ( false ) ;
2007-01-07 23:54:04 +01:00
int result = wxMessageBox ( _ ( " Do you want Aegisub to check for updates whenever it starts? You can still do it manually via the Help menu. " ) , _ ( " Check for updates? " ) , wxYES_NO ) ;
2010-08-26 20:38:03 +02:00
OPT_SET ( " App/Auto/Check For Updates " ) - > SetBool ( result = = wxYES ) ;
2007-01-07 23:54:04 +01:00
}
Merge 3906,r3909,r3910,r3912,r3928,r3931,r3932,r3933,r3935,r3936: merge update checker from 2.1.8, this also needs to be documented for doxygen. closes #1084.
Originally committed to SVN as r4042.
2010-01-26 14:14:05 +01:00
PerformVersionCheck ( false ) ;
2008-01-13 06:57:09 +01:00
2010-06-26 16:16:59 +02:00
StartupLog ( _T ( " Display main window " ) ) ;
Show ( ) ;
2010-06-29 00:15:40 +02:00
Freeze ( ) ;
2010-06-26 16:16:59 +02:00
SetDisplayMode ( 1 , 1 ) ;
Thaw ( ) ;
2008-01-13 06:57:09 +01:00
//ShowFullScreen(true,wxFULLSCREEN_NOBORDER | wxFULLSCREEN_NOCAPTION);
2009-06-12 18:59:53 +02:00
StartupLog ( _T ( " Leaving FrameMain constructor " ) ) ;
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 FrameMain destructor
2006-01-16 22:02:54 +01:00
FrameMain : : ~ FrameMain ( ) {
2006-02-03 01:22:16 +01:00
DeInitContents ( ) ;
2007-12-31 07:46:22 +01:00
# ifdef WITH_AUTOMATION
2006-12-28 23:31:33 +01:00
delete local_scripts ;
2007-12-31 07:46:22 +01: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 Initialize toolbar
2006-01-16 22:02:54 +01:00
void FrameMain : : InitToolbar ( ) {
// Create toolbar
wxSystemOptions : : SetOption ( _T ( " msw.remap " ) , 0 ) ;
Toolbar = CreateToolBar ( wxTB_FLAT | wxTB_HORIZONTAL , - 1 , _T ( " Toolbar " ) ) ;
// Subtitle control buttons
2009-07-25 06:49:59 +02:00
Toolbar - > AddTool ( Menu_File_New_Subtitles , _ ( " New " ) , GETIMAGE ( new_toolbutton_24 ) , _ ( " New subtitles " ) ) ;
Toolbar - > AddTool ( Menu_File_Open_Subtitles , _ ( " Open " ) , GETIMAGE ( open_toolbutton_24 ) , _ ( " Open subtitles " ) ) ;
Toolbar - > AddTool ( Menu_File_Save_Subtitles , _ ( " Save " ) , GETIMAGE ( save_toolbutton_24 ) , _ ( " Save subtitles " ) ) ;
2006-01-16 22:02:54 +01:00
Toolbar - > AddSeparator ( ) ;
// Video zoom controls
2009-07-25 06:49:59 +02:00
Toolbar - > AddTool ( Menu_Video_JumpTo , _ ( " Jump To... " ) , GETIMAGE ( jumpto_button_24 ) , wxNullBitmap , wxITEM_NORMAL , _ ( " Jump video to time/frame " ) ) ;
Toolbar - > AddTool ( Menu_Video_Zoom_In , _ ( " Zoom in " ) , GETIMAGE ( zoom_in_button_24 ) , wxNullBitmap , wxITEM_NORMAL , _ ( " Zoom video in " ) ) ;
Toolbar - > AddTool ( Menu_Video_Zoom_Out , _ ( " Zoom out " ) , GETIMAGE ( zoom_out_button_24 ) , wxNullBitmap , wxITEM_NORMAL , _ ( " Zoom video out " ) ) ;
2006-01-16 22:02:54 +01:00
wxArrayString choices ;
2009-10-06 19:43:15 +02:00
for ( int i = 1 ; i < = 24 ; i + + ) {
2006-01-16 22:02:54 +01:00
wxString toAdd = wxString : : Format ( _T ( " %i " ) , int ( i * 12.5 ) ) ;
if ( i % 2 ) toAdd + = _T ( " .5 " ) ;
toAdd + = _T ( " % " ) ;
choices . Add ( toAdd ) ;
}
2010-05-01 03:07:05 +02:00
ZoomBox = new wxComboBox ( Toolbar , Toolbar_Zoom_Dropdown , _T ( " 75% " ) , wxDefaultPosition , wxDefaultSize , choices , wxCB_DROPDOWN ) ;
2006-01-16 22:02:54 +01:00
Toolbar - > AddControl ( ZoomBox ) ;
Toolbar - > AddSeparator ( ) ;
// More video buttons
2009-07-25 06:49:59 +02:00
Toolbar - > AddTool ( Menu_Subs_Snap_Video_To_Start , _ ( " Jump video to start " ) , GETIMAGE ( video_to_substart_24 ) , _ ( " Jumps the video to the start frame of current subtitle " ) ) ;
Toolbar - > AddTool ( Menu_Subs_Snap_Video_To_End , _ ( " Jump video to end " ) , GETIMAGE ( video_to_subend_24 ) , _ ( " Jumps the video to the end frame of current subtitle " ) ) ;
Toolbar - > AddTool ( Menu_Subs_Snap_Start_To_Video , _ ( " Snap start to video " ) , GETIMAGE ( substart_to_video_24 ) , _ ( " Set start of selected subtitles to current video frame " ) ) ;
Toolbar - > AddTool ( Menu_Subs_Snap_End_To_Video , _ ( " Snap end to video " ) , GETIMAGE ( subend_to_video_24 ) , _ ( " Set end of selected subtitles to current video frame " ) ) ;
Toolbar - > AddTool ( Menu_Video_Select_Visible , _ ( " Select visible " ) , GETIMAGE ( select_visible_button_24 ) , _ ( " Selects all lines that are currently visible on video frame " ) ) ;
Toolbar - > AddTool ( Menu_Video_Snap_To_Scene , _ ( " Snap subtitles to scene " ) , GETIMAGE ( snap_subs_to_scene_24 ) , _ ( " Snap selected subtitles so they match current scene start/end " ) ) ;
Toolbar - > AddTool ( Menu_Video_Shift_To_Frame , _ ( " Shift subtitles to frame " ) , GETIMAGE ( shift_to_frame_24 ) , _ ( " Shift selected subtitles so first selected starts at this frame " ) ) ;
2006-01-16 22:02:54 +01:00
Toolbar - > AddSeparator ( ) ;
// Property stuff
2009-07-25 06:49:59 +02:00
Toolbar - > AddTool ( Menu_Tools_Styles_Manager , _ ( " Styles Manager " ) , GETIMAGE ( style_toolbutton_24 ) , _ ( " Open Styles Manager " ) ) ;
Toolbar - > AddTool ( Menu_Tools_Properties , _ ( " Properties " ) , GETIMAGE ( properties_toolbutton_24 ) , _ ( " Open Properties " ) ) ;
Toolbar - > AddTool ( Menu_Tools_Attachments , _ ( " Attachments " ) , GETIMAGE ( attach_button_24 ) , _ ( " Open Attachment List " ) ) ;
Toolbar - > AddTool ( Menu_Tools_Fonts_Collector , _ ( " Fonts Collector " ) , GETIMAGE ( font_collector_button_24 ) , _ ( " Open Fonts Collector " ) ) ;
2006-01-16 22:02:54 +01:00
Toolbar - > AddSeparator ( ) ;
// Automation
2007-12-31 07:46:22 +01:00
# ifdef WITH_AUTOMATION
2009-07-25 06:49:59 +02:00
Toolbar - > AddTool ( Menu_Tools_Automation , _ ( " Automation " ) , GETIMAGE ( automation_toolbutton_24 ) , _ ( " Open Automation manager " ) ) ;
2006-01-16 22:02:54 +01:00
Toolbar - > AddSeparator ( ) ;
2007-12-31 07:46:22 +01:00
# endif
2006-01-16 22:02:54 +01:00
// Tools
2008-01-20 18:34:35 +01:00
if ( HasASSDraw ( ) ) {
2009-07-25 06:49:59 +02:00
Toolbar - > AddTool ( Menu_Tools_ASSDraw , _T ( " ASSDraw3 " ) , GETIMAGE ( assdraw_24 ) , _ ( " Launches ai-chan's \" ASSDraw3 \" tool for vector drawing. " ) ) ;
2008-01-20 18:34:35 +01:00
Toolbar - > AddSeparator ( ) ;
}
2009-07-25 06:49:59 +02:00
Toolbar - > AddTool ( Menu_Edit_Shift , _ ( " Shift Times " ) , GETIMAGE ( shift_times_toolbutton_24 ) , _ ( " Open Shift Times Dialogue " ) ) ;
Toolbar - > AddTool ( Menu_Tools_Styling , _ ( " Styling Assistant " ) , GETIMAGE ( styling_toolbutton_24 ) , _ ( " Open Styling Assistant " ) ) ;
Toolbar - > AddTool ( Menu_Tools_Translation , _ ( " Translation Assistant " ) , GETIMAGE ( translation_toolbutton_24 ) , _ ( " Open Translation Assistant " ) ) ;
Toolbar - > AddTool ( Menu_Tools_Resample , _ ( " Resample " ) , GETIMAGE ( resample_toolbutton_24 ) , _ ( " Resample Script Resolution " ) ) ;
Toolbar - > AddTool ( Menu_Tools_Timing_Processor , _ ( " Timing Post-Processor " ) , GETIMAGE ( timing_processor_toolbutton_24 ) , _ ( " Open Timing Post-processor dialog " ) ) ;
2009-08-11 07:35:25 +02:00
Toolbar - > AddTool ( Menu_Tools_Kanji_Timer , _ ( " Kanji Timer " ) , GETIMAGE ( kara_timing_copier_24 ) , _ ( " Open Kanji Timer dialog " ) ) ;
2009-07-25 06:49:59 +02:00
Toolbar - > AddTool ( Menu_Tools_SpellCheck , _ ( " Spell Checker " ) , GETIMAGE ( spellcheck_toolbutton_24 ) , _ ( " Open Spell checker " ) ) ;
2006-01-16 22:02:54 +01:00
Toolbar - > AddSeparator ( ) ;
2007-01-07 23:54:04 +01:00
// Options
2009-07-25 06:49:59 +02:00
Toolbar - > AddTool ( Menu_Tools_Options , _ ( " Options " ) , GETIMAGE ( options_button_24 ) , _ ( " Configure Aegisub " ) ) ;
Toolbar - > AddTool ( Grid_Toggle_Tags , _ ( " Cycle Tag Hidding Mode " ) , GETIMAGE ( toggle_tag_hiding_24 ) , _ ( " Cycle through tag-hiding modes " ) ) ;
2006-01-16 22:02:54 +01:00
// Update
Toolbar - > Realize ( ) ;
}
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 item_text
/// @param hotkey_name
/// @return
2010-01-21 01:01:46 +01:00
wxString MakeHotkeyText ( const wxString & item_text , const wxString & hotkey_name ) {
return item_text + wxString ( _T ( " \t " ) ) + Hotkeys . GetText ( hotkey_name ) ;
}
2007-07-05 17:41:41 +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 Initialize menu bar
2006-01-16 22:02:54 +01:00
void FrameMain : : InitMenu ( ) {
// Deinit menu if needed
if ( menuCreated ) {
SetMenuBar ( NULL ) ;
2009-07-06 07:01:55 +02:00
MenuBar - > Destroy ( ) ;
2006-01-16 22:02:54 +01:00
}
2007-09-23 21:40:57 +02:00
# ifdef __WXMAC__
// Make sure special menu items are placed correctly on Mac
wxApp : : s_macAboutMenuItemId = Menu_Help_About ;
wxApp : : s_macExitMenuItemId = Menu_File_Exit ;
wxApp : : s_macPreferencesMenuItemId = Menu_Tools_Options ;
wxApp : : s_macHelpMenuTitleName = _ ( " &Help " ) ;
# endif
2006-01-16 22:02:54 +01:00
// Generate menubar
MenuBar = new wxMenuBar ( ) ;
// Create recent subs submenus
RecentSubs = new wxMenu ( ) ;
RecentVids = new wxMenu ( ) ;
RecentAuds = new wxMenu ( ) ;
2006-07-01 07:34:39 +02:00
RecentTimecodes = new wxMenu ( ) ;
2006-12-18 18:18:14 +01:00
RecentKeyframes = new wxMenu ( ) ;
2006-01-16 22:02:54 +01:00
// Create file menu
fileMenu = new wxMenu ( ) ;
2009-07-25 06:49:59 +02:00
AppendBitmapMenuItem ( fileMenu , Menu_File_New_Subtitles , MakeHotkeyText ( _ ( " &New Subtitles " ) , _T ( " New Subtitles " ) ) , _ ( " New subtitles " ) , GETIMAGE ( new_toolbutton_16 ) ) ;
AppendBitmapMenuItem ( fileMenu , Menu_File_Open_Subtitles , MakeHotkeyText ( _ ( " &Open Subtitles... " ) , _T ( " Open Subtitles " ) ) , _ ( " Opens a subtitles file " ) , GETIMAGE ( open_toolbutton_16 ) ) ;
AppendBitmapMenuItem ( fileMenu , Menu_File_Open_Subtitles_Charset , _ ( " &Open Subtitles with Charset... " ) , _ ( " Opens a subtitles file with a specific charset " ) , GETIMAGE ( open_with_toolbutton_16 ) ) ;
2010-05-19 02:44:37 +02:00
fileMenu - > Append ( Menu_File_Open_Subtitles_From_Video , _ ( " Open Subtitles from &Video " ) , _ ( " Opens the subtitles from the current video file " ) ) ;
2009-07-25 06:49:59 +02:00
AppendBitmapMenuItem ( fileMenu , Menu_File_Save_Subtitles , MakeHotkeyText ( _ ( " &Save Subtitles " ) , _T ( " Save Subtitles " ) ) , _ ( " Saves subtitles " ) , GETIMAGE ( save_toolbutton_16 ) ) ;
AppendBitmapMenuItem ( fileMenu , Menu_File_Save_Subtitles_As , _ ( " Save Subtitles as... " ) , _ ( " Saves subtitles with another name " ) , GETIMAGE ( save_as_toolbutton_16 ) ) ;
2009-08-16 05:54:44 +02:00
AppendBitmapMenuItem ( fileMenu , Menu_File_Export_Subtitles , _ ( " Export Subtitles... " ) , _ ( " Saves a copy of subtitles with processing applied to it. " ) , GETIMAGE ( export_menu_16 ) ) ;
2006-01-16 22:02:54 +01:00
wxMenuItem * RecentParent = new wxMenuItem ( fileMenu , Menu_File_Recent_Subs_Parent , _ ( " Recent " ) , _T ( " " ) , wxITEM_NORMAL , RecentSubs ) ;
2007-09-12 01:22:26 +02:00
# ifndef __APPLE__
2009-07-25 06:49:59 +02:00
RecentParent - > SetBitmap ( GETIMAGE ( blank_button_16 ) ) ;
2007-09-12 01:22:26 +02:00
# endif
2006-01-16 22:02:54 +01:00
fileMenu - > Append ( RecentParent ) ;
fileMenu - > AppendSeparator ( ) ;
2009-07-25 06:49:59 +02:00
AppendBitmapMenuItem ( fileMenu , Menu_Tools_Properties , _ ( " &Properties... " ) , _ ( " Open script properties window " ) , GETIMAGE ( properties_toolbutton_16 ) ) ;
AppendBitmapMenuItem ( fileMenu , Menu_Tools_Attachments , _ ( " &Attachments... " ) , _ ( " Open the attachment list " ) , GETIMAGE ( attach_button_16 ) ) ;
AppendBitmapMenuItem ( fileMenu , Menu_Tools_Fonts_Collector , _ ( " &Fonts Collector... " ) , _ ( " Open fonts collector " ) , GETIMAGE ( font_collector_button_16 ) ) ;
2006-12-27 02:56:34 +01:00
fileMenu - > AppendSeparator ( ) ;
2007-09-23 22:19:21 +02:00
# ifndef __APPLE__
// Doesn't work on Mac, only one instance is ever allowed there from OS side
2009-08-16 05:54:44 +02:00
AppendBitmapMenuItem ( fileMenu , Menu_File_New_Window , _ ( " New Window " ) , _ ( " Open a new application window " ) , GETIMAGE ( new_window_menu_16 ) ) ;
2007-09-23 22:19:21 +02:00
# endif
2009-07-25 06:49:59 +02:00
AppendBitmapMenuItem ( fileMenu , Menu_File_Exit , MakeHotkeyText ( _ ( " E&xit " ) , _T ( " Exit " ) ) , _ ( " Exit the application " ) , GETIMAGE ( exit_button_16 ) ) ;
2006-01-16 22:02:54 +01:00
MenuBar - > Append ( fileMenu , _ ( " &File " ) ) ;
// Create Edit menu
2007-04-08 04:41:40 +02:00
// NOTE: Undo and Redo are actually controlled in frame_main_events, OnMenuOpen(). They will always be the first two items.
2006-01-16 22:02:54 +01:00
editMenu = new wxMenu ( ) ;
2009-07-25 06:49:59 +02:00
AppendBitmapMenuItem ( editMenu , Menu_Edit_Undo , MakeHotkeyText ( _ ( " &Undo " ) , _T ( " Undo " ) ) , _ ( " Undoes last action " ) , GETIMAGE ( undo_button_16 ) ) ;
AppendBitmapMenuItem ( editMenu , Menu_Edit_Redo , MakeHotkeyText ( _ ( " &Redo " ) , _T ( " Redo " ) ) , _ ( " Redoes last action " ) , GETIMAGE ( redo_button_16 ) ) ;
2006-01-16 22:02:54 +01:00
editMenu - > AppendSeparator ( ) ;
2009-07-25 06:49:59 +02:00
AppendBitmapMenuItem ( editMenu , Menu_Edit_Cut , MakeHotkeyText ( _ ( " Cut Lines " ) , _T ( " Cut " ) ) , _ ( " Cut subtitles " ) , GETIMAGE ( cut_button_16 ) ) ;
AppendBitmapMenuItem ( editMenu , Menu_Edit_Copy , MakeHotkeyText ( _ ( " Copy Lines " ) , _T ( " Copy " ) ) , _ ( " Copy subtitles " ) , GETIMAGE ( copy_button_16 ) ) ;
AppendBitmapMenuItem ( editMenu , Menu_Edit_Paste , MakeHotkeyText ( _ ( " Paste Lines " ) , _T ( " Paste " ) ) , _ ( " Paste subtitles " ) , GETIMAGE ( paste_button_16 ) ) ;
AppendBitmapMenuItem ( editMenu , Menu_Edit_Paste_Over , MakeHotkeyText ( _ ( " Paste Lines Over... " ) , _T ( " Paste Over " ) ) , _ ( " Paste subtitles over others " ) , GETIMAGE ( paste_over_button_16 ) ) ;
2006-01-16 22:02:54 +01:00
editMenu - > AppendSeparator ( ) ;
2009-07-25 06:49:59 +02:00
AppendBitmapMenuItem ( editMenu , Menu_Edit_Find , MakeHotkeyText ( _ ( " &Find... " ) , _T ( " Find " ) ) , _ ( " Find words in subtitles " ) , GETIMAGE ( find_button_16 ) ) ;
2009-08-18 03:28:15 +02:00
AppendBitmapMenuItem ( editMenu , Menu_Edit_Find_Next , MakeHotkeyText ( _ ( " Find Next " ) , _T ( " Find Next " ) ) , _ ( " Find next match of last word " ) , GETIMAGE ( find_next_menu_16 ) ) ;
AppendBitmapMenuItem ( editMenu , Menu_Edit_Replace , MakeHotkeyText ( _ ( " Search and &Replace... " ) , _T ( " Replace " ) ) , _ ( " Find and replace words in subtitles " ) , GETIMAGE ( find_replace_menu_16 ) ) ;
2006-01-16 22:02:54 +01:00
MenuBar - > Append ( editMenu , _ ( " &Edit " ) ) ;
2006-12-27 02:56:34 +01:00
// Create subtitles menu
subtitlesMenu = new wxMenu ( ) ;
2006-12-27 21:16:47 +01:00
wxMenu * InsertMenu = new wxMenu ;
2006-12-27 21:35:50 +01:00
wxMenuItem * InsertParent = new wxMenuItem ( subtitlesMenu , Menu_Subtitles_Insert , _ ( " &Insert Lines " ) , _T ( " " ) , wxITEM_NORMAL , InsertMenu ) ;
2007-09-12 01:22:26 +02:00
# ifndef __APPLE__
2009-07-25 06:49:59 +02:00
InsertParent - > SetBitmap ( GETIMAGE ( blank_button_16 ) ) ;
2007-09-12 01:22:26 +02:00
# endif
2009-07-25 06:49:59 +02:00
AppendBitmapMenuItem ( subtitlesMenu , Menu_Tools_Styles_Manager , _ ( " &Styles Manager... " ) , _ ( " Open styles manager " ) , GETIMAGE ( style_toolbutton_16 ) ) ;
AppendBitmapMenuItem ( subtitlesMenu , Menu_Tools_Styling , _ ( " St&yling Assistant... " ) , _ ( " Open styling assistant " ) , GETIMAGE ( styling_toolbutton_16 ) ) ;
AppendBitmapMenuItem ( subtitlesMenu , Menu_Tools_Translation , _ ( " &Translation Assistant... " ) , _ ( " Open translation assistant " ) , GETIMAGE ( translation_toolbutton_16 ) ) ;
AppendBitmapMenuItem ( subtitlesMenu , Menu_Tools_Resample , _ ( " Resample Resolution... " ) , _ ( " Changes resolution and modifies subtitles to conform to change " ) , GETIMAGE ( resample_toolbutton_16 ) ) ;
AppendBitmapMenuItem ( subtitlesMenu , Menu_Tools_SpellCheck , _ ( " Spe&ll Checker... " ) , _ ( " Open spell checker " ) , GETIMAGE ( spellcheck_toolbutton_16 ) ) ;
2008-01-20 18:34:35 +01:00
if ( HasASSDraw ( ) ) {
subtitlesMenu - > AppendSeparator ( ) ;
2009-07-25 06:49:59 +02:00
AppendBitmapMenuItem ( subtitlesMenu , Menu_Tools_ASSDraw , _T ( " ASSDraw3... " ) , _ ( " Launches ai-chan's \" ASSDraw3 \" tool for vector drawing. " ) , GETIMAGE ( assdraw_16 ) ) ;
2008-01-20 18:34:35 +01:00
}
2008-01-15 01:54:54 +01:00
subtitlesMenu - > AppendSeparator ( ) ;
2009-07-25 06:49:59 +02:00
AppendBitmapMenuItem ( InsertMenu , MENU_INSERT_BEFORE , _ ( " &Before Current " ) , _ ( " Inserts a line before current " ) , GETIMAGE ( blank_button_16 ) ) ;
AppendBitmapMenuItem ( InsertMenu , MENU_INSERT_AFTER , _ ( " &After Current " ) , _ ( " Inserts a line after current " ) , GETIMAGE ( blank_button_16 ) ) ;
AppendBitmapMenuItem ( InsertMenu , MENU_INSERT_BEFORE_VIDEO , _ ( " Before Current, at Video Time " ) , _ ( " Inserts a line before current, starting at video time " ) , GETIMAGE ( blank_button_16 ) ) ;
AppendBitmapMenuItem ( InsertMenu , MENU_INSERT_AFTER_VIDEO , _ ( " After Current, at Video Time " ) , _ ( " Inserts a line after current, starting at video time " ) , GETIMAGE ( blank_button_16 ) ) ;
2006-12-27 21:16:47 +01:00
subtitlesMenu - > Append ( InsertParent ) ;
2009-07-25 06:49:59 +02:00
AppendBitmapMenuItem ( subtitlesMenu , MENU_DUPLICATE , MakeHotkeyText ( _ ( " &Duplicate Lines " ) , _T ( " Grid duplicate rows " ) ) , _ ( " Duplicate the selected lines " ) , GETIMAGE ( blank_button_16 ) ) ;
AppendBitmapMenuItem ( subtitlesMenu , MENU_DUPLICATE_NEXT_FRAME , MakeHotkeyText ( _ ( " &Duplicate and Shift by 1 Frame " ) , _T ( " Grid duplicate and shift one frame " ) ) , _ ( " Duplicate lines and shift by one frame " ) , GETIMAGE ( blank_button_16 ) ) ;
AppendBitmapMenuItem ( subtitlesMenu , MENU_DELETE , MakeHotkeyText ( _ ( " Delete Lines " ) , _T ( " Grid delete rows " ) ) , _ ( " Delete currently selected lines " ) , GETIMAGE ( delete_button_16 ) ) ;
2006-12-27 21:16:47 +01:00
subtitlesMenu - > AppendSeparator ( ) ;
wxMenu * JoinMenu = new wxMenu ;
2006-12-27 21:35:50 +01:00
wxMenuItem * JoinParent = new wxMenuItem ( subtitlesMenu , Menu_Subtitles_Join , _ ( " Join Lines " ) , _T ( " " ) , wxITEM_NORMAL , JoinMenu ) ;
2007-09-12 01:22:26 +02:00
# ifndef __APPLE__
2009-07-25 06:49:59 +02:00
JoinParent - > SetBitmap ( GETIMAGE ( blank_button_16 ) ) ;
2007-09-12 01:22:26 +02:00
# endif
2009-07-25 06:49:59 +02:00
AppendBitmapMenuItem ( JoinMenu , MENU_JOIN_CONCAT , _ ( " &Concatenate " ) , _ ( " Joins selected lines in a single one, concatenating text together " ) , GETIMAGE ( blank_button_16 ) ) ;
AppendBitmapMenuItem ( JoinMenu , MENU_JOIN_REPLACE , _ ( " Keep &First " ) , _ ( " Joins selected lines in a single one, keeping text of first and discarding remaining " ) , GETIMAGE ( blank_button_16 ) ) ;
AppendBitmapMenuItem ( JoinMenu , MENU_JOIN_AS_KARAOKE , _ ( " As &Karaoke " ) , _ ( " Joins selected lines in a single one, as karaoke " ) , GETIMAGE ( blank_button_16 ) ) ;
2006-12-27 21:16:47 +01:00
subtitlesMenu - > Append ( JoinParent ) ;
2009-07-25 06:49:59 +02:00
AppendBitmapMenuItem ( subtitlesMenu , MENU_RECOMBINE , _ ( " Recombine Lines " ) , _ ( " Recombine subtitles when they have been split and merged " ) , GETIMAGE ( blank_button_16 ) ) ;
AppendBitmapMenuItem ( subtitlesMenu , MENU_SPLIT_BY_KARAOKE , _ ( " Split Lines (by karaoke) " ) , _ ( " Uses karaoke timing to split line into multiple smaller lines " ) , GETIMAGE ( blank_button_16 ) ) ;
2006-12-27 21:16:47 +01:00
subtitlesMenu - > AppendSeparator ( ) ;
2010-05-19 02:44:44 +02:00
wxMenu * SortMenu = new wxMenu ;
wxMenuItem * SortParent = new wxMenuItem ( subtitlesMenu , Menu_Subtitles_Sort_Start , _ ( " Sort Lines " ) , _T ( " " ) , wxITEM_NORMAL , SortMenu ) ;
# ifndef __APPLE__
SortParent - > SetBitmap ( GETIMAGE ( sort_times_button_16 ) ) ;
# endif
AppendBitmapMenuItem ( SortMenu , Menu_Subtitles_Sort_Start , _ ( " &Start Time " ) , _ ( " Sort all subtitles by their start times " ) , GETIMAGE ( blank_button_16 ) ) ;
AppendBitmapMenuItem ( SortMenu , Menu_Subtitles_Sort_End , _ ( " &End Time " ) , _ ( " Sort all subtitles by their end times " ) , GETIMAGE ( blank_button_16 ) ) ;
AppendBitmapMenuItem ( SortMenu , Menu_Subtitles_Sort_Style , _ ( " St&yle Name " ) , _ ( " Sort all subtitles by their style names " ) , GETIMAGE ( blank_button_16 ) ) ;
subtitlesMenu - > Append ( SortParent ) ;
2009-07-25 06:49:59 +02:00
AppendBitmapMenuItem ( subtitlesMenu , MENU_SWAP , _ ( " Swap Lines " ) , _ ( " Swaps the two selected lines " ) , GETIMAGE ( arrow_sort_16 ) ) ;
AppendBitmapMenuItem ( subtitlesMenu , Menu_Edit_Select , MakeHotkeyText ( _ ( " Select Lines... " ) , _T ( " Select lines " ) ) , _ ( " Selects lines based on defined criterea " ) , GETIMAGE ( select_lines_button_16 ) ) ;
2006-12-27 02:56:34 +01:00
MenuBar - > Append ( subtitlesMenu , _ ( " &Subtitles " ) ) ;
// Create timing menu
timingMenu = new wxMenu ( ) ;
2009-07-25 06:49:59 +02:00
AppendBitmapMenuItem ( timingMenu , Menu_Edit_Shift , MakeHotkeyText ( _ ( " S&hift Times... " ) , _T ( " Shift times " ) ) , _ ( " Shift subtitles by time or frames " ) , GETIMAGE ( shift_times_toolbutton_16 ) ) ;
AppendBitmapMenuItem ( timingMenu , Menu_Tools_Timing_Processor , _ ( " Timing Post-Processor... " ) , _ ( " Runs a post-processor for timing to deal with lead-ins, lead-outs, scene timing and etc. " ) , GETIMAGE ( timing_processor_toolbutton_16 ) ) ;
2009-08-11 07:35:25 +02:00
AppendBitmapMenuItem ( timingMenu , Menu_Tools_Kanji_Timer , _ ( " Kanji Timer... " ) , _ ( " Open Kanji timer " ) , GETIMAGE ( kara_timing_copier_16 ) ) ;
2006-12-27 02:56:34 +01:00
timingMenu - > AppendSeparator ( ) ;
2009-07-25 06:49:59 +02:00
AppendBitmapMenuItem ( timingMenu , Menu_Subs_Snap_Start_To_Video , MakeHotkeyText ( _ ( " Snap Start to Video " ) , _T ( " Set Start To Video " ) ) , _ ( " Set start of selected subtitles to current video frame " ) , GETIMAGE ( substart_to_video_16 ) ) ;
AppendBitmapMenuItem ( timingMenu , Menu_Subs_Snap_End_To_Video , MakeHotkeyText ( _ ( " Snap End to Video " ) , _T ( " Set End to Video " ) ) , _ ( " Set end of selected subtitles to current video frame " ) , GETIMAGE ( subend_to_video_16 ) ) ;
AppendBitmapMenuItem ( timingMenu , Menu_Video_Snap_To_Scene , MakeHotkeyText ( _ ( " Snap to Scene " ) , _T ( " Snap to Scene " ) ) , _ ( " Set start and end of subtitles to the keyframes around current video frame " ) , GETIMAGE ( snap_subs_to_scene_16 ) ) ;
AppendBitmapMenuItem ( timingMenu , Menu_Video_Shift_To_Frame , MakeHotkeyText ( _ ( " Shift to Current Frame " ) , _T ( " Shift by Current Time " ) ) , _ ( " Shift selection so first selected line starts at current frame " ) , GETIMAGE ( shift_to_frame_16 ) ) ;
2006-12-27 21:35:50 +01:00
timingMenu - > AppendSeparator ( ) ;
2006-12-28 21:59:39 +01:00
wxMenu * ContinuousMenu = new wxMenu ;
wxMenuItem * ContinuousParent = new wxMenuItem ( subtitlesMenu , - 1 , _ ( " Make Times Continuous " ) , _T ( " " ) , wxITEM_NORMAL , ContinuousMenu ) ;
2007-09-12 01:22:26 +02:00
# ifndef __APPLE__
2009-07-25 06:49:59 +02:00
ContinuousParent - > SetBitmap ( GETIMAGE ( blank_button_16 ) ) ;
2007-09-12 01:22:26 +02:00
# endif
2009-07-25 06:49:59 +02:00
AppendBitmapMenuItem ( ContinuousMenu , MENU_ADJOIN , _ ( " Change &Start " ) , _ ( " Changes times of subs so start times begin on previous's end time " ) , GETIMAGE ( blank_button_16 ) ) ;
AppendBitmapMenuItem ( ContinuousMenu , MENU_ADJOIN2 , _ ( " Change &End " ) , _ ( " Changes times of subs so end times begin on next's start time " ) , GETIMAGE ( blank_button_16 ) ) ;
2006-12-28 21:59:39 +01:00
timingMenu - > Append ( ContinuousParent ) ;
2006-12-27 02:56:34 +01:00
MenuBar - > Append ( timingMenu , _ ( " &Timing " ) ) ;
2006-01-16 22:02:54 +01:00
// Create video menu
videoMenu = new wxMenu ( ) ;
2009-08-22 05:51:00 +02:00
AppendBitmapMenuItem ( videoMenu , Menu_File_Open_Video , _ ( " &Open Video... " ) , _ ( " Opens a video file " ) , GETIMAGE ( open_video_menu_16 ) ) ;
2009-08-18 03:28:15 +02:00
AppendBitmapMenuItem ( videoMenu , Menu_File_Close_Video , _ ( " &Close Video " ) , _ ( " Closes the currently open video file " ) , GETIMAGE ( close_video_menu_16 ) ) ;
2006-01-16 22:02:54 +01:00
wxMenuItem * RecentVidParent = new wxMenuItem ( videoMenu , Menu_File_Recent_Vids_Parent , _ ( " Recent " ) , _T ( " " ) , wxITEM_NORMAL , RecentVids ) ;
videoMenu - > Append ( RecentVidParent ) ;
2009-08-22 05:51:00 +02:00
AppendBitmapMenuItem ( videoMenu , Menu_Video_Dummy , _ ( " Use Dummy Video... " ) , _ ( " Opens a video clip with solid colour " ) , GETIMAGE ( use_dummy_video_menu_16 ) ) ;
AppendBitmapMenuItem ( videoMenu , Menu_Video_Details , _ ( " Show Video Details... " ) , _ ( " Shows video details " ) , GETIMAGE ( show_video_details_menu_16 ) ) ;
2006-01-16 22:02:54 +01:00
videoMenu - > AppendSeparator ( ) ;
2009-08-16 05:54:44 +02:00
AppendBitmapMenuItem ( videoMenu , Menu_File_Open_VFR , _ ( " Open Timecodes File... " ) , _ ( " Opens a VFR timecodes v1 or v2 file " ) , GETIMAGE ( open_timecodes_menu_16 ) ) ;
2009-08-22 05:51:00 +02:00
AppendBitmapMenuItem ( videoMenu , Menu_File_Save_VFR , _ ( " Save Timecodes File... " ) , _ ( " Saves a VFR timecodes v2 file " ) , GETIMAGE ( save_timecodes_menu_16 ) ) ;
AppendBitmapMenuItem ( videoMenu , Menu_File_Close_VFR , _ ( " Close Timecodes File " ) , _ ( " Closes the currently open timecodes file " ) , GETIMAGE ( close_timecodes_menu_16 ) ) - > Enable ( false ) ;
2006-07-01 07:34:39 +02:00
wxMenuItem * RecentTimesParent = new wxMenuItem ( videoMenu , Menu_File_Recent_Timecodes_Parent , _ ( " Recent " ) , _T ( " " ) , wxITEM_NORMAL , RecentTimecodes ) ;
videoMenu - > Append ( RecentTimesParent ) ;
2006-01-16 22:02:54 +01:00
videoMenu - > AppendSeparator ( ) ;
2009-08-22 05:51:00 +02:00
AppendBitmapMenuItem ( videoMenu , Menu_Video_Load_Keyframes , _ ( " Open Keyframes... " ) , _ ( " Opens a keyframe list file " ) , GETIMAGE ( open_keyframes_menu_16 ) ) ;
AppendBitmapMenuItem ( videoMenu , Menu_Video_Save_Keyframes , _ ( " Save Keyframes... " ) , _ ( " Saves the current keyframe list " ) , GETIMAGE ( save_keyframes_menu_16 ) ) - > Enable ( false ) ;
AppendBitmapMenuItem ( videoMenu , Menu_Video_Close_Keyframes , _ ( " Close Keyframes " ) , _ ( " Closes the currently open keyframes list " ) , GETIMAGE ( close_keyframes_menu_16 ) ) - > Enable ( false ) ;
2006-12-18 18:18:14 +01:00
wxMenuItem * RecentKeyframesParent = new wxMenuItem ( videoMenu , Menu_File_Recent_Keyframes_Parent , _ ( " Recent " ) , _T ( " " ) , wxITEM_NORMAL , RecentKeyframes ) ;
videoMenu - > Append ( RecentKeyframesParent ) ;
2006-12-18 03:44:38 +01:00
videoMenu - > AppendSeparator ( ) ;
2009-08-19 09:03:39 +02:00
AppendBitmapMenuItem ( videoMenu , Menu_Video_Detach , _ ( " Detach Video " ) , _ ( " Detach video, displaying it in a separate Window. " ) , GETIMAGE ( detach_video_menu_16 ) ) ;
2006-12-28 21:59:39 +01:00
wxMenu * ZoomMenu = new wxMenu ;
wxMenuItem * ZoomParent = new wxMenuItem ( subtitlesMenu , Menu_View_Zoom , _ ( " Set Zoom " ) , _T ( " " ) , wxITEM_NORMAL , ZoomMenu ) ;
2007-09-12 01:22:26 +02:00
# ifndef __APPLE__
2009-08-16 05:54:44 +02:00
ZoomParent - > SetBitmap ( GETIMAGE ( set_zoom_menu_16 ) ) ;
2007-09-12 01:22:26 +02:00
# endif
2007-07-05 17:41:41 +02:00
ZoomMenu - > Append ( Menu_View_Zoom_50 , MakeHotkeyText ( _T ( " &50% " ) , _T ( " Zoom 50% " ) ) , _ ( " Set zoom to 50% " ) ) ;
ZoomMenu - > Append ( Menu_View_Zoom_100 , MakeHotkeyText ( _T ( " &100% " ) , _T ( " Zoom 100% " ) ) , _ ( " Set zoom to 100% " ) ) ;
ZoomMenu - > Append ( Menu_View_Zoom_200 , MakeHotkeyText ( _T ( " &200% " ) , _T ( " Zoom 200% " ) ) , _ ( " Set zoom to 200% " ) ) ;
2006-12-28 21:59:39 +01:00
videoMenu - > Append ( ZoomParent ) ;
wxMenu * AspectMenu = new wxMenu ;
wxMenuItem * AspectParent = new wxMenuItem ( subtitlesMenu , Menu_Video_AR , _ ( " Override Aspect Ratio " ) , _T ( " " ) , wxITEM_NORMAL , AspectMenu ) ;
2007-09-12 01:22:26 +02:00
# ifndef __APPLE__
2009-08-16 05:54:44 +02:00
AspectParent - > SetBitmap ( GETIMAGE ( override_aspect_menu_16 ) ) ;
2007-09-12 01:22:26 +02:00
# endif
2006-12-28 21:59:39 +01:00
AspectMenu - > AppendCheckItem ( Menu_Video_AR_Default , _ ( " &Default " ) , _ ( " Leave video on original aspect ratio " ) ) ;
AspectMenu - > AppendCheckItem ( Menu_Video_AR_Full , _ ( " &Fullscreen (4:3) " ) , _ ( " Forces video to 4:3 aspect ratio " ) ) ;
AspectMenu - > AppendCheckItem ( Menu_Video_AR_Wide , _ ( " &Widescreen (16:9) " ) , _ ( " Forces video to 16:9 aspect ratio " ) ) ;
AspectMenu - > AppendCheckItem ( Menu_Video_AR_235 , _ ( " &Cinematic (2.35) " ) , _ ( " Forces video to 2.35 aspect ratio " ) ) ;
AspectMenu - > AppendCheckItem ( Menu_Video_AR_Custom , _ ( " Custom... " ) , _ ( " Forces video to a custom aspect ratio " ) ) ;
videoMenu - > Append ( AspectParent ) ;
2007-09-28 00:52:01 +02:00
videoMenu - > AppendCheckItem ( Menu_Video_Overscan , _ ( " Show Overscan Mask " ) , _ ( " Show a mask over the video, indicating areas that might get cropped off by overscan on televisions. " ) ) ;
2009-08-19 09:03:39 +02:00
// This is broken as you can't use Check() on a menu item that has a bitmap.
// AppendBitmapMenuItem(videoMenu, Menu_Video_Overscan, _("Show Overscan Mask"), _("Show a mask over the video, indicating areas that might get cropped off by overscan on televisions."), GETIMAGE(show_overscan_menu_checked_16));
2006-12-31 23:38:54 +01:00
videoMenu - > AppendSeparator ( ) ;
2009-07-25 06:49:59 +02:00
AppendBitmapMenuItem ( videoMenu , Menu_Video_JumpTo , MakeHotkeyText ( _ ( " &Jump to... " ) , _T ( " Video Jump " ) ) , _ ( " Jump to frame or time " ) , GETIMAGE ( jumpto_button_16 ) ) ;
AppendBitmapMenuItem ( videoMenu , Menu_Subs_Snap_Video_To_Start , MakeHotkeyText ( _ ( " Jump Video to Start " ) , _T ( " Jump Video To Start " ) ) , _ ( " Jumps the video to the start frame of current subtitle " ) , GETIMAGE ( video_to_substart_16 ) ) ;
AppendBitmapMenuItem ( videoMenu , Menu_Subs_Snap_Video_To_End , MakeHotkeyText ( _ ( " Jump Video to End " ) , _T ( " Jump Video To End " ) ) , _ ( " Jumps the video to the end frame of current subtitle " ) , GETIMAGE ( video_to_subend_16 ) ) ;
2006-01-16 22:02:54 +01:00
MenuBar - > Append ( videoMenu , _ ( " &Video " ) ) ;
// Create audio menu
audioMenu = new wxMenu ( ) ;
2009-08-18 03:28:15 +02:00
AppendBitmapMenuItem ( audioMenu , Menu_Audio_Open_File , _ ( " &Open Audio File... " ) , _ ( " Opens an audio file " ) , GETIMAGE ( open_audio_menu_16 ) ) ;
AppendBitmapMenuItem ( audioMenu , Menu_Audio_Open_From_Video , _ ( " Open Audio from &Video " ) , _ ( " Opens the audio from the current video file " ) , GETIMAGE ( open_audio_from_video_menu_16 ) ) ;
AppendBitmapMenuItem ( audioMenu , Menu_Audio_Close , _ ( " &Close Audio " ) , _ ( " Closes the currently open audio file " ) , GETIMAGE ( close_audio_menu_16 ) ) ;
2006-01-16 22:02:54 +01:00
wxMenuItem * RecentAudParent = new wxMenuItem ( audioMenu , Menu_File_Recent_Auds_Parent , _ ( " Recent " ) , _T ( " " ) , wxITEM_NORMAL , RecentAuds ) ;
audioMenu - > Append ( RecentAudParent ) ;
2007-07-23 17:19:48 +02:00
# ifdef _DEBUG
2007-09-28 00:52:01 +02:00
audioMenu - > AppendSeparator ( ) ;
audioMenu - > Append ( Menu_Audio_Open_Dummy , _T ( " Open 2h30 Blank Audio " ) , _T ( " Open a 150 minutes blank audio clip, for debugging " ) ) ;
audioMenu - > Append ( Menu_Audio_Open_Dummy_Noise , _T ( " Open 2h30 Noise Audio " ) , _T ( " Open a 150 minutes noise-filled audio clip, for debugging " ) ) ;
2007-07-23 17:19:48 +02:00
# endif
2006-01-16 22:02:54 +01:00
MenuBar - > Append ( audioMenu , _ ( " &Audio " ) ) ;
2007-01-08 00:14:21 +01:00
// Create Automation menu
2007-12-31 07:46:22 +01:00
# ifdef WITH_AUTOMATION
2007-01-08 00:14:21 +01:00
automationMenu = new wxMenu ( ) ;
2009-07-25 06:49:59 +02:00
AppendBitmapMenuItem ( automationMenu , Menu_Tools_Automation , _ ( " &Automation... " ) , _ ( " Open automation manager " ) , GETIMAGE ( automation_toolbutton_16 ) ) ;
2007-01-08 00:14:21 +01:00
automationMenu - > AppendSeparator ( ) ;
MenuBar - > Append ( automationMenu , _ ( " &Automation " ) ) ;
2007-12-31 07:46:22 +01:00
# endif
2007-01-08 00:14:21 +01:00
2006-12-27 02:56:34 +01:00
// Create view menu
viewMenu = new wxMenu ( ) ;
2009-08-22 05:59:09 +02:00
AppendBitmapMenuItem ( viewMenu , Menu_View_Language , _T ( " &Language... " ) , _ ( " Select Aegisub interface language " ) , GETIMAGE ( languages_menu_16 ) ) ;
2009-07-25 06:49:59 +02:00
AppendBitmapMenuItem ( viewMenu , Menu_Tools_Options , MakeHotkeyText ( _ ( " &Options... " ) , _T ( " Options " ) ) , _ ( " Configure Aegisub " ) , GETIMAGE ( options_button_16 ) ) ;
2006-12-27 02:56:34 +01:00
viewMenu - > AppendSeparator ( ) ;
2007-09-28 00:52:01 +02:00
viewMenu - > AppendRadioItem ( Menu_View_Subs , _ ( " Subs Only View " ) , _ ( " Display subtitles only " ) ) ;
viewMenu - > AppendRadioItem ( Menu_View_Video , _ ( " Video+Subs View " ) , _ ( " Display video and subtitles only " ) ) ;
viewMenu - > AppendRadioItem ( Menu_View_Audio , _ ( " Audio+Subs View " ) , _ ( " Display audio and subtitles only " ) ) ;
2006-12-27 02:56:34 +01:00
viewMenu - > AppendRadioItem ( Menu_View_Standard , _ ( " Full view " ) , _ ( " Display audio, video and subtitles " ) ) ;
2010-04-30 22:42:07 +02:00
viewMenu - > AppendSeparator ( ) ;
viewMenu - > AppendRadioItem ( Menu_View_FullTags , _ ( " Show Tags " ) , _ ( " Show full override tags in the subtitle grid " ) ) ;
viewMenu - > AppendRadioItem ( Menu_View_ShortTags , _ ( " Simplify Tags " ) , _ ( " Replace override tags in the subtitle grid with a simplified placeholder " ) ) ;
viewMenu - > AppendRadioItem ( Menu_View_NoTags , _ ( " Hide Tags " ) , _ ( " Hide override tags in the subtitle grid " ) ) ;
2006-12-27 02:56:34 +01:00
MenuBar - > Append ( viewMenu , _ ( " Vie&w " ) ) ;
2006-01-16 22:02:54 +01:00
// Create help menu
helpMenu = new wxMenu ( ) ;
2009-07-25 06:49:59 +02:00
AppendBitmapMenuItem ( helpMenu , Menu_Help_Contents , MakeHotkeyText ( _ ( " &Contents... " ) , _T ( " Help " ) ) , _ ( " Help topics " ) , GETIMAGE ( contents_button_16 ) ) ;
2009-12-25 04:28:15 +01:00
# ifdef __WXMAC__
AppendBitmapMenuItem ( helpMenu , Menu_Help_Files , MakeHotkeyText ( _ ( " &All Files " ) + _T ( " ... " ) , _T ( " Help " ) ) , _ ( " Help topics " ) , GETIMAGE ( contents_button_16 ) ) ;
# endif
2006-01-16 22:02:54 +01:00
helpMenu - > AppendSeparator ( ) ;
2009-07-25 06:49:59 +02:00
AppendBitmapMenuItem ( helpMenu , Menu_Help_Website , _ ( " &Website... " ) , _ ( " Visit Aegisub's official website " ) , GETIMAGE ( website_button_16 ) ) ;
AppendBitmapMenuItem ( helpMenu , Menu_Help_Forums , _ ( " &Forums... " ) , _ ( " Visit Aegisub's forums " ) , GETIMAGE ( forums_button_16 ) ) ;
AppendBitmapMenuItem ( helpMenu , Menu_Help_BugTracker , _ ( " &Bug Tracker... " ) , _ ( " Visit Aegisub's bug tracker to report bugs and request new features " ) , GETIMAGE ( bugtracker_button_16 ) ) ;
AppendBitmapMenuItem ( helpMenu , Menu_Help_IRCChannel , _ ( " &IRC Channel... " ) , _ ( " Visit Aegisub's official IRC channel " ) , GETIMAGE ( irc_button_16 ) ) ;
2008-07-22 22:55:24 +02:00
# ifndef __WXMAC__
2006-02-23 20:26:14 +01:00
helpMenu - > AppendSeparator ( ) ;
2008-07-22 22:55:24 +02:00
# endif
2009-07-25 06:49:59 +02:00
AppendBitmapMenuItem ( helpMenu , Menu_Help_Check_Updates , _ ( " &Check for Updates... " ) , _ ( " Check to see if there is a new version of Aegisub available " ) , GETIMAGE ( blank_button_16 ) ) ;
2009-08-22 05:51:00 +02:00
AppendBitmapMenuItem ( helpMenu , Menu_Help_About , _ ( " &About... " ) , _ ( " About Aegisub " ) , GETIMAGE ( about_menu_16 ) ) ;
2010-06-03 01:47:39 +02:00
AppendBitmapMenuItem ( helpMenu , Menu_Help_Log , _ ( " &Log window... " ) , _ ( " Aegisub event log " ) , GETIMAGE ( about_menu_16 ) ) ;
2006-01-16 22:02:54 +01:00
MenuBar - > Append ( helpMenu , _ ( " &Help " ) ) ;
// Set the bar as this frame's
SetMenuBar ( MenuBar ) ;
// Set menu created flag
menuCreated = 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 Initialize contents
2006-01-16 22:02:54 +01:00
void FrameMain : : InitContents ( ) {
2010-07-09 09:31:48 +02:00
AssFile : : top = ass = new AssFile ;
2006-01-16 22:02:54 +01:00
// Set a background panel
2009-06-12 18:59:53 +02:00
StartupLog ( _T ( " Create background panel " ) ) ;
2006-01-16 22:02:54 +01:00
Panel = new wxPanel ( this , - 1 , wxDefaultPosition , wxDefaultSize , wxTAB_TRAVERSAL | wxCLIP_CHILDREN ) ;
// Initialize sizers
2009-06-12 18:59:53 +02:00
StartupLog ( _T ( " Create main sizers " ) ) ;
2006-01-16 22:02:54 +01:00
MainSizer = new wxBoxSizer ( wxVERTICAL ) ;
TopSizer = new wxBoxSizer ( wxHORIZONTAL ) ;
BottomSizer = new wxBoxSizer ( wxHORIZONTAL ) ;
// Video area;
2009-06-12 18:59:53 +02:00
StartupLog ( _T ( " Create video box " ) ) ;
2010-08-13 07:51:17 +02:00
videoBox = new VideoBox ( Panel , false , ZoomBox ) ;
2007-01-11 04:53:20 +01:00
TopSizer - > Add ( videoBox , 0 , wxEXPAND , 0 ) ;
2006-01-16 22:02:54 +01:00
// Subtitles area
2009-06-12 18:59:53 +02:00
StartupLog ( _T ( " Create subtitles grid " ) ) ;
2010-07-09 09:31:48 +02:00
SubsGrid = new SubtitlesGrid ( this , Panel , - 1 , ass , wxDefaultPosition , wxSize ( 600 , 100 ) , wxWANTS_CHARS | wxSUNKEN_BORDER , _T ( " Subs grid " ) ) ;
2010-06-16 08:20:33 +02:00
BottomSizer - > Add ( SubsGrid , 1 , wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM , 0 ) ;
videoBox - > videoSlider - > grid = SubsGrid ;
VideoContext : : Get ( ) - > grid = SubsGrid ;
Search . grid = SubsGrid ;
2006-01-16 22:02:54 +01:00
// Audio area
2009-06-12 18:59:53 +02:00
StartupLog ( _T ( " Create audio box " ) ) ;
2007-01-21 18:01:22 +01:00
audioBox = new AudioBox ( Panel ) ;
2006-01-16 22:02:54 +01:00
audioBox - > frameMain = this ;
2007-01-21 07:30:19 +01:00
VideoContext : : Get ( ) - > audio = audioBox - > audioDisplay ;
2006-01-16 22:02:54 +01:00
// Top sizer
2009-06-12 18:59:53 +02:00
StartupLog ( _T ( " Create subtitle editing box " ) ) ;
2010-07-20 05:11:11 +02:00
EditBox = new SubsEditBox ( Panel , SubsGrid , audioBox - > audioDisplay ) ;
2009-06-12 18:59:53 +02:00
StartupLog ( _T ( " Arrange controls in sizers " ) ) ;
2006-01-16 22:02:54 +01:00
ToolSizer = new wxBoxSizer ( wxVERTICAL ) ;
ToolSizer - > Add ( audioBox , 0 , wxEXPAND | wxBOTTOM , 5 ) ;
ToolSizer - > Add ( EditBox , 1 , wxEXPAND , 5 ) ;
TopSizer - > Add ( ToolSizer , 1 , wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM , 5 ) ;
// Set sizers/hints
2009-06-12 18:59:53 +02:00
StartupLog ( _T ( " Arrange main sizers " ) ) ;
2007-07-07 05:21:52 +02:00
MainSizer - > Add ( new wxStaticLine ( Panel ) , 0 , wxEXPAND | wxALL , 0 ) ;
2006-01-16 22:02:54 +01:00
MainSizer - > Add ( TopSizer , 0 , wxEXPAND | wxALL , 0 ) ;
MainSizer - > Add ( BottomSizer , 1 , wxEXPAND | wxALL , 0 ) ;
Panel - > SetSizer ( MainSizer ) ;
//MainSizer->SetSizeHints(Panel);
//SetSizer(MainSizer);
// Set display
2009-06-12 18:59:53 +02:00
StartupLog ( _T ( " Perform layout " ) ) ;
2006-01-16 22:02:54 +01:00
Layout ( ) ;
2009-06-12 18:59:53 +02:00
StartupLog ( _T ( " Set focus to edting box " ) ) ;
2007-07-03 03:09:39 +02:00
EditBox - > TextEdit - > SetFocus ( ) ;
2009-06-12 18:59:53 +02:00
StartupLog ( _T ( " Leaving InitContents " ) ) ;
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 Deinitialize controls
2006-02-03 01:22:16 +01:00
void FrameMain : : DeInitContents ( ) {
2007-01-23 05:42:08 +01:00
if ( detachedVideo ) detachedVideo - > Destroy ( ) ;
2009-05-14 09:02:01 +02:00
if ( stylingAssistant ) stylingAssistant - > Destroy ( ) ;
2010-06-26 09:26:27 +02:00
SubsGrid - > ClearMaps ( ) ;
2006-02-03 01:22:16 +01:00
delete EditBox ;
delete videoBox ;
2010-07-09 09:31:48 +02:00
delete ass ;
2009-06-12 02:04:35 +02:00
HelpButton : : ClearPages ( ) ;
2010-07-08 06:29:04 +02:00
VideoContext : : Get ( ) - > audio = NULL ;
2006-02-03 01:22:16 +01:00
}
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 Update toolbar
2006-01-16 22:02:54 +01:00
void FrameMain : : UpdateToolbar ( ) {
// Collect flags
2007-01-23 07:32:16 +01:00
bool isVideo = VideoContext : : Get ( ) - > IsLoaded ( ) ;
2006-01-16 22:02:54 +01:00
HasSelection = true ;
2010-06-16 08:20:33 +02:00
int selRows = SubsGrid - > GetNumberSelection ( ) ;
2006-01-16 22:02:54 +01:00
// Update
wxToolBar * toolbar = GetToolBar ( ) ;
toolbar - > FindById ( Menu_Video_JumpTo ) - > Enable ( isVideo ) ;
2009-10-10 17:21:26 +02:00
toolbar - > FindById ( Menu_Video_Zoom_In ) - > Enable ( isVideo & & ! detachedVideo ) ;
toolbar - > FindById ( Menu_Video_Zoom_Out ) - > Enable ( isVideo & & ! detachedVideo ) ;
ZoomBox - > Enable ( isVideo & & ! detachedVideo ) ;
2006-02-19 02:16:15 +01:00
toolbar - > FindById ( Menu_Subs_Snap_Start_To_Video ) - > Enable ( isVideo & & selRows > 0 ) ;
toolbar - > FindById ( Menu_Subs_Snap_End_To_Video ) - > Enable ( isVideo & & selRows > 0 ) ;
toolbar - > FindById ( Menu_Subs_Snap_Video_To_Start ) - > Enable ( isVideo & & selRows = = 1 ) ;
toolbar - > FindById ( Menu_Subs_Snap_Video_To_End ) - > Enable ( isVideo & & selRows = = 1 ) ;
2006-01-16 22:02:54 +01:00
toolbar - > FindById ( Menu_Video_Select_Visible ) - > Enable ( isVideo ) ;
2006-02-19 02:16:15 +01:00
toolbar - > FindById ( Menu_Video_Snap_To_Scene ) - > Enable ( isVideo & & selRows > 0 ) ;
toolbar - > FindById ( Menu_Video_Shift_To_Frame ) - > Enable ( isVideo & & selRows > 0 ) ;
2006-01-16 22:02:54 +01:00
toolbar - > Realize ( ) ;
}
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 subtitles
/// @param filename
/// @param charset
2006-01-16 22:02:54 +01:00
void FrameMain : : LoadSubtitles ( wxString filename , wxString charset ) {
// First check if there is some loaded
2010-07-09 09:31:48 +02:00
if ( ass & & ass - > loaded ) {
2006-01-16 22:02:54 +01:00
if ( TryToCloseSubs ( ) = = wxCANCEL ) return ;
}
// Setup
2010-08-02 08:32:01 +02:00
bool isFile = ! filename . empty ( ) ;
2006-01-16 22:02:54 +01:00
// Load
try {
2006-02-23 23:47:14 +01:00
// File exists?
if ( isFile ) {
wxFileName fileCheck ( filename ) ;
2010-08-02 08:32:01 +02:00
if ( ! fileCheck . FileExists ( ) ) {
throw agi : : FileNotFoundError ( STD_STR ( filename ) ) ;
}
2006-02-24 00:04:41 +01:00
// Make sure that file isn't actually a timecode file
2009-07-14 23:28:49 +02:00
try {
TextFileReader testSubs ( filename , charset ) ;
2010-08-03 22:21:04 +02:00
wxString cur = testSubs . ReadLineFromFile ( ) ;
if ( cur . Left ( 10 ) = = _T ( " # timecode " ) ) {
LoadVFR ( filename ) ;
OPT_SET ( " Path/Last/Timecodes " ) - > SetString ( STD_STR ( fileCheck . GetPath ( ) ) ) ;
return ;
2006-02-24 00:04:41 +01:00
}
}
2009-07-14 23:28:49 +02:00
catch ( . . . ) {
2010-08-02 08:32:01 +02:00
// if trying to load the file as timecodes fails it's fairly
// safe to assume that it is in fact not a timecode file
2009-07-14 23:28:49 +02:00
}
2006-02-23 23:47:14 +01:00
}
// Proceed into loading
2010-06-26 09:26:27 +02:00
SubsGrid - > ClearMaps ( ) ;
2006-01-16 22:02:54 +01:00
if ( isFile ) {
2010-07-09 09:31:48 +02:00
ass - > Load ( filename , charset ) ;
2010-06-26 09:26:27 +02:00
SubsGrid - > UpdateMaps ( ) ;
2010-06-27 06:54:46 +02:00
if ( SubsGrid - > GetRows ( ) ) {
SubsGrid - > SetActiveLine ( SubsGrid - > GetDialogue ( 0 ) ) ;
SubsGrid - > SelectRow ( 0 ) ;
}
2007-06-21 00:23:55 +02:00
wxFileName fn ( filename ) ;
StandardPaths : : SetPathValue ( _T ( " ?script " ) , fn . GetPath ( ) ) ;
2010-05-21 03:13:36 +02:00
OPT_SET ( " Path/Last/Subtitles " ) - > SetString ( STD_STR ( fn . GetPath ( ) ) ) ;
2006-01-16 22:02:54 +01:00
}
else {
2010-06-26 09:26:27 +02:00
SubsGrid - > LoadDefault ( ) ;
2007-06-21 00:23:55 +02:00
StandardPaths : : SetPathValue ( _T ( " ?script " ) , _T ( " " ) ) ;
2006-01-16 22:02:54 +01:00
}
2010-10-11 22:05:59 +02:00
SubsGrid - > SetColumnWidths ( ) ;
2006-01-16 22:02:54 +01:00
}
2010-08-02 08:32:01 +02:00
catch ( agi : : FileNotFoundError const & ) {
wxMessageBox ( filename + L " not found. " , L " Error " , wxOK | wxICON_ERROR , NULL ) ;
config : : mru - > Remove ( " Subtitle " , STD_STR ( filename ) ) ;
return ;
}
2006-04-14 18:46:38 +02:00
catch ( const wchar_t * err ) {
2006-01-16 22:02:54 +01:00
wxMessageBox ( wxString ( err ) , _T ( " Error " ) , wxOK | wxICON_ERROR , NULL ) ;
return ;
}
2009-07-14 23:28:49 +02:00
catch ( wxString err ) {
wxMessageBox ( err , _T ( " Error " ) , wxOK | wxICON_ERROR , NULL ) ;
return ;
}
2006-01-16 22:02:54 +01:00
catch ( . . . ) {
wxMessageBox ( _T ( " Unknown error " ) , _T ( " Error " ) , wxOK | wxICON_ERROR , NULL ) ;
return ;
}
// Save copy
wxFileName origfile ( filename ) ;
2010-08-03 22:21:04 +02:00
if ( ass - > CanSave ( ) & & OPT_GET ( " App/Auto/Backup " ) - > GetBool ( ) & & origfile . FileExists ( ) ) {
2006-01-16 22:02:54 +01:00
// Get path
2010-05-21 03:13:36 +02:00
wxString path = lagi_wxString ( OPT_GET ( " Path/Auto/Backup " ) - > GetString ( ) ) ;
2006-02-20 22:32:58 +01:00
if ( path . IsEmpty ( ) ) path = origfile . GetPath ( ) ;
2006-01-16 22:02:54 +01:00
wxFileName dstpath ( path ) ;
2009-07-14 05:02:17 +02:00
if ( ! dstpath . IsAbsolute ( ) ) path = StandardPaths : : DecodePathMaybeRelative ( path , _T ( " ?user/ " ) ) ;
2006-01-16 22:02:54 +01:00
path + = _T ( " / " ) ;
dstpath . Assign ( path ) ;
if ( ! dstpath . DirExists ( ) ) wxMkdir ( path ) ;
// Save
wxString backup = path + origfile . GetName ( ) + _T ( " .ORIGINAL. " ) + origfile . GetExt ( ) ;
2009-07-14 04:20:40 +02:00
wxCopyFile ( filename , backup , true ) ;
2006-01-16 22:02:54 +01:00
}
// Sync
SynchronizeProject ( true ) ;
// Update title bar
UpdateTitle ( ) ;
2010-07-08 06:29:04 +02:00
VideoContext : : Get ( ) - > Refresh ( ) ;
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 Save subtitles
/// @param saveas
/// @param withCharset
/// @return
2006-01-16 22:02:54 +01:00
bool FrameMain : : SaveSubtitles ( bool saveas , bool withCharset ) {
// Try to get filename from file
wxString filename ;
2010-07-09 09:31:48 +02:00
if ( saveas = = false & & ass - > CanSave ( ) ) filename = ass - > filename ;
2006-01-16 22:02:54 +01:00
// Failed, ask user
2006-02-20 22:32:58 +01:00
if ( filename . IsEmpty ( ) ) {
2007-01-21 07:30:19 +01:00
VideoContext : : Get ( ) - > Stop ( ) ;
2010-05-21 03:13:36 +02:00
wxString path = lagi_wxString ( OPT_GET ( " Path/Last/Subtitles " ) - > GetString ( ) ) ;
2010-07-09 09:31:48 +02:00
wxFileName origPath ( ass - > filename ) ;
2010-08-02 08:32:01 +02:00
filename = wxFileSelector ( _ ( " Save subtitles file " ) , path , origPath . GetName ( ) + _T ( " .ass " ) , _T ( " ass " ) , AssFile : : GetWildcardList ( 1 ) , wxFD_SAVE | wxFD_OVERWRITE_PROMPT , this ) ;
2006-01-16 22:02:54 +01:00
}
// Actually save
if ( ! filename . empty ( ) ) {
2006-03-14 05:23:00 +01:00
// Store path
wxFileName filepath ( filename ) ;
2010-05-21 03:13:36 +02:00
OPT_SET ( " Path/Last/Subtitles " ) - > SetString ( STD_STR ( filepath . GetPath ( ) ) ) ;
2006-03-14 05:23:00 +01:00
// Fix me, ghetto hack for correct relative path generation in SynchronizeProject()
2010-07-09 09:31:48 +02:00
ass - > filename = filename ;
2006-03-14 05:23:00 +01:00
// Synchronize
SynchronizeProject ( ) ;
2006-01-16 22:02:54 +01:00
// Get charset
wxString charset = _T ( " " ) ;
if ( withCharset ) {
2010-06-03 22:32:25 +02:00
charset = wxGetSingleChoice ( _ ( " Choose charset code: " ) , _T ( " Charset " ) , agi : : charset : : GetEncodingsList < wxArrayString > ( ) , this , - 1 , - 1 , true , 250 , 200 ) ;
2006-02-20 22:32:58 +01:00
if ( charset . IsEmpty ( ) ) return false ;
2006-01-16 22:02:54 +01:00
}
// Save
try {
2010-07-09 09:31:48 +02:00
ass - > Save ( filename , true , true , charset ) ;
2006-01-16 22:02:54 +01:00
UpdateTitle ( ) ;
}
2010-09-08 22:03:48 +02:00
catch ( const agi : : Exception & err ) {
wxMessageBox ( lagi_wxString ( err . GetMessage ( ) ) , " Error " , wxOK | wxICON_ERROR , NULL ) ;
return false ;
}
2006-04-14 18:46:38 +02:00
catch ( const wchar_t * err ) {
2006-01-16 22:02:54 +01:00
wxMessageBox ( wxString ( err ) , _T ( " Error " ) , wxOK | wxICON_ERROR , NULL ) ;
return false ;
}
catch ( . . . ) {
wxMessageBox ( _T ( " Unknown error " ) , _T ( " Error " ) , wxOK | wxICON_ERROR , NULL ) ;
return false ;
}
return true ;
}
return false ;
}
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
/// @brief Try to close subtitles
/// @param enableCancel
/// @return
2006-01-16 22:02:54 +01:00
int FrameMain : : TryToCloseSubs ( bool enableCancel ) {
if ( ass - > IsModified ( ) ) {
int flags = wxYES_NO ;
if ( enableCancel ) flags | = wxCANCEL ;
int result = wxMessageBox ( _ ( " Save before continuing? " ) , _ ( " Unsaved changes " ) , flags , this ) ;
if ( result = = wxYES ) {
// If it fails saving, return cancel anyway
if ( SaveSubtitles ( false ) ) return wxYES ;
else return wxCANCEL ;
}
return result ;
}
else return wxYES ;
}
2009-10-12 00:10:08 +02:00
/// @brief Set the video and audio display visibilty
/// @param video -1: leave unchanged; 0: hide; 1: show
/// @param audio -1: leave unchanged; 0: hide; 1: show
void FrameMain : : SetDisplayMode ( int video , int audio ) {
if ( ! IsShownOnScreen ( ) ) return ;
bool sv = false , sa = false ;
if ( video = = - 1 ) sv = showVideo ;
else if ( video ) sv = VideoContext : : Get ( ) - > IsLoaded ( ) & & ! detachedVideo ;
if ( audio = = - 1 ) sa = showAudio ;
else if ( audio ) sa = audioBox - > loaded ;
2006-01-16 22:02:54 +01:00
2007-01-23 05:42:08 +01:00
// See if anything changed
2009-10-12 00:10:08 +02:00
if ( sv = = showVideo & & sa = = showAudio ) return ;
showVideo = sv ;
showAudio = sa ;
2007-01-23 05:42:08 +01:00
2010-06-29 00:15:40 +02:00
bool didFreeze = ! IsFrozen ( ) ;
if ( didFreeze ) Freeze ( ) ;
2007-04-13 03:46:50 +02:00
VideoContext : : Get ( ) - > Stop ( ) ;
2007-01-23 05:42:08 +01:00
// Set display
TopSizer - > Show ( videoBox , showVideo , true ) ;
ToolSizer - > Show ( audioBox , showAudio , true ) ;
2006-01-16 22:02:54 +01:00
// Update
UpdateToolbar ( ) ;
2006-07-11 03:58:53 +02:00
MainSizer - > CalcMin ( ) ;
MainSizer - > RecalcSizes ( ) ;
2006-01-16 22:02:54 +01:00
MainSizer - > Layout ( ) ;
2006-05-05 20:52:09 +02:00
Layout ( ) ;
2009-11-17 02:37:18 +01:00
if ( showVideo ) VideoContext : : Get ( ) - > UpdateDisplays ( true ) ;
2010-06-29 00:15:40 +02:00
if ( didFreeze ) Thaw ( ) ;
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 Update title bar
2006-01-16 22:02:54 +01:00
void FrameMain : : UpdateTitle ( ) {
// Determine if current subs are modified
2010-07-09 09:31:48 +02:00
bool subsMod = ass - > IsModified ( ) ;
2006-01-16 22:02:54 +01:00
// Create ideal title
wxString newTitle = _T ( " " ) ;
2007-09-22 05:07:16 +02:00
# ifndef __WXMAC__
2006-01-16 22:02:54 +01:00
if ( subsMod ) newTitle < < _T ( " * " ) ;
2010-07-09 09:31:48 +02:00
if ( ass - > filename ! = _T ( " " ) ) {
wxFileName file ( ass - > filename ) ;
2006-01-16 22:02:54 +01:00
newTitle < < file . GetFullName ( ) ;
}
2009-11-04 06:27:09 +01:00
else newTitle < < _ ( " Untitled " ) ;
2006-05-07 14:38:33 +02:00
newTitle < < _T ( " - Aegisub " ) < < GetAegisubLongVersionString ( ) ;
2007-09-22 05:49:18 +02:00
# else
// Apple HIG says "untitled" should not be capitalised
// and the window is a document window, it shouldn't contain the app name
// (The app name is already present in the menu bar)
2010-07-09 09:31:48 +02:00
if ( ass - > filename ! = _T ( " " ) ) {
wxFileName file ( ass - > filename ) ;
2007-09-22 05:49:18 +02:00
newTitle < < file . GetFullName ( ) ;
}
2009-11-04 06:27:09 +01:00
else newTitle < < _ ( " untitled " ) ;
2007-09-22 05:49:18 +02:00
# endif
2009-08-01 04:00:30 +02:00
2007-09-22 05:07:16 +02:00
# ifdef __WXMAC__
// On Mac, set the mark in the close button
2010-08-13 02:33:54 +02:00
OSXSetModified ( subsMod ) ;
2007-09-22 05:07:16 +02:00
# endif
2006-01-16 22:02:54 +01:00
// Get current title
wxString curTitle = GetTitle ( ) ;
if ( curTitle ! = newTitle ) SetTitle ( newTitle ) ;
}
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 Updates subs with video/whatever data
/// @param fromSubs
2006-01-16 22:02:54 +01:00
void FrameMain : : SynchronizeProject ( bool fromSubs ) {
// Retrieve data from subs
if ( fromSubs ) {
// Reset the state
long videoPos = 0 ;
long videoAr = 0 ;
2006-05-16 01:44:53 +02:00
double videoArValue = 0.0 ;
2010-05-01 03:07:05 +02:00
double videoZoom = 0. ;
2006-01-16 22:02:54 +01:00
2006-05-16 01:44:53 +02:00
// Get AR
2010-07-09 09:31:48 +02:00
wxString arString = ass - > GetScriptInfo ( _T ( " Video Aspect Ratio " ) ) ;
2006-05-16 01:44:53 +02:00
if ( arString . Left ( 1 ) = = _T ( " c " ) ) {
videoAr = 4 ;
arString = arString . Mid ( 1 ) ;
arString . ToDouble ( & videoArValue ) ;
}
else if ( arString . IsNumber ( ) ) arString . ToLong ( & videoAr ) ;
2006-01-16 22:02:54 +01:00
// Get new state info
2010-07-09 09:31:48 +02:00
ass - > GetScriptInfo ( _T ( " Video Position " ) ) . ToLong ( & videoPos ) ;
ass - > GetScriptInfo ( _T ( " Video Zoom Percent " ) ) . ToDouble ( & videoZoom ) ;
wxString curassVideo = DecodeRelativePath ( ass - > GetScriptInfo ( _T ( " Video File " ) ) , ass - > filename ) ;
wxString curassVFR = DecodeRelativePath ( ass - > GetScriptInfo ( _T ( " VFR File " ) ) , ass - > filename ) ;
wxString curassKeyframes = DecodeRelativePath ( ass - > GetScriptInfo ( _T ( " Keyframes File " ) ) , ass - > filename ) ;
wxString curassAudio = DecodeRelativePath ( ass - > GetScriptInfo ( _T ( " Audio File " ) ) , ass - > filename ) ;
wxString AutoScriptString = ass - > GetScriptInfo ( _T ( " Automation Scripts " ) ) ;
2006-01-16 22:02:54 +01:00
// Check if there is anything to change
2010-05-21 03:13:36 +02:00
int autoLoadMode = OPT_GET ( " App/Auto/Load Linked Files " ) - > GetInt ( ) ;
2006-01-16 22:02:54 +01:00
bool hasToLoad = false ;
2010-07-09 09:31:48 +02:00
if ( curassAudio ! = audioBox - > audioName | |
curassVFR ! = VideoContext : : Get ( ) - > GetTimecodesName ( ) | |
curassVideo ! = VideoContext : : Get ( ) - > videoName | |
curassKeyframes ! = VideoContext : : Get ( ) - > GetKeyFramesName ( )
2007-12-31 07:46:22 +01:00
# ifdef WITH_AUTOMATION
| | ! AutoScriptString . IsEmpty ( ) | | local_scripts - > GetScripts ( ) . size ( ) > 0
# endif
) {
2006-01-16 22:02:54 +01:00
hasToLoad = true ;
}
// Decide whether to load or not
bool doLoad = false ;
if ( hasToLoad ) {
if ( autoLoadMode = = 1 ) doLoad = true ;
else if ( autoLoadMode = = 2 ) {
int result = wxMessageBox ( _ ( " Do you want to load/unload the associated files? " ) , _ ( " (Un)Load files? " ) , wxYES_NO ) ;
if ( result = = wxYES ) doLoad = true ;
}
}
if ( doLoad ) {
// Video
2010-07-09 09:31:48 +02:00
if ( curassVideo ! = VideoContext : : Get ( ) - > videoName ) {
LoadVideo ( curassVideo ) ;
2007-04-17 03:19:04 +02:00
if ( VideoContext : : Get ( ) - > IsLoaded ( ) ) {
VideoContext : : Get ( ) - > SetAspectRatio ( videoAr , videoArValue ) ;
2010-05-01 03:07:05 +02:00
videoBox - > videoDisplay - > SetZoom ( videoZoom ) ;
2007-04-17 03:19:04 +02:00
VideoContext : : Get ( ) - > JumpToFrame ( videoPos ) ;
2006-01-16 22:02:54 +01:00
}
}
2010-07-09 09:31:48 +02:00
VideoContext : : Get ( ) - > LoadTimecodes ( curassVFR ) ;
VideoContext : : Get ( ) - > LoadKeyframes ( curassKeyframes ) ;
2006-12-18 19:47:45 +01:00
2006-01-16 22:02:54 +01:00
// Audio
2010-07-09 09:31:48 +02:00
if ( curassAudio ! = audioBox - > audioName ) {
if ( curassAudio = = _T ( " ?video " ) ) LoadAudio ( _T ( " " ) , true ) ;
else LoadAudio ( curassAudio ) ;
2006-01-16 22:02:54 +01:00
}
2006-12-28 23:31:33 +01:00
// Automation scripts
2007-12-31 07:46:22 +01:00
# ifdef WITH_AUTOMATION
2006-12-28 23:31:33 +01:00
local_scripts - > RemoveAll ( ) ;
wxStringTokenizer tok ( AutoScriptString , _T ( " | " ) , wxTOKEN_STRTOK ) ;
2010-07-09 09:31:48 +02:00
wxFileName assfn ( ass - > filename ) ;
2010-05-21 03:13:36 +02:00
wxString autobasefn ( lagi_wxString ( OPT_GET ( " Path/Automation/Base " ) - > GetString ( ) ) ) ;
2006-12-28 23:31:33 +01:00
while ( tok . HasMoreTokens ( ) ) {
wxString sfnames = tok . GetNextToken ( ) . Trim ( true ) . Trim ( false ) ;
wxString sfnamel = sfnames . Left ( 1 ) ;
sfnames . Remove ( 0 , 1 ) ;
wxString basepath ;
if ( sfnamel = = _T ( " ~ " ) ) {
2010-07-09 09:31:48 +02:00
basepath = assfn . GetPath ( ) ;
2006-12-28 23:31:33 +01:00
} else if ( sfnamel = = _T ( " $ " ) ) {
basepath = autobasefn ;
} else if ( sfnamel = = _T ( " / " ) ) {
basepath = _T ( " " ) ;
} else {
wxLogWarning ( _T ( " Automation Script referenced with unknown location specifier character. \n Location specifier found: %s \n Filename specified: %s " ) ,
sfnamel . c_str ( ) , sfnames . c_str ( ) ) ;
continue ;
}
wxFileName sfname ( sfnames ) ;
sfname . MakeAbsolute ( basepath ) ;
if ( sfname . FileExists ( ) ) {
sfnames = sfname . GetFullPath ( ) ;
2007-06-10 03:49:11 +02:00
local_scripts - > Add ( Automation4 : : ScriptFactory : : CreateFromFile ( sfnames , true ) ) ;
2006-12-28 23:31:33 +01:00
} else {
wxLogWarning ( _T ( " Automation Script referenced could not be found. \n Filename specified: %s%s \n Searched relative to: %s \n Resolved filename: %s " ) ,
sfnamel . c_str ( ) , sfnames . c_str ( ) , basepath . c_str ( ) , sfname . GetFullPath ( ) . c_str ( ) ) ;
}
}
2007-12-31 07:46:22 +01:00
# endif
2006-01-16 22:02:54 +01:00
}
// Display
2009-10-12 00:10:08 +02:00
SetDisplayMode ( 1 , 1 ) ;
2006-01-16 22:02:54 +01:00
}
2010-07-09 09:31:48 +02:00
// Store data on ass
2006-01-16 22:02:54 +01:00
else {
// Setup
wxString seekpos = _T ( " 0 " ) ;
wxString ar = _T ( " 0 " ) ;
wxString zoom = _T ( " 6 " ) ;
2007-01-21 07:30:19 +01:00
if ( VideoContext : : Get ( ) - > IsLoaded ( ) ) {
2009-10-05 06:22:28 +02:00
seekpos = wxString : : Format ( _T ( " %i " ) , videoBox - > videoDisplay - > GetFrame ( ) ) ;
2010-05-01 03:07:05 +02:00
zoom = wxString : : Format ( _T ( " %f " ) , videoBox - > videoDisplay - > GetZoom ( ) ) ;
2006-05-16 01:44:53 +02:00
2007-01-23 07:32:16 +01:00
int arType = VideoContext : : Get ( ) - > GetAspectRatioType ( ) ;
2009-04-06 22:01:42 +02:00
if ( arType = = 4 ) ar = wxString ( _T ( " c " ) ) + AegiFloatToString ( VideoContext : : Get ( ) - > GetAspectRatioValue ( ) ) ;
2006-05-16 01:44:53 +02:00
else ar = wxString : : Format ( _T ( " %i " ) , arType ) ;
2006-01-16 22:02:54 +01:00
}
// Store audio data
2010-07-09 09:31:48 +02:00
ass - > SetScriptInfo ( _T ( " Audio File " ) , MakeRelativePath ( audioBox - > audioName , ass - > filename ) ) ;
2006-01-16 22:02:54 +01:00
// Store video data
2010-07-09 09:31:48 +02:00
ass - > SetScriptInfo ( _T ( " Video File " ) , MakeRelativePath ( VideoContext : : Get ( ) - > videoName , ass - > filename ) ) ;
ass - > SetScriptInfo ( _T ( " Video Aspect Ratio " ) , ar ) ;
ass - > SetScriptInfo ( _T ( " Video Zoom Percent " ) , zoom ) ;
ass - > SetScriptInfo ( _T ( " Video Position " ) , seekpos ) ;
ass - > SetScriptInfo ( _T ( " VFR File " ) , MakeRelativePath ( VideoContext : : Get ( ) - > GetTimecodesName ( ) , ass - > filename ) ) ;
ass - > SetScriptInfo ( _T ( " Keyframes File " ) , MakeRelativePath ( VideoContext : : Get ( ) - > GetKeyFramesName ( ) , ass - > filename ) ) ;
2006-01-16 22:02:54 +01:00
2006-12-28 23:31:33 +01:00
// Store Automation script data
// Algorithm:
// 1. If script filename has Automation Base Path as a prefix, the path is relative to that (ie. "$")
2010-07-09 09:31:48 +02:00
// 2. Otherwise try making it relative to the ass filename
// 3. If step 2 failed, or absolut path is shorter than path relative to ass, use absolute path ("/")
// 4. Otherwise, use path relative to ass ("~")
2007-12-31 07:46:22 +01:00
# ifdef WITH_AUTOMATION
2006-12-28 23:31:33 +01:00
wxString scripts_string ;
2010-05-21 03:13:36 +02:00
wxString autobasefn ( lagi_wxString ( OPT_GET ( " Path/Automation/Base " ) - > GetString ( ) ) ) ;
2006-12-28 23:31:33 +01:00
const std : : vector < Automation4 : : Script * > & scripts = local_scripts - > GetScripts ( ) ;
2006-12-28 23:41:20 +01:00
for ( unsigned int i = 0 ; i < scripts . size ( ) ; i + + ) {
2006-12-28 23:31:33 +01:00
Automation4 : : Script * script = scripts [ i ] ;
if ( i ! = 0 )
scripts_string + = _T ( " | " ) ;
2010-07-09 09:31:48 +02:00
wxString autobase_rel , assfile_rel ;
2006-12-28 23:31:33 +01:00
wxString scriptfn ( script - > GetFilename ( ) ) ;
autobase_rel = MakeRelativePath ( scriptfn , autobasefn ) ;
2010-07-09 09:31:48 +02:00
assfile_rel = MakeRelativePath ( scriptfn , ass - > filename ) ;
2006-12-28 23:31:33 +01:00
2010-07-09 09:31:48 +02:00
if ( autobase_rel . size ( ) < = scriptfn . size ( ) & & autobase_rel . size ( ) < = assfile_rel . size ( ) ) {
2006-12-28 23:31:33 +01:00
scriptfn = _T ( " $ " ) + autobase_rel ;
2010-07-09 09:31:48 +02:00
} else if ( assfile_rel . size ( ) < = scriptfn . size ( ) & & assfile_rel . size ( ) < = autobase_rel . size ( ) ) {
scriptfn = _T ( " ~ " ) + assfile_rel ;
2006-12-28 23:31:33 +01:00
} else {
scriptfn = _T ( " / " ) + wxFileName ( scriptfn ) . GetFullPath ( wxPATH_UNIX ) ;
2006-01-16 22:02:54 +01:00
}
2006-12-28 23:31:33 +01:00
scripts_string + = scriptfn ;
2006-01-16 22:02:54 +01:00
}
2010-07-09 09:31:48 +02:00
ass - > SetScriptInfo ( _T ( " Automation Scripts " ) , scripts_string ) ;
2007-12-31 07:46:22 +01: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 Loads video
/// @param file
/// @param autoload
2006-01-16 22:02:54 +01:00
void FrameMain : : LoadVideo ( wxString file , bool autoload ) {
if ( blockVideoLoad ) return ;
2008-01-12 04:09:48 +01:00
Freeze ( ) ;
2006-01-16 22:02:54 +01:00
try {
2007-01-21 07:30:19 +01:00
VideoContext : : Get ( ) - > SetVideo ( file ) ;
2006-01-16 22:02:54 +01:00
}
2006-04-14 18:46:38 +02:00
catch ( const wchar_t * error ) {
2010-07-08 06:29:04 +02:00
wxMessageBox ( error , _T ( " Error opening video file " ) , wxOK | wxICON_ERROR , this ) ;
2006-01-16 22:02:54 +01:00
}
catch ( . . . ) {
wxMessageBox ( _T ( " Unknown error " ) , _T ( " Error opening video file " ) , wxOK | wxICON_ERROR , this ) ;
}
2007-01-21 07:30:19 +01:00
if ( VideoContext : : Get ( ) - > IsLoaded ( ) ) {
2009-12-12 02:38:09 +01:00
int vidx = VideoContext : : Get ( ) - > GetWidth ( ) , vidy = VideoContext : : Get ( ) - > GetHeight ( ) ;
// Set zoom level based on video resolution and window size
2010-08-13 07:51:26 +02:00
double zoom = videoBox - > videoDisplay - > GetZoom ( ) ;
2009-12-12 02:38:09 +01:00
wxSize windowSize = GetSize ( ) ;
2010-08-13 07:51:26 +02:00
if ( vidx * 3 * zoom > windowSize . GetX ( ) * 4 | | vidy * 4 * zoom > windowSize . GetY ( ) * 6 )
videoBox - > videoDisplay - > SetZoom ( zoom * .25 ) ;
else if ( vidx * 3 * zoom > windowSize . GetX ( ) * 2 | | vidy * 4 * zoom > windowSize . GetY ( ) * 3 )
videoBox - > videoDisplay - > SetZoom ( zoom * .5 ) ;
2009-12-12 02:38:09 +01:00
// Check that the video size matches the script video size specified
2010-06-16 08:20:33 +02:00
int scriptx = SubsGrid - > ass - > GetScriptInfoAsInt ( _T ( " PlayResX " ) ) ;
int scripty = SubsGrid - > ass - > GetScriptInfoAsInt ( _T ( " PlayResY " ) ) ;
2006-01-16 22:02:54 +01:00
if ( scriptx ! = vidx | | scripty ! = vidy ) {
2010-05-21 03:13:36 +02:00
switch ( OPT_GET ( " Video/Check Script Res " ) - > GetInt ( ) ) {
2006-01-16 22:02:54 +01:00
case 1 :
// Ask to change on mismatch
if ( wxMessageBox ( wxString : : Format ( _ ( " The resolution of the loaded video and the resolution specified for the subtitles don't match. \n \n Video resolution: \t %d x %d \n Script resolution: \t %d x %d \n \n Change subtitles resolution to match video? " ) , vidx , vidy , scriptx , scripty ) , _ ( " Resolution mismatch " ) , wxYES_NO , this ) ! = wxYES )
break ;
// Fallthrough to case 2
case 2 :
// Always change script res
2010-06-16 08:20:33 +02:00
SubsGrid - > ass - > SetScriptInfo ( _T ( " PlayResX " ) , wxString : : Format ( _T ( " %d " ) , vidx ) ) ;
SubsGrid - > ass - > SetScriptInfo ( _T ( " PlayResY " ) , wxString : : Format ( _T ( " %d " ) , vidy ) ) ;
2010-07-09 09:31:34 +02:00
SubsGrid - > ass - > Commit ( _ ( " Change script resolution " ) ) ;
2010-06-16 08:20:33 +02:00
SubsGrid - > CommitChanges ( ) ;
2006-01-16 22:02:54 +01:00
break ;
case 0 :
default :
// Never change
break ;
}
}
}
2010-07-20 05:11:11 +02:00
SubsGrid - > CommitChanges ( ) ;
2009-10-12 00:10:08 +02:00
SetDisplayMode ( 1 , - 1 ) ;
2006-01-16 22:02:54 +01:00
EditBox - > UpdateFrameTiming ( ) ;
2008-01-12 04:09:48 +01:00
2010-05-21 03:13:36 +02:00
DetachVideo ( VideoContext : : Get ( ) - > IsLoaded ( ) & & OPT_GET ( " Video/Detached/Enabled " ) - > GetBool ( ) ) ;
2008-01-12 04:09:48 +01:00
Thaw ( ) ;
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 Loads audio
/// @param filename
/// @param FromVideo
2006-01-16 22:02:54 +01:00
void FrameMain : : LoadAudio ( wxString filename , bool FromVideo ) {
if ( blockAudioLoad ) return ;
2007-01-21 07:30:19 +01:00
VideoContext : : Get ( ) - > Stop ( ) ;
2006-01-16 22:02:54 +01:00
try {
audioBox - > SetFile ( filename , FromVideo ) ;
2009-10-12 00:10:08 +02:00
SetDisplayMode ( - 1 , 1 ) ;
2006-01-16 22:02:54 +01:00
}
2006-04-14 18:46:38 +02:00
catch ( const wchar_t * error ) {
2006-01-16 22:02:54 +01:00
wxString err ( error ) ;
wxMessageBox ( err , _T ( " Error opening audio file " ) , wxOK | wxICON_ERROR , this ) ;
}
2008-01-22 03:54:16 +01:00
# ifdef WITH_AVISYNTH
2006-01-16 22:02:54 +01:00
catch ( AvisynthError err ) {
wxMessageBox ( wxString ( _T ( " AviSynth error: " ) ) + wxString ( err . msg , wxConvUTF8 ) , _T ( " Error loading audio " ) , wxOK | wxICON_ERROR ) ;
return ;
}
2006-02-23 05:19:57 +01:00
# endif
2006-01-16 22:02:54 +01:00
catch ( . . . ) {
wxMessageBox ( _T ( " Unknown error " ) , _T ( " Error opening audio file " ) , wxOK | wxICON_ERROR , this ) ;
}
}
void FrameMain : : LoadVFR ( wxString filename ) {
2010-07-08 06:29:04 +02:00
if ( filename . empty ( ) ) {
VideoContext : : Get ( ) - > CloseTimecodes ( ) ;
2006-01-16 22:02:54 +01:00
}
else {
2010-07-08 06:29:04 +02:00
VideoContext : : Get ( ) - > LoadTimecodes ( filename ) ;
2006-01-16 22:02:54 +01:00
}
2010-06-16 08:20:33 +02:00
SubsGrid - > CommitChanges ( ) ;
2006-01-16 22:02:54 +01:00
EditBox - > UpdateFrameTiming ( ) ;
}
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 help
2010-06-16 08:20:27 +02:00
void FrameMain : : OpenHelp ( wxString ) {
2008-01-13 22:05:31 +01:00
HelpButton : : OpenPage ( _T ( " Main " ) ) ;
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 Detach video window
/// @param detach
2008-01-12 04:09:48 +01:00
void FrameMain : : DetachVideo ( bool detach ) {
if ( detach ) {
if ( ! detachedVideo ) {
2009-06-06 04:57:42 +02:00
detachedVideo = new DialogDetachedVideo ( this , videoBox - > videoDisplay - > GetClientSize ( ) ) ;
2008-01-12 04:09:48 +01:00
detachedVideo - > Show ( ) ;
2009-11-17 02:37:18 +01:00
VideoContext : : Get ( ) - > UpdateDisplays ( true ) ;
2008-01-12 04:09:48 +01:00
}
}
2009-10-12 00:10:08 +02:00
else if ( detachedVideo ) {
detachedVideo - > Destroy ( ) ;
detachedVideo = NULL ;
SetDisplayMode ( 1 , - 1 ) ;
2008-01-12 04:09:48 +01:00
}
2009-10-10 17:21:26 +02:00
UpdateToolbar ( ) ;
2008-01-12 04:09:48 +01:00
}
2010-06-16 08:20:27 +02:00
/// @brief Sets status and clear after n milliseconds
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
/// @param text
/// @param ms
2006-01-16 22:02:54 +01:00
void FrameMain : : StatusTimeout ( wxString text , int ms ) {
SetStatusText ( text , 1 ) ;
StatusClear . SetOwner ( this , StatusClear_Timer ) ;
StatusClear . Start ( ms , 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 Setup accelerator table
2006-01-16 22:02:54 +01:00
void FrameMain : : SetAccelerators ( ) {
2007-07-27 06:05:18 +02:00
std : : vector < wxAcceleratorEntry > entry ;
2007-08-04 11:23:21 +02:00
entry . reserve ( 32 ) ;
2006-12-30 23:08:23 +01:00
// Standard
2007-07-27 06:05:18 +02:00
entry . push_back ( Hotkeys . GetAccelerator ( _T ( " Video global prev frame " ) , Video_Prev_Frame ) ) ;
entry . push_back ( Hotkeys . GetAccelerator ( _T ( " Video global next frame " ) , Video_Next_Frame ) ) ;
entry . push_back ( Hotkeys . GetAccelerator ( _T ( " Video global focus seek " ) , Video_Focus_Seek ) ) ;
entry . push_back ( Hotkeys . GetAccelerator ( _T ( " Grid global prev line " ) , Grid_Prev_Line ) ) ;
entry . push_back ( Hotkeys . GetAccelerator ( _T ( " Grid global next line " ) , Grid_Next_Line ) ) ;
entry . push_back ( Hotkeys . GetAccelerator ( _T ( " Save Subtitles Alt " ) , Menu_File_Save_Subtitles ) ) ;
entry . push_back ( Hotkeys . GetAccelerator ( _T ( " Video global zoom in " ) , Menu_Video_Zoom_In ) ) ;
entry . push_back ( Hotkeys . GetAccelerator ( _T ( " Video global zoom out " ) , Menu_Video_Zoom_Out ) ) ;
entry . push_back ( Hotkeys . GetAccelerator ( _T ( " Video global play " ) , Video_Frame_Play ) ) ;
2006-12-30 23:08:23 +01:00
// Medusa
2010-05-21 03:13:36 +02:00
bool medusaPlay = OPT_GET ( " Audio/Medusa Timing Hotkeys " ) - > GetBool ( ) ;
2006-12-30 23:08:23 +01:00
if ( medusaPlay & & audioBox - > audioDisplay - > loaded ) {
2007-07-27 06:05:18 +02:00
entry . push_back ( Hotkeys . GetAccelerator ( _T ( " Audio Medusa Play " ) , Medusa_Play ) ) ;
entry . push_back ( Hotkeys . GetAccelerator ( _T ( " Audio Medusa Stop " ) , Medusa_Stop ) ) ;
entry . push_back ( Hotkeys . GetAccelerator ( _T ( " Audio Medusa Play Before " ) , Medusa_Play_Before ) ) ;
entry . push_back ( Hotkeys . GetAccelerator ( _T ( " Audio Medusa Play After " ) , Medusa_Play_After ) ) ;
entry . push_back ( Hotkeys . GetAccelerator ( _T ( " Audio Medusa Next " ) , Medusa_Next ) ) ;
entry . push_back ( Hotkeys . GetAccelerator ( _T ( " Audio Medusa Previous " ) , Medusa_Prev ) ) ;
entry . push_back ( Hotkeys . GetAccelerator ( _T ( " Audio Medusa Shift Start Forward " ) , Medusa_Shift_Start_Forward ) ) ;
entry . push_back ( Hotkeys . GetAccelerator ( _T ( " Audio Medusa Shift Start Back " ) , Medusa_Shift_Start_Back ) ) ;
entry . push_back ( Hotkeys . GetAccelerator ( _T ( " Audio Medusa Shift End Forward " ) , Medusa_Shift_End_Forward ) ) ;
entry . push_back ( Hotkeys . GetAccelerator ( _T ( " Audio Medusa Shift End Back " ) , Medusa_Shift_End_Back ) ) ;
2007-07-27 10:24:49 +02:00
entry . push_back ( Hotkeys . GetAccelerator ( _T ( " Audio Medusa Enter " ) , Medusa_Enter ) ) ;
2006-12-30 23:08:23 +01:00
}
// Set table
2007-07-27 06:05:18 +02:00
wxAcceleratorTable table ( entry . size ( ) , & entry [ 0 ] ) ;
2006-01-16 22:02:54 +01:00
SetAcceleratorTable ( 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 Load list of files
/// @param list
/// @return
2006-01-16 22:02:54 +01:00
bool FrameMain : : LoadList ( wxArrayString list ) {
// Build list
wxArrayString List ;
for ( size_t i = 0 ; i < list . Count ( ) ; i + + ) {
wxFileName file ( list [ i ] ) ;
if ( file . IsRelative ( ) ) file . MakeAbsolute ( ) ;
if ( file . FileExists ( ) ) List . Add ( file . GetFullPath ( ) ) ;
}
// Video formats
wxArrayString videoList ;
videoList . Add ( _T ( " avi " ) ) ;
videoList . Add ( _T ( " mkv " ) ) ;
videoList . Add ( _T ( " mp4 " ) ) ;
videoList . Add ( _T ( " d2v " ) ) ;
videoList . Add ( _T ( " mpg " ) ) ;
videoList . Add ( _T ( " mpeg " ) ) ;
videoList . Add ( _T ( " ogm " ) ) ;
videoList . Add ( _T ( " avs " ) ) ;
videoList . Add ( _T ( " wmv " ) ) ;
videoList . Add ( _T ( " asf " ) ) ;
videoList . Add ( _T ( " mov " ) ) ;
videoList . Add ( _T ( " rm " ) ) ;
2009-07-19 06:13:46 +02:00
videoList . Add ( _T ( " y4m " ) ) ;
videoList . Add ( _T ( " yuv " ) ) ;
2006-01-16 22:02:54 +01:00
// Subtitle formats
wxArrayString subsList ;
subsList . Add ( _T ( " ass " ) ) ;
subsList . Add ( _T ( " ssa " ) ) ;
subsList . Add ( _T ( " srt " ) ) ;
2007-06-19 06:04:46 +02:00
subsList . Add ( _T ( " sub " ) ) ;
2006-01-16 22:02:54 +01:00
subsList . Add ( _T ( " txt " ) ) ;
2007-06-19 06:04:46 +02:00
subsList . Add ( _T ( " ttxt " ) ) ;
2006-01-16 22:02:54 +01:00
// Audio formats
wxArrayString audioList ;
audioList . Add ( _T ( " wav " ) ) ;
audioList . Add ( _T ( " mp3 " ) ) ;
audioList . Add ( _T ( " ogg " ) ) ;
audioList . Add ( _T ( " wma " ) ) ;
audioList . Add ( _T ( " ac3 " ) ) ;
audioList . Add ( _T ( " aac " ) ) ;
audioList . Add ( _T ( " mpc " ) ) ;
audioList . Add ( _T ( " ape " ) ) ;
audioList . Add ( _T ( " flac " ) ) ;
audioList . Add ( _T ( " mka " ) ) ;
2007-06-19 06:04:46 +02:00
audioList . Add ( _T ( " m4a " ) ) ;
2006-01-16 22:02:54 +01:00
// Scan list
wxString audio = _T ( " " ) ;
wxString video = _T ( " " ) ;
wxString subs = _T ( " " ) ;
wxString ext ;
for ( size_t i = 0 ; i < List . Count ( ) ; i + + ) {
wxFileName file ( List [ i ] ) ;
ext = file . GetExt ( ) . Lower ( ) ;
2006-02-20 22:32:58 +01:00
if ( subs . IsEmpty ( ) & & subsList . Index ( ext ) ! = wxNOT_FOUND ) subs = List [ i ] ;
if ( video . IsEmpty ( ) & & videoList . Index ( ext ) ! = wxNOT_FOUND ) video = List [ i ] ;
if ( audio . IsEmpty ( ) & & audioList . Index ( ext ) ! = wxNOT_FOUND ) audio = List [ i ] ;
2006-01-16 22:02:54 +01:00
}
// Set blocking
blockAudioLoad = ( audio ! = _T ( " " ) ) ;
blockVideoLoad = ( video ! = _T ( " " ) ) ;
// Load files
2006-02-01 03:16:57 +01:00
if ( subs ! = _T ( " " ) ) {
LoadSubtitles ( subs ) ;
}
2006-01-16 22:02:54 +01:00
if ( blockVideoLoad ) {
blockVideoLoad = false ;
LoadVideo ( video ) ;
}
if ( blockAudioLoad ) {
blockAudioLoad = false ;
LoadAudio ( audio ) ;
}
// Result
return ( ( subs ! = _T ( " " ) ) | | ( audio ! = _T ( " " ) ) | | ( video ! = _T ( " " ) ) ) ;
}
2007-01-26 01:47:42 +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 Sets the descriptions for undo/redo
2007-01-26 01:47:42 +01:00
void FrameMain : : SetUndoRedoDesc ( ) {
2010-07-09 09:31:48 +02:00
editMenu - > SetHelpString ( 0 , _T ( " Undo " ) + ass - > GetUndoDescription ( ) ) ;
editMenu - > SetHelpString ( 1 , _T ( " Redo " ) + ass - > GetRedoDescription ( ) ) ;
2007-04-03 06:34:56 +02:00
}
2008-01-20 18:34: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 Check if ASSDraw is available
2008-01-20 18:34:35 +01:00
bool FrameMain : : HasASSDraw ( ) {
# ifdef __WINDOWS__
wxFileName fn ( StandardPaths : : DecodePath ( _T ( " ?data/ASSDraw3.exe " ) ) ) ;
return fn . FileExists ( ) ;
# else
return false ;
# endif
}
2010-08-26 20:38:44 +02:00
static void autosave_timer_changed ( wxTimer & timer , const agi : : OptionValue & opt ) {
int freq = opt . GetInt ( ) ;
if ( freq < = 0 ) {
timer . Stop ( ) ;
}
else {
timer . Start ( freq * 1000 ) ;
}
}