From 90582c0b1500512ca00df5cc976462caf9cae86e Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Thu, 1 Dec 2011 00:43:48 +0000 Subject: [PATCH] Use NumValidator to ensure only numbers are typed in the frames box of the jump to dialog. Updates #1319. Originally committed to SVN as r5953. --- aegisub/src/dialog_jumpto.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/aegisub/src/dialog_jumpto.cpp b/aegisub/src/dialog_jumpto.cpp index 1d734dd1d..63344d0ed 100644 --- a/aegisub/src/dialog_jumpto.cpp +++ b/aegisub/src/dialog_jumpto.cpp @@ -51,6 +51,7 @@ #include "libresrc/libresrc.h" #include "timeedit_ctrl.h" #include "utils.h" +#include "validators.h" #include "video_context.h" DialogJumpTo::DialogJumpTo(agi::Context *c) @@ -68,7 +69,7 @@ DialogJumpTo::DialogJumpTo(agi::Context *c) // Times wxStaticText *LabelFrame = new wxStaticText(this,-1,_("Frame: "),wxDefaultPosition,wxSize(60,20)); wxStaticText *LabelTime = new wxStaticText(this,-1,_("Time: "),wxDefaultPosition,wxSize(60,20)); - JumpFrame = new wxTextCtrl(this,-1,wxString::Format("%i",jumpframe),wxDefaultPosition,wxSize(60,20),wxTE_PROCESS_ENTER); + JumpFrame = new wxTextCtrl(this,-1,wxString::Format("%i",jumpframe),wxDefaultPosition,wxSize(60,20),wxTE_PROCESS_ENTER, NumValidator()); JumpFrame->SetMaxLength(maxLength.size()); JumpTime = new TimeEdit(this,-1,jumptime.GetASSFormated(),wxDefaultPosition,wxSize(60,20),wxTE_PROCESS_ENTER); wxSizer *FrameSizer = new wxBoxSizer(wxHORIZONTAL); @@ -120,8 +121,6 @@ void DialogJumpTo::OnEditTime (wxCommandEvent &) { void DialogJumpTo::OnEditFrame (wxCommandEvent &event) { JumpFrame->GetValue().ToLong(&jumpframe); - JumpFrame->ChangeValue(wxString::Format("%i", jumpframe)); - int newtime = c->videoController->TimeAtFrame(jumpframe); if (JumpTime->time.GetMS() != newtime) { JumpTime->time.SetMS(newtime);