Actually copy the current value in IntValidator's copy constructor

This commit is contained in:
Thomas Goyne 2013-10-15 16:02:25 -07:00
parent d4a7a1a9b6
commit 9dbca06179
3 changed files with 5 additions and 12 deletions

View File

@ -78,8 +78,8 @@ DialogProperties::DialogProperties(agi::Context *c)
// Resolution box
wxSizer *ResSizer = new wxStaticBoxSizer(wxHORIZONTAL,this,_("Resolution"));
ResX = new wxTextCtrl(this,-1,"",wxDefaultPosition,wxSize(50,20),0,IntValidator(c->ass->GetScriptInfo("PlayResX")));
ResY = new wxTextCtrl(this,-1,"",wxDefaultPosition,wxSize(50,20),0,IntValidator(c->ass->GetScriptInfo("PlayResY")));
ResX = new wxTextCtrl(this,-1,"",wxDefaultPosition,wxSize(50,20),0,IntValidator(c->ass->GetScriptInfoAsInt("PlayResX")));
ResY = new wxTextCtrl(this,-1,"",wxDefaultPosition,wxSize(50,20),0,IntValidator(c->ass->GetScriptInfoAsInt("PlayResY")));
wxStaticText *ResText = new wxStaticText(this,-1,"x");
wxButton *FromVideo = new wxButton(this,-1,_("From &video"));

View File

@ -41,13 +41,6 @@ wxChar decimal_separator() {
}
}
IntValidator::IntValidator(std::string const& initial)
: allow_negative(false)
{
agi::util::try_parse(initial, &value);
Bind(wxEVT_CHAR, &IntValidator::OnChar, this);
}
IntValidator::IntValidator(int val, bool allow_negative)
: value(val)
, allow_negative(allow_negative)
@ -56,7 +49,8 @@ IntValidator::IntValidator(int val, bool allow_negative)
}
IntValidator::IntValidator(IntValidator const& rgt)
: allow_negative(rgt.allow_negative)
: value(rgt.value)
, allow_negative(rgt.allow_negative)
{
SetWindow(rgt.GetWindow());
Bind(wxEVT_CHAR, &IntValidator::OnChar, this);

View File

@ -36,8 +36,7 @@ class IntValidator : public wxValidator {
IntValidator(IntValidator const& rgt);
public:
explicit IntValidator(std::string const& value = "");
explicit IntValidator(int val, bool allow_negative=false);
explicit IntValidator(int val=0, bool allow_negative=false);
};
class DoubleValidator : public wxValidator {