[beast: 17/26] BSE: ItemImpl: add push_undo_to_redo() to compensate for bse_container_remove_backedup



commit 370205c5b56544e4f02b9200a19793fb9729fba6
Author: Tim Janik <timj gnu org>
Date:   Thu Jul 2 13:47:58 2015 +0200

    BSE: ItemImpl: add push_undo_to_redo() to compensate for bse_container_remove_backedup

 bse/bseitem.hh |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/bse/bseitem.hh b/bse/bseitem.hh
index 68d859b..de6d898 100644
--- a/bse/bseitem.hh
+++ b/bse/bseitem.hh
@@ -200,6 +200,17 @@ public:
     };
     push_item_undo (blurb, lambda);
   }
+  template<typename ItemT, typename ItemTLambda> void
+  push_undo_to_redo (const String &blurb, ItemT &self, const ItemTLambda &itemt_lambda)
+  { // push itemt_lambda as undo step when this undo step is executed (i.e. itemt_lambda is for redo)
+    const std::function<ErrorType (ItemT &item, BseUndoStack *ustack)> &undo_lambda = itemt_lambda;
+    assert_return (this == &self);
+    auto lambda = [blurb, undo_lambda] (ItemT &self, BseUndoStack *ustack) -> ErrorType {
+      self.push_undo (blurb, self, undo_lambda);
+      return ERROR_NONE;
+    };
+    push_undo (blurb, self, lambda);
+  }
   /// UndoDescriptor - type safe object handle to persist undo/redo steps
   template<class Obj>
   class UndoDescriptor {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]