#include "ardour/session.h"
#include "ardour/session_route.h"
#include "ardour/dB.h"
+#include "ardour/utils.h"
#include <gtkmm/style.h>
#include <gdkmm/color.h>
#include <gtkmm2ext/utils.h>
#include <gtkmm2ext/fastmeter.h>
-#include <gtkmm2ext/stop_signal.h>
#include <gtkmm2ext/barcontroller.h>
#include <gtkmm2ext/gtk_ui.h>
#include "midi++/manager.h"
#include "ardour_ui.h"
#include "gain_meter.h"
-#include "utils.h"
#include "logmeter.h"
#include "gui_thread.h"
#include "keyboard.h"
#include "public_editor.h"
+#include "utils.h"
#include "ardour/session.h"
#include "ardour/route.h"
}
}
-GainMeterBase::GainMeterBase (Session& s,
+GainMeterBase::GainMeterBase (Session* s,
const Glib::RefPtr<Gdk::Pixbuf>& pix,
bool horizontal,
int fader_length)
- : _session (s)
- // 0.781787 is the value needed for gain to be set to 0.
- , gain_adjustment (0.781787, 0.0, 1.0, 0.01, 0.1)
+ : gain_adjustment (0.781787, 0.0, 1.0, 0.01, 0.1) // 0.781787 is the value needed for gain to be set to 0.
, gain_automation_style_button ("")
, gain_automation_state_button ("")
, dpi_changed (false)
{
using namespace Menu_Helpers;
+ set_session (s);
+
ignore_toggle = false;
meter_menu = 0;
next_release_selects = false;
gain_automation_style_button.set_name ("MixerAutomationModeButton");
gain_automation_state_button.set_name ("MixerAutomationPlaybackButton");
- ARDOUR_UI::instance()->tooltips().set_tip (gain_automation_state_button, _("Fader automation mode"));
- ARDOUR_UI::instance()->tooltips().set_tip (gain_automation_style_button, _("Fader automation type"));
+ ARDOUR_UI::instance()->set_tip (gain_automation_state_button, _("Fader automation mode"));
+ ARDOUR_UI::instance()->set_tip (gain_automation_style_button, _("Fader automation type"));
gain_automation_style_button.unset_flags (Gtk::CAN_FOCUS);
gain_automation_state_button.unset_flags (Gtk::CAN_FOCUS);
boost::shared_ptr<Amp> amp)
{
connections.clear ();
+ model_connections.drop_connections ();
if (!pm && !amp) {
level_meter->set_meter (0);
connections.push_back (gain_automation_state_button.signal_button_press_event().connect (sigc::mem_fun(*this, &GainMeterBase::gain_automation_state_button_event), false));
boost::shared_ptr<AutomationControl> gc = amp->gain_control();
-
- connections.push_back (gc->alist()->automation_state_changed.connect (sigc::mem_fun(*this, &GainMeter::gain_automation_state_changed)));
- connections.push_back (gc->alist()->automation_style_changed.connect (sigc::mem_fun(*this, &GainMeter::gain_automation_style_changed)));
-
+
+ gc->alist()->automation_state_changed.connect (model_connections, invalidator (*this), boost::bind (&GainMeter::gain_automation_state_changed, this), gui_context());
+ gc->alist()->automation_style_changed.connect (model_connections, invalidator (*this), boost::bind (&GainMeter::gain_automation_style_changed, this), gui_context());
+
gain_automation_state_changed ();
}
-
- connections.push_back (amp->gain_control()->Changed.connect (sigc::mem_fun (*this, &GainMeterBase::gain_changed)));
+
+ amp->gain_control()->Changed.connect (model_connections, invalidator (*this), boost::bind (&GainMeterBase::gain_changed, this), gui_context());
gain_changed ();
show_gain ();
void
GainMeterBase::gain_changed ()
{
- Gtkmm2ext::UI::instance()->call_slot (boost::bind (&GainMeterBase::effective_gain_display, this));
+ Gtkmm2ext::UI::instance()->call_slot (invalidator (*this), boost::bind (&GainMeterBase::effective_gain_display, this));
}
void
/* Primary+Tertiary-click applies change to all routes */
- _session.foreach_route (this, &GainMeterBase::set_meter_point, next_meter_point (_route->meter_point()));
+ _session->foreach_route (this, &GainMeterBase::set_meter_point, next_meter_point (_route->meter_point()));
} else if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
// XXX no undo yet
- _route->set_meter_point (next_meter_point (_route->meter_point()), this);
+ _route->set_meter_point (next_meter_point (_route->meter_point()));
}
}
}
void
GainMeterBase::set_meter_point (Route& route, MeterPoint mp)
{
- route.set_meter_point (mp, this);
+ route.set_meter_point (mp);
}
void
RouteGroup* mix_group;
if((mix_group = route.route_group()) != 0){
- mix_group->apply (&Route::set_meter_point, mp, this);
+ mix_group->apply (&Route::set_meter_point, mp);
} else {
- route.set_meter_point (mp, this);
+ route.set_meter_point (mp);
}
}
style_changed = true;
}
-GainMeter::GainMeter (Session& s, int fader_length)
+GainMeter::GainMeter (Session* s, int fader_length)
: GainMeterBase (s, slider, false, fader_length)
{
gain_display_box.set_homogeneous (true);
gain_automation_style_button.set_name ("MixerAutomationModeButton");
gain_automation_state_button.set_name ("MixerAutomationPlaybackButton");
- ARDOUR_UI::instance()->tooltips().set_tip (gain_automation_state_button, _("Fader automation mode"));
- ARDOUR_UI::instance()->tooltips().set_tip (gain_automation_style_button, _("Fader automation type"));
+ ARDOUR_UI::instance()->set_tip (gain_automation_state_button, _("Fader automation mode"));
+ ARDOUR_UI::instance()->set_tip (gain_automation_style_button, _("Fader automation type"));
gain_automation_style_button.unset_flags (Gtk::CAN_FOCUS);
gain_automation_state_button.unset_flags (Gtk::CAN_FOCUS);