]> Shamusworld >> Repos - architektonas/blobdiff - src/base/rs_eventhandler.cpp
Fixed preview rendering for ActionDrawLine...
[architektonas] / src / base / rs_eventhandler.cpp
index 2961ff733d4e2e8b4e902e62462d67c8cc1ab732..a92775c000a6bc46ae54318b8e1bfa51cae9565c 100644 (file)
 #include "rs_commandevent.h"
 #include "rs_debug.h"
 #include "rs_dialogfactory.h"
-#include "rs_graphicview.h"
+#include "graphicview.h"
 #include "rs_math.h"
 
 /**
  * Constructor.
  */
-RS_EventHandler::RS_EventHandler(RS_GraphicView * graphicView)
+RS_EventHandler::RS_EventHandler(GraphicView * graphicView)
 {
        this->graphicView = graphicView;
        actionIndex = -1;
@@ -91,7 +91,7 @@ void RS_EventHandler::enter()
 }
 
 /**
- * Called by RS_GraphicView
+ * Called by GraphicView
  */
 void RS_EventHandler::mousePressEvent(QMouseEvent * e)
 {
@@ -116,7 +116,7 @@ void RS_EventHandler::mousePressEvent(QMouseEvent * e)
 }
 
 /**
- * Called by RS_GraphicView
+ * Called by GraphicView
  */
 void RS_EventHandler::mouseReleaseEvent(QMouseEvent * e)
 {
@@ -132,7 +132,7 @@ void RS_EventHandler::mouseReleaseEvent(QMouseEvent * e)
        }
        else
        {
-               if (defaultAction != NULL)
+               if (defaultAction)
                        defaultAction->mouseReleaseEvent(e);
                else
                        e->ignore();
@@ -140,11 +140,11 @@ void RS_EventHandler::mouseReleaseEvent(QMouseEvent * e)
 }
 
 /**
- * Called by RS_GraphicView
+ * Called by GraphicView
  */
 void RS_EventHandler::mouseMoveEvent(QMouseEvent * e)
 {
-       if (actionIndex >= 0 && currentActions[actionIndex] != NULL
+       if (actionIndex >= 0 && currentActions[actionIndex]
                && !currentActions[actionIndex]->isFinished())
        {
                currentActions[actionIndex]->mouseMoveEvent(e);
@@ -152,7 +152,7 @@ void RS_EventHandler::mouseMoveEvent(QMouseEvent * e)
        }
        else
        {
-               if (defaultAction!=NULL)
+               if (defaultAction)
                {
                        defaultAction->mouseMoveEvent(e);
                        e->accept();
@@ -164,7 +164,7 @@ void RS_EventHandler::mouseMoveEvent(QMouseEvent * e)
 }
 
 /**
- * Called by RS_GraphicView
+ * Called by GraphicView
  */
 void RS_EventHandler::mouseLeaveEvent()
 {
@@ -182,7 +182,7 @@ void RS_EventHandler::mouseLeaveEvent()
 }
 
 /**
- * Called by RS_GraphicView
+ * Called by GraphicView
  */
 void RS_EventHandler::mouseEnterEvent()
 {
@@ -199,7 +199,7 @@ void RS_EventHandler::mouseEnterEvent()
 }
 
 /**
- * Called by RS_GraphicView
+ * Called by GraphicView
  */
 void RS_EventHandler::keyPressEvent(QKeyEvent * e)
 {
@@ -220,7 +220,7 @@ void RS_EventHandler::keyPressEvent(QKeyEvent * e)
 }
 
 /**
- * Called by RS_GraphicView
+ * Called by GraphicView
  */
 void RS_EventHandler::keyReleaseEvent(QKeyEvent * e)
 {
@@ -326,7 +326,6 @@ void RS_EventHandler::commandEvent(RS_CommandEvent * e)
                                if (actionIndex >= 0 && currentActions[actionIndex] != NULL
                                        && !currentActions[actionIndex]->isFinished())
                                {
-//                                     int commaPos = cmd.find('<');
                                        int commaPos = cmd.indexOf('<');
                                        bool ok1, ok2;
                                        double r = RS_Math::eval(cmd.left(commaPos), &ok1);
@@ -376,7 +375,7 @@ void RS_EventHandler::commandEvent(RS_CommandEvent * e)
                                        }
                                        else
                                        {
-                                               if (RS_DIALOGFACTORY != NULL)
+                                               if (RS_DIALOGFACTORY)
                                                        RS_DIALOGFACTORY->commandMessage("Expression Syntax Error");
                                        }
 
@@ -389,7 +388,7 @@ void RS_EventHandler::commandEvent(RS_CommandEvent * e)
        // send command event directly to current action:
        if (!e->isAccepted())
        {
-               if (actionIndex >= 0 && currentActions[actionIndex] != NULL
+               if (actionIndex >= 0 && currentActions[actionIndex]
                        && !currentActions[actionIndex]->isFinished())
                {
                        currentActions[actionIndex]->commandEvent(e);
@@ -397,7 +396,7 @@ void RS_EventHandler::commandEvent(RS_CommandEvent * e)
                }
                else
                {
-                       if (defaultAction != NULL)
+                       if (defaultAction)
                                defaultAction->commandEvent(e);
                }
        }
@@ -463,14 +462,14 @@ void RS_EventHandler::setCurrentAction(RS_ActionInterface * action)
 {
        RS_DEBUG->print("RS_EventHandler::setCurrentAction");
 
-       if (action == NULL)
+       if (!action)
                return;
 
        // Predecessor of the new action or NULL:
        RS_ActionInterface * predecessor = NULL;
 
        // Suspend current action:
-       if (actionIndex >= 0 && currentActions[actionIndex] != NULL
+       if (actionIndex >= 0 && currentActions[actionIndex]
                && !currentActions[actionIndex]->isFinished())
        {
                predecessor = currentActions[actionIndex];
@@ -479,7 +478,7 @@ void RS_EventHandler::setCurrentAction(RS_ActionInterface * action)
        }
        else
        {
-               if (defaultAction != NULL)
+               if (defaultAction)
                {
                        predecessor = defaultAction;
                        predecessor->suspend();
@@ -528,7 +527,7 @@ void RS_EventHandler::setCurrentAction(RS_ActionInterface * action)
 
        RS_DEBUG->print("RS_EventHandler::setCurrentAction: debugging actions");
        debugActions();
-       RS_DEBUG->print("RS_GraphicView::setCurrentAction: OK");
+       RS_DEBUG->print("GraphicView::setCurrentAction: OK");
 }
 
 /**
@@ -571,7 +570,7 @@ void RS_EventHandler::killAllActions()
  */
 bool RS_EventHandler::hasAction()
 {
-       if (actionIndex != -1 || defaultAction != NULL)
+       if (actionIndex != -1 || defaultAction)
                return true;
 
        return false;
@@ -635,14 +634,14 @@ void RS_EventHandler::cleanUp()
        // Resume last used action:
        if (doResume)
        {
-               if (currentActions[resume] != NULL && !currentActions[resume]->isFinished())
+               if (currentActions[resume] && !currentActions[resume]->isFinished())
                {
                        currentActions[resume]->resume();
                        currentActions[resume]->showOptions();
                }
                else
                {
-                       if (defaultAction != NULL)
+                       if (defaultAction)
                        {
                                defaultAction->resume();
                                defaultAction->showOptions();
@@ -659,10 +658,10 @@ void RS_EventHandler::cleanUp()
 void RS_EventHandler::setSnapMode(RS2::SnapMode sm)
 {
        for(int c=0; c<RS_MAXACTIONS; ++c)
-               if (currentActions[c] != NULL)
+               if (currentActions[c])
                        currentActions[c]->setSnapMode(sm);
 
-       if (defaultAction!=NULL)
+       if (defaultAction)
                defaultAction->setSnapMode(sm);
 }
 
@@ -672,10 +671,10 @@ void RS_EventHandler::setSnapMode(RS2::SnapMode sm)
 void RS_EventHandler::setSnapRestriction(RS2::SnapRestriction sr)
 {
        for(int c=0; c<RS_MAXACTIONS; ++c)
-               if (currentActions[c] != NULL)
+               if (currentActions[c])
                        currentActions[c]->setSnapRestriction(sr);
 
-       if (defaultAction != NULL)
+       if (defaultAction)
                defaultAction->setSnapRestriction(sr);
 }