patch from brian to get consistent menu behaviour
[ardour.git] / gtk2_ardour / gain_meter.h
index 6a7b88e1c4092c153dfed3ff6e7cf1c089af3ed6..bbc12ccb6ce37567c906f2cb3747c8da14e003ef 100644 (file)
@@ -22,6 +22,7 @@
 #define __ardour_gtk_gain_meter_h__
 
 #include <vector>
+#include <map>
 
 #include <gtkmm/box.h>
 #include <gtkmm/adjustment.h>
 #include <gtkmm/table.h>
 #include <gtkmm/drawingarea.h>
 
-
 #include <ardour/types.h>
 
-#include <gtkmm2ext/slider_controller.h>
 #include <gtkmm2ext/click_box.h>
+#include <gtkmm2ext/slider_controller.h>
 
 #include "enums.h"
 
@@ -48,7 +48,6 @@ namespace ARDOUR {
 namespace Gtkmm2ext {
        class FastMeter;
        class BarController;
-       class Pix;
 }
 namespace Gtk {
        class Menu;
@@ -57,7 +56,7 @@ namespace Gtk {
 class GainMeter : public Gtk::VBox
 {
   public:
-       GainMeter (ARDOUR::IO&, ARDOUR::Session&);
+       GainMeter (boost::shared_ptr<ARDOUR::IO>, ARDOUR::Session&);
        ~GainMeter ();
 
        void update_gain_sensitive ();
@@ -70,11 +69,13 @@ class GainMeter : public Gtk::VBox
        void set_width (Width);
        void setup_meters ();
 
-       void set_meter_strip_name (string name);
-       void set_fader_name (string name);
+       void set_meter_strip_name (const char * name);
+       void set_fader_name (const char * name);
 
   private:
-       ARDOUR::IO& _io;
+
+       friend class MixerStrip;
+       boost::shared_ptr<ARDOUR::IO> _io;
        ARDOUR::Session& _session;
 
        bool ignore_toggle;
@@ -86,16 +87,39 @@ class GainMeter : public Gtk::VBox
        Gtk::Frame                   peak_display_frame;
        Gtk::EventBox                peak_display;
        Gtk::Label                   peak_display_label;
-       Gtk::Button                  gain_unit_button;
-       Gtk::Label                   gain_unit_label;
        Gtk::HBox                    gain_display_box;
        Gtk::HBox                    fader_box;
        Gtk::DrawingArea             meter_metric_area;
-       Gtk::Button                  meter_point_button;
-        Gtk::Label                   meter_point_label;
-       Gtk::Table                   top_table;
+
+       sigc::connection gain_watching;
+
+       Gtk::Button gain_automation_style_button;
+       Gtk::ToggleButton gain_automation_state_button;
+
+       Gtk::Menu gain_astate_menu;
+       Gtk::Menu gain_astyle_menu;
+
+       gint gain_automation_style_button_event (GdkEventButton *);
+       gint gain_automation_state_button_event (GdkEventButton *);
+       gint pan_automation_style_button_event (GdkEventButton *);
+       gint pan_automation_state_button_event (GdkEventButton *);
+
+       void gain_automation_state_changed();
+       void gain_automation_style_changed();
+
+       std::string astate_string (ARDOUR::AutoState);
+       std::string short_astate_string (ARDOUR::AutoState);
+       std::string _astate_string (ARDOUR::AutoState, bool);
+
+       std::string astyle_string (ARDOUR::AutoStyle);
+       std::string short_astyle_string (ARDOUR::AutoStyle);
+       std::string _astyle_string (ARDOUR::AutoStyle, bool);
+
        Width                       _width;
 
+       static std::map<std::string,Glib::RefPtr<Gdk::Pixmap> > metric_pixmaps;
+       static Glib::RefPtr<Gdk::Pixmap> render_metrics (Gtk::Widget&);
+
        gint meter_metrics_expose (GdkEventExpose *);
 
        static void _gain_printer (char buf[32], Gtk::Adjustment&, void *);
@@ -118,7 +142,7 @@ class GainMeter : public Gtk::VBox
        vector<MeterInfo>    meters;
        float       max_peak;
        
-
+       Gtk::VBox*   fader_vbox;
        Gtk::HBox   hbox;
        Gtk::HBox   meter_packer;
 
@@ -126,7 +150,6 @@ class GainMeter : public Gtk::VBox
        void gain_changed (void *);
        
        void meter_point_clicked ();
-       void meter_changed (void *);
        void gain_unit_changed ();
        
        void hide_all_meters ();
@@ -149,7 +172,7 @@ class GainMeter : public Gtk::VBox
        bool wait_for_release;
        ARDOUR::MeterPoint old_meter_point;
 
-       void meter_hold_changed();
+       void parameter_changed (const char*);
 
        void reset_peak_display ();
        void reset_group_peak_display (ARDOUR::RouteGroup*);
@@ -157,7 +180,8 @@ class GainMeter : public Gtk::VBox
        static sigc::signal<void> ResetAllPeakDisplays;
        static sigc::signal<void,ARDOUR::RouteGroup*> ResetGroupPeakDisplays;
 
-       static Gtkmm2ext::Pix* slider_pix;
+       static Glib::RefPtr<Gdk::Pixbuf> slider;
+       static Glib::RefPtr<Gdk::Pixbuf> rail;
        static int setup_slider_pix ();
 };