]> Shamusworld >> Repos - architektonas/blobdiff - src/base/rs_snapper.cpp
In the middle of major refactoring...
[architektonas] / src / base / rs_snapper.cpp
index 542810eb427a2a1b3f8e4daaa953a7b63bf64f0b..bbc306cc736098748264ea3b8091b0696b7ba217 100644 (file)
@@ -20,7 +20,7 @@
 #include "graphicview.h"
 #include "rs_grid.h"
 #include "rs_information.h"
-#include "paintintf.h"
+#include "paintinterface.h"
 #include "settings.h"
 
 /**
@@ -79,6 +79,7 @@ void RS_Snapper::finish()
        finished = true;
 }
 
+//bleh
 void RS_Snapper::SetContainer(RS_EntityContainer * c)
 {
        container = c;
@@ -91,11 +92,10 @@ void RS_Snapper::SetGraphicView(GraphicView * v)
 }
 
 /**
- * @return Pointer to the entity which was the key entity for the
- * last successful snapping action. If the snap mode is "end point"
- * the key entity is the entity whos end point was caught.
- * If the snap mode didn't require an entity (e.g. free, grid) this
- * method will return NULL.
+ * @return Pointer to the entity which was the key entity for the last
+ * successful snapping action. If the snap mode is "end point" the key entity
+ * is the entity whos end point was caught. If the snap mode didn't require an
+ * entity (e.g. free, grid) this method will return NULL.
  */
 RS_Entity * RS_Snapper::getKeyEntity()
 {
@@ -133,8 +133,6 @@ void RS_Snapper::setSnapRange(int r)
 Vector RS_Snapper::snapPoint(QMouseEvent * e)
 {
        RS_DEBUG->print("RS_Snapper::snapPoint");
-
-//meh  deleteSnapper();
        snapSpot = Vector(false);
 
        if (!e)
@@ -183,8 +181,7 @@ Vector RS_Snapper::snapPoint(QMouseEvent * e)
                break;
        }
 
-       // handle snap restrictions that can be activated in addition
-       //   to the ones above:
+       // Handle snap restrictions that can be activated in addition to the ones above:
        switch (snapRes)
        {
        case RS2::RestrictOrthogonal:
@@ -202,9 +199,6 @@ Vector RS_Snapper::snapPoint(QMouseEvent * e)
                break;
        }
 
-//#warning "!!! THIS IS WHERE THE SNAPPER IS BEING DRAWN... !!!"
-//     drawSnapper();
-
        if (RS_DIALOGFACTORY)
                RS_DIALOGFACTORY->updateCoordinateWidget(snapCoord, snapCoord - graphicView->getRelativeZero());
 
@@ -394,8 +388,7 @@ Vector RS_Snapper::restrictOrthogonal(Vector coord)
 Vector RS_Snapper::restrictHorizontal(Vector coord)
 {
        Vector rz = graphicView->getRelativeZero();
-//     Vector ret = Vector(coord.x, rz.y);
-//     return ret;
+
        return Vector(coord.x, rz.y);
 }
 
@@ -409,8 +402,7 @@ Vector RS_Snapper::restrictHorizontal(Vector coord)
 Vector RS_Snapper::restrictVertical(Vector coord)
 {
        Vector rz = graphicView->getRelativeZero();
-//     Vector ret = Vector(rz.x, coord.y);
-//     return ret;
+
        return Vector(rz.x, coord.y);
 }
 
@@ -529,6 +521,7 @@ printf("RS_Snapper::deleteSnapper(): Using DEPRECATED function!!!\n");
  */
 void RS_Snapper::xorSnapper()
 {
+#warning "!!! RS_Snapper::xorSnapper() is DEPRECATED !!!"
 //Not completely true...
 //#warning "!!! xorSnapper() not working AT ALL !!!"
 #if 0
@@ -568,7 +561,7 @@ void RS_Snapper::xorSnapper()
                graphicView->destroyPainter();
                visible = !visible;
        }
-#else
+//#else
        if (finished || !snapSpot.valid || !graphicView)
                return;
 
@@ -583,24 +576,18 @@ void RS_Snapper::xorSnapper()
 
 void RS_Snapper::SetVisible(bool visibility/*= true*/)
 {
-//     graphicView->SetSnapperDraw(visibility);
        visible = visibility;
 }
 
 bool RS_Snapper::Visible(void)
 {
-//     graphicView->SetSnapperDraw(visibility);
        return visible;
 }
 
 void RS_Snapper::Draw(GraphicView * view, PaintInterface * painter)
 {
-//printf("RS_Snapper::Draw()...");
        if (finished || !snapSpot.valid)
                return;
-//printf("{D}\n");
-
-//meh  painter->setPreviewMode();
 
 //hm, I don't like graphicView kicking around in here, especially since it now
 //lives inside GraphicView... How to !!! FIX !!!?
@@ -608,9 +595,10 @@ void RS_Snapper::Draw(GraphicView * view, PaintInterface * painter)
        if (snapCoord.valid)
        {
                // snap point
+               painter->setPen(RS_Pen(RS_Color(0, 127, 255), RS2::Width00, RS2::DashLine));
                painter->drawCircle(view->toGui(snapCoord), 4);
 
-               // crosshairs:
+               // crosshairs
                if (showCrosshairs)
                {
                        painter->setPen(RS_Pen(RS_Color(0, 255, 255), RS2::Width00, RS2::DashLine));