X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fbase%2Frs_snapper.cpp;h=30e666436d46e44425ac8b54e636ccbc8aed9364;hb=97d3cdae07ec9788cf80e7905abfdb5d67a7747c;hp=bbc306cc736098748264ea3b8091b0696b7ba217;hpb=d774c2655ba2c3657a565f325411144452392277;p=architektonas diff --git a/src/base/rs_snapper.cpp b/src/base/rs_snapper.cpp index bbc306c..30e6664 100644 --- a/src/base/rs_snapper.cpp +++ b/src/base/rs_snapper.cpp @@ -114,11 +114,21 @@ void RS_Snapper::setSnapRestriction(RS2::SnapRestriction snapRes) this->snapRes = snapRes; } +RS2::SnapMode RS_Snapper::getSnapMode(void) +{ + return snapMode; +} + +RS2::SnapRestriction RS_Snapper::getSnapRestriction(void) +{ + return snapRes; +} + /** -* Sets the snap range in pixels for catchEntity(). -* -* @see catchEntity() -*/ + * Sets the snap range in pixels for catchEntity(). + * + * @see catchEntity() + */ void RS_Snapper::setSnapRange(int r) { snapRange = r; @@ -228,7 +238,7 @@ Vector RS_Snapper::snapFree(Vector coord) Vector RS_Snapper::snapEndpoint(Vector coord) { Vector vec(false); - vec = container->getNearestEndpoint(coord, NULL/*, &keyEntity*/); + vec = container->getNearestEndpoint(coord, NULL); return vec; } @@ -462,7 +472,8 @@ RS_Entity * RS_Snapper::catchEntity(QMouseEvent * e, RS2::ResolveLevel level) */ /*virtual*/ void RS_Snapper::suspend() { - deleteSnapper(); +#warning "!!! This may need to have SetVisibility() called !!!" +// deleteSnapper(); snapSpot = snapCoord = Vector(false); } @@ -471,7 +482,8 @@ RS_Entity * RS_Snapper::catchEntity(QMouseEvent * e, RS2::ResolveLevel level) */ /*virtual*/ void RS_Snapper::resume() { - drawSnapper(); +#warning "!!! This may need to have SetVisibility() called !!!" +// drawSnapper(); } /** @@ -492,88 +504,6 @@ RS_Entity * RS_Snapper::catchEntity(QMouseEvent * e, RS2::ResolveLevel level) RS_DIALOGFACTORY->requestSnapDistOptions(distance, true); } -/** - * Draws the snapper on the screen. - */ -void RS_Snapper::drawSnapper() -{ -printf("RS_Snapper::drawSnapper(): Using DEPRECATED function!!!\n"); - if (!visible) - xorSnapper(); -} - -/** - * Deletes the snapper from the screen. - */ -void RS_Snapper::deleteSnapper() -{ -printf("RS_Snapper::deleteSnapper(): Using DEPRECATED function!!!\n"); - if (visible) - { - xorSnapper(); - snapSpot = Vector(false); - snapCoord = Vector(false); - } -} - -/** - * Draws / deletes the current snapper spot. - */ -void RS_Snapper::xorSnapper() -{ -#warning "!!! RS_Snapper::xorSnapper() is DEPRECATED !!!" -//Not completely true... -//#warning "!!! xorSnapper() not working AT ALL !!!" -#if 0 - if (!finished && snapSpot.valid) - { - RS_Painter * painter = graphicView->createDirectPainter(); - painter->setPreviewMode(); - - if (snapCoord.valid) - { - // snap point - painter->drawCircle(graphicView->toGui(snapCoord), 4); - - // crosshairs: - if (showCrosshairs == true) - { - painter->setPen(RS_Pen(RS_Color(0, 255, 255), RS2::Width00, RS2::DashLine)); - painter->drawLine(Vector(0, graphicView->toGuiY(snapCoord.y)), - Vector(graphicView->getWidth(), graphicView->toGuiY(snapCoord.y))); - painter->drawLine(Vector(graphicView->toGuiX(snapCoord.x), 0), - Vector(graphicView->toGuiX(snapCoord.x), graphicView->getHeight())); - } - } - - if (snapCoord.valid && snapCoord != snapSpot) - { - painter->drawLine(graphicView->toGui(snapSpot) + Vector(-5, 0), - graphicView->toGui(snapSpot) + Vector(-1, 4)); - painter->drawLine(graphicView->toGui(snapSpot) + Vector(0, 5), - graphicView->toGui(snapSpot) + Vector(4, 1)); - painter->drawLine(graphicView->toGui(snapSpot) + Vector(5, 0), - graphicView->toGui(snapSpot) + Vector(1, -4)); - painter->drawLine(graphicView->toGui(snapSpot) + Vector(0, -5), - graphicView->toGui(snapSpot) + Vector(-4, -1)); - } - - graphicView->destroyPainter(); - visible = !visible; - } -//#else - if (finished || !snapSpot.valid || !graphicView) - return; - - graphicView->SetSnapperDraw(true); - graphicView->SetSnapperVars(snapSpot, snapCoord, showCrosshairs); -//Apparently, this gets hit anyway by the preview code... -// graphicView->redraw(); - - visible = !visible; -#endif -} - void RS_Snapper::SetVisible(bool visibility/*= true*/) { visible = visibility;