}
// upd. view
- deleteSnapper();
+// deleteSnapper();
graphicView->moveRelativeZero(Vector(0.0, 0.0));
for(int i=0; i<4; i++)
{
graphicView->drawEntity(line[i]);
- RS_DEBUG->print("ActionDrawLineRectangle::trigger(): line added: %d",
- line[i]->getId());
+ RS_DEBUG->print("ActionDrawLineRectangle::trigger(): line added: %d", line[i]->getId());
}
+
graphicView->moveRelativeZero(corner2);
+ graphicView->redraw();
}
void ActionDrawLineRectangle::mouseMoveEvent(QMouseEvent * e)
if (getStatus() == SetCorner2 && corner1.valid)
{
corner2 = mouse;
- deletePreview();
- clearPreview();
-
- preparePreview();
+// deletePreview();
+// clearPreview();
+// preparePreview();
// for(int i=0; i<4; i++)
// preview->addEntity(new RS_Line(preview, data[i]));
- drawPreview();
+// drawPreview();
+ preparePreview();
+ graphicView->preview.clear();
+
+ for(int i=0; i<4; i++)
+ graphicView->preview.addEntity(new RS_Line(&(graphicView->preview), data[i]));
}
+ graphicView->redraw();
RS_DEBUG->print("ActionDrawLineRectangle::mouseMoveEvent end");
}
{
if (e->button() == Qt::LeftButton)
{
- Vector ce(snapPoint(e));
+// Vector ce(snapPoint(e));
+ Vector ce(graphicView->snapper.snapPoint(e));
coordinateEvent(&ce);
}
else if (e->button() == Qt::RightButton)
{
- deletePreview();
- deleteSnapper();
+// deletePreview();
+// deleteSnapper();
init(getStatus() - 1);
}
+
+ graphicView->preview.clear(); // Remove entities from container
+ graphicView->redraw();
}
void ActionDrawLineRectangle::preparePreview()
void ActionDrawLineRectangle::coordinateEvent(Vector * e)
{
- if (e == NULL)
+ if (!e)
return;
Vector mouse = *e;
if (checkCommand("help", c))
{
- if (RS_DIALOGFACTORY != NULL)
+ if (RS_DIALOGFACTORY)
RS_DIALOGFACTORY->commandMessage(msgAvailableCommands()
+ getAvailableCommands().join(", "));
return;
void ActionDrawLineRectangle::updateMouseButtonHints()
{
- if (RS_DIALOGFACTORY != NULL)
+ if (RS_DIALOGFACTORY)
{
switch (getStatus())
{
case SetCorner1:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify first corner"),
- tr("Cancel"));
+ RS_DIALOGFACTORY->updateMouseWidget(tr("Specify first corner"), tr("Cancel"));
break;
case SetCorner2:
- RS_DIALOGFACTORY->updateMouseWidget(tr("Specify second corner"),
- tr("Back"));
+ RS_DIALOGFACTORY->updateMouseWidget(tr("Specify second corner"), tr("Back"));
break;
default:
void ActionDrawLineRectangle::updateToolBar()
{
- if (RS_DIALOGFACTORY != NULL)
+ if (RS_DIALOGFACTORY)
{
if (!isFinished())
RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarSnap);
RS_DIALOGFACTORY->requestToolBar(RS2::ToolBarLines);
}
}
-
-