From 45b5c9667e8b2d50250cd6d2846f9e0905fb1e84 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Wed, 18 May 2016 15:56:52 -0400 Subject: basics of spill control in place (actual change in mixer display, not done) --- gtk2_ardour/mixer_ui.cc | 16 +++++++++++++ gtk2_ardour/mixer_ui.h | 6 +++++ gtk2_ardour/vca_master_strip.cc | 51 +++++++++++++++++++++-------------------- gtk2_ardour/vca_master_strip.h | 2 ++ 4 files changed, 50 insertions(+), 25 deletions(-) diff --git a/gtk2_ardour/mixer_ui.cc b/gtk2_ardour/mixer_ui.cc index 437bdf515a..0c70668d51 100644 --- a/gtk2_ardour/mixer_ui.cc +++ b/gtk2_ardour/mixer_ui.cc @@ -2663,3 +2663,19 @@ Mixer_UI::do_vca_unassign (boost::shared_ptr vca) /* call protected MixerActor:: method */ vca_unassign (vca); } + +void +Mixer_UI::show_vca_slaves (boost::shared_ptr vca) +{ + boost::shared_ptr v = spilled_vca.lock(); + if (v != vca) { + spilled_vca = vca; + show_vca_change (vca); /* EMIT SIGNAL */ + } +} + +bool +Mixer_UI::showing_vca_slaves_for (boost::shared_ptr vca) const +{ + return vca == spilled_vca.lock(); +} diff --git a/gtk2_ardour/mixer_ui.h b/gtk2_ardour/mixer_ui.h index 413e5900f3..465324deb2 100644 --- a/gtk2_ardour/mixer_ui.h +++ b/gtk2_ardour/mixer_ui.h @@ -115,6 +115,10 @@ class Mixer_UI : public Gtkmm2ext::Tabbable, public PBD::ScopedConnectionList, p void do_vca_assign (boost::shared_ptr); void do_vca_unassign (boost::shared_ptr); + void show_vca_slaves (boost::shared_ptr); + bool showing_vca_slaves_for (boost::shared_ptr) const; + + sigc::signal1 > show_vca_change; protected: void set_route_targets_for_operation (); @@ -365,6 +369,8 @@ class Mixer_UI : public Gtkmm2ext::Tabbable, public PBD::ScopedConnectionList, p // true if mixer list is visible bool _show_mixer_list; + + mutable boost::weak_ptr spilled_vca; }; #endif /* __ardour_mixer_ui_h__ */ diff --git a/gtk2_ardour/vca_master_strip.cc b/gtk2_ardour/vca_master_strip.cc index aeef39e924..e40dd96ba3 100644 --- a/gtk2_ardour/vca_master_strip.cc +++ b/gtk2_ardour/vca_master_strip.cc @@ -31,6 +31,7 @@ #include "ardour_dialog.h" #include "floating_text_entry.h" #include "gui_thread.h" +#include "mixer_ui.h" #include "tooltips.h" #include "ui_config.h" #include "vca_master_strip.h" @@ -46,30 +47,6 @@ using std::string; PBD::Signal1 VCAMasterStrip::CatchDeletion; -static string -verticalize (string const & str) -{ - return str; -#if 0 - string ret; - string::const_iterator s = str.begin(); - ret = *s; - ret += '\n'; - ++s; - - while (s != str.end()) { - ret += *s; - ret += '\n'; - ++s; - } - - /* remove terminal newline */ - - ret.erase (ret.length() - 1, string::npos); - return ret; -#endif -} - VCAMasterStrip::VCAMasterStrip (Session* s, boost::shared_ptr v) : AxisView (s) , _vca (v) @@ -124,6 +101,7 @@ VCAMasterStrip::VCAMasterStrip (Session* s, boost::shared_ptr v) /* horizontally centered, with a little space (5%) at the top */ vertical_button.set_angle (90); vertical_button.set_layout_font (UIConfiguration::instance().get_NormalBoldFont()); + vertical_button.signal_clicked.connect (sigc::mem_fun (*this, &VCAMasterStrip::spill)); global_vpacker.set_border_width (1); global_vpacker.set_spacing (0); @@ -166,6 +144,8 @@ VCAMasterStrip::VCAMasterStrip (Session* s, boost::shared_ptr v) solo_changed (); mute_changed (); + Mixer_UI::instance()->show_vca_change.connect (sigc::mem_fun (*this, &VCAMasterStrip::spill_change)); + /* this remains unchanged as the name changes */ name_button.set_text (string_compose (X_("VCA %1"), _vca->number())); @@ -485,7 +465,8 @@ VCAMasterStrip::vca_property_changed (PropertyChange const & what_changed) void VCAMasterStrip::update_vca_name () { - vertical_button.set_text (verticalize (short_version (_vca->name(), 15))); + /* 20 is a rough guess at the number of letters we can fit. */ + vertical_button.set_text (short_version (_vca->name(), 20)); } void @@ -497,3 +478,23 @@ VCAMasterStrip::build_context_menu () items.push_back (MenuElem (_("Rename"), sigc::mem_fun (*this, &VCAMasterStrip::start_name_edit))); items.push_back (MenuElem (_("Remove"))); } + +void +VCAMasterStrip::spill () +{ + if (Mixer_UI::instance()->showing_vca_slaves_for (_vca)) { + Mixer_UI::instance()->show_vca_slaves (boost::shared_ptr()); + } else { + Mixer_UI::instance()->show_vca_slaves (_vca); + } +} + +void +VCAMasterStrip::spill_change (boost::shared_ptr vca) +{ + if (vca != _vca) { + vertical_button.set_active_state (Gtkmm2ext::Off); + } else { + vertical_button.set_active_state (Gtkmm2ext::ExplicitActive); + } +} diff --git a/gtk2_ardour/vca_master_strip.h b/gtk2_ardour/vca_master_strip.h index 0c752cbeec..4734061987 100644 --- a/gtk2_ardour/vca_master_strip.h +++ b/gtk2_ardour/vca_master_strip.h @@ -70,6 +70,8 @@ class VCAMasterStrip : public AxisView, public Gtk::EventBox Gtk::MessageDialog* delete_dialog; ArdourButton vertical_button; + void spill (); + void spill_change (boost::shared_ptr); void hide_clicked(); bool width_button_pressed (GdkEventButton *); void set_selected (bool); -- cgit v1.2.3