]> Shamusworld >> Repos - architektonas/blobdiff - src/dimension.h
Added more visual feedback to Dimension type changing buttons.
[architektonas] / src / dimension.h
index 7ffca2faabf8e72b4473c809c1f8981391cf8c07..fbc2896a21735573983e69d477ae98d06f716e4d 100644 (file)
@@ -1,36 +1,43 @@
 #ifndef __DIMENSION_H__
 #define __DIMENSION_H__
 
-#include "connection.h"
 #include "object.h"
 
+class Line;
+
 enum DimensionType { DTLinear, DTLinearVert, DTLinearHorz, DTRadial, DTDiametric, DTCircumferential, DTAngular, DTLeader };
 
 class Dimension: public Object
 {
+       friend class Line;
+       friend class Geometry;
+
        public:
                Dimension(Vector, Vector, DimensionType dt = DTLinear, Object * p = 0);
-               Dimension(Connection, Connection, DimensionType dt = DTLinear, Object * p = 0);
                ~Dimension();
 
                virtual void Draw(Painter *);
                virtual Vector Center(void);
                virtual bool Collided(Vector);
-               virtual void PointerMoved(Vector);
+               virtual bool PointerMoved(Vector);
                virtual void PointerReleased(void);
                virtual bool HitTest(Point);
                virtual void Enumerate(FILE *);
                virtual Object * Copy(void);
                virtual Vector GetPointAtParameter(double parameter);
-               virtual void Connect(Object *, double);
-               virtual void Disconnect(Object *, double);
-               virtual void DisconnectAll(Object *);
+               virtual void MovePointAtParameter(double parameter, Vector);
                virtual QRectF Extents(void);
                void FlipSides(void);
 
+       protected:
+               void SaveHitState(void);
+               bool HitStateChanged(void);
+
        protected:
                Vector endpoint;                                        // Starting point is Object::position
                Vector oldPoint;                                        // Used for dragging
+               Point oldEndpoint;
+               Point linePt1, linePt2;                         // Used for testing dimension line hits
 
        private:
                bool dragging;
@@ -41,14 +48,13 @@ class Dimension: public Object
                DimensionType dimensionType;
                bool hitPoint1;
                bool hitPoint2;
+               bool hitLine;
+               bool hitFlipSwitch;
+               bool hitChangeSwitch1;
+               bool hitChangeSwitch2;
+               bool oldHitPoint1, oldHitPoint2, oldHitLine, oldHitFlipSwitch, oldHitChangeSwitch1, oldHitChangeSwitch2;
        public:
                double size;                                            // Size of arrows/text in base units
-
-       private:
-               // We use these in lieu of the built-in connected[] array; no reason to
-               // do it this way especially
-               Connection point1;
-               Connection point2;
 };
 
 #endif // __DIMENSION_H__