diff options
author | Hans Fugal <hans@fugal.net> | 2006-08-09 14:15:05 +0000 |
---|---|---|
committer | Hans Fugal <hans@fugal.net> | 2006-08-09 14:15:05 +0000 |
commit | c26215c1e59b6341da86f94f5b2b3ca950dd3889 (patch) | |
tree | aded41982da1aae24d553407595a3dc7482c3ac7 /libs/pbd/pbd | |
parent | 5fc16bf95f43c816cbabbc594f826d1d934adbd4 (diff) |
r283@gandalf: fugalh | 2006-08-09 08:13:37 -0600
Save state basics, including adding PBD::ID to the delinquents. Compiles but needs to be tested (because I can't get the whole thing to compile on OSX due to the Rect problem).
git-svn-id: svn://localhost/ardour2/branches/undo@769 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/pbd/pbd')
-rw-r--r-- | libs/pbd/pbd/id.h | 1 | ||||
-rw-r--r-- | libs/pbd/pbd/memento_command.h | 21 | ||||
-rw-r--r-- | libs/pbd/pbd/undo.h | 2 |
3 files changed, 13 insertions, 11 deletions
diff --git a/libs/pbd/pbd/id.h b/libs/pbd/pbd/id.h index 9a3f10478d..1ce448d58b 100644 --- a/libs/pbd/pbd/id.h +++ b/libs/pbd/pbd/id.h @@ -28,6 +28,7 @@ class ID { } void print (char* buf) const; + std::string to_s() const; static uint64_t counter() { return _counter; } static void init_counter (uint64_t val) { _counter = val; } diff --git a/libs/pbd/pbd/memento_command.h b/libs/pbd/pbd/memento_command.h index a86006a6ae..46c724e9ea 100644 --- a/libs/pbd/pbd/memento_command.h +++ b/libs/pbd/pbd/memento_command.h @@ -22,6 +22,7 @@ #define __lib_pbd_memento_command_h__ #include <pbd/command.h> +#include <pbd/xml++.h> #include <sigc++/slot.h> /** This command class is initialized with before and after mementos @@ -42,9 +43,9 @@ class MementoCommand : public Command virtual XMLNode &get_state() { XMLNode *node = new XMLNode("MementoCommand"); - // obj.id - // key is "MementoCommand" or something - // before and after mementos + node->add_property("obj_id", obj.id().to_s()); + node->add_child_nocopy(before); + node->add_child_nocopy(after); return *node; } // TODO does this need a copy constructor? @@ -64,10 +65,9 @@ public: void undo() { obj.set_state(before); } virtual XMLNode &get_state() { - XMLNode *node = new XMLNode("MementoUndoCommand"); // XXX - // obj.id - // key is "MementoCommand" or something - // before and after mementos + XMLNode *node = new XMLNode("MementoUndoCommand"); + node->add_property("obj_id", obj.id().to_s()); + node->add_child_nocopy(before); return *node; } protected: @@ -86,10 +86,9 @@ public: void undo() { /* noop */ } virtual XMLNode &get_state() { - XMLNode *node = new XMLNode("MementoUndoCommand"); - // obj.id - // key is "MementoCommand" or something - // before and after mementos + XMLNode *node = new XMLNode("MementoRedoCommand"); + node->add_property("obj_id", obj.id().to_s()); + node->add_child_nocopy(after); return *node; } protected: diff --git a/libs/pbd/pbd/undo.h b/libs/pbd/pbd/undo.h index 49ff19ccce..724e86aaa0 100644 --- a/libs/pbd/pbd/undo.h +++ b/libs/pbd/pbd/undo.h @@ -90,6 +90,8 @@ class UndoHistory void clear_undo (); void clear_redo (); + XMLNode &get_state(); + void save_state(); private: list<UndoTransaction> UndoList; list<UndoTransaction> RedoList; |