]> Shamusworld >> Repos - architektonas/blobdiff - src/actions/actiondrawlinetangent1.cpp
In the middle of major refactoring...
[architektonas] / src / actions / actiondrawlinetangent1.cpp
similarity index 63%
rename from src/actions/rs_actiondrawlinetangent1.cpp
rename to src/actions/actiondrawlinetangent1.cpp
index ed3703d2ca5286e6380f07a82f2d5021318aec03..fbb128ae117b2723a7aadfcc86cf2603270913c9 100644 (file)
@@ -1,4 +1,4 @@
-// rs_actiondrawlinetangent1.cpp
+// actiondrawlinetangent1.cpp
 //
 // Part of the Architektonas Project
 // Originally part of QCad Community Edition by Andrew Mustun
 // JLH  06/04/2010  Added this text. :-)
 //
 
-#include "rs_actiondrawlinetangent1.h"
+#include "actiondrawlinetangent1.h"
 
 #include "rs_creation.h"
 #include "rs_dialogfactory.h"
 #include "graphicview.h"
 #include "rs_preview.h"
 
-RS_ActionDrawLineTangent1::RS_ActionDrawLineTangent1(RS_EntityContainer & container, GraphicView & graphicView): RS_PreviewActionInterface("Draw Tangents 1",
+ActionDrawLineTangent1::ActionDrawLineTangent1(RS_EntityContainer & container, GraphicView & graphicView): ActionInterface("Draw Tangents 1",
                container, graphicView)
 {
        tangent = NULL;
@@ -27,27 +27,27 @@ RS_ActionDrawLineTangent1::RS_ActionDrawLineTangent1(RS_EntityContainer & contai
        circle = NULL;
 }
 
-RS_ActionDrawLineTangent1::~RS_ActionDrawLineTangent1()
+ActionDrawLineTangent1::~ActionDrawLineTangent1()
 {
 }
 
-void RS_ActionDrawLineTangent1::trigger()
+void ActionDrawLineTangent1::trigger()
 {
-       RS_PreviewActionInterface::trigger();
+       ActionInterface::trigger();
 
-       if (tangent != NULL)
+       if (tangent)
        {
                RS_Entity * newEntity = NULL;
                newEntity = new RS_Line(container, tangent->getData());
 
-               if (newEntity != NULL)
+               if (newEntity)
                {
                        newEntity->setLayerToActive();
                        newEntity->setPenToActive();
                        container->addEntity(newEntity);
 
                        // upd. undo list:
-                       if (document != NULL)
+                       if (document)
                        {
                                document->startUndoCycle();
                                document->addUndoable(newEntity);
@@ -64,14 +64,13 @@ void RS_ActionDrawLineTangent1::trigger()
                tangent = NULL;
        }
        else
-               RS_DEBUG->print("RS_ActionDrawLineTangent1::trigger:"
+               RS_DEBUG->print("ActionDrawLineTangent1::trigger:"
                        " Entity is NULL\n");
 }
 
-void RS_ActionDrawLineTangent1::mouseMoveEvent(QMouseEvent * e)
+void ActionDrawLineTangent1::mouseMoveEvent(QMouseEvent * e)
 {
-       RS_DEBUG->print("RS_ActionDrawLineTangent1::mouseMoveEvent begin");
-
+       RS_DEBUG->print("ActionDrawLineTangent1::mouseMoveEvent begin");
        Vector mouse(graphicView->toGraphX(e->x()), graphicView->toGraphY(e->y()));
 
        switch (getStatus())
@@ -80,43 +79,42 @@ void RS_ActionDrawLineTangent1::mouseMoveEvent(QMouseEvent * e)
                point = snapPoint(e);
                break;
 
-       case SetCircle: {
+       case SetCircle:
+       {
                RS_Entity * en = catchEntity(e, RS2::ResolveAll);
 
-               if (en != NULL && (en->rtti() == RS2::EntityCircle
-                                  || en->rtti() == RS2::EntityArc
-                                  || en->rtti() == RS2::EntityEllipse))
+               if (en && (en->rtti() == RS2::EntityCircle
+                       || en->rtti() == RS2::EntityArc
+                       || en->rtti() == RS2::EntityEllipse))
                {
                        circle = en;
-
                        RS_Creation creation(NULL, NULL);
-                       RS_Line * t = creation.createTangent1(mouse,
-                                       point,
-                                       circle);
+                       RS_Line * t = creation.createTangent1(mouse, point, circle);
 
-                       if (t != NULL)
+                       if (t)
                        {
-                               if (tangent != NULL)
+                               if (tangent)
                                        delete tangent;
+
                                tangent = (RS_Line *)t->clone();
 
                                deletePreview();
                                clearPreview();
-                               preview->addEntity(t);
+//                             preview->addEntity(t);
                                drawPreview();
                        }
                }
        }
-       break;
+               break;
 
        default:
                break;
        }
 
-       RS_DEBUG->print("RS_ActionDrawLineTangent1::mouseMoveEvent end");
+       RS_DEBUG->print("ActionDrawLineTangent1::mouseMoveEvent end");
 }
 
-void RS_ActionDrawLineTangent1::mouseReleaseEvent(QMouseEvent * e)
+void ActionDrawLineTangent1::mouseReleaseEvent(QMouseEvent * e)
 {
        if (e->button() == Qt::RightButton)
        {
@@ -129,11 +127,12 @@ void RS_ActionDrawLineTangent1::mouseReleaseEvent(QMouseEvent * e)
        {
                switch (getStatus())
                {
-               case SetPoint: {
+               case SetPoint:
+               {
                        Vector ce(snapPoint(e));
                        coordinateEvent(&ce);
                }
-               break;
+                       break;
 
                case SetCircle:
                        trigger();
@@ -142,7 +141,7 @@ void RS_ActionDrawLineTangent1::mouseReleaseEvent(QMouseEvent * e)
        }
 }
 
-void RS_ActionDrawLineTangent1::coordinateEvent(Vector * e)
+void ActionDrawLineTangent1::coordinateEvent(Vector * e)
 {
        if (e == NULL)
                return;
@@ -161,15 +160,14 @@ void RS_ActionDrawLineTangent1::coordinateEvent(Vector * e)
        }
 }
 
-void RS_ActionDrawLineTangent1::updateMouseButtonHints()
+void ActionDrawLineTangent1::updateMouseButtonHints()
 {
        if (RS_DIALOGFACTORY != NULL)
        {
                switch (getStatus())
                {
                case SetPoint:
-                       RS_DIALOGFACTORY->updateMouseWidget(tr("Specify point"),
-                               tr("Cancel"));
+                       RS_DIALOGFACTORY->updateMouseWidget(tr("Specify point"), tr("Cancel"));
                        break;
 
                case SetCircle:
@@ -184,14 +182,14 @@ void RS_ActionDrawLineTangent1::updateMouseButtonHints()
        }
 }
 
-void RS_ActionDrawLineTangent1::updateMouseCursor()
+void ActionDrawLineTangent1::updateMouseCursor()
 {
        graphicView->setMouseCursor(RS2::CadCursor);
 }
 
-void RS_ActionDrawLineTangent1::updateToolBar()
+void ActionDrawLineTangent1::updateToolBar()
 {
-       if (RS_DIALOGFACTORY != NULL)
+       if (RS_DIALOGFACTORY)
        {
                if (!isFinished())
                        RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
@@ -199,5 +197,3 @@ void RS_ActionDrawLineTangent1::updateToolBar()
                        RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarLines);
        }
 }
-
-// EOF