summaryrefslogtreecommitdiff
path: root/libs/ardour/location.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2006-05-31 02:46:04 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2006-05-31 02:46:04 +0000
commit415d3a5018738287c9175d84ce8346a7b47da4ff (patch)
tree6b4600a2045f493978a0409d68c6975f16ada401 /libs/ardour/location.cc
parent0354401e0016060701cf4869557cff3004511733 (diff)
unfinished work on selection/HiG details, restore range ops destroyed by autoscroll changes
git-svn-id: svn://localhost/trunk/ardour2@544 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/ardour/location.cc')
-rw-r--r--libs/ardour/location.cc74
1 files changed, 74 insertions, 0 deletions
diff --git a/libs/ardour/location.cc b/libs/ardour/location.cc
index 87a27e5c3d..7d479637e3 100644
--- a/libs/ardour/location.cc
+++ b/libs/ardour/location.cc
@@ -656,6 +656,80 @@ Locations::first_location_after (jack_nframes_t frame)
return 0;
}
+jack_nframes_t
+Locations::first_mark_before (jack_nframes_t frame)
+{
+ LocationList locs;
+
+ {
+ LockMonitor lm (lock, __LINE__, __FILE__);
+ locs = locations;
+ }
+
+ LocationStartLaterComparison cmp;
+ locs.sort (cmp);
+
+ /* locs is now sorted latest..earliest */
+
+ for (LocationList::iterator i = locs.begin(); i != locs.end(); ++i) {
+ if (!(*i)->is_hidden()) {
+ if ((*i)->is_mark()) {
+ /* MARK: start == end */
+ if ((*i)->start() < frame) {
+ return (*i)->start();
+ }
+ } else {
+ /* RANGE: start != end, compare start and end */
+ if ((*i)->end() < frame) {
+ return (*i)->end();
+ }
+ if ((*i)->start () < frame) {
+ return (*i)->start();
+ }
+ }
+ }
+ }
+
+ return 0;
+}
+
+jack_nframes_t
+Locations::first_mark_after (jack_nframes_t frame)
+{
+ LocationList locs;
+
+ {
+ LockMonitor lm (lock, __LINE__, __FILE__);
+ locs = locations;
+ }
+
+ LocationStartEarlierComparison cmp;
+ locs.sort (cmp);
+
+ /* locs is now sorted earliest..latest */
+
+ for (LocationList::iterator i = locs.begin(); i != locs.end(); ++i) {
+ if (!(*i)->is_hidden()) {
+ if ((*i)->is_mark()) {
+ /* MARK, start == end so just compare start */
+ if ((*i)->start() > frame) {
+ return (*i)->start();
+ }
+ } else {
+ /* RANGE, start != end, compare start and end */
+ if ((*i)->start() > frame ) {
+ return (*i)->start ();
+ }
+ if ((*i)->end() > frame) {
+ return (*i)->end ();
+ }
+ }
+ }
+ }
+
+ return max_frames;
+}
+
Location*
Locations::end_location () const
{