summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2016-02-29 14:45:03 -0500
committerPaul Davis <paul@linuxaudiosystems.com>2016-05-31 15:30:38 -0400
commit33e56e58d7b60232d7024368aed4026a6f07a7d1 (patch)
tree3f50b5e6904388ce5233347b65016ceb91a7451c /gtk2_ardour
parentf44cac5cc60c0ad93da3a44db2517f09cc82f345 (diff)
initial part of vca assignment via context menu
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/add_route_dialog.cc3
-rw-r--r--gtk2_ardour/ardour_ui.cc6
-rw-r--r--gtk2_ardour/ardour_ui.h2
-rw-r--r--gtk2_ardour/mixer_strip.cc56
-rw-r--r--gtk2_ardour/mixer_strip.h3
-rw-r--r--gtk2_ardour/mixer_ui.cc4
-rw-r--r--gtk2_ardour/vca_master_strip.cc8
-rw-r--r--gtk2_ardour/vca_master_strip.h3
8 files changed, 71 insertions, 14 deletions
diff --git a/gtk2_ardour/add_route_dialog.cc b/gtk2_ardour/add_route_dialog.cc
index 79414f7cd0..2b840ffd3a 100644
--- a/gtk2_ardour/add_route_dialog.cc
+++ b/gtk2_ardour/add_route_dialog.cc
@@ -35,6 +35,7 @@
#include "ardour/template_utils.h"
#include "ardour/route_group.h"
#include "ardour/session.h"
+#include "ardour/vca.h"
#include "utils.h"
#include "add_route_dialog.h"
@@ -264,7 +265,7 @@ AddRouteDialog::maybe_update_name_template_entry ()
name_template_entry.set_text (_("Bus"));
break;
case VCAMaster:
- name_template_entry.set_text (_("VCA"));
+ name_template_entry.set_text (VCA::default_name_template());
break;
}
}
diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc
index 2b37ad8c3d..1a5e131d3c 100644
--- a/gtk2_ardour/ardour_ui.cc
+++ b/gtk2_ardour/ardour_ui.cc
@@ -1798,13 +1798,13 @@ ARDOUR_UI::open_session ()
}
void
-ARDOUR_UI::session_add_vca (const string& name_template)
+ARDOUR_UI::session_add_vca (const string& name_template, uint32_t n)
{
if (!_session) {
return;
}
- _session->vca_manager().create_vca (name_template);
+ _session->vca_manager().create_vca (n, name_template);
}
void
@@ -4046,7 +4046,7 @@ ARDOUR_UI::add_route ()
session_add_midi_bus (route_group, count, name_template, strict_io, instrument, 0);
break;
case AddRouteDialog::VCAMaster:
- session_add_vca (name_template);
+ session_add_vca (name_template, count);
break;
}
}
diff --git a/gtk2_ardour/ardour_ui.h b/gtk2_ardour/ardour_ui.h
index cf6b400738..4227c5fb28 100644
--- a/gtk2_ardour/ardour_ui.h
+++ b/gtk2_ardour/ardour_ui.h
@@ -271,7 +271,7 @@ public:
void flush_videotimeline_cache (bool localcacheonly=false);
void export_video (bool range = false);
- void session_add_vca (std::string const &);
+ void session_add_vca (std::string const &, uint32_t);
void session_add_audio_track (
int input_channels,
diff --git a/gtk2_ardour/mixer_strip.cc b/gtk2_ardour/mixer_strip.cc
index c65a10b644..591b4f4250 100644
--- a/gtk2_ardour/mixer_strip.cc
+++ b/gtk2_ardour/mixer_strip.cc
@@ -52,6 +52,8 @@
#include "ardour/session.h"
#include "ardour/types.h"
#include "ardour/user_bundle.h"
+#include "ardour/vca.h"
+#include "ardour/vca_manager.h"
#include "ardour_window.h"
#include "mixer_strip.h"
@@ -217,9 +219,14 @@ MixerStrip::init ()
for (uint32_t n = 0; n < n_vca_buttons; ++n) {
ArdourButton* v = manage (new ArdourButton (ArdourButton::default_elements));
vca_buttons.push_back (v); /* no ownership transfer, button is managed by its container */
- vca_table.attach (*v, n, n+1, 0, 1);
+ v->set_no_show_all (true);
+ v->set_name (X_("vca assign"));
+ v->add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK);
+ v->signal_button_release_event().connect (sigc::bind (sigc::mem_fun (*this, &MixerStrip::vca_button_release), n), false);
+ UI::instance()->set_tip (*v, string_compose (_("VCA %1 assign"), n));
+ v->set_text (_("v."));
v->show ();
- v->set_text ("a");
+ vca_table.attach (*v, n, n+1, 0, 1);
}
vca_table.show ();
@@ -2483,3 +2490,48 @@ MixerStrip::set_meter_type (MeterType t)
if (_suspend_menu_callbacks) return;
gpm.set_type (t);
}
+
+void
+MixerStrip::vca_menu_toggle (uint32_t n)
+{
+ if (!_route) {
+ return;
+ }
+
+ boost::shared_ptr<VCA> vca = _session->vca_manager().vca_by_number (n);
+
+ if (!vca) {
+ return;
+ }
+
+ vca->add (_route);
+}
+
+bool
+MixerStrip::vca_button_release (GdkEventButton* ev, uint32_t which)
+{
+ using namespace Gtk::Menu_Helpers;
+
+ if (!_session || !Keyboard::is_context_menu_event (ev)) {
+ return false;
+ }
+
+ VCAManager::VCAS vcas (_session->vca_manager().vcas());
+
+ if (vcas.empty()) {
+ /* XXX should probably show a message saying "No VCA masters" */
+ return true;
+ }
+
+ Menu* menu = new Menu;
+ MenuList& items = menu->items();
+ RadioMenuItem::Group group;
+
+ for (VCAManager::VCAS::iterator v = vcas.begin(); v != vcas.end(); ++v) {
+ items.push_back (RadioMenuElem (group, (*v)->name(), sigc::bind (sigc::mem_fun (*this, &MixerStrip::vca_menu_toggle), (*v)->number())));
+ }
+
+ menu->popup (1, ev->time);
+
+ return true;
+}
diff --git a/gtk2_ardour/mixer_strip.h b/gtk2_ardour/mixer_strip.h
index df3b78dcd3..1fbdb04120 100644
--- a/gtk2_ardour/mixer_strip.h
+++ b/gtk2_ardour/mixer_strip.h
@@ -319,6 +319,9 @@ class MixerStrip : public RouteUI, public Gtk::EventBox
PBD::ScopedConnection _level_meter_connection;
std::string meter_point_string (ARDOUR::MeterPoint);
+
+ void vca_menu_toggle (uint32_t n);
+ bool vca_button_release (GdkEventButton* ev, uint32_t which);
};
#endif /* __ardour_mixer_strip__ */
diff --git a/gtk2_ardour/mixer_ui.cc b/gtk2_ardour/mixer_ui.cc
index 5e45b9338c..3efb1ce0f1 100644
--- a/gtk2_ardour/mixer_ui.cc
+++ b/gtk2_ardour/mixer_ui.cc
@@ -368,7 +368,7 @@ Mixer_UI::show_window ()
void
Mixer_UI::add_masters (VCAList& vcas)
{
- cerr << "VCA added\n";
+ cerr << vcas.size() << " VCAs added\n";
for (VCAList::iterator v = vcas.begin(); v != vcas.end(); ++v) {
@@ -1192,7 +1192,7 @@ Mixer_UI::redisplay_track_list ()
if (vms) {
vca_packer.pack_start (*vms, false, false);
vms->show ();
- cerr << "Packed vca into vca_packer\n";
+ cerr << "Packed vca " << vms->vca()->number() << " into vca_packer\n";
continue;
}
diff --git a/gtk2_ardour/vca_master_strip.cc b/gtk2_ardour/vca_master_strip.cc
index 7761b6f973..038d995fb3 100644
--- a/gtk2_ardour/vca_master_strip.cc
+++ b/gtk2_ardour/vca_master_strip.cc
@@ -25,15 +25,15 @@ using std::string;
VCAMasterStrip::VCAMasterStrip (Session* s, boost::shared_ptr<VCA> v)
: AxisView (s)
- , vca (v)
+ , _vca (v)
, gain_meter (s, 250)
{
gain_meter.set_controls (boost::shared_ptr<Route>(),
boost::shared_ptr<PeakMeter>(),
boost::shared_ptr<Amp>(),
- vca->control());
+ _vca->control());
- name_button.set_text (vca->name());
+ name_button.set_text (_vca->name());
active_button.set_text ("active");
pack_start (active_button, false, false);
@@ -48,5 +48,5 @@ VCAMasterStrip::VCAMasterStrip (Session* s, boost::shared_ptr<VCA> v)
string
VCAMasterStrip::name() const
{
- return vca->name();
+ return _vca->name();
}
diff --git a/gtk2_ardour/vca_master_strip.h b/gtk2_ardour/vca_master_strip.h
index cef7290b9a..5043c6144e 100644
--- a/gtk2_ardour/vca_master_strip.h
+++ b/gtk2_ardour/vca_master_strip.h
@@ -39,9 +39,10 @@ class VCAMasterStrip : public AxisView, public Gtk::VBox
std::string name() const;
std::string state_id() const { return "VCAMasterStrip"; }
+ boost::shared_ptr<ARDOUR::VCA> vca() const { return _vca; }
private:
- boost::shared_ptr<ARDOUR::VCA> vca;
+ boost::shared_ptr<ARDOUR::VCA> _vca;
ArdourButton name_button;
ArdourButton active_button;
GainMeter gain_meter;