diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2006-08-25 01:07:15 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2006-08-25 01:07:15 +0000 |
commit | ce234f363e95c38fc92728e520bf5ba240a89aa7 (patch) | |
tree | 96ce8c4734bdd564ec1f2ad0c36bc32f0b108204 /libs/pbd/pbd/undo.h | |
parent | 7e95f29ce95edf01d6d451f96fae03f3d3451ff8 (diff) |
use shared_ptr<> for all region handling
git-svn-id: svn://localhost/ardour2/trunk@852 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/pbd/pbd/undo.h')
-rw-r--r-- | libs/pbd/pbd/undo.h | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/libs/pbd/pbd/undo.h b/libs/pbd/pbd/undo.h index 724e86aaa0..eecd8ae49d 100644 --- a/libs/pbd/pbd/undo.h +++ b/libs/pbd/pbd/undo.h @@ -29,9 +29,6 @@ #include <sys/time.h> #include <pbd/command.h> -using std::string; -using std::list; - typedef sigc::slot<void> UndoAction; class UndoTransaction : public Command @@ -40,10 +37,11 @@ class UndoTransaction : public Command UndoTransaction (); UndoTransaction (const UndoTransaction&); UndoTransaction& operator= (const UndoTransaction&); + ~UndoTransaction (); void clear (); - void add_command (Command *const); + void add_command (Command* const); void operator() (); void undo(); @@ -51,10 +49,10 @@ class UndoTransaction : public Command XMLNode &get_state(); - void set_name (const string& str) { + void set_name (const std::string& str) { _name = str; } - const string& name() const { return _name; } + const std::string& name() const { return _name; } void set_timestamp (struct timeval &t) { _timestamp = t; @@ -65,26 +63,28 @@ class UndoTransaction : public Command } private: - list<Command*> actions; - struct timeval _timestamp; - string _name; + std::list<Command*> actions; + struct timeval _timestamp; + std::string _name; + bool clearing; + void remove_command (Command* const); }; class UndoHistory { public: - UndoHistory() {} + UndoHistory(); ~UndoHistory() {} - void add (UndoTransaction ut); + void add (UndoTransaction* ut); void undo (unsigned int n); void redo (unsigned int n); unsigned long undo_depth() const { return UndoList.size(); } unsigned long redo_depth() const { return RedoList.size(); } - string next_undo() const { return (UndoList.empty() ? string("") : UndoList.back().name()); } - string next_redo() const { return (RedoList.empty() ? string("") : RedoList.back().name()); } + std::string next_undo() const { return (UndoList.empty() ? std::string("") : UndoList.back()->name()); } + std::string next_redo() const { return (RedoList.empty() ? std::string("") : RedoList.back()->name()); } void clear (); void clear_undo (); @@ -92,9 +92,13 @@ class UndoHistory XMLNode &get_state(); void save_state(); + private: - list<UndoTransaction> UndoList; - list<UndoTransaction> RedoList; + bool clearing; + std::list<UndoTransaction*> UndoList; + std::list<UndoTransaction*> RedoList; + + void remove (UndoTransaction*); }; |