summaryrefslogtreecommitdiff
path: root/libs/pbd/pbd
diff options
context:
space:
mode:
Diffstat (limited to 'libs/pbd/pbd')
-rw-r--r--libs/pbd/pbd/id.h1
-rw-r--r--libs/pbd/pbd/memento_command.h21
-rw-r--r--libs/pbd/pbd/undo.h2
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;