diff --git a/aegisub/src/subs_edit_box.cpp b/aegisub/src/subs_edit_box.cpp index cddeb813e..8ab73baab 100644 --- a/aegisub/src/subs_edit_box.cpp +++ b/aegisub/src/subs_edit_box.cpp @@ -75,7 +75,7 @@ template struct field_setter : public std::binary_function { T AssDialogue::*field; field_setter(T AssDialogue::*field) : field(field) { } - void operator()(AssDialogue* obj, T value) { + void operator()(AssDialogue* obj, T const& value) { obj->*field = value; } }; @@ -236,7 +236,7 @@ void SubsEditBox::MakeButton(const char *cmd_name) { ToolTipManager::Bind(btn, command->StrHelp(), "Subtitle Edit Box", cmd_name); MiddleBotSizer->Add(btn, wxSizerFlags().Center().Expand()); - btn->Bind(wxEVT_COMMAND_BUTTON_CLICKED, std::tr1::bind(cmd::call, cmd_name, c)); + btn->Bind(wxEVT_COMMAND_BUTTON_CLICKED, std::tr1::bind(&SubsEditBox::CallCommand, this, cmd_name)); } wxComboBox *SubsEditBox::MakeComboBox(wxString const& initial_text, int style, void (SubsEditBox::*handler)(wxCommandEvent&), wxString const& tooltip) { @@ -544,3 +544,8 @@ void SubsEditBox::OnEffectChange(wxCommandEvent &) { void SubsEditBox::OnCommentChange(wxCommandEvent &) { SetSelectedRows(&AssDialogue::Comment, CommentBox->GetValue(), _("comment change"), AssFile::COMMIT_DIAG_META); } + +void SubsEditBox::CallCommand(const char *cmd_name) { + cmd::call(cmd_name, c); + TextEdit->SetFocus(); +} diff --git a/aegisub/src/subs_edit_box.h b/aegisub/src/subs_edit_box.h index 1ba5cea35..e995e2d08 100644 --- a/aegisub/src/subs_edit_box.h +++ b/aegisub/src/subs_edit_box.h @@ -198,6 +198,9 @@ class SubsEditBox : public wxPanel { /// @brief Enable or disable frame timing mode void UpdateFrameTiming(agi::vfr::Framerate const& fps); + /// Call a command the restore focus to the edit box + void CallCommand(const char *cmd_name); + SubsTextEditCtrl *TextEdit; agi::scoped_ptr textSelectionController;