]> Shamusworld >> Repos - architektonas/blobdiff - src/actions/actionmodifydeletefree.cpp
In the middle of major refactoring...
[architektonas] / src / actions / actionmodifydeletefree.cpp
similarity index 75%
rename from src/actions/rs_actionmodifydeletefree.cpp
rename to src/actions/actionmodifydeletefree.cpp
index 2a4c8bb72dc6a2ec4515724c2584267ca47efeb5..12cc39d68842ddd1ffb0ce414e04521907e13da3 100644 (file)
@@ -1,4 +1,4 @@
-// rs_actionmodifydeletefree.cpp
+// actionmodifydeletefree.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_actionmodifydeletefree.h"
+#include "actionmodifydeletefree.h"
 
 #include "rs_dialogfactory.h"
 #include "graphicview.h"
 #include "rs_polyline.h"
 #include "rs_undo.h"
 
-RS_ActionModifyDeleteFree::RS_ActionModifyDeleteFree(
-       RS_EntityContainer & container, GraphicView & graphicView):
-       RS_ActionInterface("Delete Entities Freehand",
-               container, graphicView)
+ActionModifyDeleteFree::ActionModifyDeleteFree(RS_EntityContainer & container,
+       GraphicView & graphicView):
+       ActionInterface("Delete Entities Freehand", container, graphicView)
 {
 }
 
-RS_ActionModifyDeleteFree::~RS_ActionModifyDeleteFree()
+ActionModifyDeleteFree::~ActionModifyDeleteFree()
 {
 }
 
-void RS_ActionModifyDeleteFree::init(int status)
+void ActionModifyDeleteFree::init(int status)
 {
-       RS_ActionInterface::init(status);
+       ActionInterface::init(status);
        polyline = NULL;
        e1 = e2 = NULL;
        v1 = v2 = Vector(false);
-       setSnapMode(RS2::SnapOnEntity);
+//     setSnapMode(RS2::SnapOnEntity);
 }
 
-void RS_ActionModifyDeleteFree::trigger()
+void ActionModifyDeleteFree::trigger()
 {
-       if (e1 != NULL && e2 != NULL)
+       if (e1 && e2)
        {
                RS_EntityContainer * parent = e2->getParent();
 
-               if (parent != NULL)
+               if (parent)
                {
                        if (parent->rtti() == RS2::EntityPolyline)
                        {
@@ -59,10 +58,7 @@ void RS_ActionModifyDeleteFree::trigger()
                                        RS_Polyline * pl1;
                                        RS_Polyline * pl2;
                                        RS_Modification m(*container);
-                                       m.splitPolyline(*polyline,
-                                               *e1, v1,
-                                               *e2, v2,
-                                               &pl1, &pl2);
+                                       m.splitPolyline(*polyline, *e1, v1, *e2, v2, &pl1, &pl2);
 
                                        if (document)
                                        {
@@ -95,7 +91,7 @@ void RS_ActionModifyDeleteFree::trigger()
                RS_DIALOGFACTORY->commandMessage(tr("One of the chosen entities is NULL"));
 }
 
-void RS_ActionModifyDeleteFree::mouseReleaseEvent(QMouseEvent * e)
+void ActionModifyDeleteFree::mouseReleaseEvent(QMouseEvent * e)
 {
        if (e->button() == Qt::RightButton)
                init(getStatus() - 1);
@@ -105,13 +101,14 @@ void RS_ActionModifyDeleteFree::mouseReleaseEvent(QMouseEvent * e)
                {
                case 0:
                        v1 = snapPoint(e);
-                       e1 = getKeyEntity();
+//                     e1 = getKeyEntity();
+                       e1 = graphicView->snapper.getKeyEntity();
 
-                       if (e1 != NULL)
+                       if (e1)
                        {
                                RS_EntityContainer * parent = e1->getParent();
 
-                               if (parent != NULL)
+                               if (parent)
                                {
                                        if (parent->rtti() == RS2::EntityPolyline)
                                        {
@@ -134,9 +131,10 @@ void RS_ActionModifyDeleteFree::mouseReleaseEvent(QMouseEvent * e)
 
                case 1:
                        v2 = snapPoint(e);
-                       e2 = getKeyEntity();
+//                     e2 = getKeyEntity();
+                       e2 = graphicView->snapper.getKeyEntity();
 
-                       if (e2 != NULL)
+                       if (e2)
                                trigger();
                        else
                                RS_DIALOGFACTORY->commandMessage(tr("Second entity is NULL"));
@@ -146,19 +144,18 @@ void RS_ActionModifyDeleteFree::mouseReleaseEvent(QMouseEvent * e)
        }
 }
 
-void RS_ActionModifyDeleteFree::updateMouseButtonHints()
+void ActionModifyDeleteFree::updateMouseButtonHints()
 {
        switch (getStatus())
        {
        case 0:
                RS_DIALOGFACTORY->updateMouseWidget(tr("Specify first break point "
-                               "on a polyline"), tr("Cancel"));
+                       "on a polyline"), tr("Cancel"));
                break;
 
        case 1:
                RS_DIALOGFACTORY->updateMouseWidget(tr("Specify second break point "
-                               "on the same polyline"),
-                       tr("Back"));
+                       "on the same polyline"), tr("Back"));
                break;
 
        default:
@@ -166,4 +163,3 @@ void RS_ActionModifyDeleteFree::updateMouseButtonHints()
                break;
        }
 }
-