Fixed the enter key on the goto dialog and MAYBE glitch #569

Originally committed to SVN as r1708.
This commit is contained in:
Rodrigo Braz Monteiro 2008-01-13 23:47:58 +00:00
parent dd0fdcae46
commit 3aaffcf0fc
2 changed files with 10 additions and 14 deletions

View file

@ -58,7 +58,7 @@ enum {
/////////////// ///////////////
// Constructor // Constructor
DialogJumpTo::DialogJumpTo (wxWindow *parent) DialogJumpTo::DialogJumpTo (wxWindow *parent)
: wxDialog(parent, -1, _("Jump to"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE, _T("JumpTo")) : wxDialog(parent, -1, _("Jump to"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxWANTS_CHARS , _T("JumpTo"))
{ {
// Set icon // Set icon
SetIcon(BitmapToIcon(wxBITMAP(jumpto_button))); SetIcon(BitmapToIcon(wxBITMAP(jumpto_button)));
@ -71,8 +71,8 @@ DialogJumpTo::DialogJumpTo (wxWindow *parent)
// Times // Times
wxStaticText *LabelFrame = new wxStaticText(this,-1,_("Frame: "),wxDefaultPosition,wxSize(60,20)); wxStaticText *LabelFrame = new wxStaticText(this,-1,_("Frame: "),wxDefaultPosition,wxSize(60,20));
wxStaticText *LabelTime = new wxStaticText(this,-1,_("Time: "),wxDefaultPosition,wxSize(60,20)); wxStaticText *LabelTime = new wxStaticText(this,-1,_("Time: "),wxDefaultPosition,wxSize(60,20));
JumpFrame = new wxTextCtrl(this,TEXT_JUMP_FRAME,wxString::Format(_T("%i"),jumpframe),wxDefaultPosition,wxSize(60,20)); JumpFrame = new wxTextCtrl(this,TEXT_JUMP_FRAME,wxString::Format(_T("%i"),jumpframe),wxDefaultPosition,wxSize(60,20),wxTE_PROCESS_ENTER);
JumpTime = new TimeEdit(this,TEXT_JUMP_TIME,jumptime.GetASSFormated(),wxDefaultPosition,wxSize(60,20)); JumpTime = new TimeEdit(this,TEXT_JUMP_TIME,jumptime.GetASSFormated(),wxDefaultPosition,wxSize(60,20),wxTE_PROCESS_ENTER);
wxSizer *FrameSizer = new wxBoxSizer(wxHORIZONTAL); wxSizer *FrameSizer = new wxBoxSizer(wxHORIZONTAL);
wxSizer *TimeSizer = new wxBoxSizer(wxHORIZONTAL); wxSizer *TimeSizer = new wxBoxSizer(wxHORIZONTAL);
FrameSizer->Add(LabelFrame,0,wxALIGN_CENTER_VERTICAL,0); FrameSizer->Add(LabelFrame,0,wxALIGN_CENTER_VERTICAL,0);
@ -106,7 +106,8 @@ DialogJumpTo::DialogJumpTo (wxWindow *parent)
/////////////// ///////////////
// Event table // Event table
BEGIN_EVENT_TABLE(DialogJumpTo, wxDialog) BEGIN_EVENT_TABLE(DialogJumpTo, wxDialog)
EVT_KEY_DOWN(DialogJumpTo::OnKey) EVT_TEXT_ENTER(TEXT_JUMP_FRAME,DialogJumpTo::OnKey)
EVT_TEXT_ENTER(TEXT_JUMP_TIME,DialogJumpTo::OnKey)
EVT_BUTTON(wxID_CANCEL,DialogJumpTo::OnCloseButton) EVT_BUTTON(wxID_CANCEL,DialogJumpTo::OnCloseButton)
EVT_BUTTON(wxID_OK,DialogJumpTo::OnOK) EVT_BUTTON(wxID_OK,DialogJumpTo::OnOK)
EVT_TEXT(TEXT_JUMP_TIME, DialogJumpTo::OnEditTime) EVT_TEXT(TEXT_JUMP_TIME, DialogJumpTo::OnEditTime)
@ -122,22 +123,17 @@ void DialogJumpTo::OnOK (wxCommandEvent &event) { OnClose(true); }
////////////////// //////////////////
// On Key pressed // On Key pressed
void DialogJumpTo::OnKey(wxKeyEvent &event) { void DialogJumpTo::OnKey(wxCommandEvent &event) {
int key = event.GetKeyCode(); EndModal(0);
if (key == WXK_RETURN) { VideoContext::Get()->JumpToFrame(jumpframe);
VideoContext::Get()->JumpToFrame(jumpframe);
EndModal(0);
return;
}
event.Skip();
} }
//////////////////////// ////////////////////////
// On OK button pressed // On OK button pressed
void DialogJumpTo::OnClose(bool ok) { void DialogJumpTo::OnClose(bool ok) {
if (ok) VideoContext::Get()->JumpToFrame(jumpframe);
EndModal(0); EndModal(0);
if (ok) VideoContext::Get()->JumpToFrame(jumpframe);
} }

View file

@ -56,7 +56,7 @@ private:
TimeEdit *JumpTime; TimeEdit *JumpTime;
wxTextCtrl *JumpFrame; wxTextCtrl *JumpFrame;
void OnKey(wxKeyEvent &event); void OnKey(wxCommandEvent &event);
void OnCloseButton(wxCommandEvent &event); void OnCloseButton(wxCommandEvent &event);
void OnOK(wxCommandEvent &event); void OnOK(wxCommandEvent &event);
void OnEditTime(wxCommandEvent &event); void OnEditTime(wxCommandEvent &event);