Commit 2699b0ea authored by twanvl's avatar twanvl

Scroll wheel in native look editor now scrolls window under cursor

parent ef988aca
...@@ -131,10 +131,16 @@ void NativeLookEditor::onScroll(wxScrollWinEvent& ev) { ...@@ -131,10 +131,16 @@ void NativeLookEditor::onScroll(wxScrollWinEvent& ev) {
} }
} }
void NativeLookEditor::onMouseWheel(wxMouseEvent& ev) { void NativeLookEditor::onMouseWheel(wxMouseEvent& ev) {
if (current_editor) { // send scroll event to field under cursor
bool scrolled = current_editor->onMouseWheel(mousePoint(ev), ev); RealPoint pos = mousePoint(ev);
if (scrolled) return; 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 toScroll = 10 * ev.GetWheelRotation() * ev.GetLinesPerAction() / ev.GetWheelDelta(); // note: up is positive
int y = GetScrollPos(wxVERTICAL); int y = GetScrollPos(wxVERTICAL);
scrollTo(wxVERTICAL, y - toScroll); scrollTo(wxVERTICAL, y - toScroll);
......
...@@ -45,6 +45,8 @@ void SetInfoPanel::initUI(wxToolBar* tb, wxMenuBar* mb) { ...@@ -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_SYMBOL, _("symbol"), _MENU_("symbols"), _HELP_("symbols"), wxITEM_CHECK);
menuFormat->Append(ID_FORMAT_REMINDER, _("reminder"), _MENU_("reminder text"), _HELP_("reminder text"), wxITEM_CHECK); menuFormat->Append(ID_FORMAT_REMINDER, _("reminder"), _MENU_("reminder text"), _HELP_("reminder text"), wxITEM_CHECK);
mb->Insert(2, menuFormat, _MENU_("format")); mb->Insert(2, menuFormat, _MENU_("format"));
// focus on editor
editor->SetFocus();
} }
void SetInfoPanel::destroyUI(wxToolBar* tb, wxMenuBar* mb) { void SetInfoPanel::destroyUI(wxToolBar* tb, wxMenuBar* mb) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment