X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Factions%2Factiondimaligned.cpp;h=cd3007639dc1ab645712b3593ae53a6b3a130bd5;hb=2ee84c5948ede7fc2f7b4435c5edef42a030ac05;hp=464d63a803ed8b9ad4e740c310626d349070949a;hpb=d774c2655ba2c3657a565f325411144452392277;p=architektonas diff --git a/src/actions/actiondimaligned.cpp b/src/actions/actiondimaligned.cpp index 464d63a..cd30076 100644 --- a/src/actions/actiondimaligned.cpp +++ b/src/actions/actiondimaligned.cpp @@ -3,7 +3,9 @@ // 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 // @@ -14,14 +16,15 @@ #include "actiondimaligned.h" -#include "rs_commandevent.h" -#include "rs_constructionline.h" -#include "rs_dialogfactory.h" +#include "commandevent.h" +#include "constructionline.h" +#include "debug.h" +#include "dialogfactory.h" #include "graphicview.h" -#include "rs_preview.h" -#include "rs_snapper.h" +#include "preview.h" +#include "snapper.h" -ActionDimAligned::ActionDimAligned(RS_EntityContainer & container, GraphicView & graphicView): ActionDimension("Draw aligned dimensions", +ActionDimAligned::ActionDimAligned(EntityContainer & container, GraphicView & graphicView): ActionDimension("Draw aligned dimensions", container, graphicView) { reset(); @@ -39,11 +42,11 @@ ActionDimAligned::~ActionDimAligned() void ActionDimAligned::reset() { ActionDimension::reset(); - edata = RS_DimAlignedData(Vector(false), Vector(false)); + edata = DimAlignedData(Vector(false), Vector(false)); lastStatus = SetExtPoint1; - if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->requestOptions(this, true, true); + if (DIALOGFACTORY != NULL) + DIALOGFACTORY->requestOptions(this, true, true); } void ActionDimAligned::trigger() @@ -53,7 +56,7 @@ void ActionDimAligned::trigger() graphicView->moveRelativeZero(data.definitionPoint); //data.text = getText(); - RS_DimAligned * dim = new RS_DimAligned(container, data, edata); + DimAligned * dim = new DimAligned(container, data, edata); dim->setLayerToActive(); dim->setPenToActive(); dim->update(); @@ -74,21 +77,21 @@ void ActionDimAligned::trigger() graphicView->moveRelativeZero(rz); drawSnapper(); - RS_DEBUG->print("ActionDimAligned::trigger(): dim added: %d", dim->getId()); + DEBUG->print("ActionDimAligned::trigger(): dim added: %d", dim->getId()); } void ActionDimAligned::preparePreview() { Vector dirV; dirV.setPolar(100.0, edata.extensionPoint1.angleTo(edata.extensionPoint2) + M_PI / 2.0); - RS_ConstructionLine cl(NULL, RS_ConstructionLineData(edata.extensionPoint2, + ConstructionLine cl(NULL, ConstructionLineData(edata.extensionPoint2, edata.extensionPoint2 + dirV)); data.definitionPoint = cl.getNearestPointOnEntity(data.definitionPoint); } void ActionDimAligned::mouseMoveEvent(QMouseEvent * e) { - RS_DEBUG->print("ActionDimAligned::mouseMoveEvent begin"); + DEBUG->print("ActionDimAligned::mouseMoveEvent begin"); Vector mouse = snapPoint(e); switch (getStatus()) @@ -102,7 +105,7 @@ void ActionDimAligned::mouseMoveEvent(QMouseEvent * e) { deletePreview(); clearPreview(); -// preview->addEntity(new RS_Line(preview, RS_LineData(edata.extensionPoint1, mouse))); +// preview->addEntity(new Line(preview, LineData(edata.extensionPoint1, mouse))); drawPreview(); } break; @@ -118,7 +121,7 @@ void ActionDimAligned::mouseMoveEvent(QMouseEvent * e) preparePreview(); //data.text = getText(); -// RS_DimAligned * dim = new RS_DimAligned(preview, data, edata); +// DimAligned * dim = new DimAligned(preview, data, edata); // dim->update(); // preview->addEntity(dim); drawPreview(); @@ -129,7 +132,7 @@ void ActionDimAligned::mouseMoveEvent(QMouseEvent * e) break; } - RS_DEBUG->print("ActionDimAligned::mouseMoveEvent end"); + DEBUG->print("ActionDimAligned::mouseMoveEvent end"); } void ActionDimAligned::mouseReleaseEvent(QMouseEvent * e) @@ -182,14 +185,14 @@ void ActionDimAligned::coordinateEvent(Vector * e) } } -void ActionDimAligned::commandEvent(RS_CommandEvent * e) +void ActionDimAligned::commandEvent(CommandEvent * e) { QString c = e->getCommand().toLower(); if (checkCommand("help", c)) { - if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + if (DIALOGFACTORY != NULL) + DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); return; @@ -200,8 +203,8 @@ void ActionDimAligned::commandEvent(RS_CommandEvent * e) case SetText: setText(c); - if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->requestOptions(this, true, true); + if (DIALOGFACTORY != NULL) + DIALOGFACTORY->requestOptions(this, true, true); setStatus(lastStatus); graphicView->enableCoordinateInput(); @@ -240,28 +243,28 @@ QStringList ActionDimAligned::getAvailableCommands() void ActionDimAligned::updateMouseButtonHints() { - if (RS_DIALOGFACTORY != NULL) + if (DIALOGFACTORY != NULL) { switch (getStatus()) { case SetExtPoint1: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify first extension line origin"), tr("Cancel")); + DIALOGFACTORY->updateMouseWidget(tr("Specify first extension line origin"), tr("Cancel")); break; case SetExtPoint2: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify second extension line origin"), tr("Back")); + DIALOGFACTORY->updateMouseWidget(tr("Specify second extension line origin"), tr("Back")); break; case SetDefPoint: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify dimension line location"), tr("Back")); + DIALOGFACTORY->updateMouseWidget(tr("Specify dimension line location"), tr("Back")); break; case SetText: - RS_DIALOGFACTORY->updateMouseWidget(tr("Enter dimension text:"), ""); + DIALOGFACTORY->updateMouseWidget(tr("Enter dimension text:"), ""); break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } @@ -269,8 +272,8 @@ void ActionDimAligned::updateMouseButtonHints() void ActionDimAligned::hideOptions() { - if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->requestOptions(this, false); + if (DIALOGFACTORY != NULL) + DIALOGFACTORY->requestOptions(this, false); ActionDimension::hideOptions(); } @@ -279,7 +282,7 @@ void ActionDimAligned::showOptions() { ActionDimension::showOptions(); - if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->requestOptions(this, true); + if (DIALOGFACTORY != NULL) + DIALOGFACTORY->requestOptions(this, true); }