// Who When What
// --- ---------- -----------------------------------------------------------
// JLH 06/03/2010 Added this text. :-)
+// JLH 09/11/2010 Fixed preview/snapper rendering.
//
#include "actiondrawcircle2p.h"
#include "graphicview.h"
#include "preview.h"
-ActionDrawCircle2P::ActionDrawCircle2P(EntityContainer & container, GraphicView & graphicView): ActionInterface("Draw circles",
- container, graphicView)
+ActionDrawCircle2P::ActionDrawCircle2P(EntityContainer & container,
+ GraphicView & graphicView):
+ ActionInterface("Draw circles", container, graphicView)
{
reset();
}
void ActionDrawCircle2P::init(int status)
{
ActionInterface::init(status);
-
reset();
}
void ActionDrawCircle2P::trigger()
{
ActionInterface::trigger();
-
preparePreview();
if (data.isValid())
container->addEntity(circle);
// upd. undo list:
- if (document != NULL)
+ if (document)
{
document->startUndoCycle();
document->addUndoable(circle);
document->endUndoCycle();
}
- deleteSnapper();
- Vector rz = graphicView->getRelativeZero();
- graphicView->moveRelativeZero(Vector(0.0, 0.0));
- graphicView->drawEntity(circle);
- graphicView->moveRelativeZero(rz);
- drawSnapper();
+// deleteSnapper();
+// Vector rz = graphicView->getRelativeZero();
+// graphicView->moveRelativeZero(Vector(0.0, 0.0));
+// graphicView->drawEntity(circle);
+// graphicView->moveRelativeZero(rz);
+// drawSnapper();
+ graphicView->preview.clear(); // hm.
+ graphicView->redraw();
setStatus(SetPoint1);
reset();
}
- else if (DIALOGFACTORY != NULL)
+ else if (DIALOGFACTORY)
DIALOGFACTORY->requestWarningDialog(tr("Invalid Circle data."));
}
if (point1.valid && point2.valid)
{
Circle circle(NULL, data);
- bool suc = circle.createFrom2P(point1, point2);
+ bool success = circle.createFrom2P(point1, point2);
- if (suc)
+ if (success)
data = circle.getData();
}
}
// clearPreview();
// preview->addEntity(circle);
// drawPreview();
+ graphicView->preview.clear();
+ graphicView->preview.addEntity(new Circle(&(graphicView->preview), data));
}
break;
default:
break;
}
+
+ graphicView->redraw();
}
void ActionDrawCircle2P::mouseReleaseEvent(QMouseEvent * e)
}
else if (e->button() == Qt::RightButton)
{
- deletePreview();
- deleteSnapper();
+// deletePreview();
+// deleteSnapper();
init(getStatus() - 1);
+ graphicView->redraw();
}
}