From 3a269ad7b321bd35915809a7920b98429831993b Mon Sep 17 00:00:00 2001 From: Eberhard Graether Date: Wed, 7 Dec 2016 12:39:43 +0100 Subject: [PATCH] ui: Fixed graph switch animation being used for edge activation --- .../component/controller/GraphController.cpp | 4 +-- .../controller/UndoRedoController.cpp | 26 ++++++++++++------- .../component/controller/UndoRedoController.h | 4 +-- .../messaging/type/MessageFlushUpdates.h | 3 ++- 4 files changed, 23 insertions(+), 14 deletions(-) diff --git a/src/lib/component/controller/GraphController.cpp b/src/lib/component/controller/GraphController.cpp index 21f26c24..96e864a3 100644 --- a/src/lib/component/controller/GraphController.cpp +++ b/src/lib/component/controller/GraphController.cpp @@ -49,7 +49,7 @@ void GraphController::handleMessage(MessageActivateTokens* message) { m_activeEdgeIds = message->tokenIds; setActiveAndVisibility(utility::concat(m_activeNodeIds, m_activeEdgeIds)); - buildGraph(message, false); + buildGraph(message, false, false); return; } else if (message->isAggregation) @@ -88,7 +88,7 @@ void GraphController::handleMessage(MessageActivateTokens* message) void GraphController::handleMessage(MessageFlushUpdates* message) { - buildGraph(message, true); + buildGraph(message, true, !message->keepContent()); } void GraphController::handleMessage(MessageSearchFullText* message) diff --git a/src/lib/component/controller/UndoRedoController.cpp b/src/lib/component/controller/UndoRedoController.cpp index 0401dab6..a72f99af 100644 --- a/src/lib/component/controller/UndoRedoController.cpp +++ b/src/lib/component/controller/UndoRedoController.cpp @@ -173,9 +173,9 @@ void UndoRedoController::handleMessage(MessageRedo* message) getView()->setRedoButtonEnabled(false); } - replayCommands(oldIterator); + bool keepsContent = replayCommands(oldIterator); - MessageFlushUpdates().dispatch(); + MessageFlushUpdates(keepsContent).dispatch(); } void UndoRedoController::handleMessage(MessageRefresh* message) @@ -193,9 +193,9 @@ void UndoRedoController::handleMessage(MessageRefresh* message) } else { - replayCommands(); + bool keepsContent = replayCommands(); - MessageFlushUpdates().dispatch(); + MessageFlushUpdates(keepsContent).dispatch(); } } @@ -289,12 +289,12 @@ void UndoRedoController::handleMessage(MessageUndo* message) m_iterator = it; - replayCommands(); + bool keepsContent = replayCommands(); - MessageFlushUpdates().dispatch(); + MessageFlushUpdates(keepsContent).dispatch(); } -void UndoRedoController::replayCommands() +bool UndoRedoController::replayCommands() { std::list::iterator startIterator = m_iterator; @@ -304,12 +304,13 @@ void UndoRedoController::replayCommands() } while (startIterator != m_list.begin() && startIterator->order != Command::ORDER_ACTIVATE); - replayCommands(startIterator); + return replayCommands(startIterator); } -void UndoRedoController::replayCommands(std::list::iterator it) +bool UndoRedoController::replayCommands(std::list::iterator it) { std::vector::iterator> viewCommands; + bool keepsContent = true; std::shared_ptr m; while (it != m_iterator) @@ -321,6 +322,11 @@ void UndoRedoController::replayCommands(std::list::iterator it) m->setIsLast(it == std::prev(m_iterator)); m->dispatch(); + if (!m->keepContent()) + { + keepsContent = false; + } + if (it->order != Command::ORDER_VIEW) { viewCommands.clear(); @@ -355,6 +361,8 @@ void UndoRedoController::replayCommands(std::list::iterator it) m->setIsLast(it == std::prev(m_iterator)); m->dispatch(); } + + return keepsContent; } void UndoRedoController::processCommand(Command command) diff --git a/src/lib/component/controller/UndoRedoController.h b/src/lib/component/controller/UndoRedoController.h index 619b2a9d..db8d49cc 100644 --- a/src/lib/component/controller/UndoRedoController.h +++ b/src/lib/component/controller/UndoRedoController.h @@ -94,8 +94,8 @@ private: virtual void handleMessage(MessageShowScope* message); virtual void handleMessage(MessageUndo* message); - void replayCommands(); - void replayCommands(std::list::iterator iterator); + bool replayCommands(); + bool replayCommands(std::list::iterator iterator); void processCommand(Command command); diff --git a/src/lib/utility/messaging/type/MessageFlushUpdates.h b/src/lib/utility/messaging/type/MessageFlushUpdates.h index 0d7dbf60..fcba110f 100644 --- a/src/lib/utility/messaging/type/MessageFlushUpdates.h +++ b/src/lib/utility/messaging/type/MessageFlushUpdates.h @@ -7,8 +7,9 @@ class MessageFlushUpdates: public Message { public: - MessageFlushUpdates() + MessageFlushUpdates(bool keepsContent = false) { + setKeepContent(keepsContent); } static const std::string getStaticType()