X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Feditwindow.h;h=77104bd4d442287b704108ee3ce44492da24da01;hb=c7d608c4fcdd370274964cc861b674c2fae69468;hp=f31298cc1305d5d041d200d6a1806194e11ec4a9;hpb=3599953dec39d0ae662b039378a0b3eda39424e8;p=ttedit diff --git a/src/editwindow.h b/src/editwindow.h old mode 100755 new mode 100644 index f31298c..77104bd --- a/src/editwindow.h +++ b/src/editwindow.h @@ -8,11 +8,12 @@ #ifndef __EDITWINDOW_H__ #define __EDITWINDOW_H__ -#include -#include "types.h" -//#include "ttedit.h" // For TTEditApp +#include +#include #include "toolwindow.h" // For ToolType enum #include "glyphpoints.h" +#include "painter.h" + class EditWindow: public QWidget { @@ -24,67 +25,38 @@ class EditWindow: public QWidget QSize sizeHint() const; protected: - void paintEvent(QPaintEvent * event); - void mousePressEvent(QMouseEvent * event); - void mouseMoveEvent(QMouseEvent * event); - void mouseReleaseEvent(QMouseEvent * event); + void paintEvent(QPaintEvent *); + void mousePressEvent(QMouseEvent *); + void mouseMoveEvent(QMouseEvent *); + void mouseReleaseEvent(QMouseEvent *); + void keyPressEvent(QKeyEvent *); + void keyReleaseEvent(QKeyEvent *); private: void CreateCursors(void); - QPoint GetAdjustedMousePosition(QMouseEvent * event); - QPoint GetAdjustedClientPosition(int x, int y); + void DrawGlyph(Painter & p, GlyphPoints & glyph); + void DrawGlyphPoly(Painter & p, GlyphPoints & glyph, uint16_t poly); + void DrawGlyphSegment(Painter & p, IPoint p1, IPoint p2, IPoint p3); + void ClearSelection(void); + public: QImage image; - QPoint pt, ptOffset, ptPrevious; -// TTEditApp & app; // Reference to the application object - double scale; // Window scaling factor - int32 offsetX, offsetY; // Window offsets - ToolType tool; // Current tool - GlyphPoints pts; // Glyph point structure - int32 ptHighlight, oldPtHighlight, ptNextHighlight, oldPtNextHighlight; + Vector pt, ptOffset, ptPrevious, addPoint; + bool addPointOnCurve; + ToolType tool; // Current tool + GlyphPoints pts; // Glyph point structure + int32_t ptHighlight, oldPtHighlight, ptNextHighlight, oldPtNextHighlight; + int16_t polyHighlight, oldPolyHighlight; bool polyFirstPoint; + bool showRotationCenter, haveZeroPoint; + Vector rotationCenter, rotationZeroPoint, rotationCurrentPoint; + double rotationAngle; ToolWindow * toolPalette; - QCursor cur[8]; -}; - -#if 0 -#include // So that whoever uses this can without having - // to pull in a bunch of references manually -#include "types.h" -#include "ttedit.h" // For TTEditApp -#include "toolwindow.h" // For ToolType enum -#include "glyphpoints.h" - -class TTEditWindow: public wxWindow -{ - private: - TTEditApp & app; // Reference to the application object - double scale; // Window scaling factor - int32 offsetX, offsetY; // Window offsets - ToolType tool; // Current tool - GlyphPoints pts; // Glyph point structure - int32 ptHighlight, oldPtHighlight, ptNextHighlight, oldPtNextHighlight; - bool polyFirstPoint; - - protected: - public: - wxBitmap * bmp; - wxPoint pt, ptOffset, ptPrevious; - - // Constructor and destructor - TTEditWindow(wxFrame * parent, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, long style = 0); - ~TTEditWindow(void); - - void OnPaint(wxPaintEvent &e); - void OnMouseEvent(wxMouseEvent &e); - - protected: - wxPoint GetAdjustedMousePosition(wxMouseEvent &e); - wxPoint GetAdjustedClientPosition(wxCoord x, wxCoord y); - - DECLARE_EVENT_TABLE() + QCursor cur[12]; + bool selectedPoints[65536]; // Potential memory leak :-O + QRect selection; + bool selectionInProgress; }; -#endif #endif // __EDITWINDOW_H__