]> Shamusworld >> Repos - architektonas/blobdiff - src/base/actioninterface.cpp
Still in the middle of fixing preview/snapper rendering...
[architektonas] / src / base / actioninterface.cpp
index 9f38848e2df778ae588dc33ab3dfb9dee8e2435d..10f452408161383c5dd9e9a35f096a2e723401d8 100644 (file)
@@ -12,6 +12,8 @@
 // Who  When        What
 // ---  ----------  -----------------------------------------------------------
 // JLH  05/22/2010  Added this text. :-)
+// JLH  08/09/2010  Preparation for removal of GraphicView object from this
+//                  class
 //
 
 #include "actioninterface.h"
 /**
  * Constructor.
  *
- * Sets the entity container on which the action class inherited
- * from this interface operates.
+ * Sets the entity container on which the action class inherited from this
+ * interface operates.
  *
- * @param name Action name. This can be used internally for
- *             debugging mainly.
+ * @param name Action name. This can be used internally for debugging mainly.
  * @param container Entity container this action operates on.
- * @param graphicView Graphic view instance this action operates on.
- *                    Please note that an action belongs to this
- *                    view.
- * @param cursor Default mouse cursor for this action. If the action
- *               is suspended and resumed again the cursor will always
- *               be reset to the one given here.
+ * @param graphicView Graphic view instance this action operates on. Please
+ *                    note that an action belongs to this view.
  */
-ActionInterface::ActionInterface(const char * name, RS_EntityContainer & c,
-       GraphicView & v): graphicView(&v), container(&c)
+ActionInterface::ActionInterface(const char * name, RS_EntityContainer & ec,
+       GraphicView & gv): graphicView(&gv), container(&ec)
 {
        RS_DEBUG->print("ActionInterface::ActionInterface: Setting up action: \"%s\"", name);
 
@@ -47,17 +44,19 @@ ActionInterface::ActionInterface(const char * name, RS_EntityContainer & c,
        finished = false;
 
        // Graphic provides a pointer to the graphic if the entity container is a
-       //graphic (i.e. can also hold layers).
-       graphic = c.getGraphic();
+       // graphic (i.e. can also hold layers).
+       graphic = ec.getGraphic();
 
        // Document pointer will be used for undo / redo
-       document = c.getDocument();
+       document = ec.getDocument();
 
        // This is here until I can figure out a better way to contain all of this
        // circular referential nonsense that exists in this codebase. It will be
        // expunged, by Grabthar's Hammer!
        graphicView->snapper.SetContainer(container);
        graphicView->snapper.SetGraphicView(graphicView);       // <-- THIS is what I mean! INSANE!
+       // Not all actions use these. Perhaps we need to pass params to the contructor
+       // in order to set these? Setting the default to true for both?
        graphicView->snapper.SetVisible();
        graphicView->preview.SetVisible();
 
@@ -67,7 +66,7 @@ ActionInterface::ActionInterface(const char * name, RS_EntityContainer & c,
 /**
  * Destructor.
  */
-ActionInterface::~ActionInterface()
+/*virtual*/ ActionInterface::~ActionInterface()
 {
        // would be pure virtual now:
        // hideOptions();
@@ -115,6 +114,7 @@ void ActionInterface::init(int status/*= 0*/)
        {
                graphicView->snapper.SetVisible(false);
                graphicView->preview.SetVisible(false);
+               graphicView->preview.clear();
        }
 }
 
@@ -312,6 +312,8 @@ void ActionInterface::setPredecessor(ActionInterface * p)
  */
 void ActionInterface::suspend()
 {
+       // Maybe this is where we need to save the state of the snapper
+       // & preview objects???
 //     graphicView->setMouseCursor(RS2::ArrowCursor);
 //     RS_Snapper::suspend();
 }
@@ -384,6 +386,7 @@ RS_Entity * ActionInterface::catchEntity(Vector v, RS2::ResolveLevel level/*= RS
        return graphicView->snapper.catchEntity(v, level);
 }
 
+#warning "!!! Dummy functions need to be deleted once all actions no longer use these !!!"
 //dummy functions, will delete later...
 void ActionInterface::drawSnapper(void)
 {