]> Shamusworld >> Repos - architektonas/blobdiff - src/base/rs_snapper.cpp
Check in prior to mucking around with preview/snapper rendering...
[architektonas] / src / base / rs_snapper.cpp
index 9505d6b3b8bc2993ebba465a7b2ca918a28d9082..13d76a92da0e4642819569af28793c790a753fcd 100644 (file)
@@ -183,7 +183,7 @@ Vector RS_Snapper::snapPoint(QMouseEvent * e)
 #warning "!!! THIS IS WHERE THE SNAPPER IS BEING DRAWN... !!!"
        drawSnapper();
 
-       if (RS_DIALOGFACTORY != NULL)
+       if (RS_DIALOGFACTORY)
                RS_DIALOGFACTORY->updateCoordinateWidget(snapCoord, snapCoord - graphicView->getRelativeZero());
 
        RS_DEBUG->print("RS_Snapper::snapPoint: OK");
@@ -409,10 +409,10 @@ RS_Entity * RS_Snapper::catchEntity(const Vector& pos, RS2::ResolveLevel level)
 
        int idx = -1;
 
-       if (entity != NULL && entity->getParent() != NULL)
+       if (entity && entity->getParent())
                idx = entity->getParent()->findEntity(entity);
 
-       if (entity != NULL && dist <= graphicView->toGraphDX(snapRange))
+       if (entity && dist <= graphicView->toGraphDX(snapRange))
        {
                // highlight:
                RS_DEBUG->print("RS_Snapper::catchEntity: found: %d", idx);
@@ -425,7 +425,7 @@ RS_Entity * RS_Snapper::catchEntity(const Vector& pos, RS2::ResolveLevel level)
        }
 
        RS_DEBUG->print("RS_Snapper::catchEntity: OK");
-       }
+}
 
 /**
  * Catches an entity which is close to the mouse cursor.
@@ -463,9 +463,8 @@ void RS_Snapper::resume()
  */
 void RS_Snapper::hideOptions()
 {
-       if (snapMode == RS2::SnapDist)
-               if (RS_DIALOGFACTORY != NULL)
-                       RS_DIALOGFACTORY->requestSnapDistOptions(distance, false);
+       if (snapMode == RS2::SnapDist && RS_DIALOGFACTORY)
+               RS_DIALOGFACTORY->requestSnapDistOptions(distance, false);
 }
 
 /**
@@ -473,9 +472,8 @@ void RS_Snapper::hideOptions()
  */
 void RS_Snapper::showOptions()
 {
-       if (snapMode == RS2::SnapDist)
-               if (RS_DIALOGFACTORY != NULL)
-                       RS_DIALOGFACTORY->requestSnapDistOptions(distance, true);
+       if (snapMode == RS2::SnapDist && RS_DIALOGFACTORY)
+               RS_DIALOGFACTORY->requestSnapDistOptions(distance, true);
 }
 
 /**
@@ -483,6 +481,7 @@ void RS_Snapper::showOptions()
  */
 void RS_Snapper::drawSnapper()
 {
+printf("RS_Snapper::drawSnapper(): Using DEPRECATED function!!!\n");
        if (!visible)
                xorSnapper();
 }
@@ -492,6 +491,7 @@ void RS_Snapper::drawSnapper()
  */
 void RS_Snapper::deleteSnapper()
 {
+printf("RS_Snapper::deleteSnapper(): Using DEPRECATED function!!!\n");
        if (visible)
        {
                xorSnapper();
@@ -556,3 +556,15 @@ void RS_Snapper::xorSnapper()
        visible = !visible;
 #endif
 }
+
+void RS_Snapper::SetSnapperVisible(bool visibility/*= true*/)
+{
+       graphicView->SetSnapperDraw(visibility);
+}
+
+//Hmm, not sure this is necessary...
+#warning "!!! Not sure this is necessary... !!!"
+void RS_Snapper::SetSnapperCoords(Vector snapCoord, Vector snapSpot)
+{
+       graphicView->SetSnapperVars(snapSpot, snapCoord, showCrosshairs);
+}