VKeybd: Pass on primary (Ctrl/Cmd) shortcuts
[ardour.git] / gtk2_ardour / gain_meter.h
index 15948768a13a707ef8fde54b1f1404c5d6f57261..2ae9a2ee44f0686ff37a387e4b9e1461eec156e7 100644 (file)
@@ -1,21 +1,27 @@
 /*
-    Copyright (C) 2002 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.
-
-*/
+ * Copyright (C) 2005-2016 Paul Davis <paul@linuxaudiosystems.com>
+ * Copyright (C) 2005 Taybin Rutkin <taybin@taybin.com>
+ * Copyright (C) 2006 Nick Mainsbridge <mainsbridge@gmail.com>
+ * Copyright (C) 2007-2011 David Robillard <d@drobilla.net>
+ * Copyright (C) 2007 Doug McLain <doug@nostar.net>
+ * Copyright (C) 2009-2012 Carl Hetherington <carl@carlh.net>
+ * Copyright (C) 2013-2019 Robin Gareus <robin@gareus.org>
+ * Copyright (C) 2014 Ben Loftis <ben@harrisonconsoles.com>
+ *
+ * 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.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
 
 #ifndef __ardour_gtk_gain_meter_h__
 #define __ardour_gtk_gain_meter_h__
 #include <vector>
 #include <map>
 
-#include <gtkmm/box.h>
 #include <gtkmm/adjustment.h>
-#include <gtkmm/frame.h>
-#include <gtkmm/eventbox.h>
+#include <gtkmm/alignment.h>
+#include <gtkmm/box.h>
 #include <gtkmm/button.h>
-#include <gtkmm/table.h>
 #include <gtkmm/drawingarea.h>
-#include <gdkmm/colormap.h>
+#include <gtkmm/eventbox.h>
+#include <gtkmm/frame.h>
+#include <gtkmm/table.h>
+
+//#include <gdkmm/colormap.h>
 
 #include "pbd/signals.h"
 
 #include "ardour/types.h"
 #include "ardour/session_handle.h"
 
-#include "ardour_button.h"
-
-#include "gtkmm2ext/click_box.h"
-#include "gtkmm2ext/focus_entry.h"
-#include "gtkmm2ext/slider_controller.h"
+#include "widgets/ardour_button.h"
+#include "widgets/focus_entry.h"
+#include "widgets/slider_controller.h"
 
 #include "enums.h"
 #include "level_meter.h"
@@ -57,21 +63,25 @@ namespace ARDOUR {
        class Amp;
        class Automatable;
 }
-namespace Gtkmm2ext {
-       class FastMeter;
-}
+
 namespace Gtk {
        class Menu;
 }
 
