Merged with trunk R1612.
[ardour.git] / libs / ardour / ardour / automation_event.h
index 5864de73c668201a761dc9209afa62b5d1ac4815..007bad7259052240f5d8019962c5de64859bd776 100644 (file)
@@ -15,7 +15,6 @@
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
-    $Id$
 */
 
 #ifndef __ardour_automation_event_h__
 
 #include <sigc++/signal.h>
 #include <glibmm/thread.h>
+
 #include <pbd/undo.h>
 #include <pbd/xml++.h>
+#include <pbd/statefuldestructible.h> 
+
 #include <ardour/ardour.h>
-#include <ardour/state_manager.h>
 
 namespace ARDOUR {
        
@@ -51,14 +52,15 @@ struct ControlEvent {
 
 };
 
-class AutomationList : public StateManager, public Stateful
+class AutomationList : public PBD::StatefulDestructible
 {
   public:
        typedef std::list<ControlEvent*> AutomationEventList;
        typedef AutomationEventList::iterator iterator;
        typedef AutomationEventList::const_iterator const_iterator;
 
-       AutomationList(double default_value, bool no_state = false);
+       AutomationList (double default_value);
+       AutomationList (const XMLNode&);
        ~AutomationList();
 
        AutomationList (const AutomationList&);
@@ -79,11 +81,13 @@ class AutomationList : public StateManager, public Stateful
        void clear ();
        void x_scale (double factor);
        bool extend_to (double);
-
+       void slide (iterator before, double distance);
+       
        void reposition_for_rt_add (double when);
        void rt_add (double when, double value);
-       iterator add (double when, double value, iterator, bool ignore_mode = false);
-       void add (double when, double value, bool for_loading = false);
+       void add (double when, double value);
+       /* this should be private but old-school automation loading needs it in IO/Redirect */
+       void fast_simple_add (double when, double value);
 
        void reset_range (double start, double end);
        void erase_range (double start, double end);
@@ -148,15 +152,12 @@ class AutomationList : public StateManager, public Stateful
                (obj.*method)(*this);
        }
 
-       UndoAction get_memento () const;
-       
-       virtual void store_state (XMLNode& node) const;
-       virtual void load_state (const XMLNode&);
+       sigc::signal<void> StateChanged;
 
-       XMLNode &get_state(void); 
+       XMLNodeget_state(void); 
        int set_state (const XMLNode &s);
-
-        PBD::ID id() { return _id; }
+       XMLNode& state (bool full);
+       XMLNode& serialize_events ();
 
        void set_max_xval (double);
        double get_max_xval() const { return max_xval; }
@@ -183,17 +184,13 @@ class AutomationList : public StateManager, public Stateful
                }
        };
 
-  protected:
-        PBD::ID _id;
-       struct State : public ARDOUR::StateManager::State {
-           AutomationEventList events;
+        static sigc::signal<void, AutomationList*> AutomationListCreated;
 
-           State (std::string why) : ARDOUR::StateManager::State (why) {}
-       };
+  protected:
 
        AutomationEventList events;
        mutable Glib::Mutex lock;
-       bool   _frozen;
+       int8_t  _frozen;
        bool    changed_when_thawed;
        bool   _dirty;
 
@@ -212,7 +209,7 @@ class AutomationList : public StateManager, public Stateful
        double min_yval;
        double max_yval;
        double default_value;
-       bool   no_state;
+       bool   sort_pending;
 
        iterator rt_insertion_point;
        double   rt_pos;
@@ -239,14 +236,12 @@ class AutomationList : public StateManager, public Stateful
 
        virtual double unlocked_eval (double where);
 
-       Change   restore_state (StateManager::State&);
-       StateManager::State* state_factory (std::string why) const;
-
        virtual ControlEvent* point_factory (double,double) const;
        virtual ControlEvent* point_factory (const ControlEvent&) const;
 
-
        AutomationList* cut_copy_clear (double, double, int op);
+
+       int deserialize_events (const XMLNode&);
 };
 
 } // namespace