X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Feditwindow.h;h=f1518e9a4e27c1bd5fb5ebce24a75caa3128ec6b;hb=1881acb17ed405cdb5aa2cb333a7af77f644a86d;hp=8034d7e27245aa1e2829240417008370be30fea8;hpb=4e11c12e60477f13a26c0bbad41fbd9a2b1db5d9;p=ttedit diff --git a/src/editwindow.h b/src/editwindow.h old mode 100755 new mode 100644 index 8034d7e..f1518e9 --- a/src/editwindow.h +++ b/src/editwindow.h @@ -1,52 +1,60 @@ -// -// EDITWINDOW.H: Header file -// -// by James L. Hammons -// (C) 2008 Underground Software -// - -#ifndef __EDITWINDOW_H__ -#define __EDITWINDOW_H__ - -#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); - void DrawRoundDot(wxDC &, int32, int32); - void DrawSquareDot(wxDC &, int32, int32); - void DrawRoundDotN(wxDC &, int32, int32, uint32); - void DrawSquareDotN(wxDC &, int32, int32, uint32); - - DECLARE_EVENT_TABLE() -}; - -#endif // __EDITWINDOW_H__ +// +// EDITWINDOW.H: Header file +// +// by James L. Hammons +// (C) 2008 Underground Software +// + +#ifndef __EDITWINDOW_H__ +#define __EDITWINDOW_H__ + +#include +#include +#include "toolwindow.h" // For ToolType enum +#include "glyphpoints.h" +#include "painter.h" + + +class EditWindow: public QWidget +{ + Q_OBJECT + + public: + EditWindow(QWidget * parent = NULL); + QSize minimumSizeHint() const; + QSize sizeHint() const; + + protected: + void paintEvent(QPaintEvent *); + void mousePressEvent(QMouseEvent *); + void mouseMoveEvent(QMouseEvent *); + void mouseReleaseEvent(QMouseEvent *); + void keyPressEvent(QKeyEvent *); + void keyReleaseEvent(QKeyEvent *); + + private: + void CreateCursors(void); + void DrawGlyph(Painter & p, GlyphPoints & glyph); + void DrawGlyphPoly(Painter & p, GlyphPoints & glyph, uint16_t poly); + void ClearSelection(void); + + public: + QImage image; + Vector pt, ptOffset, ptPrevious; + 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[12]; + bool selectedPoints[65536]; // Potential memory leak :-O + QRect selection; + bool selectionInProgress; +}; + +#endif // __EDITWINDOW_H__