summaryrefslogtreecommitdiff
path: root/gtk2_ardour/foldback_strip.cc
diff options
context:
space:
mode:
authorLen Ovens <len@ovenwerks.net>2019-09-10 19:26:00 -0700
committerLen Ovens <len@ovenwerks.net>2019-09-10 19:26:41 -0700
commit3f6310ef9c8659fb62706a3e127aae4f5eeff090 (patch)
tree333442ba28f70cf964fae8386a21a4b546b0b421 /gtk2_ardour/foldback_strip.cc
parent8a313daa130f0eaed3c22e440e98baa3c9cf26a8 (diff)
Foldback GUI: sort send controls by mixer order
also found send button name did not follow sending route name after change and tool tip was wrong. Fixed both.
Diffstat (limited to 'gtk2_ardour/foldback_strip.cc')
-rw-r--r--gtk2_ardour/foldback_strip.cc67
1 files changed, 47 insertions, 20 deletions
diff --git a/gtk2_ardour/foldback_strip.cc b/gtk2_ardour/foldback_strip.cc
index 12a8f9f833..17f271f1f1 100644
--- a/gtk2_ardour/foldback_strip.cc
+++ b/gtk2_ardour/foldback_strip.cc
@@ -82,8 +82,7 @@ FoldbackSend::FoldbackSend (boost::shared_ptr<Send> snd, \
_button.signal_led_clicked.connect (sigc::mem_fun (*this, &FoldbackSend::led_clicked));
_button.set_name ("processor prefader");
_button.set_layout_ellipsize_width (Wide * PANGO_SCALE);
- string s_name = PBD::short_version (_send_route->name (), 8);
- _button.set_text (s_name);
+ name_changed ();
_button.set_text_ellipsize (Pango::ELLIPSIZE_END);
snd_but_pan->pack_start (_button, true, true);
_button.set_active (_send_proc->enabled ());
@@ -107,8 +106,6 @@ FoldbackSend::FoldbackSend (boost::shared_ptr<Send> snd, \
_slider.set_name ("ProcessorControlSlider");
_slider.set_text (_("Level"));
-
-
pack_start (*snd_but_pan, Gtk::PACK_SHRINK);
snd_but_pan->show();
pack_start (_slider, true, true);
@@ -119,6 +116,7 @@ FoldbackSend::FoldbackSend (boost::shared_ptr<Send> snd, \
lc->Changed.connect (_connections, invalidator (*this), boost::bind (&FoldbackSend::level_changed, this), gui_context ());
_send_proc->ActiveChanged.connect (_connections, invalidator (*this), boost::bind (&FoldbackSend::send_state_changed, this), gui_context ());
_button.signal_button_press_event().connect (sigc::mem_fun (*this, &FoldbackSend::button_press));
+ _send_route->PropertyChanged.connect (_connections, invalidator (*this), boost::bind (&FoldbackSend::route_property_changed, this, _1), gui_context());
show ();
@@ -139,6 +137,23 @@ FoldbackSend::~FoldbackSend ()
}
void
+FoldbackSend::route_property_changed (const PropertyChange& what_changed)
+{
+ if (what_changed.contains (ARDOUR::Properties::name)) {
+ name_changed ();
+ }
+}
+
+void
+FoldbackSend::name_changed ()
+{
+ string s_name = PBD::short_version (_send_route->name (), 8);
+ _button.set_text (s_name);
+
+ ArdourWidgets::set_tooltip (_button, Gtkmm2ext::markup_escape_text(_send_route->name()));
+}
+
+void
FoldbackSend::led_clicked(GdkEventButton *ev)
{
if (_send_proc) {
@@ -216,7 +231,6 @@ FoldbackSend::set_tooltip ()
std::string tt = ARDOUR::value_as_string (lc->desc(), lc->get_value ());
string sm = Gtkmm2ext::markup_escape_text (tt);
_slider_persistant_tooltip.set_tip (sm);
- ArdourWidgets::set_tooltip (_button, Gtkmm2ext::markup_escape_text (sm));
}
Menu*
@@ -586,6 +600,15 @@ FoldbackStrip::set_route (boost::shared_ptr<Route> rt)
show ();
}
+// predicate for sort call in get_sorted_stripables
+struct StripableByPresentationOrder
+{
+ bool operator () (const boost::shared_ptr<Stripable> & a, const boost::shared_ptr<Stripable> & b) const
+ {
+ return a->presentation_info().order() < b->presentation_info().order();
+ }
+};
+
void
FoldbackStrip::update_send_box ()
{
@@ -593,17 +616,28 @@ FoldbackStrip::update_send_box ()
if (!_route) {
return;
}
+ StripableList stripables;
+ stripables.clear ();
+
Route::FedBy fed_by = _route->fed_by();
for (Route::FedBy::iterator i = fed_by.begin(); i != fed_by.end(); ++i) {
if (i->sends_only) {
- boost::shared_ptr<Route> s_rt (i->r.lock());
- boost::shared_ptr<Send> snd = s_rt->internal_send_for (_route);
- if (snd) {
- FoldbackSend * fb_s = new FoldbackSend (snd, s_rt, _route);
- send_display.pack_start (*fb_s, Gtk::PACK_SHRINK);
- fb_s->show ();
- s_rt->processors_changed.connect (_connections, invalidator (*this), boost::bind (&FoldbackStrip::processors_changed, this, _1), gui_context ());
- }
+ boost::shared_ptr<Route> rt (i->r.lock());
+ boost::shared_ptr<Stripable> s = boost::dynamic_pointer_cast<Stripable> (rt);
+ stripables.push_back (s);
+ }
+ }
+ stripables.sort (StripableByPresentationOrder());
+ for (StripableList::iterator it = stripables.begin(); it != stripables.end(); ++it) {
+
+ boost::shared_ptr<Stripable> s_sp = *it;
+ boost::shared_ptr<Route> s_rt = boost::dynamic_pointer_cast<Route> (s_sp);
+ boost::shared_ptr<Send> snd = s_rt->internal_send_for (_route);
+ if (snd) {
+ FoldbackSend * fb_s = new FoldbackSend (snd, s_rt, _route);
+ send_display.pack_start (*fb_s, Gtk::PACK_SHRINK);
+ fb_s->show ();
+ s_rt->processors_changed.connect (_connections, invalidator (*this), boost::bind (&FoldbackStrip::processors_changed, this, _1), gui_context ());
}
}
}
@@ -632,13 +666,6 @@ FoldbackStrip::set_packed (bool yn)
_packed = yn;
}
-
-struct RouteCompareByName {
- bool operator() (boost::shared_ptr<Route> a, boost::shared_ptr<Route> b) {
- return a->name().compare (b->name()) < 0;
- }
-};
-
gint
FoldbackStrip::output_release (GdkEventButton *ev)
{