pull from trunk
[ardour.git] / libs / ardour / ardour / location.h
index 1da67c78da587406a2fded4609e573cd1509ec9b..30c02a80a1eaa0802f7937f9a9af1e0c89cf7083 100644 (file)
 #include <map>
 
 #include <sys/types.h>
-#include <pthread.h>
 #include <sigc++/signal.h>
 
-#include <pbd/lockmonitor.h>
+#include <glibmm/thread.h>
+
 #include <pbd/undo.h>
+#include <pbd/stateful.h> 
 
-#include "ardour.h"
-#include "stateful.h"
-#include "state_manager.h"
+#include <ardour/ardour.h>
+#include <ardour/state_manager.h>
 
 using std::string;
 
@@ -50,7 +50,9 @@ class Location : public Stateful, public sigc::trackable
                IsAutoLoop = 0x4,
                IsHidden = 0x8,
                IsCDMarker = 0x10,
-               IsEnd = 0x20
+               IsEnd = 0x20,
+               IsRangeMarker = 0x40,
+               IsStart = 0x80
        };
 
        Location (jack_nframes_t sample_start,
@@ -88,6 +90,7 @@ class Location : public Stateful, public sigc::trackable
        void set_hidden (bool yn, void *src);
        void set_cd (bool yn, void *src);
        void set_is_end (bool yn, void* src);
+       void set_is_start (bool yn, void* src);
 
        bool is_auto_punch ()  { return _flags & IsAutoPunch; }
        bool is_auto_loop () { return _flags & IsAutoLoop; }
@@ -95,6 +98,8 @@ class Location : public Stateful, public sigc::trackable
        bool is_hidden () { return _flags & IsHidden; }
        bool is_cd_marker () { return _flags & IsCDMarker; }
        bool is_end() { return _flags & IsEnd; }
+       bool is_start() { return _flags & IsStart; }
+       bool is_range_marker() { return _flags & IsRangeMarker; }
 
        sigc::signal<void,Location*> name_changed;
        sigc::signal<void,Location*> end_changed;
@@ -144,6 +149,9 @@ class Locations : public Stateful, public StateManager
        Location* auto_loop_location () const;
        Location* auto_punch_location () const;
        Location* end_location() const;
+       Location* start_location() const;
+
+       uint32_t num_range_markers() const;
 
        int set_current (Location *, bool want_lock = true);
        Location *current () const { return current_location; }
@@ -151,18 +159,21 @@ class Locations : public Stateful, public StateManager
        Location *first_location_before (jack_nframes_t);
        Location *first_location_after (jack_nframes_t);
 
+       jack_nframes_t first_mark_before (jack_nframes_t);
+       jack_nframes_t first_mark_after (jack_nframes_t);
+
        sigc::signal<void,Location*> current_changed;
        sigc::signal<void>           changed;
        sigc::signal<void,Location*> added;
        sigc::signal<void,Location*> removed;
 
        template<class T> void apply (T& obj, void (T::*method)(LocationList&)) {
-               LockMonitor lm (lock, __LINE__, __FILE__);
+               Glib::Mutex::Lock lm (lock);
                (obj.*method)(locations);
        }
 
        template<class T1, class T2> void apply (T1& obj, void (T1::*method)(LocationList&, T2& arg), T2& arg) {
-               LockMonitor lm (lock, __LINE__, __FILE__);
+               Glib::Mutex::Lock lm (lock);
                (obj.*method)(locations, arg);
        }
 
@@ -179,7 +190,7 @@ class Locations : public Stateful, public StateManager
 
        LocationList       locations;
        Location          *current_location;
-       PBD::Lock          lock;
+       mutable Glib::Mutex  lock;
 
        int set_current_unlocked (Location *);
        void location_changed (Location*);
@@ -188,6 +199,6 @@ class Locations : public Stateful, public StateManager
        StateManager::State* state_factory (std::string why) const;
 };
 
-}; /* namespace ARDOUR */
+} // namespace ARDOUR
 
 #endif /* __ardour_location_h__ */