]> Shamusworld >> Repos - architektonas/blobdiff - src/drawingview.h
Fix for Print Preview for centering of drawing on page.
[architektonas] / src / drawingview.h
index 5cbd53b8952411808ec7ebb9622d72251613df17..704b79d357f60b1b610a0afbf4d802ea8f271fd1 100644 (file)
@@ -3,10 +3,13 @@
 
 #include <QtWidgets>
 #include <stdint.h>
-//#include "action.h"
-//#include "container.h"
+#include "rect.h"
 #include "structs.h"
 
+enum { ToolMouseDown, ToolMouseMove, ToolMouseUp, ToolKeyDown, ToolKeyUp, ToolCleanup };
+
+class Painter;
+
 class DrawingView: public QWidget
 {
        Q_OBJECT
@@ -15,17 +18,51 @@ class DrawingView: public QWidget
                DrawingView(QWidget * parent = NULL);
 
        public:
-//             void SetToolActive(Action * action);
-               void SetGridSize(uint32_t);
-               void UpdateGridBackground(void);
+               void DrawBackground(Painter *);
                Point SnapPointToGrid(Point);
+               Point SnapPointToAngle(Point);
+               void RenderObjects(Painter *, VPVector &, int, bool ignoreLayer = false);
+               void AddHoveredToSelection(void);
+               VPVector GetSelection(void);
+               VPVector GetHovered(void);
+               void ToolHandler(int, Point);
+               void ToolDraw(Painter *);
+               void LineHandler(int, Point);
+               void CircleHandler(int, Point);
+               void ArcHandler(int, Point);
+               void RotateHandler(int, Point);
+               void MirrorHandler(int, Point);
+               void DimensionHandler(int, Point);
+               void TriangulateHandler(int, Point);
+               void TrimHandler(int, Point);
+               void ParallelHandler(int, Point);
+               Rect GetObjectExtents(Object *);
+               void CheckObjectBounds(void);
+               bool HitTestObjects(Point);
+               bool HitTest(Object *, Point);
+               bool HandleObjectClicked(void);
+               void HandleObjectMovement(Point);
+               void AddDimensionTo(void * obj);
 
        public slots:
-               void AddNewObjectToDocument(Object *);
-               void HandleActionUpdate(void);
-               void SetCurrentLayer(int);
+               void DeleteCurrentLayer(int);
+               void HandleLayerToggle(void);
+               void HandleLayerSwap(int, int);
+               void HandleLayerSwap(int, int, VPVector &);
+               void HandlePenWidth(float);
+               void HandlePenStyle(int);
+               void HandlePenColor(uint32_t);
+               void HandlePenStamp(QAction *);
+               void HandlePenDropper(QAction *);
+
+       signals:
+               void ObjectHovered(Object *);
+               void ObjectSelected(Object *);
+               void NeedZoomUpdate(void);
 
        protected:
+               void focusOutEvent(QFocusEvent * event);
+               void focusInEvent(QFocusEvent * event);
                void paintEvent(QPaintEvent * event);
                void resizeEvent(QResizeEvent * event);
                void mousePressEvent(QMouseEvent * event);
@@ -36,29 +73,52 @@ class DrawingView: public QWidget
                void keyReleaseEvent(QKeyEvent * event);
 
        private:
+               void DrawSubGrid(Painter *, uint32_t, double, Vector, Vector);
                QPoint GetAdjustedMousePosition(QMouseEvent * event);
                QPoint GetAdjustedClientPosition(int x, int y);
 
        public:
                bool useAntialiasing;
+               uint32_t numHovered;
+               bool shiftDown;
+               bool ctrlDown;
+               bool altDown;
 
        private:
                QPixmap gridBackground;
                double scale;                                                   // Window scaling factor
                int32_t offsetX, offsetY;                               // Window offsets
+               bool supressSelected;
+               QCursor curMarker;
+               QCursor curDropper;
        public:
                Container document;
                uint32_t gridPixels;                                    // Grid size in pixels
-       private:
+               double gridPixelsF;                                             // Grid size in pixels (float)
+//     private:
+       public:
                bool collided;
                bool scrollDrag;
                Vector oldPoint;
+               Vector oldScrollPoint;
+               QString informativeText;
 
        public:
-//             Action * toolAction;
-
-//     public:
-//             static Container document;
+               VPVector select;
+               VPVector toolObjects;
+               std::vector<Object> toolScratch;
+               VPVector toolScratch2;
+               Point toolPoint[32];
+               Object * toolObj[32];
+               Point intersectionPoint;
+               Point hoverPoint;
+               bool hoverPointValid;
+               bool hoveringIntersection;
+               Object * dragged;
+               bool draggingObject;
+               bool angleSnap;
+               bool dirty;
+               bool scrollWheelSeen;
 };
 
 #endif // __DRAWINGVIEW_H__