Tidy.
[ardour.git] / libs / ardour / ardour / region.h
index fb1220e99649cca58ec38d7833059cda3f53f9ee..a84057a909d62790dc48de99f0b83fb04291e2ba 100644 (file)
@@ -30,6 +30,7 @@
 #include <ardour/data_type.h>
 #include <ardour/automatable.h>
 #include <ardour/readable.h>
+#include <ardour/session_object.h>
 
 class XMLNode;
 
@@ -45,7 +46,10 @@ enum RegionEditState {
        EditChangesID      = 2
 };
 
-class Region : public Automatable, public boost::enable_shared_from_this<Region>, public Readable
+class Region
+               : public SessionObject
+               , public boost::enable_shared_from_this<Region>
+               , public Readable
 {
   public:
        typedef std::vector<boost::shared_ptr<Source> > SourceList;
@@ -90,6 +94,7 @@ class Region : public Automatable, public boost::enable_shared_from_this<Region>
        static Change HiddenChanged;
 
        sigc::signal<void,Change> StateChanged;
+       static sigc::signal<void,boost::shared_ptr<ARDOUR::Region> > RegionPropertyChanged;
 
        virtual ~Region();
 
@@ -98,6 +103,16 @@ class Region : public Automatable, public boost::enable_shared_from_this<Region>
 
        const DataType& data_type() const { return _type; }
 
+       /**
+        * Thats how the region parameters play together:
+        * <PRE>
+        * |------------------------------------------------------------------- track
+        *                    |..........[------------------].....| region
+        * |-----------------------------| _position
+        *                               |------------------| _length
+        *                    |----------| _start
+        * </PRE>
+        */
        nframes_t position () const { return _position; }
        nframes_t start ()    const { return _start; }
        nframes_t length()    const { return _length; }
@@ -117,8 +132,9 @@ class Region : public Automatable, public boost::enable_shared_from_this<Region>
 
        nframes_t sync_offset(int& dir) const;
        nframes_t sync_position() const;
+       nframes_t sync_point () const;
 
-       nframes_t adjust_to_sync (nframes_t);
+       nframes_t adjust_to_sync (nframes_t) const;
        
        /* first_frame() is an alias; last_frame() just hides some math */
 
@@ -207,7 +223,15 @@ class Region : public Automatable, public boost::enable_shared_from_this<Region>
        const SourceList& master_sources() const { return _master_sources; }
 
        std::vector<string> master_source_names();
-       void set_master_sources (SourceList&);
+       void set_master_sources (const SourceList&);
+       
+       /* automation */
+       
+       virtual boost::shared_ptr<Evoral::Control>
+       control(const Evoral::Parameter& id, bool create=false) = 0;
+
+       virtual boost::shared_ptr<const Evoral::Control>
+       control(const Evoral::Parameter& id) const = 0;
        
        /* serialization */
        
@@ -242,6 +266,7 @@ class Region : public Automatable, public boost::enable_shared_from_this<Region>
                const string& name, DataType type, layer_t = 0, Flag flags = DefaultFlags);
        
        Region (boost::shared_ptr<const Region>, nframes_t start, nframes_t length, const string& name, layer_t = 0, Flag flags = DefaultFlags);
+       Region (boost::shared_ptr<const Region>, nframes_t length, const string& name, layer_t = 0, Flag flags = DefaultFlags);
        Region (boost::shared_ptr<const Region>);
        Region (boost::shared_ptr<Source> src, const XMLNode&);
        Region (const SourceList& srcs, const XMLNode&);
@@ -249,6 +274,8 @@ class Region : public Automatable, public boost::enable_shared_from_this<Region>
        Region (Session& s, nframes_t start, nframes_t length, const string& name, DataType, layer_t = 0, Flag flags = DefaultFlags);
 
   protected:
+       void copy_stuff (boost::shared_ptr<const Region>, nframes_t start, nframes_t length, const string& name, layer_t, Flag flags);
+
        XMLNode& get_short_state (); /* used only by Session */
 
        void send_change (Change);