X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Factions%2Frs_actiondrawline.cpp;h=d911e779c02016f7258631b1c4d6a58075bbdc6b;hb=c715d05d11ffe2913fe3465ec43d456ee9b85964;hp=1c1860af04f88143cb0a84b63d1590c1a1f6b484;hpb=937ade06241548bfbc7858705b3ce1c7778c3d88;p=architektonas diff --git a/src/actions/rs_actiondrawline.cpp b/src/actions/rs_actiondrawline.cpp index 1c1860a..d911e77 100644 --- a/src/actions/rs_actiondrawline.cpp +++ b/src/actions/rs_actiondrawline.cpp @@ -29,6 +29,7 @@ RS_ActionDrawLine::RS_ActionDrawLine(RS_EntityContainer & container, GraphicView graphicView.snapper.SetContainer(&container); graphicView.snapper.SetGraphicView(&graphicView); graphicView.snapper.SetVisible(); + graphicView.preview.SetVisible(); RS_DEBUG->print("RS_ActionDrawLine::RS_ActionDrawLine: OK"); } @@ -61,7 +62,12 @@ void RS_ActionDrawLine::init(int status) void RS_ActionDrawLine::trigger() { +#if 0 RS_PreviewActionInterface::trigger(); // XOR off screen, delete entities in container +#else + graphicView->preview.clear(); +// graphicView->redraw(); +#endif RS_Line * line = new RS_Line(container, data); line->setLayerToActive(); @@ -81,13 +87,9 @@ void RS_ActionDrawLine::trigger() document->endUndoCycle(); } -// deleteSnapper(); // XOR off of screen -// graphicView->moveRelativeZero(Vector(0.0, 0.0)); -//This is unnecessary, because we added this to the container... -//#warning "!!! Here's the trouble... Trying to draw direct !!!" -// graphicView->drawEntity(line); graphicView->moveRelativeZero(line->getEndpoint()); -// drawSnapper(); // XOR on screen + //hm. [OK, it just moves the relative zero tho. Overkill. And remove preview, so OK.] + graphicView->redraw(); RS_DEBUG->print("RS_ActionDrawLine::trigger(): line added: %d", line->getId()); } @@ -96,14 +98,13 @@ void RS_ActionDrawLine::mouseMoveEvent(QMouseEvent * e) RS_DEBUG->print("RS_ActionDrawLine::mouseMoveEvent begin"); RS_DEBUG->print("RS_ActionDrawLine::mouseMoveEvent: snap point"); -//This used to draw the snapper, but now that's defunct... so, !!! FIX !!! -// Vector mouse = snapPoint(e); Vector mouse = graphicView->snapper.snapPoint(e); RS_DEBUG->print("RS_ActionDrawLine::mouseMoveEvent: snap point: OK"); if (getStatus() == SetEndpoint && data.startpoint.valid) { RS_DEBUG->print("RS_ActionDrawLine::mouseMoveEvent: update preview"); +#if 0 //not needed, but without this, it doesn't draw... strange... //obviously we haven't gotten our rendering path correct... // deletePreview(); // XOR off of screen @@ -112,9 +113,18 @@ void RS_ActionDrawLine::mouseMoveEvent(QMouseEvent * e) RS_DEBUG->print("RS_ActionDrawLine::mouseMoveEvent: draw preview"); // drawPreview(); // XOR on screen xorPreview(); // XOR on screen +#else + // This is lame. Creating a new Line every time the endpoint moves. + // Surely we can alter the line entity inside the preview, no? + graphicView->preview.clear(); // Remove entities from the container + RS_Line * line = new RS_Line(&(graphicView->preview), RS_LineData(data.startpoint, mouse)); +//wha? Even THIS doesn't work!!! It was the container... +// line->setPen(RS_Pen(RS_Color(60, 255, 60), RS2::Width00, RS2::SolidLine)); + graphicView->preview.addEntity(line); +#endif } - //hm. + //hm. [ok, this works. :-D] graphicView->redraw(); RS_DEBUG->print("RS_ActionDrawLine::mouseMoveEvent end"); } @@ -128,11 +138,23 @@ void RS_ActionDrawLine::mouseReleaseEvent(QMouseEvent * e) } else if (e->button() == Qt::RightButton) { + if (getStatus() == 0) + { + graphicView->snapper.SetVisible(false); + graphicView->preview.SetVisible(false); + } + +#if 0 deletePreview(); // XOR off of screen clearPreview(); // Remove entities from the container -// deleteSnapper(); // XOR off of screen +#else +#endif init(getStatus() - 1); } + + //hm. [Seems to work OK.] + graphicView->preview.clear(); // Remove entities from container + graphicView->redraw(); } void RS_ActionDrawLine::coordinateEvent(Vector * e) @@ -323,11 +345,13 @@ void RS_ActionDrawLine::undo() if (history.count() > 1) { history.removeLast(); - deletePreview(); // XOR off of screen - clearPreview(); // Delete entities in container +// deletePreview(); // XOR off of screen +// clearPreview(); // Delete entities in container graphicView->setCurrentAction(new RS_ActionEditUndo(true, *container, *graphicView)); data.startpoint = *history.last(); graphicView->moveRelativeZero(data.startpoint); +graphicView->preview.clear(); +graphicView->redraw(); } else RS_DIALOGFACTORY->commandMessage(tr("Cannot undo: Not enough entities defined yet."));