X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fgtkmm2ext%2Fscroomer.cc;h=6e27f5ce0a6d79c1339aea12f310f86a2e9695dd;hb=ba8742edd11ea8cb0dd3afef9e18b05025421c70;hp=3009449c91e0c8804790743d7f6406896a9f77fc;hpb=847e8f06107293254606d499aeb3e8a2006b9b78;p=ardour.git diff --git a/libs/gtkmm2ext/scroomer.cc b/libs/gtkmm2ext/scroomer.cc index 3009449c91..6e27f5ce0a 100644 --- a/libs/gtkmm2ext/scroomer.cc +++ b/libs/gtkmm2ext/scroomer.cc @@ -74,6 +74,10 @@ Scroomer::on_motion_notify_event (GdkEventMotion* ev) return true; } + if (ev->y < 0 || ev->y > get_height ()) { + return true; + } + grab_y = ev->y; if (ev->state & Keyboard::PrimaryModifier) { @@ -138,10 +142,11 @@ Scroomer::on_motion_notify_event (GdkEventMotion* ev) /* Then we handle zoom, which is dragging horizontally. We zoom around the area that is * the current y pointer value, not from the area that was the start of the drag. - * the point of zoom must have the same + * We don't start doing zoom until we are at least one scroomer width outside the scroomer's + * area. */ - if (ev->x > get_width()) { + if (ev->x > (get_width() * 2)) { zoom = ev->x - get_width(); double higher = unzoomed_val + unzoomed_page - half_min_page - val_at_pointer; @@ -194,9 +199,10 @@ Scroomer::on_motion_notify_event (GdkEventMotion* ev) val = unzoomed_val; page = unzoomed_page; } - - adj.set_page_size(page); - adj.set_value(val); + + /* Round these values to stop the scroomer handlers quivering about during drags */ + adj.set_page_size (rint (page)); + adj.set_value (rint (val)); adj.value_changed(); return true; @@ -207,10 +213,10 @@ Scroomer::on_scroll_event (GdkEventScroll* ev) { switch (ev->direction) { case GDK_SCROLL_UP: - adj.set_value (adj.get_value() - adj.get_page_size()/10.0); + adj.set_value (adj.get_value() + adj.get_page_size() / 10.0); break; case GDK_SCROLL_DOWN: - adj.set_value (adj.get_value() + adj.get_page_size()/10.0); + adj.set_value (adj.get_value() - adj.get_page_size() / 10.0); break; default: return false; @@ -241,8 +247,14 @@ Scroomer::on_button_press_event (GdkEventButton* ev) } else { pinch = false; } + + DragStarting (); /* EMIT SIGNAL */ } + if (ev->type == GDK_2BUTTON_PRESS && ev->button == 1) { + DoubleClicked(); + } + return false; } @@ -281,6 +293,7 @@ Scroomer::on_button_release_event (GdkEventButton* ev) grab_comp = None; remove_modal_grab(); + DragFinishing (); /* EMIT SIGNAL */ return true; } @@ -391,29 +404,5 @@ Scroomer::adjustment_changed() rect.set_height(position[BottomBase] - old_pos[Handle2]); win->invalidate_rect(rect, false); } - - win->process_updates(false); } -std::string -Scroomer::get_comp_name(Component c) -{ - switch (c) { - case TopBase: - return "TopBase"; - case Handle1: - return "Handle1"; - case Slider: - return "Slider"; - case Handle2: - return "Handle2"; - case BottomBase: - return "BottomBase"; - case Total: - return "Total"; - case None: - return "None"; - default: - return "ERROR"; - } -}