]> Shamusworld >> Repos - architektonas/blobdiff - src/drawingview.cpp
Initial stab at getting Circle to respond to selection rectangle.
[architektonas] / src / drawingview.cpp
index 1c095f4a73b41a3a5b070e880c81f4cb8372c04e..23c1d49100ad95f26a55aeb7e1a441a1a8875d0b 100644 (file)
@@ -51,7 +51,7 @@ DrawingView::DrawingView(QWidget * parent/*= NULL*/): QWidget(parent),
        gridSpacing(12.0), collided(false), rotateTool(false), rx(150.0), ry(150.0),
        scrollDrag(false), addLineTool(false), addCircleTool(false),
        addDimensionTool(false),
-       selectionInProgress(false),
+//     selectionInProgress(false),
        toolAction(NULL)
 {
        document.isTopLevelContainer = true;
@@ -284,13 +284,13 @@ void DrawingView::paintEvent(QPaintEvent * /*event*/)
        if (toolAction)
                toolAction->Draw(&painter);
 
-       if (selectionInProgress)
+       if (Object::selectionInProgress)
        {
 //             painter.SetPen(QPen(Qt::green, 1.0, Qt::SolidLine));
                painter.SetPen(QPen(QColor(255, 127, 0, 255)));
 //             painter.SetBrush(QBrush(Qt::NoBrush));
                painter.SetBrush(QBrush(QColor(255, 127, 0, 100)));
-               painter.DrawRect(selection);
+               painter.DrawRect(Object::selection);
        }
 }
 
@@ -311,9 +311,9 @@ void DrawingView::mousePressEvent(QMouseEvent * event)
                // Didn't hit any object and not using a tool, so do a selection rectangle
                if (!(collided || toolAction))
                {
-                       selectionInProgress = true;
-                       selection.setTopLeft(QPointF(point.x, point.y));
-                       selection.setBottomRight(QPointF(point.x, point.y));
+                       Object::selectionInProgress = true;
+                       Object::selection.setTopLeft(QPointF(point.x, point.y));
+                       Object::selection.setBottomRight(QPointF(point.x, point.y));
                }
        }
        else if (event->button() == Qt::MiddleButton)
@@ -329,7 +329,7 @@ void DrawingView::mousePressEvent(QMouseEvent * event)
 void DrawingView::mouseMoveEvent(QMouseEvent * event)
 {
        Vector point = Painter::QtToCartesianCoords(Vector(event->x(), event->y()));
-       selection.setBottomRight(QPointF(point.x, point.y));
+       Object::selection.setBottomRight(QPointF(point.x, point.y));
 
        if (event->buttons() & Qt::MiddleButton)
        {
@@ -373,7 +373,7 @@ void DrawingView::mouseMoveEvent(QMouseEvent * event)
 //changed...
        document.PointerMoved(point);
 
-       if (document.NeedsUpdate() || selectionInProgress)
+       if (document.NeedsUpdate() || Object::selectionInProgress)
                update();
 
        if (toolAction)
@@ -400,10 +400,10 @@ void DrawingView::mouseReleaseEvent(QMouseEvent * event)
                if (toolAction)
                        toolAction->MouseReleased();
 
-               if (selectionInProgress)
+               if (Object::selectionInProgress)
                {
                        // Select all the stuff inside of selection
-                       selectionInProgress = false;
+                       Object::selectionInProgress = false;
                }
        }
        else if (event->button() == Qt::MiddleButton)