]> Shamusworld >> Repos - architektonas/blobdiff - src/widgets/actionhandler.cpp
In the middle of chasing down MDI not activating bug, renaming of Graphic to
[architektonas] / src / widgets / actionhandler.cpp
index 5765d9750dfdea22b0eed14bd78643e019ed6cdf..b5a28de9ae62ad3a02df289cb6be96106605bf3f 100644 (file)
@@ -57,6 +57,7 @@
 #include "actiondrawlinetangent1.h"
 #include "actiondrawlinetangent2.h"
 #include "actiondrawpoint.h"
+#include "actiondrawpolyline.h"
 #include "actiondrawspline.h"
 #include "actiondrawtext.h"
 #include "actioneditcopy.h"
 #include "actionmodifytrim.h"
 #include "actionmodifytrimamount.h"
 #include "actionoptionsdrawing.h"
+#include "actionpolylineadd.h"
+#include "actionpolylineappend.h"
+#include "actionpolylinedel.h"
+#include "actionpolylinedelbetween.h"
+#include "actionpolylinetrim.h"
 #include "actionselect.h"
 #include "actionselectall.h"
 #include "actionselectcontour.h"
 #include "actionzoomredraw.h"
 #include "actionzoomwindow.h"
 
-#warning "!!! Need to add polyline functionality !!!"
-#if 0
-#include "actiondrawpolyline.h"
-#include "actionpolylineadd.h"
-#include "actionpolylineappend.h"
-#include "actionpolylinedel.h"
-#include "actionpolylinedelbetween.h"
-#include "actionpolylinetrim.h"
-#endif
-
 #ifdef RS_CAM
 #include "actioncamexportauto.h"
 #include "actioncamreorder.h"
 /**
  * Constructor
  */
-ActionHandler::ActionHandler(QG_MainWindowInterface * mw)
+ActionHandler::ActionHandler(QG_MainWindowInterface * mwi)
 {
        DEBUG->print("ActionHandler::ActionHandler");
-       mainWindow = mw;
+       mainWindowIntf = mwi;
 
        snapFree = NULL;
        snapGrid = NULL;
@@ -175,7 +171,7 @@ ActionHandler::~ActionHandler()
  */
 void ActionHandler::killSelectActions()
 {
-       GraphicView * gv = mainWindow->getGraphicView();
+       GraphicView * gv = mainWindowIntf->getGraphicView();
 
        if (gv)
                gv->killSelectActions();
@@ -186,7 +182,7 @@ void ActionHandler::killSelectActions()
  */
 ActionInterface * ActionHandler::getCurrentAction()
 {
-       GraphicView * gv = mainWindow->getGraphicView();
+       GraphicView * gv = mainWindowIntf->getGraphicView();
 
        if (gv)
                return gv->getCurrentAction();
@@ -198,8 +194,8 @@ ActionInterface * ActionHandler::getCurrentAction()
 Instead of the following giant switch statement, you could something like the following:
 ActionInterface * ActionHandler::setCurrentAction(ActionInterface * action)
 {
-       GraphicView * gv = mainWindow->getGraphicView();
-       Document * doc = mainWindow->getDocument();
+       GraphicView * gv = mainWindowIntf->getGraphicView();
+       Document * doc = mainWindowIntf->getDocument();
 
        // only global options are allowed without a document:
        if (gv == NULL || doc == NULL)
@@ -222,7 +218,7 @@ itself would create the gv & doc. So for the EditUndo, we'd have:
        FunctionCreateAction(bool);
        FunctionCreateAction(void);
 
-Well... The problem is the action, they're all different...
+Well... The problem is the actions, they're all different...
 #endif
 
 /**
@@ -234,15 +230,15 @@ ActionInterface * ActionHandler::setCurrentAction(RS2::ActionType id)
 {
        DEBUG->print("ActionHandler::setCurrentAction()");
 
-       GraphicView * gv = mainWindow->getGraphicView();
-       Document * doc = mainWindow->getDocument();
+       GraphicView * gv = mainWindowIntf->getGraphicView();
+       Document * doc = mainWindowIntf->getDocument();
        ActionInterface * a = NULL;
 
        // only global options are allowed without a document:
        if (gv == NULL || doc == NULL)
        {
                DEBUG->print(Debug::D_WARNING,
-                       "ActionHandler::setCurrentAction: graphic view or document is NULL");
+                       "ActionHandler::setCurrentAction: graphic view=%08X or document=%08X", gv, doc);
                return NULL;
        }
 
@@ -331,13 +327,6 @@ ActionInterface * ActionHandler::setCurrentAction(RS2::ActionType id)
                a = new ActionSelectLayer(*doc, *gv);
                break;
 
-               // Tool actions:
-               //
-//no
-//     case RS2::ActionToolRegenerateDimensions:
-//             a = new ActionToolRegenerateDimensions(*doc, *gv);
-//             break;
-
                // Zooming actions:
                //
        case RS2::ActionZoomIn:
@@ -409,8 +398,6 @@ ActionInterface * ActionHandler::setCurrentAction(RS2::ActionType id)
        case RS2::ActionDrawLineRelAngle:
                a = new ActionDrawLineRelAngle(*doc, *gv, M_PI / 2.0, false);
                break;
-#warning "!!! Need to add polyline functionality !!!"
-#ifdef RS_PROF
        case RS2::ActionDrawPolyline:
                a = new ActionDrawPolyline(*doc, *gv);
                break;
@@ -429,7 +416,6 @@ ActionInterface * ActionHandler::setCurrentAction(RS2::ActionType id)
        case RS2::ActionPolylineTrim:
                a = new ActionPolylineTrim(*doc, *gv);
                break;
-#endif
        case RS2::ActionDrawLinePolygon:
                a = new ActionDrawLinePolygon(*doc, *gv);
                break;
@@ -830,6 +816,7 @@ bool ActionHandler::keycode(const QString & code)
        //if (!e.isAccepted()) {
        // keycode for new action:
        RS2::ActionType type = COMMANDS->keycodeToAction(code);
+
        if (type != RS2::ActionNone)
        {
                // some actions require special handling (GUI update):
@@ -882,7 +869,6 @@ bool ActionHandler::keycode(const QString & code)
                }
                return true;
        }
-       //}
 
        return false;
 }
@@ -901,7 +887,7 @@ bool ActionHandler::command(const QString & cmd)
 
        if (c == "\n")
        {
-               GraphicView * gv = mainWindow->getGraphicView();
+               GraphicView * gv = mainWindowIntf->getGraphicView();
 
                if (gv)
                        gv->back();
@@ -913,7 +899,7 @@ bool ActionHandler::command(const QString & cmd)
        // pass command on to running action:
        CommandEvent e(cmd);
 
-       GraphicView * gv = mainWindow->getGraphicView();
+       GraphicView * gv = mainWindowIntf->getGraphicView();
 
        if (gv)
        {
@@ -1848,13 +1834,10 @@ void ActionHandler::slotCamReorder()
 #endif
 }
 
+// ??? WHAT THE FUCK IS THIS SHIT ???
 void ActionHandler::slotFocusNormal()
 {
-       //QG_GraphicView* gv = mainWindow->getGraphicView();
-       //if (gv) {
-               //gv->setFocus();
-       mainWindow->setFocus2();
-       //}
+       mainWindowIntf->setFocus2();
 }
 
 void ActionHandler::setActionSnapFree(QAction * a)