From e4c30241e8ed4ba79c37f568ca683be7644f52a8 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Sun, 9 Nov 2008 08:22:48 +0000 Subject: [PATCH] a few useful keybindings in the xfade editor git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@4116 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/canvas-waveview.c | 5 ++-- gtk2_ardour/crossfade_edit.cc | 45 +++++++++++++++++++++++++++++++++++ gtk2_ardour/crossfade_edit.h | 4 ++++ 3 files changed, 52 insertions(+), 2 deletions(-) diff --git a/gtk2_ardour/canvas-waveview.c b/gtk2_ardour/canvas-waveview.c index 9e05ec65a0..3821d6ff98 100644 --- a/gtk2_ardour/canvas-waveview.c +++ b/gtk2_ardour/canvas-waveview.c @@ -1359,8 +1359,9 @@ gnome_canvas_waveview_render (GnomeCanvasItem *item, prev_pymax = pymax; prev_pymin = pymin; } - } - else if(waveview->filled && rectify) { + + } else if (waveview->filled && rectify) { + int prev_pymax = -1; int last_pymax = -1; int next_pymax; diff --git a/gtk2_ardour/crossfade_edit.cc b/gtk2_ardour/crossfade_edit.cc index c5d7b72db4..b47247c68d 100644 --- a/gtk2_ardour/crossfade_edit.cc +++ b/gtk2_ardour/crossfade_edit.cc @@ -1338,3 +1338,48 @@ CrossfadeEditor::audition_left_dry_toggled () } } } + +bool +CrossfadeEditor::on_key_press_event (GdkEventKey *ev) +{ + return true; +} + +bool +CrossfadeEditor::on_key_release_event (GdkEventKey* ev) +{ + switch (ev->keyval) { + case GDK_Right: + if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) { + audition_right_dry_button.set_active (!audition_right_dry_button.get_active()); + } else { + audition_right_button.set_active (!audition_right_button.get_active()); + } + break; + + case GDK_Left: + if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) { + audition_left_dry_button.set_active (!audition_left_dry_button.get_active()); + } else { + audition_left_button.set_active (!audition_left_button.get_active()); + } + break; + + case GDK_space: + if (audition_left_dry_button.get_active() || + audition_left_button.get_active () || + audition_right_dry_button.get_active () || + audition_right_button.get_active () || + audition_both_button.get_active ()) { + cancel_audition (); + } else { + audition_both_button.set_active (!audition_both_button.get_active()); + } + break; + + default: + break; + } + + return true; +} diff --git a/gtk2_ardour/crossfade_edit.h b/gtk2_ardour/crossfade_edit.h index 3d51771e2b..e3b7338356 100644 --- a/gtk2_ardour/crossfade_edit.h +++ b/gtk2_ardour/crossfade_edit.h @@ -72,6 +72,10 @@ class CrossfadeEditor : public ArdourDialog static Presets* fade_in_presets; static Presets* fade_out_presets; + + protected: + bool on_key_press_event (GdkEventKey*); + bool on_key_release_event (GdkEventKey*); private: boost::shared_ptr xfade;