From 8470ffdbf07992996fb93d61e369fee99135c3dc Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Wed, 9 Jan 2013 07:29:41 -0800 Subject: [PATCH] Allow negative values for shadow depth, angle and spacing in the style editor --- aegisub/src/dialog_style_editor.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/aegisub/src/dialog_style_editor.cpp b/aegisub/src/dialog_style_editor.cpp index 6ed551a16..a329bcc01 100644 --- a/aegisub/src/dialog_style_editor.cpp +++ b/aegisub/src/dialog_style_editor.cpp @@ -139,8 +139,8 @@ static wxSpinCtrl *spin_ctrl(wxWindow *parent, float value, int max_value) { return new wxSpinCtrl(parent, -1, AegiFloatToString(value), wxDefaultPosition, wxSize(60, -1), wxSP_ARROW_KEYS, 0, max_value, value); } -static wxTextCtrl *num_text_ctrl(wxWindow *parent, double value, wxSize size = wxSize(70, 20)) { - return new wxTextCtrl(parent, -1, "", wxDefaultPosition, size, 0, NumValidator(value)); +static wxTextCtrl *num_text_ctrl(wxWindow *parent, double value, bool allow_negative, wxSize size = wxSize(70, 20)) { + return new wxTextCtrl(parent, -1, "", wxDefaultPosition, size, 0, NumValidator(value, allow_negative)); } DialogStyleEditor::DialogStyleEditor(wxWindow *parent, AssStyle *style, agi::Context *c, AssStyleStorage *store, std::string const& new_name) @@ -186,7 +186,7 @@ DialogStyleEditor::DialogStyleEditor(wxWindow *parent, AssStyle *style, agi::Con // Create controls StyleName = new wxTextCtrl(this, -1, to_wx(style->name)); FontName = new wxComboBox(this, -1, to_wx(style->font), wxDefaultPosition, wxSize(150, -1), 0, 0, wxCB_DROPDOWN); - FontSize = num_text_ctrl(this, style->fontsize, wxSize(50, -1)); + FontSize = num_text_ctrl(this, style->fontsize, false, wxSize(50, -1)); BoxBold = new wxCheckBox(this, -1, _("&Bold")); BoxItalic = new wxCheckBox(this, -1, _("&Italic")); BoxUnderline = new wxCheckBox(this, -1, _("&Underline")); @@ -202,13 +202,13 @@ DialogStyleEditor::DialogStyleEditor(wxWindow *parent, AssStyle *style, agi::Con for (int i = 0; i < 3; i++) margin[i] = spin_ctrl(this, style->Margin[i], 9999); Alignment = new wxRadioBox(this, -1, _("Alignment"), wxDefaultPosition, wxDefaultSize, 9, alignValues, 3, wxRA_SPECIFY_COLS); - Outline = num_text_ctrl(this, style->outline_w, wxSize(50, -1)); - Shadow = num_text_ctrl(this, style->shadow_w, wxSize(50, -1)); + Outline = num_text_ctrl(this, style->outline_w, false, wxSize(50, -1)); + Shadow = num_text_ctrl(this, style->shadow_w, true, wxSize(50, -1)); OutlineType = new wxCheckBox(this, -1, _("&Opaque box")); - ScaleX = num_text_ctrl(this, style->scalex); - ScaleY = num_text_ctrl(this, style->scaley); - Angle = num_text_ctrl(this, style->angle); - Spacing = num_text_ctrl(this, style->spacing); + ScaleX = num_text_ctrl(this, style->scalex, false); + ScaleY = num_text_ctrl(this, style->scaley, false); + Angle = num_text_ctrl(this, style->angle, true); + Spacing = num_text_ctrl(this, style->spacing, true); Encoding = new wxComboBox(this, -1, "", wxDefaultPosition, wxDefaultSize, encodingStrings, wxCB_READONLY); // Set control tooltips