#include "pbd/undo.h"
#include "pbd/stateful.h"
+#include "pbd/stateful_owner.h"
#include "pbd/statefuldestructible.h"
+#include "pbd/sequence_property.h"
#include "evoral/types.hpp"
class Session;
class Region;
+class Playlist;
+
+namespace Properties {
+ /* fake the type, since regions are handled by SequenceProperty which doesn't
+ care about such things.
+ */
+ extern PBD::PropertyDescriptor<bool> regions;
+}
+
+class RegionListProperty : public PBD::SequenceProperty<std::list<boost::shared_ptr<Region > > >
+{
+ public:
+ RegionListProperty (Playlist&);
+
+ boost::shared_ptr<Region> lookup_id (const PBD::ID& id);
+ void diff (PBD::PropertyList& undo, PBD::PropertyList& redo) const;
+
+ private:
+ friend class Playlist;
+ std::list<boost::shared_ptr<Region> > rlist() { return _val; }
+
+ /* we live and die with our playlist, no lifetime management needed */
+ Playlist& _playlist;
+
+ /* create a copy of this RegionListProperty that only
+ has what is needed for use in a history list command. This
+ means that it won't contain the actual region list but
+ will have the added/removed list.
+ */
+ RegionListProperty* copy_for_history () const;
+};
class Playlist : public SessionObject
+ , public PBD::StatefulOwner
, public boost::enable_shared_from_this<Playlist> {
public:
typedef std::list<boost::shared_ptr<Region> > RegionList;
+ static void make_property_quarks ();
Playlist (Session&, const XMLNode&, DataType type, bool hidden = false);
Playlist (Session&, std::string name, DataType type, bool hidden = false);
virtual ~Playlist ();
+ bool set_property (const PBD::PropertyBase&);
+ void update (const RegionListProperty::ChangeRecord&);
+ void clear_owned_history ();
+ void rdiff (std::vector<PBD::StatefulDiffCommand*>&) const;
+
+ PBD::PropertyList* property_factory (const XMLNode&) const;
+
+ boost::shared_ptr<Region> region_by_id (const PBD::ID&);
+
void set_region_ownership ();
virtual void clear (bool with_signals=true);
bool used () const { return _refcnt != 0; }
bool set_name (const std::string& str);
+ int sort_id() { return _sort_id; }
const DataType& data_type() const { return _type; }
boost::shared_ptr<Playlist> copy (std::list<AudioRange>&, bool result_is_hidden = true);
int paste (boost::shared_ptr<Playlist>, framepos_t position, float times);
- const RegionList& region_list () const { return regions; }
+ const RegionListProperty& region_list () const { return regions; }
RegionList* regions_at (framepos_t frame);
RegionList* regions_touched (framepos_t start, framepos_t end);
uint32_t read_data_count() const { return _read_data_count; }
+ /* XXX: use of diskstream here is a little unfortunate */
const PBD::ID& get_orig_diskstream_id () const { return _orig_diskstream_id; }
void set_orig_diskstream_id (const PBD::ID& did) { _orig_diskstream_id = did; }
friend class RegionLock;
- RegionList regions; /* the current list of regions in the playlist */
+ RegionListProperty regions; /* the current list of regions in the playlist */
std::set<boost::shared_ptr<Region> > all_regions; /* all regions ever added to this playlist */
PBD::ScopedConnectionList region_state_changed_connections;
DataType _type;
+ int _sort_id;
mutable gint block_notifications;
mutable gint ignore_state_changes;
mutable Glib::RecMutex region_lock;
bool save_on_thaw;
std::string last_save_reason;
uint32_t in_set_state;
+ bool in_update;
bool first_set_state;
bool _hidden;
bool _splicing;
virtual void flush_notifications ();
void clear_pending ();
+ void _set_sort_id ();
+
void notify_region_removed (boost::shared_ptr<Region>);
void notify_region_added (boost::shared_ptr<Region>);
void notify_length_changed ();
virtual XMLNode& state (bool);
- boost::shared_ptr<Region> region_by_id (PBD::ID);
-
bool add_region_internal (boost::shared_ptr<Region>, framepos_t position);
int remove_region_internal (boost::shared_ptr<Region>);