]> Shamusworld >> Repos - architektonas/blobdiff - src/drawlineaction.cpp
Fixed 'flip sides' handle to work on Dimension object.
[architektonas] / src / drawlineaction.cpp
index 27b9513c04574e395ca22a7273c3b3ed126b003d..3dc9f7d240922b1c14f1122a9fa3d791941251a3 100644 (file)
@@ -14,6 +14,7 @@
 
 #include "drawlineaction.h"
 #include "line.h"
+#include "mathconstants.h"
 #include "painter.h"
 
 
@@ -46,8 +47,11 @@ DrawLineAction::~DrawLineAction()
                painter->DrawLine(p1, p2);
                painter->DrawHandle(p2);
 
-               QString text = tr("Length: %1 in.");
-               text = text.arg(Vector::Magnitude(p1, p2));
+               Vector v(p1, p2);
+               double absAngle = v.Angle() * RADIANS_TO_DEGREES;
+               double absLength = v.Magnitude();
+               QString text = tr("Length: %1 in.\n") + QChar(0x2221) + tr(": %2");
+               text = text.arg(absLength).arg(absAngle);
                painter->DrawInformativeText(text);
        }
 }
@@ -80,12 +84,22 @@ DrawLineAction::~DrawLineAction()
        {
                p2 = p1;
                state = NEXT_POINT;
+               line = NULL;
        }
        else if (state == NEXT_POINT)
        {
+               Line * oldLine = line;
                // We create the new object here, and then pass it off to the
                // DrawingView which stuffs it into the document.
                line = new Line(p1, p2);
+
+               // Connect Lines by default
+               if (oldLine)
+               {
+                       oldLine->Connect(line, 0);
+                       line->Connect(oldLine, 1.0);
+               }
+
                // We don't need no stinkin' sentinels, when we have signals & slots!
                emit ObjectReady(line);
 
@@ -103,7 +117,7 @@ DrawLineAction::~DrawLineAction()
                p1Save = p1;
                p1 = p2;
                state = FIRST_POINT;
-               emit(NeedRefresh());
+               emit NeedRefresh();
        }
 }