1 #ifndef __DRAWINGVIEW_H__
2 #define __DRAWINGVIEW_H__
9 enum { ToolMouseDown, ToolMouseMove, ToolMouseUp, ToolKeyDown, ToolKeyUp, ToolCleanup };
13 class DrawingView: public QWidget
18 DrawingView(QWidget * parent = NULL);
21 void DrawBackground(Painter *);
22 Point SnapPointToGrid(Point);
23 Point SnapPointToAngle(Point);
24 void RenderObjects(Painter *, VPVector &, int, bool ignoreLayer = false);
25 void HandleSelectionClick(VPVector &);
26 VPVector GetSelection(void);
27 VPVector GetHovered(bool exclude = false);
28 void MoveSelectedToLayer(int);
29 void ToolHandler(int, Point);
30 void ToolDraw(Painter *);
31 void LineHandler(int, Point);
32 void CircleHandler(int, Point);
33 void ArcHandler(int, Point);
34 void RotateHandler(int, Point);
35 void MirrorHandler(int, Point);
36 void DimensionHandler(int, Point);
37 void DeleteHandler(int, Point);
38 void TriangulateHandler(int, Point);
39 void TrimHandler(int, Point);
40 void ParallelHandler(int, Point);
41 Rect GetObjectExtents(Object *);
42 void CheckObjectBounds(void);
43 bool HitTestObjects(Point);
44 bool HitTest(Object *, Point);
45 bool HandleObjectClicked(void);
46 void HandleObjectMovement(Point);
47 void AddDimensionTo(void * obj);
50 void DeleteCurrentLayer(int);
51 void HandleLayerToggle(void);
52 void HandleLayerSwap(int, int);
53 void HandleLayerSwap(int, int, VPVector &);
54 void HandlePenStamp(QAction *);
55 void HandlePenDropper(QAction *);
58 void ObjectHovered(Object *);
59 void ObjectSelected(Object *);
60 void NeedZoomUpdate(void);
63 void focusOutEvent(QFocusEvent * event);
64 void focusInEvent(QFocusEvent * event);
65 void paintEvent(QPaintEvent * event);
66 void resizeEvent(QResizeEvent * event);
67 void mousePressEvent(QMouseEvent * event);
68 void mouseMoveEvent(QMouseEvent * event);
69 void mouseReleaseEvent(QMouseEvent * event);
70 void wheelEvent(QWheelEvent * event);
71 void keyPressEvent(QKeyEvent * event);
72 void keyReleaseEvent(QKeyEvent * event);
75 void DrawSubGrid(Painter *, uint32_t, double, Vector, Vector);
76 QPoint GetAdjustedMousePosition(QMouseEvent * event);
77 QPoint GetAdjustedClientPosition(int x, int y);
87 QPixmap gridBackground;
88 double scale; // Window scaling factor
89 int32_t offsetX, offsetY; // Window offsets
93 uint32_t currentSelect;
96 uint32_t gridPixels; // Grid size in pixels
97 double gridPixelsF; // Grid size in pixels (float)
101 Vector oldScrollPoint;
102 QString informativeText;
106 VPVector toolObjects;
107 std::vector<Object> toolScratch;
108 VPVector toolScratch2;
111 Object * toolObj[32];
112 double toolParam[32];
113 Point intersectionPoint;
115 bool hoverPointValid;
116 bool hoveringIntersection;
121 bool scrollWheelSeen;
124 #endif // __DRAWINGVIEW_H__