diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2009-10-28 19:56:00 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2009-10-28 19:56:00 +0000 |
commit | 7fb1446cb255220e5456145be482e07fbd524a00 (patch) | |
tree | 174bdc89e374707f840b4a02b891831d8b0b6ba0 | |
parent | e5c44367bcdde76d419cb723b5ffa52de61ec3b7 (diff) |
key stroke (left/right arrow) and wheel (left/right, shift-down/up) scrolling in mixer window
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@5958 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r-- | gtk2_ardour/mixer_ui.cc | 58 | ||||
-rw-r--r-- | gtk2_ardour/mixer_ui.h | 3 |
2 files changed, 61 insertions, 0 deletions
diff --git a/gtk2_ardour/mixer_ui.cc b/gtk2_ardour/mixer_ui.cc index a024661006..e2946f823b 100644 --- a/gtk2_ardour/mixer_ui.cc +++ b/gtk2_ardour/mixer_ui.cc @@ -1478,8 +1478,66 @@ Mixer_UI::pane_allocation_handler (Allocation& alloc, Gtk::Paned* which) } } +void +Mixer_UI::scroll_left () +{ + Adjustment* adj = scroller.get_hscrollbar()->get_adjustment(); + /* stupid GTK: can't rely on clamping across versions */ + scroller.get_hscrollbar()->set_value (max (adj->get_lower(), adj->get_value() - adj->get_step_increment())); +} + +void +Mixer_UI::scroll_right () +{ + Adjustment* adj = scroller.get_hscrollbar()->get_adjustment(); + /* stupid GTK: can't rely on clamping across versions */ + scroller.get_hscrollbar()->set_value (min (adj->get_upper(), adj->get_value() + adj->get_step_increment())); +} + bool Mixer_UI::on_key_press_event (GdkEventKey* ev) { + switch (ev->keyval) { + case GDK_Left: + scroll_left (); + return true; + + case GDK_Right: + scroll_right (); + return true; + + default: + break; + } + return key_press_focus_accelerator_handler (*this, ev); } + +bool +Mixer_UI::on_scroll_event (GdkEventScroll* ev) +{ + switch (ev->direction) { + case GDK_SCROLL_LEFT: + scroll_left (); + return true; + case GDK_SCROLL_UP: + if (ev->state & Keyboard::TertiaryModifier) { + scroll_left (); + return true; + } + return false; + + case GDK_SCROLL_RIGHT: + scroll_right (); + return true; + + case GDK_SCROLL_DOWN: + if (ev->state & Keyboard::TertiaryModifier) { + scroll_right (); + return true; + } + return false; + } + + return false; +} diff --git a/gtk2_ardour/mixer_ui.h b/gtk2_ardour/mixer_ui.h index 1c5ecda850..809e7a759c 100644 --- a/gtk2_ardour/mixer_ui.h +++ b/gtk2_ardour/mixer_ui.h @@ -113,12 +113,15 @@ class Mixer_UI : public Gtk::Window void get_window_pos_and_size (); bool on_key_press_event (GdkEventKey*); + bool on_scroll_event (GdkEventScroll*); void pane_allocation_handler (Gtk::Allocation&, Gtk::Paned*); list<MixerStrip *> strips; bool strip_scroller_button_release (GdkEventButton*); + void scroll_left (); + void scroll_right (); void add_strip (ARDOUR::Session::RouteList&); void remove_strip (MixerStrip *); |