Replaced margin edit boxes in style editor with spin controls.

Originally committed to SVN as r1192.
This commit is contained in:
Rodrigo Braz Monteiro 2007-05-21 06:03:09 +00:00
parent e1592d0628
commit a0b7583262
3 changed files with 46 additions and 65 deletions

View file

@ -50,7 +50,7 @@ Please visit http://aegisub.net to download latest version
o New, more horizontal, layout (AMZ) o New, more horizontal, layout (AMZ)
o Realtime preview box (AMZ) o Realtime preview box (AMZ)
o Editable drop-down (combo box) to select fonts, instead of the OS's standard font chooser. This allows easy realtime preview of fonts. (AMZ) o Editable drop-down (combo box) to select fonts, instead of the OS's standard font chooser. This allows easy realtime preview of fonts. (AMZ)
o Alpha boxes now use spin controls. (AMZ) o Alpha and margin edit boxes were replaced with spin controls. (AMZ)
o Hitting enter will now "OK" it. (AMZ) o Hitting enter will now "OK" it. (AMZ)
- Changes to subtitle reading/writing: - Changes to subtitle reading/writing:
o Support reading SSA/ASS files with intermixed V4 and V4+ Styles sections. (jfs) o Support reading SSA/ASS files with intermixed V4 and V4+ Styles sections. (jfs)

View file

@ -101,9 +101,6 @@ DialogStyleEditor::DialogStyleEditor (wxWindow *parent, AssStyle *_style, Subtit
// Prepare control values // Prepare control values
FontSizeValue = FloatToString(style->fontsize); FontSizeValue = FloatToString(style->fontsize);
MarginLValue = style->GetMarginString(0);
MarginRValue = style->GetMarginString(1);
MarginVValue = style->GetMarginString(2);
OutlineValue = FloatToString(style->outline_w); OutlineValue = FloatToString(style->outline_w);
ShadowValue = FloatToString(style->shadow_w); ShadowValue = FloatToString(style->shadow_w);
ScaleXValue = FloatToString(style->scalex); ScaleXValue = FloatToString(style->scalex);
@ -122,23 +119,21 @@ DialogStyleEditor::DialogStyleEditor (wxWindow *parent, AssStyle *_style, Subtit
// Create controls // Create controls
StyleName = new wxTextCtrl(this,-1,style->name); StyleName = new wxTextCtrl(this,-1,style->name);
FontName = new wxComboBox(this,TEXT_FONT_NAME,style->font,wxDefaultPosition,wxSize(150,20),fontList,wxCB_DROPDOWN | wxTE_PROCESS_ENTER); FontName = new wxComboBox(this,TEXT_FONT_NAME,style->font,wxDefaultPosition,wxSize(150,20),fontList,wxCB_DROPDOWN | wxTE_PROCESS_ENTER);
FontSize = new wxTextCtrl(this,TEXT_FONT_SIZE,_T(""),wxDefaultPosition,wxSize(30,20),0,wxTextValidator(wxFILTER_NUMERIC,&FontSizeValue)); 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")); //wxButton *FontButton = new wxButton(this,BUTTON_STYLE_FONT,_("Choose"));
BoxBold = new wxCheckBox(this,CHECKBOX_STYLE_BOLD,_("Bold")); BoxBold = new wxCheckBox(this,CHECKBOX_STYLE_BOLD,_("Bold"));
BoxItalic = new wxCheckBox(this,CHECKBOX_STYLE_ITALIC,_("Italic")); BoxItalic = new wxCheckBox(this,CHECKBOX_STYLE_ITALIC,_("Italic"));
BoxUnderline = new wxCheckBox(this,CHECKBOX_STYLE_UNDERLINE,_("Underline")); BoxUnderline = new wxCheckBox(this,CHECKBOX_STYLE_UNDERLINE,_("Underline"));
BoxStrikeout = new wxCheckBox(this,CHECKBOX_STYLE_STRIKEOUT,_("Strikeout")); BoxStrikeout = new wxCheckBox(this,CHECKBOX_STYLE_STRIKEOUT,_("Strikeout"));
colorButton[0] = new ColourButton(this,BUTTON_COLOR_1,wxSize(45,16),style->primary.GetWXColor()); colorButton[0] = new ColourButton(this,BUTTON_COLOR_1,wxSize(55,16),style->primary.GetWXColor());
colorButton[1] = new ColourButton(this,BUTTON_COLOR_2,wxSize(45,16),style->secondary.GetWXColor()); colorButton[1] = new ColourButton(this,BUTTON_COLOR_2,wxSize(55,16),style->secondary.GetWXColor());
colorButton[2] = new ColourButton(this,BUTTON_COLOR_3,wxSize(45,16),style->outline.GetWXColor()); colorButton[2] = new ColourButton(this,BUTTON_COLOR_3,wxSize(55,16),style->outline.GetWXColor());
colorButton[3] = new ColourButton(this,BUTTON_COLOR_4,wxSize(45,16),style->shadow.GetWXColor()); colorButton[3] = new ColourButton(this,BUTTON_COLOR_4,wxSize(55,16),style->shadow.GetWXColor());
colorAlpha[0] = new wxSpinCtrl(this,TEXT_ALPHA_1,_T(""),wxDefaultPosition,wxSize(50,20),wxSP_ARROW_KEYS,0,255,style->primary.a); colorAlpha[0] = new wxSpinCtrl(this,TEXT_ALPHA_1,_T(""),wxDefaultPosition,wxSize(60,20),wxSP_ARROW_KEYS,0,255,style->primary.a);
colorAlpha[1] = new wxSpinCtrl(this,TEXT_ALPHA_2,_T(""),wxDefaultPosition,wxSize(50,20),wxSP_ARROW_KEYS,0,255,style->secondary.a); colorAlpha[1] = new wxSpinCtrl(this,TEXT_ALPHA_2,_T(""),wxDefaultPosition,wxSize(60,20),wxSP_ARROW_KEYS,0,255,style->secondary.a);
colorAlpha[2] = new wxSpinCtrl(this,TEXT_ALPHA_3,_T(""),wxDefaultPosition,wxSize(50,20),wxSP_ARROW_KEYS,0,255,style->outline.a); colorAlpha[2] = new wxSpinCtrl(this,TEXT_ALPHA_3,_T(""),wxDefaultPosition,wxSize(60,20),wxSP_ARROW_KEYS,0,255,style->outline.a);
colorAlpha[3] = new wxSpinCtrl(this,TEXT_ALPHA_4,_T(""),wxDefaultPosition,wxSize(50,20),wxSP_ARROW_KEYS,0,255,style->shadow.a); colorAlpha[3] = new wxSpinCtrl(this,TEXT_ALPHA_4,_T(""),wxDefaultPosition,wxSize(60,20),wxSP_ARROW_KEYS,0,255,style->shadow.a);
MarginL = new wxTextCtrl(this,TEXT_MARGIN_L,_T(""),wxDefaultPosition,wxSize(40,20),0,NumValidator(&MarginLValue)); for (int i=0;i<3;i++) margin[i] = new wxSpinCtrl(this,TEXT_MARGIN_L+i,_T(""),wxDefaultPosition,wxSize(60,20),wxSP_ARROW_KEYS,0,9999,style->Margin[i]);
MarginR = new wxTextCtrl(this,TEXT_MARGIN_R,_T(""),wxDefaultPosition,wxSize(40,20),0,NumValidator(&MarginRValue));
MarginV = new wxTextCtrl(this,TEXT_MARGIN_V,_T(""),wxDefaultPosition,wxSize(40,20),0,NumValidator(&MarginVValue));
Alignment = new wxRadioBox(this, RADIO_ALIGNMENT, _("Alignment"), wxDefaultPosition, wxDefaultSize, 9, alignValues, 3, wxRA_SPECIFY_COLS); Alignment = new wxRadioBox(this, RADIO_ALIGNMENT, _("Alignment"), wxDefaultPosition, wxDefaultSize, 9, alignValues, 3, wxRA_SPECIFY_COLS);
Outline = new wxTextCtrl(this,TEXT_OUTLINE,_T(""),wxDefaultPosition,wxSize(40,20),0,wxTextValidator(wxFILTER_NUMERIC,&OutlineValue)); Outline = new wxTextCtrl(this,TEXT_OUTLINE,_T(""),wxDefaultPosition,wxSize(40,20),0,wxTextValidator(wxFILTER_NUMERIC,&OutlineValue));
Shadow = new wxTextCtrl(this,TEXT_SHADOW,_T(""),wxDefaultPosition,wxSize(40,20),0,wxTextValidator(wxFILTER_NUMERIC,&ShadowValue)); Shadow = new wxTextCtrl(this,TEXT_SHADOW,_T(""),wxDefaultPosition,wxSize(40,20),0,wxTextValidator(wxFILTER_NUMERIC,&ShadowValue));
@ -154,28 +149,29 @@ DialogStyleEditor::DialogStyleEditor (wxWindow *parent, AssStyle *_style, Subtit
previewButton = new ColourButton(this,BUTTON_PREVIEW_COLOR,wxSize(45,16),Options.AsColour(_T("Style editor preview background"))); previewButton = new ColourButton(this,BUTTON_PREVIEW_COLOR,wxSize(45,16),Options.AsColour(_T("Style editor preview background")));
// Set control tooltips // Set control tooltips
StyleName->SetToolTip(_("Style name")); StyleName->SetToolTip(_("Style name."));
FontName->SetToolTip(_("Font face")); FontName->SetToolTip(_("Font face."));
FontSize->SetToolTip(_("Font size")); FontSize->SetToolTip(_("Font size."));
colorButton[0]->SetToolTip(_("Click to choose primary color")); colorButton[0]->SetToolTip(_("Click to choose primary color."));
colorButton[1]->SetToolTip(_("Click to choose secondary color")); colorButton[1]->SetToolTip(_("Click to choose secondary color."));
colorButton[2]->SetToolTip(_("Click to choose outline color")); colorButton[2]->SetToolTip(_("Click to choose outline color."));
colorButton[3]->SetToolTip(_("Click to choose shadow color")); colorButton[3]->SetToolTip(_("Click to choose shadow color."));
for (int i=0;i<4;i++) colorAlpha[i]->SetToolTip(_("Set opacity, from 0 (opaque) to 255 (transparent)")); for (int i=0;i<4;i++) colorAlpha[i]->SetToolTip(_("Set opacity, from 0 (opaque) to 255 (transparent)."));
MarginL->SetToolTip(_("Distance from left edge, in pixels")); margin[0]->SetToolTip(_("Distance from left edge, in pixels."));
MarginR->SetToolTip(_("Distance from right edge, in pixels")); margin[1]->SetToolTip(_("Distance from right edge, in pixels."));
MarginV->SetToolTip(_("Distance from top/bottom edge, in pixels")); margin[2]->SetToolTip(_("Distance from top/bottom edge, in pixels."));
OutlineType->SetToolTip(_("Checking this will display an opaque box instead of outline")); OutlineType->SetToolTip(_("Checking this will display an opaque box instead of outline."));
Outline->SetToolTip(_("Outline width, in pixels")); Outline->SetToolTip(_("Outline width, in pixels."));
Shadow->SetToolTip(_("Shadow distance, in pixels")); Shadow->SetToolTip(_("Shadow distance, in pixels."));
ScaleX->SetToolTip(_("Scale X, in percentage")); ScaleX->SetToolTip(_("Scale X, in percentage."));
ScaleY->SetToolTip(_("Scale Y, in percentage")); ScaleY->SetToolTip(_("Scale Y, in percentage."));
Angle->SetToolTip(_("Angle to rotate in Z axis, in degrees")); Angle->SetToolTip(_("Angle to rotate in Z axis, in degrees."));
Encoding->SetToolTip(_("Encoding, only useful in unicode if the font doesn't have the proper unicode mapping.")); Encoding->SetToolTip(_("Encoding, only useful in unicode if the font doesn't have the proper unicode mapping."));
Spacing->SetToolTip(_("Character spacing, in pixels")); Spacing->SetToolTip(_("Character spacing, in pixels."));
Alignment->SetToolTip(_("Alignment in screen, in numpad style")); Alignment->SetToolTip(_("Alignment in screen, in numpad style."));
SubsPreview->SetToolTip(_("Preview of current stlye")); SubsPreview->SetToolTip(_("Preview of current stlye."));
PreviewText->SetToolTip(_("Text to be used for the preview")); PreviewText->SetToolTip(_("Text to be used for the preview."));
previewButton->SetToolTip(_("Colour of preview background."));
// Set up controls // Set up controls
BoxBold->SetValue(style->bold); BoxBold->SetValue(style->bold);
@ -234,26 +230,18 @@ DialogStyleEditor::DialogStyleEditor (wxWindow *parent, AssStyle *_style, Subtit
ColorsSizer->AddStretchSpacer(1); ColorsSizer->AddStretchSpacer(1);
// Margins // Margins
wxString marginLabels[] = { _("Left"), _("Right"), _("Vert") };
wxSizer *MarginSizer = new wxStaticBoxSizer(wxHORIZONTAL,this,_("Margins")); wxSizer *MarginSizer = new wxStaticBoxSizer(wxHORIZONTAL,this,_("Margins"));
wxSizer *MarginSizerL = new wxBoxSizer(wxVERTICAL);
wxSizer *MarginSizerR = new wxBoxSizer(wxVERTICAL);
wxSizer *MarginSizerV = new wxBoxSizer(wxVERTICAL);
MarginSizerL->AddStretchSpacer(1);
MarginSizerL->Add(new wxStaticText(this,-1,_("Left")),0,wxCENTER,0);
MarginSizerL->Add(MarginL,0,wxTOP | wxCENTER,5);
MarginSizerL->AddStretchSpacer(1);
MarginSizerR->AddStretchSpacer(1);
MarginSizerR->Add(new wxStaticText(this,-1,_("Right")),0,wxCENTER,0);
MarginSizerR->Add(MarginR,0,wxTOP | wxCENTER,5);
MarginSizerR->AddStretchSpacer(1);
MarginSizerV->AddStretchSpacer(1);
MarginSizerV->Add(new wxStaticText(this,-1,_("Vert")),0,wxCENTER,0);
MarginSizerV->Add(MarginV,0,wxTOP | wxCENTER,5);
MarginSizerV->AddStretchSpacer(1);
MarginSizer->AddStretchSpacer(1); MarginSizer->AddStretchSpacer(1);
MarginSizer->Add(MarginSizerL,0,wxEXPAND,0); wxSizer *marginSubSizer[3];
MarginSizer->Add(MarginSizerR,0,wxEXPAND | wxLEFT,5); for (int i=0;i<3;i++) {
MarginSizer->Add(MarginSizerV,0,wxEXPAND | wxLEFT,5); 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);
}
MarginSizer->AddStretchSpacer(1); MarginSizer->AddStretchSpacer(1);
// Margins+Alignment // Margins+Alignment
@ -520,10 +508,8 @@ void DialogStyleEditor::UpdateWorkStyle() {
work->alignment = ControlToAlign(Alignment->GetSelection()); work->alignment = ControlToAlign(Alignment->GetSelection());
// Margins // Margins
work->SetMarginString(MarginL->GetValue(),0); for (int i=0;i<3;i++) work->Margin[i] = margin[i]->GetValue();
work->SetMarginString(MarginR->GetValue(),1); work->Margin[3] = margin[2]->GetValue();
work->SetMarginString(MarginV->GetValue(),2); // make sure both top and bottom margins reflect vertical margin
work->SetMarginString(MarginV->GetValue(),3);
// Color alphas // Color alphas
work->primary.a = colorAlpha[0]->GetValue(); work->primary.a = colorAlpha[0]->GetValue();

View file

@ -61,9 +61,6 @@ private:
SubtitlesGrid *grid; SubtitlesGrid *grid;
wxString FontSizeValue; wxString FontSizeValue;
wxString MarginLValue;
wxString MarginRValue;
wxString MarginVValue;
wxString AlignmentValue; wxString AlignmentValue;
wxString OutlineValue; wxString OutlineValue;
wxString ShadowValue; wxString ShadowValue;
@ -82,9 +79,7 @@ private:
wxCheckBox *BoxStrikeout; wxCheckBox *BoxStrikeout;
ColourButton *colorButton[4]; ColourButton *colorButton[4];
wxSpinCtrl *colorAlpha[4]; wxSpinCtrl *colorAlpha[4];
wxTextCtrl *MarginL; wxSpinCtrl *margin[4];
wxTextCtrl *MarginR;
wxTextCtrl *MarginV;
wxRadioBox *Alignment; wxRadioBox *Alignment;
wxTextCtrl *Outline; wxTextCtrl *Outline;
wxTextCtrl *Shadow; wxTextCtrl *Shadow;