Merged with trunk R1612.
[ardour.git] / gtk2_ardour / gain_meter.h
index a1a91ced08756a50c3cecd16e2cd6b249f70377f..a24b93c034a21631df2c315236b60f8c3f9e033c 100644 (file)
@@ -15,7 +15,6 @@
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
-    $Id$
 */
 
 #ifndef __ardour_gtk_gain_meter_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/focus_entry.h>
+#include <gtkmm2ext/slider_controller.h>
 
 #include "enums.h"
 
@@ -49,7 +48,6 @@ namespace ARDOUR {
 namespace Gtkmm2ext {
        class FastMeter;
        class BarController;
-       class Pix;
 }
 namespace Gtk {
        class Menu;
@@ -58,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 ();
@@ -71,30 +69,52 @@ class GainMeter : public Gtk::VBox
        void set_width (Width);
        void setup_meters ();
 
+       int get_gm_width ();
+
        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;
+       bool next_release_selects;
 
        Gtkmm2ext::VSliderController *gain_slider;
        Gtk::Adjustment              gain_adjustment;
-       Gtk::Frame                   gain_display_frame;
-       Gtkmm2ext::ClickBox           gain_display;
-       Gtk::Frame                   peak_display_frame;
-       Gtk::EventBox                peak_display;
-       Gtk::Label                   peak_display_label;
-       Gtk::Button                  gain_unit_button;
-       Gtk::Label                   gain_unit_label;
+       Gtkmm2ext::FocusEntry        gain_display;
+       Gtk::Button                  peak_display;
        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;
@@ -102,9 +122,10 @@ class GainMeter : public Gtk::VBox
 
        gint meter_metrics_expose (GdkEventExpose *);
 
-       static void _gain_printer (char buf[32], Gtk::Adjustment&, void *);
-       void gain_printer (char buf[32], Gtk::Adjustment&);
-       
+       void show_gain ();
+       void gain_activated ();
+       bool gain_focused (GdkEventFocus*);
+
        struct MeterInfo {
            Gtkmm2ext::FastMeter *meter;
            gint16          width;   
@@ -122,7 +143,7 @@ class GainMeter : public Gtk::VBox
        vector<MeterInfo>    meters;
        float       max_peak;
        
-
+       Gtk::VBox*   fader_vbox;
        Gtk::HBox   hbox;
        Gtk::HBox   meter_packer;
 
@@ -130,7 +151,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 ();
@@ -138,7 +158,8 @@ class GainMeter : public Gtk::VBox
        gint meter_button_press (GdkEventButton*, uint32_t);
        gint meter_button_release (GdkEventButton*, uint32_t);
 
-       gint peak_button_release (GdkEventButton*);
+       bool peak_button_release (GdkEventButton*);
+       bool gain_key_press (GdkEventKey*);
        
        Gtk::Menu* meter_menu;
        void popup_meter_menu (GdkEventButton*);
@@ -153,7 +174,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*);
@@ -161,7 +182,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 ();
 };