X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Factions%2Factiondrawcircle2p.cpp;h=676db76006406b822195676f43652fbb4fe0b510;hb=e1d1cacbb43055988d0d9db632fdf05c0bea9543;hp=d580bb33f7e30aca5369e0c894b9f4aa8810fea4;hpb=16354e0421b316a62c6b9f7b0b4f3b8cf6f06284;p=architektonas diff --git a/src/actions/actiondrawcircle2p.cpp b/src/actions/actiondrawcircle2p.cpp index d580bb3..676db76 100644 --- a/src/actions/actiondrawcircle2p.cpp +++ b/src/actions/actiondrawcircle2p.cpp @@ -12,6 +12,7 @@ // Who When What // --- ---------- ----------------------------------------------------------- // JLH 06/03/2010 Added this text. :-) +// JLH 09/11/2010 Fixed preview/snapper rendering. // #include "actiondrawcircle2p.h" @@ -21,8 +22,9 @@ #include "graphicview.h" #include "preview.h" -ActionDrawCircle2P::ActionDrawCircle2P(EntityContainer & container, GraphicView & graphicView): ActionInterface("Draw circles", - container, graphicView) +ActionDrawCircle2P::ActionDrawCircle2P(EntityContainer & container, + GraphicView & graphicView): + ActionInterface("Draw circles", container, graphicView) { reset(); } @@ -41,14 +43,12 @@ void ActionDrawCircle2P::reset() void ActionDrawCircle2P::init(int status) { ActionInterface::init(status); - reset(); } void ActionDrawCircle2P::trigger() { ActionInterface::trigger(); - preparePreview(); if (data.isValid()) @@ -59,24 +59,26 @@ void ActionDrawCircle2P::trigger() container->addEntity(circle); // upd. undo list: - if (document != NULL) + if (document) { document->startUndoCycle(); document->addUndoable(circle); document->endUndoCycle(); } - deleteSnapper(); - Vector rz = graphicView->getRelativeZero(); - graphicView->moveRelativeZero(Vector(0.0, 0.0)); - graphicView->drawEntity(circle); - graphicView->moveRelativeZero(rz); - drawSnapper(); +// deleteSnapper(); +// Vector rz = graphicView->getRelativeZero(); +// graphicView->moveRelativeZero(Vector(0.0, 0.0)); +// graphicView->drawEntity(circle); +// graphicView->moveRelativeZero(rz); +// drawSnapper(); + graphicView->preview.clear(); // hm. + graphicView->redraw(); setStatus(SetPoint1); reset(); } - else if (DIALOGFACTORY != NULL) + else if (DIALOGFACTORY) DIALOGFACTORY->requestWarningDialog(tr("Invalid Circle data.")); } @@ -87,9 +89,9 @@ void ActionDrawCircle2P::preparePreview() if (point1.valid && point2.valid) { Circle circle(NULL, data); - bool suc = circle.createFrom2P(point1, point2); + bool success = circle.createFrom2P(point1, point2); - if (suc) + if (success) data = circle.getData(); } } @@ -115,12 +117,16 @@ void ActionDrawCircle2P::mouseMoveEvent(QMouseEvent * e) // clearPreview(); // preview->addEntity(circle); // drawPreview(); + graphicView->preview.clear(); + graphicView->preview.addEntity(new Circle(&(graphicView->preview), data)); } break; default: break; } + + graphicView->redraw(); } void ActionDrawCircle2P::mouseReleaseEvent(QMouseEvent * e) @@ -132,9 +138,10 @@ void ActionDrawCircle2P::mouseReleaseEvent(QMouseEvent * e) } else if (e->button() == Qt::RightButton) { - deletePreview(); - deleteSnapper(); +// deletePreview(); +// deleteSnapper(); init(getStatus() - 1); + graphicView->redraw(); } }