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/button.h>
#include <gtkmm/table.h>
#include <gtkmm/drawingarea.h>
+#include <gdkmm/colormap.h>
-#include <ardour/types.h>
+#include "pbd/signals.h"
-#include <gtkmm2ext/click_box.h>
-#include <gtkmm2ext/slider_controller.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 Gtkmm2ext {
class FastMeter;
class Menu;
}
-class GainMeter : public Gtk::VBox
+class GainMeterBase : virtual public sigc::trackable, ARDOUR::SessionHandlePtr
{
public:
- GainMeter (boost::shared_ptr<ARDOUR::IO>, ARDOUR::Session&);
- ~GainMeter ();
+ GainMeterBase (ARDOUR::Session*, const Glib::RefPtr<Gdk::Pixbuf>& pix,
+ bool horizontal, int);
+ virtual ~GainMeterBase ();
- void update_gain_sensitive ();
+ virtual void set_controls (boost::shared_ptr<ARDOUR::Route> route,
+ boost::shared_ptr<ARDOUR::PeakMeter> meter,
+ boost::shared_ptr<ARDOUR::Amp> amp);
+ void update_gain_sensitive ();
void update_meters ();
- void update_meters_falloff ();
void effective_gain_display ();
-
- void set_width (Width);
- void setup_meters ();
-
+ 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);
+
+ boost::shared_ptr<PBD::Controllable> get_controllable();
+
+ 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<bool, GdkEventButton *> LevelMeterButtonPress;
+
+ protected:
friend class MixerStrip;
- boost::shared_ptr<ARDOUR::IO> _io;
- ARDOUR::Session& _session;
+ boost::shared_ptr<ARDOUR::Route> _route;
+ boost::shared_ptr<ARDOUR::PeakMeter> _meter;
+ boost::shared_ptr<ARDOUR::Amp> _amp;
+ std::vector<sigc::connection> connections;
+ PBD::ScopedConnectionList model_connections;
bool ignore_toggle;
+ bool next_release_selects;
- Gtkmm2ext::VSliderController *gain_slider;
+ Gtkmm2ext::SliderController *gain_slider;
Gtk::Adjustment gain_adjustment;
- Gtk::Entry gain_display;
- Gtk::Entry peak_display;
- Gtk::HBox gain_display_box;
- Gtk::HBox fader_box;
+ Gtkmm2ext::FocusEntry gain_display;
+ Gtk::Button peak_display;
Gtk::DrawingArea meter_metric_area;
+ LevelMeter *level_meter;
sigc::connection gain_watching;
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 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 *);
+ Width _width;
void show_gain ();
- void gain_entered ();
-
- 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<MeterInfo> meters;
- float max_peak;
-
- Gtk::VBox* fader_vbox;
- Gtk::HBox hbox;
- Gtk::HBox meter_packer;
+ 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 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);
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*);
+ 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*);
static sigc::signal<void> ResetAllPeakDisplays;
static sigc::signal<void,ARDOUR::RouteGroup*> 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<ARDOUR::Route> route,
+ boost::shared_ptr<ARDOUR::PeakMeter> meter,
+ boost::shared_ptr<ARDOUR::Amp> 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<std::string,cairo_pattern_t*> MetricPatterns;
+ static MetricPatterns metric_patterns;
+ static cairo_pattern_t* render_metrics (Gtk::Widget &, std::vector<ARDOUR::DataType>);
+
+ 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<ARDOUR::DataType> _types;
+
static Glib::RefPtr<Gdk::Pixbuf> slider;
- static Glib::RefPtr<Gdk::Pixbuf> rail;
- static int setup_slider_pix ();
};
#endif /* __ardour_gtk_gain_meter_h__ */