X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Factions%2Factiondrawlineparallel.cpp;h=f8a473af7c8645f4d98bdcf6552ca3fe0a4433ef;hb=f62cebc26c7c3af447f0e4e4c43331f8589dce22;hp=8701b6ad5c8f71c4ae14f35d684b95f6243b5a29;hpb=865303923fcb231a171992b75a73364ff469ff8c;p=architektonas diff --git a/src/actions/actiondrawlineparallel.cpp b/src/actions/actiondrawlineparallel.cpp index 8701b6a..f8a473a 100644 --- a/src/actions/actiondrawlineparallel.cpp +++ b/src/actions/actiondrawlineparallel.cpp @@ -12,27 +12,26 @@ // Who When What // --- ---------- ----------------------------------------------------------- // JLH 05/22/2010 Added this text. :-) +// JLH 08/19/2010 Fix rendering for new (correct) rendering path // #include "actiondrawlineparallel.h" #include "actiondrawlineparallelthrough.h" -#include "rs_commandevent.h" +#include "commandevent.h" #include "commands.h" -#include "rs_creation.h" -#include "rs_dialogfactory.h" +#include "creation.h" +#include "debug.h" +#include "dialogfactory.h" #include "graphicview.h" -#include "rs_preview.h" +#include "preview.h" -ActionDrawLineParallel::ActionDrawLineParallel(RS_EntityContainer & container, - GraphicView & graphicView): ActionInterface("Draw Parallels", - container, graphicView) +ActionDrawLineParallel::ActionDrawLineParallel(EntityContainer & container, + GraphicView & graphicView): + ActionInterface("Draw Parallels", container, graphicView), + parallel(NULL), distance(1.0), number(1), coord(Vector(false)), entity(NULL) { - parallel = NULL; - entity = NULL; - distance = 1.0; - number = 1; - coord = Vector(false); + graphicView.snapper.SetVisible(false); } ActionDrawLineParallel::~ActionDrawLineParallel() @@ -47,17 +46,19 @@ ActionDrawLineParallel::~ActionDrawLineParallel() void ActionDrawLineParallel::trigger() { ActionInterface::trigger(); - - RS_Creation creation(container, graphicView); - RS_Entity * e = creation.createParallel(coord, distance, number, entity); + Creation creation(container, graphicView); + Entity * e = creation.createParallel(coord, distance, number, entity); if (!e) - RS_DEBUG->print("ActionDrawLineParallel::trigger: No parallels added\n"); + DEBUG->print("ActionDrawLineParallel::trigger: No parallels added\n"); + + graphicView->preview.clear(); + graphicView->redraw(); } void ActionDrawLineParallel::mouseMoveEvent(QMouseEvent * e) { - RS_DEBUG->print("ActionDrawLineParallel::mouseMoveEvent begin"); + DEBUG->print("ActionDrawLineParallel::mouseMoveEvent begin"); coord = Vector(graphicView->toGraphX(e->x()), graphicView->toGraphY(e->y())); entity = catchEntity(e, RS2::ResolveAll); @@ -65,19 +66,26 @@ void ActionDrawLineParallel::mouseMoveEvent(QMouseEvent * e) { case SetEntity: { +#if 0 deletePreview(); clearPreview(); -// RS_Creation creation(preview, NULL, false); -// creation.createParallel(coord, distance, number, entity); + Creation creation(preview, NULL, false); + creation.createParallel(coord, distance, number, entity); drawPreview(); +#else + graphicView->preview.clear(); + Creation creation(&(graphicView->preview), NULL, false); + creation.createParallel(coord, distance, number, entity); + graphicView->redraw(); +#endif } - break; + break; default: break; } - RS_DEBUG->print("ActionDrawLineParallel::mouseMoveEvent end"); + DEBUG->print("ActionDrawLineParallel::mouseMoveEvent end"); } void ActionDrawLineParallel::mouseReleaseEvent(QMouseEvent * e) @@ -90,23 +98,23 @@ void ActionDrawLineParallel::mouseReleaseEvent(QMouseEvent * e) void ActionDrawLineParallel::updateMouseButtonHints() { - if (RS_DIALOGFACTORY != NULL) + if (DIALOGFACTORY) { switch (getStatus()) { case SetEntity: - RS_DIALOGFACTORY->updateMouseWidget( + DIALOGFACTORY->updateMouseWidget( tr("Specify Distance <%1> or select entity or [%2]") - .arg(distance).arg(RS_COMMANDS->command("through")), + .arg(distance).arg(COMMANDS->command("through")), tr("Cancel")); break; case SetNumber: - RS_DIALOGFACTORY->updateMouseWidget(tr("Enter number:"), ""); + DIALOGFACTORY->updateMouseWidget(tr("Enter number:"), ""); break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } @@ -116,8 +124,8 @@ void ActionDrawLineParallel::showOptions() { ActionInterface::showOptions(); - if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->requestOptions(this, true); + if (DIALOGFACTORY) + DIALOGFACTORY->requestOptions(this, true); updateMouseButtonHints(); } @@ -126,18 +134,18 @@ void ActionDrawLineParallel::hideOptions() { ActionInterface::hideOptions(); - if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->requestOptions(this, false); + if (DIALOGFACTORY) + DIALOGFACTORY->requestOptions(this, false); } -void ActionDrawLineParallel::commandEvent(RS_CommandEvent * e) +void ActionDrawLineParallel::commandEvent(CommandEvent * e) { QString c = e->getCommand().toLower(); if (checkCommand("help", c)) { - if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + if (DIALOGFACTORY) + DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); return; @@ -150,32 +158,33 @@ void ActionDrawLineParallel::commandEvent(RS_CommandEvent * e) { finish(); graphicView->setCurrentAction(new ActionDrawLineParallelThrough(*container, - *graphicView)); + *graphicView)); } else if (checkCommand("number", c)) { - deleteSnapper(); - deletePreview(); - clearPreview(); +// deleteSnapper(); +// deletePreview(); +// clearPreview(); setStatus(SetNumber); } else { bool ok; - double d = RS_Math::eval(c, &ok); + double d = Math::eval(c, &ok); if (ok && d > 1.0e-10) distance = d; - else if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); + else if (DIALOGFACTORY) + 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); updateMouseButtonHints(); //setStatus(SetEntity); } + break; case SetNumber: @@ -187,20 +196,18 @@ void ActionDrawLineParallel::commandEvent(RS_CommandEvent * e) { if (n > 0 && n < 100) number = n; - else if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->commandMessage(tr("Not a valid number. Try 1..99")); - + else if (DIALOGFACTORY) + DIALOGFACTORY->commandMessage(tr("Not a valid number. Try 1..99")); } - else if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->commandMessage(tr("Not a valid expression")); - + else if (DIALOGFACTORY) + DIALOGFACTORY->commandMessage(tr("Not a valid expression")); - if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->requestOptions(this, true, true); + if (DIALOGFACTORY) + DIALOGFACTORY->requestOptions(this, true, true); setStatus(SetEntity); } - break; + break; default: break; @@ -232,8 +239,8 @@ void ActionDrawLineParallel::updateMouseCursor() void ActionDrawLineParallel::updateToolBar() { - if (RS_DIALOGFACTORY != NULL) - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarLines); + if (DIALOGFACTORY) + DIALOGFACTORY->requestToolBar(RS2::ToolBarLines); } double ActionDrawLineParallel::getDistance()