graphicView.snapper.SetContainer(&container);
graphicView.snapper.SetGraphicView(&graphicView);
graphicView.snapper.SetVisible();
+ graphicView.preview.SetVisible();
RS_DEBUG->print("RS_ActionDrawLine::RS_ActionDrawLine: OK");
}
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();
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());
}
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
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");
}
}
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)
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."));