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 AddHoveredToSelection(void);
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 HandlePenWidth(float);
55 void HandlePenStyle(int);
56 void HandlePenColor(uint32_t);
57 void HandlePenStamp(QAction *);
58 void HandlePenDropper(QAction *);
61 void ObjectHovered(Object *);
62 void ObjectSelected(Object *);
63 void NeedZoomUpdate(void);
66 void focusOutEvent(QFocusEvent * event);
67 void focusInEvent(QFocusEvent * event);
68 void paintEvent(QPaintEvent * event);
69 void resizeEvent(QResizeEvent * event);
70 void mousePressEvent(QMouseEvent * event);
71 void mouseMoveEvent(QMouseEvent * event);
72 void mouseReleaseEvent(QMouseEvent * event);
73 void wheelEvent(QWheelEvent * event);
74 void keyPressEvent(QKeyEvent * event);
75 void keyReleaseEvent(QKeyEvent * event);
78 void DrawSubGrid(Painter *, uint32_t, double, Vector, Vector);
79 QPoint GetAdjustedMousePosition(QMouseEvent * event);
80 QPoint GetAdjustedClientPosition(int x, int y);
90 QPixmap gridBackground;
91 double scale; // Window scaling factor
92 int32_t offsetX, offsetY; // Window offsets
98 uint32_t gridPixels; // Grid size in pixels
99 double gridPixelsF; // Grid size in pixels (float)
105 Vector oldScrollPoint;
106 QString informativeText;
110 VPVector toolObjects;
111 std::vector<Object> toolScratch;
112 VPVector toolScratch2;
114 Object * toolObj[32];
115 double toolParam[32];
116 Point intersectionPoint;
118 bool hoverPointValid;
119 bool hoveringIntersection;
124 bool scrollWheelSeen;
127 #endif // __DRAWINGVIEW_H__