diff --git a/aegisub/src/scintilla_text_ctrl.cpp b/aegisub/src/scintilla_text_ctrl.cpp index a086fa5e8..f147ff1b8 100644 --- a/aegisub/src/scintilla_text_ctrl.cpp +++ b/aegisub/src/scintilla_text_ctrl.cpp @@ -42,6 +42,7 @@ ScintillaTextCtrl::ScintillaTextCtrl(wxWindow* parent, wxWindowID id, const wxString& value, const wxPoint& pos, const wxSize& size, long style) : wxStyledTextCtrl(parent, id, pos, size, style, value) { + Bind(wxEVT_MOUSEWHEEL, &ScintillaTextCtrl::OnMouseWheel, this); } /// @brief Get unicode-compatible position @@ -111,3 +112,10 @@ wxString ScintillaTextCtrl::GetWordAtPosition(int pos) { void ScintillaTextCtrl::SetSelectionU(int start, int end) { SetSelection(GetUnicodePosition(start),GetUnicodePosition(end)); } + +void ScintillaTextCtrl::OnMouseWheel(wxMouseEvent& evt) { + if (ForwardMouseWheelEvent(this, evt)) { + // Skip the event so that wxSTC's default mouse wheel handler is hit + evt.Skip(); + } +} diff --git a/aegisub/src/scintilla_text_ctrl.h b/aegisub/src/scintilla_text_ctrl.h index 98159db21..c4e2045d7 100644 --- a/aegisub/src/scintilla_text_ctrl.h +++ b/aegisub/src/scintilla_text_ctrl.h @@ -45,6 +45,8 @@ /// DOCME class ScintillaTextCtrl : public wxStyledTextCtrl { wxString text; + + void OnMouseWheel(wxMouseEvent& evt); public: wxString GetWordAtPosition(int pos); void GetBoundsOfWordAtPosition(int pos,int &start,int &end);