summaryrefslogtreecommitdiff
path: root/gtk2_ardour/foldback_strip.cc
diff options
context:
space:
mode:
authorLen Ovens <len@ovenwerks.net>2019-09-10 21:09:54 -0700
committerLen Ovens <len@ovenwerks.net>2019-09-10 21:09:54 -0700
commit2e857e9143e588ea629ea3a9f9e570d57825bbc1 (patch)
treeb052237c04a10c40e5ace50446630da05ad78cbb /gtk2_ardour/foldback_strip.cc
parent3f6310ef9c8659fb62706a3e127aae4f5eeff090 (diff)
Foldback gui: previous and next buttons don't wrap around
I had set the previous next buttons to wrap around but Robin felt dead ending was better. The previous button becomes insensitive when the first foldback bus is displayed and next is insensitive when the last is displayed.
Diffstat (limited to 'gtk2_ardour/foldback_strip.cc')
-rw-r--r--gtk2_ardour/foldback_strip.cc99
1 files changed, 60 insertions, 39 deletions
diff --git a/gtk2_ardour/foldback_strip.cc b/gtk2_ardour/foldback_strip.cc
index 17f271f1f1..3f39e32fd5 100644
--- a/gtk2_ardour/foldback_strip.cc
+++ b/gtk2_ardour/foldback_strip.cc
@@ -321,9 +321,12 @@ FoldbackStrip::init ()
_previous_button.set_name ("mixer strip button");
_previous_button.set_icon (ArdourIcon::NudgeLeft);
_previous_button.set_tweaks (ArdourButton::Square);
+ _previous_button.set_sensitive (false);
+
_next_button.set_name ("mixer strip button");
_next_button.set_icon (ArdourIcon::NudgeRight);
_next_button.set_tweaks (ArdourButton::Square);
+ _next_button.set_sensitive (false);
prev_next_box.pack_start (_previous_button, false, true);
prev_next_box.pack_end (_next_button, false, true);
@@ -576,7 +579,7 @@ FoldbackStrip::set_route (boost::shared_ptr<Route> rt)
update_output_display ();
add_events (Gdk::BUTTON_RELEASE_MASK);
-
+ prev_next_changed ();
_previous_button.show();
_next_button.show();
prev_next_box.show ();
@@ -1228,21 +1231,74 @@ FoldbackStrip::previous_button_button_press (GdkEventButton* ev)
}
}
} else {
- // only one route or none do nothing
+ // only one route do nothing
return true;
}
//use previous to set route
if (previous) {
set_route (previous);
- } else {
+ } /*else { no wrap around
set_route (last);
+ }*/
+ return true;
+ }
+
+ return false;
+}
+
+gboolean
+FoldbackStrip::next_button_button_press (GdkEventButton* ev)
+{
+ if (ev->button == 1 || ev->button == 3) {
+ bool past_current = false;
+ StripableList slist;
+ boost::shared_ptr<Route> next = boost::shared_ptr<Route> ();
+ boost::shared_ptr<Route> first = boost::shared_ptr<Route> ();
+ _session->get_stripables (slist, PresentationInfo::FoldbackBus);
+ if (slist.size () > 1) {
+ first = boost::dynamic_pointer_cast<Route> (*(slist.begin()));
+ for (StripableList::iterator s = slist.begin(); s != slist.end(); ++s) {
+ if (past_current) {
+ next = boost::dynamic_pointer_cast<Route> (*s);
+ break;
+ }
+ if ((*s) == _route) {
+ past_current = true;
+ }
+ }
+ } else {
+ // only one route do nothing
+ return true;
}
+ //use next to set route
+ if (next) {
+ set_route (next);
+ } /*else { no wrap around
+ set_route (first);
+ }*/
return true;
}
return false;
}
+void
+FoldbackStrip::prev_next_changed ()
+{
+ StripableList slist;
+ _session->get_stripables (slist, PresentationInfo::FoldbackBus);
+ if ((slist.size() < 2) || (boost::dynamic_pointer_cast<Stripable> (_route) == *(slist.begin()))) {
+ _previous_button.set_sensitive (false);
+ } else {
+ _previous_button.set_sensitive (true);
+ }
+ if ((slist.size () < 2) || boost::dynamic_pointer_cast<Stripable> (_route) == *(--slist.end())) {
+ _next_button.set_sensitive (false);
+ } else {
+ _next_button.set_sensitive (true);
+ }
+}
+
gboolean
FoldbackStrip::show_sends_press (GdkEventButton* ev)
{
@@ -1280,42 +1336,6 @@ FoldbackStrip::send_blink (bool onoff)
}
}
-gboolean
-FoldbackStrip::next_button_button_press (GdkEventButton* ev)
-{
- if (ev->button == 1 || ev->button == 3) {
- bool past_current = false;
- StripableList slist;
- boost::shared_ptr<Route> next = boost::shared_ptr<Route> ();
- boost::shared_ptr<Route> first = boost::shared_ptr<Route> ();
- _session->get_stripables (slist, PresentationInfo::FoldbackBus);
- if (slist.size () > 1) {
- first = boost::dynamic_pointer_cast<Route> (*(slist.begin()));
- for (StripableList::iterator s = slist.begin(); s != slist.end(); ++s) {
- if (past_current) {
- next = boost::dynamic_pointer_cast<Route> (*s);
- break;
- }
- if ((*s) == _route) {
- past_current = true;
- }
- }
- } else {
- // only one or no route do nothing
- return true;
- }
- //use next to set route
- if (next) {
- set_route (next);
- } else {
- set_route (first);
- }
- return true;
- }
-
- return false;
-}
-
void
FoldbackStrip::list_route_operations ()
{
@@ -1651,6 +1671,7 @@ FoldbackStrip::remove_current_fb ()
if (next) {
set_route (next);
_session->remove_route (old_route);
+ prev_next_changed ();
} else {
clear_send_box ();
RouteUI::self_delete ();