X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=libs%2Fgtkmm2ext%2Fscroomer.cc;h=07e5b464528e3f9a1a8c4759b77e7811482c7185;hb=51ad790745400eeb38547fa4de842202fec934b8;hp=0f252070064e0999632a665f1e76f36a69037ac3;hpb=3a97c19e1e3d5dcbe71067cde4652efc9f255c18;p=ardour.git diff --git a/libs/gtkmm2ext/scroomer.cc b/libs/gtkmm2ext/scroomer.cc index 0f25207006..07e5b46452 100644 --- a/libs/gtkmm2ext/scroomer.cc +++ b/libs/gtkmm2ext/scroomer.cc @@ -18,7 +18,9 @@ */ #include -#include + +#include "gtkmm2ext/scroomer.h" +#include "gtkmm2ext/keyboard.h" using namespace Gtkmm2ext; using namespace Gtk; @@ -28,8 +30,8 @@ using namespace std; Scroomer::Scroomer(Gtk::Adjustment& adjustment) : adj(adjustment) , handle_size(0) - , grab_comp(None) { - + , grab_comp(None) +{ position[TopBase] = 0; position[Handle1] = 0; position[Slider] = 0; @@ -74,8 +76,8 @@ Scroomer::on_motion_notify_event (GdkEventMotion* ev) grab_y = ev->y; - if (ev->state & GDK_CONTROL_MASK) { - if (ev->state & GDK_MOD1_MASK) { + if (ev->state & Keyboard::PrimaryModifier) { + if (ev->state & Keyboard::SecondaryModifier) { scale = 0.05; } else { scale = 0.1; @@ -88,7 +90,7 @@ Scroomer::on_motion_notify_event (GdkEventMotion* ev) fract = max (-1.0, fract); fract = -fract; - switch(grab_comp) { + switch (grab_comp) { case TopBase: case BottomBase: unzoomed_val += scale * fract * range; @@ -118,8 +120,7 @@ Scroomer::on_motion_notify_event (GdkEventMotion* ev) break; } - /* - * Then we handle zoom, which is dragging horizontally. We zoom around the area that is + /* 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 */ @@ -232,7 +233,7 @@ Scroomer::on_button_release_event (GdkEventButton* ev) return true; } - switch(grab_comp) { + switch (grab_comp) { case TopBase: break; case Handle1: @@ -269,15 +270,14 @@ Scroomer::on_size_allocate (Allocation& a) update(); } -/* - * assumes that x and width are correct, and they will not be altered +/** Assumes that x and width are correct, and they will not be altered. */ void Scroomer::set_comp_rect(GdkRectangle& r, Component c) const { int index = (int) c; - switch(c) { + switch (c) { case None: return; case Total: @@ -374,7 +374,7 @@ Scroomer::adjustment_changed() std::string Scroomer::get_comp_name(Component c) { - switch(c) { + switch (c) { case TopBase: return "TopBase"; case Handle1: