X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdrawingview.cpp;h=3f27f96f84c5284b24d7efb5b06f67e7f32c14a8;hb=baf67656b97e3d61e9223e66ebe4f554e364cd4a;hp=0d62be16552d6eafc26e70268b8b085faa6b2ace;hpb=7b7c8ec7d7f5379e09a8b7392f465f41639b0c79;p=architektonas diff --git a/src/drawingview.cpp b/src/drawingview.cpp index 0d62be1..3f27f96 100644 --- a/src/drawingview.cpp +++ b/src/drawingview.cpp @@ -46,7 +46,8 @@ DrawingView::DrawingView(QWidget * parent/*= NULL*/): QWidget(parent), gridBackground(256, 256), scale(1.0), offsetX(-10), offsetY(-10), document(Vector(0, 0)), - gridSpacing(32.0), collided(false), rotateTool(false), rx(150.0), ry(150.0), +// gridSpacing(32.0), collided(false), rotateTool(false), rx(150.0), ry(150.0), + gridSpacing(12.0), collided(false), rotateTool(false), rx(150.0), ry(150.0), scrollDrag(false), addLineTool(false), toolAction(NULL) { setBackgroundRole(QPalette::Base); @@ -66,7 +67,7 @@ DrawingView::DrawingView(QWidget * parent/*= NULL*/): QWidget(parent), document.Add(new Arc(Vector(300, 300), 32, PI / 4.0, PI * 1.3, &document)), document.Add(new Arc(Vector(200, 200), 60, PI / 2.0, PI * 1.5, &document)); #if 1 - Dimension * dimension = new Dimension(Vector(0, 0), Vector(0, 0), &document); + Dimension * dimension = new Dimension(Vector(0, 0), Vector(0, 0), DTLinear, &document); line->SetDimensionOnLine(dimension); document.Add(dimension); #else @@ -91,7 +92,7 @@ DrawingView::DrawingView(QWidget * parent/*= NULL*/): QWidget(parent), pmp.fillRect(192, 128, 64, 64, Qt::darkGray); #else pmp.fillRect(0, 0, 256, 256, QColor(240, 240, 240)); - pmp.setPen(QPen(QColor(190, 190, 255), 2.0, Qt::SolidLine)); + pmp.setPen(QPen(QColor(210, 210, 255), 2.0, Qt::SolidLine)); for(int i=0; i<255; i+=12) pmp.drawLine(i, 0, i, 255); for(int i=0; i<255; i+=12) @@ -178,6 +179,7 @@ setPalette(pal); Vector pixmapOrigin = Painter::CartesianToQtCoords(Vector()); int x = (int)pixmapOrigin.x; int y = (int)pixmapOrigin.y; + // Use mod arithmetic to grab the correct swatch of background // Problem with mod 128: Negative numbers screw it up... [FIXED] x = (x < 0 ? 0 : BG_BRUSH_SPAN - 1) - (x % BG_BRUSH_SPAN); y = (y < 0 ? 0 : BG_BRUSH_SPAN - 1) - (y % BG_BRUSH_SPAN); @@ -240,7 +242,8 @@ void DrawingView::paintEvent(QPaintEvent * /*event*/) painter.DrawLine(-16384, 0, 16384, 0); // Draw supplemental (tool related) points - +// NOTE that this can be done as an action! +// In that case, we would need access to the document... if (rotateTool) { painter.SetPen(QPen(QColor(0, 200, 0), 2.0, Qt::SolidLine)); @@ -264,11 +267,11 @@ void DrawingView::paintEvent(QPaintEvent * /*event*/) painter.drawLine(-16384, (int)y, 16384, (int)y); #endif - painter.SetPen(QPen(Qt::black, 1.0, Qt::SolidLine)); - - for(double x=0; x