]> Shamusworld >> Repos - architektonas/blobdiff - src/drawsplineaction.cpp
Initial work on making Rotate tool work, plus removal of unneeded files.
[architektonas] / src / drawsplineaction.cpp
diff --git a/src/drawsplineaction.cpp b/src/drawsplineaction.cpp
deleted file mode 100644 (file)
index 644cd50..0000000
+++ /dev/null
@@ -1,135 +0,0 @@
-// drawsplineaction.cpp: Action class for drawing NURBS
-//
-// Part of the Architektonas Project
-// (C) 2014 Underground Software
-// See the README and GPLv3 files for licensing and warranty information
-//
-// JLH = James Hammons <jlhamm@acm.org>
-//
-// WHO  WHEN        WHAT
-// ---  ----------  ------------------------------------------------------------
-// JLH  03/20/2014  Created this file
-//
-
-#include "drawsplineaction.h"
-#include "spline.h"
-#include "mathconstants.h"
-#include "painter.h"
-
-
-enum { FIRST_POINT, NEXT_POINT };
-
-
-DrawSplineAction::DrawSplineAction(): state(FIRST_POINT), spline(NULL),
-       shiftWasPressedOnNextPoint(false)
-{
-}
-
-
-DrawSplineAction::~DrawSplineAction()
-{
-}
-
-
-/*virtual*/ void DrawSplineAction::Draw(Painter * painter)
-{
-       painter->SetPen(QPen(Qt::red, 2.0, Qt::DotLine));
-
-       // I think stuff like crosshairs should be done in the DrawingView, tho
-       // (and it's done there now...)
-       if (state == FIRST_POINT)
-       {
-               painter->DrawHandle(p1);
-       }
-       else
-       {
-               painter->DrawLine(p1, p2);
-               painter->DrawHandle(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);
-       }
-}
-
-
-/*virtual*/ void DrawSplineAction::MouseDown(Vector point)
-{
-       // Clear our override...
-       shiftWasPressedOnNextPoint = false;
-
-       if (state == FIRST_POINT)
-               p1 = point;
-       else
-               p2 = point;
-}
-
-
-/*virtual*/ void DrawSplineAction::MouseMoved(Vector point)
-{
-       if (state == FIRST_POINT)
-               p1 = point;
-       else
-               p2 = point;
-}
-
-
-/*virtual*/ void DrawSplineAction::MouseReleased(void)
-{
-       if (state == FIRST_POINT)
-       {
-               p2 = p1;
-               state = NEXT_POINT;
-               spline = NULL;
-       }
-       else if (state == NEXT_POINT)
-       {
-               Spline * oldSpline = spline;
-               // We create the new object here, and then pass it off to the
-               // DrawingView which stuffs it into the document.
-               spline = new Spline(p1, p2.Angle());
-
-               // Connect Lines by default
-               if (oldSpline)
-               {
-                       oldSpline->Connect(spline, 0);
-                       spline->Connect(oldSpline, 1.0);
-               }
-
-               // We don't need no stinkin' sentinels, when we have signals & slots!
-               emit ObjectReady(spline);
-
-               p1 = p2;
-               state = NEXT_POINT;
-       }
-}
-
-
-/*virtual*/ void DrawSplineAction::KeyDown(int key)
-{
-       if ((key == Qt::Key_Shift) && (state == NEXT_POINT))
-       {
-               shiftWasPressedOnNextPoint = true;
-               p1Save = p1;
-               p1 = p2;
-               state = FIRST_POINT;
-               emit NeedRefresh();
-       }
-}
-
-
-/*virtual*/ void DrawSplineAction::KeyReleased(int key)
-{
-       if ((key == Qt::Key_Shift) && shiftWasPressedOnNextPoint)
-       {
-               shiftWasPressedOnNextPoint = false;
-               p2 = p1;
-               p1 = p1Save;
-               state = NEXT_POINT;
-               emit(NeedRefresh());
-       }
-}
-