From 001c5947f67d531eebeab8f42bf4da9b5dd9b702 Mon Sep 17 00:00:00 2001 From: Rodrigo Braz Monteiro Date: Mon, 21 May 2007 03:59:46 +0000 Subject: [PATCH] Changed the Style Editor to have an editable drop-down (combo box) to select fonts, instead of the OS's standard font chooser. This allows easy realtime preview of subtitles. Originally committed to SVN as r1188. --- aegisub/changelog.txt | 1 + aegisub/dialog_style_editor.cpp | 10 +++++++--- aegisub/dialog_style_editor.h | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/aegisub/changelog.txt b/aegisub/changelog.txt index 8d4710094..2786b741a 100644 --- a/aegisub/changelog.txt +++ b/aegisub/changelog.txt @@ -122,6 +122,7 @@ Please visit http://aegisub.net to download latest version - Added a "Scale Border and Shadow" check box to script properties dialog. (AMZ) - Fixed drawing of inactive lines in audio display to prevent it from being drawn over selection. (AMZ) - Commiting text now commits times as well. (AMZ) +- Changed the Style Editor to have an editable drop-down (combo box) to select fonts, instead of the OS's standard font chooser. This allows easy realtime preview of subtitles. (AMZ) = 1.10 beta - 2006.08.07 =========================== diff --git a/aegisub/dialog_style_editor.cpp b/aegisub/dialog_style_editor.cpp index 1757f29eb..09045792e 100644 --- a/aegisub/dialog_style_editor.cpp +++ b/aegisub/dialog_style_editor.cpp @@ -38,6 +38,7 @@ // Includes #include #include +#include #include "dialog_style_editor.h" #include "ass_dialogue.h" #include "ass_style.h" @@ -114,6 +115,8 @@ 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") }; + wxArrayString fontList = wxFontEnumerator::GetFacenames(); + fontList.Sort(); // Encoding options wxArrayString encodingStrings; @@ -121,9 +124,9 @@ DialogStyleEditor::DialogStyleEditor (wxWindow *parent, AssStyle *_style, Subtit // Create controls StyleName = new wxTextCtrl(this,-1,style->name); - FontName = new wxTextCtrl(this,TEXT_FONT_NAME,style->font,wxDefaultPosition,wxSize(150,20)); + FontName = new wxComboBox(this,TEXT_FONT_NAME,style->font,wxDefaultPosition,wxSize(150,20),fontList,wxCB_DROPDOWN); FontSize = new wxTextCtrl(this,TEXT_FONT_SIZE,_T(""),wxDefaultPosition,wxSize(30,20),0,wxTextValidator(wxFILTER_NUMERIC,&FontSizeValue)); - wxButton *FontButton = new wxButton(this,BUTTON_STYLE_FONT,_("Choose")); + //wxButton *FontButton = new wxButton(this,BUTTON_STYLE_FONT,_("Choose")); BoxBold = new wxCheckBox(this,CHECKBOX_STYLE_BOLD,_("Bold")); BoxItalic = new wxCheckBox(this,CHECKBOX_STYLE_ITALIC,_("Italic")); BoxUnderline = new wxCheckBox(this,CHECKBOX_STYLE_UNDERLINE,_("Underline")); @@ -211,7 +214,7 @@ DialogStyleEditor::DialogStyleEditor (wxWindow *parent, AssStyle *_style, Subtit wxSizer *FontSizerBottom = new wxBoxSizer(wxHORIZONTAL); FontSizerTop->Add(FontName,1,wxALL,0); FontSizerTop->Add(FontSize,0,wxLEFT,5); - FontSizerTop->Add(FontButton,0,wxLEFT,5); + //FontSizerTop->Add(FontButton,0,wxLEFT,5); FontSizerBottom->AddStretchSpacer(1); FontSizerBottom->Add(BoxBold,0,0,0); FontSizerBottom->Add(BoxItalic,0,wxLEFT,5); @@ -380,6 +383,7 @@ BEGIN_EVENT_TABLE(DialogStyleEditor, wxDialog) EVT_CHECKBOX(CHECKBOX_STYLE_STRIKEOUT, DialogStyleEditor::OnCommandPreviewUpdate) EVT_CHECKBOX(CHECKBOX_OUTLINE, DialogStyleEditor::OnCommandPreviewUpdate) EVT_COMBOBOX(COMBO_ENCODING, DialogStyleEditor::OnCommandPreviewUpdate) + EVT_COMBOBOX(TEXT_FONT_NAME, DialogStyleEditor::OnCommandPreviewUpdate) END_EVENT_TABLE() diff --git a/aegisub/dialog_style_editor.h b/aegisub/dialog_style_editor.h index 1628fa7ec..6ad1ae6a2 100644 --- a/aegisub/dialog_style_editor.h +++ b/aegisub/dialog_style_editor.h @@ -77,7 +77,7 @@ private: wxString SpacingValue; wxTextCtrl *StyleName; - wxTextCtrl *FontName; + wxComboBox *FontName; wxTextCtrl *FontSize; wxCheckBox *BoxBold; wxCheckBox *BoxItalic;