X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fgain_meter.h;h=e706606c76ee7a554efc531abf2a61a2aec74071;hb=51138ef75b4c59ea5a0c35c23906a093c1e34b2c;hp=06ae0dafd99f697dcd273dbd85c962c4a6a1befb;hpb=209d967b1bb80a9735d690d8f4f0455ecb9970ca;p=ardour.git diff --git a/gtk2_ardour/gain_meter.h b/gtk2_ardour/gain_meter.h index 06ae0dafd9..e706606c76 100644 --- a/gtk2_ardour/gain_meter.h +++ b/gtk2_ardour/gain_meter.h @@ -15,141 +15,222 @@ 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__ #define __ardour_gtk_gain_meter_h__ #include +#include -#include +#include +#include +#include +#include +#include +#include +#include +#include -#include -#include -#include +#include "pbd/signals.h" + +#include "ardour/chan_count.h" +#include "ardour/types.h" +#include "ardour/session_handle.h" + +#include "gtkmm2ext/click_box.h" +#include "gtkmm2ext/focus_entry.h" +#include "gtkmm2ext/slider_controller.h" #include "enums.h" +#include "level_meter.h" namespace ARDOUR { class IO; class Session; class Route; class RouteGroup; + class PeakMeter; + class Amp; + class Automatable; } -namespace Gtkmmext { +namespace Gtkmm2ext { class FastMeter; class BarController; - class Pix; +} +namespace Gtk { + class Menu; } -class GainMeter : public Gtk::VBox +class GainMeterBase : virtual public sigc::trackable, ARDOUR::SessionHandlePtr { public: - GainMeter (ARDOUR::IO&, ARDOUR::Session&); - ~GainMeter (); + GainMeterBase (ARDOUR::Session*, const Glib::RefPtr& pix, + bool horizontal, int); + virtual ~GainMeterBase (); - void update_gain_sensitive (); + virtual void set_controls (boost::shared_ptr route, + boost::shared_ptr meter, + boost::shared_ptr amp); + void update_gain_sensitive (); void update_meters (); - void update_meters_falloff (); void effective_gain_display (); + void set_width (Width, int len=0); + void set_meter_strip_name (const char * name); + void set_fader_name (const char * name); - void set_width (Width); - void setup_meters (); + virtual void setup_meters (int len=0); - void set_meter_strip_name (string name); - void set_fader_name (string name); + boost::shared_ptr get_controllable(); - private: - ARDOUR::IO& _io; - ARDOUR::Session& _session; + LevelMeter& get_level_meter() const { return *level_meter; } + Gtkmm2ext::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 LevelMeterButtonPress; + + protected: + + friend class MixerStrip; + boost::shared_ptr _route; + boost::shared_ptr _meter; + boost::shared_ptr _amp; + std::vector connections; + PBD::ScopedConnectionList model_connections; bool ignore_toggle; + bool next_release_selects; - Gtkmmext::VSliderController *gain_slider; + Gtkmm2ext::SliderController *gain_slider; Gtk::Adjustment gain_adjustment; - Gtk::Frame gain_display_frame; - Gtkmmext::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; - Gtk::HBox gain_display_box; - Gtk::HBox fader_box; + Gtkmm2ext::FocusEntry gain_display; + Gtk::Button peak_display; Gtk::DrawingArea meter_metric_area; - Gtk::Button meter_point_button; - Gtk::Label meter_point_label; - Gtk::Table top_table; - Width _width; + LevelMeter *level_meter; - gint meter_metrics_expose (GdkEventExpose *); + sigc::connection gain_watching; + + Gtk::Button gain_automation_style_button; + Gtk::ToggleButton gain_automation_state_button; - static void _gain_printer (char buf[32], Gtk::Adjustment&, void *); - void gain_printer (char buf[32], Gtk::Adjustment&); - - struct MeterInfo { - Gtkmmext::FastMeter *meter; - gint16 width; - bool packed; - - MeterInfo() { - meter = 0; - width = 0; - packed = false; - } - }; - - static const guint16 regular_meter_width = 5; - static const guint16 thin_meter_width = 2; - vector meters; - float max_peak; - - - Gtk::HBox hbox; - Gtk::HBox meter_packer; + 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(); + + void setup_gain_adjustment (); + + 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; + + void show_gain (); + void gain_activated (); + bool gain_focused (GdkEventFocus*); + + float max_peak; void gain_adjusted (); - void gain_changed (void *); - + void gain_changed (); + void meter_point_clicked (); - void meter_changed (void *); void gain_unit_changed (); - - void hide_all_meters (); + + virtual void hide_all_meters (); 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*); - gint start_gain_touch (GdkEventButton*); - gint end_gain_touch (GdkEventButton*); - - gint entry_focus_event (GdkEventFocus* ev); + bool gain_slider_button_press (GdkEventButton *); + bool gain_slider_button_release (GdkEventButton *); - void set_mix_group_meter_point (ARDOUR::Route&, ARDOUR::MeterPoint); + 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; - void meter_hold_changed(); + void parameter_changed (const char*); void reset_peak_display (); void reset_group_peak_display (ARDOUR::RouteGroup*); - static SigC::Signal0 ResetAllPeakDisplays; - static SigC::Signal1 ResetGroupPeakDisplays; + static sigc::signal ResetAllPeakDisplays; + static sigc::signal ResetGroupPeakDisplays; + + void on_theme_changed (); + bool style_changed; + bool dpi_changed; + bool color_changed; + void color_handler(bool); + ARDOUR::DataType _data_type; + ARDOUR::ChanCount _previous_amp_output_streams; + +private: + + bool level_meter_button_press (GdkEventButton *); + PBD::ScopedConnection _level_meter_connection; +}; + +class GainMeter : public GainMeterBase, public Gtk::VBox +{ + public: + GainMeter (ARDOUR::Session*, int); + ~GainMeter () {} + + virtual void set_controls (boost::shared_ptr route, + boost::shared_ptr meter, + boost::shared_ptr amp); + + int get_gm_width (); + void setup_meters (int len=0); + + static void setup_slider_pix (); + + protected: + void hide_all_meters (); + + gint meter_metrics_expose (GdkEventExpose *); + + typedef std::map MetricPatterns; + static MetricPatterns metric_patterns; + static cairo_pattern_t* render_metrics (Gtk::Widget &, std::vector); + + private: + + void meter_configuration_changed (ARDOUR::ChanCount); + + Gtk::HBox gain_display_box; + Gtk::HBox fader_box; + Gtk::VBox* fader_vbox; + Gtk::HBox hbox; + Gtk::Alignment fader_alignment; + Gtk::Alignment meter_alignment; + std::vector _types; - static Gtkmmext::Pix* slider_pix; - static int setup_slider_pix (); + static Glib::RefPtr slider; }; #endif /* __ardour_gtk_gain_meter_h__ */