+enum MeterPointChangeTarget {
+       MeterPointChangeAll,
+       MeterPointChangeGroup,
+       MeterPointChangeSingle
+};
+
 class GainMeterBase : virtual public sigc::trackable, ARDOUR::SessionHandlePtr
 {
-  public:
-        GainMeterBase (ARDOUR::Session*, bool horizontal, int, int);
+public:
+       GainMeterBase (ARDOUR::Session*, bool horizontal, int, int);
        virtual ~GainMeterBase ();
 
        virtual void set_controls (boost::shared_ptr<ARDOUR::Route> route,
-                                  boost::shared_ptr<ARDOUR::PeakMeter> meter,
+                                  boost::shared_ptr<ARDOUR::PeakMeter> meter,
                                   boost::shared_ptr<ARDOUR::Amp> amp,
                                   boost::shared_ptr<ARDOUR::GainControl> control);
 
@@ -86,31 +96,28 @@ class GainMeterBase : virtual public sigc::trackable, ARDOUR::SessionHandlePtr
        void set_fader_name (const char * name);
 
        virtual void setup_meters (int len=0);
-       virtual void set_type (ARDOUR::MeterType);
 
        boost::shared_ptr<PBD::Controllable> get_controllable();
 
        LevelMeterHBox& get_level_meter() const { return *level_meter; }
-       Gtkmm2ext::SliderController& get_gain_slider() const { return *gain_slider; }
+       ArdourWidgets::SliderController& get_gain_slider() const { return *gain_slider; }
 
        /** Emitted in the GUI thread when a button is pressed over the level meter;
         *  return true if the event is handled.
         */
        PBD::Signal1<bool, GdkEventButton *> LevelMeterButtonPress;
 
+       static std::string meterpt_string (ARDOUR::MeterPoint);
        static std::string astate_string (ARDOUR::AutoState);
        static std::string short_astate_string (ARDOUR::AutoState);
        static std::string _astate_string (ARDOUR::AutoState, bool);
 
-       static std::string astyle_string (ARDOUR::AutoStyle);
-       static std::string short_astyle_string (ARDOUR::AutoStyle);
-       static std::string _astyle_string (ARDOUR::AutoStyle, bool);
-
-  protected:
+protected:
 
        friend class MixerStrip;
        friend class MeterStrip;
        friend class RouteTimeAxisView;
+       friend class VCAMasterStrip;
        boost::shared_ptr<ARDOUR::Route> _route;
        boost::shared_ptr<ARDOUR::PeakMeter> _meter;
        boost::shared_ptr<ARDOUR::Amp> _amp;
@@ -121,35 +128,33 @@ class GainMeterBase : virtual public sigc::trackable, ARDOUR::SessionHandlePtr
        bool ignore_toggle;
        bool next_release_selects;
 
-       Gtkmm2ext::SliderController *gain_slider;
-       Gtk::Adjustment              gain_adjustment;
-       Gtkmm2ext::FocusEntry        gain_display;
-       Gtkmm2ext::FocusEntry        peak_display;
-//     Gtk::Button                  peak_display;
-       Gtk::DrawingArea             meter_metric_area;
-       Gtk::DrawingArea             meter_ticks1_area;
-       Gtk::DrawingArea             meter_ticks2_area;
-       LevelMeterHBox              *level_meter;
+       ArdourWidgets::SliderController* gain_slider;
+       Gtk::Adjustment                  gain_adjustment;
+       ArdourWidgets::FocusEntry        gain_display;
+       ArdourWidgets::FocusEntry        peak_display;
+       Gtk::DrawingArea                 meter_metric_area;
+       Gtk::DrawingArea                 meter_ticks1_area;
+       Gtk::DrawingArea                 meter_ticks2_area;
+       LevelMeterHBox*                  level_meter;
 
        sigc::connection gain_watching;
 
-       ArdourButton gain_automation_style_button;
-       ArdourButton gain_automation_state_button;
+       ArdourWidgets::ArdourButton gain_automation_state_button;
 
        Gtk::Menu gain_astate_menu;
-       Gtk::Menu gain_astyle_menu;
+
+       ArdourWidgets::ArdourButton meter_point_button;
+
+       Gtk::Menu meter_point_menu;
 
        void set_gain_astate (ARDOUR::AutoState);
        bool gain_astate_propagate;
        static sigc::signal<void, ARDOUR::AutoState> ChangeGainAutomationState;
 
-       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();
 
        void setup_gain_adjustment ();
        Width _width;
@@ -163,13 +168,14 @@ class GainMeterBase : virtual public sigc::trackable, ARDOUR::SessionHandlePtr
        void fader_moved ();
        void gain_changed ();
 
-       void meter_point_clicked ();
+       void meter_point_clicked (ARDOUR::MeterPoint);
        void gain_unit_changed ();
 
        virtual void hide_all_meters ();
 
        gint meter_button_press (GdkEventButton*, uint32_t);
 
+       bool peak_button_press (GdkEventButton*);
        bool peak_button_release (GdkEventButton*);
        bool gain_key_press (GdkEventKey*);
 
@@ -181,11 +187,11 @@ class GainMeterBase : virtual public sigc::trackable, ARDOUR::SessionHandlePtr
 
        void set_route_group_meter_point (ARDOUR::Route&, ARDOUR::MeterPoint);
        void set_meter_point (ARDOUR::Route&, ARDOUR::MeterPoint);
-       gint meter_release (GdkEventButton*);
        gint meter_press (GdkEventButton*);
-       bool wait_for_release;
        ARDOUR::MeterPoint old_meter_point;
 
+       MeterPointChangeTarget meter_point_change_target;
+
        void parameter_changed (const char*);
 
        void reset_peak_display ();
@@ -211,13 +217,12 @@ class GainMeter : public GainMeterBase, public Gtk::VBox
        virtual ~GainMeter ();
 
        virtual void set_controls (boost::shared_ptr<ARDOUR::Route> route,
-                                  boost::shared_ptr<ARDOUR::PeakMeter> meter,
+                                  boost::shared_ptr<ARDOUR::PeakMeter> meter,
                                   boost::shared_ptr<ARDOUR::Amp> amp,
-                                  boost::shared_ptr<ARDOUR::GainControl> control);
+                                  boost::shared_ptr<ARDOUR::GainControl> control);
 
        int get_gm_width ();
        void setup_meters (int len=0);
-       void set_type (ARDOUR::MeterType);
        void route_active_changed ();
 
   protected:
@@ -227,11 +232,11 @@ class GainMeter : public GainMeterBase, public Gtk::VBox
        gint meter_ticks1_expose (GdkEventExpose *);
        gint meter_ticks2_expose (GdkEventExpose *);
        void on_style_changed (const Glib::RefPtr<Gtk::Style>&);
+       void redraw_metrics ();
 
   private:
 
        void meter_configuration_changed (ARDOUR::ChanCount);
-       void meter_type_changed (ARDOUR::MeterType);
 
        Gtk::HBox  gain_display_box;
        Gtk::HBox  fader_box;