diff options
Diffstat (limited to 'libs/gtkmm2ext/gtkmm2ext')
-rw-r--r-- | libs/gtkmm2ext/gtkmm2ext/barcontroller.h | 23 | ||||
-rw-r--r-- | libs/gtkmm2ext/gtkmm2ext/bindable_button.h | 50 | ||||
-rw-r--r-- | libs/gtkmm2ext/gtkmm2ext/binding_proxy.h | 54 | ||||
-rw-r--r-- | libs/gtkmm2ext/gtkmm2ext/controller.h | 59 | ||||
-rw-r--r-- | libs/gtkmm2ext/gtkmm2ext/slider_controller.h | 42 |
5 files changed, 82 insertions, 146 deletions
diff --git a/libs/gtkmm2ext/gtkmm2ext/barcontroller.h b/libs/gtkmm2ext/gtkmm2ext/barcontroller.h index 67c8221a55..ebce4e2de9 100644 --- a/libs/gtkmm2ext/gtkmm2ext/barcontroller.h +++ b/libs/gtkmm2ext/gtkmm2ext/barcontroller.h @@ -21,9 +21,9 @@ #define __gtkmm2ext_bar_controller_h__ #include <gtkmm.h> -#include <gtkmm2ext/popup.h> +#include <gtkmm2ext/binding_proxy.h> -namespace MIDI { +namespace ARDOUR { class Controllable; } @@ -32,14 +32,9 @@ namespace Gtkmm2ext { class BarController : public Gtk::Frame { public: - BarController (Gtk::Adjustment& adj, MIDI::Controllable*, sigc::slot<void,char*,unsigned int>); + BarController (Gtk::Adjustment& adj, PBD::Controllable&, sigc::slot<void,char*,unsigned int>); virtual ~BarController () {} - void set_bind_button_state (guint button, guint statemask); - void get_bind_button_state (guint &button, guint &statemask); - void midicontrol_set_tip (); - void midi_learn (); - void set_sensitive (bool yn) { darea.set_sensitive (yn); } @@ -69,9 +64,8 @@ class BarController : public Gtk::Frame protected: Gtk::Adjustment& adjustment; + BindingProxy binding_proxy; Gtk::DrawingArea darea; - Gtkmm2ext::PopUp prompter; - MIDI::Controllable* midi_control; sigc::slot<void,char*,unsigned int> label_callback; Glib::RefPtr<Pango::Layout> layout; Style _style; @@ -85,10 +79,6 @@ class BarController : public Gtk::Frame Gtk::SpinButton spinner; bool use_parent; - guint bind_button; - guint bind_statemask; - bool prompting, unprompting; - bool button_press (GdkEventButton *); bool button_release (GdkEventButton *); bool motion (GdkEventMotion *); @@ -98,11 +88,6 @@ class BarController : public Gtk::Frame gint mouse_control (double x, GdkWindow* w, double scaling); - gint prompter_hiding (GdkEventAny *); - void midicontrol_prompt (); - void midicontrol_unprompt (); - void update_midi_control (); - gint switch_to_bar (); gint switch_to_spinner (); diff --git a/libs/gtkmm2ext/gtkmm2ext/bindable_button.h b/libs/gtkmm2ext/gtkmm2ext/bindable_button.h index 7400cf15d0..1936125405 100644 --- a/libs/gtkmm2ext/gtkmm2ext/bindable_button.h +++ b/libs/gtkmm2ext/gtkmm2ext/bindable_button.h @@ -18,59 +18,31 @@ $Id$ */ -#ifndef __pbd_gtkmm_bindable_button_h__ -#define __pbd_gtkmm_bindable_button_h__ +#ifndef __bindable_button_h__ +#define __bindable_button_h__ #include <string> #include <gtkmm2ext/stateful_button.h> -#include <gtkmm2ext/popup.h> +#include "binding_proxy.h" -namespace MIDI { +namespace PBD { class Controllable; } -namespace Gtkmm2ext { - class BindableToggleButton : public Gtk::ToggleButton { public: - BindableToggleButton(MIDI::Controllable *); - - //: Create a check button with a label. - //- You won't be able - //- to add a widget in this button since it already has a {\class Gtk_Label} - //- in it. - explicit BindableToggleButton(MIDI::Controllable *, const std::string &label); - + BindableToggleButton (PBD::Controllable& c) : binding_proxy (c) {} + explicit BindableToggleButton (PBD::Controllable& c, const std::string &label) : Gtk::ToggleButton (label), binding_proxy (c) {} virtual ~BindableToggleButton() {} - void set_bind_button_state (guint button, guint statemask); - void get_bind_button_state (guint &button, guint &statemask); - - void midicontrol_set_tip (); - - void midi_learn (); - - protected: - - Gtkmm2ext::PopUp prompter; - - MIDI::Controllable* midi_control; - - guint bind_button; - guint bind_statemask; - - bool prompting, unprompting; - - void init_events (); - bool prompter_hiding (GdkEventAny *); - void midicontrol_prompt (); - void midicontrol_unprompt (); - - bool on_button_press_event (GdkEventButton *); -}; + bool on_button_press_event (GdkEventButton *ev) { + return binding_proxy.button_press_handler (ev); + } + private: + BindingProxy binding_proxy; }; #endif diff --git a/libs/gtkmm2ext/gtkmm2ext/binding_proxy.h b/libs/gtkmm2ext/gtkmm2ext/binding_proxy.h new file mode 100644 index 0000000000..a26c8ace2a --- /dev/null +++ b/libs/gtkmm2ext/gtkmm2ext/binding_proxy.h @@ -0,0 +1,54 @@ +/* + Copyright (C) 2006 Paul Davis + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + + $Id$ +*/ + +#ifndef __binding_proxy__ +#define __binding_proxy__ + +#include <string> + +#include <gtkmm2ext/popup.h> + +namespace PBD { + class Controllable; +} + +class BindingProxy : public sigc::trackable +{ + public: + BindingProxy (PBD::Controllable&); + virtual ~BindingProxy() {} + + void set_bind_button_state (guint button, guint statemask); + void get_bind_button_state (guint &button, guint &statemask); + + bool button_press_handler (GdkEventButton *); + + protected: + + Gtkmm2ext::PopUp prompter; + PBD::Controllable& controllable; + guint bind_button; + guint bind_statemask; + sigc::connection learning_connection; + void learning_finished (); + bool prompter_hiding (GdkEventAny *); +}; + +#endif diff --git a/libs/gtkmm2ext/gtkmm2ext/controller.h b/libs/gtkmm2ext/gtkmm2ext/controller.h deleted file mode 100644 index b72f6c7ed7..0000000000 --- a/libs/gtkmm2ext/gtkmm2ext/controller.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - Copyright (C) 1998-99 Paul Davis - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - - $Id$ -*/ - -#ifndef __gtkmm2ext_controller_h__ -#define __gtkmm2ext_controller_h__ - -#include <gtkmm.h> -#include <gtkmm2ext/popup.h> -#include <midi++/controllable.h> - -namespace Gtkmm2ext { - -class Controller : public MIDI::Controllable - -{ - public: - Controller (Gtk::Adjustment *, MIDI::Port *); - virtual ~Controller () {} - - void set_value (float); - float lower () { return adjustment->get_lower(); } - float upper () { return adjustment->get_upper(); } - float range () { return upper() - lower() /* XXX +1 ??? */ ; } - - void midicontrol_prompt (); - void midicontrol_unprompt (); - - protected: - Gtk::Adjustment *adjustment; - - private: - Gtkmm2ext::PopUp prompter; - gfloat new_value; - bool new_value_pending; - - static gint update_controller_value (void *); -}; - -}; /* namespace */ - -#endif // __gtkmm2ext_controller_h__ - - diff --git a/libs/gtkmm2ext/gtkmm2ext/slider_controller.h b/libs/gtkmm2ext/gtkmm2ext/slider_controller.h index 7abaf285d1..f0f645eab7 100644 --- a/libs/gtkmm2ext/gtkmm2ext/slider_controller.h +++ b/libs/gtkmm2ext/gtkmm2ext/slider_controller.h @@ -1,5 +1,5 @@ /* - Copyright (C) 1998-99 Paul Davis + Copyright (C) 1998-2006 Paul Davis This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or @@ -17,18 +17,19 @@ $Id$ */ -#ifndef __gtkmm2ext_motion_controller_h__ -#define __gtkmm2ext_motion_controller_h__ +#ifndef __gtkmm2ext_slider_controller_h__ +#define __gtkmm2ext_slider_controller_h__ #include <gtkmm.h> #include <gtkmm2ext/popup.h> #include <gtkmm2ext/pixscroller.h> +#include <gtkmm2ext/binding_proxy.h> namespace Gtkmm2ext { class Pix; } -namespace MIDI { +namespace PBD { class Controllable; } @@ -40,41 +41,24 @@ class SliderController : public Gtkmm2ext::PixScroller SliderController (Glib::RefPtr<Gdk::Pixbuf> slider, Glib::RefPtr<Gdk::Pixbuf> rail, Gtk::Adjustment* adj, - MIDI::Controllable*, + PBD::Controllable&, bool with_numeric = true); virtual ~SliderController () {} - void set_bind_button_state (guint button, guint statemask); - void get_bind_button_state (guint &button, guint &statemask); - void midicontrol_set_tip (); - void midi_learn (); - void set_value (float); - // void set_sensitive (bool yn) { - // spin.set_sensitive (yn); - // } - Gtk::SpinButton & get_spin_button () { return spin; } + Gtk::SpinButton& get_spin_button () { return spin; } + bool on_button_press_event (GdkEventButton *ev); + protected: + BindingProxy binding_proxy; Glib::RefPtr<Gdk::Pixbuf> slider; Glib::RefPtr<Gdk::Pixbuf> rail; Gtk::SpinButton spin; Gtk::Frame spin_frame; Gtk::HBox spin_hbox; - Gtkmm2ext::PopUp prompter; - MIDI::Controllable* midi_control; - - guint bind_button; - guint bind_statemask; - bool prompting, unprompting; - - bool button_press (GdkEventButton *); - bool prompter_hiding (GdkEventAny *); - void midicontrol_prompt (); - void midicontrol_unprompt (); - void update_midi_control (); }; class VSliderController : public SliderController @@ -83,7 +67,7 @@ class VSliderController : public SliderController VSliderController (Glib::RefPtr<Gdk::Pixbuf> slider, Glib::RefPtr<Gdk::Pixbuf> rail, Gtk::Adjustment *adj, - MIDI::Controllable *, + PBD::Controllable&, bool with_numeric = true); }; @@ -93,11 +77,11 @@ class HSliderController : public SliderController HSliderController (Glib::RefPtr<Gdk::Pixbuf> slider, Glib::RefPtr<Gdk::Pixbuf> rail, Gtk::Adjustment *adj, - MIDI::Controllable *, + PBD::Controllable&, bool with_numeric = true); }; }; /* namespace */ -#endif // __gtkmm2ext_motion_controller_h__ +#endif // __gtkmm2ext_slider_controller_h__ |