From 8f50ee08a7b236f3a38e2980ab86085bacf90267 Mon Sep 17 00:00:00 2001 From: Rodrigo Braz Monteiro Date: Fri, 29 Dec 2006 21:45:22 +0000 Subject: [PATCH] Fixed weird bug related to committing on various text controls. Originally committed to SVN as r656. --- aegisub/frame_main_events.cpp | 12 +++++++----- aegisub/subs_edit_box.cpp | 14 +++++++------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/aegisub/frame_main_events.cpp b/aegisub/frame_main_events.cpp index b39db90d0..e0a61a761 100644 --- a/aegisub/frame_main_events.cpp +++ b/aegisub/frame_main_events.cpp @@ -1480,6 +1480,7 @@ void FrameMain::OnToggleTags(wxCommandEvent &event) { void FrameMain::OnEditBoxCommit(wxCommandEvent &event) { // Find focus wxWindow *focus = FindFocus(); + if (!focus) return; // Is the text edit if (focus == EditBox->TextEdit) { @@ -1490,11 +1491,12 @@ void FrameMain::OnEditBoxCommit(wxCommandEvent &event) { // Other window else { - wxKeyEvent keyevent; - keyevent.m_keyCode = WXK_RETURN; - keyevent.m_controlDown = true; - keyevent.SetEventType(wxEVT_KEY_DOWN); - focus->AddPendingEvent(keyevent); + //wxKeyEvent keyevent; + //keyevent.m_keyCode = WXK_RETURN; + //keyevent.m_controlDown = true; + //keyevent.SetEventType(wxEVT_KEY_DOWN); + wxCommandEvent keyevent(wxEVT_COMMAND_TEXT_ENTER,focus->GetId()); + focus->GetEventHandler()->AddPendingEvent(keyevent); } } diff --git a/aegisub/subs_edit_box.cpp b/aegisub/subs_edit_box.cpp index 5678fa160..e5603c068 100644 --- a/aegisub/subs_edit_box.cpp +++ b/aegisub/subs_edit_box.cpp @@ -81,26 +81,26 @@ SubsEditBox::SubsEditBox (wxWindow *parent,SubtitlesGrid *gridp) : wxPanel(paren styles.Add(_T("")); CommentBox = new wxCheckBox(this,COMMENT_CHECKBOX,_("Comment")); CommentBox->SetToolTip(_("Comment this line out. Commented lines don't show up on screen.")); - StyleBox = new wxComboBox(this,STYLE_COMBOBOX,_T(""),wxDefaultPosition,wxSize(110,25),styles,wxCB_READONLY); + StyleBox = new wxComboBox(this,STYLE_COMBOBOX,_T(""),wxDefaultPosition,wxSize(110,25),styles,wxCB_READONLY | wxTE_PROCESS_ENTER); StyleBox->SetToolTip(_("Style for this line.")); - ActorBox = new wxComboBox(this,ACTOR_COMBOBOX,_T(""),wxDefaultPosition,wxSize(110,25),styles,wxCB_DROPDOWN); + ActorBox = new wxComboBox(this,ACTOR_COMBOBOX,_T(""),wxDefaultPosition,wxSize(110,25),styles,wxCB_DROPDOWN | wxTE_PROCESS_ENTER); ActorBox->SetToolTip(_("Actor name for this speech. This is only for reference, and is mainly useless.")); ActorBox->PushEventHandler(new IdleFieldHandler(ActorBox,_("Actor"))); - Effect = new HiliModTextCtrl(this,EFFECT_BOX,_T(""),wxDefaultPosition,wxSize(120,20),0); + Effect = new HiliModTextCtrl(this,EFFECT_BOX,_T(""),wxDefaultPosition,wxSize(120,20),wxTE_PROCESS_ENTER); Effect->SetToolTip(_("Effect for this line. This can be used to store extra information for karaoke scripts, or for the effects supported by the renderer.")); Effect->PushEventHandler(new IdleFieldHandler(Effect,_("Effect"))); // Middle controls - Layer = new HiliModTextCtrl(this,LAYER_BOX,_T(""),wxDefaultPosition,wxSize(40,20),0,NumValidator()); + Layer = new HiliModTextCtrl(this,LAYER_BOX,_T(""),wxDefaultPosition,wxSize(40,20),wxTE_PROCESS_ENTER,NumValidator()); Layer->SetToolTip(_("Layer number")); - StartTime = new TimeEdit(this,STARTTIME_BOX,_T(""),wxDefaultPosition,wxSize(75,20)); + StartTime = new TimeEdit(this,STARTTIME_BOX,_T(""),wxDefaultPosition,wxSize(75,20),wxTE_PROCESS_ENTER,NumValidator()); StartTime->SetToolTip(_("Start time")); StartTime->showModified = true; - EndTime = new TimeEdit(this,ENDTIME_BOX,_T(""),wxDefaultPosition,wxSize(75,20),0,NumValidator()); + EndTime = new TimeEdit(this,ENDTIME_BOX,_T(""),wxDefaultPosition,wxSize(75,20),wxTE_PROCESS_ENTER,NumValidator()); EndTime->SetToolTip(_("End time")); EndTime->isEnd = true; EndTime->showModified = true; - Duration = new TimeEdit(this,DURATION_BOX,_T(""),wxDefaultPosition,wxSize(75,20),0,NumValidator()); + Duration = new TimeEdit(this,DURATION_BOX,_T(""),wxDefaultPosition,wxSize(75,20),wxTE_PROCESS_ENTER,NumValidator()); Duration->SetToolTip(_("Line duration")); Duration->showModified = true; MarginL = new HiliModTextCtrl(this,MARGINL_BOX,_T(""),wxDefaultPosition,wxSize(40,20),wxTE_CENTRE | wxTE_PROCESS_ENTER,NumValidator());