X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Factions%2Factiondrawlineangle.cpp;h=22e06718a017be1bdb48d9b9fe8790f20a88d644;hb=5adb444f3e523d3fd028617ced72d1ea6661db21;hp=e0c1d6839327872f05e89cebc36395e4f0657ae0;hpb=1f0d096a7fc370ff02477f3860beae2669bf8903;p=architektonas diff --git a/src/actions/actiondrawlineangle.cpp b/src/actions/actiondrawlineangle.cpp index e0c1d68..22e0671 100644 --- a/src/actions/actiondrawlineangle.cpp +++ b/src/actions/actiondrawlineangle.cpp @@ -17,23 +17,18 @@ #include "actiondrawlineangle.h" -#include "rs_commandevent.h" -#include "rs_debug.h" -#include "rs_dialogfactory.h" +#include "commandevent.h" +#include "debug.h" +#include "dialogfactory.h" #include "graphicview.h" -#include "rs_preview.h" +#include "preview.h" -ActionDrawLineAngle::ActionDrawLineAngle(RS_EntityContainer & container, +ActionDrawLineAngle::ActionDrawLineAngle(EntityContainer & container, GraphicView & graphicView, double a, bool fa): ActionInterface("Draw lines with given angle", container, graphicView), pos(Vector(false)), angle(a), length(1.0), fixedAngle(fa), snpPoint(0) { reset(); - //hm. -// graphicView.snapper.SetContainer(&container); -// graphicView.snapper.SetGraphicView(&graphicView); -// graphicView.snapper.SetVisible(); -// graphicView.preview.SetVisible(); } ActionDrawLineAngle::~ActionDrawLineAngle() @@ -47,7 +42,7 @@ ActionDrawLineAngle::~ActionDrawLineAngle() void ActionDrawLineAngle::reset() { - data = RS_LineData(Vector(false), Vector(false)); + data = LineData(Vector(false), Vector(false)); } void ActionDrawLineAngle::init(int status) @@ -60,7 +55,7 @@ void ActionDrawLineAngle::trigger() { ActionInterface::trigger(); preparePreview(); - RS_Line * line = new RS_Line(container, data); + Line * line = new Line(container, data); line->setLayerToActive(); line->setPenToActive(); container->addEntity(line); @@ -78,12 +73,12 @@ void ActionDrawLineAngle::trigger() graphicView->drawEntity(line); graphicView->moveRelativeZero(data.startpoint); graphicView->redraw(); - RS_DEBUG->print("ActionDrawLineAngle::trigger(): line added: %d", line->getId()); + DEBUG->print("ActionDrawLineAngle::trigger(): line added: %d", line->getId()); } void ActionDrawLineAngle::mouseMoveEvent(QMouseEvent * e) { - RS_DEBUG->print("ActionDrawLineAngle::mouseMoveEvent begin"); + DEBUG->print("ActionDrawLineAngle::mouseMoveEvent begin"); if (getStatus() == SetPos) { @@ -91,15 +86,15 @@ void ActionDrawLineAngle::mouseMoveEvent(QMouseEvent * e) // deletePreview(); // clearPreview(); // preparePreview(); -// preview->addEntity(new RS_Line(preview, data)); +// preview->addEntity(new Line(preview, data)); // drawPreview(); preparePreview(); graphicView->preview.clear(); - graphicView->preview.addEntity(new RS_Line(&(graphicView->preview), data)); + graphicView->preview.addEntity(new Line(&(graphicView->preview), data)); } graphicView->redraw(); - RS_DEBUG->print("ActionDrawLineAngle::mouseMoveEvent end"); + DEBUG->print("ActionDrawLineAngle::mouseMoveEvent end"); } void ActionDrawLineAngle::mouseReleaseEvent(QMouseEvent * e) @@ -109,7 +104,7 @@ void ActionDrawLineAngle::mouseReleaseEvent(QMouseEvent * e) if (getStatus() == SetPos) { // Vector ce(snapPoint(e)); - Vector ce(graphicView->snapper.snapPoint(e)); + Vector ce(graphicView->SnapPoint(e)); coordinateEvent(&ce); } } @@ -141,7 +136,7 @@ void ActionDrawLineAngle::preparePreview() p1 = pos; p2 += p1; - data = RS_LineData(p1, p2); + data = LineData(p1, p2); } void ActionDrawLineAngle::coordinateEvent(Vector * e) @@ -161,13 +156,13 @@ void ActionDrawLineAngle::coordinateEvent(Vector * e) } } -void ActionDrawLineAngle::commandEvent(RS_CommandEvent * e) +void ActionDrawLineAngle::commandEvent(CommandEvent * e) { QString c = e->getCommand().toLower(); if (checkCommand("help", c)) { - RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); return; } @@ -194,14 +189,14 @@ void ActionDrawLineAngle::commandEvent(RS_CommandEvent * e) case SetAngle: { bool ok; - double a = RS_Math::eval(c, &ok); + double a = Math::eval(c, &ok); if (ok) - angle = RS_Math::deg2rad(a); + angle = Math::deg2rad(a); else - RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); + DIALOGFACTORY->commandMessage(tr("Not a valid expression")); - RS_DIALOGFACTORY->requestOptions(this, true, true); + DIALOGFACTORY->requestOptions(this, true, true); setStatus(SetPos); } break; @@ -209,14 +204,14 @@ void ActionDrawLineAngle::commandEvent(RS_CommandEvent * e) case SetLength: { bool ok; - double l = RS_Math::eval(c, &ok); + double l = Math::eval(c, &ok); if (ok) length = l; else - RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); + DIALOGFACTORY->commandMessage(tr("Not a valid expression")); - RS_DIALOGFACTORY->requestOptions(this, true, true); + DIALOGFACTORY->requestOptions(this, true, true); setStatus(SetPos); } break; @@ -251,15 +246,15 @@ void ActionDrawLineAngle::updateMouseButtonHints() switch (getStatus()) { case SetPos: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify position"), tr("Cancel")); + DIALOGFACTORY->updateMouseWidget(tr("Specify position"), tr("Cancel")); break; case SetAngle: - RS_DIALOGFACTORY->updateMouseWidget(tr("Enter angle:"), tr("Back")); + DIALOGFACTORY->updateMouseWidget(tr("Enter angle:"), tr("Back")); break; case SetLength: - RS_DIALOGFACTORY->updateMouseWidget(tr("Enter length:"), tr("Back")); + DIALOGFACTORY->updateMouseWidget(tr("Enter length:"), tr("Back")); break; default: @@ -270,13 +265,13 @@ void ActionDrawLineAngle::updateMouseButtonHints() void ActionDrawLineAngle::showOptions() { ActionInterface::showOptions(); - RS_DIALOGFACTORY->requestOptions(this, true); + DIALOGFACTORY->requestOptions(this, true); } void ActionDrawLineAngle::hideOptions() { ActionInterface::hideOptions(); - RS_DIALOGFACTORY->requestOptions(this, false); + DIALOGFACTORY->requestOptions(this, false); } void ActionDrawLineAngle::updateMouseCursor() @@ -287,9 +282,9 @@ void ActionDrawLineAngle::updateMouseCursor() void ActionDrawLineAngle::updateToolBar() { if (!isFinished()) - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); + DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); else - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarLines); + DIALOGFACTORY->requestToolBar(RS2::ToolBarLines); } void ActionDrawLineAngle::setSnapPoint(int sp)