]> Shamusworld >> Repos - architektonas/blobdiff - src/actions/actionblockscreate.cpp
In the middle of major refactoring...
[architektonas] / src / actions / actionblockscreate.cpp
similarity index 70%
rename from src/actions/rs_actionblockscreate.cpp
rename to src/actions/actionblockscreate.cpp
index 30e7a397c7abdfc82c94992e64ea174ff844329d..7b57aa7115324f89284fa4638e083fea38b19374 100644 (file)
@@ -1,4 +1,4 @@
-// rs_actionblockscreate.cpp
+// actionblockscreate.cpp
 //
 // Part of the Architektonas Project
 // Originally part of QCad Community Edition by Andrew Mustun
@@ -13,7 +13,7 @@
 // JLH  06/03/2010  Scrubbed out all occurances of RS_CoordinateEvent
 //
 
-#include "rs_actionblockscreate.h"
+#include "actionblockscreate.h"
 
 #include "rs_creation.h"
 #include "rs_dialogfactory.h"
 /**
  * Constructor.
  */
-RS_ActionBlocksCreate::RS_ActionBlocksCreate(RS_EntityContainer & container, GraphicView & graphicView): RS_PreviewActionInterface("Blocks Create", container, graphicView)
+ActionBlocksCreate::ActionBlocksCreate(RS_EntityContainer & container, GraphicView & graphicView): ActionInterface("Blocks Create", container, graphicView)
 {
        referencePoint = Vector(false);
 }
 
-RS_ActionBlocksCreate::~RS_ActionBlocksCreate()
+ActionBlocksCreate::~ActionBlocksCreate()
 {
 }
 
 #if 0
-QAction * RS_ActionBlocksCreate::createGUIAction(RS2::ActionType /*type*/, QObject * /*parent*/)
+QAction * ActionBlocksCreate::createGUIAction(RS2::ActionType /*type*/, QObject * /*parent*/)
 {
        QAction * action = new QAction(tr("&Create Block"), 0);
 //    QAction* action = new QAction(tr("Create Block"),
@@ -47,19 +47,19 @@ QAction * RS_ActionBlocksCreate::createGUIAction(RS2::ActionType /*type*/, QObje
 
 #endif
 
-/*virtual*/ RS2::ActionType RS_ActionBlocksCreate::rtti()
+/*virtual*/ RS2::ActionType ActionBlocksCreate::rtti()
 {
        return RS2::ActionBlocksCreate;
 }
 
-void RS_ActionBlocksCreate::init(int status)
+void ActionBlocksCreate::init(int status)
 {
-       RS_PreviewActionInterface::init(status);
+       ActionInterface::init(status);
 }
 
-void RS_ActionBlocksCreate::trigger()
+void ActionBlocksCreate::trigger()
 {
-       deleteSnapper();
+//     deleteSnapper();
        //deletePreview();
        //clearPreview();
 
@@ -91,9 +91,10 @@ void RS_ActionBlocksCreate::trigger()
        graphicView->killSelectActions();
 }
 
-void RS_ActionBlocksCreate::mouseMoveEvent(QMouseEvent * e)
+void ActionBlocksCreate::mouseMoveEvent(QMouseEvent * e)
 {
-       snapPoint(e);
+//     snapPoint(e);
+       graphicView->snapper.snapPoint(e);
 
        switch (getStatus())
        {
@@ -116,34 +117,29 @@ void RS_ActionBlocksCreate::mouseMoveEvent(QMouseEvent * e)
        }
 }
 
-void RS_ActionBlocksCreate::mouseReleaseEvent(QMouseEvent * e)
+void ActionBlocksCreate::mouseReleaseEvent(QMouseEvent * e)
 {
-//     if (e->button() == Qt::LeftButton)
        if (e->button() == Qt::LeftButton)
        {
 //             Vector ce(snapPoint(e));
-//             coordinateEvent(&ce);
-               Vector ce(snapPoint(e));
+               Vector ce(graphicView->snapper.snapPoint(e));
                coordinateEvent(&ce);
        }
-//     else if (e->button() == Qt::RightButton)
        else if (e->button() == Qt::RightButton)
        {
-               deleteSnapper();
+//             deleteSnapper();
                init(getStatus() - 1);
        }
 }
 
-//void RS_ActionBlocksCreate::coordinateEvent(Vector * e)
-void RS_ActionBlocksCreate::coordinateEvent(Vector * e)
+void ActionBlocksCreate::coordinateEvent(Vector * e)
 {
-       if (e == NULL)
+       if (!e)
                return;
 
        switch (getStatus())
        {
        case SetReferencePoint:
-//             referencePoint = e->getCoordinate();
                referencePoint = *e;
                trigger();
                break;
@@ -153,7 +149,7 @@ void RS_ActionBlocksCreate::coordinateEvent(Vector * e)
        }
 }
 
-void RS_ActionBlocksCreate::updateMouseButtonHints()
+void ActionBlocksCreate::updateMouseButtonHints()
 {
        switch (getStatus())
        {
@@ -167,12 +163,12 @@ void RS_ActionBlocksCreate::updateMouseButtonHints()
        }
 }
 
-void RS_ActionBlocksCreate::updateMouseCursor()
+void ActionBlocksCreate::updateMouseCursor()
 {
        graphicView->setMouseCursor(RS2::CadCursor);
 }
 
-void RS_ActionBlocksCreate::updateToolBar()
+void ActionBlocksCreate::updateToolBar()
 {
        if (!isFinished())
                RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);