mirror of https://github.com/odrling/Aegisub
Fixed style editor crashing for good (I think) and added some performance measurement of font list creation in debug builds.
Originally committed to SVN as r1208.
This commit is contained in:
parent
31003a3a52
commit
9d1f40b4c4
|
@ -94,6 +94,7 @@ enum {
|
|||
DialogStyleEditor::DialogStyleEditor (wxWindow *parent, AssStyle *_style, SubtitlesGrid *_grid)
|
||||
: wxDialog (parent,-1,_("Style Editor"),wxDefaultPosition,wxDefaultSize,wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER,_T("DialogStyleEditor"))
|
||||
{
|
||||
wxStopWatch performance_timer;
|
||||
// Set styles
|
||||
grid = _grid;
|
||||
style = _style;
|
||||
|
@ -110,8 +111,10 @@ DialogStyleEditor::DialogStyleEditor (wxWindow *parent, AssStyle *_style, Subtit
|
|||
EncodingValue = IntegerToString(style->encoding);
|
||||
SpacingValue = FloatToString(style->spacing);
|
||||
wxString alignValues[9] = { _T("7"),_T("8"),_T("9"),_T("4"),_T("5"),_T("6"),_T("1"),_T("2"),_T("3") };
|
||||
performance_timer.Start();
|
||||
wxArrayString fontList = wxFontEnumerator::GetFacenames();
|
||||
fontList.Sort();
|
||||
wxLogDebug(_T("Time to get and sort font face names: %d"), performance_timer.Time());
|
||||
|
||||
// Encoding options
|
||||
wxArrayString encodingStrings;
|
||||
|
@ -119,7 +122,9 @@ DialogStyleEditor::DialogStyleEditor (wxWindow *parent, AssStyle *_style, Subtit
|
|||
|
||||
// Create controls
|
||||
StyleName = new wxTextCtrl(this,-1,style->name);
|
||||
performance_timer.Start();
|
||||
FontName = new wxComboBox(this,TEXT_FONT_NAME,style->font,wxDefaultPosition,wxSize(150,20),fontList,wxCB_DROPDOWN | wxTE_PROCESS_ENTER);
|
||||
wxLogDebug(_T("Time to create and fill font face list: %d"), performance_timer.Time());
|
||||
FontSize = new wxTextCtrl(this,TEXT_FONT_SIZE,_T(""),wxDefaultPosition,wxSize(50,20),0,wxTextValidator(wxFILTER_NUMERIC,&FontSizeValue));
|
||||
//wxButton *FontButton = new wxButton(this,BUTTON_STYLE_FONT,_("Choose"));
|
||||
BoxBold = new wxCheckBox(this,CHECKBOX_STYLE_BOLD,_("Bold"));
|
||||
|
@ -273,6 +278,8 @@ DialogStyleEditor::DialogStyleEditor (wxWindow *parent, AssStyle *_style, Subtit
|
|||
|
||||
// Preview
|
||||
wxSizer *PreviewBox = new wxStaticBoxSizer(wxVERTICAL,this,_("Preview"));
|
||||
SubsPreview = NULL;
|
||||
PreviewText = NULL;
|
||||
if (SubtitlesProviderFactory::ProviderAvailable()) {
|
||||
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")));
|
||||
|
|
Loading…
Reference in New Issue