]> Shamusworld >> Repos - architektonas/blobdiff - src/drawlineaction.cpp
Added better visual feedback to add Line and Circle tools.
[architektonas] / src / drawlineaction.cpp
index 867970df4d62685e1b87831fe1467d3865d81508..780ad58a66c3fd49f9e563f3156aa3af29ffa98f 100644 (file)
@@ -4,7 +4,7 @@
 // (C) 2011 Underground Software
 // See the README and GPLv3 files for licensing and warranty information
 //
-// JLH = James L. Hammons <jlhamm@acm.org>
+// JLH = James Hammons <jlhamm@acm.org>
 //
 // WHO  WHEN        WHAT
 // ---  ----------  ------------------------------------------------------------
@@ -33,14 +33,17 @@ DrawLineAction::~DrawLineAction()
 
 /*virtual*/ void DrawLineAction::Draw(Painter * painter)
 {
-       // Need to fix pen colors, etc...
+       painter->SetPen(QPen(Qt::red, 2.0, Qt::DotLine));
+
+       // I think stuff like crosshairs should be done in the DrawingView, tho
        if (state == FIRST_POINT)
        {
-               painter->DrawPoint(p1.x, p1.y);
+               painter->DrawHandle(p1);
        }
        else
        {
                painter->DrawLine(p1, p2);
+               painter->DrawHandle(p2);
        }
 }
 
@@ -63,14 +66,18 @@ DrawLineAction::~DrawLineAction()
 /*virtual*/ void DrawLineAction::MouseReleased(void)
 {
        if (state == FIRST_POINT)
+       {
+               p2 = p1;
                state = NEXT_POINT;
+       }
        else if (state == NEXT_POINT)
        {
-               // We create the new object here, and then pass it off to the document.
+               // 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);
                // We don't need no stinkin' sentinels, when we have signals & slots!
                emit ObjectReady(line);
-               
+
                p1 = p2;
        }
 }