From 1bf5af3de408f2a5d676dcf5ab41d61bfcc5ec4c Mon Sep 17 00:00:00 2001 From: twanvl Date: Thu, 22 Mar 2007 13:07:39 +0000 Subject: [PATCH] Scroll wheel in native look editor now scrolls window under cursor git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@226 0fc631ac-6414-0410-93d0-97cfa31319b6 --- src/gui/control/native_look_editor.cpp | 12 +++++++++--- src/gui/set/set_info_panel.cpp | 2 ++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/gui/control/native_look_editor.cpp b/src/gui/control/native_look_editor.cpp index d08d6888..697d84b1 100644 --- a/src/gui/control/native_look_editor.cpp +++ b/src/gui/control/native_look_editor.cpp @@ -131,10 +131,16 @@ void NativeLookEditor::onScroll(wxScrollWinEvent& ev) { } } void NativeLookEditor::onMouseWheel(wxMouseEvent& ev) { - if (current_editor) { - bool scrolled = current_editor->onMouseWheel(mousePoint(ev), ev); - if (scrolled) return; + // send scroll event to field under cursor + RealPoint pos = mousePoint(ev); + FOR_EACH_EDITOR_REVERSE { // find high z index fields first + if (v->containsPoint(pos) && v->getField()->editable) { + bool scrolled = e->onMouseWheel(mousePoint(ev), ev); + if (scrolled) return; + break; + } } + // scroll entire window int toScroll = 10 * ev.GetWheelRotation() * ev.GetLinesPerAction() / ev.GetWheelDelta(); // note: up is positive int y = GetScrollPos(wxVERTICAL); scrollTo(wxVERTICAL, y - toScroll); diff --git a/src/gui/set/set_info_panel.cpp b/src/gui/set/set_info_panel.cpp index 161a90a4..11ab0db4 100644 --- a/src/gui/set/set_info_panel.cpp +++ b/src/gui/set/set_info_panel.cpp @@ -45,6 +45,8 @@ void SetInfoPanel::initUI(wxToolBar* tb, wxMenuBar* mb) { menuFormat->Append(ID_FORMAT_SYMBOL, _("symbol"), _MENU_("symbols"), _HELP_("symbols"), wxITEM_CHECK); menuFormat->Append(ID_FORMAT_REMINDER, _("reminder"), _MENU_("reminder text"), _HELP_("reminder text"), wxITEM_CHECK); mb->Insert(2, menuFormat, _MENU_("format")); + // focus on editor + editor->SetFocus(); } void SetInfoPanel::destroyUI(wxToolBar* tb, wxMenuBar* mb) {