diff options
author | Carl Hetherington <carl@carlh.net> | 2010-11-26 00:29:12 +0000 |
---|---|---|
committer | Carl Hetherington <carl@carlh.net> | 2010-11-26 00:29:12 +0000 |
commit | 1539ac1b9661f0c0bb313d8f0d9a72b6dc95aaf1 (patch) | |
tree | 4fb53c3a175339a899f39a7a8598d75aed254f02 | |
parent | 54cbc45a5a40f4eefd64fa41ad9029f5f8f6a84f (diff) |
Somewhat distasteful hack to fix #3469 (broken keyboard-entry of pan values)
git-svn-id: svn://localhost/ardour2/branches/3.0@8090 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r-- | gtk2_ardour/mixer_strip.cc | 11 | ||||
-rw-r--r-- | gtk2_ardour/panner_ui.cc | 8 | ||||
-rw-r--r-- | gtk2_ardour/panner_ui.h | 4 | ||||
-rw-r--r-- | libs/gtkmm2ext/barcontroller.cc | 6 | ||||
-rw-r--r-- | libs/gtkmm2ext/gtkmm2ext/barcontroller.h | 5 |
5 files changed, 33 insertions, 1 deletions
diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc index f5ed9d8618..dc788dd35e 100644 --- a/gtk2_ardour/mixer_strip.cc +++ b/gtk2_ardour/mixer_strip.cc @@ -1912,7 +1912,16 @@ bool MixerStrip::on_enter_notify_event (GdkEventCrossing*) { Keyboard::magic_widget_grab_focus (); - grab_focus (); + + if (!panners._bar_spinner_active) { + /* This next grab_focus() causes a focus-out event to be sent to, amongst + * other things, panner BarControllers. When they receive it, they abort + * the use of any SpinButton that might be in use to change pan settings. + * Hence we have this horrific hack which stops the grab_focus () call + * happening if a bar spinner is active. + */ + grab_focus (); + } return false; } diff --git a/gtk2_ardour/panner_ui.cc b/gtk2_ardour/panner_ui.cc index ea9b270bb5..25580f0f51 100644 --- a/gtk2_ardour/panner_ui.cc +++ b/gtk2_ardour/panner_ui.cc @@ -58,6 +58,7 @@ PannerUI::PannerUI (Session* s) , panning_link_button (_("link")) , pan_automation_style_button ("") , pan_automation_state_button ("") + , _bar_spinner_active (false) { set_session (s); @@ -453,6 +454,7 @@ PannerUI::setup_pan () (sigc::bind (sigc::mem_fun(*this, &PannerUI::pan_button_event), (uint32_t) asz)); bc->set_size_request (-1, pan_bar_height); + bc->SpinnerActive.connect (sigc::mem_fun (*this, &PannerUI::bar_spinner_activate)); pan_bars.push_back (bc); pan_bar_packer.pack_start (*bc, false, false); @@ -921,3 +923,9 @@ PannerUI::connect_to_pan_control (uint32_t i) _pan_control_connections, invalidator (*this), boost::bind (&PannerUI::pan_value_changed, this, i), gui_context () ); } + +void +PannerUI::bar_spinner_activate (bool a) +{ + _bar_spinner_active = a; +} diff --git a/gtk2_ardour/panner_ui.h b/gtk2_ardour/panner_ui.h index 0e16d01a64..4c0039a8d3 100644 --- a/gtk2_ardour/panner_ui.h +++ b/gtk2_ardour/panner_ui.h @@ -170,6 +170,10 @@ class PannerUI : public Gtk::HBox, public ARDOUR::SessionHandlePtr void start_touch (boost::weak_ptr<ARDOUR::AutomationControl>); void stop_touch (boost::weak_ptr<ARDOUR::AutomationControl>); + + void bar_spinner_activate (bool); + /** true if any of our PannerBars are currently using a SpinButton to modify value */ + bool _bar_spinner_active; }; #endif /* __ardour_gtk_panner_ui_h__ */ diff --git a/libs/gtkmm2ext/barcontroller.cc b/libs/gtkmm2ext/barcontroller.cc index 75e5d4e7d6..1b8c210fc9 100644 --- a/libs/gtkmm2ext/barcontroller.cc +++ b/libs/gtkmm2ext/barcontroller.cc @@ -398,6 +398,9 @@ BarController::switch_to_bar () darea.show (); switching = false; + + SpinnerActive (false); /* EMIT SIGNAL */ + return FALSE; } @@ -421,6 +424,9 @@ BarController::switch_to_spinner () spinner.grab_focus (); switching = false; + + SpinnerActive (true); /* EMIT SIGNAL */ + return FALSE; } diff --git a/libs/gtkmm2ext/gtkmm2ext/barcontroller.h b/libs/gtkmm2ext/gtkmm2ext/barcontroller.h index f3eb2f41cd..1a0b78dabe 100644 --- a/libs/gtkmm2ext/gtkmm2ext/barcontroller.h +++ b/libs/gtkmm2ext/gtkmm2ext/barcontroller.h @@ -61,6 +61,11 @@ class BarController : public Gtk::Frame boost::shared_ptr<PBD::Controllable> get_controllable() { return binding_proxy.get_controllable(); } void set_controllable(boost::shared_ptr<PBD::Controllable> c) { binding_proxy.set_controllable(c); } + /** Emitted when the adjustment spinner is activated or deactivated; + * the parameter is true on activation, false on deactivation. + */ + sigc::signal<void, bool> SpinnerActive; + protected: Gtk::Adjustment& adjustment; BindingProxy binding_proxy; |