1 #ifndef __DRAWINGVIEW_H__
2 #define __DRAWINGVIEW_H__
8 enum { ToolMouseDown, ToolMouseMove, ToolMouseUp, ToolKeyDown, ToolKeyUp, ToolCleanup };
12 class DrawingView: public QWidget
17 DrawingView(QWidget * parent = NULL);
20 void SetGridSize(uint32_t);
21 void UpdateGridBackground(void);
22 Point SnapPointToGrid(Point);
23 void RenderObjects(Painter *, std::vector<void *> &);
24 void AddHoveredToSelection(void);
25 void GetSelection(std::vector<void *> &);
26 void GetHovered(std::vector<void *> &);
27 void ToolHandler(int, Point);
28 void ToolDraw(Painter *);
29 void LineHandler(int, Point);
30 void CircleHandler(int, Point);
31 void ArcHandler(int, Point);
32 void RotateHandler(int, Point);
33 void CheckObjectBounds(void);
34 bool HitTestObjects(Point);
35 void HandleObjectMovement(Point);
38 void SetCurrentLayer(int);
41 void paintEvent(QPaintEvent * event);
42 void resizeEvent(QResizeEvent * event);
43 void mousePressEvent(QMouseEvent * event);
44 void mouseMoveEvent(QMouseEvent * event);
45 void mouseReleaseEvent(QMouseEvent * event);
46 void wheelEvent(QWheelEvent * event);
47 void keyPressEvent(QKeyEvent * event);
48 void keyReleaseEvent(QKeyEvent * event);
51 QPoint GetAdjustedMousePosition(QMouseEvent * event);
52 QPoint GetAdjustedClientPosition(int x, int y);
62 QPixmap gridBackground;
63 double scale; // Window scaling factor
64 int32_t offsetX, offsetY; // Window offsets
67 uint32_t gridPixels; // Grid size in pixels
72 QString informativeText;
75 std::vector<void *> select;
76 std::vector<void *> hover;
77 std::vector<void *> toolObjects;
78 std::vector<Object> toolScratch;
82 // static Container document;
85 #endif // __DRAWINGVIEW_H__