diff Framework/Scene2DViewport/ViewportController.cpp @ 906:52b1c6ff10c5

Disabled OpenGL in GuiAdapter to allow for Cairo-only workflows (THIS IS A TEMP CHANGE!!!) + disabled outlined text by default (build macro)
author Benjamin Golinvaux <bgo@osimis.io>
date Wed, 17 Jul 2019 17:17:34 +0200
parents 0c5201499af8
children a911f5bb48da
line wrap: on
line diff
--- a/Framework/Scene2DViewport/ViewportController.cpp	Wed Jul 17 16:56:53 2019 +0200
+++ b/Framework/Scene2DViewport/ViewportController.cpp	Wed Jul 17 17:17:34 2019 +0200
@@ -51,27 +51,59 @@
 
   void ViewportController::PushCommand(boost::shared_ptr<TrackerCommand> command)
   {
-    GetUndoStack()->PushCommand(command);
+    boost::shared_ptr<UndoStack> undoStack = undoStackW_.lock();
+    if(undoStack.get() != NULL)
+      undoStack->PushCommand(command);
+    else
+    {
+      LOG(ERROR) << "Internal error: no undo stack in the viewport controller!";
+    }
   }
 
   void ViewportController::Undo()
   {
-    GetUndoStack()->Undo();
+    boost::shared_ptr<UndoStack> undoStack = undoStackW_.lock();
+    if (undoStack.get() != NULL)
+      undoStack->Undo();
+    else
+    {
+      LOG(ERROR) << "Internal error: no undo stack in the viewport controller!";
+    }
   }
 
   void ViewportController::Redo()
   {
-    GetUndoStack()->Redo();
+    boost::shared_ptr<UndoStack> undoStack = undoStackW_.lock();
+    if (undoStack.get() != NULL)
+      undoStack->Redo();
+    else
+    {
+      LOG(ERROR) << "Internal error: no undo stack in the viewport controller!";
+    }
   }
 
   bool ViewportController::CanUndo() const
   {
-    return GetUndoStack()->CanUndo();
+    boost::shared_ptr<UndoStack> undoStack = undoStackW_.lock();
+    if (undoStack.get() != NULL)
+      return undoStack->CanUndo();
+    else
+    {
+      LOG(ERROR) << "Internal error: no undo stack in the viewport controller!";
+      return false;
+    }
   }
 
   bool ViewportController::CanRedo() const
   {
-    return GetUndoStack()->CanRedo();
+    boost::shared_ptr<UndoStack> undoStack = undoStackW_.lock();
+    if (undoStack.get() != NULL)
+      return undoStack->CanRedo();
+    else
+    {
+      LOG(ERROR) << "Internal error: no undo stack in the viewport controller!";
+      return false;
+    }
   }
   
   bool ViewportController::HandlePointerEvent(PointerEvent e)