diff --git a/aegisub/validators.cpp b/aegisub/validators.cpp index 24cf16e6c..cb9ae355d 100644 --- a/aegisub/validators.cpp +++ b/aegisub/validators.cpp @@ -61,6 +61,16 @@ NumValidator::NumValidator(wxString* _valPtr,bool isfloat,bool issigned) { } +//////////////////// +// Copy constructor +NumValidator::NumValidator(const NumValidator &from) { + valPtr = from.valPtr; + isFloat = from.isFloat; + isSigned = from.isSigned; + SetWindow(from.GetWindow()); +} + + /////////////// // Event table BEGIN_EVENT_TABLE(NumValidator, wxValidator) @@ -91,7 +101,7 @@ bool NumValidator::Validate(wxWindow* parent) { // Check each character bool gotDecimal = false; for (size_t i=0;i 0; - bool canSign = from == 0 && signs == 0; + bool isFirst = from == 0; + bool canSign = signs == 0; // Check character - if (!CheckCharacter(chr,canSign,gotDecimal)) { + if (!CheckCharacter(chr,isFirst,canSign,gotDecimal)) { if (!wxValidator::IsSilent()) wxBell(); return; } diff --git a/aegisub/validators.h b/aegisub/validators.h index 3b4ccf052..fe7cf497a 100644 --- a/aegisub/validators.h +++ b/aegisub/validators.h @@ -58,12 +58,13 @@ private: bool TransferToWindow(); bool TransferFromWindow(); - bool CheckCharacter(int chr,bool isFirst,bool &gotDecimal); + bool CheckCharacter(int chr,bool isFirst,bool canSign,bool &gotDecimal); void OnChar(wxKeyEvent& event); public: NumValidator(wxString* valPtr = NULL,bool isfloat=false,bool issigned=false); + NumValidator(const NumValidator& from); DECLARE_EVENT_TABLE(); };