#include "arc.h"
#include "circle.h"
#include "dimension.h"
-#include "drawarcaction.h"
-#include "drawcircleaction.h"
-#include "drawdimensionaction.h"
-#include "drawlineaction.h"
#include "line.h"
#include "painter.h"
we do! :-)
*/
-#if 0
- QPainter pmp(&gridBackground);
- pmp.fillRect(0, 0, BACKGROUND_MAX_SIZE, BACKGROUND_MAX_SIZE, QColor(240, 240, 240));
- pmp.setPen(QPen(QColor(210, 210, 255), 2.0, Qt::SolidLine));
-
- for(int i=0; i<(BACKGROUND_MAX_SIZE-1); i+=12)
- {
- pmp.drawLine(i, 0, i, BACKGROUND_MAX_SIZE - 1);
- pmp.drawLine(0, i, BACKGROUND_MAX_SIZE - 1, i);
- }
-
- pmp.end();
- UpdateGridBackground();
-#else
SetGridSize(12);
-#endif
}
}
-void DrawingView::SetAddLineToolActive(bool state/*= true*/)
+void DrawingView::SetToolActive(Action * action)
{
- if (state)
+ if (action != NULL)
{
- toolAction = new DrawLineAction();
+ toolAction = action;
connect(toolAction, SIGNAL(ObjectReady(Object *)), this,
SLOT(AddNewObjectToDocument(Object *)));
}
-
- update();
-//printf("DrawingView::SetAddLineToolActive(). toolAction=%08X\n", toolAction);
-}
-
-
-void DrawingView::SetAddCircleToolActive(bool state/*= true*/)
-{
- if (state)
- {
- toolAction = new DrawCircleAction();
- connect(toolAction, SIGNAL(ObjectReady(Object *)), this,
- SLOT(AddNewObjectToDocument(Object *)));
- }
-
- update();
-}
-
-
-void DrawingView::SetAddArcToolActive(bool state/*= true*/)
-{
- if (state)
- {
- toolAction = new DrawArcAction();
- connect(toolAction, SIGNAL(ObjectReady(Object *)), this,
- SLOT(AddNewObjectToDocument(Object *)));
- }
-
- update();
-}
-
-
-void DrawingView::SetAddDimensionToolActive(bool state/*= true*/)
-{
- if (state)
- {
- toolAction = new DrawDimensionAction();
- connect(toolAction, SIGNAL(ObjectReady(Object *)), this,
- SLOT(AddNewObjectToDocument(Object *)));
- }
-
- update();
}
document.Draw(&painter);
if (toolAction)
+ {
+// painter.SetPen(QPen(Qt::green, 1.0, Qt::DashLine));
+ painter.SetPen(QPen(QColor(200, 100, 0, 255), 1.0, Qt::DashLine));
+ painter.DrawCrosshair(oldPoint);
toolAction->Draw(&painter);
+ }
if (Object::selectionInProgress)
{
{
Vector point = Painter::QtToCartesianCoords(Vector(event->x(), event->y()));
+// Problem with this: Can't select stuff very well with the snap grid on.
+// Completely screws things up.
if (Object::snapToGrid)
point = SnapPointToGrid(point);
#endif
}
#endif
+ oldPoint = point;
//we should keep track of the last point here and only pass this down *if* the point
//changed...
document.PointerMoved(point);
if (toolAction)
{
+ if (Object::snapToGrid)
+ {
+ point = SnapPointToGrid(point);
+ oldPoint = point;
+ }
+
toolAction->MouseMoved(point);
update();
}