X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdrawingview.cpp;h=bd4bb4638612a895ecb99185e28abbca7a05ecb5;hb=a14390c31519388a3e4f01bc53c0e4572708940c;hp=911b2bac0cbeb232ccfa438e4e1e8b49d560b2bb;hpb=9f6ad3fe0b9cb30115a5d38e8af3aebed0d70c08;p=architektonas diff --git a/src/drawingview.cpp b/src/drawingview.cpp index 911b2ba..bd4bb46 100644 --- a/src/drawingview.cpp +++ b/src/drawingview.cpp @@ -20,7 +20,7 @@ // Uncomment this for debugging... //#define DEBUG -//#define DEBUGFOO // Various tool debugging... +//#define DEBUGFOO // Various tool debugging... //#define DEBUGTP // Toolpalette debugging... #include "drawingview.h" @@ -50,14 +50,23 @@ DrawingView::DrawingView(QWidget * parent/*= NULL*/): QWidget(parent), // setCursor(cur[TOOLSelect]); // setMouseTracking(true); - document.Add(new Line(Vector(5, 5), Vector(50, 40), &document)); + Line * line = new Line(Vector(5, 5), Vector(50, 40), &document); + document.Add(line); document.Add(new Line(Vector(50, 40), Vector(10, 83), &document)); document.Add(new Line(Vector(10, 83), Vector(17, 2), &document)); document.Add(new Circle(Vector(100, 100), 36, &document)); document.Add(new Circle(Vector(50, 150), 49, &document)); 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)); - document.Add(new Dimension(Vector(5, 5), Vector(50, 40), &document)); +#if 1 + Dimension * dimension = new Dimension(Vector(0, 0), Vector(0, 0), &document); + line->SetDimensionOnLine(dimension); +// line->SetDimensionOnPoint2(dimension); + document.Add(dimension); +#else + // Alternate way to do the above... + line->SetDimensionOnLine(); +#endif } QPoint DrawingView::GetAdjustedMousePosition(QMouseEvent * event) @@ -154,12 +163,15 @@ void DrawingView::mouseMoveEvent(QMouseEvent * event) // snap to the one before it. So we add half of the grid spacing to the // point, then divide by it so that we can remove the fractional part, then // multiply it back to get back to the correct answer. - point += gridSpacing / 2.0; // *This* adds to Z!!! - point /= gridSpacing; - point.x = floor(point.x);//need to fix this for negative numbers... - point.y = floor(point.y); - point.z = 0; // Make *sure* Z doesn't go anywhere!!! - point *= gridSpacing; + if (event->buttons() & Qt::LeftButton) + { + point += gridSpacing / 2.0; // *This* adds to Z!!! + point /= gridSpacing; + point.x = floor(point.x);//need to fix this for negative numbers... + point.y = floor(point.y); + point.z = 0; // Make *sure* Z doesn't go anywhere!!! + point *= gridSpacing; + } #endif //we should keep track of the last point here and only pass this down *if* the point //changed...