2006-01-16 22:02:54 +01:00
// Copyright (c) 2005, Rodrigo Braz Monteiro
2010-07-20 05:11:11 +02:00
// Copyright (c) 2010, Thomas Goyne <plorkyeran@aegisub.org>
2006-01-16 22:02:54 +01:00
// 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 subs_edit_box.cpp
/// @brief Main subtitle editing area, including toolbars around the text control
/// @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
2010-07-20 05:11:11 +02:00
# ifdef _WIN32
# include <functional>
# else
# include <tr1/functional>
# endif
# include <wx/button.h>
# include <wx/checkbox.h>
2006-12-24 05:54:35 +01:00
# include <wx/colordlg.h>
2010-07-20 05:11:11 +02:00
# include <wx/combobox.h>
# include <wx/dcclient.h>
# include <wx/dcmemory.h>
2006-12-24 05:54:35 +01:00
# include <wx/fontdlg.h>
2010-07-20 05:11:11 +02:00
# include <wx/radiobut.h>
# include <wx/spinctrl.h>
2009-09-10 15:06:40 +02:00
# endif
2011-01-05 19:40:37 +01:00
# include "include/aegisub/hotkey.h"
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
# include "ass_dialogue.h"
2009-09-10 15:06:40 +02:00
# include "ass_file.h"
2006-01-16 22:02:54 +01:00
# include "ass_override.h"
2009-09-10 15:06:40 +02:00
# include "ass_style.h"
2010-12-08 04:36:10 +01:00
# include "audio_controller.h"
2006-01-16 22:02:54 +01:00
# include "dialog_colorpicker.h"
2006-03-05 21:42:38 +01:00
# include "dialog_search_replace.h"
2011-01-16 08:17:36 +01:00
# include "include/aegisub/context.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 "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 "timeedit_ctrl.h"
# include "tooltip_manager.h"
# include "utils.h"
# include "validators.h"
# include "video_context.h"
2006-01-16 22:02:54 +01:00
2010-07-20 05:11:11 +02:00
enum {
BUTTON_BOLD = 1300 ,
BUTTON_ITALICS ,
BUTTON_UNDERLINE ,
BUTTON_STRIKEOUT ,
BUTTON_FONT_NAME ,
BUTTON_COLOR1 ,
BUTTON_COLOR2 ,
BUTTON_COLOR3 ,
BUTTON_COLOR4 ,
BUTTON_COMMIT ,
BUTTON_LAST
} ;
enum {
BUTTON_FIRST = BUTTON_BOLD
} ;
template < class T >
struct field_setter : public std : : binary_function < AssDialogue * , T , void > {
T AssDialogue : : * field ;
field_setter ( T AssDialogue : : * field ) : field ( field ) { }
void operator ( ) ( AssDialogue * obj , T value ) {
obj - > * field = value ;
}
} ;
/// @brief Get the selection from a text edit
/// @param[out] start Beginning of selection
/// @param[out] end End of selection
void get_selection ( SubsTextEditCtrl * TextEdit , int & start , int & end ) {
TextEdit - > GetSelection ( & start , & end ) ;
int len = TextEdit - > GetText ( ) . size ( ) ;
2010-12-31 22:03:03 +01:00
start = mid ( 0 , TextEdit - > GetReverseUnicodePosition ( start ) , len ) ;
end = mid ( 0 , TextEdit - > GetReverseUnicodePosition ( end ) , len ) ;
2010-07-20 05:11:11 +02:00
}
/// @brief Get the value of a tag at a specified position in a line
/// @param line Line to get the value from
/// @param blockn Block number in the line
/// @param initial Value from style to use if the tag does not exist
/// @param tag Tag to get the value of
/// @param alt Alternate name of the tag, if any
template < class T >
static T get_value ( AssDialogue const & line , int blockn , T initial , wxString tag , wxString alt = " " ) {
for ( int i = blockn ; i > = 0 ; i - - ) {
AssDialogueBlockOverride * ovr = dynamic_cast < AssDialogueBlockOverride * > ( line . Blocks [ i ] ) ;
2010-10-08 08:06:44 +02:00
if ( ! ovr ) continue ;
for ( int j = ( int ) ovr - > Tags . size ( ) - 1 ; j > = 0 ; j - - ) {
if ( ovr - > Tags [ j ] - > Name = = tag | | ovr - > Tags [ j ] - > Name = = alt ) {
return ovr - > Tags [ j ] - > Params [ 0 ] - > Get < T > ( initial ) ;
2010-07-20 05:11:11 +02:00
}
}
}
return initial ;
}
template < class Control >
struct FocusHandler : std : : unary_function < wxFocusEvent & , void > {
wxString value ;
wxString alt ;
wxColor color ;
Control * control ;
void operator ( ) ( wxFocusEvent & event ) const {
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
2010-07-20 05:11:11 +02:00
if ( control - > GetValue ( ) = = alt ) {
control - > Freeze ( ) ;
control - > ChangeValue ( value ) ;
control - > SetForegroundColour ( color ) ;
control - > Thaw ( ) ;
}
}
} ;
template < class Event , class T >
void bind_focus_handler ( T * control , Event event , wxString value , wxString alt , wxColor color ) {
FocusHandler < T > handler ;
handler . value = value ;
handler . alt = alt ;
handler . color = color ;
handler . control = control ;
control - > Bind ( event , handler ) ;
}
2011-01-16 08:17:36 +01:00
SubsEditBox : : SubsEditBox ( wxWindow * parent , agi : : Context * context )
2010-07-20 05:11:11 +02:00
: wxPanel ( parent , - 1 , wxDefaultPosition , wxDefaultSize , wxTAB_TRAVERSAL | wxRAISED_BORDER , " SubsEditBox " )
, line ( NULL )
, splitLineMode ( false )
, controlState ( true )
2011-01-16 08:17:36 +01:00
, c ( context )
2006-01-16 22:02:54 +01:00
{
// Top controls
wxArrayString styles ;
2011-09-28 21:43:11 +02:00
styles . Add ( " Default " ) ;
2011-11-18 19:49:09 +01:00
CommentBox = new wxCheckBox ( this , wxID_ANY , _ ( " &Comment " ) ) ;
2011-09-28 21:43:11 +02:00
StyleBox = new wxComboBox ( this , wxID_ANY , " Default " , wxDefaultPosition , wxSize ( 110 , - 1 ) , styles , wxCB_READONLY | wxTE_PROCESS_ENTER ) ;
ActorBox = new wxComboBox ( this , wxID_ANY , " Actor " , wxDefaultPosition , wxSize ( 110 , - 1 ) , styles , wxCB_DROPDOWN | wxTE_PROCESS_ENTER ) ;
2010-07-20 05:11:11 +02:00
Effect = new wxTextCtrl ( this , wxID_ANY , " " , wxDefaultPosition , wxSize ( 80 , - 1 ) , wxTE_PROCESS_ENTER ) ;
// Middle controls
Layer = new wxSpinCtrl ( this , wxID_ANY , " " , wxDefaultPosition , wxSize ( 50 , - 1 ) , wxSP_ARROW_KEYS , 0 , 0x7FFFFFFF , 0 ) ;
2011-12-22 22:18:16 +01:00
StartTime = new TimeEdit ( this , wxID_ANY , context , " " , wxSize ( 75 , - 1 ) ) ;
EndTime = new TimeEdit ( this , wxID_ANY , context , " " , wxSize ( 75 , - 1 ) , true ) ;
Duration = new TimeEdit ( this , wxID_ANY , context , " " , wxSize ( 75 , - 1 ) ) ;
2010-07-20 05:11:11 +02:00
MarginL = new wxTextCtrl ( this , wxID_ANY , " " , wxDefaultPosition , wxSize ( 40 , - 1 ) , wxTE_CENTRE | wxTE_PROCESS_ENTER , NumValidator ( ) ) ;
MarginL - > SetMaxLength ( 4 ) ;
MarginR = new wxTextCtrl ( this , wxID_ANY , " " , wxDefaultPosition , wxSize ( 40 , - 1 ) , wxTE_CENTRE | wxTE_PROCESS_ENTER , NumValidator ( ) ) ;
MarginR - > SetMaxLength ( 4 ) ;
MarginV = new wxTextCtrl ( this , wxID_ANY , " " , wxDefaultPosition , wxSize ( 40 , - 1 ) , wxTE_CENTRE | wxTE_PROCESS_ENTER , NumValidator ( ) ) ;
MarginV - > SetMaxLength ( 4 ) ;
// Middle-bottom controls
ToggableButtons . reserve ( 10 ) ;
int id = BUTTON_FIRST ;
# define MAKE_BUTTON(img, tooltip) \
ToggableButtons . push_back ( new wxBitmapButton ( this , id + + , GETIMAGE ( img ) ) ) ; \
ToggableButtons . back ( ) - > SetToolTip ( tooltip ) ;
MAKE_BUTTON ( button_bold_16 , _ ( " Bold " ) ) ;
MAKE_BUTTON ( button_italics_16 , _ ( " Italics " ) ) ;
MAKE_BUTTON ( button_underline_16 , _ ( " Underline " ) ) ;
MAKE_BUTTON ( button_strikeout_16 , _ ( " Strikeout " ) ) ;
2011-11-17 03:21:46 +01:00
MAKE_BUTTON ( button_fontname_16 , _ ( " Font Face " ) ) ;
2010-07-20 05:11:11 +02:00
MAKE_BUTTON ( button_color_one_16 , _ ( " Primary color " ) ) ;
MAKE_BUTTON ( button_color_two_16 , _ ( " Secondary color " ) ) ;
MAKE_BUTTON ( button_color_three_16 , _ ( " Outline color " ) ) ;
MAKE_BUTTON ( button_color_four_16 , _ ( " Shadow color " ) ) ;
2011-11-18 19:49:09 +01:00
MAKE_BUTTON ( button_audio_commit_16 , _ ( " Commits the text (Enter) " ) ) ;
2010-07-20 05:11:11 +02:00
# undef MAKE_BUTTON
2011-11-18 19:49:09 +01:00
ByTime = new wxRadioButton ( this , wxID_ANY , _ ( " &Time " ) , wxDefaultPosition , wxDefaultSize , wxRB_GROUP ) ;
ByFrame = new wxRadioButton ( this , wxID_ANY , _ ( " F&rame " ) ) ;
2010-12-31 22:03:18 +01:00
ByFrame - > Enable ( false ) ;
2010-07-20 05:11:11 +02:00
// Tooltips
2006-01-16 22:02:54 +01:00
CommentBox - > SetToolTip ( _ ( " Comment this line out. Commented lines don't show up on screen. " ) ) ;
StyleBox - > SetToolTip ( _ ( " Style for this line. " ) ) ;
ActorBox - > SetToolTip ( _ ( " Actor name for this speech. This is only for reference, and is mainly useless. " ) ) ;
2006-12-24 17:17:40 +01:00
Effect - > SetToolTip ( _ ( " Effect for this line. This can be used to store extra information for karaoke scripts, or for the effects supported by the renderer. " ) ) ;
2006-01-16 22:02:54 +01:00
Layer - > SetToolTip ( _ ( " Layer number " ) ) ;
StartTime - > SetToolTip ( _ ( " Start time " ) ) ;
EndTime - > SetToolTip ( _ ( " End time " ) ) ;
Duration - > SetToolTip ( _ ( " Line duration " ) ) ;
2006-12-30 15:31:41 +01:00
MarginL - > SetToolTip ( _ ( " Left Margin (0 = default) " ) ) ;
MarginR - > SetToolTip ( _ ( " Right Margin (0 = default) " ) ) ;
MarginV - > SetToolTip ( _ ( " Vertical Margin (0 = default) " ) ) ;
2006-12-24 17:17:40 +01:00
ByTime - > SetToolTip ( _ ( " Time by h:mm:ss.cs " ) ) ;
ByFrame - > SetToolTip ( _ ( " Time by frame number " ) ) ;
2006-06-27 06:13:34 +02:00
// Top sizer
2006-12-27 01:00:41 +01:00
TopSizer = new wxBoxSizer ( wxHORIZONTAL ) ;
2008-03-10 00:00:03 +01:00
TopSizer - > Add ( CommentBox , 0 , wxRIGHT | wxALIGN_CENTER , 5 ) ;
TopSizer - > Add ( StyleBox , 2 , wxRIGHT | wxALIGN_CENTER , 5 ) ;
TopSizer - > Add ( ActorBox , 2 , wxRIGHT | wxALIGN_CENTER , 5 ) ;
TopSizer - > Add ( Effect , 3 , wxALIGN_CENTER , 5 ) ;
2006-06-27 06:13:34 +02:00
// Middle sizer
2006-12-27 01:00:41 +01:00
splitLineMode = true ;
MiddleSizer = new wxBoxSizer ( wxHORIZONTAL ) ;
2007-09-21 18:20:00 +02:00
MiddleSizer - > Add ( Layer , 0 , wxRIGHT | wxALIGN_CENTER , 5 ) ;
MiddleSizer - > Add ( StartTime , 0 , wxRIGHT | wxALIGN_CENTER , 0 ) ;
MiddleSizer - > Add ( EndTime , 0 , wxRIGHT | wxALIGN_CENTER , 5 ) ;
MiddleSizer - > Add ( Duration , 0 , wxRIGHT | wxALIGN_CENTER , 5 ) ;
MiddleSizer - > Add ( MarginL , 0 , wxALIGN_CENTER , 0 ) ;
MiddleSizer - > Add ( MarginR , 0 , wxALIGN_CENTER , 0 ) ;
MiddleSizer - > Add ( MarginV , 0 , wxALIGN_CENTER , 0 ) ;
2006-12-27 01:00:41 +01:00
MiddleSizer - > AddSpacer ( 5 ) ;
2006-01-16 22:02:54 +01:00
// Middle-bottom sizer
2006-12-27 01:00:41 +01:00
MiddleBotSizer = new wxBoxSizer ( wxHORIZONTAL ) ;
2010-07-20 05:11:11 +02:00
for ( size_t i = 0 ; i < ToggableButtons . size ( ) ; + + i ) {
MiddleBotSizer - > Add ( ToggableButtons [ i ] , 0 , wxALIGN_CENTER | wxEXPAND , 0 ) ;
if ( i = = 4 | | i = = 8 )
MiddleBotSizer - > AddSpacer ( 5 ) ;
}
2008-03-09 23:31:16 +01:00
MiddleBotSizer - > AddSpacer ( 10 ) ;
MiddleBotSizer - > Add ( ByTime , 0 , wxRIGHT | wxALIGN_CENTER | wxEXPAND , 5 ) ;
MiddleBotSizer - > Add ( ByFrame , 0 , wxRIGHT | wxALIGN_CENTER | wxEXPAND , 5 ) ;
2006-01-16 22:02:54 +01:00
// Text editor
2011-01-16 08:17:36 +01:00
TextEdit = new SubsTextEditCtrl ( this , wxSize ( 300 , 50 ) , wxBORDER_SUNKEN , c - > subsGrid ) ;
2010-07-20 05:11:11 +02:00
TextEdit - > Bind ( wxEVT_KEY_DOWN , & SubsEditBox : : OnKeyDown , this ) ;
TextEdit - > SetUndoCollection ( false ) ;
2006-12-27 01:00:41 +01:00
BottomSizer = new wxBoxSizer ( wxHORIZONTAL ) ;
2006-01-16 22:02:54 +01:00
BottomSizer - > Add ( TextEdit , 1 , wxEXPAND , 0 ) ;
// Main sizer
2006-12-27 01:00:41 +01:00
MainSizer = new wxBoxSizer ( wxVERTICAL ) ;
2008-03-09 23:31:16 +01:00
MainSizer - > Add ( TopSizer , 0 , wxEXPAND | wxALL , 3 ) ;
2006-01-16 22:02:54 +01:00
MainSizer - > Add ( MiddleSizer , 0 , wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM , 3 ) ;
MainSizer - > Add ( MiddleBotSizer , 0 , wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM , 3 ) ;
MainSizer - > Add ( BottomSizer , 1 , wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM , 3 ) ;
// Set sizer
SetSizer ( MainSizer ) ;
MainSizer - > SetSizeHints ( this ) ;
origBgColour = TextEdit - > GetBackgroundColour ( ) ;
disabledBgColour = GetBackgroundColour ( ) ;
2006-12-27 01:00:41 +01:00
2010-07-20 05:11:11 +02:00
wxColor text = wxSystemSettings : : GetColour ( wxSYS_COLOUR_WINDOWTEXT ) ;
wxColor grey ( ( text . Red ( ) + origBgColour . Red ( ) ) / 2 ,
( text . Green ( ) + origBgColour . Green ( ) ) / 2 ,
( text . Blue ( ) + origBgColour . Blue ( ) ) / 2 ) ;
2006-01-16 22:02:54 +01:00
2010-07-20 05:11:11 +02:00
// Setup placeholders for effect and actor boxes
2011-09-28 21:43:11 +02:00
bind_focus_handler ( Effect , wxEVT_SET_FOCUS , " " , " Effect " , text ) ;
bind_focus_handler ( Effect , wxEVT_KILL_FOCUS , " Effect " , " " , grey ) ;
2010-07-20 05:11:11 +02:00
Effect - > SetForegroundColour ( grey ) ;
2006-01-16 22:02:54 +01:00
2011-09-28 21:43:11 +02:00
bind_focus_handler ( ActorBox , wxEVT_SET_FOCUS , " " , " Actor " , text ) ;
bind_focus_handler ( ActorBox , wxEVT_KILL_FOCUS , " Actor " , " " , grey ) ;
2010-07-20 05:11:11 +02:00
ActorBox - > SetForegroundColour ( grey ) ;
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
2010-07-20 05:11:11 +02:00
TextEdit - > Bind ( wxEVT_STC_MODIFIED , & SubsEditBox : : OnChange , this ) ;
TextEdit - > SetModEventMask ( wxSTC_MOD_INSERTTEXT | wxSTC_MOD_DELETETEXT ) ;
2009-05-18 07:33:49 +02:00
2010-07-20 05:11:11 +02:00
Bind ( wxEVT_COMMAND_RADIOBUTTON_SELECTED , & SubsEditBox : : OnFrameTimeRadio , this , ByFrame - > GetId ( ) ) ;
Bind ( wxEVT_COMMAND_RADIOBUTTON_SELECTED , & SubsEditBox : : OnFrameTimeRadio , this , ByTime - > GetId ( ) ) ;
2009-05-18 07:33:49 +02:00
2010-07-20 05:11:11 +02:00
Bind ( wxEVT_COMMAND_COMBOBOX_SELECTED , & SubsEditBox : : OnStyleChange , this , StyleBox - > GetId ( ) ) ;
Bind ( wxEVT_COMMAND_COMBOBOX_SELECTED , & SubsEditBox : : OnActorChange , this , ActorBox - > GetId ( ) ) ;
Bind ( wxEVT_COMMAND_TEXT_UPDATED , & SubsEditBox : : OnActorChange , this , ActorBox - > GetId ( ) ) ;
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
2010-07-20 05:11:11 +02:00
Bind ( wxEVT_COMMAND_TEXT_UPDATED , & SubsEditBox : : OnLayerEnter , this , Layer - > GetId ( ) ) ;
Bind ( wxEVT_COMMAND_SPINCTRL_UPDATED , & SubsEditBox : : OnLayerChange , this , Layer - > GetId ( ) ) ;
Bind ( wxEVT_COMMAND_TEXT_UPDATED , & SubsEditBox : : OnStartTimeChange , this , StartTime - > GetId ( ) ) ;
Bind ( wxEVT_COMMAND_TEXT_UPDATED , & SubsEditBox : : OnEndTimeChange , this , EndTime - > GetId ( ) ) ;
Bind ( wxEVT_COMMAND_TEXT_UPDATED , & SubsEditBox : : OnDurationChange , this , Duration - > GetId ( ) ) ;
Bind ( wxEVT_COMMAND_TEXT_UPDATED , & SubsEditBox : : OnMarginLChange , this , MarginL - > GetId ( ) ) ;
Bind ( wxEVT_COMMAND_TEXT_UPDATED , & SubsEditBox : : OnMarginRChange , this , MarginR - > GetId ( ) ) ;
Bind ( wxEVT_COMMAND_TEXT_UPDATED , & SubsEditBox : : OnMarginVChange , this , MarginV - > GetId ( ) ) ;
Bind ( wxEVT_COMMAND_TEXT_UPDATED , & SubsEditBox : : OnEffectChange , this , Effect - > GetId ( ) ) ;
Bind ( wxEVT_COMMAND_CHECKBOX_CLICKED , & SubsEditBox : : OnCommentChange , this , CommentBox - > GetId ( ) ) ;
2006-12-27 01:00:41 +01:00
2010-07-20 05:11:11 +02:00
Bind ( wxEVT_SIZE , & SubsEditBox : : OnSize , this ) ;
2006-12-27 01:00:41 +01:00
2010-07-20 05:11:11 +02:00
for ( int i = 0 ; i < 4 ; i + + ) {
Bind ( wxEVT_COMMAND_BUTTON_CLICKED , & SubsEditBox : : OnFlagButton , this , BUTTON_FIRST + i ) ;
2006-12-27 01:00:41 +01:00
}
2010-07-20 05:11:11 +02:00
Bind ( wxEVT_COMMAND_BUTTON_CLICKED , & SubsEditBox : : OnFontButton , this , BUTTON_FONT_NAME ) ;
for ( int i = 5 ; i < 9 ; i + + ) {
Bind ( wxEVT_COMMAND_BUTTON_CLICKED , & SubsEditBox : : OnColorButton , this , BUTTON_FIRST + i ) ;
2006-12-27 01:00:41 +01:00
}
2010-07-20 05:11:11 +02:00
Bind ( wxEVT_COMMAND_BUTTON_CLICKED , & SubsEditBox : : OnCommitButton , this , BUTTON_COMMIT ) ;
2006-12-27 01:00:41 +01:00
2010-07-20 05:11:11 +02:00
wxSizeEvent evt ;
OnSize ( evt ) ;
2006-12-27 01:00:41 +01:00
2011-09-15 07:17:29 +02:00
c - > selectionController - > AddSelectionListener ( this ) ;
2011-09-15 07:17:00 +02:00
file_changed_slot = c - > ass - > AddCommitListener ( & SubsEditBox : : Update , this ) ;
2011-01-16 08:17:36 +01:00
context - > videoController - > AddTimecodesListener ( & SubsEditBox : : UpdateFrameTiming , this ) ;
2010-07-20 05:11:11 +02:00
}
SubsEditBox : : ~ SubsEditBox ( ) {
2011-09-15 07:17:29 +02:00
c - > selectionController - > RemoveSelectionListener ( this ) ;
2010-07-20 05:11:11 +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
2010-12-07 20:09:28 +01:00
void SubsEditBox : : Update ( int type ) {
2010-12-12 01:34:02 +01:00
SetEvtHandlerEnabled ( false ) ;
2011-09-15 07:16:32 +02:00
if ( type = = AssFile : : COMMIT_NEW | | type & AssFile : : COMMIT_STYLES ) {
2010-12-07 20:09:28 +01:00
StyleBox - > Clear ( ) ;
2011-01-16 08:17:36 +01:00
StyleBox - > Append ( c - > ass - > GetStyles ( ) ) ;
2011-09-15 07:16:32 +02:00
}
2010-12-07 20:09:28 +01:00
2011-09-15 07:16:32 +02:00
if ( type = = AssFile : : COMMIT_NEW ) {
/// @todo maybe preserve selection over undo?
2011-10-19 06:05:09 +02:00
PopulateActorList ( ) ;
2010-12-07 20:09:28 +01:00
TextEdit - > SetSelection ( 0 , 0 ) ;
2010-12-12 01:34:02 +01:00
SetEvtHandlerEnabled ( true ) ;
2010-12-07 20:09:28 +01:00
return ;
}
2011-11-18 05:04:35 +01:00
else if ( type & AssFile : : COMMIT_STYLES )
StyleBox - > Select ( StyleBox - > FindString ( line - > Style ) ) ;
2011-09-15 07:16:32 +02:00
if ( ! ( type ^ AssFile : : COMMIT_ORDER ) ) return ;
2010-12-07 20:09:28 +01:00
2010-07-20 05:11:11 +02:00
SetControlsState ( ! ! line ) ;
if ( ! line ) {
2010-12-12 01:34:02 +01:00
SetEvtHandlerEnabled ( true ) ;
2010-07-20 05:11:11 +02:00
return ;
2006-01-16 22:02:54 +01:00
}
2010-07-20 05:11:11 +02:00
2011-09-15 07:16:32 +02:00
if ( type & AssFile : : COMMIT_DIAG_TIME ) {
StartTime - > SetTime ( line - > Start ) ;
EndTime - > SetTime ( line - > End ) ;
Duration - > SetTime ( line - > End - line - > Start ) ;
}
if ( type & AssFile : : COMMIT_DIAG_TEXT ) {
2010-07-20 05:11:11 +02:00
TextEdit - > SetTextTo ( line - > Text ) ;
2011-09-15 07:16:32 +02:00
}
if ( type & AssFile : : COMMIT_DIAG_META ) {
2010-07-20 05:11:11 +02:00
Layer - > SetValue ( line - > Layer ) ;
MarginL - > ChangeValue ( line - > GetMarginString ( 0 , false ) ) ;
MarginR - > ChangeValue ( line - > GetMarginString ( 1 , false ) ) ;
MarginV - > ChangeValue ( line - > GetMarginString ( 2 , false ) ) ;
2011-10-19 06:05:09 +02:00
Effect - > ChangeValue ( line - > Effect . empty ( ) ? " Effect " : line - > Effect ) ;
2010-07-20 05:11:11 +02:00
CommentBox - > SetValue ( line - > Comment ) ;
StyleBox - > Select ( StyleBox - > FindString ( line - > Style ) ) ;
2011-10-19 06:05:09 +02:00
PopulateActorList ( ) ;
ActorBox - > ChangeValue ( line - > Actor . empty ( ) ? " Actor " : line - > Actor ) ;
2010-07-20 05:11:11 +02:00
ActorBox - > SetStringSelection ( line - > Actor ) ;
2006-01-16 22:02:54 +01:00
}
2010-07-20 05:11:11 +02:00
SetEvtHandlerEnabled ( true ) ;
2006-01-16 22:02:54 +01:00
}
2011-10-19 06:05:09 +02:00
void SubsEditBox : : PopulateActorList ( ) {
std : : set < wxString > actors ;
for ( entryIter it = c - > ass - > Line . begin ( ) ; it ! = c - > ass - > Line . end ( ) ; + + it ) {
if ( AssDialogue * diag = dynamic_cast < AssDialogue * > ( * it ) )
actors . insert ( diag - > Actor ) ;
}
# ifdef __APPLE__
// OSX doesn't like combo boxes that are empty.
actors . insert ( " Actor " ) ;
# endif
actors . erase ( " " ) ;
wxArrayString arrstr ;
arrstr . reserve ( actors . size ( ) ) ;
copy ( actors . begin ( ) , actors . end ( ) , std : : back_inserter ( arrstr ) ) ;
ActorBox - > Freeze ( ) ;
bool evt_handler_was_enabled = GetEvtHandlerEnabled ( ) ;
SetEvtHandlerEnabled ( false ) ;
long pos = ActorBox - > GetInsertionPoint ( ) ;
wxString value = ActorBox - > GetValue ( ) ;
ActorBox - > Clear ( ) ;
ActorBox - > Append ( arrstr ) ;
ActorBox - > ChangeValue ( value ) ;
ActorBox - > SetStringSelection ( value ) ;
ActorBox - > SetInsertionPoint ( pos ) ;
if ( evt_handler_was_enabled )
SetEvtHandlerEnabled ( true ) ;
ActorBox - > Thaw ( ) ;
}
2010-07-20 05:11:11 +02:00
void SubsEditBox : : OnActiveLineChanged ( AssDialogue * new_line ) {
SetEvtHandlerEnabled ( false ) ;
line = new_line ;
2006-01-16 22:02:54 +01:00
2011-09-15 07:16:32 +02:00
Update ( AssFile : : COMMIT_DIAG_FULL ) ;
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
2010-07-20 05:11:11 +02:00
/// @todo VideoContext should be doing this
2011-01-16 08:17:36 +01:00
if ( c - > videoController - > IsLoaded ( ) ) {
2010-07-20 05:11:11 +02:00
bool sync ;
2011-12-22 22:14:32 +01:00
if ( Search . HasFocus ( ) ) sync = OPT_GET ( " Tool/Search Replace/Video Update " ) - > GetBool ( ) ;
2010-07-20 05:11:11 +02:00
else sync = OPT_GET ( " Video/Subtitle Sync " ) - > GetBool ( ) ;
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
2010-07-20 05:11:11 +02:00
if ( sync ) {
2011-01-16 08:17:36 +01:00
c - > videoController - > Stop ( ) ;
2011-12-22 22:28:51 +01:00
c - > videoController - > JumpToTime ( line - > Start ) ;
2010-07-20 05:11:11 +02:00
}
2007-01-02 06:00:55 +01:00
}
2010-07-20 05:11:11 +02:00
SetEvtHandlerEnabled ( true ) ;
}
void SubsEditBox : : OnSelectedSetChanged ( const Selection & , const Selection & ) {
2011-09-15 07:17:29 +02:00
sel = c - > selectionController - > GetSelectedSet ( ) ;
2006-12-24 05:54:35 +01:00
}
2010-12-31 22:03:18 +01:00
void SubsEditBox : : UpdateFrameTiming ( agi : : vfr : : Framerate const & fps ) {
if ( fps . IsLoaded ( ) ) {
ByFrame - > Enable ( true ) ;
}
2010-07-20 05:11:11 +02:00
else {
ByFrame - > Enable ( false ) ;
ByTime - > SetValue ( true ) ;
StartTime - > SetByFrame ( false ) ;
EndTime - > SetByFrame ( false ) ;
2011-01-16 08:17:36 +01:00
c - > subsGrid - > SetByFrame ( false ) ;
2010-07-20 05:11:11 +02:00
}
2007-01-02 19:09:56 +01:00
}
2010-07-20 05:11:11 +02:00
void SubsEditBox : : OnKeyDown ( wxKeyEvent & event ) {
2011-07-30 01:16:55 +02:00
if ( hotkey : : check ( " Subtitle Edit Box " , c , event . GetKeyCode ( ) , event . GetUnicodeKey ( ) , event . GetModifiers ( ) ) )
2011-01-19 04:12:46 +01:00
return ;
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
2010-07-20 05:11:11 +02:00
int key = event . GetKeyCode ( ) ;
if ( line & & ( key = = WXK_RETURN | | key = = WXK_NUMPAD_ENTER ) ) {
2010-10-26 06:12:10 +02:00
NextLine ( ) ;
2010-07-20 05:11:11 +02:00
}
else {
event . Skip ( ) ;
}
}
2007-01-02 19:09:56 +01:00
2010-07-20 05:11:11 +02:00
void SubsEditBox : : OnCommitButton ( wxCommandEvent & ) {
2010-10-26 06:12:10 +02:00
if ( line ) NextLine ( ) ;
2010-07-20 05:11:11 +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
2010-10-26 06:12:10 +02:00
void SubsEditBox : : NextLine ( ) {
2011-09-15 07:17:29 +02:00
AssDialogue * cur = line ;
c - > selectionController - > NextLine ( ) ;
if ( line = = cur ) {
2010-07-20 05:11:11 +02:00
AssDialogue * newline = new AssDialogue ;
newline - > Start = cur - > End ;
newline - > End = cur - > End + OPT_GET ( " Timing/Default Duration " ) - > GetInt ( ) ;
newline - > Style = cur - > Style ;
2011-09-15 07:17:29 +02:00
entryIter pos = find ( c - > ass - > Line . begin ( ) , c - > ass - > Line . end ( ) , line ) ;
c - > ass - > Line . insert ( + + pos , newline ) ;
c - > ass - > Commit ( _ ( " line insertion " ) , AssFile : : COMMIT_DIAG_ADDREM ) ;
2011-09-28 21:50:32 +02:00
c - > selectionController - > NextLine ( ) ;
2006-01-16 22:02:54 +01:00
}
2010-07-20 05:11:11 +02:00
}
2006-12-24 05:54:35 +01:00
2010-07-20 05:11:11 +02:00
void SubsEditBox : : OnChange ( wxStyledTextEvent & event ) {
if ( line & & TextEdit - > GetText ( ) ! = line - > Text ) {
if ( event . GetModificationType ( ) & wxSTC_MOD_INSERTTEXT ) {
CommitText ( _ ( " insert text " ) ) ;
}
else {
CommitText ( _ ( " delete text " ) ) ;
}
}
2006-01-16 22:02:54 +01:00
}
2010-07-20 05:11:11 +02:00
template < class T , class setter >
2011-09-15 07:16:32 +02:00
void SubsEditBox : : SetSelectedRows ( setter set , T value , wxString desc , int type , bool amend ) {
2011-10-19 06:05:09 +02:00
for_each ( sel . begin ( ) , sel . end ( ) , bind ( set , std : : tr1 : : placeholders : : _1 , value ) ) ;
Note: This was done using a script! it's far from perfect but 95% of the work has been done already formatting-wise.
Document all functions, class, struct, union, enum, macro, variable, typedefs. This isn't the actual document in itself but empty documentation using any old documentation if it was there.
This was done using exuberant ctags to get tag info, then a TCL script to parse/remove old comments and convert them into Doxygen-style.
Some notes:
* Anything labeled 'DOCME' needs to be documented, @param and @return have been left blank as it would be annoying to delete the 'DOCME' from every one of those.
* Some multiline comments may have been munged into single line comments
* Leave the /// comments above global variables with a space, if they're harder to read then we'll be less likey to use them.
* Enum comments can go after the enumeration itself '[value] /// comment'
* include/aegisub/*.h haven't been converted yet, this will be done in a later commit
* Some documentation blocks are in the wrong place, in the .h when it should be in the .cpp, or vice versa.
See http://devel.aegisub.org/wiki/Doxygen for some details on Doxygen and a 'style guide'.
Originally committed to SVN as r3312.
2009-07-30 00:59:22 +02:00
2011-10-19 06:05:09 +02:00
file_changed_slot . Block ( ) ;
2011-09-28 21:44:24 +02:00
commitId = c - > ass - > Commit ( desc , type , ( amend & & desc = = lastCommitType ) ? commitId : - 1 , sel . size ( ) = = 1 ? * sel . begin ( ) : 0 ) ;
2011-10-19 06:05:09 +02:00
file_changed_slot . Unblock ( ) ;
2010-07-20 05:11:11 +02:00
lastCommitType = desc ;
2007-01-02 06:00:55 +01:00
}
2010-07-20 05:11:11 +02:00
template < class T >
2011-09-15 07:16:32 +02:00
void SubsEditBox : : SetSelectedRows ( T AssDialogue : : * field , T value , wxString desc , int type , bool amend ) {
SetSelectedRows ( field_setter < T > ( field ) , value , desc , type , amend ) ;
2007-01-02 19:28:09 +01:00
}
2010-07-20 05:11:11 +02:00
void SubsEditBox : : CommitText ( wxString desc ) {
2011-09-15 07:16:32 +02:00
SetSelectedRows ( & AssDialogue : : Text , TextEdit - > GetText ( ) , desc , AssFile : : COMMIT_DIAG_TEXT , true ) ;
2010-07-20 05:11:11 +02:00
}
2007-01-02 19:28:09 +01:00
2010-07-20 05:11:11 +02:00
void SubsEditBox : : CommitTimes ( TimeField field ) {
2011-12-22 22:18:16 +01:00
Duration - > SetTime ( EndTime - > GetTime ( ) - StartTime - > GetTime ( ) ) ;
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
2010-07-20 05:11:11 +02:00
// Update lines
for ( Selection : : iterator cur = sel . begin ( ) ; cur ! = sel . end ( ) ; + + cur ) {
switch ( field ) {
case TIME_START :
2011-12-22 22:18:16 +01:00
( * cur ) - > Start = StartTime - > GetTime ( ) ;
2010-07-20 05:11:11 +02:00
if ( ( * cur ) - > Start > ( * cur ) - > End ) ( * cur ) - > End = ( * cur ) - > Start ;
break ;
case TIME_END :
2011-12-22 22:18:16 +01:00
( * cur ) - > End = EndTime - > GetTime ( ) ;
2010-07-20 05:11:11 +02:00
if ( ( * cur ) - > Start > ( * cur ) - > End ) ( * cur ) - > Start = ( * cur ) - > End ;
break ;
case TIME_DURATION :
2011-12-22 22:18:16 +01:00
( * cur ) - > End = ( * cur ) - > Start + Duration - > GetTime ( ) ;
2010-07-20 05:11:11 +02:00
break ;
}
}
2011-09-28 21:44:24 +02:00
timeCommitId [ field ] = c - > ass - > Commit ( _ ( " modify times " ) , AssFile : : COMMIT_DIAG_TIME , timeCommitId [ field ] , sel . size ( ) = = 1 ? * sel . begin ( ) : 0 ) ;
2006-01-16 22:02:54 +01:00
}
2010-07-20 05:11:11 +02:00
void SubsEditBox : : OnSize ( wxSizeEvent & evt ) {
int topWidth = TopSizer - > GetSize ( ) . GetWidth ( ) ;
int midMin = MiddleSizer - > GetMinSize ( ) . GetWidth ( ) ;
int botMin = MiddleBotSizer - > GetMinSize ( ) . GetWidth ( ) ;
2006-01-16 22:02:54 +01:00
2010-07-20 05:11:11 +02:00
if ( splitLineMode ) {
if ( topWidth > = midMin + botMin ) {
MainSizer - > Detach ( MiddleBotSizer ) ;
MiddleSizer - > Add ( MiddleBotSizer , 0 , wxALIGN_CENTER_VERTICAL ) ;
splitLineMode = false ;
}
}
else {
if ( topWidth < midMin ) {
MiddleSizer - > Detach ( MiddleBotSizer ) ;
MainSizer - > Insert ( 2 , MiddleBotSizer , 0 , wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM , 3 ) ;
splitLineMode = true ;
}
2006-01-16 22:02:54 +01:00
}
2010-07-20 05:11:11 +02:00
evt . 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
2010-07-20 05:11:11 +02:00
void SubsEditBox : : OnFrameTimeRadio ( wxCommandEvent & event ) {
bool byFrame = ByFrame - > GetValue ( ) ;
StartTime - > SetByFrame ( byFrame ) ;
EndTime - > SetByFrame ( byFrame ) ;
Duration - > SetByFrame ( byFrame ) ;
2011-01-16 08:17:36 +01:00
c - > subsGrid - > SetByFrame ( byFrame ) ;
2010-07-20 05:11:11 +02:00
event . Skip ( ) ;
}
2006-01-16 22:02:54 +01:00
2010-07-20 05:11:11 +02:00
void SubsEditBox : : SetControlsState ( bool state ) {
2006-01-16 22:02:54 +01:00
if ( state = = controlState ) return ;
controlState = state ;
// HACK: TextEdit workaround the stupid colour lock bug
2006-12-24 05:54:35 +01:00
TextEdit - > SetReadOnly ( ! state ) ;
2006-01-16 22:02:54 +01:00
if ( state ) TextEdit - > SetBackgroundColour ( origBgColour ) ;
else TextEdit - > SetBackgroundColour ( disabledBgColour ) ;
// Sets controls
StartTime - > Enable ( state ) ;
EndTime - > Enable ( state ) ;
Duration - > Enable ( state ) ;
Layer - > Enable ( state ) ;
MarginL - > Enable ( state ) ;
MarginR - > Enable ( state ) ;
MarginV - > Enable ( state ) ;
2006-06-27 06:13:34 +02:00
Effect - > Enable ( state ) ;
2006-01-16 22:02:54 +01:00
CommentBox - > Enable ( state ) ;
StyleBox - > Enable ( state ) ;
ActorBox - > Enable ( state ) ;
ByTime - > Enable ( state ) ;
2010-07-20 05:11:11 +02:00
for ( size_t i = 0 ; i < ToggableButtons . size ( ) ; + + i )
ToggableButtons [ i ] - > Enable ( state ) ;
2006-01-16 22:02:54 +01:00
2010-07-20 05:11:11 +02:00
if ( ! state ) {
SetEvtHandlerEnabled ( false ) ;
TextEdit - > SetTextTo ( " " ) ;
2006-01-16 22:02:54 +01:00
StartTime - > SetTime ( 0 ) ;
EndTime - > SetTime ( 0 ) ;
2007-01-08 04:05:26 +01:00
Duration - > SetTime ( 0 ) ;
2010-07-20 05:11:11 +02:00
Layer - > SetValue ( " " ) ;
MarginL - > ChangeValue ( " " ) ;
MarginR - > ChangeValue ( " " ) ;
MarginV - > ChangeValue ( " " ) ;
Effect - > ChangeValue ( " " ) ;
2006-01-16 22:02:54 +01:00
CommentBox - > SetValue ( false ) ;
2010-07-20 05:11:11 +02:00
SetEvtHandlerEnabled ( true ) ;
2006-01-16 22:02:54 +01:00
}
}
2010-07-20 05:11:11 +02:00
void SubsEditBox : : OnStyleChange ( wxCommandEvent & ) {
2011-09-15 07:16:32 +02:00
SetSelectedRows ( & AssDialogue : : Style , StyleBox - > GetValue ( ) , _ ( " style change " ) , AssFile : : COMMIT_DIAG_META ) ;
2006-01-16 22:02:54 +01:00
}
2010-07-20 05:11:11 +02:00
void SubsEditBox : : OnActorChange ( wxCommandEvent & ) {
2011-10-19 06:05:09 +02:00
SetSelectedRows ( & AssDialogue : : Actor , ActorBox - > GetValue ( ) , _ ( " actor change " ) , AssFile : : COMMIT_DIAG_META ) ;
PopulateActorList ( ) ;
2006-01-16 22:02:54 +01:00
}
2007-06-18 01:49:51 +02:00
void SubsEditBox : : OnLayerChange ( wxSpinEvent & event ) {
2010-07-20 05:11:11 +02:00
OnLayerEnter ( event ) ;
2007-10-29 16:30:04 +01:00
}
2010-07-20 05:11:11 +02:00
void SubsEditBox : : OnLayerEnter ( wxCommandEvent & ) {
2011-09-15 07:16:32 +02:00
SetSelectedRows ( & AssDialogue : : Layer , Layer - > GetValue ( ) , _ ( " layer change " ) , AssFile : : COMMIT_DIAG_META ) ;
2006-01-16 22:02:54 +01:00
}
2010-07-20 05:11:11 +02:00
void SubsEditBox : : OnStartTimeChange ( wxCommandEvent & ) {
2011-12-22 22:18:16 +01:00
if ( StartTime - > GetTime ( ) > EndTime - > GetTime ( ) ) EndTime - > SetTime ( StartTime - > GetTime ( ) ) ;
2010-07-20 05:11:11 +02:00
CommitTimes ( TIME_START ) ;
2006-01-16 22:02:54 +01:00
}
2010-07-20 05:11:11 +02:00
void SubsEditBox : : OnEndTimeChange ( wxCommandEvent & ) {
2011-12-22 22:18:16 +01:00
if ( StartTime - > GetTime ( ) > EndTime - > GetTime ( ) ) StartTime - > SetTime ( EndTime - > GetTime ( ) ) ;
2010-07-20 05:11:11 +02:00
CommitTimes ( TIME_END ) ;
2006-01-16 22:02:54 +01:00
}
2010-07-20 05:11:11 +02:00
void SubsEditBox : : OnDurationChange ( wxCommandEvent & ) {
2011-12-22 22:18:16 +01:00
EndTime - > SetTime ( StartTime - > GetTime ( ) + Duration - > GetTime ( ) ) ;
2010-07-20 05:11:11 +02:00
CommitTimes ( TIME_DURATION ) ;
2006-01-16 22:02:54 +01:00
}
2010-07-20 05:11:11 +02:00
void SubsEditBox : : OnMarginLChange ( wxCommandEvent & ) {
2011-09-15 07:16:32 +02:00
SetSelectedRows ( std : : mem_fun ( & AssDialogue : : SetMarginString < 0 > ) , MarginL - > GetValue ( ) , _ ( " MarginL change " ) , AssFile : : COMMIT_DIAG_META ) ;
2011-07-15 06:04:54 +02:00
if ( line ) MarginL - > ChangeValue ( line - > GetMarginString ( 0 , false ) ) ;
2006-01-16 22:02:54 +01:00
}
2010-07-20 05:11:11 +02:00
void SubsEditBox : : OnMarginRChange ( wxCommandEvent & ) {
2011-09-15 07:16:32 +02:00
SetSelectedRows ( std : : mem_fun ( & AssDialogue : : SetMarginString < 1 > ) , MarginR - > GetValue ( ) , _ ( " MarginR change " ) , AssFile : : COMMIT_DIAG_META ) ;
2011-07-15 06:04:54 +02:00
if ( line ) MarginR - > ChangeValue ( line - > GetMarginString ( 1 , false ) ) ;
2006-01-16 22:02:54 +01:00
}
2010-07-20 05:11:11 +02:00
static void set_margin_v ( AssDialogue * diag , wxString value ) {
diag - > SetMarginString ( value , 2 ) ;
diag - > SetMarginString ( value , 3 ) ;
2006-01-16 22:02:54 +01:00
}
2010-07-20 05:11:11 +02:00
void SubsEditBox : : OnMarginVChange ( wxCommandEvent & ) {
2011-09-15 07:16:32 +02:00
SetSelectedRows ( set_margin_v , MarginV - > GetValue ( ) , _ ( " MarginV change " ) , AssFile : : COMMIT_DIAG_META ) ;
2011-07-15 06:04:54 +02:00
if ( line ) MarginV - > ChangeValue ( line - > GetMarginString ( 2 , false ) ) ;
2006-01-16 22:02:54 +01:00
}
2010-07-20 05:11:11 +02:00
void SubsEditBox : : OnEffectChange ( wxCommandEvent & ) {
2011-09-15 07:16:32 +02:00
SetSelectedRows ( & AssDialogue : : Effect , Effect - > GetValue ( ) , _ ( " effect change " ) , AssFile : : COMMIT_DIAG_META ) ;
2006-06-27 06:13:34 +02:00
}
2011-12-22 22:09:31 +01:00
void SubsEditBox : : OnCommentChange ( wxCommandEvent & ) {
2011-09-15 07:16:32 +02:00
SetSelectedRows ( & AssDialogue : : Comment , CommentBox - > GetValue ( ) , _ ( " comment change " ) , AssFile : : COMMIT_DIAG_META ) ;
2006-01-16 22:02:54 +01:00
}
2011-10-19 05:24:10 +02:00
int SubsEditBox : : BlockAtPos ( wxString const & text , int pos ) const {
int n = 0 ;
int max = text . size ( ) - 1 ;
for ( int i = 0 ; i < = pos & & i < = max ; + + i ) {
if ( i > 0 & & text [ i ] = = ' { ' )
n + + ;
if ( text [ i ] = = ' } ' & & i ! = max & & i ! = pos & & i ! = pos - 1 & & ( i + 1 = = max | | text [ i + 1 ] ! = ' { ' ) )
n + + ;
2006-01-16 22:02:54 +01:00
}
2010-07-20 05:11:11 +02:00
return n ;
2006-01-16 22:02:54 +01:00
}
2010-07-20 05:11:11 +02:00
void SubsEditBox : : SetTag ( wxString tag , wxString value , bool atEnd ) {
assert ( line ) ;
if ( line - > Blocks . empty ( ) )
line - > ParseASSTags ( ) ;
2006-01-16 22:02:54 +01:00
2010-07-20 05:11:11 +02:00
int selstart , selend ;
get_selection ( TextEdit , selstart , selend ) ;
int start = atEnd ? selend : selstart ;
2011-10-19 05:24:10 +02:00
int blockn = BlockAtPos ( line - > Text , start ) ;
2011-11-18 05:06:03 +01:00
AssDialogueBlockPlain * plain = 0 ;
AssDialogueBlockOverride * ovr = 0 ;
2011-10-19 05:24:10 +02:00
while ( blockn > = 0 ) {
AssDialogueBlock * block = line - > Blocks [ blockn ] ;
if ( dynamic_cast < AssDialogueBlockDrawing * > ( block ) )
- - blockn ;
2011-11-07 07:18:34 +01:00
else if ( ( plain = dynamic_cast < AssDialogueBlockPlain * > ( block ) ) ) {
2011-10-19 05:24:10 +02:00
// Cursor is in a comment block, so try the previous block instead
if ( plain - > GetText ( ) . StartsWith ( " { " ) ) {
- - blockn ;
start = line - > Text . rfind ( ' { ' , start ) ;
}
else
break ;
}
else {
ovr = dynamic_cast < AssDialogueBlockOverride * > ( block ) ;
assert ( ovr ) ;
break ;
}
2010-06-26 13:32:16 +02:00
}
2009-04-26 03:02:23 +02:00
2011-10-19 05:24:10 +02:00
// If we didn't hit a suitable block for inserting the override just put
// it at the beginning of the line
if ( blockn < 0 )
start = 0 ;
2010-07-20 05:11:11 +02:00
wxString insert = tag + value ;
int shift = insert . size ( ) ;
2011-10-19 05:24:10 +02:00
if ( plain | | blockn < 0 ) {
2010-07-20 05:11:11 +02:00
line - > Text = line - > Text . Left ( start ) + " { " + insert + " } " + line - > Text . Mid ( start ) ;
shift + = 2 ;
line - > ParseASSTags ( ) ;
2007-06-30 22:00:07 +02:00
}
2011-10-19 05:24:10 +02:00
else {
2010-07-20 05:11:11 +02:00
wxString alt ;
2011-09-28 21:43:11 +02:00
if ( tag = = " \\ c " ) alt = " \\ 1c " ;
2010-07-20 05:11:11 +02:00
// Remove old of same
bool found = false ;
for ( size_t i = 0 ; i < ovr - > Tags . size ( ) ; i + + ) {
wxString name = ovr - > Tags [ i ] - > Name ;
if ( tag = = name | | alt = = name ) {
shift - = ( ( wxString ) * ovr - > Tags [ i ] ) . size ( ) ;
if ( found ) {
delete ovr - > Tags [ i ] ;
ovr - > Tags . erase ( ovr - > Tags . begin ( ) + i ) ;
i - - ;
}
else {
ovr - > Tags [ i ] - > Params [ 0 ] - > Set ( value ) ;
2010-10-08 08:06:44 +02:00
ovr - > Tags [ i ] - > Params [ 0 ] - > omitted = false ;
2010-07-20 05:11:11 +02:00
found = true ;
}
2009-04-26 03:02:23 +02:00
}
}
2010-07-20 05:11:11 +02:00
if ( ! found ) {
ovr - > AddTag ( insert ) ;
2007-01-08 06:32:29 +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
2010-07-20 05:11:11 +02:00
line - > UpdateText ( ) ;
2006-01-16 22:02:54 +01:00
}
2010-07-20 05:11:11 +02:00
TextEdit - > SetTextTo ( line - > Text ) ;
if ( ! atEnd ) TextEdit - > SetSelectionU ( selstart + shift , selend + shift ) ;
TextEdit - > SetFocus ( ) ;
2006-01-16 22:02:54 +01:00
}
2010-07-20 05:11:11 +02:00
void SubsEditBox : : OnFlagButton ( wxCommandEvent & evt ) {
int id = evt . GetId ( ) ;
assert ( id < BUTTON_LAST & & id > = BUTTON_FIRST ) ;
2006-01-16 22:02:54 +01:00
2010-07-20 05:11:11 +02:00
wxString tagname ;
wxString desc ;
2006-02-19 05:55:10 +01:00
bool state = false ;
2011-01-16 08:17:36 +01:00
AssStyle * style = c - > ass - > GetStyle ( line - > Style ) ;
2006-01-16 22:02:54 +01:00
AssStyle defStyle ;
2010-07-20 05:11:11 +02:00
if ( ! style ) style = & defStyle ;
if ( id = = BUTTON_BOLD ) {
2011-09-28 21:43:11 +02:00
tagname = " \\ b " ;
2010-07-20 05:11:11 +02:00
desc = _ ( " toggle bold " ) ;
2006-02-19 05:55:10 +01:00
state = style - > bold ;
}
2010-07-20 05:11:11 +02:00
else if ( id = = BUTTON_ITALICS ) {
2011-09-28 21:43:11 +02:00
tagname = " \\ i " ;
2010-07-20 05:11:11 +02:00
desc = _ ( " toggle italic " ) ;
2006-02-19 05:55:10 +01:00
state = style - > italic ;
}
2010-07-20 05:11:11 +02:00
else if ( id = = BUTTON_UNDERLINE ) {
2011-09-28 21:43:11 +02:00
tagname = " \\ u " ;
2010-07-20 05:11:11 +02:00
desc = _ ( " toggle underline " ) ;
2006-02-19 05:55:10 +01:00
state = style - > underline ;
}
2010-07-20 05:11:11 +02:00
else if ( id = = BUTTON_STRIKEOUT ) {
2011-09-28 21:43:11 +02:00
tagname = " \\ s " ;
2010-07-20 05:11:11 +02:00
desc = _ ( " toggle strikeout " ) ;
2006-02-19 05:55:10 +01:00
state = style - > strikeout ;
2006-01-16 22:02:54 +01:00
}
2010-07-20 05:11:11 +02:00
else {
return ;
2006-01-16 22:02:54 +01:00
}
2010-07-20 05:11:11 +02:00
line - > ParseASSTags ( ) ;
int selstart , selend ;
get_selection ( TextEdit , selstart , selend ) ;
2011-10-19 05:24:10 +02:00
int blockn = BlockAtPos ( line - > Text , selstart ) ;
2007-01-15 20:44:48 +01:00
2010-07-20 05:11:11 +02:00
state = get_value ( * line , blockn , state , tagname ) ;
2006-02-19 05:55:10 +01:00
2010-07-20 05:11:11 +02:00
SetTag ( tagname , wxString : : Format ( " %i " , ! state ) ) ;
if ( selend ! = selstart ) {
SetTag ( tagname , wxString : : Format ( " %i " , state ) , true ) ;
2006-02-19 05:55:10 +01:00
}
2006-01-16 22:02:54 +01:00
2010-07-20 05:11:11 +02:00
line - > ClearBlocks ( ) ;
commitId = - 1 ;
CommitText ( desc ) ;
}
void SubsEditBox : : OnFontButton ( wxCommandEvent & ) {
int selstart , selend ;
get_selection ( TextEdit , selstart , selend ) ;
2006-01-16 22:02:54 +01:00
2010-07-20 05:11:11 +02:00
line - > ParseASSTags ( ) ;
2011-10-19 05:24:10 +02:00
int blockn = BlockAtPos ( line - > Text , selstart ) ;
2006-01-16 22:02:54 +01:00
2010-07-20 05:11:11 +02:00
wxFont startfont ;
2011-01-16 08:17:36 +01:00
AssStyle * style = c - > ass - > GetStyle ( line - > Style ) ;
2010-07-20 05:11:11 +02:00
AssStyle defStyle ;
if ( ! style ) style = & defStyle ;
2006-01-16 22:02:54 +01:00
2011-09-28 21:43:11 +02:00
startfont . SetFaceName ( get_value ( * line , blockn , style - > font , " \\ fn " ) ) ;
startfont . SetPointSize ( get_value ( * line , blockn , ( int ) style - > fontsize , " \\ fs " ) ) ;
startfont . SetWeight ( get_value ( * line , blockn , style - > bold , " \\ b " ) ? wxFONTWEIGHT_BOLD : wxFONTWEIGHT_NORMAL ) ;
startfont . SetStyle ( get_value ( * line , blockn , style - > italic , " \\ i " ) ? wxFONTSTYLE_ITALIC : wxFONTSTYLE_NORMAL ) ;
startfont . SetUnderlined ( get_value ( * line , blockn , style - > underline , " \\ u " ) ) ;
2006-01-16 22:02:54 +01:00
2010-07-20 05:11:11 +02:00
wxFont font = wxGetFontFromUser ( this , startfont ) ;
if ( ! font . Ok ( ) | | font = = startfont ) {
line - > ClearBlocks ( ) ;
return ;
2006-01-16 22:02:54 +01:00
}
2010-07-20 05:11:11 +02:00
if ( font . GetFaceName ( ) ! = startfont . GetFaceName ( ) ) {
2011-09-28 21:43:11 +02:00
SetTag ( " \\ fn " , font . GetFaceName ( ) ) ;
2006-01-16 22:02:54 +01:00
}
2010-07-20 05:11:11 +02:00
if ( font . GetPointSize ( ) ! = startfont . GetPointSize ( ) ) {
2011-09-28 21:43:11 +02:00
SetTag ( " \\ fs " , wxString : : Format ( " %i " , font . GetPointSize ( ) ) ) ;
2006-01-16 22:02:54 +01:00
}
2010-07-20 05:11:11 +02:00
if ( font . GetWeight ( ) ! = startfont . GetWeight ( ) ) {
2011-09-28 21:43:11 +02:00
SetTag ( " \\ b " , wxString : : Format ( " %i " , font . GetWeight ( ) = = wxFONTWEIGHT_BOLD ) ) ;
2006-01-16 22:02:54 +01:00
}
2010-07-20 05:11:11 +02:00
if ( font . GetStyle ( ) ! = startfont . GetStyle ( ) ) {
2011-09-28 21:43:11 +02:00
SetTag ( " \\ i " , wxString : : Format ( " %i " , font . GetStyle ( ) = = wxFONTSTYLE_ITALIC ) ) ;
2010-07-20 05:11:11 +02:00
}
if ( font . GetUnderlined ( ) ! = startfont . GetUnderlined ( ) ) {
2011-09-28 21:43:11 +02:00
SetTag ( " \\ i " , wxString : : Format ( " %i " , font . GetUnderlined ( ) ) ) ;
2010-07-20 05:11:11 +02:00
}
line - > ClearBlocks ( ) ;
commitId = - 1 ;
CommitText ( _ ( " set font " ) ) ;
2007-06-30 22:00:07 +02:00
}
2010-07-20 05:11:11 +02:00
void SubsEditBox : : OnColorButton ( wxCommandEvent & evt ) {
int id = evt . GetId ( ) ;
assert ( id < BUTTON_LAST & & id > = BUTTON_FIRST ) ;
wxString alt ;
2007-06-30 22:00:07 +02:00
2010-07-20 05:11:11 +02:00
wxColor color ;
2011-01-16 08:17:36 +01:00
AssStyle * style = c - > ass - > GetStyle ( line - > Style ) ;
2010-07-20 05:11:11 +02:00
AssStyle defStyle ;
if ( ! style ) style = & defStyle ;
if ( id = = BUTTON_COLOR1 ) {
color = style - > primary . GetWXColor ( ) ;
2011-09-28 21:43:11 +02:00
colorTag = " \\ c " ;
alt = " \\ c1 " ;
2010-07-20 05:11:11 +02:00
}
else if ( id = = BUTTON_COLOR2 ) {
color = style - > secondary . GetWXColor ( ) ;
2011-09-28 21:43:11 +02:00
colorTag = " \\ 2c " ;
2010-07-20 05:11:11 +02:00
}
else if ( id = = BUTTON_COLOR3 ) {
color = style - > outline . GetWXColor ( ) ;
2011-09-28 21:43:11 +02:00
colorTag = " \\ 3c " ;
2010-07-20 05:11:11 +02:00
}
else if ( id = = BUTTON_COLOR4 ) {
color = style - > shadow . GetWXColor ( ) ;
2011-09-28 21:43:11 +02:00
colorTag = " \\ 4c " ;
2010-07-20 05:11:11 +02:00
}
else {
return ;
2010-06-26 13:32:16 +02:00
}
2010-07-20 05:11:11 +02:00
commitId = - 1 ;
2010-06-26 13:32:16 +02:00
2010-07-20 05:11:11 +02:00
line - > ParseASSTags ( ) ;
int selstart , selend ;
get_selection ( TextEdit , selstart , selend ) ;
2011-10-19 05:24:10 +02:00
int blockn = BlockAtPos ( line - > Text , selstart ) ;
2010-06-26 13:32:16 +02:00
2010-07-20 05:11:11 +02:00
color = get_value ( * line , blockn , color , colorTag , alt ) ;
wxString initialText = line - > Text ;
2011-01-16 08:17:36 +01:00
wxColor newColor = GetColorFromUser < SubsEditBox , & SubsEditBox : : SetColorCallback > ( c - > parent , color , this ) ;
2010-07-20 05:11:11 +02:00
if ( newColor = = color ) {
TextEdit - > SetTextTo ( initialText ) ;
TextEdit - > SetSelectionU ( selstart , selend ) ;
2010-06-26 13:32:16 +02:00
}
2010-07-20 05:11:11 +02:00
line - > ClearBlocks ( ) ;
CommitText ( _ ( " set color " ) ) ;
2010-06-26 13:32:16 +02:00
}
2010-07-20 05:11:11 +02:00
void SubsEditBox : : SetColorCallback ( wxColor newColor ) {
if ( newColor . Ok ( ) ) {
SetTag ( colorTag , AssColor ( newColor ) . GetASSFormatted ( false ) ) ;
CommitText ( _ ( " set color " ) ) ;
}
2010-06-26 13:32:16 +02:00
}