summaryrefslogtreecommitdiff
path: root/libs/pbd/undo.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2007-09-02 15:17:13 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2007-09-02 15:17:13 +0000
commitf2a2e9c00281c9bfe5ff7df31cdc8860129b282c (patch)
treee45988a790da04e1e72e917d2b0f7935526fe8a2 /libs/pbd/undo.cc
parent6c2728f9815bcdbf1cbd702f271344e295ddb074 (diff)
limited history depth (no GUI yet); more work on import dialog and semantics
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2361 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/pbd/undo.cc')
-rw-r--r--libs/pbd/undo.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/libs/pbd/undo.cc b/libs/pbd/undo.cc
index 4719d0968e..d54c6b0fff 100644
--- a/libs/pbd/undo.cc
+++ b/libs/pbd/undo.cc
@@ -148,12 +148,28 @@ XMLNode &UndoTransaction::get_state()
UndoHistory::UndoHistory ()
{
_clearing = false;
+ _depth = 0;
+}
+
+void
+UndoHistory::set_depth (uint32_t d)
+{
+ _depth = d;
+
+ while (_depth > 0 && UndoList.size() > _depth) {
+ UndoList.pop_front ();
+ }
}
void
UndoHistory::add (UndoTransaction* const ut)
{
ut->GoingAway.connect (bind (mem_fun (*this, &UndoHistory::remove), ut));
+
+ while (_depth > 0 && UndoList.size() > _depth) {
+ UndoList.pop_front ();
+ }
+
UndoList.push_back (ut);
/* we are now owners of the transaction */