]> Shamusworld >> Repos - architektonas/blobdiff - src/actions/actionmodifydeletefree.cpp
Bugfixes related to removing Snapper class.
[architektonas] / src / actions / actionmodifydeletefree.cpp
index 12cc39d68842ddd1ffb0ce414e04521907e13da3..434d7d5686eff0a273c379d7066e83b604912999 100644 (file)
@@ -3,7 +3,9 @@
 // Part of the Architektonas Project
 // Originally part of QCad Community Edition by Andrew Mustun
 // Extensively rewritten and refactored by James L. Hammons
-// (C) 2010 Underground Software
+// Portions copyright (C) 2001-2003 RibbonSoft
+// Copyright (C) 2010 Underground Software
+// See the README and GPLv2 files for licensing and warranty information
 //
 // JLH = James L. Hammons <jlhamm@acm.org>
 //
 
 #include "actionmodifydeletefree.h"
 
-#include "rs_dialogfactory.h"
+#include "dialogfactory.h"
 #include "graphicview.h"
-#include "rs_modification.h"
-#include "rs_polyline.h"
-#include "rs_undo.h"
+#include "modification.h"
+#include "polyline.h"
+#include "undo.h"
 
-ActionModifyDeleteFree::ActionModifyDeleteFree(RS_EntityContainer & container,
+ActionModifyDeleteFree::ActionModifyDeleteFree(EntityContainer & container,
        GraphicView & graphicView):
        ActionInterface("Delete Entities Freehand", container, graphicView)
 {
@@ -43,7 +45,7 @@ void ActionModifyDeleteFree::trigger()
 {
        if (e1 && e2)
        {
-               RS_EntityContainer * parent = e2->getParent();
+               EntityContainer * parent = e2->getParent();
 
                if (parent)
                {
@@ -51,13 +53,16 @@ void ActionModifyDeleteFree::trigger()
                        {
                                if (parent->getId() == polyline->getId())
                                {
+#warning "!!! Old rendering path need upgrade !!!"
+#if 0
                                        // deletes whole polyline on screen:
-                                       graphicView->deleteEntity((RS_Entity *)polyline);
+                                       graphicView->deleteEntity((Entity *)polyline);
+#endif
 
                                        // splits up the polyline in the container:
-                                       RS_Polyline * pl1;
-                                       RS_Polyline * pl2;
-                                       RS_Modification m(*container);
+                                       Polyline * pl1;
+                                       Polyline * pl2;
+                                       Modification m(*container);
                                        m.splitPolyline(*polyline, *e1, v1, *e2, v2, &pl1, &pl2);
 
                                        if (document)
@@ -70,25 +75,25 @@ void ActionModifyDeleteFree::trigger()
                                        }
 
                                        // draws the new polylines on the screen:
-                                       graphicView->drawEntity((RS_Entity *)pl1);
-                                       graphicView->drawEntity((RS_Entity *)pl2);
+                                       graphicView->drawEntity((Entity *)pl1);
+                                       graphicView->drawEntity((Entity *)pl2);
 
                                        init();
 
-                                       RS_DIALOGFACTORY->updateSelectionWidget(
+                                       DIALOGFACTORY->updateSelectionWidget(
                                                container->countSelected());
                                }
                                else
-                                       RS_DIALOGFACTORY->commandMessage(tr("Entities not in the same polyline."));
+                                       DIALOGFACTORY->commandMessage(tr("Entities not in the same polyline."));
                        }
                        else
-                               RS_DIALOGFACTORY->commandMessage(tr("Parent of second entity is not a polyline"));
+                               DIALOGFACTORY->commandMessage(tr("Parent of second entity is not a polyline"));
                }
                else
-                       RS_DIALOGFACTORY->commandMessage(tr("Parent of second entity is NULL"));
+                       DIALOGFACTORY->commandMessage(tr("Parent of second entity is NULL"));
        }
        else
-               RS_DIALOGFACTORY->commandMessage(tr("One of the chosen entities is NULL"));
+               DIALOGFACTORY->commandMessage(tr("One of the chosen entities is NULL"));
 }
 
 void ActionModifyDeleteFree::mouseReleaseEvent(QMouseEvent * e)
@@ -102,29 +107,29 @@ void ActionModifyDeleteFree::mouseReleaseEvent(QMouseEvent * e)
                case 0:
                        v1 = snapPoint(e);
 //                     e1 = getKeyEntity();
-                       e1 = graphicView->snapper.getKeyEntity();
+                       e1 = graphicView->GetSnapperEntity();
 
                        if (e1)
                        {
-                               RS_EntityContainer * parent = e1->getParent();
+                               EntityContainer * parent = e1->getParent();
 
                                if (parent)
                                {
                                        if (parent->rtti() == RS2::EntityPolyline)
                                        {
-                                               polyline = (RS_Polyline *)parent;
+                                               polyline = (Polyline *)parent;
                                                setStatus(1);
                                        }
                                        else
-                                               RS_DIALOGFACTORY->commandMessage(
+                                               DIALOGFACTORY->commandMessage(
                                                        tr("Parent of first entity is not a polyline"));
                                }
                                else
-                                       RS_DIALOGFACTORY->commandMessage(
+                                       DIALOGFACTORY->commandMessage(
                                                tr("Parent of first entity is NULL"));
                        }
                        else
-                               RS_DIALOGFACTORY->commandMessage(
+                               DIALOGFACTORY->commandMessage(
                                        tr("First entity is NULL"));
 
                        break;
@@ -132,12 +137,12 @@ void ActionModifyDeleteFree::mouseReleaseEvent(QMouseEvent * e)
                case 1:
                        v2 = snapPoint(e);
 //                     e2 = getKeyEntity();
-                       e2 = graphicView->snapper.getKeyEntity();
+                       e2 = graphicView->GetSnapperEntity();
 
                        if (e2)
                                trigger();
                        else
-                               RS_DIALOGFACTORY->commandMessage(tr("Second entity is NULL"));
+                               DIALOGFACTORY->commandMessage(tr("Second entity is NULL"));
 
                        break;
                }
@@ -149,17 +154,17 @@ void ActionModifyDeleteFree::updateMouseButtonHints()
        switch (getStatus())
        {
        case 0:
-               RS_DIALOGFACTORY->updateMouseWidget(tr("Specify first break point "
+               DIALOGFACTORY->updateMouseWidget(tr("Specify first break point "
                        "on a polyline"), tr("Cancel"));
                break;
 
        case 1:
-               RS_DIALOGFACTORY->updateMouseWidget(tr("Specify second break point "
+               DIALOGFACTORY->updateMouseWidget(tr("Specify second break point "
                        "on the same polyline"), tr("Back"));
                break;
 
        default:
-               RS_DIALOGFACTORY->updateMouseWidget("", "");
+               DIALOGFACTORY->updateMouseWidget("", "");
                break;
        }
 }