r274@gandalf: fugalh | 2006-08-07 19:53:48 -0600
authorHans Fugal <hans@fugal.net>
Wed, 9 Aug 2006 14:14:17 +0000 (14:14 +0000)
committerHans Fugal <hans@fugal.net>
Wed, 9 Aug 2006 14:14:17 +0000 (14:14 +0000)
 Nuke Serializable in favor of Stateful. Got rid of some warnings with stub
 code.

git-svn-id: svn://localhost/ardour2/branches/undo@767 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/automation_line.cc
libs/ardour/ardour/session.h
libs/ardour/session_command.cc
libs/pbd/command.cc
libs/pbd/pbd/command.h
libs/pbd/pbd/memento_command.h
libs/pbd/pbd/serializable.h [deleted file]
libs/pbd/pbd/undo.h
libs/pbd/undo.cc

index 4cf6779c9827406ff76f672a2357e04d3dabd962..5c09ddd49b35e1c90d9d8e7f3dcfe07a81ef2394 100644 (file)
@@ -1278,4 +1278,5 @@ int AutomationLine::set_state(const XMLNode &node)
 {
     // TODO
     alist.set_state(node);
+    return 0;
 }
index 0c53cc32e76128cb6a38402abce7c66660db7fc9..65daeafca72afd553d120264f7609dbb430cf603 100644 (file)
@@ -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();
         };
 
index 6482de41fb8f7ca6993c0a36e2ea28ac1ccf5978..9a43de55de17ee1f9c8a04ce5984a96e3ae539d8 100644 (file)
@@ -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
index 3f5aca8e513a0082d046fa1700f0610e64901090..c0fcf361872dccef28aaed7e50dac67768ccb50d 100644 (file)
@@ -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
index 35ae011530c0b69e7898002e37006f5f360bcd08..cd9bf0e08a577ff07b69b8c2b960022f15ae7d92 100644 (file)
 #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_
index c8bfe5de4ca0d2e173d2bade668e1a8c85634785..a86006a6ae48243f2887499aab5f5399bcdfc5ca 100644 (file)
@@ -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 (file)
index f6ac4e9..0000000
+++ /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__
index 33577ed4d717e4420958af26e718411bce7036c8..49ff19ccceca24bfd794e0ad27fd199cf34a0be8 100644 (file)
@@ -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;
index aa27f95789a6e378b77828b25273781561efb602..a5ca6b713a4f4117b15b1e2c2f64d9f73b264e50 100644 (file)
@@ -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