summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xgtk2_ardour/ardbg2
-rw-r--r--gtk2_ardour/automation_line.cc7
-rw-r--r--libs/ardour/ardour/session.h1
-rw-r--r--libs/ardour/session_command.cc21
-rw-r--r--libs/pbd/pbd/memento_command.h16
5 files changed, 38 insertions, 9 deletions
diff --git a/gtk2_ardour/ardbg b/gtk2_ardour/ardbg
index 267fdbae73..9d3f5bf6c7 100755
--- a/gtk2_ardour/ardbg
+++ b/gtk2_ardour/ardbg
@@ -1,3 +1,3 @@
#!/bin/sh
source ardev_common.sh
-exec gdb ./ardour.bin
+exec gdb ./ardour.bin "$*"
diff --git a/gtk2_ardour/automation_line.cc b/gtk2_ardour/automation_line.cc
index 5c09ddd49b..f3e30c4523 100644
--- a/gtk2_ardour/automation_line.cc
+++ b/gtk2_ardour/automation_line.cc
@@ -1270,13 +1270,14 @@ AutomationLine::hide_all_but_selected_control_points ()
XMLNode &AutomationLine::get_state(void)
{
- // TODO
- return alist.get_state();
+ XMLNode *node = new XMLNode("AutomationLine");
+ node->add_child_nocopy(alist.get_state());
+ return *node;
}
int AutomationLine::set_state(const XMLNode &node)
{
// TODO
- alist.set_state(node);
+ //alist.set_state(node);
return 0;
}
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h
index 69ba373456..632e85eade 100644
--- a/libs/ardour/ardour/session.h
+++ b/libs/ardour/ardour/session.h
@@ -839,6 +839,7 @@ class Session : public sigc::trackable, public Stateful
}
// these commands are implemented in libs/ardour/session_command.cc
+ Command *memento_command_factory(XMLNode *n);
class GlobalSoloStateCommand : public Command
{
GlobalRouteBooleanState before, after;
diff --git a/libs/ardour/session_command.cc b/libs/ardour/session_command.cc
index 9a43de55de..276b2c1822 100644
--- a/libs/ardour/session_command.cc
+++ b/libs/ardour/session_command.cc
@@ -1,7 +1,28 @@
#include <ardour/session.h>
#include <ardour/route.h>
+#include <pbd/memento_command.h>
+#include <ardour/diskstream.h>
namespace ARDOUR {
+
+Command *Session::memento_command_factory(XMLNode *n)
+{
+ PBD::ID id;
+ XMLNode *before, *after;
+ void *obj;
+
+ /* get obj_id */
+
+ /* get before and/or after */
+
+ /* get an object by id by trial and error, and use it to construct an
+ * appropriate memento command */
+ // e.g.
+ if (Diskstream *obj = diskstream_by_id(id))
+ return new MementoCommand<Diskstream>(*obj, *before, *after);
+ // etc.
+}
+
// solo
Session::GlobalSoloStateCommand::GlobalSoloStateCommand(Session &sess, void *src)
: sess(sess), src(src)
diff --git a/libs/pbd/pbd/memento_command.h b/libs/pbd/pbd/memento_command.h
index 46c724e9ea..122dcb4c86 100644
--- a/libs/pbd/pbd/memento_command.h
+++ b/libs/pbd/pbd/memento_command.h
@@ -24,6 +24,7 @@
#include <pbd/command.h>
#include <pbd/xml++.h>
#include <sigc++/slot.h>
+#include <typeinfo>
/** This command class is initialized with before and after mementos
* (from Stateful::get_state()), so undo becomes restoring the before
@@ -33,6 +34,7 @@ template <class obj_T>
class MementoCommand : public Command
{
public:
+ MementoCommand(XMLNode &state);
MementoCommand(obj_T &obj,
XMLNode &before,
XMLNode &after
@@ -44,11 +46,11 @@ class MementoCommand : public Command
{
XMLNode *node = new XMLNode("MementoCommand");
node->add_property("obj_id", obj.id().to_s());
- node->add_child_nocopy(before);
- node->add_child_nocopy(after);
+ node->add_property("type_name", typeid(obj).name());
+ node->add_child_copy(before);
+ node->add_child_copy(after);
return *node;
}
- // TODO does this need a copy constructor?
protected:
obj_T &obj;
XMLNode &before, &after;
@@ -58,6 +60,7 @@ template <class obj_T>
class MementoUndoCommand : public Command
{
public:
+ MementoUndoCommand(XMLNode &state);
MementoUndoCommand(obj_T &obj,
XMLNode &before)
: obj(obj), before(before) {}
@@ -67,7 +70,8 @@ public:
{
XMLNode *node = new XMLNode("MementoUndoCommand");
node->add_property("obj_id", obj.id().to_s());
- node->add_child_nocopy(before);
+ node->add_property("type_name", typeid(obj).name());
+ node->add_child_copy(before);
return *node;
}
protected:
@@ -79,6 +83,7 @@ template <class obj_T>
class MementoRedoCommand : public Command
{
public:
+ MementoRedoCommand(XMLNode &state);
MementoRedoCommand(obj_T &obj,
XMLNode &after)
: obj(obj), after(after) {}
@@ -88,7 +93,8 @@ public:
{
XMLNode *node = new XMLNode("MementoRedoCommand");
node->add_property("obj_id", obj.id().to_s());
- node->add_child_nocopy(after);
+ node->add_property("type_name", typeid(obj).name());
+ node->add_child_copy(after);
return *node;
}
protected: