summaryrefslogtreecommitdiff
path: root/libs/pbd/undo.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2007-09-26 14:36:49 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2007-09-26 14:36:49 +0000
commitaf895ef50d80bae4f5bb63ee563604804eeb2fb2 (patch)
tree1ee2e2f0529d95283db11a89cb8f721c0a458e6c /libs/pbd/undo.cc
parent555cbaf613f1aca0654ca173dce4162ef7e122f3 (diff)
GUI control over saved and in-memory history depth
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@2486 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/pbd/undo.cc')
-rw-r--r--libs/pbd/undo.cc15
1 files changed, 10 insertions, 5 deletions
diff --git a/libs/pbd/undo.cc b/libs/pbd/undo.cc
index d54c6b0fff..f59228082d 100644
--- a/libs/pbd/undo.cc
+++ b/libs/pbd/undo.cc
@@ -152,11 +152,11 @@ UndoHistory::UndoHistory ()
}
void
-UndoHistory::set_depth (uint32_t d)
+UndoHistory::set_depth (int32_t d)
{
_depth = d;
- while (_depth > 0 && UndoList.size() > _depth) {
+ while (_depth > 0 && UndoList.size() > (uint32_t) _depth) {
UndoList.pop_front ();
}
}
@@ -166,7 +166,7 @@ UndoHistory::add (UndoTransaction* const ut)
{
ut->GoingAway.connect (bind (mem_fun (*this, &UndoHistory::remove), ut));
- while (_depth > 0 && UndoList.size() > _depth) {
+ while (_depth > 0 && UndoList.size() > (uint32_t) _depth) {
UndoList.pop_front ();
}
@@ -253,17 +253,22 @@ UndoHistory::clear ()
}
XMLNode&
-UndoHistory::get_state (uint32_t depth)
+UndoHistory::get_state (int32_t depth)
{
XMLNode *node = new XMLNode ("UndoHistory");
if (depth == 0) {
+
+ return (*node);
+
+ } else if (depth < 0) {
+
/* everything */
for (list<UndoTransaction*>::iterator it = UndoList.begin(); it != UndoList.end(); ++it) {
node->add_child_nocopy((*it)->get_state());
}
-
+
} else {
/* just the last "depth" transactions */