mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-25 07:57:43 +01:00
refactor GainMeter so that it can used by RouteTimeAxisView, and thus bring automation display to editor track faders and more
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@3468 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
5e58d036af
commit
0a16f643a0
6 changed files with 693 additions and 697 deletions
|
|
@ -82,6 +82,8 @@ typedef uint64_t microseconds_t;
|
|||
#include "gui_thread.h"
|
||||
#include "theme_manager.h"
|
||||
#include "engine_dialog.h"
|
||||
#include "gain_meter.h"
|
||||
#include "route_time_axis.h"
|
||||
|
||||
#include "i18n.h"
|
||||
|
||||
|
|
@ -237,6 +239,9 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[])
|
|||
Config->set_current_owner (ConfigVariableBase::Interface);
|
||||
setup_profile ();
|
||||
|
||||
GainMeter::setup_slider_pix ();
|
||||
RouteTimeAxisView::setup_slider_pix ();
|
||||
|
||||
} catch (failed_constructor& err) {
|
||||
error << _("could not initialize Ardour.") << endmsg;
|
||||
// pass it on up
|
||||
|
|
|
|||
|
|
@ -4743,7 +4743,6 @@ Editor::on_expose_event (GdkEventExpose* ev)
|
|||
|
||||
int xroot, yroot, discard;
|
||||
int controls_width;
|
||||
int scrollbar_offset;
|
||||
|
||||
/* Our root coordinates for drawing the line will be the left edge
|
||||
of the track controls, and the upper left edge of our own window.
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -54,28 +54,27 @@ namespace Gtk {
|
|||
class Menu;
|
||||
}
|
||||
|
||||
class GainMeter : public Gtk::VBox
|
||||
class GainMeterBase
|
||||
{
|
||||
public:
|
||||
GainMeter (boost::shared_ptr<ARDOUR::IO>, ARDOUR::Session&);
|
||||
~GainMeter ();
|
||||
GainMeterBase (boost::shared_ptr<ARDOUR::IO>, ARDOUR::Session&, const Glib::RefPtr<Gdk::Pixbuf>& pix,
|
||||
bool horizontal);
|
||||
virtual ~GainMeterBase ();
|
||||
|
||||
void update_gain_sensitive ();
|
||||
|
||||
void update_meters ();
|
||||
|
||||
void effective_gain_display ();
|
||||
|
||||
void set_width (Width, int len=0);
|
||||
void setup_meters (int len=0);
|
||||
|
||||
int get_gm_width ();
|
||||
|
||||
void set_meter_strip_name (const char * name);
|
||||
void set_fader_name (const char * name);
|
||||
PBD::Controllable& get_controllable() { return _io->gain_control(); }
|
||||
|
||||
private:
|
||||
virtual void setup_meters (int len=0);
|
||||
|
||||
PBD::Controllable& get_controllable() { return _io->gain_control(); }
|
||||
LevelMeter& get_level_meter() const { return *level_meter; }
|
||||
Gtkmm2ext::SliderController& get_gain_slider() const { return *gain_slider; }
|
||||
|
||||
protected:
|
||||
|
||||
friend class MixerStrip;
|
||||
boost::shared_ptr<ARDOUR::IO> _io;
|
||||
|
|
@ -84,14 +83,12 @@ class GainMeter : public Gtk::VBox
|
|||
bool ignore_toggle;
|
||||
bool next_release_selects;
|
||||
|
||||
Gtkmm2ext::VSliderController *gain_slider;
|
||||
Gtkmm2ext::SliderController *gain_slider;
|
||||
Gtk::Adjustment gain_adjustment;
|
||||
Gtkmm2ext::FocusEntry gain_display;
|
||||
Gtk::Button peak_display;
|
||||
Gtk::HBox gain_display_box;
|
||||
Gtk::HBox fader_box;
|
||||
Gtk::DrawingArea meter_metric_area;
|
||||
LevelMeter *level_meter;
|
||||
LevelMeter *level_meter;
|
||||
|
||||
sigc::connection gain_watching;
|
||||
|
||||
|
|
@ -130,16 +127,13 @@ class GainMeter : public Gtk::VBox
|
|||
|
||||
float max_peak;
|
||||
|
||||
Gtk::VBox* fader_vbox;
|
||||
Gtk::HBox hbox;
|
||||
|
||||
void gain_adjusted ();
|
||||
void gain_changed (void *);
|
||||
|
||||
void meter_point_clicked ();
|
||||
void gain_unit_changed ();
|
||||
|
||||
void hide_all_meters ();
|
||||
virtual void hide_all_meters ();
|
||||
|
||||
gint meter_button_press (GdkEventButton*, uint32_t);
|
||||
|
||||
|
|
@ -167,10 +161,6 @@ class GainMeter : public Gtk::VBox
|
|||
static sigc::signal<void> ResetAllPeakDisplays;
|
||||
static sigc::signal<void,ARDOUR::RouteGroup*> ResetGroupPeakDisplays;
|
||||
|
||||
static Glib::RefPtr<Gdk::Pixbuf> slider;
|
||||
static Glib::RefPtr<Gdk::Pixbuf> rail;
|
||||
static int setup_slider_pix ();
|
||||
|
||||
void on_theme_changed ();
|
||||
bool style_changed;
|
||||
bool dpi_changed;
|
||||
|
|
@ -178,5 +168,29 @@ class GainMeter : public Gtk::VBox
|
|||
void color_handler(bool);
|
||||
};
|
||||
|
||||
class GainMeter : public GainMeterBase, public Gtk::VBox
|
||||
{
|
||||
public:
|
||||
GainMeter (boost::shared_ptr<ARDOUR::IO>, ARDOUR::Session&);
|
||||
~GainMeter () {}
|
||||
|
||||
int get_gm_width ();
|
||||
void setup_meters (int len=0);
|
||||
|
||||
static void setup_slider_pix ();
|
||||
|
||||
protected:
|
||||
void hide_all_meters ();
|
||||
|
||||
|
||||
private:
|
||||
Gtk::HBox gain_display_box;
|
||||
Gtk::HBox fader_box;
|
||||
Gtk::VBox* fader_vbox;
|
||||
Gtk::HBox hbox;
|
||||
|
||||
static Glib::RefPtr<Gdk::Pixbuf> slider;
|
||||
};
|
||||
|
||||
#endif /* __ardour_gtk_gain_meter_h__ */
|
||||
|
||||
|
|
|
|||
|
|
@ -86,11 +86,12 @@ using namespace std;
|
|||
|
||||
Glib::RefPtr<Gdk::Pixbuf> RouteTimeAxisView::slider;
|
||||
|
||||
int
|
||||
void
|
||||
RouteTimeAxisView::setup_slider_pix ()
|
||||
{
|
||||
slider = ::get_icon ("fader_belt_h");
|
||||
return 0;
|
||||
if ((slider = ::get_icon ("fader_belt_h")) == 0) {
|
||||
throw failed_constructor ();
|
||||
}
|
||||
}
|
||||
|
||||
RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, boost::shared_ptr<Route> rt, Canvas& canvas)
|
||||
|
|
@ -104,17 +105,11 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, boost::sh
|
|||
size_button (_("h")), // height
|
||||
automation_button (_("a")),
|
||||
visual_button (_("v")),
|
||||
lm (rt, sess),
|
||||
gain_slider (0),
|
||||
gain_adjustment (0.781787, 0.0, 1.0, 0.01, 0.1),
|
||||
ignore_gain_adjustment (false)
|
||||
gm (rt, sess, slider, true)
|
||||
{
|
||||
if (slider == 0) {
|
||||
setup_slider_pix ();
|
||||
}
|
||||
gm.get_level_meter().set_no_show_all();
|
||||
gm.get_level_meter().setup_meters(50);
|
||||
|
||||
lm.set_no_show_all();
|
||||
lm.setup_meters(50);
|
||||
_has_state = true;
|
||||
playlist_menu = 0;
|
||||
playlist_action_menu = 0;
|
||||
|
|
@ -125,8 +120,6 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, boost::sh
|
|||
destructive_track_mode_item = 0;
|
||||
normal_track_mode_item = 0;
|
||||
|
||||
gain_slider = manage (new HSliderController (slider, &gain_adjustment, _route->gain_control(), false));
|
||||
|
||||
ignore_toggle = false;
|
||||
|
||||
edit_group_button.set_name ("TrackGroupButton");
|
||||
|
|
@ -173,7 +166,7 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, boost::sh
|
|||
|
||||
}
|
||||
|
||||
controls_hbox.pack_start(lm, false, false);
|
||||
controls_hbox.pack_start(gm.get_level_meter(), false, false);
|
||||
_route->meter_change.connect (mem_fun(*this, &RouteTimeAxisView::meter_changed));
|
||||
_route->input_changed.connect (mem_fun(*this, &RouteTimeAxisView::io_changed));
|
||||
_route->output_changed.connect (mem_fun(*this, &RouteTimeAxisView::io_changed));
|
||||
|
|
@ -182,7 +175,7 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, boost::sh
|
|||
controls_table.attach (*solo_button, 7, 8, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
|
||||
|
||||
controls_table.attach (edit_group_button, 7, 8, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 0, 0);
|
||||
controls_table.attach (*gain_slider, 0, 5, 1, 2, Gtk::SHRINK, Gtk::SHRINK, 0, 0);
|
||||
controls_table.attach (gm.get_gain_slider(), 0, 5, 1, 2, Gtk::SHRINK, Gtk::SHRINK, 0, 0);
|
||||
|
||||
ARDOUR_UI::instance()->tooltips().set_tip(*solo_button,_("Solo"));
|
||||
ARDOUR_UI::instance()->tooltips().set_tip(*mute_button,_("Mute"));
|
||||
|
|
@ -233,14 +226,7 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session& sess, boost::sh
|
|||
editor.ZoomChanged.connect (mem_fun(*this, &RouteTimeAxisView::reset_samples_per_unit));
|
||||
ColorsChanged.connect (mem_fun (*this, &RouteTimeAxisView::color_handler));
|
||||
|
||||
gain_slider->signal_button_press_event().connect (mem_fun(*this, &RouteTimeAxisView::start_gain_touch));
|
||||
gain_slider->signal_button_release_event().connect (mem_fun(*this, &RouteTimeAxisView::end_gain_touch));
|
||||
gain_slider->set_name ("TrackGainFader");
|
||||
|
||||
gain_adjustment.signal_value_changed().connect (mem_fun(*this, &RouteTimeAxisView::gain_adjusted));
|
||||
_route->gain_changed.connect (mem_fun(*this, &RouteTimeAxisView::gain_changed));
|
||||
|
||||
gain_slider->show_all();
|
||||
gm.get_gain_slider().set_name ("TrackGainFader");
|
||||
}
|
||||
|
||||
RouteTimeAxisView::~RouteTimeAxisView ()
|
||||
|
|
@ -698,7 +684,7 @@ RouteTimeAxisView::set_height (uint32_t h)
|
|||
{
|
||||
int gmlen = h - 5;
|
||||
bool height_changed = (height == 0) || (h != height);
|
||||
lm.setup_meters (gmlen);
|
||||
gm.get_level_meter().setup_meters (gmlen);
|
||||
|
||||
TimeAxisView::set_height (h);
|
||||
|
||||
|
|
@ -717,7 +703,7 @@ RouteTimeAxisView::set_height (uint32_t h)
|
|||
show_name_entry ();
|
||||
hide_name_label ();
|
||||
|
||||
gain_slider->show();
|
||||
gm.get_gain_slider().show();
|
||||
mute_button->show();
|
||||
solo_button->show();
|
||||
if (rec_enable_button)
|
||||
|
|
@ -739,7 +725,7 @@ RouteTimeAxisView::set_height (uint32_t h)
|
|||
show_name_entry ();
|
||||
hide_name_label ();
|
||||
|
||||
gain_slider->hide();
|
||||
gm.get_gain_slider().hide();
|
||||
mute_button->show();
|
||||
solo_button->show();
|
||||
if (rec_enable_button)
|
||||
|
|
@ -761,7 +747,7 @@ RouteTimeAxisView::set_height (uint32_t h)
|
|||
hide_name_entry ();
|
||||
show_name_label ();
|
||||
|
||||
gain_slider->hide();
|
||||
gm.get_gain_slider().hide();
|
||||
mute_button->hide();
|
||||
solo_button->hide();
|
||||
if (rec_enable_button)
|
||||
|
|
@ -1826,14 +1812,14 @@ RouteTimeAxisView::update_rec_display ()
|
|||
void
|
||||
RouteTimeAxisView::fast_update ()
|
||||
{
|
||||
lm.update_meters ();
|
||||
gm.get_level_meter().update_meters ();
|
||||
}
|
||||
|
||||
void
|
||||
RouteTimeAxisView::hide_meter ()
|
||||
{
|
||||
clear_meter ();
|
||||
lm.hide_meters ();
|
||||
gm.get_level_meter().hide_meters ();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -1846,7 +1832,7 @@ void
|
|||
RouteTimeAxisView::reset_meter ()
|
||||
{
|
||||
if (Config->get_show_track_meters()) {
|
||||
lm.setup_meters (height-5);
|
||||
gm.get_level_meter().setup_meters (height-5);
|
||||
} else {
|
||||
hide_meter ();
|
||||
}
|
||||
|
|
@ -1855,7 +1841,7 @@ RouteTimeAxisView::reset_meter ()
|
|||
void
|
||||
RouteTimeAxisView::clear_meter ()
|
||||
{
|
||||
lm.clear_meters ();
|
||||
gm.get_level_meter().clear_meters ();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -1871,41 +1857,3 @@ RouteTimeAxisView::io_changed (IOChange change, void *src)
|
|||
reset_meter ();
|
||||
}
|
||||
|
||||
gint
|
||||
RouteTimeAxisView::start_gain_touch (GdkEventButton* ev)
|
||||
{
|
||||
_route->start_gain_touch ();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
gint
|
||||
RouteTimeAxisView::end_gain_touch (GdkEventButton* ev)
|
||||
{
|
||||
_route->end_gain_touch ();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
RouteTimeAxisView::gain_adjusted ()
|
||||
{
|
||||
if (ignore_gain_adjustment) {
|
||||
return;
|
||||
}
|
||||
|
||||
_route->set_gain (slider_position_to_gain (gain_adjustment.get_value()), this);
|
||||
}
|
||||
|
||||
void
|
||||
RouteTimeAxisView::gain_changed (void *src)
|
||||
{
|
||||
Gtkmm2ext::UI::instance()->call_slot (mem_fun(*this, &RouteTimeAxisView::effective_gain_display));
|
||||
}
|
||||
|
||||
void
|
||||
RouteTimeAxisView::effective_gain_display ()
|
||||
{
|
||||
gfloat value = gain_to_slider_position (_route->effective_gain());
|
||||
ignore_gain_adjustment = true;
|
||||
gain_adjustment.set_value (value);
|
||||
ignore_gain_adjustment = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@
|
|||
#include "enums.h"
|
||||
#include "time_axis_view.h"
|
||||
#include "canvas.h"
|
||||
#include "level_meter.h"
|
||||
#include "gain_meter.h"
|
||||
|
||||
|
||||
namespace ARDOUR {
|
||||
|
|
@ -110,7 +110,9 @@ public:
|
|||
void clear_meter ();
|
||||
void io_changed (ARDOUR::IOChange, void *);
|
||||
void meter_changed (void *);
|
||||
void effective_gain_display ();
|
||||
void effective_gain_display () { gm.effective_gain_display(); }
|
||||
|
||||
static void setup_slider_pix ();
|
||||
|
||||
protected:
|
||||
friend class StreamView;
|
||||
|
|
@ -257,18 +259,9 @@ protected:
|
|||
|
||||
void post_construct ();
|
||||
|
||||
LevelMeter lm;
|
||||
GainMeterBase gm;
|
||||
|
||||
Gtkmm2ext::HSliderController *gain_slider;
|
||||
Gtk::Adjustment gain_adjustment;
|
||||
bool ignore_gain_adjustment;
|
||||
static Glib::RefPtr<Gdk::Pixbuf> slider;
|
||||
static int setup_slider_pix ();
|
||||
void gain_adjusted();
|
||||
|
||||
gint start_gain_touch (GdkEventButton*);
|
||||
gint end_gain_touch (GdkEventButton*);
|
||||
void gain_changed (void *);
|
||||
};
|
||||
|
||||
#endif /* __ardour_route_time_axis_h__ */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue