X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Factions%2Factionmodifyround.cpp;h=38fd7c0dece20f981e3a66ae4ba3f0b1b17c7290;hb=2ee84c5948ede7fc2f7b4435c5edef42a030ac05;hp=4eb96d436537b0fa61eba3c85356a9ba3a978b82;hpb=d774c2655ba2c3657a565f325411144452392277;p=architektonas diff --git a/src/actions/actionmodifyround.cpp b/src/actions/actionmodifyround.cpp index 4eb96d4..38fd7c0 100644 --- a/src/actions/actionmodifyround.cpp +++ b/src/actions/actionmodifyround.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,12 +16,13 @@ #include "actionmodifyround.h" -#include "rs_commandevent.h" -#include "rs_dialogfactory.h" -#include "rs_information.h" -#include "rs_preview.h" +#include "commandevent.h" +#include "debug.h" +#include "dialogfactory.h" +#include "information.h" +#include "preview.h" -ActionModifyRound::ActionModifyRound(RS_EntityContainer & container, GraphicView & graphicView): +ActionModifyRound::ActionModifyRound(EntityContainer & container, GraphicView & graphicView): ActionInterface("Round Entities", container, graphicView) { entity1 = NULL; @@ -47,16 +50,16 @@ void ActionModifyRound::init(int status) void ActionModifyRound::trigger() { - RS_DEBUG->print("ActionModifyRound::trigger()"); + DEBUG->print("ActionModifyRound::trigger()"); if (entity1 != NULL && entity1->isAtomic() && entity2 != NULL && entity2->isAtomic()) { deletePreview(); - RS_Modification m(*container, graphicView); - m.round(coord2, coord1, (RS_AtomicEntity *)entity1, coord2, - (RS_AtomicEntity *)entity2, data); + Modification m(*container, graphicView); + m.round(coord2, coord1, (AtomicEntity *)entity1, coord2, + (AtomicEntity *)entity2, data); coord1 = Vector(false); entity1 = NULL; @@ -66,17 +69,17 @@ void ActionModifyRound::trigger() clearPreview(); - if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->updateSelectionWidget(container->countSelected()); + if (DIALOGFACTORY != NULL) + DIALOGFACTORY->updateSelectionWidget(container->countSelected()); } } void ActionModifyRound::mouseMoveEvent(QMouseEvent * e) { - RS_DEBUG->print("ActionModifyRound::mouseMoveEvent begin"); + DEBUG->print("ActionModifyRound::mouseMoveEvent begin"); Vector mouse = graphicView->toGraph(e->x(), e->y()); - RS_Entity * se = catchEntity(e, RS2::ResolveAll); + Entity * se = catchEntity(e, RS2::ResolveAll); switch (getStatus()) { @@ -90,12 +93,12 @@ void ActionModifyRound::mouseMoveEvent(QMouseEvent * e) coord2 = mouse; if (entity1 != NULL && entity2 != NULL && entity2->isAtomic() - && RS_Information::isTrimmable(entity1, entity2)) + && Information::isTrimmable(entity1, entity2)) { deletePreview(); clearPreview(); -/* RS_Entity * tmp1 = entity1->clone(); - RS_Entity * tmp2 = entity2->clone();*/ +/* Entity * tmp1 = entity1->clone(); + Entity * tmp2 = entity2->clone();*/ // tmp1->reparent(preview); // tmp2->reparent(preview); // preview->addEntity(tmp1); @@ -103,9 +106,9 @@ void ActionModifyRound::mouseMoveEvent(QMouseEvent * e) /* bool trim = data.trim; data.trim = false; - RS_Modification m(*preview, NULL, false); - m.round(coord2, coord1, (RS_AtomicEntity *)tmp1, coord2, - (RS_AtomicEntity *)tmp2, data); + Modification m(*preview, NULL, false); + m.round(coord2, coord1, (AtomicEntity *)tmp1, coord2, + (AtomicEntity *)tmp2, data); data.trim = trim; preview->removeEntity(tmp1); @@ -118,13 +121,13 @@ void ActionModifyRound::mouseMoveEvent(QMouseEvent * e) break; } - RS_DEBUG->print("ActionModifyRound::mouseMoveEvent end"); + DEBUG->print("ActionModifyRound::mouseMoveEvent end"); } void ActionModifyRound::mouseReleaseEvent(QMouseEvent * e) { Vector mouse = graphicView->toGraph(e->x(), e->y()); - RS_Entity * se = catchEntity(e, RS2::ResolveAll); + Entity * se = catchEntity(e, RS2::ResolveAll); if (e->button() == Qt::LeftButton) { @@ -135,7 +138,7 @@ void ActionModifyRound::mouseReleaseEvent(QMouseEvent * e) coord1 = mouse; if (entity1 != NULL && entity1->isAtomic() - && RS_Information::isTrimmable(entity1)) + && Information::isTrimmable(entity1)) setStatus(SetEntity2); break; @@ -144,7 +147,7 @@ void ActionModifyRound::mouseReleaseEvent(QMouseEvent * e) coord2 = mouse; if (entity2 != NULL && entity2->isAtomic() - && RS_Information::isTrimmable(entity1, entity2)) + && Information::isTrimmable(entity1, entity2)) //setStatus(ChooseRounding); trigger(); break; @@ -161,14 +164,14 @@ void ActionModifyRound::mouseReleaseEvent(QMouseEvent * e) } } -void ActionModifyRound::commandEvent(RS_CommandEvent * e) +void ActionModifyRound::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; } @@ -196,22 +199,22 @@ void ActionModifyRound::commandEvent(RS_CommandEvent * e) */ data.trim = !data.trim; - if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->requestOptions(this, true, true); + if (DIALOGFACTORY != NULL) + DIALOGFACTORY->requestOptions(this, true, true); } break; case SetRadius: { bool ok; - double r = RS_Math::eval(c, &ok); + double r = Math::eval(c, &ok); if (ok == true) data.radius = r; - else if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); + else if (DIALOGFACTORY != NULL) + DIALOGFACTORY->commandMessage(tr("Not a valid expression")); - if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->requestOptions(this, true, true); + if (DIALOGFACTORY != NULL) + DIALOGFACTORY->requestOptions(this, true, true); setStatus(lastStatus); } break; @@ -222,10 +225,10 @@ void ActionModifyRound::commandEvent(RS_CommandEvent * e) } else if (c==cmdNo.toLower() || c==cmdNo2) { data.trim = false; } else { - RS_DIALOGFACTORY->commandMessage(tr("Please enter 'Yes' " + DIALOGFACTORY->commandMessage(tr("Please enter 'Yes' " "or 'No'")); } - RS_DIALOGFACTORY->requestOptions(this, true, true); + DIALOGFACTORY->requestOptions(this, true, true); setStatus(lastStatus); } break;*/ @@ -257,45 +260,45 @@ void ActionModifyRound::showOptions() { ActionInterface::showOptions(); - if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->requestOptions(this, true); + if (DIALOGFACTORY != NULL) + DIALOGFACTORY->requestOptions(this, true); } void ActionModifyRound::hideOptions() { ActionInterface::hideOptions(); - if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->requestOptions(this, false); + if (DIALOGFACTORY != NULL) + DIALOGFACTORY->requestOptions(this, false); } void ActionModifyRound::updateMouseButtonHints() { - if (RS_DIALOGFACTORY != NULL) + if (DIALOGFACTORY != NULL) { switch (getStatus()) { case SetEntity1: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify first entity"), + DIALOGFACTORY->updateMouseWidget(tr("Specify first entity"), tr("Back")); break; case SetEntity2: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify second entity"), + DIALOGFACTORY->updateMouseWidget(tr("Specify second entity"), tr("Back")); break; case SetRadius: - RS_DIALOGFACTORY->updateMouseWidget(tr("Enter radius:"), + DIALOGFACTORY->updateMouseWidget(tr("Enter radius:"), tr("Cancel")); break; /*case SetTrim: - RS_DIALOGFACTORY->updateMouseWidget(tr("Trim on? (yes/no):"), + DIALOGFACTORY->updateMouseWidget(tr("Trim on? (yes/no):"), ""); break;*/ default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } @@ -308,8 +311,8 @@ void ActionModifyRound::updateMouseCursor() void ActionModifyRound::updateToolBar() { - if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarModify); + if (DIALOGFACTORY != NULL) + DIALOGFACTORY->requestToolBar(RS2::ToolBarModify); } void ActionModifyRound::setRadius(double r)