]> Shamusworld >> Repos - architektonas/blob - src/drawingview.h
Fix DrawArcAction to actually allow creation of Arcs.
[architektonas] / src / drawingview.h
1 #ifndef __DRAWINGVIEW_H__
2 #define __DRAWINGVIEW_H__
3
4 #include <QtGui>
5 #include <stdint.h>
6 #include "action.h"
7 #include "container.h"
8
9 class DrawingView: public QWidget
10 {
11         Q_OBJECT
12
13         public:
14                 DrawingView(QWidget * parent = NULL);
15
16         public:
17                 void SetRotateToolActive(bool state = true);
18 #if 0
19                 void SetAddLineToolActive(bool state = true);
20                 void SetAddCircleToolActive(bool state = true);
21                 void SetAddArcToolActive(bool state = true);
22                 void SetAddDimensionToolActive(bool state = true);
23 #endif
24 //              void SetToolActive(Action * action, bool state = true);
25                 void SetToolActive(Action * action);//, bool state = true);
26                 void SetGridSize(uint32_t);
27                 void UpdateGridBackground(void);
28
29         public slots:
30                 void AddNewObjectToDocument(Object *);
31
32         protected:
33                 void paintEvent(QPaintEvent * event);
34                 void resizeEvent(QResizeEvent * event);
35                 void mousePressEvent(QMouseEvent * event);
36                 void mouseMoveEvent(QMouseEvent * event);
37                 void mouseReleaseEvent(QMouseEvent * event);
38
39         private:
40                 QPoint GetAdjustedMousePosition(QMouseEvent * event);
41                 QPoint GetAdjustedClientPosition(int x, int y);
42                 Vector SnapPointToGrid(Vector);
43
44         public:
45                 bool useAntialiasing;
46
47         private:
48 //              QBrush * backgroundBrush;
49                 QPixmap gridBackground;
50                 double scale;                                                   // Window scaling factor
51                 int32_t offsetX, offsetY;                               // Window offsets
52         public:
53                 Container document;
54                 double gridSpacing;                                             // Grid spacing in base units
55                 uint32_t gridPixels;                                    // Grid size in pixels
56 //              double gridBaseUnits;                                   // Grid size in base units
57         private:
58                 bool collided;
59 //Should this go into Object's class variables???
60                 bool rotateTool;
61                 double rx, ry;
62                 bool scrollDrag;
63                 Vector oldPoint;
64                 bool addLineTool;
65                 bool addCircleTool;
66                 bool addDimensionTool;
67 //              bool selectionInProgress;
68 //              QRectF selection;
69
70         public:
71                 Action * toolAction;
72 };
73
74 #endif  // __DRAWINGVIEW_H__