2016-01-24 21:27:25 -05:00
|
|
|
/*
|
2019-08-02 17:26:43 -04:00
|
|
|
* Copyright (C) 2016-2017 Paul Davis <paul@linuxaudiosystems.com>
|
|
|
|
* Copyright (C) 2016-2019 Robin Gareus <robin@gareus.org>
|
|
|
|
* Copyright (C) 2017-2018 Ben Loftis <ben@harrisonconsoles.com>
|
|
|
|
*
|
|
|
|
* 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.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
2016-01-24 21:27:25 -05:00
|
|
|
|
2016-05-16 07:30:28 -04:00
|
|
|
#include <gtkmm/stock.h>
|
|
|
|
|
2016-09-21 01:38:42 -04:00
|
|
|
#include "pbd/string_convert.h"
|
2016-03-03 11:47:01 -05:00
|
|
|
|
2016-03-04 14:15:37 -05:00
|
|
|
#include "ardour/rc_configuration.h"
|
2016-03-04 14:53:13 -05:00
|
|
|
#include "ardour/session.h"
|
2016-01-25 12:51:10 -05:00
|
|
|
#include "ardour/vca.h"
|
2016-03-04 14:53:13 -05:00
|
|
|
#include "ardour/vca_manager.h"
|
2016-01-25 12:51:10 -05:00
|
|
|
|
2022-08-10 23:11:52 -04:00
|
|
|
#include "gtkmm2ext/colors.h"
|
2016-04-29 11:07:57 -04:00
|
|
|
#include "gtkmm2ext/doi.h"
|
2016-03-08 22:08:51 -05:00
|
|
|
#include "gtkmm2ext/keyboard.h"
|
2017-07-15 11:38:28 -04:00
|
|
|
#include "widgets/tooltips.h"
|
2016-03-08 22:08:51 -05:00
|
|
|
|
2016-05-16 07:30:28 -04:00
|
|
|
#include "ardour_dialog.h"
|
2020-02-18 21:14:00 -05:00
|
|
|
#include "ardour_message.h"
|
2016-03-08 14:57:26 -05:00
|
|
|
#include "floating_text_entry.h"
|
2016-05-16 07:30:28 -04:00
|
|
|
#include "gui_thread.h"
|
2016-05-18 15:56:52 -04:00
|
|
|
#include "mixer_ui.h"
|
2016-05-18 15:06:01 -04:00
|
|
|
#include "ui_config.h"
|
2016-01-24 21:27:25 -05:00
|
|
|
#include "vca_master_strip.h"
|
|
|
|
|
2016-07-14 14:44:52 -04:00
|
|
|
#include "pbd/i18n.h"
|
2016-03-03 11:47:01 -05:00
|
|
|
|
2016-01-24 21:27:25 -05:00
|
|
|
using namespace ARDOUR;
|
2017-07-15 11:38:28 -04:00
|
|
|
using namespace ArdourWidgets;
|
2016-03-03 11:47:01 -05:00
|
|
|
using namespace Gtkmm2ext;
|
2016-03-04 14:53:13 -05:00
|
|
|
using namespace Gtk;
|
2016-03-08 14:57:26 -05:00
|
|
|
using namespace PBD;
|
2016-01-25 12:51:10 -05:00
|
|
|
using std::string;
|
2016-01-24 21:27:25 -05:00
|
|
|
|
2016-04-23 18:25:49 -04:00
|
|
|
PBD::Signal1<void,VCAMasterStrip*> VCAMasterStrip::CatchDeletion;
|
|
|
|
|
2016-01-25 12:51:10 -05:00
|
|
|
VCAMasterStrip::VCAMasterStrip (Session* s, boost::shared_ptr<VCA> v)
|
2016-06-05 15:47:39 -04:00
|
|
|
: SessionHandlePtr (s)
|
2016-02-29 14:45:03 -05:00
|
|
|
, _vca (v)
|
2016-06-09 16:30:21 -04:00
|
|
|
, gain_meter (s, 254) /* magic number, don't adjust blindly */
|
2016-03-08 22:08:51 -05:00
|
|
|
, context_menu (0)
|
2016-05-16 07:30:28 -04:00
|
|
|
, delete_dialog (0)
|
2016-06-09 13:12:04 -04:00
|
|
|
, control_slave_ui (s)
|
2016-01-24 21:27:25 -05:00
|
|
|
{
|
2016-06-09 16:24:41 -04:00
|
|
|
/* set color for the VCA, if not already done. */
|
2016-06-09 15:35:56 -04:00
|
|
|
|
2016-06-09 16:24:41 -04:00
|
|
|
if (!_vca->presentation_info().color_set()) {
|
2022-08-10 23:11:52 -04:00
|
|
|
_vca->presentation_info().set_color (Gtkmm2ext::gdk_color_to_rgba (unique_random_color()));
|
2016-06-09 15:35:56 -04:00
|
|
|
}
|
|
|
|
|
2016-06-09 13:12:04 -04:00
|
|
|
control_slave_ui.set_stripable (boost::dynamic_pointer_cast<Stripable> (v));
|
|
|
|
|
2016-01-25 12:51:10 -05:00
|
|
|
gain_meter.set_controls (boost::shared_ptr<Route>(),
|
|
|
|
boost::shared_ptr<PeakMeter>(),
|
|
|
|
boost::shared_ptr<Amp>(),
|
2016-03-07 15:00:12 -05:00
|
|
|
_vca->gain_control());
|
2016-01-25 12:51:10 -05:00
|
|
|
|
2016-03-04 14:15:37 -05:00
|
|
|
solo_button.set_name ("solo button");
|
|
|
|
set_tooltip (solo_button, _("Solo slaves"));
|
|
|
|
solo_button.signal_button_release_event().connect (sigc::mem_fun (*this, &VCAMasterStrip::solo_release), false);
|
|
|
|
|
|
|
|
mute_button.set_name ("mute button");
|
2016-03-08 14:57:26 -05:00
|
|
|
mute_button.set_text (_("M"));
|
2016-03-04 14:15:37 -05:00
|
|
|
set_tooltip (mute_button, _("Mute slaves"));
|
|
|
|
mute_button.signal_button_release_event().connect (sigc::mem_fun (*this, &VCAMasterStrip::mute_release), false);
|
|
|
|
|
2019-09-12 17:35:57 -04:00
|
|
|
hide_button.set_icon (ArdourIcon::HideEye);
|
2016-03-03 11:47:01 -05:00
|
|
|
set_tooltip (&hide_button, _("Hide this VCA strip"));
|
|
|
|
|
|
|
|
hide_button.signal_clicked.connect (sigc::mem_fun(*this, &VCAMasterStrip::hide_clicked));
|
|
|
|
|
2016-03-04 14:15:37 -05:00
|
|
|
solo_mute_box.set_spacing (2);
|
|
|
|
solo_mute_box.pack_start (mute_button, true, true);
|
|
|
|
solo_mute_box.pack_start (solo_button, true, true);
|
|
|
|
|
2017-07-03 13:55:17 -04:00
|
|
|
mute_button.set_controllable (_vca->mute_control());
|
|
|
|
solo_button.set_controllable (_vca->solo_control());
|
|
|
|
|
2016-09-21 01:38:42 -04:00
|
|
|
number_label.set_text (PBD::to_string (v->number()));
|
2016-03-03 11:47:01 -05:00
|
|
|
number_label.set_elements((ArdourButton::Element)(ArdourButton::Edge|ArdourButton::Body|ArdourButton::Text|ArdourButton::Inactive));
|
|
|
|
number_label.set_no_show_all ();
|
2016-03-08 14:57:26 -05:00
|
|
|
number_label.set_name ("generic button");
|
2016-03-03 11:47:01 -05:00
|
|
|
number_label.set_alignment (.5, .5);
|
|
|
|
number_label.set_fallthrough_to_parent (true);
|
2016-12-21 20:00:55 -05:00
|
|
|
number_label.set_inactive_color (_vca->presentation_info().color ());
|
2017-08-06 12:37:15 -04:00
|
|
|
number_label.signal_button_release_event().connect (sigc::mem_fun (*this, &VCAMasterStrip::number_button_press), false);
|
2016-03-03 11:47:01 -05:00
|
|
|
|
2016-12-20 21:52:58 -05:00
|
|
|
update_bottom_padding ();
|
2016-03-03 11:47:01 -05:00
|
|
|
|
2016-05-18 15:06:01 -04:00
|
|
|
//Glib::RefPtr<Pango::Layout> layout = vertical_button.get_layout ();
|
|
|
|
// layout->set_justify (JUSTIFY_CENTER);
|
2016-05-18 13:30:01 -04:00
|
|
|
/* horizontally centered, with a little space (5%) at the top */
|
2016-05-18 15:06:01 -04:00
|
|
|
vertical_button.set_angle (90);
|
|
|
|
vertical_button.set_layout_font (UIConfiguration::instance().get_NormalBoldFont());
|
2016-05-21 08:07:29 -04:00
|
|
|
vertical_button.signal_button_release_event().connect (sigc::mem_fun (*this, &VCAMasterStrip::vertical_button_press));
|
|
|
|
vertical_button.set_fallthrough_to_parent (true);
|
2016-06-09 15:35:56 -04:00
|
|
|
vertical_button.set_active_color (_vca->presentation_info().color ());
|
2016-05-21 08:07:29 -04:00
|
|
|
set_tooltip (vertical_button, _("Click to show slaves only")); /* tooltip updated dynamically */
|
2016-05-18 13:30:01 -04:00
|
|
|
|
2017-01-02 11:41:15 -05:00
|
|
|
global_vpacker.set_border_width (0);
|
2017-07-20 20:10:21 -04:00
|
|
|
global_vpacker.set_spacing (0);
|
2016-12-20 21:52:58 -05:00
|
|
|
gain_meter.set_spacing(4);
|
2016-03-03 11:47:01 -05:00
|
|
|
|
2017-07-20 20:10:21 -04:00
|
|
|
global_vpacker.pack_start (number_label, false, false, 1);
|
|
|
|
global_vpacker.pack_start (hide_button, false, false, 1);
|
|
|
|
global_vpacker.pack_start (vertical_button, true, true, 1);
|
|
|
|
global_vpacker.pack_start (solo_mute_box, false, false, 1);
|
|
|
|
global_vpacker.pack_start (gain_meter, false, false, 1);
|
|
|
|
global_vpacker.pack_start (control_slave_ui, false, false, 1);
|
|
|
|
global_vpacker.pack_start (gain_meter.gain_automation_state_button, false, false, 1);
|
|
|
|
global_vpacker.pack_start (bottom_padding, false, false, 0);
|
2016-01-24 21:27:25 -05:00
|
|
|
|
2017-09-18 14:45:56 -04:00
|
|
|
global_frame.add (global_vpacker);
|
|
|
|
global_frame.set_shadow_type (Gtk::SHADOW_IN);
|
|
|
|
global_frame.set_name ("BaseFrame");
|
2016-03-03 11:47:01 -05:00
|
|
|
|
2017-09-18 14:45:56 -04:00
|
|
|
add (global_frame);
|
2016-03-03 11:47:01 -05:00
|
|
|
|
|
|
|
global_vpacker.show ();
|
2017-09-18 14:45:56 -04:00
|
|
|
global_frame.show ();
|
2016-05-18 15:06:01 -04:00
|
|
|
vertical_button.show ();
|
2016-03-08 14:57:26 -05:00
|
|
|
hide_button.show ();
|
|
|
|
number_label.show ();
|
|
|
|
gain_meter.show ();
|
2016-03-04 14:15:37 -05:00
|
|
|
solo_mute_box.show_all ();
|
2016-06-09 13:12:04 -04:00
|
|
|
control_slave_ui.show ();
|
2017-07-20 20:10:21 -04:00
|
|
|
gain_meter.gain_automation_state_button.show ();
|
2016-03-03 13:28:42 -05:00
|
|
|
|
|
|
|
/* force setting of visible selected status */
|
|
|
|
|
|
|
|
_selected = true;
|
|
|
|
set_selected (false);
|
2016-03-08 14:57:26 -05:00
|
|
|
set_solo_text ();
|
|
|
|
update_vca_name ();
|
2016-04-21 02:58:25 -04:00
|
|
|
solo_changed ();
|
|
|
|
mute_changed ();
|
2016-05-21 08:07:29 -04:00
|
|
|
spill_change (boost::shared_ptr<VCA>());
|
2016-03-08 14:57:26 -05:00
|
|
|
|
2017-01-16 16:30:26 -05:00
|
|
|
Mixer_UI::instance()->show_spill_change.connect (sigc::mem_fun (*this, &VCAMasterStrip::spill_change));
|
2016-05-18 15:56:52 -04:00
|
|
|
|
2016-03-08 14:57:26 -05:00
|
|
|
_vca->PropertyChanged.connect (vca_connections, invalidator (*this), boost::bind (&VCAMasterStrip::vca_property_changed, this, _1), gui_context());
|
2016-06-09 15:35:56 -04:00
|
|
|
_vca->presentation_info().PropertyChanged.connect (vca_connections, invalidator (*this), boost::bind (&VCAMasterStrip::vca_property_changed, this, _1), gui_context());
|
2016-06-09 13:12:04 -04:00
|
|
|
_vca->DropReferences.connect (vca_connections, invalidator (*this), boost::bind (&VCAMasterStrip::self_delete, this), gui_context());
|
2016-03-04 14:15:37 -05:00
|
|
|
|
2016-03-07 15:00:12 -05:00
|
|
|
_vca->solo_control()->Changed.connect (vca_connections, invalidator (*this), boost::bind (&VCAMasterStrip::solo_changed, this), gui_context());
|
|
|
|
_vca->mute_control()->Changed.connect (vca_connections, invalidator (*this), boost::bind (&VCAMasterStrip::mute_changed, this), gui_context());
|
2016-03-04 16:44:46 -05:00
|
|
|
|
2019-03-01 10:51:08 -05:00
|
|
|
_session->MonitorBusAddedOrRemoved.connect (*this, invalidator (*this), boost::bind (&VCAMasterStrip::set_button_names, this), gui_context());
|
2016-04-23 18:25:49 -04:00
|
|
|
|
2016-05-21 16:54:34 -04:00
|
|
|
s->config.ParameterChanged.connect (*this, invalidator (*this), boost::bind (&VCAMasterStrip::parameter_changed, this, _1), gui_context());
|
|
|
|
Config->ParameterChanged.connect (*this, invalidator (*this), boost::bind (&VCAMasterStrip::parameter_changed, this, _1), gui_context());
|
|
|
|
UIConfiguration::instance().ParameterChanged.connect (sigc::mem_fun (*this, &VCAMasterStrip::parameter_changed));
|
2016-04-23 18:25:49 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
VCAMasterStrip::~VCAMasterStrip ()
|
|
|
|
{
|
2017-01-16 16:30:26 -05:00
|
|
|
if ((_session && !_session->deletion_in_progress()) && Mixer_UI::instance()->showing_spill_for (_vca)) {
|
2016-05-18 22:02:14 -04:00
|
|
|
/* cancel spill for this VCA */
|
2017-01-16 16:30:26 -05:00
|
|
|
Mixer_UI::instance()->show_spill (boost::shared_ptr<Stripable>());
|
2016-05-18 22:02:14 -04:00
|
|
|
}
|
|
|
|
|
2016-05-16 07:30:28 -04:00
|
|
|
delete delete_dialog;
|
|
|
|
delete context_menu;
|
|
|
|
|
2016-04-23 18:25:49 -04:00
|
|
|
CatchDeletion (this); /* EMIT SIGNAL */
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
VCAMasterStrip::self_delete ()
|
|
|
|
{
|
2017-01-16 16:30:26 -05:00
|
|
|
if ((_session && !_session->deletion_in_progress()) && Mixer_UI::instance()->showing_spill_for (_vca)) {
|
2016-06-06 19:22:33 -04:00
|
|
|
/* cancel spill for this VCA */
|
2017-01-16 16:30:26 -05:00
|
|
|
Mixer_UI::instance()->show_spill (boost::shared_ptr<Stripable>());
|
2016-06-06 19:22:33 -04:00
|
|
|
}
|
|
|
|
/* Drop reference immediately, delete self when idle */
|
|
|
|
_vca.reset ();
|
2017-07-29 22:51:25 -04:00
|
|
|
gain_meter.set_controls (boost::shared_ptr<Route>(),
|
|
|
|
boost::shared_ptr<PeakMeter>(),
|
|
|
|
boost::shared_ptr<Amp>(),
|
|
|
|
boost::shared_ptr<GainControl>());
|
2016-04-29 11:07:57 -04:00
|
|
|
delete_when_idle (this);
|
2016-03-04 16:44:46 -05:00
|
|
|
}
|
|
|
|
|
2016-05-21 16:54:34 -04:00
|
|
|
void
|
|
|
|
VCAMasterStrip::parameter_changed (std::string const & p)
|
|
|
|
{
|
2019-03-01 10:51:08 -05:00
|
|
|
if (p == "solo-control-is-listen-control" || p == "listen-position") {
|
2016-05-21 16:54:34 -04:00
|
|
|
set_button_names ();
|
2016-12-20 21:52:58 -05:00
|
|
|
} else if (p == "mixer-element-visibility") {
|
|
|
|
update_bottom_padding ();
|
2016-05-21 16:54:34 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
VCAMasterStrip::set_button_names ()
|
|
|
|
{
|
|
|
|
if (Config->get_solo_control_is_listen_control()) {
|
|
|
|
switch (Config->get_listen_position()) {
|
|
|
|
case AfterFaderListen:
|
|
|
|
solo_button.set_text (S_("AfterFader|A"));
|
|
|
|
set_tooltip (solo_button, _("After-fade listen (AFL)"));
|
|
|
|
break;
|
|
|
|
case PreFaderListen:
|
|
|
|
solo_button.set_text (S_("PreFader|P"));
|
|
|
|
set_tooltip (solo_button, _("Pre-fade listen (PFL)"));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
solo_button.set_text (S_("Solo|S"));
|
|
|
|
set_tooltip (solo_button, _("Solo"));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-12-20 21:52:58 -05:00
|
|
|
void
|
|
|
|
VCAMasterStrip::update_bottom_padding ()
|
|
|
|
{
|
|
|
|
std::string viz = UIConfiguration::instance().get_mixer_strip_visibility ();
|
|
|
|
|
|
|
|
ArdourButton output_button (_("Output"));
|
|
|
|
ArdourButton comment_button (_("Comments"));
|
|
|
|
|
|
|
|
output_button.set_name ("mixer strip button");
|
|
|
|
comment_button.set_name ("generic button");
|
|
|
|
|
2017-04-26 18:25:57 -04:00
|
|
|
if (viz.find ("VCA") == std::string::npos) {
|
|
|
|
control_slave_ui.hide ();
|
|
|
|
} else {
|
|
|
|
control_slave_ui.show ();
|
|
|
|
}
|
2016-12-20 21:52:58 -05:00
|
|
|
|
2017-07-20 20:10:21 -04:00
|
|
|
int h = 0;
|
2016-12-20 21:52:58 -05:00
|
|
|
if (viz.find ("Output") != std::string::npos) {
|
|
|
|
Gtk::Window window (WINDOW_TOPLEVEL);
|
|
|
|
window.add (output_button);
|
|
|
|
Gtk::Requisition requisition(output_button.size_request ());
|
|
|
|
h += requisition.height + 2;
|
|
|
|
}
|
|
|
|
if (viz.find ("Comments") != std::string::npos) {
|
|
|
|
Gtk::Window window (WINDOW_TOPLEVEL);
|
|
|
|
window.add (comment_button);
|
|
|
|
Gtk::Requisition requisition(comment_button.size_request ());
|
|
|
|
h += requisition.height + 2;
|
|
|
|
}
|
2017-07-20 20:10:21 -04:00
|
|
|
if (h <= 0) {
|
|
|
|
bottom_padding.set_size_request (-1, 1);
|
|
|
|
bottom_padding.hide ();
|
|
|
|
} else {
|
|
|
|
bottom_padding.set_size_request (-1, h);
|
|
|
|
bottom_padding.show ();
|
|
|
|
}
|
2016-12-20 21:52:58 -05:00
|
|
|
}
|
|
|
|
|
2016-01-25 12:51:10 -05:00
|
|
|
string
|
|
|
|
VCAMasterStrip::name() const
|
|
|
|
{
|
2016-02-29 14:45:03 -05:00
|
|
|
return _vca->name();
|
2016-01-25 12:51:10 -05:00
|
|
|
}
|
2016-03-03 11:47:01 -05:00
|
|
|
|
|
|
|
void
|
|
|
|
VCAMasterStrip::hide_clicked ()
|
|
|
|
{
|
2016-06-09 16:58:49 -04:00
|
|
|
_vca->presentation_info().set_hidden (true);
|
2016-05-16 07:30:28 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
VCAMasterStrip::hide_confirmation (int response)
|
|
|
|
{
|
|
|
|
delete_dialog->hide ();
|
|
|
|
|
|
|
|
switch (response) {
|
2016-05-19 15:44:35 -04:00
|
|
|
case RESPONSE_YES:
|
2016-05-16 07:30:28 -04:00
|
|
|
/* get everything to deassign. This will also delete ourselves (when
|
|
|
|
* idle) and that in turn will remove us from the Mixer GUI
|
|
|
|
*/
|
|
|
|
_session->vca_manager().remove_vca (_vca);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2016-03-03 11:47:01 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
VCAMasterStrip::width_button_pressed (GdkEventButton* ev)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2016-03-03 13:28:42 -05:00
|
|
|
|
|
|
|
void
|
|
|
|
VCAMasterStrip::set_selected (bool yn)
|
|
|
|
{
|
|
|
|
AxisView::set_selected (yn);
|
|
|
|
|
|
|
|
if (_selected) {
|
2017-09-18 14:45:56 -04:00
|
|
|
global_frame.set_shadow_type (Gtk::SHADOW_ETCHED_OUT);
|
|
|
|
global_frame.set_name ("MixerStripSelectedFrame");
|
2016-03-03 13:28:42 -05:00
|
|
|
} else {
|
2017-09-18 14:45:56 -04:00
|
|
|
global_frame.set_shadow_type (Gtk::SHADOW_IN);
|
|
|
|
global_frame.set_name ("MixerStripFrame");
|
2016-03-03 13:28:42 -05:00
|
|
|
}
|
|
|
|
|
2017-09-18 14:45:56 -04:00
|
|
|
global_frame.queue_draw ();
|
2016-03-03 13:28:42 -05:00
|
|
|
}
|
|
|
|
|
2016-03-04 14:15:37 -05:00
|
|
|
bool
|
|
|
|
VCAMasterStrip::solo_release (GdkEventButton*)
|
|
|
|
{
|
2016-04-15 00:38:03 -04:00
|
|
|
/* We use NoGroup because VCA controls are never part of a group. This
|
|
|
|
is redundant, but clear.
|
|
|
|
*/
|
|
|
|
_vca->solo_control()->set_value (_vca->solo_control()->self_soloed() ? 0.0 : 1.0, Controllable::NoGroup);
|
2016-03-04 14:15:37 -05:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
VCAMasterStrip::mute_release (GdkEventButton*)
|
|
|
|
{
|
2016-04-15 00:38:03 -04:00
|
|
|
/* We use NoGroup because VCA controls are never part of a group. This
|
|
|
|
is redundant, but clear.
|
|
|
|
*/
|
|
|
|
_vca->mute_control()->set_value (_vca->mute_control()->muted_by_self() ? 0.0 : 1.0, Controllable::NoGroup);
|
2016-03-04 14:15:37 -05:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
VCAMasterStrip::set_solo_text ()
|
|
|
|
{
|
2016-03-08 14:57:26 -05:00
|
|
|
if (Config->get_solo_control_is_listen_control ()) {
|
|
|
|
switch (Config->get_listen_position()) {
|
|
|
|
case AfterFaderListen:
|
|
|
|
solo_button.set_text (_("A"));
|
|
|
|
break;
|
|
|
|
case PreFaderListen:
|
|
|
|
solo_button.set_text (_("P"));
|
|
|
|
break;
|
2016-03-04 14:15:37 -05:00
|
|
|
}
|
|
|
|
} else {
|
2016-03-08 14:57:26 -05:00
|
|
|
solo_button.set_text (_("S"));
|
2016-03-04 14:15:37 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
VCAMasterStrip::mute_changed ()
|
|
|
|
{
|
2016-04-15 00:38:03 -04:00
|
|
|
if (_vca->mute_control()->muted_by_self()) {
|
2016-03-04 14:15:37 -05:00
|
|
|
mute_button.set_active_state (ExplicitActive);
|
2016-04-20 23:22:29 -04:00
|
|
|
} else if (_vca->mute_control()->muted_by_masters ()) {
|
2016-04-15 00:38:03 -04:00
|
|
|
mute_button.set_active_state (ImplicitActive);
|
2016-03-04 14:15:37 -05:00
|
|
|
} else {
|
|
|
|
mute_button.set_active_state (Gtkmm2ext::Off);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
VCAMasterStrip::solo_changed ()
|
|
|
|
{
|
2016-04-21 02:06:01 -04:00
|
|
|
if (_vca->solo_control()->self_soloed()) {
|
2016-03-04 14:15:37 -05:00
|
|
|
solo_button.set_active_state (ExplicitActive);
|
2016-04-21 02:06:01 -04:00
|
|
|
} else if (_vca->solo_control()->soloed_by_masters ()) {
|
|
|
|
solo_button.set_active_state (ImplicitActive);
|
2016-03-04 14:15:37 -05:00
|
|
|
} else {
|
|
|
|
solo_button.set_active_state (Gtkmm2ext::Off);
|
|
|
|
}
|
|
|
|
}
|
2016-03-04 14:53:13 -05:00
|
|
|
|
2016-05-18 13:30:01 -04:00
|
|
|
bool
|
2016-05-21 08:07:29 -04:00
|
|
|
VCAMasterStrip::vertical_button_press (GdkEventButton* ev)
|
2016-05-18 13:30:01 -04:00
|
|
|
{
|
2016-05-18 14:15:39 -04:00
|
|
|
if (ev->button == 1 && ev->type == GDK_2BUTTON_PRESS) {
|
|
|
|
start_name_edit ();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (Keyboard::is_context_menu_event (ev)) {
|
|
|
|
if (!context_menu) {
|
|
|
|
build_context_menu ();
|
|
|
|
}
|
2017-03-24 09:36:17 -04:00
|
|
|
context_menu->popup (1, ev->time);
|
2016-05-18 14:15:39 -04:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ev->button == 1) {
|
2016-05-21 08:07:29 -04:00
|
|
|
spill ();
|
2016-05-18 14:15:39 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
2016-05-18 13:30:01 -04:00
|
|
|
}
|
|
|
|
|
2017-01-05 09:08:42 -05:00
|
|
|
bool
|
|
|
|
VCAMasterStrip::number_button_press (GdkEventButton* ev)
|
|
|
|
{
|
|
|
|
if (Keyboard::is_context_menu_event (ev)) {
|
|
|
|
if (!context_menu) {
|
|
|
|
build_context_menu ();
|
|
|
|
}
|
2017-03-24 09:36:17 -04:00
|
|
|
context_menu->popup (1, ev->time);
|
2017-08-06 12:37:15 -04:00
|
|
|
return true;
|
2017-01-05 09:08:42 -05:00
|
|
|
}
|
2017-08-06 12:37:15 -04:00
|
|
|
return false;
|
2017-01-05 09:08:42 -05:00
|
|
|
}
|
|
|
|
|
2016-05-18 14:15:39 -04:00
|
|
|
void
|
|
|
|
VCAMasterStrip::start_name_edit ()
|
|
|
|
{
|
|
|
|
Gtk::Window* win = dynamic_cast<Gtk::Window*>(get_toplevel());
|
|
|
|
FloatingTextEntry* fte = new FloatingTextEntry (win, _vca->name());
|
|
|
|
fte->use_text.connect (sigc::mem_fun (*this, &VCAMasterStrip::finish_name_edit));
|
|
|
|
fte->present ();
|
|
|
|
}
|
|
|
|
|
2016-03-08 14:57:26 -05:00
|
|
|
void
|
2016-05-21 19:17:11 -04:00
|
|
|
VCAMasterStrip::finish_name_edit (std::string str, int)
|
2016-03-08 14:57:26 -05:00
|
|
|
{
|
|
|
|
_vca->set_name (str);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
VCAMasterStrip::vca_property_changed (PropertyChange const & what_changed)
|
|
|
|
{
|
|
|
|
if (what_changed.contains (ARDOUR::Properties::name)) {
|
|
|
|
update_vca_name ();
|
|
|
|
}
|
2016-06-09 15:35:56 -04:00
|
|
|
|
|
|
|
if (what_changed.contains (ARDOUR::Properties::color)) {
|
|
|
|
vertical_button.set_active_color (_vca->presentation_info().color ());
|
2016-12-21 20:00:55 -05:00
|
|
|
number_label.set_inactive_color (_vca->presentation_info().color ());
|
2016-06-09 15:35:56 -04:00
|
|
|
}
|
2016-06-09 16:58:49 -04:00
|
|
|
|
|
|
|
if (what_changed.contains (ARDOUR::Properties::hidden)) {
|
|
|
|
|
|
|
|
}
|
2016-03-08 14:57:26 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
VCAMasterStrip::update_vca_name ()
|
|
|
|
{
|
2016-05-18 15:56:52 -04:00
|
|
|
/* 20 is a rough guess at the number of letters we can fit. */
|
2017-01-28 10:06:44 -05:00
|
|
|
vertical_button.set_text (short_version (_vca->full_name(), 20));
|
2016-03-08 14:57:26 -05:00
|
|
|
}
|
2016-03-08 22:08:51 -05:00
|
|
|
|
|
|
|
void
|
|
|
|
VCAMasterStrip::build_context_menu ()
|
|
|
|
{
|
|
|
|
using namespace Gtk::Menu_Helpers;
|
|
|
|
context_menu = new Menu;
|
|
|
|
MenuList& items = context_menu->items();
|
2016-05-18 14:15:39 -04:00
|
|
|
items.push_back (MenuElem (_("Rename"), sigc::mem_fun (*this, &VCAMasterStrip::start_name_edit)));
|
2016-06-09 15:35:56 -04:00
|
|
|
items.push_back (MenuElem (_("Color..."), sigc::mem_fun (*this, &VCAMasterStrip::start_color_edit)));
|
2016-05-19 14:53:41 -04:00
|
|
|
items.push_back (SeparatorElem());
|
2017-02-02 12:02:10 -05:00
|
|
|
items.push_back (MenuElem (_("Assign Selected Channels"), sigc::mem_fun (*this, &VCAMasterStrip::assign_all_selected)));
|
|
|
|
items.push_back (MenuElem (_("Drop Selected Channels"), sigc::mem_fun (*this, &VCAMasterStrip::unassign_all_selected)));
|
|
|
|
items.push_back (SeparatorElem());
|
2016-05-19 15:44:12 -04:00
|
|
|
items.push_back (MenuElem (_("Drop All Slaves"), sigc::mem_fun (*this, &VCAMasterStrip::drop_all_slaves)));
|
2016-05-19 14:53:41 -04:00
|
|
|
items.push_back (SeparatorElem());
|
2020-02-18 21:41:23 -05:00
|
|
|
items.push_back (MenuElem (_("Remove"), sigc::mem_fun (*this, &VCAMasterStrip::remove)));
|
2016-03-08 22:08:51 -05:00
|
|
|
}
|
2016-05-18 15:56:52 -04:00
|
|
|
|
|
|
|
void
|
|
|
|
VCAMasterStrip::spill ()
|
|
|
|
{
|
2017-01-16 16:30:26 -05:00
|
|
|
if (Mixer_UI::instance()->showing_spill_for (_vca)) {
|
|
|
|
Mixer_UI::instance()->show_spill (boost::shared_ptr<Stripable>());
|
2016-05-18 15:56:52 -04:00
|
|
|
} else {
|
2017-01-16 16:30:26 -05:00
|
|
|
Mixer_UI::instance()->show_spill (_vca);
|
2016-05-18 15:56:52 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2017-01-16 16:30:26 -05:00
|
|
|
VCAMasterStrip::spill_change (boost::shared_ptr<Stripable> vca)
|
2016-05-18 15:56:52 -04:00
|
|
|
{
|
|
|
|
if (vca != _vca) {
|
|
|
|
vertical_button.set_active_state (Gtkmm2ext::Off);
|
2016-05-21 08:07:29 -04:00
|
|
|
set_tooltip (vertical_button, _("Click to show slaves only"));
|
2016-05-18 15:56:52 -04:00
|
|
|
} else {
|
|
|
|
vertical_button.set_active_state (Gtkmm2ext::ExplicitActive);
|
2016-05-21 08:07:29 -04:00
|
|
|
set_tooltip (vertical_button, _("Click to show normal mixer"));
|
2016-05-18 15:56:52 -04:00
|
|
|
}
|
|
|
|
}
|
2016-05-18 22:02:14 -04:00
|
|
|
|
2020-02-18 21:41:23 -05:00
|
|
|
void
|
|
|
|
VCAMasterStrip::remove ()
|
|
|
|
{
|
|
|
|
if (!_session) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ArdourMessageDialog checker (_("Do you really want to remove this VCA?"),
|
|
|
|
true,
|
|
|
|
Gtk::MESSAGE_QUESTION,
|
|
|
|
Gtk::BUTTONS_NONE);
|
|
|
|
|
|
|
|
string title = string_compose (_("Remove %1"), "VCA");
|
|
|
|
checker.set_title (title);
|
|
|
|
|
|
|
|
checker.set_secondary_text(_("This action cannot be undone."));
|
|
|
|
|
|
|
|
checker.add_button (_("No, do nothing."), RESPONSE_CANCEL);
|
|
|
|
checker.add_button (_("Yes, remove it."), RESPONSE_ACCEPT);
|
|
|
|
checker.set_default_response (RESPONSE_CANCEL);
|
|
|
|
|
|
|
|
checker.set_name (X_("RemoveVcaDialog"));
|
|
|
|
checker.set_wmclass (X_("ardour_vca_remove"), PROGRAM_NAME);
|
|
|
|
checker.set_position (Gtk::WIN_POS_MOUSE);
|
|
|
|
|
|
|
|
switch (checker.run()) {
|
|
|
|
case RESPONSE_ACCEPT:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
checker.hide();
|
|
|
|
|
|
|
|
_session->vca_manager().remove_vca (_vca);
|
|
|
|
}
|
|
|
|
|
2017-02-02 12:02:10 -05:00
|
|
|
void
|
|
|
|
VCAMasterStrip::assign_all_selected ()
|
|
|
|
{
|
|
|
|
Mixer_UI::instance()->do_vca_assign (_vca);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
VCAMasterStrip::unassign_all_selected ()
|
|
|
|
{
|
|
|
|
Mixer_UI::instance()->do_vca_unassign (_vca);
|
|
|
|
}
|
|
|
|
|
2016-05-19 14:53:41 -04:00
|
|
|
void
|
|
|
|
VCAMasterStrip::drop_all_slaves ()
|
|
|
|
{
|
2016-05-19 15:15:51 -04:00
|
|
|
_vca->Drop (); /* EMIT SIGNAL */
|
|
|
|
|
2017-01-16 16:30:26 -05:00
|
|
|
if (Mixer_UI::instance()->showing_spill_for (_vca)) {
|
|
|
|
Mixer_UI::instance()->show_spill (boost::shared_ptr<Stripable>());
|
2016-05-19 15:15:51 -04:00
|
|
|
}
|
2016-05-19 14:53:41 -04:00
|
|
|
}
|
|
|
|
|
2016-06-05 15:39:22 -04:00
|
|
|
Gdk::Color
|
|
|
|
VCAMasterStrip::color () const
|
|
|
|
{
|
2022-08-10 23:11:52 -04:00
|
|
|
return Gtkmm2ext::gdk_color_from_rgba (_vca->presentation_info().color ());
|
2016-06-05 15:39:22 -04:00
|
|
|
}
|
2016-06-08 11:02:41 -04:00
|
|
|
|
|
|
|
string
|
|
|
|
VCAMasterStrip::state_id () const
|
|
|
|
{
|
|
|
|
return string_compose (X_("vms-%1"), _vca->number());
|
|
|
|
}
|
2016-06-09 15:35:56 -04:00
|
|
|
|
|
|
|
void
|
|
|
|
VCAMasterStrip::start_color_edit ()
|
|
|
|
{
|
2017-03-10 17:51:39 -05:00
|
|
|
_color_picker.popup (_vca);
|
2016-06-09 15:35:56 -04:00
|
|
|
}
|
2016-06-09 16:03:07 -04:00
|
|
|
|
|
|
|
bool
|
|
|
|
VCAMasterStrip::marked_for_display () const
|
|
|
|
{
|
|
|
|
return !_vca->presentation_info().hidden();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
VCAMasterStrip::set_marked_for_display (bool yn)
|
|
|
|
{
|
|
|
|
if (yn == _vca->presentation_info().hidden()) {
|
|
|
|
_vca->presentation_info().set_hidden (!yn);
|
|
|
|
return true; // things changed
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
2016-07-06 13:37:30 -04:00
|
|
|
|
|
|
|
PresentationInfo const &
|
|
|
|
VCAMasterStrip::presentation_info () const
|
|
|
|
{
|
|
|
|
return _vca->presentation_info();
|
|
|
|
}
|
|
|
|
|
|
|
|
boost::shared_ptr<Stripable>
|
|
|
|
VCAMasterStrip::stripable () const
|
|
|
|
{
|
|
|
|
return _vca;
|
|
|
|
}
|