2006-01-16 22:02:54 +01:00
// Copyright (c) 2005, Rodrigo Braz Monteiro
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// * Neither the name of the Aegisub Group nor the names of its contributors
// may be used to endorse or promote products derived from this software
// without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
2009-07-29 07:43:02 +02:00
// Aegisub Project http://www.aegisub.org/
2006-01-16 22:02:54 +01:00
//
2009-07-29 07:43:02 +02:00
// $Id$
/// @file dialog_styling_assistant.cpp
/// @brief Styling Assistant dialogue box and logic
/// @ingroup tools_ui
///
2006-01-16 22:02:54 +01:00
///////////
// Headers
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/recguard.h>
2009-09-10 15:06:40 +02:00
# endif
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
# include "aegisub/hotkey.h"
2009-09-10 15:06:40 +02:00
# include "ass_dialogue.h"
2006-01-16 22:02:54 +01:00
# include "ass_file.h"
# include "ass_style.h"
2010-12-08 04:36:10 +01:00
# include "selection_controller.h"
# include "audio_controller.h"
2006-01-16 22:02:54 +01:00
# include "audio_box.h"
2009-09-10 15:06:40 +02:00
# include "dialog_styling_assistant.h"
# include "frame_main.h"
2008-01-13 22:05:31 +01:00
# include "help_button.h"
2009-07-24 02:08:25 +02:00
# include "libresrc/libresrc.h"
2009-09-10 15:06:40 +02:00
# include "subs_edit_box.h"
# include "subs_grid.h"
# include "utils.h"
# include "video_context.h"
# include "video_display.h"
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 Constructor
/// @param parent
/// @param _grid
///
2006-01-16 22:02:54 +01:00
DialogStyling : : DialogStyling ( wxWindow * parent , SubtitlesGrid * _grid ) :
2009-05-14 09:02:01 +02:00
wxDialog ( parent , - 1 , _ ( " Styling assistant " ) , wxDefaultPosition , wxDefaultSize , wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER | wxMINIMIZE_BOX )
2006-01-16 22:02:54 +01:00
{
2007-07-05 01:09:40 +02:00
// Set icon
2009-07-25 06:49:59 +02:00
SetIcon ( BitmapToIcon ( GETIMAGE ( styling_toolbutton_24 ) ) ) ;
2007-07-05 01:09:40 +02:00
2006-01-16 22:02:54 +01:00
// Variables
grid = _grid ;
2010-12-08 04:36:10 +01:00
audio = VideoContext : : Get ( ) - > audio ;
video = VideoContext : : Get ( ) ;
2006-01-16 22:02:54 +01:00
needCommit = false ;
linen = - 1 ;
// Top sizer
wxSizer * TopSizer = new wxStaticBoxSizer ( wxHORIZONTAL , this , _ ( " Current line " ) ) ;
CurLine = new wxTextCtrl ( this , - 1 , _ ( " Current line " ) , wxDefaultPosition , wxSize ( 300 , 60 ) , wxTE_MULTILINE | wxTE_READONLY ) ;
TopSizer - > Add ( CurLine , 1 , wxEXPAND , 0 ) ;
// Left sizer
Styles = new wxListBox ( this , STYLE_LIST , wxDefaultPosition , wxSize ( 150 , 180 ) , grid - > ass - > GetStyles ( ) ) ;
wxSizer * LeftSizer = new wxStaticBoxSizer ( wxVERTICAL , this , _ ( " Styles available " ) ) ;
LeftSizer - > Add ( Styles , 1 , wxEXPAND , 0 ) ;
// Right sizer
wxSizer * RightSizer = new wxBoxSizer ( wxVERTICAL ) ;
wxSizer * RightTop = new wxStaticBoxSizer ( wxHORIZONTAL , this , _ ( " Set style " ) ) ;
2008-05-09 06:27:10 +02:00
wxSizer * RightMiddle = new wxStaticBoxSizer ( wxVERTICAL , this , _ ( " Keys " ) ) ;
wxSizer * RightBottom = new wxStaticBoxSizer ( wxHORIZONTAL , this , _ ( " Actions " ) ) ;
2006-01-16 22:02:54 +01:00
TypeBox = new StyleEditBox ( this ) ;
RightTop - > Add ( TypeBox , 1 , wxEXPAND ) ;
// Shortcuts
//wxStaticText *Keys = new wxStaticText(this,-1,_("Enter:\t\tAccept changes\nPage up:\tPrevious line\nPage down:\tNext line\nEnd:\t\tPlay sound\nClick on list:\tSet style\nCtrl+enter:\tAccept without going to next"));
wxSizer * KeysInnerSizer = new wxGridSizer ( 2 , 0 , 5 ) ;
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
//H KeysInnerSizer->Add(new wxStaticText(this,-1,Hotkeys.GetText(_T("Styling Assistant Accept")) + _T(": ")));
2006-01-16 22:02:54 +01:00
KeysInnerSizer - > Add ( new wxStaticText ( this , - 1 , _ ( " Accept changes " ) ) ) ;
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
//H KeysInnerSizer->Add(new wxStaticText(this,-1,Hotkeys.GetText(_T("Styling Assistant Preview")) + _T(": ")));
2006-01-16 22:02:54 +01:00
KeysInnerSizer - > Add ( new wxStaticText ( this , - 1 , _ ( " Preview changes " ) ) ) ;
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
//H KeysInnerSizer->Add(new wxStaticText(this,-1,Hotkeys.GetText(_T("Styling Assistant Prev")) + _T(": ")));
2006-01-16 22:02:54 +01:00
KeysInnerSizer - > Add ( new wxStaticText ( this , - 1 , _ ( " Previous line " ) ) ) ;
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
//H KeysInnerSizer->Add(new wxStaticText(this,-1,Hotkeys.GetText(_T("Styling Assistant Next")) + _T(": ")));
2006-01-16 22:02:54 +01:00
KeysInnerSizer - > Add ( new wxStaticText ( this , - 1 , _ ( " Next line " ) ) ) ;
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
//H KeysInnerSizer->Add(new wxStaticText(this,-1,Hotkeys.GetText(_T("Styling Assistant Play Video")) + _T(": ")));
2008-05-09 06:27:10 +02:00
KeysInnerSizer - > Add ( new wxStaticText ( this , - 1 , _ ( " Play Video " ) ) ) ;
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
//H KeysInnerSizer->Add(new wxStaticText(this,-1,Hotkeys.GetText(_T("Styling Assistant Play Audio")) + _T(": ")));
2006-01-16 22:02:54 +01:00
KeysInnerSizer - > Add ( new wxStaticText ( this , - 1 , _ ( " Play Audio " ) ) ) ;
KeysInnerSizer - > Add ( new wxStaticText ( this , - 1 , _ ( " Click on list: " ) ) ) ;
KeysInnerSizer - > Add ( new wxStaticText ( this , - 1 , _ ( " Select style " ) ) ) ;
2008-05-09 06:27:10 +02:00
// Right Middle
2006-01-16 22:02:54 +01:00
PreviewCheck = new wxCheckBox ( this , - 1 , _ ( " Enable preview (slow) " ) ) ;
PreviewCheck - > SetValue ( true ) ;
2008-05-09 06:27:10 +02:00
RightMiddle - > Add ( KeysInnerSizer , 0 , wxEXPAND | wxBOTTOM , 5 ) ;
RightMiddle - > Add ( PreviewCheck , 0 , 0 , 0 ) ;
RightMiddle - > AddStretchSpacer ( 1 ) ;
// Rest of right sizer
2009-05-14 09:02:01 +02:00
PlayVideoButton = new wxButton ( this , BUTTON_PLAY_VIDEO , _ ( " Play Video " ) ) ;
PlayAudioButton = new wxButton ( this , BUTTON_PLAY_AUDIO , _ ( " Play Audio " ) ) ;
2006-01-16 22:02:54 +01:00
RightBottom - > AddStretchSpacer ( 1 ) ;
2008-05-09 06:27:10 +02:00
RightBottom - > Add ( PlayAudioButton , 0 , wxLEFT | wxRIGHT | wxBOTTOM , 5 ) ;
RightBottom - > Add ( PlayVideoButton , 0 , wxBOTTOM | wxRIGHT , 5 ) ;
RightBottom - > AddStretchSpacer ( 1 ) ;
2006-01-16 22:02:54 +01:00
RightSizer - > Add ( RightTop , 0 , wxEXPAND | wxBOTTOM , 5 ) ;
2008-05-09 06:27:10 +02:00
RightSizer - > Add ( RightMiddle , 0 , wxEXPAND | wxBOTTOM , 5 ) ;
RightSizer - > Add ( RightBottom , 0 , wxEXPAND , 5 ) ;
2006-01-16 22:02:54 +01:00
// Bottom sizer
wxSizer * BottomSizer = new wxBoxSizer ( wxHORIZONTAL ) ;
BottomSizer - > Add ( LeftSizer , 1 , wxEXPAND | wxRIGHT , 5 ) ;
BottomSizer - > Add ( RightSizer , 1 , wxEXPAND , 0 ) ;
// Button sizer
2008-01-13 22:27:06 +01:00
wxStdDialogButtonSizer * ButtonSizer = new wxStdDialogButtonSizer ( ) ;
2008-01-16 02:01:40 +01:00
ButtonSizer - > AddButton ( new wxButton ( this , wxID_CANCEL ) ) ;
2008-01-13 22:27:06 +01:00
ButtonSizer - > AddButton ( new HelpButton ( this , _T ( " Styling Assistant " ) ) ) ;
ButtonSizer - > Realize ( ) ;
2006-01-16 22:02:54 +01:00
// Main sizer
wxSizer * MainSizer = new wxBoxSizer ( wxVERTICAL ) ;
MainSizer - > Add ( TopSizer , 0 , wxEXPAND | wxALL , 5 ) ;
MainSizer - > Add ( BottomSizer , 1 , wxEXPAND | wxLEFT | wxBOTTOM | wxRIGHT , 5 ) ;
MainSizer - > Add ( ButtonSizer , 0 , wxEXPAND | wxBOTTOM | wxLEFT | wxRIGHT , 5 ) ;
MainSizer - > SetSizeHints ( this ) ;
SetSizer ( MainSizer ) ;
// Position window
if ( lastx = = - 1 & & lasty = = - 1 ) {
CenterOnParent ( ) ;
} else {
Move ( lastx , lasty ) ;
}
// h4x
origColour = TypeBox - > GetBackgroundColour ( ) ;
}
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 Destructor
///
2006-01-16 22:02:54 +01:00
DialogStyling : : ~ DialogStyling ( ) {
GetPosition ( & lastx , & lasty ) ;
if ( needCommit ) {
2010-12-07 20:09:28 +01:00
grid - > ass - > Commit ( _ ( " style changes " ) , AssFile : : COMMIT_TEXT ) ;
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 Jump to line
/// @param n
/// @return
///
2006-01-16 22:02:54 +01:00
void DialogStyling : : JumpToLine ( int n ) {
// Check stuff
if ( n = = - 1 ) return ;
// Get line
2006-02-19 04:10:03 +01:00
AssDialogue * nextLine = grid - > GetDialogue ( n ) ;
if ( ! nextLine ) return ;
line = nextLine ;
2006-01-16 22:02:54 +01:00
// Set number
linen = n ;
// Set text
CurLine - > SetValue ( line - > Text ) ;
// Set focus
TypeBox - > SetFocus ( ) ;
2009-05-14 09:02:01 +02:00
bool matched = false ;
for ( size_t i = 0 ; i < Styles - > GetCount ( ) ; i + + ) {
if ( TypeBox - > GetValue ( ) . IsSameAs ( Styles - > GetString ( i ) , true ) ) {
matched = true ;
break ;
}
}
if ( ! matched | | TypeBox - > GetValue ( ) . IsEmpty ( ) ) TypeBox - > SetValue ( Styles - > GetString ( 0 ) ) ;
2006-01-16 22:02:54 +01:00
TypeBox - > SetSelection ( 0 , TypeBox - > GetValue ( ) . Length ( ) ) ;
// Update grid
grid - > SelectRow ( linen , false ) ;
grid - > MakeCellVisible ( linen , 0 ) ;
2010-06-26 13:32:16 +02:00
grid - > SetActiveLine ( grid - > GetDialogue ( linen ) ) ;
2006-01-16 22:02:54 +01:00
// Update display
2010-06-16 08:19:49 +02:00
if ( PreviewCheck - > IsChecked ( ) ) VideoContext : : Get ( ) - > JumpToTime ( line - > Start . GetMS ( ) ) ;
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 Set style of current line
/// @param curName
/// @param jump
///
2006-01-16 22:02:54 +01:00
void DialogStyling : : SetStyle ( wxString curName , bool jump ) {
// Get line
AssDialogue * line = grid - > GetDialogue ( linen ) ;
// Update line
line - > Style = curName ;
// Update grid/subs
2006-02-22 05:59:39 +01:00
grid - > Refresh ( false ) ;
2006-01-16 22:02:54 +01:00
if ( PreviewCheck - > IsChecked ( ) ) {
2010-12-07 20:09:28 +01:00
grid - > ass - > Commit ( _ ( " styling assistant " ) , AssFile : : COMMIT_TEXT ) ;
2006-01-16 22:02:54 +01:00
}
else needCommit = true ;
// Next line
if ( jump ) JumpToLine ( linen + 1 ) ;
}
///////////////
// Event table
BEGIN_EVENT_TABLE ( DialogStyling , wxDialog )
2009-05-14 09:02:01 +02:00
EVT_ACTIVATE ( DialogStyling : : OnActivate )
2008-05-09 06:27:10 +02:00
EVT_BUTTON ( BUTTON_PLAY_VIDEO , DialogStyling : : OnPlayVideoButton )
EVT_BUTTON ( BUTTON_PLAY_AUDIO , DialogStyling : : OnPlayAudioButton )
2006-01-16 22:02:54 +01:00
//EVT_TEXT_ENTER(ENTER_STYLE_BOX, DialogStyling::OnStyleBoxEnter)
EVT_TEXT ( ENTER_STYLE_BOX , DialogStyling : : OnStyleBoxModified )
2009-06-07 05:43:12 +02:00
EVT_LISTBOX_DCLICK ( STYLE_LIST , DialogStyling : : OnListClicked )
2006-01-16 22:02:54 +01:00
EVT_KEY_DOWN ( DialogStyling : : OnKeyDown )
END_EVENT_TABLE ( )
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
/// @brief Dialog was De/Activated
/// @param event
/// @return
///
2009-05-14 09:02:01 +02:00
void DialogStyling : : OnActivate ( wxActivateEvent & event ) {
// Dialog lost focus
if ( ! event . GetActive ( ) ) {
2009-05-14 19:29:07 +02:00
if ( needCommit ) {
2010-12-07 20:09:28 +01:00
grid - > ass - > Commit ( _ ( " styling assistant " ) , AssFile : : COMMIT_TEXT ) ;
2009-05-14 19:29:07 +02:00
needCommit = false ;
2009-05-14 09:02:01 +02:00
}
return ;
}
// Enable/disable play video/audio buttons
PlayVideoButton - > Enable ( video - > IsLoaded ( ) ) ;
2010-12-08 04:36:10 +01:00
/// @todo Reinstate this when the audio controller is made reachable from here
//PlayAudioButton->Enable(audio->loaded);
2009-05-14 09:02:01 +02:00
// Fix style list
Styles - > Set ( grid - > ass - > GetStyles ( ) ) ;
// Fix line selection
2009-05-14 19:29:07 +02:00
JumpToLine ( grid - > GetFirstSelRow ( ) ) ;
2009-05-14 09:02:01 +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 Key pressed
/// @param event
///
2006-01-16 22:02:54 +01:00
void DialogStyling : : OnKeyDown ( wxKeyEvent & event ) {
int keycode = event . GetKeyCode ( ) ;
// Previous line
2007-01-22 20:31:49 +01:00
if ( keycode = = WXK_PAGEUP ) {
2006-01-16 22:02:54 +01:00
JumpToLine ( linen - 1 ) ;
}
// Next line
2007-01-22 20:31:49 +01:00
if ( keycode = = WXK_PAGEDOWN ) {
2006-01-16 22:02:54 +01:00
JumpToLine ( linen + 1 ) ;
}
event . Skip ( ) ;
}
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
/// @brief Edit box changed
/// @param event
/// @return
///
2006-01-16 22:02:54 +01:00
void DialogStyling : : OnStyleBoxModified ( wxCommandEvent & event ) {
// Recursion guard
static wxRecursionGuardFlag s_flag ;
wxRecursionGuard guard ( s_flag ) ;
if ( guard . IsInside ( ) ) return ;
// Find partial style name
long from , to ;
TypeBox - > GetSelection ( & from , & to ) ;
wxString partial = TypeBox - > GetValue ( ) . Left ( from ) . Lower ( ) ;
int len = partial . Length ( ) ;
// Find first style that matches partial name
bool match = false ;
int n = Styles - > GetCount ( ) ;
wxString curname ;
for ( int i = 0 ; i < n ; i + + ) {
curname = Styles - > GetString ( i ) ;
if ( curname . Left ( len ) . Lower ( ) = = partial ) {
match = true ;
break ;
}
}
// Found
if ( match ) {
TypeBox - > SetValue ( curname ) ;
TypeBox - > SetSelection ( from , curname . Length ( ) ) ;
TypeBox - > SetBackgroundColour ( origColour ) ;
TypeBox - > Refresh ( ) ;
}
// Not found
else {
TypeBox - > SetBackgroundColour ( wxColour ( 255 , 108 , 108 ) ) ;
TypeBox - > Refresh ( ) ;
}
}
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 Enter pressed
/// @param event
///
2006-01-16 22:02:54 +01:00
void DialogStyling : : OnStyleBoxEnter ( wxCommandEvent & event ) {
}
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 Style list clicked
/// @param event
///
2006-01-16 22:02:54 +01:00
void DialogStyling : : OnListClicked ( wxCommandEvent & event ) {
int n = event . GetInt ( ) ;
SetStyle ( Styles - > GetString ( n ) ) ;
Styles - > SetSelection ( wxNOT_FOUND ) ;
TypeBox - > SetFocus ( ) ;
}
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 Play video button
/// @param event
///
2008-05-09 06:27:10 +02:00
void DialogStyling : : OnPlayVideoButton ( wxCommandEvent & event ) {
video - > PlayLine ( ) ;
TypeBox - > SetFocus ( ) ;
}
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 Play audio button
/// @param event
///
2008-05-09 06:27:10 +02:00
void DialogStyling : : OnPlayAudioButton ( wxCommandEvent & event ) {
2010-12-08 09:09:16 +01:00
audio - > PlayRange ( SampleRange (
2010-12-08 04:36:10 +01:00
audio - > SamplesFromMilliseconds ( line - > Start . GetMS ( ) ) ,
audio - > SamplesFromMilliseconds ( line - > End . GetMS ( ) ) ) ) ;
2006-01-16 22:02:54 +01:00
TypeBox - > SetFocus ( ) ;
}
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 Style edit box constructor
/// @param parent
///
2006-01-16 22:02:54 +01:00
StyleEditBox : : StyleEditBox ( DialogStyling * parent )
: wxTextCtrl ( parent , ENTER_STYLE_BOX , _T ( " " ) , wxDefaultPosition , wxSize ( 180 , - 1 ) , wxTE_PROCESS_ENTER )
{
diag = parent ;
}
////////////////////////////
// Event table for edit box
BEGIN_EVENT_TABLE ( StyleEditBox , wxTextCtrl )
EVT_KEY_DOWN ( StyleEditBox : : OnKeyDown )
END_EVENT_TABLE ( )
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
/// @brief Key pressed
/// @param event
/// @return
///
2006-01-16 22:02:54 +01:00
void StyleEditBox : : OnKeyDown ( wxKeyEvent & event ) {
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
hotkey : : check ( " Styling Assistant " , event . GetKeyCode ( ) , event . GetUnicodeKey ( ) , event . GetModifiers ( ) ) ;
event . StopPropagation ( ) ;
//H I think most of this can be removed.
2006-01-16 22:02:54 +01:00
//int keycode = event.GetKeyCode();
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
/*
*
2007-09-22 17:16:48 +02:00
# ifdef __APPLE__
Hotkeys . SetPressed ( event . GetKeyCode ( ) , event . m_metaDown , event . m_altDown , event . m_shiftDown ) ;
# else
2006-01-16 22:02:54 +01:00
Hotkeys . SetPressed ( event . GetKeyCode ( ) , event . m_controlDown , event . m_altDown , event . m_shiftDown ) ;
2007-09-22 17:16:48 +02:00
# endif
2006-01-16 22:02:54 +01:00
// Backspace
2007-09-22 17:16:48 +02:00
# ifdef __APPLE__
if ( event . GetKeyCode ( ) = = WXK_BACK & & ! event . m_metaDown & & ! event . m_altDown & & ! event . m_shiftDown ) {
# else
2006-01-16 22:02:54 +01:00
if ( event . GetKeyCode ( ) = = WXK_BACK & & ! event . m_controlDown & & ! event . m_altDown & & ! event . m_shiftDown ) {
2007-09-22 17:16:48 +02:00
# endif
2006-01-16 22:02:54 +01:00
long from , to ;
GetSelection ( & from , & to ) ;
if ( from > 0 ) SetSelection ( from - 1 , to ) ;
}
// Previous line
if ( Hotkeys . IsPressed ( _T ( " Styling Assistant Prev " ) ) ) {
diag - > JumpToLine ( diag - > linen - 1 ) ;
return ;
}
// Next line
if ( Hotkeys . IsPressed ( _T ( " Styling Assistant Next " ) ) ) {
diag - > JumpToLine ( diag - > linen + 1 ) ;
return ;
}
2008-05-09 06:27:10 +02:00
// Play video
if ( Hotkeys . IsPressed ( _T ( " Styling Assistant Play Video " ) ) ) {
if ( diag - > video - > IsLoaded ( ) ) {
diag - > video - > PlayLine ( ) ;
}
return ;
}
2006-01-16 22:02:54 +01:00
// Play audio
2008-05-09 06:27:10 +02:00
if ( Hotkeys . IsPressed ( _T ( " Styling Assistant Play Audio " ) ) ) {
2010-12-08 04:36:10 +01:00
/// @todo Reinstate this when the audio controller is made reachable from here
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +01:00
//if (diag->audio->loaded) {
// diag->audio->Play(diag->line->Start.GetMS(),diag->line->End.GetMS());
//}
2006-01-16 22:02:54 +01:00
return ;
}
// Enter key
if ( Hotkeys . IsPressed ( _T ( " Styling Assistant Accept " ) ) | | Hotkeys . IsPressed ( _T ( " Styling Assistant Preview " ) ) ) {
// Make sure that entered style is valid
int n = diag - > Styles - > GetCount ( ) ;
wxString curName ;
bool match = false ;
for ( int i = 0 ; i < n ; i + + ) {
curName = diag - > Styles - > GetString ( i ) ;
if ( curName = = GetValue ( ) ) {
match = true ;
break ;
}
}
// Set style name
if ( match ) {
diag - > SetStyle ( curName , Hotkeys . IsPressed ( _T ( " Styling Assistant Accept " ) ) ) ;
}
return ;
}
event . Skip ( ) ;
Merge the dynamic menu, hotkey and toolbar branch to trunk. This doesn't include Windows support as vs2008 was being a major pain. This involves revisions r4921:4950, r4961:5002, r5005:5006, r5008:5056, r5062:5065, r5072, r5081:5082, r5087, r5096:5110, r5124:5125. Updates #1258.
Originally committed to SVN as r5126.
2011-01-05 14:00:46 +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
/// DOCME
2006-01-16 22:02:54 +01:00
int DialogStyling : : lastx = - 1 ;
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
/// DOCME
2006-01-16 22:02:54 +01:00
int DialogStyling : : lasty = - 1 ;
2009-07-29 07:43:02 +02:00
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00