2005-09-25 14:42:24 -04:00
|
|
|
/*
|
|
|
|
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.
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __ardour_gtk_gain_meter_h__
|
|
|
|
#define __ardour_gtk_gain_meter_h__
|
|
|
|
|
|
|
|
#include <vector>
|
2006-03-12 13:21:48 -05:00
|
|
|
#include <map>
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2005-11-28 23:41:15 -05:00
|
|
|
#include <gtkmm/box.h>
|
|
|
|
#include <gtkmm/adjustment.h>
|
|
|
|
#include <gtkmm/frame.h>
|
|
|
|
#include <gtkmm/eventbox.h>
|
|
|
|
#include <gtkmm/button.h>
|
|
|
|
#include <gtkmm/table.h>
|
|
|
|
#include <gtkmm/drawingarea.h>
|
2007-05-25 16:29:12 -04:00
|
|
|
#include <gdkmm/colormap.h>
|
2005-11-28 23:41:15 -05:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
#include <ardour/types.h>
|
|
|
|
|
2005-09-25 18:26:56 -04:00
|
|
|
#include <gtkmm2ext/click_box.h>
|
2006-11-29 23:21:32 -05:00
|
|
|
#include <gtkmm2ext/focus_entry.h>
|
2006-07-07 19:51:30 -04:00
|
|
|
#include <gtkmm2ext/slider_controller.h>
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
#include "enums.h"
|
2008-04-11 10:06:50 -04:00
|
|
|
#include "level_meter.h"
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
namespace ARDOUR {
|
|
|
|
class IO;
|
|
|
|
class Session;
|
|
|
|
class Route;
|
|
|
|
class RouteGroup;
|
|
|
|
}
|
2005-09-25 18:26:56 -04:00
|
|
|
namespace Gtkmm2ext {
|
2005-09-25 14:42:24 -04:00
|
|
|
class FastMeter;
|
|
|
|
class BarController;
|
|
|
|
}
|
2005-11-28 23:41:15 -05:00
|
|
|
namespace Gtk {
|
|
|
|
class Menu;
|
|
|
|
}
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2008-09-10 11:03:30 -04:00
|
|
|
class GainMeterBase : virtual public sigc::trackable
|
2005-09-25 14:42:24 -04:00
|
|
|
{
|
|
|
|
public:
|
2008-12-08 11:07:28 -05:00
|
|
|
GainMeterBase ( ARDOUR::Session&, const Glib::RefPtr<Gdk::Pixbuf>& pix,
|
2008-09-10 11:03:30 -04:00
|
|
|
bool horizontal);
|
|
|
|
virtual ~GainMeterBase ();
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2008-12-08 11:07:28 -05:00
|
|
|
virtual void set_io (boost::shared_ptr<ARDOUR::IO>);
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
void update_gain_sensitive ();
|
|
|
|
void update_meters ();
|
|
|
|
|
|
|
|
void effective_gain_display ();
|
2007-12-20 18:25:19 -05:00
|
|
|
void set_width (Width, int len=0);
|
2005-12-24 08:07:36 -05:00
|
|
|
void set_meter_strip_name (const char * name);
|
|
|
|
void set_fader_name (const char * name);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2008-09-10 11:03:30 -04:00
|
|
|
virtual void setup_meters (int len=0);
|
2008-04-11 10:06:50 -04:00
|
|
|
|
2009-01-30 15:18:31 -05:00
|
|
|
boost::shared_ptr<PBD::Controllable> get_controllable();
|
2008-01-10 16:20:59 -05:00
|
|
|
|
2008-09-10 11:03:30 -04:00
|
|
|
LevelMeter& get_level_meter() const { return *level_meter; }
|
|
|
|
Gtkmm2ext::SliderController& get_gain_slider() const { return *gain_slider; }
|
|
|
|
|
|
|
|
protected:
|
2006-05-19 13:29:05 -04:00
|
|
|
|
|
|
|
friend class MixerStrip;
|
2006-07-27 12:52:14 -04:00
|
|
|
boost::shared_ptr<ARDOUR::IO> _io;
|
2005-09-25 14:42:24 -04:00
|
|
|
ARDOUR::Session& _session;
|
2008-12-08 11:07:28 -05:00
|
|
|
std::vector<sigc::connection> connections;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
bool ignore_toggle;
|
2006-11-29 23:21:32 -05:00
|
|
|
bool next_release_selects;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2008-09-10 11:03:30 -04:00
|
|
|
Gtkmm2ext::SliderController *gain_slider;
|
2005-09-25 14:42:24 -04:00
|
|
|
Gtk::Adjustment gain_adjustment;
|
2006-11-29 23:21:32 -05:00
|
|
|
Gtkmm2ext::FocusEntry gain_display;
|
2007-03-12 10:24:05 -04:00
|
|
|
Gtk::Button peak_display;
|
2005-09-25 14:42:24 -04:00
|
|
|
Gtk::DrawingArea meter_metric_area;
|
2008-09-10 11:03:30 -04:00
|
|
|
LevelMeter *level_meter;
|
2006-05-19 13:29:05 -04:00
|
|
|
|
|
|
|
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);
|
|
|
|
|
2008-03-17 16:54:03 -04:00
|
|
|
Width _width;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2006-11-27 14:31:33 -05:00
|
|
|
void show_gain ();
|
2006-11-29 23:21:32 -05:00
|
|
|
void gain_activated ();
|
|
|
|
bool gain_focused (GdkEventFocus*);
|
2006-11-27 14:31:33 -05:00
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
float max_peak;
|
|
|
|
|
|
|
|
void gain_adjusted ();
|
2007-06-29 00:02:58 -04:00
|
|
|
void gain_changed ();
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
void meter_point_clicked ();
|
|
|
|
void gain_unit_changed ();
|
|
|
|
|
2008-09-10 11:03:30 -04:00
|
|
|
virtual void hide_all_meters ();
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
gint meter_button_press (GdkEventButton*, uint32_t);
|
|
|
|
|
2006-11-27 14:31:33 -05:00
|
|
|
bool peak_button_release (GdkEventButton*);
|
|
|
|
bool gain_key_press (GdkEventKey*);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
Gtk::Menu* meter_menu;
|
|
|
|
void popup_meter_menu (GdkEventButton*);
|
|
|
|
|
|
|
|
gint start_gain_touch (GdkEventButton*);
|
|
|
|
gint end_gain_touch (GdkEventButton*);
|
|
|
|
|
|
|
|
void set_mix_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;
|
|
|
|
|
2006-09-25 17:24:00 -04:00
|
|
|
void parameter_changed (const char*);
|
2005-09-25 14:42:24 -04:00
|
|
|
|
|
|
|
void reset_peak_display ();
|
|
|
|
void reset_group_peak_display (ARDOUR::RouteGroup*);
|
|
|
|
|
2005-09-25 18:26:56 -04:00
|
|
|
static sigc::signal<void> ResetAllPeakDisplays;
|
|
|
|
static sigc::signal<void,ARDOUR::RouteGroup*> ResetGroupPeakDisplays;
|
2005-09-25 14:42:24 -04:00
|
|
|
|
2007-06-27 08:12:34 -04:00
|
|
|
void on_theme_changed ();
|
2007-05-26 09:47:28 -04:00
|
|
|
bool style_changed;
|
2008-03-17 16:54:03 -04:00
|
|
|
bool dpi_changed;
|
2008-01-10 16:20:59 -05:00
|
|
|
bool color_changed;
|
2008-03-17 16:54:03 -04:00
|
|
|
void color_handler(bool);
|
2005-09-25 14:42:24 -04:00
|
|
|
};
|
|
|
|
|
2008-09-10 11:03:30 -04:00
|
|
|
class GainMeter : public GainMeterBase, public Gtk::VBox
|
|
|
|
{
|
|
|
|
public:
|
2008-12-08 11:07:28 -05:00
|
|
|
GainMeter (ARDOUR::Session&);
|
2008-09-10 11:03:30 -04:00
|
|
|
~GainMeter () {}
|
|
|
|
|
2008-12-08 11:07:28 -05:00
|
|
|
void set_io (boost::shared_ptr<ARDOUR::IO>);
|
|
|
|
|
2008-09-10 11:03:30 -04:00
|
|
|
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 *);
|
|
|
|
|
|
|
|
static std::map<std::string,Glib::RefPtr<Gdk::Pixmap> > metric_pixmaps;
|
|
|
|
static Glib::RefPtr<Gdk::Pixmap> render_metrics (Gtk::Widget&);
|
|
|
|
|
|
|
|
private:
|
|
|
|
Gtk::HBox gain_display_box;
|
|
|
|
Gtk::HBox fader_box;
|
|
|
|
Gtk::VBox* fader_vbox;
|
|
|
|
Gtk::HBox hbox;
|
|
|
|
|
|
|
|
static Glib::RefPtr<Gdk::Pixbuf> slider;
|
|
|
|
};
|
|
|
|
|
2005-09-25 14:42:24 -04:00
|
|
|
#endif /* __ardour_gtk_gain_meter_h__ */
|
|
|
|
|