add method (taken from GTK GUI) to goto_nth_marker() to BasicUI
authorPaul Davis <paul@linuxaudiosystems.com>
Fri, 17 Jun 2016 05:55:36 +0000 (01:55 -0400)
committerPaul Davis <paul@linuxaudiosystems.com>
Tue, 27 Sep 2016 19:59:29 +0000 (14:59 -0500)
libs/surfaces/control_protocol/basic_ui.cc
libs/surfaces/control_protocol/control_protocol/basic_ui.h

index aa13060b35eaa861096e40d0e6b1407ba95fbf20..dd18702d4c4d3110c479cb60f6a901fd63bca445 100644 (file)
@@ -539,6 +539,37 @@ BasicUI::cancel_all_solo ()
        }
 }
 
+struct SortLocationsByPosition {
+    bool operator() (Location* a, Location* b) {
+           return a->start() < b->start();
+    }
+};
+
+void
+BasicUI::goto_nth_marker (int n)
+{
+       if (!session) {
+               return;
+       }
+
+       const Locations::LocationList& l (session->locations()->list());
+       Locations::LocationList ordered;
+       ordered = l;
+
+       SortLocationsByPosition cmp;
+       ordered.sort (cmp);
+
+       for (Locations::LocationList::iterator i = ordered.begin(); n >= 0 && i != ordered.end(); ++i) {
+               if ((*i)->is_mark() && !(*i)->is_hidden() && !(*i)->is_session_range()) {
+                       if (n == 0) {
+                               session->request_locate ((*i)->start(), session->transport_rolling());
+                               break;
+                       }
+                       --n;
+               }
+       }
+}
+
 #if 0
 this stuff is waiting to go in so that all UIs can offer complex solo/mute functionality
 
index a09c28e6275b8c18e6124ef2c1c8c72feb7c920b..069a40c119261482f7659bf66729685cf0731815 100644 (file)
@@ -140,6 +140,8 @@ class LIBCONTROLCP_API BasicUI {
        void all_tracks_rec_in ();
        void all_tracks_rec_out ();
 
+       void goto_nth_marker (int n);
+
        ARDOUR::framecnt_t timecode_frames_per_hour ();
 
        void timecode_time (framepos_t where, Timecode::Time&);