X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Factions%2Factiondrawline.cpp;h=a0be6db85b6a1812c2b6164fc4d61e61173e1c61;hb=2ee84c5948ede7fc2f7b4435c5edef42a030ac05;hp=50fb99087cae5b6075a613e3f536c5cfa025f711;hpb=3239ef39dcee08fa6e8cd68cdf2727fc68cc7a8c;p=architektonas diff --git a/src/actions/actiondrawline.cpp b/src/actions/actiondrawline.cpp index 50fb990..a0be6db 100644 --- a/src/actions/actiondrawline.cpp +++ b/src/actions/actiondrawline.cpp @@ -24,17 +24,17 @@ #include "graphicview.h" #include "preview.h" -ActionDrawLine::ActionDrawLine(RS_EntityContainer & container, GraphicView & graphicView): +ActionDrawLine::ActionDrawLine(EntityContainer & container, GraphicView & graphicView): ActionInterface("Draw lines", container, graphicView) { - RS_DEBUG->print("ActionDrawLine::ActionDrawLine"); + DEBUG->print("ActionDrawLine::ActionDrawLine"); reset(); //hm. // graphicView.snapper.SetContainer(&container); // graphicView.snapper.SetGraphicView(&graphicView); // graphicView.snapper.SetVisible(); // graphicView.preview.SetVisible(); - RS_DEBUG->print("ActionDrawLine::ActionDrawLine: OK"); + DEBUG->print("ActionDrawLine::ActionDrawLine: OK"); } ActionDrawLine::~ActionDrawLine() @@ -49,33 +49,33 @@ ActionDrawLine::~ActionDrawLine() void ActionDrawLine::reset() { - RS_DEBUG->print("ActionDrawLine::reset"); - data = RS_LineData(Vector(false), Vector(false)); + DEBUG->print("ActionDrawLine::reset"); + data = LineData(Vector(false), Vector(false)); start = Vector(false); ClearHistory(); - RS_DEBUG->print("ActionDrawLine::reset: OK"); + DEBUG->print("ActionDrawLine::reset: OK"); } void ActionDrawLine::init(int status) { - RS_DEBUG->print("ActionDrawLine::init"); + DEBUG->print("ActionDrawLine::init"); ActionInterface::init(status); reset(); - RS_DEBUG->print("ActionDrawLine::init: OK"); + DEBUG->print("ActionDrawLine::init: OK"); } void ActionDrawLine::trigger() { graphicView->preview.clear(); - RS_Line * line = new RS_Line(container, data); + Line * line = new Line(container, data); line->setLayerToActive(); line->setPenToActive(); container->addEntity(line); //std::cout << container; //printf("ActionDrawLine::trigger(): new line is %f,%f to %f,%f\n", data.startpoint.x, data.startpoint.y, data.endpoint.x, data.endpoint.y); //This makes it come back as "Unknown Entity" -//std::cout << *((RS_Entity *)container); +//std::cout << *((Entity *)container); //std::cout << *container; // Update undo list: @@ -89,29 +89,29 @@ void ActionDrawLine::trigger() graphicView->moveRelativeZero(line->getEndpoint()); //hm. [OK, it just moves the relative zero tho. Overkill. And remove preview, so OK.] graphicView->redraw(); - RS_DEBUG->print("ActionDrawLine::trigger(): line added: %d", line->getId()); + DEBUG->print("ActionDrawLine::trigger(): line added: %d", line->getId()); } void ActionDrawLine::mouseMoveEvent(QMouseEvent * e) { - RS_DEBUG->print("ActionDrawLine::mouseMoveEvent begin"); + DEBUG->print("ActionDrawLine::mouseMoveEvent begin"); - RS_DEBUG->print("ActionDrawLine::mouseMoveEvent: snap point"); + DEBUG->print("ActionDrawLine::mouseMoveEvent: snap point"); Vector mouse = graphicView->snapper.snapPoint(e); - RS_DEBUG->print("ActionDrawLine::mouseMoveEvent: snap point: OK"); + DEBUG->print("ActionDrawLine::mouseMoveEvent: snap point: OK"); if (getStatus() == SetEndpoint && data.startpoint.valid) { - RS_DEBUG->print("ActionDrawLine::mouseMoveEvent: update preview"); + DEBUG->print("ActionDrawLine::mouseMoveEvent: update preview"); // This is lame. Creating a new Line every time the endpoint moves. // Surely we can alter the line entity inside the preview, no? #if 0 graphicView->preview.clear(); // Remove entities from the container - RS_Line * line = new RS_Line(&(graphicView->preview), RS_LineData(data.startpoint, mouse)); + Line * line = new Line(&(graphicView->preview), LineData(data.startpoint, mouse)); graphicView->preview.addEntity(line); #else // We can assume there's only one line in there, can't we? - RS_Line * line = (RS_Line *)graphicView->preview.firstEntity(RS2::ResolveNone); + Line * line = (Line *)graphicView->preview.firstEntity(RS2::ResolveNone); if (line) { @@ -119,7 +119,7 @@ void ActionDrawLine::mouseMoveEvent(QMouseEvent * e) } else { - line = new RS_Line(&(graphicView->preview), RS_LineData(data.startpoint, mouse)); + line = new Line(&(graphicView->preview), LineData(data.startpoint, mouse)); graphicView->preview.addEntity(line); } #endif @@ -127,7 +127,7 @@ void ActionDrawLine::mouseMoveEvent(QMouseEvent * e) //hm. [ok, this works. :-D] graphicView->redraw(); - RS_DEBUG->print("ActionDrawLine::mouseMoveEvent end"); + DEBUG->print("ActionDrawLine::mouseMoveEvent end"); } void ActionDrawLine::mouseReleaseEvent(QMouseEvent * e) @@ -155,11 +155,11 @@ void ActionDrawLine::mouseReleaseEvent(QMouseEvent * e) void ActionDrawLine::coordinateEvent(Vector * e) { - RS_DEBUG->print("ActionDrawLine::coordinateEvent"); + DEBUG->print("ActionDrawLine::coordinateEvent"); if (!e) { - RS_DEBUG->print("ActionDrawLine::coordinateEvent: event was NULL"); + DEBUG->print("ActionDrawLine::coordinateEvent: event was NULL"); return; } @@ -189,12 +189,12 @@ void ActionDrawLine::coordinateEvent(Vector * e) break; } - RS_DEBUG->print("ActionDrawLine::coordinateEvent: OK"); + DEBUG->print("ActionDrawLine::coordinateEvent: OK"); } -void ActionDrawLine::commandEvent(RS_CommandEvent * e) +void ActionDrawLine::commandEvent(CommandEvent * e) { - RS_DEBUG->print("ActionDrawLine::commandEvent"); + DEBUG->print("ActionDrawLine::commandEvent"); QString c = e->getCommand().toLower(); switch (getStatus()) @@ -203,7 +203,7 @@ void ActionDrawLine::commandEvent(RS_CommandEvent * e) if (checkCommand("help", c)) { - RS_DIALOGFACTORY->commandMessage(msgAvailableCommands() + DIALOGFACTORY->commandMessage(msgAvailableCommands() + getAvailableCommands().join(", ")); return; } @@ -230,7 +230,7 @@ void ActionDrawLine::commandEvent(RS_CommandEvent * e) break; } - RS_DEBUG->print("ActionDrawLine::commandEvent: OK"); + DEBUG->print("ActionDrawLine::commandEvent: OK"); } QStringList ActionDrawLine::getAvailableCommands() @@ -264,7 +264,7 @@ void ActionDrawLine::updateMouseButtonHints() switch (getStatus()) { case SetStartpoint: - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify first point"), tr("Cancel")); + DIALOGFACTORY->updateMouseWidget(tr("Specify first point"), tr("Cancel")); break; case SetEndpoint: @@ -273,38 +273,38 @@ void ActionDrawLine::updateMouseButtonHints() if (history.count() >= 3) { - msg += RS_COMMANDS->command("close"); + msg += COMMANDS->command("close"); msg += "/"; } if (history.count() >= 2) - msg += RS_COMMANDS->command("undo"); + msg += COMMANDS->command("undo"); if (history.count() >= 2) - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify next point or [%1]").arg(msg), tr("Back")); + DIALOGFACTORY->updateMouseWidget(tr("Specify next point or [%1]").arg(msg), tr("Back")); else - RS_DIALOGFACTORY->updateMouseWidget(tr("Specify next point"), tr("Back")); + DIALOGFACTORY->updateMouseWidget(tr("Specify next point"), tr("Back")); } break; default: - RS_DIALOGFACTORY->updateMouseWidget("", ""); + DIALOGFACTORY->updateMouseWidget("", ""); break; } } void ActionDrawLine::showOptions() { - RS_DEBUG->print("ActionDrawLine::showOptions"); + DEBUG->print("ActionDrawLine::showOptions"); ActionInterface::showOptions(); - RS_DIALOGFACTORY->requestOptions(this, true); - RS_DEBUG->print("ActionDrawLine::showOptions: OK"); + DIALOGFACTORY->requestOptions(this, true); + DEBUG->print("ActionDrawLine::showOptions: OK"); } void ActionDrawLine::hideOptions() { ActionInterface::hideOptions(); - RS_DIALOGFACTORY->requestOptions(this, false); + DIALOGFACTORY->requestOptions(this, false); } void ActionDrawLine::updateMouseCursor() @@ -315,9 +315,9 @@ void ActionDrawLine::updateMouseCursor() void ActionDrawLine::updateToolBar() { if (!isFinished()) - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); + DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap); else - RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarLines); + DIALOGFACTORY->requestToolBar(RS2::ToolBarLines); } void ActionDrawLine::close() @@ -332,7 +332,7 @@ void ActionDrawLine::close() graphicView->moveRelativeZero(start); } else - RS_DIALOGFACTORY->commandMessage(tr("Cannot close sequence of lines: Not enough entities defined yet.")); + DIALOGFACTORY->commandMessage(tr("Cannot close sequence of lines: Not enough entities defined yet.")); } void ActionDrawLine::undo() @@ -348,7 +348,7 @@ void ActionDrawLine::undo() graphicView->redraw(); } else - RS_DIALOGFACTORY->commandMessage(tr("Cannot undo: Not enough entities defined yet.")); + DIALOGFACTORY->commandMessage(tr("Cannot undo: Not enough entities defined yet.")); } void ActionDrawLine::ClearHistory(void)