]> Shamusworld >> Repos - architektonas/blobdiff - src/actions/actiondrawhatch.cpp
Bugfixes related to removing Snapper class.
[architektonas] / src / actions / actiondrawhatch.cpp
index a12530e9df1b9881508e583a5e91dea80fccdd60..a7fbe9a15bc287ff82dfafc153140465e04df726 100644 (file)
 
 #include "actiondrawhatch.h"
 
-#include "rs_debug.h"
-#include "rs_dialogfactory.h"
+#include "debug.h"
+#include "dialogfactory.h"
 #include "graphicview.h"
-#include "rs_information.h"
+#include "information.h"
 
-ActionDrawHatch::ActionDrawHatch(RS_EntityContainer & container, GraphicView & graphicView):
+ActionDrawHatch::ActionDrawHatch(EntityContainer & container, GraphicView & graphicView):
        ActionInterface("Draw Hatch", container, graphicView)
 {
        hatch = NULL;
@@ -34,13 +34,13 @@ ActionDrawHatch::~ActionDrawHatch()
 void ActionDrawHatch::init(int status)
 {
        ActionInterface::init(status);
-       clearPreview();
+//     clearPreview();
 
-       RS_Hatch tmp(container, data);
+       Hatch tmp(container, data);
        tmp.setLayerToActive();
        tmp.setPenToActive();
 
-       if (RS_DIALOGFACTORY->requestHatchDialog(&tmp))
+       if (DIALOGFACTORY->requestHatchDialog(&tmp))
        {
                data = tmp.getData();
                trigger();
@@ -53,10 +53,10 @@ void ActionDrawHatch::init(int status)
 
 void ActionDrawHatch::trigger()
 {
-       RS_DEBUG->print("ActionDrawHatch::trigger()");
+       DEBUG->print("ActionDrawHatch::trigger()");
 
-       deleteSnapper();
-       RS_Entity * e;
+//     deleteSnapper();
+       Entity * e;
 
        // deselect unhatchable entities:
        for(e=container->firstEntity(RS2::ResolveNone); e!=NULL;
@@ -66,7 +66,7 @@ void ActionDrawHatch::trigger()
                    && (e->rtti() == RS2::EntityHatch
                        || e->rtti() == RS2::EntityEllipse || e->rtti() == RS2::EntityPoint
                        || e->rtti() == RS2::EntityText
-                       || RS_Information::isDimension(e->rtti())))
+                       || Information::isDimension(e->rtti())))
                        e->setSelected(false);
        }
 
@@ -77,7 +77,7 @@ void ActionDrawHatch::trigger()
                        && (e->rtti() == RS2::EntityHatch
                        || e->rtti() == RS2::EntityEllipse || e->rtti() == RS2::EntityPoint
                        || e->rtti() == RS2::EntityText
-                       || RS_Information::isDimension(e->rtti())))
+                       || Information::isDimension(e->rtti())))
                        e->setSelected(false);
        }
 
@@ -95,14 +95,14 @@ void ActionDrawHatch::trigger()
                return;
        }
 
-       hatch = new RS_Hatch(container, data);
+       hatch = new Hatch(container, data);
        hatch->setLayerToActive();
        hatch->setPenToActive();
-       RS_EntityContainer * loop = new RS_EntityContainer(hatch);
-       loop->setPen(RS_Pen(RS2::FlagInvalid));
+       EntityContainer * loop = new EntityContainer(hatch);
+       loop->setPen(Pen(RS2::FlagInvalid));
 
        // add selected contour:
-       for(RS_Entity * e=container->firstEntity(RS2::ResolveAll); e!=NULL;
+       for(Entity * e=container->firstEntity(RS2::ResolveAll); e!=NULL;
             e=container->nextEntity(RS2::ResolveAll))
        {
                if (e->isSelected())
@@ -115,8 +115,8 @@ void ActionDrawHatch::trigger()
                                || e->getParent()->rtti() == RS2::EntityPolyline))
                                e->getParent()->setSelected(false);
 
-                       RS_Entity * cp = e->clone();
-                       cp->setPen(RS_Pen(RS2::FlagInvalid));
+                       Entity * cp = e->clone();
+                       cp->setPen(Pen(RS2::FlagInvalid));
                        cp->reparent(loop);
                        loop->addEntity(cp);
                }
@@ -136,37 +136,21 @@ void ActionDrawHatch::trigger()
                }
 
                hatch->update();
-               graphicView->drawEntity(hatch);
-               RS_DIALOGFACTORY->commandMessage(tr("Hatch created successfully."));
+               DIALOGFACTORY->commandMessage(tr("Hatch created successfully."));
        }
        else
        {
                delete hatch;
                hatch = NULL;
-               RS_DIALOGFACTORY->commandMessage(tr("Invalid hatch area. Please check that "
+               DIALOGFACTORY->commandMessage(tr("Invalid hatch area. Please check that "
                        "the entities chosen form one or more closed contours."));
        }
 }
 
 void ActionDrawHatch::mouseMoveEvent(QMouseEvent *)
 {
-       RS_DEBUG->print("ActionDrawHatch::mouseMoveEvent begin");
-
-       /*if (getStatus()==SetPos) {
-           Vector mouse = snapPoint(e);
-           pos = mouse;
-
-
-           deletePreview();
-           if (hatch!=NULL && !hatch->isVisible()) {
-               hatch->setVisible(true);
-           }
-           offset = Vector(graphicView->toGuiDX(pos.x),
-                              -graphicView->toGuiDY(pos.y));
-           drawPreview();
-          }*/
-
-       RS_DEBUG->print("ActionDrawHatch::mouseMoveEvent end");
+       DEBUG->print("ActionDrawHatch::mouseMoveEvent begin");
+       DEBUG->print("ActionDrawHatch::mouseMoveEvent end");
 }
 
 void ActionDrawHatch::mouseReleaseEvent(QMouseEvent * e)
@@ -186,15 +170,15 @@ void ActionDrawHatch::mouseReleaseEvent(QMouseEvent * e)
        }
        else if (e->button() == Qt::RightButton)
        {
-               //deletePreview();
-               deleteSnapper();
                init(getStatus() - 1);
+//doesn't clear the preview or snapper.
+               graphicView->redraw();  // hm.
        }
 }
 
 void ActionDrawHatch::updateMouseButtonHints()
 {
-       RS_DIALOGFACTORY->updateMouseWidget("", "");
+       DIALOGFACTORY->updateMouseWidget("", "");
 }
 
 void ActionDrawHatch::updateMouseCursor()
@@ -204,5 +188,5 @@ void ActionDrawHatch::updateMouseCursor()
 
 void ActionDrawHatch::updateToolBar()
 {
-       RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarMain);
+       DIALOGFACTORY->requestToolBar(RS2::ToolBarMain);
 }