fix visual focus indication in IOSelector; import pays attention to audio file embedd...
[ardour.git] / libs / ardour / ardour / playlist.h
index 4c2e75c6c9b271b9d1bf743e2737acfb10f8f899..7b9ae718bcb71b9ccee68011f420ce86a5f5ee2d 100644 (file)
 #include <ardour/ardour.h>
 #include <ardour/crossfade_compare.h>
 #include <ardour/location.h>
-#include <ardour/state_manager.h>
 
 namespace ARDOUR  {
 
 class Session;
 class Region;
 
-class Playlist : public StateManager, public PBD::StatefulDestructible {
+class Playlist : public PBD::StatefulDestructible {
   public:
        typedef list<boost::shared_ptr<Region> >    RegionList;
 
@@ -56,22 +55,22 @@ class Playlist : public StateManager, public PBD::StatefulDestructible {
        Playlist (const Playlist&, string name, bool hidden = false);
        Playlist (const Playlist&, nframes_t start, nframes_t cnt, string name, bool hidden = false);
 
-       virtual void clear (bool with_save = true);
+       virtual void clear (bool with_signals=true);
        virtual void dump () const;
-       virtual UndoAction get_memento() const = 0;
 
        void ref();
        void unref();
        uint32_t refcnt() const { return _refcnt; }
 
-       const string& name() const { return _name; }
-       void set_name (const string& str);
+       std::string name() const { return _name; }
+       void set_name (std::string str);
 
        bool frozen() const { return _frozen; }
        void set_frozen (bool yn);
 
        bool hidden() const { return _hidden; }
        bool empty() const;
+       uint32_t n_regions() const;
        nframes_t get_maximum_extent () const;
        layer_t top_layer() const;
 
@@ -80,7 +79,7 @@ class Playlist : public StateManager, public PBD::StatefulDestructible {
 
        /* Editing operations */
 
-       void add_region (boost::shared_ptr<Region>, nframes_t position, float times = 1, bool with_save = true);
+       void add_region (boost::shared_ptr<Region>, nframes_t position, float times = 1);
        void remove_region (boost::shared_ptr<Region>);
        void get_equivalent_regions (boost::shared_ptr<Region>, std::vector<boost::shared_ptr<Region> >&);
        void get_region_list_equivalent_regions (boost::shared_ptr<Region>, std::vector<boost::shared_ptr<Region> >&);
@@ -90,19 +89,15 @@ class Playlist : public StateManager, public PBD::StatefulDestructible {
        void duplicate (boost::shared_ptr<Region>, nframes_t position, float times);
        void nudge_after (nframes_t start, nframes_t distance, bool forwards);
 
-       boost::shared_ptr<Region> find_region (const PBD::ID&) const;
-
        Playlist* cut  (list<AudioRange>&, bool result_is_hidden = true);
        Playlist* copy (list<AudioRange>&, bool result_is_hidden = true);
        int       paste (Playlist&, nframes_t position, float times);
 
-       uint32_t read_data_count() { return _read_data_count; }
-
-       RegionList* regions_at (nframes_t frame);
-       RegionList* regions_touched (nframes_t start, nframes_t end);
+       RegionList*                regions_at (nframes_t frame);
+       RegionList*                regions_touched (nframes_t start, nframes_t end);
+       boost::shared_ptr<Region>  find_region (const PBD::ID&) const;
        boost::shared_ptr<Region>  top_region_at (nframes_t frame);
-
-       boost::shared_ptr<Region>     find_next_region (nframes_t frame, RegionPoint point, int dir);
+       boost::shared_ptr<Region>  find_next_region (nframes_t frame, RegionPoint point, int dir);
 
        template<class T> void foreach_region (T *t, void (T::*func)(boost::shared_ptr<Region>, void *), void *arg);
        template<class T> void foreach_region (T *t, void (T::*func)(boost::shared_ptr<Region>));
@@ -111,8 +106,6 @@ class Playlist : public StateManager, public PBD::StatefulDestructible {
        int set_state (const XMLNode&);
        XMLNode& get_template ();
 
-       sigc::signal<void,boost::shared_ptr<Region> > RegionAdded;
-       sigc::signal<void,boost::shared_ptr<Region> > RegionRemoved;
        sigc::signal<void,Playlist*,bool> InUse;
        sigc::signal<void>                Modified;
        sigc::signal<void>                NameChanged;
@@ -169,19 +162,20 @@ class Playlist : public StateManager, public PBD::StatefulDestructible {
        friend class RegionLock;
 
        RegionList       regions;  /* the current list of regions in the playlist */
+       std::set<boost::shared_ptr<Region> > all_regions; /* all regions ever added to this playlist */
        string          _name;
        Session&        _session;
        mutable gint    block_notifications;
        mutable gint    ignore_state_changes;
        mutable Glib::Mutex region_lock;
-       RegionList       pending_removals;
-       RegionList       pending_adds;
+       std::set<boost::shared_ptr<Region> > pending_adds;
+       std::set<boost::shared_ptr<Region> > pending_removes;
        RegionList       pending_bounds;
        bool             pending_modified;
        bool             pending_length;
        bool             save_on_thaw;
        string           last_save_reason;
-       bool             in_set_state;
+       uint32_t         in_set_state;
        bool            _hidden;
        bool            _splicing;
        bool            _nudging;
@@ -244,10 +238,7 @@ class Playlist : public StateManager, public PBD::StatefulDestructible {
 
        virtual XMLNode& state (bool);
 
-       /* override state_manager::save_state so we can check in_set_state() */
-
-       void save_state (std::string why);
-       void maybe_save_state (std::string why);
+       boost::shared_ptr<Region> region_by_id (PBD::ID);
 
        void add_region_internal (boost::shared_ptr<Region>, nframes_t position, bool delay_sort = false);