diff options
Diffstat (limited to 'libs/pbd')
-rw-r--r-- | libs/pbd/pbd/command.h | 9 | ||||
-rw-r--r-- | libs/pbd/pbd/undo.h | 6 | ||||
-rw-r--r-- | libs/pbd/undo.cc | 6 |
3 files changed, 12 insertions, 9 deletions
diff --git a/libs/pbd/pbd/command.h b/libs/pbd/pbd/command.h index 5d45f85ac3..a66485bc0d 100644 --- a/libs/pbd/pbd/command.h +++ b/libs/pbd/pbd/command.h @@ -30,11 +30,20 @@ public: virtual void operator() () = 0; + void set_name (const std::string& str) { _name = str; } + const std::string& name() const { return _name; } + virtual void undo() = 0; virtual void redo() { (*this)(); } virtual XMLNode &get_state(); virtual int set_state(const XMLNode&) { /* noop */ return 0; } + +protected: + Command() {} + Command(const std::string& name) : _name(name) {} + + std::string _name; }; #endif // __lib_pbd_command_h_ diff --git a/libs/pbd/pbd/undo.h b/libs/pbd/pbd/undo.h index ea9a6d0e8b..5bfccf5a06 100644 --- a/libs/pbd/pbd/undo.h +++ b/libs/pbd/pbd/undo.h @@ -50,11 +50,6 @@ class UndoTransaction : public Command void redo(); XMLNode &get_state(); - - void set_name (const std::string& str) { - _name = str; - } - const std::string& name() const { return _name; } void set_timestamp (struct timeval &t) { _timestamp = t; @@ -67,7 +62,6 @@ class UndoTransaction : public Command private: std::list<Command*> actions; struct timeval _timestamp; - std::string _name; bool _clearing; friend void command_death (UndoTransaction*, Command *); diff --git a/libs/pbd/undo.cc b/libs/pbd/undo.cc index 5c7178b0d6..6db85e6ab3 100644 --- a/libs/pbd/undo.cc +++ b/libs/pbd/undo.cc @@ -32,14 +32,14 @@ using namespace std; using namespace sigc; UndoTransaction::UndoTransaction () + : _clearing(false) { - _clearing = false; } UndoTransaction::UndoTransaction (const UndoTransaction& rhs) + : Command(rhs._name) + , _clearing(false) { - _name = rhs._name; - _clearing = false; clear (); actions.insert(actions.end(),rhs.actions.begin(),rhs.actions.end()); } |