// Part of the Architektonas Project
// Originally part of QCad Community Edition by Andrew Mustun
// Extensively rewritten and refactored by James L. Hammons
-// (C) 2010 Underground Software
+// Portions copyright (C) 2001-2003 RibbonSoft
+// Copyright (C) 2010 Underground Software
+// See the README and GPLv2 files for licensing and warranty information
//
// JLH = James L. Hammons <jlhamm@acm.org>
//
* container
* @return Pointer to the entity or NULL.
*/
-RS_Entity * RS_Snapper::catchEntity(const Vector& pos, RS2::ResolveLevel level)
+RS_Entity * RS_Snapper::catchEntity(const Vector & pos, RS2::ResolveLevel level)
{
RS_DEBUG->print("RS_Snapper::catchEntity");
return visible;
}
+/*
+We need to figure out how to kick the GraphicView out of this class. Perhaps we
+need to move the toGuiX/Y() functions into another class as static functions.
+Further inspection seems to rule this out as they are pretty well coupled to the
+GraphicView class... What to do?
+*/
void RS_Snapper::Draw(GraphicView * view, PaintInterface * painter)
{
- if (finished || !snapSpot.valid)
+ if (finished || !snapSpot.valid || !snapCoord.valid)
return;
//hm, I don't like graphicView kicking around in here, especially since it now
//lives inside GraphicView... How to !!! FIX !!!?
//We'll pass it in for now...
- if (snapCoord.valid)
+// if (snapCoord.valid)
+// {
+ // Snap point (need to make sure the brush is NULL!)
+// painter->setPen(RS_Pen(RS_Color(0, 127, 255), RS2::Width00, RS2::DashLine));
+ painter->setPen(RS_Pen(RS_Color(255, 127, 0), RS2::Width00, RS2::DashLine));
+ painter->drawCircle(view->toGui(snapCoord), 4);
+
+ // Crosshairs
+ if (showCrosshairs)
{
- // snap point
- painter->setPen(RS_Pen(RS_Color(0, 127, 255), RS2::Width00, RS2::DashLine));
- painter->drawCircle(view->toGui(snapCoord), 4);
-
- // crosshairs
- if (showCrosshairs)
- {
- painter->setPen(RS_Pen(RS_Color(0, 255, 255), RS2::Width00, RS2::DashLine));
- painter->drawLine(Vector(0, view->toGuiY(snapCoord.y)),
- Vector(view->getWidth(), view->toGuiY(snapCoord.y)));
- painter->drawLine(Vector(view->toGuiX(snapCoord.x), 0),
- Vector(view->toGuiX(snapCoord.x), view->getHeight()));
- }
+ painter->setPen(RS_Pen(RS_Color(0, 255, 255), RS2::Width00, RS2::DashLine));
+ painter->drawLine(Vector(0, view->toGuiY(snapCoord.y)),
+ Vector(view->getWidth(), view->toGuiY(snapCoord.y)));
+ painter->drawLine(Vector(view->toGuiX(snapCoord.x), 0),
+ Vector(view->toGuiX(snapCoord.x), view->getHeight()));
}
+// }
- if (snapCoord.valid && snapCoord != snapSpot)
+ if (/*snapCoord.valid &&*/ snapCoord != snapSpot)
{
painter->drawLine(view->toGui(snapSpot) + Vector(-5, 0),
view->toGui(snapSpot) + Vector(-1, 4));