#include "pbd/undo.h"
#include "pbd/stateful.h"
-#include "pbd/stateful_owner.h"
#include "pbd/statefuldestructible.h"
#include "pbd/sequence_property.h"
class Session;
class Region;
class Playlist;
+class Crossfade;
namespace Properties {
/* fake the type, since regions are handled by SequenceProperty which doesn't
extern PBD::PropertyDescriptor<bool> regions;
}
-class RegionListProperty : public PBD::SequenceProperty<std::list<boost::shared_ptr<Region > > >
+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, Command*) const;
- bool involves (boost::shared_ptr<Region>);
+ RegionListProperty* clone () const;
+ void get_content_as_xml (boost::shared_ptr<Region>, XMLNode &) const;
+ boost::shared_ptr<Region> get_content_from_xml (XMLNode const &) const;
private:
- friend class Playlist;
- std::list<boost::shared_ptr<Region> > rlist() { return _val; }
+ RegionListProperty* create () const;
+
+ /* copy construction only by ourselves */
+ RegionListProperty (RegionListProperty const & p);
+ friend class Playlist;
/* 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;
+class Playlist : public SessionObject , 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);
virtual ~Playlist ();
- bool set_property (const PBD::PropertyBase&);
void update (const RegionListProperty::ChangeRecord&);
- void clear_owned_history ();
- void rdiff (std::vector<PBD::StatefulDiffCommand*>&) const;
+ void clear_owned_changes ();
+ void rdiff (std::vector<Command*>&) const;
- PBD::PropertyList* property_factory (const XMLNode&) const;
-
- boost::shared_ptr<Region> region_by_id (const PBD::ID&);
+ boost::shared_ptr<Region> region_by_id (const PBD::ID&) const;
void set_region_ownership ();
bool hidden() const { return _hidden; }
bool empty() const;
uint32_t n_regions() const;
- std::pair<framecnt_t, framecnt_t> get_extent () const;
+ std::pair<framepos_t, framepos_t> get_extent () const;
layer_t top_layer() const;
EditMode get_edit_mode() const { return _edit_mode; }
const RegionListProperty& region_list () const { return regions; }
RegionList* regions_at (framepos_t frame);
+ uint32_t count_regions_at (framepos_t);
RegionList* regions_touched (framepos_t start, framepos_t end);
RegionList* regions_to_read (framepos_t start, framepos_t end);
+ uint32_t region_use_count (boost::shared_ptr<Region>) const;
boost::shared_ptr<Region> find_region (const PBD::ID&) const;
boost::shared_ptr<Region> top_region_at (framepos_t frame);
boost::shared_ptr<Region> top_unmuted_region_at (framepos_t frame);
PBD::Signal0<void> NameChanged;
PBD::Signal0<void> LengthChanged;
PBD::Signal0<void> LayeringChanged;
- PBD::Signal1<void,std::list< Evoral::RangeMove<framepos_t> > const &> RangesMoved;
+
+ /** Emitted when regions have moved (not when regions have only been trimmed) */
+ PBD::Signal2<void,std::list< Evoral::RangeMove<framepos_t> > const &, bool> RangesMoved;
static std::string bump_name (std::string old_name, Session&);
void freeze ();
- void thaw ();
+ void thaw (bool from_undo = false);
void raise_region (boost::shared_ptr<Region>);
void lower_region (boost::shared_ptr<Region>);
void set_explicit_relayering (bool e);
+ virtual boost::shared_ptr<Crossfade> find_crossfade (const PBD::ID &) const {
+ return boost::shared_ptr<Crossfade> ();
+ }
+
+ framepos_t find_next_top_layer_position (framepos_t) const;
+
protected:
friend class Session;
bool pending_contents_change;
bool pending_layering;
bool pending_length;
+
+ /** Movements of time ranges caused by region moves; note that
+ * region trims are not included in this list; it is used to
+ * do automation-follows-regions.
+ */
std::list< Evoral::RangeMove<framepos_t> > pending_range_moves;
bool save_on_thaw;
std::string last_save_reason;
}
void delay_notifications ();
- void release_notifications ();
- virtual void flush_notifications ();
+ void release_notifications (bool from_undo = false);
+ virtual void flush_notifications (bool from_undo = false);
void clear_pending ();
void _set_sort_id ();
bool add_region_internal (boost::shared_ptr<Region>, framepos_t position);
int remove_region_internal (boost::shared_ptr<Region>);
- RegionList *find_regions_at (framepos_t frame);
+ RegionList *find_regions_at (framepos_t);
void copy_regions (RegionList&) const;
void partition_internal (framepos_t start, framepos_t end, bool cutting, RegionList& thawlist);
- std::pair<framecnt_t, framecnt_t> _get_extent() const;
+ std::pair<framepos_t, framepos_t> _get_extent() const;
boost::shared_ptr<Playlist> cut_copy (boost::shared_ptr<Playlist> (Playlist::*pmf)(framepos_t, framecnt_t, bool),
std::list<AudioRange>& ranges, bool result_is_hidden);