NOOP, remove trailing tabs/whitespace.
[ardour.git] / libs / gtkmm2ext / gtkmm2ext / slider_controller.h
index 7abaf285d197d28f0c06b0e4312aef2df896b9c7..e756180eaf0b47671bf55c3040718d5720f89733 100644 (file)
@@ -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
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
-    $Id$
 */
 
-#ifndef __gtkmm2ext_motion_controller_h__
-#define __gtkmm2ext_motion_controller_h__
+#ifndef __gtkmm2ext_slider_controller_h__
+#define __gtkmm2ext_slider_controller_h__
+
+#ifdef interface
+#undef interface
+#endif
 
 #include <gtkmm.h>
 #include <gtkmm2ext/popup.h>
-#include <gtkmm2ext/pixscroller.h>
+#include <gtkmm2ext/pixfader.h>
+#include <gtkmm2ext/binding_proxy.h>
+
+#include <boost/shared_ptr.hpp>
+
+#include "gtkmm2ext/visibility.h"
 
 namespace Gtkmm2ext {
        class Pix;
 }
 
-namespace MIDI {
+namespace PBD {
        class Controllable;
 }
 
 namespace Gtkmm2ext {
 
-class SliderController : public Gtkmm2ext::PixScroller
+class LIBGTKMM2EXT_API SliderController : public Gtkmm2ext::PixFader
 {
-  public:
-       SliderController (Glib::RefPtr<Gdk::Pixbuf> slider,
-                         Glib::RefPtr<Gdk::Pixbuf> rail,
-                         Gtk::Adjustment* adj,
-                         MIDI::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; }
-       
-  protected:
-       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 ();
+       public:
+       SliderController (Gtk::Adjustment* adj, boost::shared_ptr<PBD::Controllable> mc, int orientation, int, int);
+
+       virtual ~SliderController () {}
+
+       Gtk::SpinButton& get_spin_button () { assert(_ctrl); return _spin; }
+       void set_controllable (boost::shared_ptr<PBD::Controllable> c) { _binding_proxy.set_controllable (c); }
+
+       protected:
+       bool on_button_press_event (GdkEventButton *ev);
+       void ctrl_adjusted();
+       void spin_adjusted();
+
+       BindingProxy _binding_proxy;
+       boost::shared_ptr<PBD::Controllable> _ctrl;
+       Gtk::Adjustment *_ctrl_adj;
+       Gtk::Adjustment _spin_adj;
+       Gtk::SpinButton _spin;
+       bool _ctrl_ignore;
+       bool _spin_ignore;
 };
 
-class VSliderController : public SliderController
+class LIBGTKMM2EXT_API VSliderController : public SliderController
 {
-  public:
-       VSliderController (Glib::RefPtr<Gdk::Pixbuf> slider,
-                          Glib::RefPtr<Gdk::Pixbuf> rail,
-                          Gtk::Adjustment *adj,
-                          MIDI::Controllable *,
-                          bool with_numeric = true);
+       public:
+       VSliderController (Gtk::Adjustment *adj, boost::shared_ptr<PBD::Controllable> mc, int, int);
 };
 
-class HSliderController : public SliderController
+class LIBGTKMM2EXT_API HSliderController : public SliderController
 {
-  public:
-       HSliderController (Glib::RefPtr<Gdk::Pixbuf> slider,
-                          Glib::RefPtr<Gdk::Pixbuf> rail,
-                          Gtk::Adjustment *adj,
-                          MIDI::Controllable *,
-                          bool with_numeric = true);
+       public:
+       HSliderController (Gtk::Adjustment *adj, boost::shared_ptr<PBD::Controllable> mc, int, int);
 };
 
 
 }; /* namespace */
 
-#endif // __gtkmm2ext_motion_controller_h__            
+#endif // __gtkmm2ext_slider_controller_h__