]> Shamusworld >> Repos - architektonas/blobdiff - src/widgets/actionhandler.cpp
Bugfixes related to removing Snapper class.
[architektonas] / src / widgets / actionhandler.cpp
index d26327ba746cb2a26190a6a787bbf0e423dd15dd..f44ca7a5c4b59be626f97228fae448aaf05605ac 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"
  */
 ActionHandler::ActionHandler(QG_MainWindowInterface * mw)
 {
-       RS_DEBUG->print("ActionHandler::ActionHandler");
+       DEBUG->print("ActionHandler::ActionHandler");
        mainWindow = mw;
 
        snapFree = NULL;
@@ -157,7 +153,7 @@ ActionHandler::ActionHandler(QG_MainWindowInterface * mw)
        restrictVertical = NULL;
 
        lockRelativeZero = NULL;
-       RS_DEBUG->print("ActionHandler::ActionHandler: OK");
+       DEBUG->print("ActionHandler::ActionHandler: OK");
 }
 
 /**
@@ -165,8 +161,8 @@ ActionHandler::ActionHandler(QG_MainWindowInterface * mw)
  */
 ActionHandler::~ActionHandler()
 {
-       RS_DEBUG->print("ActionHandler::~ActionHandler");
-       RS_DEBUG->print("ActionHandler::~ActionHandler: OK");
+       DEBUG->print("ActionHandler::~ActionHandler");
+       DEBUG->print("ActionHandler::~ActionHandler: OK");
 }
 
 /**
@@ -199,7 +195,7 @@ Instead of the following giant switch statement, you could something like the fo
 ActionInterface * ActionHandler::setCurrentAction(ActionInterface * action)
 {
        GraphicView * gv = mainWindow->getGraphicView();
-       RS_Document * doc = mainWindow->getDocument();
+       Document * doc = mainWindow->getDocument();
 
        // only global options are allowed without a document:
        if (gv == NULL || doc == NULL)
@@ -232,16 +228,16 @@ Well... The problem is the action, they're all different...
  */
 ActionInterface * ActionHandler::setCurrentAction(RS2::ActionType id)
 {
-       RS_DEBUG->print("ActionHandler::setCurrentAction()");
+       DEBUG->print("ActionHandler::setCurrentAction()");
 
        GraphicView * gv = mainWindow->getGraphicView();
-       RS_Document * doc = mainWindow->getDocument();
+       Document * doc = mainWindow->getDocument();
        ActionInterface * a = NULL;
 
        // only global options are allowed without a document:
        if (gv == NULL || doc == NULL)
        {
-               RS_DEBUG->print(RS_Debug::D_WARNING,
+               DEBUG->print(Debug::D_WARNING,
                        "ActionHandler::setCurrentAction: graphic view or document is NULL");
                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;
@@ -775,7 +761,7 @@ ActionInterface * ActionHandler::setCurrentAction(RS2::ActionType id)
 #endif
 
        default:
-               RS_DEBUG->print(RS_Debug::D_WARNING,
+               DEBUG->print(Debug::D_WARNING,
                        "ActionHandler::setCurrentAction(): No such action found.");
                break;
        }
@@ -783,7 +769,7 @@ ActionInterface * ActionHandler::setCurrentAction(RS2::ActionType id)
        if (a)
                gv->setCurrentAction(a);
 
-       RS_DEBUG->print("ActionHandler::setCurrentAction(): OK");
+       DEBUG->print("ActionHandler::setCurrentAction(): OK");
 
        return a;
 }
@@ -829,7 +815,7 @@ bool ActionHandler::keycode(const QString & code)
        //   it might be intended to launch a new keycode
        //if (!e.isAccepted()) {
        // keycode for new action:
-       RS2::ActionType type = RS_COMMANDS->keycodeToAction(code);
+       RS2::ActionType type = COMMANDS->keycodeToAction(code);
        if (type != RS2::ActionNone)
        {
                // some actions require special handling (GUI update):
@@ -896,7 +882,7 @@ bool ActionHandler::keycode(const QString & code)
  */
 bool ActionHandler::command(const QString & cmd)
 {
-       RS_DEBUG->print("ActionHandler::command: %s", cmd.toLatin1().data());
+       DEBUG->print("ActionHandler::command: %s", cmd.toLatin1().data());
        QString c = cmd.toLower();
 
        if (c == "\n")
@@ -906,18 +892,18 @@ bool ActionHandler::command(const QString & cmd)
                if (gv)
                        gv->back();
 
-               RS_DEBUG->print("ActionHandler::command: back");
+               DEBUG->print("ActionHandler::command: back");
                return true;
        }
 
        // pass command on to running action:
-       RS_CommandEvent e(cmd);
+       CommandEvent e(cmd);
 
        GraphicView * gv = mainWindow->getGraphicView();
 
        if (gv)
        {
-               RS_DEBUG->print("ActionHandler::command: trigger command event in graphic view");
+               DEBUG->print("ActionHandler::command: trigger command event in graphic view");
                gv->commandEvent(&e);
        }
 
@@ -925,20 +911,20 @@ bool ActionHandler::command(const QString & cmd)
        //   it might be intended to launch a new command
        if (!e.isAccepted())
        {
-               RS_DEBUG->print("ActionHandler::command: convert cmd to action type");
+               DEBUG->print("ActionHandler::command: convert cmd to action type");
                // command for new action:
-               RS2::ActionType type = RS_COMMANDS->cmdToAction(cmd);
+               RS2::ActionType type = COMMANDS->cmdToAction(cmd);
 
                if (type != RS2::ActionNone)
                {
-                       RS_DEBUG->print("ActionHandler::command: setting current action");
+                       DEBUG->print("ActionHandler::command: setting current action");
                        setCurrentAction(type);
-                       RS_DEBUG->print("ActionHandler::command: current action set");
+                       DEBUG->print("ActionHandler::command: current action set");
                        return true;
                }
        }
 
-       RS_DEBUG->print("ActionHandler::command: current action not set");
+       DEBUG->print("ActionHandler::command: current action not set");
        return false;
 }