2 Copyright (C) 2002 Brett Viren & Paul Davis
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 #ifndef __lib_pbd_undo_h__
22 #define __lib_pbd_undo_h__
26 #include <sigc++/slot.h>
32 typedef sigc::slot<void> UndoAction;
38 UndoCommand (const UndoCommand&);
39 UndoCommand& operator= (const UndoCommand&);
43 void add_undo (const UndoAction&);
44 void add_redo (const UndoAction&);
45 void add_redo_no_execute (const UndoAction&);
50 void set_name (const string& str) {
53 const string& name() const { return _name; }
55 void set_timestamp (struct timeval &t) {
59 const struct timeval& timestamp() const {
64 list<UndoAction> redo_actions;
65 list<UndoAction> undo_actions;
66 struct timeval _timestamp;
76 void add (UndoCommand uc);
77 void undo (unsigned int n);
78 void redo (unsigned int n);
80 unsigned long undo_depth() const { return UndoList.size(); }
81 unsigned long redo_depth() const { return RedoList.size(); }
83 string next_undo() const { return (UndoList.empty() ? string("") : UndoList.back().name()); }
84 string next_redo() const { return (RedoList.empty() ? string("") : RedoList.back().name()); }
91 list<UndoCommand> UndoList;
92 list<UndoCommand> RedoList;
96 #endif /* __lib_pbd_undo_h__ */