X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fbase%2Factioninterface.cpp;h=10f452408161383c5dd9e9a35f096a2e723401d8;hb=bd2b29c8735d83ab48df13c3efee53f63570473e;hp=033fbe1c428e66f3b943ce7a88f3d40b4cf9aa0d;hpb=97d3cdae07ec9788cf80e7905abfdb5d67a7747c;p=architektonas diff --git a/src/base/actioninterface.cpp b/src/base/actioninterface.cpp index 033fbe1..10f4524 100644 --- a/src/base/actioninterface.cpp +++ b/src/base/actioninterface.cpp @@ -3,13 +3,17 @@ // Part of the Architektonas Project // Originally part of QCad Community Edition by Andrew Mustun // Extensively rewritten and refactored by James L. Hammons -// (C) 2010 Underground Software +// Portions copyright (C) 2001-2003 RibbonSoft +// Copyright (C) 2010 Underground Software +// See the README and GPLv2 files for licensing and warranty information // // JLH = James L. Hammons // // 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" @@ -22,21 +26,16 @@ /** * 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); @@ -45,17 +44,21 @@ 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(); RS_DEBUG->print("ActionInterface::ActionInterface: Setting up action: \"%s\": OK", name); } @@ -63,7 +66,7 @@ ActionInterface::ActionInterface(const char * name, RS_EntityContainer & c, /** * Destructor. */ -ActionInterface::~ActionInterface() +/*virtual*/ ActionInterface::~ActionInterface() { // would be pure virtual now: // hideOptions(); @@ -107,6 +110,12 @@ void ActionInterface::init(int status/*= 0*/) updateMouseCursor(); updateToolBar(); } + else // status < 0, e.g. this action is finished + { + graphicView->snapper.SetVisible(false); + graphicView->preview.SetVisible(false); + graphicView->preview.clear(); + } } /** @@ -303,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(); } @@ -375,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) {