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.
//
// -----------------------------------------------------------------------------
//
// AEGISUB
//
// Website: http://aegisub.cellosoft.com
// Contact: mailto:zeratul@cellosoft.com
//
////////////
// Includes
2009-01-04 07:31:48 +01:00
# include "config.h"
2006-04-04 22:41:09 +02:00
# include <wx/fontdlg.h>
# include <wx/colordlg.h>
2007-05-21 05:59:46 +02:00
# include <wx/fontenum.h>
2006-01-16 22:02:54 +01:00
# include "dialog_style_editor.h"
2006-12-17 21:16:22 +01:00
# include "ass_dialogue.h"
2006-01-16 22:02:54 +01:00
# include "ass_style.h"
# include "ass_file.h"
2006-12-17 21:16:22 +01:00
# include "ass_override.h"
2006-01-16 22:02:54 +01:00
# include "validators.h"
# include "subs_grid.h"
2006-04-04 22:41:09 +02:00
# include "utils.h"
2006-01-16 22:02:54 +01:00
# include "dialog_colorpicker.h"
2007-01-02 23:10:45 +01:00
# include "colour_button.h"
2007-04-16 06:26:42 +02:00
# include "subs_preview.h"
2007-04-17 01:41:06 +02:00
# include "options.h"
2008-03-07 22:00:20 +01:00
# include "subtitles_provider_manager.h"
2007-07-27 08:14:38 +02:00
# include "ass_style_storage.h"
2008-01-13 22:27:06 +01:00
# include "help_button.h"
2009-07-24 02:08:25 +02:00
# include "libresrc/libresrc.h"
2007-04-17 01:41:06 +02:00
///////
// IDs
enum {
BUTTON_STYLE_FONT = 1050 ,
CHECKBOX_STYLE_BOLD ,
CHECKBOX_STYLE_ITALIC ,
CHECKBOX_STYLE_UNDERLINE ,
CHECKBOX_STYLE_STRIKEOUT ,
2007-04-17 01:59:38 +02:00
CHECKBOX_OUTLINE ,
2007-04-17 01:41:06 +02:00
BUTTON_COLOR_1 ,
BUTTON_COLOR_2 ,
BUTTON_COLOR_3 ,
BUTTON_COLOR_4 ,
2007-05-21 06:53:14 +02:00
BUTTON_PREVIEW_COLOR ,
2007-04-17 01:41:06 +02:00
RADIO_ALIGNMENT ,
TEXT_FONT_NAME ,
TEXT_FONT_SIZE ,
TEXT_ALPHA_1 ,
TEXT_ALPHA_2 ,
TEXT_ALPHA_3 ,
TEXT_ALPHA_4 ,
TEXT_MARGIN_L ,
TEXT_MARGIN_R ,
TEXT_MARGIN_V ,
TEXT_OUTLINE ,
TEXT_SHADOW ,
TEXT_SCALE_X ,
TEXT_SCALE_Y ,
TEXT_ANGLE ,
TEXT_SPACING ,
2007-04-17 01:59:38 +02:00
TEXT_PREVIEW ,
COMBO_ENCODING
2007-04-17 01:41:06 +02:00
} ;
2006-01-16 22:02:54 +01:00
///////////////
// Constructor
2007-07-27 08:14:38 +02:00
DialogStyleEditor : : DialogStyleEditor ( wxWindow * parent , AssStyle * _style , SubtitlesGrid * _grid , bool local , AssStyleStorage * _store )
2007-04-16 06:26:42 +02:00
: wxDialog ( parent , - 1 , _ ( " Style Editor " ) , wxDefaultPosition , wxDefaultSize , wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER , _T ( " DialogStyleEditor " ) )
2006-01-16 22:02:54 +01:00
{
2007-07-05 01:09:40 +02:00
// Set icon
2009-07-24 01:38:04 +02:00
SetIcon ( BitmapToIcon ( wxBitmap ( style_toolbutton_xpm ) ) ) ;
2007-07-05 01:09:40 +02:00
2007-07-27 08:14:38 +02:00
// Set variables
isLocal = local ;
store = _store ;
2006-01-16 22:02:54 +01:00
// Set styles
grid = _grid ;
style = _style ;
work = new AssStyle ;
* work = * style ;
2007-04-17 00:13:09 +02:00
// Prepare control values
2009-04-06 22:01:42 +02:00
FontSizeValue = AegiFloatToString ( style - > fontsize ) ;
OutlineValue = AegiFloatToString ( style - > outline_w ) ;
ShadowValue = AegiFloatToString ( style - > shadow_w ) ;
ScaleXValue = AegiFloatToString ( style - > scalex ) ;
ScaleYValue = AegiFloatToString ( style - > scaley ) ;
AngleValue = AegiFloatToString ( style - > angle ) ;
EncodingValue = AegiIntegerToString ( style - > encoding ) ;
SpacingValue = AegiFloatToString ( style - > spacing ) ;
2007-04-17 00:13:09 +02:00
wxString alignValues [ 9 ] = { _T ( " 7 " ) , _T ( " 8 " ) , _T ( " 9 " ) , _T ( " 4 " ) , _T ( " 5 " ) , _T ( " 6 " ) , _T ( " 1 " ) , _T ( " 2 " ) , _T ( " 3 " ) } ;
2007-05-21 05:59:46 +02:00
wxArrayString fontList = wxFontEnumerator : : GetFacenames ( ) ;
fontList . Sort ( ) ;
2006-01-16 22:02:54 +01:00
2007-04-17 00:13:09 +02:00
// Encoding options
wxArrayString encodingStrings ;
AssStyle : : GetEncodings ( encodingStrings ) ;
2007-09-24 19:04:13 +02:00
// Create sizers
wxSizer * NameSizer = new wxStaticBoxSizer ( wxHORIZONTAL , this , _ ( " Style name " ) ) ;
wxSizer * FontSizer = new wxStaticBoxSizer ( wxVERTICAL , this , _ ( " Font " ) ) ;
wxSizer * ColorsSizer = new wxStaticBoxSizer ( wxHORIZONTAL , this , _ ( " Colors " ) ) ;
wxSizer * MarginSizer = new wxStaticBoxSizer ( wxHORIZONTAL , this , _ ( " Margins " ) ) ;
wxSizer * OutlineBox = new wxStaticBoxSizer ( wxHORIZONTAL , this , _ ( " Outline " ) ) ;
2008-07-22 02:33:25 +02:00
wxSizer * MiscBox = new wxStaticBoxSizer ( wxVERTICAL , this , _ ( " Miscellaneous " ) ) ;
2007-09-24 19:04:13 +02:00
wxSizer * PreviewBox = new wxStaticBoxSizer ( wxVERTICAL , this , _ ( " Preview " ) ) ;
2007-04-17 00:13:09 +02:00
// Create controls
StyleName = new wxTextCtrl ( this , - 1 , style - > name ) ;
2008-01-16 01:34:39 +01:00
FontName = new wxComboBox ( this , TEXT_FONT_NAME , style - > font , wxDefaultPosition , wxSize ( 150 , - 1 ) , 0 , 0 , wxCB_DROPDOWN ) ;
2007-09-21 18:20:00 +02:00
FontSize = new wxTextCtrl ( this , TEXT_FONT_SIZE , _T ( " " ) , wxDefaultPosition , wxSize ( 50 , - 1 ) , 0 , NumValidator ( & FontSizeValue , true , false ) ) ;
2006-01-16 22:02:54 +01:00
BoxBold = new wxCheckBox ( this , CHECKBOX_STYLE_BOLD , _ ( " Bold " ) ) ;
BoxItalic = new wxCheckBox ( this , CHECKBOX_STYLE_ITALIC , _ ( " Italic " ) ) ;
BoxUnderline = new wxCheckBox ( this , CHECKBOX_STYLE_UNDERLINE , _ ( " Underline " ) ) ;
BoxStrikeout = new wxCheckBox ( this , CHECKBOX_STYLE_STRIKEOUT , _ ( " Strikeout " ) ) ;
2007-05-21 08:03:09 +02:00
colorButton [ 0 ] = new ColourButton ( this , BUTTON_COLOR_1 , wxSize ( 55 , 16 ) , style - > primary . GetWXColor ( ) ) ;
colorButton [ 1 ] = new ColourButton ( this , BUTTON_COLOR_2 , wxSize ( 55 , 16 ) , style - > secondary . GetWXColor ( ) ) ;
colorButton [ 2 ] = new ColourButton ( this , BUTTON_COLOR_3 , wxSize ( 55 , 16 ) , style - > outline . GetWXColor ( ) ) ;
colorButton [ 3 ] = new ColourButton ( this , BUTTON_COLOR_4 , wxSize ( 55 , 16 ) , style - > shadow . GetWXColor ( ) ) ;
2009-04-06 22:01:42 +02:00
colorAlpha [ 0 ] = new wxSpinCtrl ( this , TEXT_ALPHA_1 , AegiFloatToString ( style - > primary . a ) , wxDefaultPosition , wxSize ( 60 , - 1 ) , wxSP_ARROW_KEYS , 0 , 255 , style - > primary . a ) ;
colorAlpha [ 1 ] = new wxSpinCtrl ( this , TEXT_ALPHA_2 , AegiFloatToString ( style - > secondary . a ) , wxDefaultPosition , wxSize ( 60 , - 1 ) , wxSP_ARROW_KEYS , 0 , 255 , style - > secondary . a ) ;
colorAlpha [ 2 ] = new wxSpinCtrl ( this , TEXT_ALPHA_3 , AegiFloatToString ( style - > outline . a ) , wxDefaultPosition , wxSize ( 60 , - 1 ) , wxSP_ARROW_KEYS , 0 , 255 , style - > outline . a ) ;
colorAlpha [ 3 ] = new wxSpinCtrl ( this , TEXT_ALPHA_4 , AegiFloatToString ( style - > shadow . a ) , wxDefaultPosition , wxSize ( 60 , - 1 ) , wxSP_ARROW_KEYS , 0 , 255 , style - > shadow . a ) ;
for ( int i = 0 ; i < 3 ; i + + ) margin [ i ] = new wxSpinCtrl ( this , TEXT_MARGIN_L + i , AegiFloatToString ( style - > Margin [ i ] ) , wxDefaultPosition , wxSize ( 60 , - 1 ) , wxSP_ARROW_KEYS , 0 , 9999 , style - > Margin [ i ] ) ;
2007-05-22 07:53:08 +02:00
margin [ 3 ] = 0 ;
2007-04-17 00:13:09 +02:00
Alignment = new wxRadioBox ( this , RADIO_ALIGNMENT , _ ( " Alignment " ) , wxDefaultPosition , wxDefaultSize , 9 , alignValues , 3 , wxRA_SPECIFY_COLS ) ;
2007-06-17 23:12:28 +02:00
Outline = new wxTextCtrl ( this , TEXT_OUTLINE , _T ( " " ) , wxDefaultPosition , wxSize ( 40 , 20 ) , 0 , NumValidator ( & OutlineValue , true , false ) ) ;
Shadow = new wxTextCtrl ( this , TEXT_SHADOW , _T ( " " ) , wxDefaultPosition , wxSize ( 40 , 20 ) , 0 , NumValidator ( & ShadowValue , true , false ) ) ;
2007-04-17 01:59:38 +02:00
OutlineType = new wxCheckBox ( this , CHECKBOX_OUTLINE , _ ( " Opaque box " ) ) ;
2007-06-17 23:12:28 +02:00
ScaleX = new wxTextCtrl ( this , TEXT_SCALE_X , _T ( " " ) , wxDefaultPosition , wxSize ( 70 , 20 ) , 0 , NumValidator ( & ScaleXValue , true , false ) ) ;
ScaleY = new wxTextCtrl ( this , TEXT_SCALE_Y , _T ( " " ) , wxDefaultPosition , wxSize ( 70 , 20 ) , 0 , NumValidator ( & ScaleYValue , true , false ) ) ;
Angle = new wxTextCtrl ( this , TEXT_ANGLE , _T ( " " ) , wxDefaultPosition , wxSize ( 40 , 20 ) , 0 , NumValidator ( & AngleValue , true , true ) ) ;
Spacing = new wxTextCtrl ( this , TEXT_SPACING , _T ( " " ) , wxDefaultPosition , wxSize ( 40 , 20 ) , 0 , NumValidator ( & SpacingValue , true , true ) ) ;
2007-04-17 01:59:38 +02:00
Encoding = new wxComboBox ( this , COMBO_ENCODING , _T ( " " ) , wxDefaultPosition , wxDefaultSize , encodingStrings , wxCB_READONLY ) ;
2007-04-17 00:13:09 +02:00
// Set control tooltips
2007-05-21 08:03:09 +02:00
StyleName - > SetToolTip ( _ ( " Style name. " ) ) ;
FontName - > SetToolTip ( _ ( " Font face. " ) ) ;
FontSize - > SetToolTip ( _ ( " Font size. " ) ) ;
2007-07-05 17:23:31 +02:00
colorButton [ 0 ] - > SetToolTip ( _ ( " Choose primary color. " ) ) ;
colorButton [ 1 ] - > SetToolTip ( _ ( " Choose secondary color. " ) ) ;
colorButton [ 2 ] - > SetToolTip ( _ ( " Choose outline color. " ) ) ;
colorButton [ 3 ] - > SetToolTip ( _ ( " Choose shadow color. " ) ) ;
2007-05-21 08:03:09 +02:00
for ( int i = 0 ; i < 4 ; i + + ) colorAlpha [ i ] - > SetToolTip ( _ ( " Set opacity, from 0 (opaque) to 255 (transparent). " ) ) ;
margin [ 0 ] - > SetToolTip ( _ ( " Distance from left edge, in pixels. " ) ) ;
margin [ 1 ] - > SetToolTip ( _ ( " Distance from right edge, in pixels. " ) ) ;
margin [ 2 ] - > SetToolTip ( _ ( " Distance from top/bottom edge, in pixels. " ) ) ;
2007-07-05 17:23:31 +02:00
OutlineType - > SetToolTip ( _ ( " When selected, display an opaque box behind the subtitles instead of an outline around the text. " ) ) ;
2007-05-21 08:03:09 +02:00
Outline - > SetToolTip ( _ ( " Outline width, in pixels. " ) ) ;
Shadow - > SetToolTip ( _ ( " Shadow distance, in pixels. " ) ) ;
ScaleX - > SetToolTip ( _ ( " Scale X, in percentage. " ) ) ;
ScaleY - > SetToolTip ( _ ( " Scale Y, in percentage. " ) ) ;
Angle - > SetToolTip ( _ ( " Angle to rotate in Z axis, in degrees. " ) ) ;
2007-04-17 00:13:09 +02:00
Encoding - > SetToolTip ( _ ( " Encoding, only useful in unicode if the font doesn't have the proper unicode mapping. " ) ) ;
2007-05-21 08:03:09 +02:00
Spacing - > SetToolTip ( _ ( " Character spacing, in pixels. " ) ) ;
Alignment - > SetToolTip ( _ ( " Alignment in screen, in numpad style. " ) ) ;
2007-04-17 00:13:09 +02:00
// Set up controls
2006-01-16 22:02:54 +01:00
BoxBold - > SetValue ( style - > bold ) ;
BoxItalic - > SetValue ( style - > italic ) ;
BoxUnderline - > SetValue ( style - > underline ) ;
BoxStrikeout - > SetValue ( style - > strikeout ) ;
2007-04-17 00:13:09 +02:00
OutlineType - > SetValue ( style - > borderstyle = = 3 ) ;
Alignment - > SetSelection ( AlignToControl ( style - > alignment ) ) ;
2007-06-06 23:42:32 +02:00
// Fill font face list box
FontName - > Freeze ( ) ;
for ( size_t i = 0 ; i < fontList . size ( ) ; i + + ) {
FontName - > Append ( fontList [ i ] ) ;
}
2008-07-16 14:10:00 +02:00
FontName - > SetValue ( style - > font ) ;
2007-06-06 23:42:32 +02:00
FontName - > Thaw ( ) ;
2007-04-17 00:13:09 +02:00
// Set encoding value
bool found = false ;
for ( size_t i = 0 ; i < encodingStrings . Count ( ) ; i + + ) {
2007-06-06 23:42:32 +02:00
if ( encodingStrings [ i ] . StartsWith ( EncodingValue ) ) {
2007-04-17 00:13:09 +02:00
Encoding - > Select ( i ) ;
found = true ;
break ;
}
}
if ( ! found ) Encoding - > Select ( 0 ) ;
// Style name sizer
NameSizer - > Add ( StyleName , 1 , wxALL , 0 ) ;
// Font sizer
wxSizer * FontSizerTop = new wxBoxSizer ( wxHORIZONTAL ) ;
wxSizer * FontSizerBottom = new wxBoxSizer ( wxHORIZONTAL ) ;
2006-01-16 22:02:54 +01:00
FontSizerTop - > Add ( FontName , 1 , wxALL , 0 ) ;
FontSizerTop - > Add ( FontSize , 0 , wxLEFT , 5 ) ;
FontSizerBottom - > AddStretchSpacer ( 1 ) ;
FontSizerBottom - > Add ( BoxBold , 0 , 0 , 0 ) ;
FontSizerBottom - > Add ( BoxItalic , 0 , wxLEFT , 5 ) ;
FontSizerBottom - > Add ( BoxUnderline , 0 , wxLEFT , 5 ) ;
FontSizerBottom - > Add ( BoxStrikeout , 0 , wxLEFT , 5 ) ;
FontSizerBottom - > AddStretchSpacer ( 1 ) ;
FontSizer - > Add ( FontSizerTop , 1 , wxALL | wxEXPAND , 0 ) ;
FontSizer - > Add ( FontSizerBottom , 1 , wxTOP | wxEXPAND , 5 ) ;
2007-04-17 00:13:09 +02:00
// Colors sizer
2007-05-21 07:38:28 +02:00
wxSizer * ColorSizer [ 4 ] ;
wxString colorLabels [ ] = { _ ( " Primary " ) , _ ( " Secondary " ) , _ ( " Outline " ) , _ ( " Shadow " ) } ;
2006-01-16 22:02:54 +01:00
ColorsSizer - > AddStretchSpacer ( 1 ) ;
2007-05-21 07:38:28 +02:00
for ( int i = 0 ; i < 4 ; i + + ) {
ColorSizer [ i ] = new wxBoxSizer ( wxVERTICAL ) ;
ColorSizer [ i ] - > Add ( new wxStaticText ( this , - 1 , colorLabels [ i ] ) , 0 , wxBOTTOM | wxALIGN_CENTER , 5 ) ;
ColorSizer [ i ] - > Add ( colorButton [ i ] , 0 , wxBOTTOM | wxALIGN_CENTER , 5 ) ;
ColorSizer [ i ] - > Add ( colorAlpha [ i ] , 0 , wxALIGN_CENTER , 0 ) ;
ColorsSizer - > Add ( ColorSizer [ i ] , 0 , wxLEFT , i ? 5 : 0 ) ;
}
2006-01-16 22:02:54 +01:00
ColorsSizer - > AddStretchSpacer ( 1 ) ;
// Margins
2007-05-21 08:03:09 +02:00
wxString marginLabels [ ] = { _ ( " Left " ) , _ ( " Right " ) , _ ( " Vert " ) } ;
2006-01-16 22:02:54 +01:00
MarginSizer - > AddStretchSpacer ( 1 ) ;
2007-05-21 08:03:09 +02:00
wxSizer * marginSubSizer [ 3 ] ;
for ( int i = 0 ; i < 3 ; i + + ) {
marginSubSizer [ i ] = new wxBoxSizer ( wxVERTICAL ) ;
marginSubSizer [ i ] - > AddStretchSpacer ( 1 ) ;
marginSubSizer [ i ] - > Add ( new wxStaticText ( this , - 1 , marginLabels [ i ] ) , 0 , wxCENTER , 0 ) ;
marginSubSizer [ i ] - > Add ( margin [ i ] , 0 , wxTOP | wxCENTER , 5 ) ;
marginSubSizer [ i ] - > AddStretchSpacer ( 1 ) ;
MarginSizer - > Add ( marginSubSizer [ i ] , 0 , wxEXPAND | wxLEFT , i ? 5 : 0 ) ;
}
2006-01-16 22:02:54 +01:00
MarginSizer - > AddStretchSpacer ( 1 ) ;
// Margins+Alignment
wxSizer * MarginAlign = new wxBoxSizer ( wxHORIZONTAL ) ;
MarginAlign - > Add ( MarginSizer , 1 , wxLEFT | wxEXPAND , 0 ) ;
MarginAlign - > Add ( Alignment , 0 , wxLEFT | wxEXPAND , 5 ) ;
// Outline
OutlineBox - > AddStretchSpacer ( 1 ) ;
OutlineBox - > Add ( new wxStaticText ( this , - 1 , _ ( " Outline: " ) ) , 0 , wxALIGN_CENTER , 0 ) ;
OutlineBox - > Add ( Outline , 0 , wxLEFT | wxALIGN_CENTER , 5 ) ;
OutlineBox - > Add ( new wxStaticText ( this , - 1 , _ ( " Shadow: " ) ) , 0 , wxLEFT | wxALIGN_CENTER , 5 ) ;
OutlineBox - > Add ( Shadow , 0 , wxLEFT | wxALIGN_CENTER , 5 ) ;
OutlineBox - > Add ( OutlineType , 0 , wxLEFT | wxALIGN_CENTER , 5 ) ;
OutlineBox - > AddStretchSpacer ( 1 ) ;
// Misc
2007-04-16 17:08:09 +02:00
wxFlexGridSizer * MiscBoxTop = new wxFlexGridSizer ( 2 , 4 , 5 , 5 ) ;
2006-01-16 22:02:54 +01:00
wxSizer * MiscBoxBottom = new wxBoxSizer ( wxHORIZONTAL ) ;
2006-04-20 01:47:41 +02:00
MiscBoxTop - > Add ( new wxStaticText ( this , - 1 , _ ( " Scale X%: " ) ) , 1 , wxALIGN_CENTER , 0 ) ;
MiscBoxTop - > Add ( ScaleX , 0 , wxLEFT | wxALIGN_CENTER | wxEXPAND , 5 ) ;
MiscBoxTop - > Add ( new wxStaticText ( this , - 1 , _ ( " Scale Y%: " ) ) , 1 , wxLEFT | wxALIGN_CENTER , 5 ) ;
MiscBoxTop - > Add ( ScaleY , 0 , wxLEFT | wxALIGN_CENTER | wxEXPAND , 5 ) ;
2007-04-16 17:08:09 +02:00
MiscBoxTop - > Add ( new wxStaticText ( this , - 1 , _ ( " Rotation: " ) ) , 1 , wxALIGN_CENTER , 0 ) ;
2006-04-20 01:47:41 +02:00
MiscBoxTop - > Add ( Angle , 0 , wxLEFT | wxALIGN_CENTER | wxEXPAND , 5 ) ;
MiscBoxTop - > Add ( new wxStaticText ( this , - 1 , _ ( " Spacing: " ) ) , 1 , wxLEFT | wxALIGN_CENTER , 5 ) ;
MiscBoxTop - > Add ( Spacing , 0 , wxLEFT | wxALIGN_CENTER | wxEXPAND , 5 ) ;
2007-04-16 17:08:09 +02:00
MiscBoxTop - > AddGrowableCol ( 1 , 1 ) ;
MiscBoxTop - > AddGrowableCol ( 3 , 1 ) ;
2006-01-16 22:02:54 +01:00
MiscBoxBottom - > Add ( new wxStaticText ( this , - 1 , _ ( " Encoding: " ) ) , 0 , wxLEFT | wxALIGN_CENTER , 5 ) ;
2006-04-20 01:47:41 +02:00
MiscBoxBottom - > Add ( Encoding , 1 , wxLEFT | wxALIGN_CENTER , 5 ) ;
2007-04-16 06:26:42 +02:00
MiscBox - > Add ( MiscBoxTop , 0 , wxEXPAND | wxALIGN_CENTER , 0 ) ;
2007-04-16 17:08:09 +02:00
MiscBox - > Add ( MiscBoxBottom , 1 , wxEXPAND | wxTOP | wxALIGN_CENTER , 5 ) ;
2006-01-16 22:02:54 +01:00
2007-04-16 17:08:09 +02:00
// Preview
2007-06-06 23:27:42 +02:00
SubsPreview = NULL ;
PreviewText = NULL ;
2008-03-07 03:32:29 +01:00
if ( SubtitlesProviderFactoryManager : : ProviderAvailable ( ) ) {
2007-06-03 06:54:38 +02:00
PreviewText = new wxTextCtrl ( this , TEXT_PREVIEW , Options . AsText ( _T ( " Style editor preview text " ) ) ) ;
previewButton = new ColourButton ( this , BUTTON_PREVIEW_COLOR , wxSize ( 45 , 16 ) , Options . AsColour ( _T ( " Style editor preview background " ) ) ) ;
SubsPreview = new SubtitlesPreview ( this , - 1 , wxDefaultPosition , wxSize ( 100 , 60 ) , wxSUNKEN_BORDER , Options . AsColour ( _T ( " Style editor preview background " ) ) ) ;
SubsPreview - > SetToolTip ( _ ( " Preview of current style. " ) ) ;
SubsPreview - > SetStyle ( style ) ;
SubsPreview - > SetText ( PreviewText - > GetValue ( ) ) ;
PreviewText - > SetToolTip ( _ ( " Text to be used for the preview. " ) ) ;
previewButton - > SetToolTip ( _ ( " Colour of preview background. " ) ) ;
wxSizer * PreviewBottomSizer = new wxBoxSizer ( wxHORIZONTAL ) ;
PreviewBottomSizer - > Add ( PreviewText , 1 , wxEXPAND | wxRIGHT , 5 ) ;
PreviewBottomSizer - > Add ( previewButton , 0 , wxEXPAND , 0 ) ;
PreviewBox - > Add ( SubsPreview , 1 , wxEXPAND | wxBOTTOM , 5 ) ;
PreviewBox - > Add ( PreviewBottomSizer , 0 , wxEXPAND | wxBOTTOM , 0 ) ;
}
else {
wxStaticText * NoSP = new wxStaticText ( this , - 1 , _ ( " No subtitle providers available. Cannot preview subs. " ) ) ;
PreviewBox - > AddStretchSpacer ( ) ;
PreviewBox - > Add ( NoSP , 1 , wxEXPAND | wxLEFT | wxRIGHT , 8 ) ;
PreviewBox - > AddStretchSpacer ( ) ;
SubsPreview = NULL ;
PreviewText = NULL ;
}
2007-04-16 17:08:09 +02:00
2006-01-16 22:02:54 +01:00
// Buttons
2007-06-23 09:27:09 +02:00
wxStdDialogButtonSizer * ButtonSizer = new wxStdDialogButtonSizer ( ) ;
2007-04-08 02:21:56 +02:00
wxButton * okButton = new wxButton ( this , wxID_OK ) ;
okButton - > SetDefault ( ) ;
2007-06-23 09:27:09 +02:00
ButtonSizer - > AddButton ( new wxButton ( this , wxID_CANCEL ) ) ;
2007-08-16 01:17:42 +02:00
ButtonSizer - > AddButton ( new wxButton ( this , wxID_APPLY ) ) ;
2008-01-13 22:27:06 +01:00
ButtonSizer - > AddButton ( new HelpButton ( this , _T ( " Style Editor " ) ) ) ;
2007-06-23 09:27:09 +02:00
ButtonSizer - > AddButton ( okButton ) ;
ButtonSizer - > Realize ( ) ;
2007-06-03 06:54:38 +02:00
2007-04-16 06:26:42 +02:00
// Left side sizer
wxSizer * LeftSizer = new wxBoxSizer ( wxVERTICAL ) ;
LeftSizer - > Add ( NameSizer , 0 , wxBOTTOM | wxEXPAND , 5 ) ;
LeftSizer - > Add ( FontSizer , 0 , wxBOTTOM | wxEXPAND , 5 ) ;
LeftSizer - > Add ( ColorsSizer , 0 , wxBOTTOM | wxEXPAND , 5 ) ;
2007-04-16 17:08:09 +02:00
LeftSizer - > Add ( MarginAlign , 0 , wxBOTTOM | wxEXPAND , 0 ) ;
2007-04-16 06:26:42 +02:00
// Right side sizer
wxSizer * RightSizer = new wxBoxSizer ( wxVERTICAL ) ;
2007-04-16 17:08:09 +02:00
RightSizer - > Add ( OutlineBox , 0 , wxEXPAND | wxBOTTOM , 5 ) ;
RightSizer - > Add ( MiscBox , 0 , wxEXPAND | wxBOTTOM , 5 ) ;
RightSizer - > Add ( PreviewBox , 1 , wxEXPAND , 0 ) ;
2007-04-16 06:26:42 +02:00
// Controls Sizer
wxSizer * ControlSizer = new wxBoxSizer ( wxHORIZONTAL ) ;
ControlSizer - > Add ( LeftSizer , 0 , wxEXPAND , 0 ) ;
ControlSizer - > Add ( RightSizer , 1 , wxLEFT | wxEXPAND , 5 ) ;
2006-01-16 22:02:54 +01:00
// General Layout
MainSizer = new wxBoxSizer ( wxVERTICAL ) ;
2007-04-16 06:26:42 +02:00
MainSizer - > Add ( ControlSizer , 1 , wxALL | wxALIGN_CENTER | wxEXPAND , 5 ) ;
2007-06-23 09:27:09 +02:00
MainSizer - > Add ( ButtonSizer , 0 , wxBOTTOM | wxEXPAND , 5 ) ;
2006-01-16 22:02:54 +01:00
// Set sizer
MainSizer - > SetSizeHints ( this ) ;
2007-04-16 06:26:42 +02:00
SetSizer ( MainSizer ) ;
2009-06-05 04:02:55 +02:00
LoadPosition ( ) ;
2006-01-16 22:02:54 +01:00
}
//////////////
// Destructor
DialogStyleEditor : : ~ DialogStyleEditor ( ) {
delete work ;
}
///////////////
// Event table
BEGIN_EVENT_TABLE ( DialogStyleEditor , wxDialog )
EVT_BUTTON ( wxID_APPLY , DialogStyleEditor : : OnApply )
EVT_BUTTON ( wxID_OK , DialogStyleEditor : : OnOK )
EVT_BUTTON ( wxID_CANCEL , DialogStyleEditor : : OnCancel )
EVT_BUTTON ( BUTTON_COLOR_1 , DialogStyleEditor : : OnSetColor1 )
EVT_BUTTON ( BUTTON_COLOR_2 , DialogStyleEditor : : OnSetColor2 )
EVT_BUTTON ( BUTTON_COLOR_3 , DialogStyleEditor : : OnSetColor3 )
EVT_BUTTON ( BUTTON_COLOR_4 , DialogStyleEditor : : OnSetColor4 )
2007-05-21 06:53:14 +02:00
EVT_BUTTON ( BUTTON_PREVIEW_COLOR , DialogStyleEditor : : OnPreviewColourChange )
2007-04-17 01:59:38 +02:00
2007-04-17 01:41:06 +02:00
EVT_CHILD_FOCUS ( DialogStyleEditor : : OnChildFocus )
EVT_TEXT ( TEXT_PREVIEW , DialogStyleEditor : : OnPreviewTextChange )
2007-04-17 01:59:38 +02:00
EVT_CHECKBOX ( CHECKBOX_STYLE_BOLD , DialogStyleEditor : : OnCommandPreviewUpdate )
EVT_CHECKBOX ( CHECKBOX_STYLE_ITALIC , DialogStyleEditor : : OnCommandPreviewUpdate )
EVT_CHECKBOX ( CHECKBOX_STYLE_UNDERLINE , DialogStyleEditor : : OnCommandPreviewUpdate )
EVT_CHECKBOX ( CHECKBOX_STYLE_STRIKEOUT , DialogStyleEditor : : OnCommandPreviewUpdate )
EVT_CHECKBOX ( CHECKBOX_OUTLINE , DialogStyleEditor : : OnCommandPreviewUpdate )
EVT_COMBOBOX ( COMBO_ENCODING , DialogStyleEditor : : OnCommandPreviewUpdate )
2007-05-21 05:59:46 +02:00
EVT_COMBOBOX ( TEXT_FONT_NAME , DialogStyleEditor : : OnCommandPreviewUpdate )
2007-05-21 06:53:14 +02:00
EVT_TEXT_ENTER ( TEXT_FONT_NAME , DialogStyleEditor : : OnCommandPreviewUpdate )
2007-05-21 07:38:28 +02:00
EVT_SPINCTRL ( TEXT_ALPHA_1 , DialogStyleEditor : : OnSpinPreviewUpdate )
EVT_SPINCTRL ( TEXT_ALPHA_2 , DialogStyleEditor : : OnSpinPreviewUpdate )
EVT_SPINCTRL ( TEXT_ALPHA_3 , DialogStyleEditor : : OnSpinPreviewUpdate )
EVT_SPINCTRL ( TEXT_ALPHA_4 , DialogStyleEditor : : OnSpinPreviewUpdate )
2006-01-16 22:02:54 +01:00
END_EVENT_TABLE ( )
/////////////////////
// Event redirectors
void DialogStyleEditor : : OnApply ( wxCommandEvent & event ) { Apply ( true , false ) ; }
2009-06-05 04:02:55 +02:00
void DialogStyleEditor : : OnOK ( wxCommandEvent & event ) { SavePosition ( ) ; Apply ( true , true ) ; }
void DialogStyleEditor : : OnCancel ( wxCommandEvent & event ) { SavePosition ( ) ; Apply ( false , true ) ; }
2006-01-16 22:02:54 +01:00
void DialogStyleEditor : : OnSetColor1 ( wxCommandEvent & event ) { OnSetColor ( 1 ) ; }
void DialogStyleEditor : : OnSetColor2 ( wxCommandEvent & event ) { OnSetColor ( 2 ) ; }
void DialogStyleEditor : : OnSetColor3 ( wxCommandEvent & event ) { OnSetColor ( 3 ) ; }
void DialogStyleEditor : : OnSetColor4 ( wxCommandEvent & event ) { OnSetColor ( 4 ) ; }
2006-12-17 21:16:22 +01:00
/////////////////
// Replace Style
void ReplaceStyle ( wxString tag , int n , AssOverrideParameter * param , void * userData ) {
wxArrayString strings = * ( ( wxArrayString * ) userData ) ;
if ( tag = = _T ( " \\ r " ) ) {
if ( param - > GetType ( ) = = VARDATA_TEXT ) {
if ( param - > AsText ( ) = = strings [ 0 ] ) {
param - > SetText ( strings [ 1 ] ) ;
}
}
}
}
2006-01-16 22:02:54 +01:00
//////////
// Events
void DialogStyleEditor : : Apply ( bool apply , bool close ) {
// Apply
if ( apply ) {
2006-12-17 21:16:22 +01:00
// Style name
wxString newStyleName = StyleName - > GetValue ( ) ;
2006-12-17 21:30:59 +01:00
2007-07-27 08:14:38 +02:00
// Get list of existing styles
wxArrayString styles ;
if ( isLocal ) styles = grid - > ass - > GetStyles ( ) ;
else if ( store ) styles = store - > GetNames ( ) ;
2006-12-17 21:30:59 +01:00
// Check if style name is unique
for ( unsigned int i = 0 ; i < styles . Count ( ) ; i + + ) {
2009-07-18 05:45:16 +02:00
if ( newStyleName . CmpNoCase ( styles [ i ] ) = = 0 ) {
2009-07-18 05:58:22 +02:00
if ( ( isLocal & & ( grid - > ass - > GetStyle ( styles [ i ] ) ! = style ) ) | | ( ! isLocal & & ( store - > GetStyle ( styles [ i ] ) ! = style ) ) ) {
2009-07-24 04:10:41 +02:00
wxMessageBox ( _T ( " There is already a style with this name. Please choose another name. " ) , _T ( " Style name conflict. " ) , wxICON_ERROR | wxOK ) ;
2007-04-08 02:21:56 +02:00
return ;
2006-12-17 21:30:59 +01:00
}
}
}
// Style name change
2007-03-18 02:20:25 +01:00
if ( work - > name ! = newStyleName ) {
2007-07-27 08:14:38 +02:00
if ( ! work - > name . StartsWith ( _ ( " Copy of " ) ) & & isLocal ) {
2007-03-18 02:20:25 +01:00
// See if user wants to update style name through script
int answer = wxNO ;
2007-07-05 17:23:31 +02:00
if ( work - > name ! = _T ( " Default " ) ) answer = wxMessageBox ( _ ( " Do you want to change all instances of this style in the script to this new name? " ) , _ ( " Update script? " ) , wxYES_NO | wxCANCEL ) ;
2007-03-18 02:20:25 +01:00
// Cancel
if ( answer = = wxCANCEL ) return ;
// Update
if ( answer = = wxYES ) {
int n = grid - > GetRows ( ) ;
wxArrayString strings ;
strings . Add ( work - > name ) ;
strings . Add ( newStyleName ) ;
for ( int i = 0 ; i < n ; i + + ) {
AssDialogue * curDiag = grid - > GetDialogue ( i ) ;
if ( curDiag - > Style = = work - > name ) curDiag - > Style = newStyleName ;
curDiag - > ParseASSTags ( ) ;
curDiag - > ProcessParameters ( ReplaceStyle , & strings ) ;
curDiag - > UpdateText ( ) ;
curDiag - > UpdateData ( ) ;
curDiag - > ClearBlocks ( ) ;
}
2006-12-17 21:16:22 +01:00
}
}
// Change name
work - > name = newStyleName ;
}
2007-04-17 01:41:06 +02:00
// Update work style
UpdateWorkStyle ( ) ;
2006-04-20 01:47:41 +02:00
2006-01-16 22:02:54 +01:00
// Copy
* style = * work ;
style - > UpdateData ( ) ;
2007-07-27 08:14:38 +02:00
if ( isLocal ) {
AssFile : : top - > FlagAsModified ( _ ( " style change " ) ) ;
grid - > CommitChanges ( ) ;
}
2006-01-16 22:02:54 +01:00
// Exit
2007-04-17 01:41:06 +02:00
if ( close ) {
EndModal ( 1 ) ;
2007-06-03 06:54:38 +02:00
if ( PreviewText ) Options . SetText ( _T ( " Style editor preview text " ) , PreviewText - > GetValue ( ) ) ;
2007-04-17 01:41:06 +02:00
Options . Save ( ) ;
}
2007-04-16 06:26:42 +02:00
// Update preview
2007-06-03 06:54:38 +02:00
else if ( SubsPreview ) SubsPreview - > SetStyle ( style ) ;
2006-01-16 22:02:54 +01:00
}
// Close
else {
2007-04-17 01:41:06 +02:00
if ( close ) {
EndModal ( 0 ) ;
2007-06-03 06:54:38 +02:00
if ( PreviewText ) Options . SetText ( _T ( " Style editor preview text " ) , PreviewText - > GetValue ( ) ) ;
2007-04-17 01:41:06 +02:00
Options . Save ( ) ;
}
2006-01-16 22:02:54 +01:00
}
}
2007-04-17 01:41:06 +02:00
/////////////////////
// Update work style
void DialogStyleEditor : : UpdateWorkStyle ( ) {
// Font and its size
work - > font = FontName - > GetValue ( ) ;
FontSize - > GetValue ( ) . ToDouble ( & ( work - > fontsize ) ) ;
// Update scale
ScaleX - > GetValue ( ) . ToDouble ( & ( work - > scalex ) ) ;
ScaleY - > GetValue ( ) . ToDouble ( & ( work - > scaley ) ) ;
// Update encoding
long templ = 0 ;
wxString enc = Encoding - > GetValue ( ) ;
enc . Left ( enc . Find ( _T ( " - " ) ) - 1 ) . ToLong ( & templ ) ;
work - > encoding = templ ;
// Angle and spacing
Angle - > GetValue ( ) . ToDouble ( & ( work - > angle ) ) ;
Spacing - > GetValue ( ) . ToDouble ( & ( work - > spacing ) ) ;
// Outline type
if ( OutlineType - > IsChecked ( ) ) work - > borderstyle = 3 ;
else work - > borderstyle = 1 ;
// Shadow and outline
Shadow - > GetValue ( ) . ToDouble ( & ( work - > shadow_w ) ) ;
Outline - > GetValue ( ) . ToDouble ( & ( work - > outline_w ) ) ;
// Alignment
work - > alignment = ControlToAlign ( Alignment - > GetSelection ( ) ) ;
// Margins
2007-05-21 08:03:09 +02:00
for ( int i = 0 ; i < 3 ; i + + ) work - > Margin [ i ] = margin [ i ] - > GetValue ( ) ;
work - > Margin [ 3 ] = margin [ 2 ] - > GetValue ( ) ;
2007-04-17 01:41:06 +02:00
// Color alphas
2007-05-21 07:38:28 +02:00
work - > primary . a = colorAlpha [ 0 ] - > GetValue ( ) ;
work - > secondary . a = colorAlpha [ 1 ] - > GetValue ( ) ;
work - > outline . a = colorAlpha [ 2 ] - > GetValue ( ) ;
work - > shadow . a = colorAlpha [ 3 ] - > GetValue ( ) ;
2007-04-17 01:41:06 +02:00
// Bold/italic/underline/strikeout
work - > bold = BoxBold - > IsChecked ( ) ;
work - > italic = BoxItalic - > IsChecked ( ) ;
work - > underline = BoxUnderline - > IsChecked ( ) ;
work - > strikeout = BoxStrikeout - > IsChecked ( ) ;
}
2006-01-16 22:02:54 +01:00
///////////////////
// Choose font box
void DialogStyleEditor : : OnChooseFont ( wxCommandEvent & event ) {
2007-04-04 22:42:44 +02:00
wxFont oldfont ( int ( work - > fontsize ) , wxFONTFAMILY_DEFAULT , ( work - > italic ? wxFONTSTYLE_ITALIC : wxFONTSTYLE_NORMAL ) , ( work - > bold ? wxFONTWEIGHT_BOLD : wxFONTWEIGHT_NORMAL ) , work - > underline , work - > font , wxFONTENCODING_DEFAULT ) ;
2006-01-16 22:02:54 +01:00
wxFont newfont = wxGetFontFromUser ( this , oldfont ) ;
if ( newfont . Ok ( ) ) {
FontName - > SetValue ( newfont . GetFaceName ( ) ) ;
FontSize - > SetValue ( wxString : : Format ( _T ( " %i " ) , newfont . GetPointSize ( ) ) ) ;
BoxBold - > SetValue ( newfont . GetWeight ( ) = = wxFONTWEIGHT_BOLD ) ;
BoxItalic - > SetValue ( newfont . GetStyle ( ) = = wxFONTSTYLE_ITALIC ) ;
BoxUnderline - > SetValue ( newfont . GetUnderlined ( ) ) ;
work - > font = newfont . GetFaceName ( ) ;
work - > fontsize = newfont . GetPointSize ( ) ;
work - > bold = ( newfont . GetWeight ( ) = = wxFONTWEIGHT_BOLD ) ;
work - > italic = ( newfont . GetStyle ( ) = = wxFONTSTYLE_ITALIC ) ;
work - > underline = newfont . GetUnderlined ( ) ;
2007-04-17 01:59:38 +02:00
UpdateWorkStyle ( ) ;
2007-06-03 06:54:38 +02:00
if ( SubsPreview ) SubsPreview - > SetStyle ( work ) ;
2006-01-16 22:02:54 +01:00
// Comic sans warning
if ( newfont . GetFaceName ( ) = = _T ( " Comic Sans MS " ) ) {
wxMessageBox ( _ ( " You have chosen to use the \" Comic Sans \" font. As the programmer and a typesetter, \n I must urge you to reconsider. Comic Sans is the most abused font in the history \n of computing, so please avoid using it unless it's REALLY suitable. Thanks. " ) , _ ( " Warning " ) , wxICON_EXCLAMATION | wxOK ) ;
}
}
}
////////////////////////////////////////////////
// Sets color for one of the four color buttons
void DialogStyleEditor : : OnSetColor ( int n ) {
AssColor * modify ;
switch ( n ) {
case 1 : modify = & work - > primary ; break ;
case 2 : modify = & work - > secondary ; break ;
case 3 : modify = & work - > outline ; break ;
case 4 : modify = & work - > shadow ; break ;
2007-07-18 15:46:38 +02:00
default : throw _T ( " Internal error in style editor, attempted setting colour id outside range " ) ;
2006-01-16 22:02:54 +01:00
}
2007-01-02 23:10:45 +01:00
modify - > SetWXColor ( colorButton [ n - 1 ] - > GetColour ( ) ) ;
2007-06-03 06:54:38 +02:00
if ( SubsPreview ) SubsPreview - > SetStyle ( work ) ;
2007-04-17 01:41:06 +02:00
}
//////////////////////
// Child focus change
void DialogStyleEditor : : OnChildFocus ( wxChildFocusEvent & event ) {
UpdateWorkStyle ( ) ;
2007-06-03 06:54:38 +02:00
if ( SubsPreview ) SubsPreview - > SetStyle ( work ) ;
2007-04-17 01:41:06 +02:00
event . Skip ( ) ;
}
////////////////////////
// Preview text changed
void DialogStyleEditor : : OnPreviewTextChange ( wxCommandEvent & event ) {
if ( PreviewText ) {
2007-06-03 06:54:38 +02:00
if ( SubsPreview ) SubsPreview - > SetText ( PreviewText - > GetValue ( ) ) ;
2007-04-17 01:41:06 +02:00
event . Skip ( ) ;
}
2006-01-16 22:02:54 +01:00
}
2007-05-21 06:53:14 +02:00
/////////////////////////////////////////
// Change colour of preview's background
void DialogStyleEditor : : OnPreviewColourChange ( wxCommandEvent & event ) {
2007-06-03 06:54:38 +02:00
if ( SubsPreview ) SubsPreview - > SetColour ( previewButton - > GetColour ( ) ) ;
2007-05-21 06:53:14 +02:00
Options . SetColour ( _T ( " Style editor preview background " ) , previewButton - > GetColour ( ) ) ;
Options . Save ( ) ;
}
2007-04-17 01:59:38 +02:00
///////////////////////////////////
// Command event to update preview
void DialogStyleEditor : : OnCommandPreviewUpdate ( wxCommandEvent & event ) {
2007-05-22 07:53:08 +02:00
if ( ! IsShownOnScreen ( ) ) return ;
2007-04-17 01:59:38 +02:00
UpdateWorkStyle ( ) ;
2007-06-03 06:54:38 +02:00
if ( SubsPreview ) SubsPreview - > SetStyle ( work ) ;
2007-04-17 01:59:38 +02:00
event . Skip ( ) ;
}
2006-01-16 22:02:54 +01:00
///////////////////////////////////////
// Converts control value to alignment
int DialogStyleEditor : : ControlToAlign ( int n ) {
switch ( n ) {
case 0 : return 7 ;
case 1 : return 8 ;
case 2 : return 9 ;
case 3 : return 4 ;
case 4 : return 5 ;
case 5 : return 6 ;
case 6 : return 1 ;
case 7 : return 2 ;
case 8 : return 3 ;
default : return 2 ;
}
}
///////////////////////////////////////
// Converts alignment value to control
int DialogStyleEditor : : AlignToControl ( int n ) {
switch ( n ) {
case 7 : return 0 ;
case 8 : return 1 ;
case 9 : return 2 ;
case 4 : return 3 ;
case 5 : return 4 ;
case 6 : return 5 ;
case 1 : return 6 ;
case 2 : return 7 ;
case 3 : return 8 ;
default : return 7 ;
}
}
2009-06-05 04:02:55 +02:00
/////////////////////////////////////////////////
// Load and save window position for the session
void DialogStyleEditor : : SavePosition ( ) {
use_saved_position = true ;
saved_position = GetRect ( ) ;
}
void DialogStyleEditor : : LoadPosition ( ) {
if ( use_saved_position )
SetSize ( saved_position ) ;
else
CentreOnParent ( ) ;
}
/////////////////////////////////////
// Static class data saving position
wxRect DialogStyleEditor : : saved_position ;
bool DialogStyleEditor : : use_saved_position = false ;