]> Shamusworld >> Repos - ttedit/blob - src/editwindow.h
983a96c1e02b636e0340b68f95df5df58294d91c
[ttedit] / src / editwindow.h
1 //
2 // EDITWINDOW.H: Header file
3 //
4 // by James L. Hammons
5 // (C) 2008 Underground Software
6 //
7
8 #ifndef __EDITWINDOW_H__
9 #define __EDITWINDOW_H__
10
11 #include <QtWidgets>
12 #include <stdint.h>
13 #include "toolwindow.h"                                                 // For ToolType enum
14 #include "glyphpoints.h"
15 #include "painter.h"
16
17
18 class EditWindow: public QWidget
19 {
20         Q_OBJECT
21
22         public:
23                 EditWindow(QWidget * parent = NULL);
24                 QSize minimumSizeHint() const;
25                 QSize sizeHint() const;
26
27         protected:
28                 void paintEvent(QPaintEvent *);
29                 void mousePressEvent(QMouseEvent *);
30                 void mouseMoveEvent(QMouseEvent *);
31                 void mouseReleaseEvent(QMouseEvent *);
32                 void keyPressEvent(QKeyEvent *);
33                 void keyReleaseEvent(QKeyEvent *);
34
35         private:
36                 void CreateCursors(void);
37                 void DrawGlyph(Painter & p, GlyphPoints & glyph);
38                 void DrawGlyphPoly(Painter & p, GlyphPoints & glyph, uint16_t poly);
39                 void ClearSelection(void);
40
41         public:
42                 QImage image;
43                 Vector pt, ptOffset, ptPrevious;
44                 double scale;                                           // Window scaling factor
45                 int32_t offsetX, offsetY;                       // Window offsets
46                 ToolType tool;                                          // Current tool
47                 GlyphPoints pts;                                        // Glyph point structure
48                 int32_t ptHighlight, oldPtHighlight, ptNextHighlight, oldPtNextHighlight;
49                 int16_t polyHighlight, oldPolyHighlight;
50                 bool polyFirstPoint;
51                 bool showRotationCenter, haveZeroPoint;
52                 Vector rotationCenter, rotationZeroPoint, rotationCurrentPoint;
53                 double rotationAngle;
54
55                 ToolWindow * toolPalette;
56                 QCursor cur[12];
57                 bool selectedPoints[65536];     // Potential memory leak :-O
58                 QRect selection;
59                 bool selectionInProgress;
60 };
61
62 #endif  // __EDITWINDOW_H__