X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdrawingview.cpp;h=8104f82b2ca7644698f60b67e1fecb46582d32f2;hb=da1348151182fe5340495ff8243e662b96c1fbfa;hp=aeb764cc5781ff38364f7a99eb154c4898c360bd;hpb=06456047e6476969e45be5b1f31b8336ea74c45f;p=architektonas diff --git a/src/drawingview.cpp b/src/drawingview.cpp index aeb764c..8104f82 100644 --- a/src/drawingview.cpp +++ b/src/drawingview.cpp @@ -370,13 +370,13 @@ void DrawingView::RenderObjects(Painter * painter, std::vector & v) { Circle * ci = (Circle *)obj; painter->SetBrush(QBrush(Qt::NoBrush)); - painter->DrawEllipse(ci->p[0], ci->radius, ci->radius); + painter->DrawEllipse(ci->p[0], ci->radius[0], ci->radius[0]); break; } case OTArc: { Arc * a = (Arc *)obj; - painter->DrawArc(a->p[0], a->radius, a->angle1, a->angle2); + painter->DrawArc(a->p[0], a->radius[0], a->angle[0], a->angle[1]); break; } case OTDimension: @@ -707,7 +707,7 @@ void DrawingView::RotateHandler(int mode, Point p) if (shiftDown) return; - double angle = Vector(toolPoint[1], toolPoint[0]).Angle(); + double angle = Vector(toolPoint[0], toolPoint[1]).Angle(); std::vector::iterator j = select.begin(); std::vector::iterator i = toolScratch.begin(); @@ -719,6 +719,15 @@ void DrawingView::RotateHandler(int mode, Point p) Object * obj2 = (Object *)(*j); obj2->p[0] = p1; obj2->p[1] = p2; + + if (obj.type == OTArc) + { +//printf("Obj2->angle[0] = %f, obj.angle[0] = %f, angle = %f\n", obj2->angle[0], obj.angle[0], angle); + obj2->angle[0] = obj.angle[0] + angle; + + if (obj2->angle[0] > PI_TIMES_2) + obj2->angle[0] -= PI_TIMES_2; + } } } @@ -913,26 +922,25 @@ void DrawingView::mouseReleaseEvent(QMouseEvent * event) } if (Global::selectionInProgress) - { - // Select all the stuff inside of selection Global::selectionInProgress = false; - // Clear our vectors - select.clear(); - hover.clear(); +// Should be we do this automagically? Hmm... + // Clear our vectors + select.clear(); + hover.clear(); - // Scoop 'em up - std::vector::iterator i; + // Scoop 'em up + std::vector::iterator i; - for(i=document.objects.begin(); i!=document.objects.end(); i++) - { - if (((Object *)(*i))->selected) - select.push_back(*i); + for(i=document.objects.begin(); i!=document.objects.end(); i++) + { + if (((Object *)(*i))->selected) + select.push_back(*i); //hmm, this is no good, too late to do any good :-P // if ((*i)->hovered) // hover.push_back(*i); - } +// } } } else if (event->button() == Qt::MiddleButton) @@ -1058,7 +1066,7 @@ void DrawingView::CheckObjectBounds(void) { Circle * c = (Circle *)obj; - if (Global::selection.contains(c->p[0].x - c->radius, c->p[0].y - c->radius) && Global::selection.contains(c->p[0].x + c->radius, c->p[0].y + c->radius)) + if (Global::selection.contains(c->p[0].x - c->radius[0], c->p[0].y - c->radius[0]) && Global::selection.contains(c->p[0].x + c->radius[0], c->p[0].y + c->radius[0])) c->selected = true; break; @@ -1067,8 +1075,8 @@ void DrawingView::CheckObjectBounds(void) { Arc * a = (Arc *)obj; - double start = a->angle1; - double end = start + a->angle2; + double start = a->angle[0]; + double end = start + a->angle[1]; QPointF p1(cos(start), sin(start)); QPointF p2(cos(end), sin(end)); QRectF bounds(p1, p2); @@ -1119,8 +1127,8 @@ void DrawingView::CheckObjectBounds(void) if ((start < ((3.0 * PI) + PI_OVER_2)) && (end > ((3.0 * PI) + PI_OVER_2))) bounds.setBottom(-1.0); - bounds.setTopLeft(QPointF(bounds.left() * a->radius, bounds.top() * a->radius)); - bounds.setBottomRight(QPointF(bounds.right() * a->radius, bounds.bottom() * a->radius)); + bounds.setTopLeft(QPointF(bounds.left() * a->radius[0], bounds.top() * a->radius[0])); + bounds.setBottomRight(QPointF(bounds.right() * a->radius[0], bounds.bottom() * a->radius[0])); bounds.translate(a->p[0].x, a->p[0].y); if (Global::selection.contains(bounds))