X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Factions%2Factiondrawcircle3p.cpp;h=a20d8f49d533a6fc5269bf5f329d684dbabc6458;hb=e1d1cacbb43055988d0d9db632fdf05c0bea9543;hp=7985bb5ebdb96d6f49028bbd6a82296644c94b7e;hpb=d774c2655ba2c3657a565f325411144452392277;p=architektonas diff --git a/src/actions/actiondrawcircle3p.cpp b/src/actions/actiondrawcircle3p.cpp index 7985bb5..a20d8f4 100644 --- a/src/actions/actiondrawcircle3p.cpp +++ b/src/actions/actiondrawcircle3p.cpp @@ -3,25 +3,28 @@ // 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 // // Who When What // --- ---------- ----------------------------------------------------------- // JLH 06/03/2010 Added this text. :-) +// JLH 09/11/2010 Fixed preview/snapper rendering. // #include "actiondrawcircle3p.h" -#include "rs_commandevent.h" -#include "rs_dialogfactory.h" +#include "commandevent.h" +#include "dialogfactory.h" #include "graphicview.h" -#include "rs_preview.h" +#include "preview.h" -ActionDrawCircle3P::ActionDrawCircle3P(RS_EntityContainer & container, - GraphicView & graphicView): ActionInterface("Draw circles", - container, graphicView) +ActionDrawCircle3P::ActionDrawCircle3P(EntityContainer & container, + GraphicView & graphicView): + ActionInterface("Draw circles", container, graphicView) { reset(); } @@ -48,12 +51,11 @@ void ActionDrawCircle3P::init(int status) void ActionDrawCircle3P::trigger() { ActionInterface::trigger(); - preparePreview(); if (data.isValid()) { - RS_Circle * circle = new RS_Circle(container, data); + Circle * circle = new Circle(container, data); circle->setLayerToActive(); circle->setPenToActive(); container->addEntity(circle); @@ -66,18 +68,20 @@ void ActionDrawCircle3P::trigger() 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 - RS_DIALOGFACTORY->requestWarningDialog(tr("Invalid circle data.")); + DIALOGFACTORY->requestWarningDialog(tr("Invalid circle data.")); } void ActionDrawCircle3P::preparePreview() @@ -86,7 +90,7 @@ void ActionDrawCircle3P::preparePreview() if (point1.valid && point2.valid && point3.valid) { - RS_Circle circle(NULL, data); + Circle circle(NULL, data); bool success = circle.createFrom3P(point1, point2, point3); if (success) @@ -114,15 +118,19 @@ void ActionDrawCircle3P::mouseMoveEvent(QMouseEvent * e) if (data.isValid()) { -// RS_Circle * circle = new RS_Circle(preview, data); -// +// Circle * circle = new Circle(preview, data); // deletePreview(); // clearPreview(); // preview->addEntity(circle); // drawPreview(); + graphicView->preview.clear(); + graphicView->preview.addEntity(new Circle(&(graphicView->preview), data)); } + break; } + + graphicView->redraw(); } void ActionDrawCircle3P::mouseReleaseEvent(QMouseEvent * e) @@ -134,9 +142,10 @@ void ActionDrawCircle3P::mouseReleaseEvent(QMouseEvent * e) } else if (e->button() == Qt::RightButton) { - deletePreview(); - deleteSnapper(); +// deletePreview(); +// deleteSnapper(); init(getStatus() - 1); + graphicView->redraw(); // hm. } } @@ -171,13 +180,13 @@ void ActionDrawCircle3P::coordinateEvent(Vector * e) } } -void ActionDrawCircle3P::commandEvent(RS_CommandEvent * e) +void ActionDrawCircle3P::commandEvent(CommandEvent * e) { QString c = e->getCommand().toLower(); if (checkCommand("help", c)) { - RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); return; } @@ -194,19 +203,19 @@ void ActionDrawCircle3P::updateMouseButtonHints() switch (getStatus()) { case SetPoint1: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify first point"), tr("Cancel")); + DIALOGFACTORY->updateMouseWidget(tr("Specify first point"), tr("Cancel")); break; case SetPoint2: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify second point"), tr("Back")); + DIALOGFACTORY->updateMouseWidget(tr("Specify second point"), tr("Back")); break; case SetPoint3: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify third point"), tr("Back")); + DIALOGFACTORY->updateMouseWidget(tr("Specify third point"), tr("Back")); break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } @@ -219,7 +228,7 @@ void ActionDrawCircle3P::updateMouseCursor() void ActionDrawCircle3P::updateToolBar() { if (!isFinished()) - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); + DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); else - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarCircles); + DIALOGFACTORY->requestToolBar(RS2::ToolBarCircles); }