X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Factions%2Factiondrawarc.cpp;h=a833e58caa481b42c94fa5de44c60a253e194b5a;hb=2ee84c5948ede7fc2f7b4435c5edef42a030ac05;hp=8782be83759c308894f9b216a8221425f8e357b8;hpb=865303923fcb231a171992b75a73364ff469ff8c;p=architektonas diff --git a/src/actions/actiondrawarc.cpp b/src/actions/actiondrawarc.cpp index 8782be8..a833e58 100644 --- a/src/actions/actiondrawarc.cpp +++ b/src/actions/actiondrawarc.cpp @@ -16,13 +16,14 @@ #include "actiondrawarc.h" -#include "rs_commandevent.h" +#include "commandevent.h" #include "commands.h" -#include "rs_dialogfactory.h" +#include "debug.h" +#include "dialogfactory.h" #include "graphicview.h" -#include "rs_preview.h" +#include "preview.h" -ActionDrawArc::ActionDrawArc(RS_EntityContainer & container, GraphicView & graphicView): +ActionDrawArc::ActionDrawArc(EntityContainer & container, GraphicView & graphicView): ActionInterface("Draw arcs", container, graphicView) { reset(); @@ -40,9 +41,9 @@ RS2::ActionType ActionDrawArc::rtti() void ActionDrawArc::reset() { if (data.reversed) - data = RS_ArcData(Vector(false), 0.0, 2 * M_PI, 0.0, true); + data = ArcData(Vector(false), 0.0, 2 * M_PI, 0.0, true); else - data = RS_ArcData(Vector(false), 0.0, 0.0, 2 * M_PI, false); + data = ArcData(Vector(false), 0.0, 0.0, 2 * M_PI, false); } void ActionDrawArc::init(int status) @@ -55,7 +56,7 @@ void ActionDrawArc::trigger() { ActionInterface::trigger(); - RS_Arc * arc = new RS_Arc(container, data); + Arc * arc = new Arc(container, data); arc->setLayerToActive(); arc->setPenToActive(); container->addEntity(arc); @@ -77,12 +78,12 @@ void ActionDrawArc::trigger() setStatus(SetCenter); reset(); - RS_DEBUG->print("ActionDrawArc::trigger(): arc added: %d", arc->getId()); + DEBUG->print("ActionDrawArc::trigger(): arc added: %d", arc->getId()); } void ActionDrawArc::mouseMoveEvent(QMouseEvent * e) { - RS_DEBUG->print("ActionDrawArc::mouseMoveEvent begin"); + DEBUG->print("ActionDrawArc::mouseMoveEvent begin"); Vector mouse = snapPoint(e); switch (getStatus()) @@ -98,7 +99,7 @@ void ActionDrawArc::mouseMoveEvent(QMouseEvent * e) data.radius = data.center.distanceTo(mouse); deletePreview(); clearPreview(); -// preview->addEntity(new RS_Circle(preview, RS_CircleData(data.center, data.radius))); +// preview->addEntity(new Circle(preview, CircleData(data.center, data.radius))); drawPreview(); } break; @@ -107,13 +108,13 @@ void ActionDrawArc::mouseMoveEvent(QMouseEvent * e) data.angle1 = data.center.angleTo(mouse); if (data.reversed) - data.angle2 = RS_Math::correctAngle(data.angle1 - M_PI / 3); + data.angle2 = Math::correctAngle(data.angle1 - M_PI / 3); else - data.angle2 = RS_Math::correctAngle(data.angle1 + M_PI / 3); + data.angle2 = Math::correctAngle(data.angle1 + M_PI / 3); deletePreview(); clearPreview(); -// preview->addEntity(new RS_Arc(preview, data)); +// preview->addEntity(new Arc(preview, data)); drawPreview(); break; @@ -121,7 +122,7 @@ void ActionDrawArc::mouseMoveEvent(QMouseEvent * e) data.angle2 = data.center.angleTo(mouse); deletePreview(); clearPreview(); -// preview->addEntity(new RS_Arc(preview, data)); +// preview->addEntity(new Arc(preview, data)); drawPreview(); break; @@ -129,7 +130,7 @@ void ActionDrawArc::mouseMoveEvent(QMouseEvent * e) data.angle2 = data.angle1 + data.center.angleTo(mouse); deletePreview(); clearPreview(); -// preview->addEntity(new RS_Arc(preview, data)); +// preview->addEntity(new Arc(preview, data)); drawPreview(); break; @@ -142,7 +143,7 @@ void ActionDrawArc::mouseMoveEvent(QMouseEvent * e) data.angle2 = data.angle1 + asin(x / (2 * data.radius)) * 2; deletePreview(); clearPreview(); -// preview->addEntity(new RS_Arc(preview, data)); +// preview->addEntity(new Arc(preview, data)); drawPreview(); } } @@ -152,7 +153,7 @@ void ActionDrawArc::mouseMoveEvent(QMouseEvent * e) break; } - RS_DEBUG->print("ActionDrawArc::mouseMoveEvent end"); + DEBUG->print("ActionDrawArc::mouseMoveEvent end"); } void ActionDrawArc::mouseReleaseEvent(QMouseEvent * e) @@ -226,25 +227,25 @@ void ActionDrawArc::coordinateEvent(Vector * e) } } -void ActionDrawArc::commandEvent(RS_CommandEvent * e) +void ActionDrawArc::commandEvent(CommandEvent * e) { QString c = e->getCommand().toLower(); - if (RS_COMMANDS->checkCommand("help", c)) + if (COMMANDS->checkCommand("help", c)) { - if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + if (DIALOGFACTORY != NULL) + DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); return; } - if (RS_COMMANDS->checkCommand("reversed", c)) + if (COMMANDS->checkCommand("reversed", c)) { e->accept(); setReversed(!isReversed()); - if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->requestOptions(this, true, true); + if (DIALOGFACTORY != NULL) + DIALOGFACTORY->requestOptions(this, true, true); return; } @@ -252,74 +253,74 @@ void ActionDrawArc::commandEvent(RS_CommandEvent * e) { case SetRadius: { bool ok; - double r = RS_Math::eval(c, &ok); + double r = Math::eval(c, &ok); if (ok == true) { data.radius = r; setStatus(SetAngle1); } - else if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); + else if (DIALOGFACTORY != NULL) + DIALOGFACTORY->commandMessage(tr("Not a valid expression")); } break; case SetAngle1: { bool ok; - double a = RS_Math::eval(c, &ok); + double a = Math::eval(c, &ok); if (ok == true) { - data.angle1 = RS_Math::deg2rad(a); + data.angle1 = Math::deg2rad(a); setStatus(SetAngle2); } - else if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); + else if (DIALOGFACTORY != NULL) + DIALOGFACTORY->commandMessage(tr("Not a valid expression")); } break; case SetAngle2: - if (RS_COMMANDS->checkCommand("angle", c)) + if (COMMANDS->checkCommand("angle", c)) setStatus(SetIncAngle); - else if (RS_COMMANDS->checkCommand("chord length", c)) + else if (COMMANDS->checkCommand("chord length", c)) setStatus(SetChordLength); else { bool ok; - double a = RS_Math::eval(c, &ok); + double a = Math::eval(c, &ok); if (ok == true) { - data.angle2 = RS_Math::deg2rad(a); + data.angle2 = Math::deg2rad(a); trigger(); } - else if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); + else if (DIALOGFACTORY != NULL) + DIALOGFACTORY->commandMessage(tr("Not a valid expression")); } break; case SetIncAngle: { bool ok; - double a = RS_Math::eval(c, &ok); + double a = Math::eval(c, &ok); if (ok == true) { - data.angle2 = data.angle1 + RS_Math::deg2rad(a); + data.angle2 = data.angle1 + Math::deg2rad(a); trigger(); } - else if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); + else if (DIALOGFACTORY != NULL) + DIALOGFACTORY->commandMessage(tr("Not a valid expression")); } break; case SetChordLength: { bool ok; - double l = RS_Math::eval(c, &ok); + double l = Math::eval(c, &ok); if (ok == true) { @@ -328,13 +329,13 @@ void ActionDrawArc::commandEvent(RS_CommandEvent * e) data.angle2 = data.angle1 + asin(l / (2 * data.radius)) * 2; trigger(); } - else if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->commandMessage( + else if (DIALOGFACTORY != NULL) + DIALOGFACTORY->commandMessage( tr("Not a valid chord length")); } - else if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); + else if (DIALOGFACTORY != NULL) + DIALOGFACTORY->commandMessage(tr("Not a valid expression")); } break; @@ -347,47 +348,47 @@ void ActionDrawArc::commandEvent(RS_CommandEvent * e) QStringList ActionDrawArc::getAvailableCommands() { QStringList cmd; - cmd += RS_COMMANDS->command("reversed"); + cmd += COMMANDS->command("reversed"); return cmd; } void ActionDrawArc::updateMouseButtonHints() { - if (RS_DIALOGFACTORY != NULL) + if (DIALOGFACTORY != NULL) { switch (getStatus()) { case SetCenter: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify center"), tr("Cancel")); + DIALOGFACTORY->updateMouseWidget(tr("Specify center"), tr("Cancel")); break; case SetRadius: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify radius"), tr("Back")); + DIALOGFACTORY->updateMouseWidget(tr("Specify radius"), tr("Back")); break; case SetAngle1: - RS_DIALOGFACTORY->updateMouseWidget( + DIALOGFACTORY->updateMouseWidget( tr("Specify start angle:"), tr("Back")); break; case SetAngle2: - RS_DIALOGFACTORY->updateMouseWidget( + DIALOGFACTORY->updateMouseWidget( tr("Specify end angle or [Angle/chord Length]"), tr("Back")); break; case SetIncAngle: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify included angle:"), + DIALOGFACTORY->updateMouseWidget(tr("Specify included angle:"), tr("Back")); break; case SetChordLength: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify chord length:"), + DIALOGFACTORY->updateMouseWidget(tr("Specify chord length:"), tr("Back")); break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } @@ -397,16 +398,16 @@ void ActionDrawArc::showOptions() { ActionInterface::showOptions(); - if (RS_DIALOGFACTORY) - RS_DIALOGFACTORY->requestOptions(this, true); + if (DIALOGFACTORY) + DIALOGFACTORY->requestOptions(this, true); } void ActionDrawArc::hideOptions() { ActionInterface::hideOptions(); - if (RS_DIALOGFACTORY) - RS_DIALOGFACTORY->requestOptions(this, false); + if (DIALOGFACTORY) + DIALOGFACTORY->requestOptions(this, false); } void ActionDrawArc::updateMouseCursor() @@ -416,13 +417,13 @@ void ActionDrawArc::updateMouseCursor() void ActionDrawArc::updateToolBar() { - if (!RS_DIALOGFACTORY) + if (!DIALOGFACTORY) return; if (!isFinished()) - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); + DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); else - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarArcs); + DIALOGFACTORY->requestToolBar(RS2::ToolBarArcs); } bool ActionDrawArc::isReversed()