*** NEW CODING POLICY ***
[ardour.git] / libs / ardour / location.cc
index 0da75810ca4fd4c1661f89b031b2ea9c59fd7d98..ca0a56972ecc8484ea77461016eb49fc5fe03bdf 100644 (file)
 #include <ctime>
 #include <sigc++/bind.h>
 
-#include <pbd/stl_delete.h>
-#include <pbd/xml++.h>
-#include <pbd/enumwriter.h>
+#include "pbd/stl_delete.h"
+#include "pbd/xml++.h"
+#include "pbd/enumwriter.h"
 
-#include <ardour/location.h>
-#include <ardour/session.h>
-#include <ardour/audiofilesource.h>
+#include "ardour/location.h"
+#include "ardour/session.h"
+#include "ardour/audiofilesource.h"
 
 #include "i18n.h"
 
@@ -100,6 +100,7 @@ Location::set_start (nframes_t s)
                        _end = s;
 
                        start_changed(this); /* EMIT SIGNAL */
+                       end_changed(this); /* EMIT SIGNAL */
 
                        if ( is_start() ) {
 
@@ -137,7 +138,17 @@ Location::set_end (nframes_t e)
                if (_start != e) {
                        _start = e;
                        _end = e;
+                       start_changed(this); /* EMIT SIGNAL */
                        end_changed(this); /* EMIT SIGNAL */
+
+                       if ( is_start() ) {
+                               Session::StartTimeChanged (); /* EMIT SIGNAL */
+                       }
+
+                       if ( is_end() ) {
+                               Session::EndTimeChanged (); /* EMIT SIGNAL */
+                       }
+
                }
                return 0;
        }
@@ -235,6 +246,14 @@ Location::set_is_start (bool yn, void *src)
        }
 }
 
+void
+Location::set_is_range_marker (bool yn, void *src)
+{
+       if (set_flag_internal (yn, IsRangeMarker)) {
+                FlagsChanged (this, src); /* EMIT SIGNAL */
+       }
+}
+
 void
 Location::set_auto_punch (bool yn, void *src) 
 {
@@ -913,3 +932,16 @@ Locations::get_location_by_id(PBD::ID id)
 
     return 0;
 }
+
+void
+Locations::find_all_between (nframes64_t start, nframes64_t end, LocationList& ll, Location::Flags flags)
+{
+       Glib::Mutex::Lock lm (lock);
+
+       for (LocationList::const_iterator i = locations.begin(); i != locations.end(); ++i) {
+               if ((flags == 0 || (*i)->matches (flags)) && 
+                   ((*i)->start() >= start && (*i)->end() < end)) {
+                       ll.push_back (*i);
+               }
+       }
+}