Modified Harukalover's patch from yesterday so the frame number is sanitized after entry, not during.

Originally committed to SVN as r2722.
This commit is contained in:
Karl Blomster 2009-02-04 23:22:10 +00:00
parent 6a765528e1
commit f530b4c0da
1 changed files with 3 additions and 2 deletions

View File

@ -127,6 +127,7 @@ void DialogJumpTo::OnOK (wxCommandEvent &event) { OnClose(true); }
// On Key pressed // On Key pressed
void DialogJumpTo::OnKey(wxCommandEvent &event) { void DialogJumpTo::OnKey(wxCommandEvent &event) {
EndModal(0); EndModal(0);
if (jumpframe > VideoContext::Get()->GetLength()-1) jumpframe = VideoContext::Get()->GetLength()-1;
VideoContext::Get()->JumpToFrame(jumpframe); VideoContext::Get()->JumpToFrame(jumpframe);
} }
@ -135,6 +136,7 @@ void DialogJumpTo::OnKey(wxCommandEvent &event) {
// On OK button pressed // On OK button pressed
void DialogJumpTo::OnClose(bool ok) { void DialogJumpTo::OnClose(bool ok) {
EndModal(0); EndModal(0);
if (jumpframe > VideoContext::Get()->GetLength()-1) jumpframe = VideoContext::Get()->GetLength()-1;
if (ok) VideoContext::Get()->JumpToFrame(jumpframe); if (ok) VideoContext::Get()->JumpToFrame(jumpframe);
} }
@ -147,7 +149,6 @@ void DialogJumpTo::OnEditTime (wxCommandEvent &event) {
// Update frame // Update frame
long newframe = VFR_Output.GetFrameAtTime(JumpTime->time.GetMS()); long newframe = VFR_Output.GetFrameAtTime(JumpTime->time.GetMS());
if (newframe > VideoContext::Get()->GetLength()-1) newframe = VideoContext::Get()->GetLength()-1;
if (jumpframe != newframe) { if (jumpframe != newframe) {
jumpframe = newframe; jumpframe = newframe;
JumpFrame->SetValue(wxString::Format(_T("%i"),jumpframe)); JumpFrame->SetValue(wxString::Format(_T("%i"),jumpframe));
@ -167,7 +168,7 @@ void DialogJumpTo::OnEditFrame (wxCommandEvent &event) {
// Update frame // Update frame
JumpFrame->GetValue().ToLong(&jumpframe); JumpFrame->GetValue().ToLong(&jumpframe);
if (jumpframe > VideoContext::Get()->GetLength()-1) jumpframe = VideoContext::Get()->GetLength()-1;
JumpFrame->SetValue(wxString::Format(_T("%i"),jumpframe)); JumpFrame->SetValue(wxString::Format(_T("%i"),jumpframe));
// Update time // Update time