X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Factions%2Factiondrawlinetangent1.cpp;fp=src%2Factions%2Frs_actiondrawlinetangent1.cpp;h=fbb128ae117b2723a7aadfcc86cf2603270913c9;hb=d774c2655ba2c3657a565f325411144452392277;hp=ed3703d2ca5286e6380f07a82f2d5021318aec03;hpb=468780dd17f8b0ebb35427a9fc43491721d44d69;p=architektonas diff --git a/src/actions/rs_actiondrawlinetangent1.cpp b/src/actions/actiondrawlinetangent1.cpp similarity index 63% rename from src/actions/rs_actiondrawlinetangent1.cpp rename to src/actions/actiondrawlinetangent1.cpp index ed3703d..fbb128a 100644 --- a/src/actions/rs_actiondrawlinetangent1.cpp +++ b/src/actions/actiondrawlinetangent1.cpp @@ -1,4 +1,4 @@ -// rs_actiondrawlinetangent1.cpp +// actiondrawlinetangent1.cpp // // Part of the Architektonas Project // Originally part of QCad Community Edition by Andrew Mustun @@ -12,14 +12,14 @@ // JLH 06/04/2010 Added this text. :-) // -#include "rs_actiondrawlinetangent1.h" +#include "actiondrawlinetangent1.h" #include "rs_creation.h" #include "rs_dialogfactory.h" #include "graphicview.h" #include "rs_preview.h" -RS_ActionDrawLineTangent1::RS_ActionDrawLineTangent1(RS_EntityContainer & container, GraphicView & graphicView): RS_PreviewActionInterface("Draw Tangents 1", +ActionDrawLineTangent1::ActionDrawLineTangent1(RS_EntityContainer & container, GraphicView & graphicView): ActionInterface("Draw Tangents 1", container, graphicView) { tangent = NULL; @@ -27,27 +27,27 @@ RS_ActionDrawLineTangent1::RS_ActionDrawLineTangent1(RS_EntityContainer & contai circle = NULL; } -RS_ActionDrawLineTangent1::~RS_ActionDrawLineTangent1() +ActionDrawLineTangent1::~ActionDrawLineTangent1() { } -void RS_ActionDrawLineTangent1::trigger() +void ActionDrawLineTangent1::trigger() { - RS_PreviewActionInterface::trigger(); + ActionInterface::trigger(); - if (tangent != NULL) + if (tangent) { RS_Entity * newEntity = NULL; newEntity = new RS_Line(container, tangent->getData()); - if (newEntity != NULL) + if (newEntity) { newEntity->setLayerToActive(); newEntity->setPenToActive(); container->addEntity(newEntity); // upd. undo list: - if (document != NULL) + if (document) { document->startUndoCycle(); document->addUndoable(newEntity); @@ -64,14 +64,13 @@ void RS_ActionDrawLineTangent1::trigger() tangent = NULL; } else - RS_DEBUG->print("RS_ActionDrawLineTangent1::trigger:" + RS_DEBUG->print("ActionDrawLineTangent1::trigger:" " Entity is NULL\n"); } -void RS_ActionDrawLineTangent1::mouseMoveEvent(QMouseEvent * e) +void ActionDrawLineTangent1::mouseMoveEvent(QMouseEvent * e) { - RS_DEBUG->print("RS_ActionDrawLineTangent1::mouseMoveEvent begin"); - + RS_DEBUG->print("ActionDrawLineTangent1::mouseMoveEvent begin"); Vector mouse(graphicView->toGraphX(e->x()), graphicView->toGraphY(e->y())); switch (getStatus()) @@ -80,43 +79,42 @@ void RS_ActionDrawLineTangent1::mouseMoveEvent(QMouseEvent * e) point = snapPoint(e); break; - case SetCircle: { + case SetCircle: + { RS_Entity * en = catchEntity(e, RS2::ResolveAll); - if (en != NULL && (en->rtti() == RS2::EntityCircle - || en->rtti() == RS2::EntityArc - || en->rtti() == RS2::EntityEllipse)) + if (en && (en->rtti() == RS2::EntityCircle + || en->rtti() == RS2::EntityArc + || en->rtti() == RS2::EntityEllipse)) { circle = en; - RS_Creation creation(NULL, NULL); - RS_Line * t = creation.createTangent1(mouse, - point, - circle); + RS_Line * t = creation.createTangent1(mouse, point, circle); - if (t != NULL) + if (t) { - if (tangent != NULL) + if (tangent) delete tangent; + tangent = (RS_Line *)t->clone(); deletePreview(); clearPreview(); - preview->addEntity(t); +// preview->addEntity(t); drawPreview(); } } } - break; + break; default: break; } - RS_DEBUG->print("RS_ActionDrawLineTangent1::mouseMoveEvent end"); + RS_DEBUG->print("ActionDrawLineTangent1::mouseMoveEvent end"); } -void RS_ActionDrawLineTangent1::mouseReleaseEvent(QMouseEvent * e) +void ActionDrawLineTangent1::mouseReleaseEvent(QMouseEvent * e) { if (e->button() == Qt::RightButton) { @@ -129,11 +127,12 @@ void RS_ActionDrawLineTangent1::mouseReleaseEvent(QMouseEvent * e) { switch (getStatus()) { - case SetPoint: { + case SetPoint: + { Vector ce(snapPoint(e)); coordinateEvent(&ce); } - break; + break; case SetCircle: trigger(); @@ -142,7 +141,7 @@ void RS_ActionDrawLineTangent1::mouseReleaseEvent(QMouseEvent * e) } } -void RS_ActionDrawLineTangent1::coordinateEvent(Vector * e) +void ActionDrawLineTangent1::coordinateEvent(Vector * e) { if (e == NULL) return; @@ -161,15 +160,14 @@ void RS_ActionDrawLineTangent1::coordinateEvent(Vector * e) } } -void RS_ActionDrawLineTangent1::updateMouseButtonHints() +void ActionDrawLineTangent1::updateMouseButtonHints() { if (RS_DIALOGFACTORY != NULL) { switch (getStatus()) { case SetPoint: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify point"), - tr("Cancel")); + RS_DIALOGFACTORY->updateMouseWidget(tr("Specify point"), tr("Cancel")); break; case SetCircle: @@ -184,14 +182,14 @@ void RS_ActionDrawLineTangent1::updateMouseButtonHints() } } -void RS_ActionDrawLineTangent1::updateMouseCursor() +void ActionDrawLineTangent1::updateMouseCursor() { graphicView->setMouseCursor(RS2::CadCursor); } -void RS_ActionDrawLineTangent1::updateToolBar() +void ActionDrawLineTangent1::updateToolBar() { - if (RS_DIALOGFACTORY != NULL) + if (RS_DIALOGFACTORY) { if (!isFinished()) RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); @@ -199,5 +197,3 @@ void RS_ActionDrawLineTangent1::updateToolBar() RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarLines); } } - -// EOF