X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=gtk2_ardour%2Fgain_meter.h;h=cd8c1b552f380e6a18b0be1e959e27ca483a8390;hb=5981b7f1b8bc85444d66ab0ffac2dee412dd21ea;hp=0ed09ee383b661831115d3796a749d79e1370ebe;hpb=8b46567e0677eb25c965ed46b80da8808fa33b2b;p=ardour.git diff --git a/gtk2_ardour/gain_meter.h b/gtk2_ardour/gain_meter.h index 0ed09ee383..cd8c1b552f 100644 --- a/gtk2_ardour/gain_meter.h +++ b/gtk2_ardour/gain_meter.h @@ -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__ @@ -24,165 +23,224 @@ #include #include -#include #include -#include -#include +#include +#include #include -#include #include +#include +#include +#include + +//#include + +#include "pbd/signals.h" -#include +#include "ardour/chan_count.h" +#include "ardour/types.h" +#include "ardour/session_handle.h" -#include -#include +#include "widgets/ardour_button.h" +#include "widgets/focus_entry.h" +#include "widgets/slider_controller.h" #include "enums.h" +#include "level_meter.h" namespace ARDOUR { class IO; + class GainControl; class Session; class Route; class RouteGroup; + class PeakMeter; + class Amp; + class Automatable; } -namespace Gtkmm2ext { - class FastMeter; - class BarController; -} + namespace Gtk { class Menu; } -class GainMeter : public Gtk::VBox +enum MeterPointChangeTarget { + MeterPointChangeAll, + MeterPointChangeGroup, + MeterPointChangeSingle +}; + +class GainMeterBase : virtual public sigc::trackable, ARDOUR::SessionHandlePtr { - public: - GainMeter (ARDOUR::IO&, ARDOUR::Session&); - ~GainMeter (); +public: + GainMeterBase (ARDOUR::Session*, bool horizontal, int, int); + virtual ~GainMeterBase (); - void update_gain_sensitive (); + virtual void set_controls (boost::shared_ptr route, + boost::shared_ptr meter, + boost::shared_ptr amp, + boost::shared_ptr control); + void update_gain_sensitive (); void update_meters (); - void update_meters_falloff (); - - void effective_gain_display (); - void set_width (Width); - void setup_meters (); + const ARDOUR::ChanCount meter_channels () const; + 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); - private: + virtual void setup_meters (int len=0); + virtual void set_type (ARDOUR::MeterType); + + boost::shared_ptr get_controllable(); + + LevelMeterHBox& get_level_meter() const { return *level_meter; } + 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 LevelMeterButtonPress; + + static std::string astate_string (ARDOUR::AutoState); + static std::string short_astate_string (ARDOUR::AutoState); + static std::string _astate_string (ARDOUR::AutoState, bool); + +protected: friend class MixerStrip; - ARDOUR::IO& _io; - ARDOUR::Session& _session; + friend class MeterStrip; + friend class RouteTimeAxisView; + friend class VCAMasterStrip; + boost::shared_ptr _route; + boost::shared_ptr _meter; + boost::shared_ptr _amp; + boost::shared_ptr _control; + std::vector connections; + PBD::ScopedConnectionList model_connections; 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::HBox gain_display_box; - Gtk::HBox fader_box; - Gtk::DrawingArea meter_metric_area; + 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; - Gtk::Button gain_automation_style_button; - Gtk::ToggleButton gain_automation_state_button; + ArdourWidgets::ArdourButton gain_automation_state_button; Gtk::Menu gain_astate_menu; - Gtk::Menu gain_astyle_menu; - gint gain_automation_style_button_event (GdkEventButton *); + ArdourWidgets::ArdourButton meter_point_button; + + Gtk::Menu meter_point_menu; + + void set_gain_astate (ARDOUR::AutoState); + bool gain_astate_propagate; + static sigc::signal ChangeGainAutomationState; + 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); + void setup_gain_adjustment (); + Width _width; - Width _width; + void show_gain (); + void gain_activated (); + bool gain_focused (GdkEventFocus*); - static std::map > metric_pixmaps; - static Glib::RefPtr render_metrics (Gtk::Widget&); + float max_peak; - gint meter_metrics_expose (GdkEventExpose *); + void fader_moved (); + void gain_changed (); - static void _gain_printer (char buf[32], Gtk::Adjustment&, void *); - void gain_printer (char buf[32], Gtk::Adjustment&); - - struct MeterInfo { - Gtkmm2ext::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::VBox* fader_vbox; - Gtk::HBox hbox; - Gtk::HBox meter_packer; - - void gain_adjusted (); - void gain_changed (void *); - - void meter_point_clicked (); + void meter_point_clicked (ARDOUR::MeterPoint); 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_press (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*); + void amp_stop_touch (); + void amp_start_touch (); - 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(); + MeterPointChangeTarget meter_point_change_target; + + void parameter_changed (const char*); void reset_peak_display (); + void reset_route_peak_display (ARDOUR::Route*); void reset_group_peak_display (ARDOUR::RouteGroup*); - static sigc::signal ResetAllPeakDisplays; - static sigc::signal ResetGroupPeakDisplays; + void redraw_metrics (); + void on_theme_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); + virtual ~GainMeter (); + + virtual void set_controls (boost::shared_ptr route, + boost::shared_ptr meter, + boost::shared_ptr amp, + boost::shared_ptr control); + + int get_gm_width (); + void setup_meters (int len=0); + void set_type (ARDOUR::MeterType); + void route_active_changed (); + + protected: + void hide_all_meters (); + + gint meter_metrics_expose (GdkEventExpose *); + gint meter_ticks1_expose (GdkEventExpose *); + gint meter_ticks2_expose (GdkEventExpose *); + void on_style_changed (const Glib::RefPtr&); + + private: - static Glib::RefPtr slider; - static Glib::RefPtr rail; - static int setup_slider_pix (); + void meter_configuration_changed (ARDOUR::ChanCount); + void meter_type_changed (ARDOUR::MeterType); + + Gtk::HBox gain_display_box; + Gtk::HBox fader_box; + Gtk::VBox fader_vbox; + Gtk::HBox hbox; + Gtk::HBox meter_hbox; + Gtk::Alignment fader_alignment; + Gtk::Alignment meter_alignment; + std::vector _types; }; #endif /* __ardour_gtk_gain_meter_h__ */