notably modify the design and logic of the startup dialog, so that we can handle...
[ardour.git] / gtk2_ardour / level_meter.h
index bf0e081ccec5ccff2b72fd3c2e44cecc249d2743..0e51758858e33fa897fe8e9e30521952b4cc313d 100644 (file)
@@ -31,6 +31,8 @@
 #include <gtkmm/drawingarea.h>
 
 #include "ardour/types.h"
+#include "ardour/chan_count.h"
+#include "ardour/session_handle.h"
 
 #include <gtkmm2ext/click_box.h>
 #include <gtkmm2ext/focus_entry.h>
@@ -49,10 +51,10 @@ namespace Gtk {
        class Menu;
 }
 
-class LevelMeter : public Gtk::HBox
+class LevelMeter : public Gtk::HBox, public ARDOUR::SessionHandlePtr
 {
   public:
-       LevelMeter (ARDOUR::Session&);
+       LevelMeter (ARDOUR::Session*);
        ~LevelMeter ();
 
        virtual void set_meter (ARDOUR::PeakMeter* meter);
@@ -65,8 +67,10 @@ class LevelMeter : public Gtk::HBox
        void hide_meters ();
        void setup_meters (int len=0, int width=3);
 
+       /** Emitted in the GUI thread when a button is pressed over the meter */
+       PBD::Signal1<bool, GdkEventButton *> ButtonPress;
+
   private:
-       ARDOUR::Session&   _session;
        ARDOUR::PeakMeter* _meter;
 
        Width _width;
@@ -74,13 +78,13 @@ class LevelMeter : public Gtk::HBox
        struct MeterInfo {
            Gtkmm2ext::FastMeter *meter;
            gint16                width;
-               int                               length;
+            int                          length;
            bool                  packed;
 
            MeterInfo() {
                    meter = 0;
                    width = 0;
-                       length = 0;
+                    length = 0;
                    packed = false;
            }
        };
@@ -91,10 +95,12 @@ class LevelMeter : public Gtk::HBox
        std::vector<MeterInfo> meters;
        float                  max_peak;
 
-       sigc::connection _configuration_connection;
+       PBD::ScopedConnection _configuration_connection;
+       PBD::ScopedConnection _parameter_connection;
 
        void hide_all_meters ();
-       gint meter_button_release (GdkEventButton*, uint32_t);
+       bool meter_button_press (GdkEventButton *);
+       bool meter_button_release (GdkEventButton *);
 
        void parameter_changed (std::string);
        void configuration_changed (ARDOUR::ChanCount in, ARDOUR::ChanCount out);