summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gtk2_ardour/automation_line.cc1
-rw-r--r--libs/ardour/ardour/session.h16
-rw-r--r--libs/ardour/session_command.cc16
-rw-r--r--libs/pbd/command.cc4
-rw-r--r--libs/pbd/pbd/command.h7
-rw-r--r--libs/pbd/pbd/memento_command.h24
-rw-r--r--libs/pbd/pbd/serializable.h33
-rw-r--r--libs/pbd/pbd/undo.h2
-rw-r--r--libs/pbd/undo.cc3
9 files changed, 45 insertions, 61 deletions
diff --git a/gtk2_ardour/automation_line.cc b/gtk2_ardour/automation_line.cc
index 4cf6779c98..5c09ddd49b 100644
--- a/gtk2_ardour/automation_line.cc
+++ b/gtk2_ardour/automation_line.cc
@@ -1278,4 +1278,5 @@ int AutomationLine::set_state(const XMLNode &node)
{
// TODO
alist.set_state(node);
+ return 0;
}
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h
index 0c53cc32e7..65daeafca7 100644
--- a/libs/ardour/ardour/session.h
+++ b/libs/ardour/ardour/session.h
@@ -841,52 +841,52 @@ class Session : public sigc::trackable, public Stateful
class GlobalSoloStateCommand : public Command
{
GlobalRouteBooleanState before, after;
- void *src;
Session &sess;
+ void *src;
public:
GlobalSoloStateCommand(Session &, void *src);
void operator()();
void undo();
- XMLNode &serialize();
+ XMLNode &get_state();
void mark();
};
class GlobalMuteStateCommand : public Command
{
GlobalRouteBooleanState before, after;
- void *src;
Session &sess;
+ void *src;
public:
GlobalMuteStateCommand(Session &, void *src);
void operator()();
void undo();
- XMLNode &serialize();
+ XMLNode &get_state();
void mark();
};
class GlobalRecordEnableStateCommand : public Command
{
GlobalRouteBooleanState before, after;
- void *src;
Session &sess;
+ void *src;
public:
GlobalRecordEnableStateCommand(Session &, void *src);
void operator()();
void undo();
- XMLNode &serialize();
+ XMLNode &get_state();
void mark();
};
class GlobalMeteringStateCommand : public Command
{
GlobalRouteMeterState before, after;
- void *src;
Session &sess;
+ void *src;
public:
GlobalMeteringStateCommand(Session &, void *src);
void operator()();
void undo();
- XMLNode &serialize();
+ XMLNode &get_state();
void mark();
};
diff --git a/libs/ardour/session_command.cc b/libs/ardour/session_command.cc
index 6482de41fb..9a43de55de 100644
--- a/libs/ardour/session_command.cc
+++ b/libs/ardour/session_command.cc
@@ -20,8 +20,10 @@ void Session::GlobalSoloStateCommand::undo()
{
sess.set_global_solo(before, src);
}
-XMLNode &Session::GlobalSoloStateCommand::serialize()
+XMLNode &Session::GlobalSoloStateCommand::get_state()
{
+ XMLNode *node = new XMLNode("GlobalSoloStateCommand");
+ return *node;
}
// mute
@@ -42,8 +44,10 @@ void Session::GlobalMuteStateCommand::undo()
{
sess.set_global_mute(before, src);
}
-XMLNode &Session::GlobalMuteStateCommand::serialize()
+XMLNode &Session::GlobalMuteStateCommand::get_state()
{
+ XMLNode *node = new XMLNode("GlobalMuteStateCommand");
+ return *node;
}
// record enable
@@ -64,8 +68,10 @@ void Session::GlobalRecordEnableStateCommand::undo()
{
sess.set_global_record_enable(before, src);
}
-XMLNode &Session::GlobalRecordEnableStateCommand::serialize()
+XMLNode &Session::GlobalRecordEnableStateCommand::get_state()
{
+ XMLNode *node = new XMLNode("GlobalRecordEnableStateCommand");
+ return *node;
}
// metering
@@ -86,8 +92,10 @@ void Session::GlobalMeteringStateCommand::undo()
{
sess.set_global_route_metering(before, src);
}
-XMLNode &Session::GlobalMeteringStateCommand::serialize()
+XMLNode &Session::GlobalMeteringStateCommand::get_state()
{
+ XMLNode *node = new XMLNode("GlobalMeteringStateCommand");
+ return *node;
}
} // namespace ARDOUR
diff --git a/libs/pbd/command.cc b/libs/pbd/command.cc
index 3f5aca8e51..c0fcf36187 100644
--- a/libs/pbd/command.cc
+++ b/libs/pbd/command.cc
@@ -1,8 +1,8 @@
#include <pbd/command.h>
+#include <pbd/xml++.h>
-class XMLNode;
-XMLNode &Command::serialize()
+XMLNode &Command::get_state()
{
XMLNode *node = new XMLNode ("Command");
// TODO
diff --git a/libs/pbd/pbd/command.h b/libs/pbd/pbd/command.h
index 35ae011530..cd9bf0e08a 100644
--- a/libs/pbd/pbd/command.h
+++ b/libs/pbd/pbd/command.h
@@ -21,16 +21,17 @@
#ifndef __lib_pbd_command_h__
#define __lib_pbd_command_h__
-#include <pbd/serializable.h>
+#include <pbd/stateful.h>
-class Command : public Serializable
+class Command : public Stateful
{
public:
virtual ~Command() {}
virtual void operator() () = 0;
virtual void undo() = 0;
virtual void redo() { (*this)(); }
- virtual XMLNode &serialize();
+ virtual XMLNode &get_state();
+ virtual int set_state(const XMLNode&) { /* noop */ return 0; }
};
#endif // __lib_pbd_command_h_
diff --git a/libs/pbd/pbd/memento_command.h b/libs/pbd/pbd/memento_command.h
index c8bfe5de4c..a86006a6ae 100644
--- a/libs/pbd/pbd/memento_command.h
+++ b/libs/pbd/pbd/memento_command.h
@@ -39,12 +39,14 @@ class MementoCommand : public Command
: obj(obj), before(before), after(after) {}
void operator() () { obj.set_state(after); }
void undo() { obj.set_state(before); }
- virtual XMLNode &serialize() {}
- //{
+ virtual XMLNode &get_state()
+ {
+ XMLNode *node = new XMLNode("MementoCommand");
// obj.id
// key is "MementoCommand" or something
// before and after mementos
- //}
+ return *node;
+ }
// TODO does this need a copy constructor?
protected:
obj_T &obj;
@@ -60,12 +62,14 @@ public:
: obj(obj), before(before) {}
void operator() () { /* noop */ }
void undo() { obj.set_state(before); }
- virtual XMLNode &serialize() {}
- //{
+ virtual XMLNode &get_state()
+ {
+ XMLNode *node = new XMLNode("MementoUndoCommand"); // XXX
// obj.id
// key is "MementoCommand" or something
// before and after mementos
- //}
+ return *node;
+ }
protected:
obj_T &obj;
XMLNode &before;
@@ -80,12 +84,14 @@ public:
: obj(obj), after(after) {}
void operator() () { obj.set_state(after); }
void undo() { /* noop */ }
- virtual XMLNode &serialize() {}
- //{
+ virtual XMLNode &get_state()
+ {
+ XMLNode *node = new XMLNode("MementoUndoCommand");
// obj.id
// key is "MementoCommand" or something
// before and after mementos
- //}
+ return *node;
+ }
protected:
obj_T &obj;
XMLNode &after;
diff --git a/libs/pbd/pbd/serializable.h b/libs/pbd/pbd/serializable.h
deleted file mode 100644
index f6ac4e92fb..0000000000
--- a/libs/pbd/pbd/serializable.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- Copyright (C) 2006 Paul Davis
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
- $Id: /local/undo/libs/pbd3/pbd/undo.h 59 2006-06-15T18:16:20.960977Z fugalh $
-*/
-
-#ifndef __lib_pbd_serializable_h__
-#define __lib_pbd_serializable_h__
-
-#include <pbd/xml++.h>
-
-class Serializable
-{
-public:
- virtual XMLNode &serialize() = 0;
- virtual ~Serializable() {}
-};
-
-#endif // __lib_pbd_serializable_h__
diff --git a/libs/pbd/pbd/undo.h b/libs/pbd/pbd/undo.h
index 33577ed4d7..49ff19ccce 100644
--- a/libs/pbd/pbd/undo.h
+++ b/libs/pbd/pbd/undo.h
@@ -49,7 +49,7 @@ class UndoTransaction : public Command
void undo();
void redo();
- XMLNode &serialize();
+ XMLNode &get_state();
void set_name (const string& str) {
_name = str;
diff --git a/libs/pbd/undo.cc b/libs/pbd/undo.cc
index aa27f95789..a5ca6b713a 100644
--- a/libs/pbd/undo.cc
+++ b/libs/pbd/undo.cc
@@ -21,6 +21,7 @@
#include <iostream>
#include <pbd/undo.h>
+#include <pbd/xml++.h>
using namespace std;
using namespace sigc;
@@ -82,7 +83,7 @@ UndoTransaction::redo ()
(*this)();
}
-XMLNode &UndoTransaction::serialize()
+XMLNode &UndoTransaction::get_state()
{
XMLNode *node = new XMLNode ("UndoTransaction");
// TODO