]> Shamusworld >> Repos - architektonas/blobdiff - src/actions/actiondrawlineparallelthrough.cpp
In the middle of major refactoring...
[architektonas] / src / actions / actiondrawlineparallelthrough.cpp
similarity index 61%
rename from src/actions/rs_actiondrawlineparallelthrough.cpp
rename to src/actions/actiondrawlineparallelthrough.cpp
index 81a9bcec053d6f30e415f3a0a0f69fe24871872f..902e8b18105cc62c37829fd5ea7fcba97ea1c46b 100644 (file)
@@ -1,4 +1,4 @@
-// rs_actiondrawlineparallelthrough.cpp
+// actiondrawlineparallelthrough.cpp
 //
 // Part of the Architektonas Project
 // Originally part of QCad Community Edition by Andrew Mustun
@@ -12,7 +12,7 @@
 // JLH  06/04/2010  Added this text. :-)
 //
 
-#include "rs_actiondrawlineparallelthrough.h"
+#include "actiondrawlineparallelthrough.h"
 
 #include "rs_commandevent.h"
 #include "rs_creation.h"
 #include "graphicview.h"
 #include "rs_preview.h"
 
-RS_ActionDrawLineParallelThrough::RS_ActionDrawLineParallelThrough(
+ActionDrawLineParallelThrough::ActionDrawLineParallelThrough(
        RS_EntityContainer & container, GraphicView & graphicView):
-       RS_PreviewActionInterface("Draw Parallels", container, graphicView)
+       ActionInterface("Draw Parallels", container, graphicView)
 {
        parallel = NULL;
        entity = NULL;
-       distance = 1.0;
+//???  distance = 1.0;
        number = 1;
        coord = Vector(false);
 }
 
-RS_ActionDrawLineParallelThrough::~RS_ActionDrawLineParallelThrough()
+ActionDrawLineParallelThrough::~ActionDrawLineParallelThrough()
 {
 }
 
-/*virtual*/ RS2::ActionType RS_ActionDrawLineParallelThrough::rtti()
+/*virtual*/ RS2::ActionType ActionDrawLineParallelThrough::rtti()
 {
        return RS2::ActionDrawLineParallelThrough;
 }
 
-void RS_ActionDrawLineParallelThrough::trigger()
+void ActionDrawLineParallelThrough::trigger()
 {
-       RS_PreviewActionInterface::trigger();
+       ActionInterface::trigger();
        deleteSnapper();
 
-       if (entity != NULL)
+       if (entity)
        {
                RS_Creation creation(container, graphicView);
                RS_Entity * e = creation.createParallelThrough(coord, number, entity);
 
-               if (e == NULL)
-                       RS_DEBUG->print("RS_ActionDrawLineParallelThrough::trigger:"
+               if (!e)
+                       RS_DEBUG->print("ActionDrawLineParallelThrough::trigger:"
                                " No parallels added\n");
        }
 }
 
-void RS_ActionDrawLineParallelThrough::mouseMoveEvent(QMouseEvent * e)
+void ActionDrawLineParallelThrough::mouseMoveEvent(QMouseEvent * e)
 {
-       RS_DEBUG->print("RS_ActionDrawLineParallelThrough::mouseMoveEvent begin");
+       RS_DEBUG->print("ActionDrawLineParallelThrough::mouseMoveEvent begin");
 
        switch (getStatus())
        {
        case SetEntity:
                entity = catchEntity(e, RS2::ResolveAll);
-               /*deletePreview();
-                  clearPreview();
-
-                  RS_Creation creation(preview, NULL, false);
-                  creation.createParallelThrough(coord,
-                                                                               number,
-                                                                               entity);
-
-                  drawPreview();*/
                break;
 
        case SetPos:
        {
                coord = snapPoint(e);
-               //Vector(graphicView->toGraphX(e->x()),
-               //                  graphicView->toGraphY(e->y()));
                deletePreview();
                clearPreview();
 
-               RS_Creation creation(preview, NULL, false);
-               creation.createParallelThrough(coord,
-                       number,
-                       entity);
+//             RS_Creation creation(preview, NULL, false);
+//             creation.createParallelThrough(coord, number, entity);
 
                drawPreview();
        }
@@ -96,12 +83,11 @@ void RS_ActionDrawLineParallelThrough::mouseMoveEvent(QMouseEvent * e)
                break;
        }
 
-       RS_DEBUG->print("RS_ActionDrawLineParallelThrough::mouseMoveEvent end");
+       RS_DEBUG->print("ActionDrawLineParallelThrough::mouseMoveEvent end");
 }
 
-void RS_ActionDrawLineParallelThrough::mouseReleaseEvent(QMouseEvent * e)
+void ActionDrawLineParallelThrough::mouseReleaseEvent(QMouseEvent * e)
 {
-//     if (RS2::qtToRsButtonState(e->button())==RS2::LeftButton)
        if (e->button() == Qt::LeftButton)
        {
                switch (getStatus())
@@ -109,7 +95,7 @@ void RS_ActionDrawLineParallelThrough::mouseReleaseEvent(QMouseEvent * e)
                case SetEntity:
                        entity = catchEntity(e, RS2::ResolveAll);
 
-                       if (entity != NULL)
+                       if (entity)
                        {
                                entity->setHighlighted(true);
                                graphicView->drawEntity(entity);
@@ -129,13 +115,12 @@ void RS_ActionDrawLineParallelThrough::mouseReleaseEvent(QMouseEvent * e)
                        break;
                }
        }
-//     else if (RS2::qtToRsButtonState(e->button())==RS2::RightButton)
        else if (e->button() == Qt::RightButton)
        {
                deletePreview();
                deleteSnapper();
 
-               if (entity != NULL)
+               if (entity)
                {
                        entity->setHighlighted(false);
                        graphicView->drawEntity(entity);
@@ -146,7 +131,7 @@ void RS_ActionDrawLineParallelThrough::mouseReleaseEvent(QMouseEvent * e)
        }
 }
 
-void RS_ActionDrawLineParallelThrough::coordinateEvent(Vector * e)
+void ActionDrawLineParallelThrough::coordinateEvent(Vector * e)
 {
        if (e == NULL)
                return;
@@ -165,7 +150,7 @@ void RS_ActionDrawLineParallelThrough::coordinateEvent(Vector * e)
        }
 }
 
-void RS_ActionDrawLineParallelThrough::updateMouseButtonHints()
+void ActionDrawLineParallelThrough::updateMouseButtonHints()
 {
        switch (getStatus())
        {
@@ -187,22 +172,20 @@ void RS_ActionDrawLineParallelThrough::updateMouseButtonHints()
        }
 }
 
-void RS_ActionDrawLineParallelThrough::showOptions()
+void ActionDrawLineParallelThrough::showOptions()
 {
-       RS_ActionInterface::showOptions();
-
+       ActionInterface::showOptions();
        RS_DIALOGFACTORY->requestOptions(this, true);
        updateMouseButtonHints();
 }
 
-void RS_ActionDrawLineParallelThrough::hideOptions()
+void ActionDrawLineParallelThrough::hideOptions()
 {
-       RS_ActionInterface::hideOptions();
-
+       ActionInterface::hideOptions();
        RS_DIALOGFACTORY->requestOptions(this, false);
 }
 
-void RS_ActionDrawLineParallelThrough::commandEvent(RS_CommandEvent * e)
+void ActionDrawLineParallelThrough::commandEvent(RS_CommandEvent * e)
 {
        QString c = e->getCommand().toLower();
 
@@ -228,7 +211,8 @@ void RS_ActionDrawLineParallelThrough::commandEvent(RS_CommandEvent * e)
                }
                break;
 
-       case SetNumber: {
+       case SetNumber:
+       {
                bool ok;
                int n = c.toInt(&ok);
 
@@ -245,14 +229,14 @@ void RS_ActionDrawLineParallelThrough::commandEvent(RS_CommandEvent * e)
                RS_DIALOGFACTORY->requestOptions(this, true, true);
                setStatus(lastStatus);
        }
-       break;
+               break;
 
        default:
                break;
        }
 }
 
-QStringList RS_ActionDrawLineParallelThrough::getAvailableCommands()
+QStringList ActionDrawLineParallelThrough::getAvailableCommands()
 {
        QStringList cmd;
 
@@ -269,12 +253,12 @@ QStringList RS_ActionDrawLineParallelThrough::getAvailableCommands()
        return cmd;
 }
 
-void RS_ActionDrawLineParallelThrough::updateMouseCursor()
+void ActionDrawLineParallelThrough::updateMouseCursor()
 {
        graphicView->setMouseCursor(RS2::CadCursor);
 }
 
-void RS_ActionDrawLineParallelThrough::updateToolBar()
+void ActionDrawLineParallelThrough::updateToolBar()
 {
        if (getStatus() == SetPos && !isFinished())
                RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
@@ -282,13 +266,12 @@ void RS_ActionDrawLineParallelThrough::updateToolBar()
                RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarLines);
 }
 
-int RS_ActionDrawLineParallelThrough::getNumber()
+int ActionDrawLineParallelThrough::getNumber()
 {
        return number;
 }
 
-void RS_ActionDrawLineParallelThrough::setNumber(int n)
+void ActionDrawLineParallelThrough::setNumber(int n)
 {
        number = n;
 }
-