OGL improvements

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@616 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
1998-08-22 16:31:11 +00:00
parent 32c66ea22e
commit 42cfaf8cd4
30 changed files with 2582 additions and 1773 deletions
+11 -11
View File
@@ -84,7 +84,7 @@ istream& DiagramDocument::LoadObject(istream& stream)
* Implementation of drawing command
*/
DiagramCommand::DiagramCommand(char *name, int command, DiagramDocument *ddoc, wxClassInfo *info, float xx, float yy,
DiagramCommand::DiagramCommand(char *name, int command, DiagramDocument *ddoc, wxClassInfo *info, double xx, double yy,
bool sel, wxShape *theShape, wxShape *fs, wxShape *ts):
wxCommand(TRUE, name)
{
@@ -394,7 +394,7 @@ void DiagramCommand::RemoveLines(wxShape *shape)
* MyEvtHandler: an event handler class for all shapes
*/
void MyEvtHandler::OnLeftClick(float x, float y, int keys, int attachment)
void MyEvtHandler::OnLeftClick(double x, double y, int keys, int attachment)
{
wxClientDC dc(GetShape()->GetCanvas());
GetShape()->GetCanvas()->PrepareDC(dc);
@@ -444,7 +444,7 @@ void MyEvtHandler::OnLeftClick(float x, float y, int keys, int attachment)
* Implement connection of two shapes by right-dragging between them.
*/
void MyEvtHandler::OnBeginDragRight(float x, float y, int keys, int attachment)
void MyEvtHandler::OnBeginDragRight(double x, double y, int keys, int attachment)
{
// Force attachment to be zero for now. Eventually we can deal with
// the actual attachment point, e.g. a rectangle side if attachment mode is on.
@@ -456,13 +456,13 @@ void MyEvtHandler::OnBeginDragRight(float x, float y, int keys, int attachment)
wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT);
dc.SetLogicalFunction(wxXOR);
dc.SetPen(dottedPen);
float xp, yp;
double xp, yp;
GetShape()->GetAttachmentPosition(attachment, &xp, &yp);
dc.DrawLine(xp, yp, x, y);
GetShape()->GetCanvas()->CaptureMouse();
}
void MyEvtHandler::OnDragRight(bool draw, float x, float y, int keys, int attachment)
void MyEvtHandler::OnDragRight(bool draw, double x, double y, int keys, int attachment)
{
// Force attachment to be zero for now
attachment = 0;
@@ -473,12 +473,12 @@ void MyEvtHandler::OnDragRight(bool draw, float x, float y, int keys, int attach
wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT);
dc.SetLogicalFunction(wxXOR);
dc.SetPen(dottedPen);
float xp, yp;
double xp, yp;
GetShape()->GetAttachmentPosition(attachment, &xp, &yp);
dc.DrawLine(xp, yp, x, y);
}
void MyEvtHandler::OnEndDragRight(float x, float y, int keys, int attachment)
void MyEvtHandler::OnEndDragRight(double x, double y, int keys, int attachment)
{
GetShape()->GetCanvas()->ReleaseMouse();
MyCanvas *canvas = (MyCanvas *)GetShape()->GetCanvas();
@@ -495,7 +495,7 @@ void MyEvtHandler::OnEndDragRight(float x, float y, int keys, int attachment)
}
}
void MyEvtHandler::OnEndSize(float x, float y)
void MyEvtHandler::OnEndSize(double x, double y)
{
wxClientDC dc(GetShape()->GetCanvas());
GetShape()->GetCanvas()->PrepareDC(dc);
@@ -534,16 +534,16 @@ bool MyDiagram::OnShapeLoad(wxExprDatabase& db, wxShape& shape, wxExpr& expr)
IMPLEMENT_DYNAMIC_CLASS(wxRoundedRectangleShape, wxRectangleShape)
wxRoundedRectangleShape::wxRoundedRectangleShape(float w, float h):
wxRoundedRectangleShape::wxRoundedRectangleShape(double w, double h):
wxRectangleShape(w, h)
{
// 0.3 of the smaller rectangle dimension
SetCornerRadius((float) -0.3);
SetCornerRadius((double) -0.3);
}
IMPLEMENT_DYNAMIC_CLASS(wxDiamondShape, wxPolygonShape)
wxDiamondShape::wxDiamondShape(float w, float h):
wxDiamondShape::wxDiamondShape(double w, double h):
wxPolygonShape()
{
// wxPolygonShape::SetSize relies on the shape having non-zero
+10 -10
View File
@@ -44,7 +44,7 @@ class wxRoundedRectangleShape: public wxRectangleShape
DECLARE_DYNAMIC_CLASS(wxRoundedRectangleShape)
private:
public:
wxRoundedRectangleShape(float w = 0.0, float h = 0.0);
wxRoundedRectangleShape(double w = 0.0, double h = 0.0);
};
class wxDiamondShape: public wxPolygonShape
@@ -52,7 +52,7 @@ class wxDiamondShape: public wxPolygonShape
DECLARE_DYNAMIC_CLASS(wxDiamondShape)
private:
public:
wxDiamondShape(float w = 0.0, float h = 0.0);
wxDiamondShape(double w = 0.0, double h = 0.0);
};
/*
@@ -71,11 +71,11 @@ class MyEvtHandler: public wxShapeEvtHandler
~MyEvtHandler(void)
{
}
void OnLeftClick(float x, float y, int keys = 0, int attachment = 0);
void OnBeginDragRight(float x, float y, int keys = 0, int attachment = 0);
void OnDragRight(bool draw, float x, float y, int keys = 0, int attachment = 0);
void OnEndDragRight(float x, float y, int keys = 0, int attachment = 0);
void OnEndSize(float x, float y);
void OnLeftClick(double x, double y, int keys = 0, int attachment = 0);
void OnBeginDragRight(double x, double y, int keys = 0, int attachment = 0);
void OnDragRight(bool draw, double x, double y, int keys = 0, int attachment = 0);
void OnEndDragRight(double x, double y, int keys = 0, int attachment = 0);
void OnEndSize(double x, double y);
};
/*
@@ -135,8 +135,8 @@ class DiagramCommand: public wxCommand
wxShape *fromShape;
wxShape *toShape;
wxClassInfo *shapeInfo;
float x;
float y;
double x;
double y;
bool selected;
bool deleteShape;
@@ -147,7 +147,7 @@ class DiagramCommand: public wxCommand
public:
// Multi-purpose constructor for creating, deleting shapes
DiagramCommand(char *name, int cmd, DiagramDocument *ddoc, wxClassInfo *shapeInfo = NULL,
float x = 0.0, float y = 0.0, bool sel = FALSE, wxShape *theShape = NULL, wxShape *fs = NULL, wxShape *ts = NULL);
double x = 0.0, double y = 0.0, bool sel = FALSE, wxShape *theShape = NULL, wxShape *fs = NULL, wxShape *ts = NULL);
// Property-changing command constructors
DiagramCommand(char *name, int cmd, DiagramDocument *ddoc, wxBrush *backgroundColour, wxShape *theShape);
+8 -8
View File
@@ -188,7 +188,7 @@ MyCanvas::~MyCanvas(void)
{
}
void MyCanvas::OnLeftClick(float x, float y, int keys)
void MyCanvas::OnLeftClick(double x, double y, int keys)
{
EditorToolPalette *palette = wxGetApp().frame->palette;
wxClassInfo *info = NULL;
@@ -224,31 +224,31 @@ void MyCanvas::OnLeftClick(float x, float y, int keys)
}
}
void MyCanvas::OnRightClick(float x, float y, int keys)
void MyCanvas::OnRightClick(double x, double y, int keys)
{
}
void MyCanvas::OnDragLeft(bool draw, float x, float y, int keys)
void MyCanvas::OnDragLeft(bool draw, double x, double y, int keys)
{
}
void MyCanvas::OnBeginDragLeft(float x, float y, int keys)
void MyCanvas::OnBeginDragLeft(double x, double y, int keys)
{
}
void MyCanvas::OnEndDragLeft(float x, float y, int keys)
void MyCanvas::OnEndDragLeft(double x, double y, int keys)
{
}
void MyCanvas::OnDragRight(bool draw, float x, float y, int keys)
void MyCanvas::OnDragRight(bool draw, double x, double y, int keys)
{
}
void MyCanvas::OnBeginDragRight(float x, float y, int keys)
void MyCanvas::OnBeginDragRight(double x, double y, int keys)
{
}
void MyCanvas::OnEndDragRight(float x, float y, int keys)
void MyCanvas::OnEndDragRight(double x, double y, int keys)
{
}
+8 -8
View File
@@ -34,16 +34,16 @@ class MyCanvas: public wxShapeCanvas
void OnMouseEvent(wxMouseEvent& event);
void OnPaint(wxPaintEvent& event);
virtual void OnLeftClick(float x, float y, int keys = 0);
virtual void OnRightClick(float x, float y, int keys = 0);
virtual void OnLeftClick(double x, double y, int keys = 0);
virtual void OnRightClick(double x, double y, int keys = 0);
virtual void OnDragLeft(bool draw, float x, float y, int keys=0); // Erase if draw false
virtual void OnBeginDragLeft(float x, float y, int keys=0);
virtual void OnEndDragLeft(float x, float y, int keys=0);
virtual void OnDragLeft(bool draw, double x, double y, int keys=0); // Erase if draw false
virtual void OnBeginDragLeft(double x, double y, int keys=0);
virtual void OnEndDragLeft(double x, double y, int keys=0);
virtual void OnDragRight(bool draw, float x, float y, int keys=0); // Erase if draw false
virtual void OnBeginDragRight(float x, float y, int keys=0);
virtual void OnEndDragRight(float x, float y, int keys=0);
virtual void OnDragRight(bool draw, double x, double y, int keys=0); // Erase if draw false
virtual void OnBeginDragRight(double x, double y, int keys=0);
virtual void OnEndDragRight(double x, double y, int keys=0);
DECLARE_EVENT_TABLE()
};
+441 -216
View File
File diff suppressed because it is too large Load Diff
+128 -100
View File
@@ -106,6 +106,9 @@ class WXDLLEXPORT wxExpr;
class WXDLLEXPORT wxExprDatabase;
#endif
// Round up
#define WXROUND(x) ( (long) (x + 0.5) )
class wxShapeEvtHandler: public wxObject
{
DECLARE_DYNAMIC_CLASS(wxShapeEvtHandler)
@@ -128,31 +131,34 @@ class wxShapeEvtHandler: public wxObject
virtual void OnErase(wxDC& dc);
virtual void OnEraseContents(wxDC& dc);
virtual void OnHighlight(wxDC& dc);
virtual void OnLeftClick(float x, float y, int keys = 0, int attachment = 0);
virtual void OnRightClick(float x, float y, int keys = 0, int attachment = 0);
virtual void OnSize(float x, float y);
virtual bool OnMovePre(wxDC& dc, float x, float y, float old_x, float old_y, bool display = TRUE);
virtual void OnMovePost(wxDC& dc, float x, float y, float old_x, float old_y, bool display = TRUE);
virtual void OnLeftClick(double x, double y, int keys = 0, int attachment = 0);
virtual void OnRightClick(double x, double y, int keys = 0, int attachment = 0);
virtual void OnSize(double x, double y);
virtual bool OnMovePre(wxDC& dc, double x, double y, double old_x, double old_y, bool display = TRUE);
virtual void OnMovePost(wxDC& dc, double x, double y, double old_x, double old_y, bool display = TRUE);
virtual void OnDragLeft(bool draw, float x, float y, int keys=0, int attachment = 0); // Erase if draw false
virtual void OnBeginDragLeft(float x, float y, int keys=0, int attachment = 0);
virtual void OnEndDragLeft(float x, float y, int keys=0, int attachment = 0);
virtual void OnDragRight(bool draw, float x, float y, int keys=0, int attachment = 0); // Erase if draw false
virtual void OnBeginDragRight(float x, float y, int keys=0, int attachment = 0);
virtual void OnEndDragRight(float x, float y, int keys=0, int attachment = 0);
virtual void OnDrawOutline(wxDC& dc, float x, float y, float w, float h);
virtual void OnDragLeft(bool draw, double x, double y, int keys=0, int attachment = 0); // Erase if draw false
virtual void OnBeginDragLeft(double x, double y, int keys=0, int attachment = 0);
virtual void OnEndDragLeft(double x, double y, int keys=0, int attachment = 0);
virtual void OnDragRight(bool draw, double x, double y, int keys=0, int attachment = 0); // Erase if draw false
virtual void OnBeginDragRight(double x, double y, int keys=0, int attachment = 0);
virtual void OnEndDragRight(double x, double y, int keys=0, int attachment = 0);
virtual void OnDrawOutline(wxDC& dc, double x, double y, double w, double h);
virtual void OnDrawControlPoints(wxDC& dc);
virtual void OnEraseControlPoints(wxDC& dc);
virtual void OnMoveLink(wxDC& dc, bool moveControlPoints = TRUE);
// Control points ('handles') redirect control to the actual shape, to make it easier
// to override sizing behaviour.
virtual void OnSizingDragLeft(wxControlPoint* pt, bool draw, float x, float y, int keys=0, int attachment = 0); // Erase if draw false
virtual void OnSizingBeginDragLeft(wxControlPoint* pt, float x, float y, int keys=0, int attachment = 0);
virtual void OnSizingEndDragLeft(wxControlPoint* pt, float x, float y, int keys=0, int attachment = 0);
virtual void OnSizingDragLeft(wxControlPoint* pt, bool draw, double x, double y, int keys=0, int attachment = 0); // Erase if draw false
virtual void OnSizingBeginDragLeft(wxControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
virtual void OnSizingEndDragLeft(wxControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
virtual void OnBeginSize(float WXUNUSED(w), float WXUNUSED(h)) { }
virtual void OnEndSize(float WXUNUSED(w), float WXUNUSED(h)) { }
virtual void OnBeginSize(double WXUNUSED(w), double WXUNUSED(h)) { }
virtual void OnEndSize(double WXUNUSED(w), double WXUNUSED(h)) { }
// Can override this to prevent or intercept line reordering.
virtual void OnChangeAttachment(int attachment, wxLineShape* line, wxList& ordering);
// Creates a copy of this event handler.
wxShapeEvtHandler *CreateNewCopy();
@@ -174,21 +180,21 @@ class wxShape: public wxShapeEvtHandler
wxShape(wxShapeCanvas *can = NULL);
virtual ~wxShape();
virtual void GetBoundingBoxMax(float *width, float *height);
virtual void GetBoundingBoxMin(float *width, float *height) = 0;
virtual bool GetPerimeterPoint(float x1, float y1,
float x2, float y2,
float *x3, float *y3);
virtual void GetBoundingBoxMax(double *width, double *height);
virtual void GetBoundingBoxMin(double *width, double *height) = 0;
virtual bool GetPerimeterPoint(double x1, double y1,
double x2, double y2,
double *x3, double *y3);
inline wxShapeCanvas *GetCanvas() { return m_canvas; }
void SetCanvas(wxShapeCanvas *the_canvas);
virtual void AddToCanvas(wxShapeCanvas *the_canvas, wxShape *addAfter = NULL);
virtual void InsertInCanvas(wxShapeCanvas *the_canvas);
virtual void RemoveFromCanvas(wxShapeCanvas *the_canvas);
inline float GetX() const { return m_xpos; }
inline float GetY() const { return m_ypos; }
inline void SetX(float x) { m_xpos = x; }
inline void SetY(float y) { m_ypos = y; }
inline double GetX() const { return m_xpos; }
inline double GetY() const { return m_ypos; }
inline void SetX(double x) { m_xpos = x; }
inline void SetY(double y) { m_ypos = y; }
inline wxShape *GetParent() const { return m_parent; }
inline void SetParent(wxShape *p) { m_parent = p; }
@@ -204,30 +210,30 @@ class wxShape: public wxShapeEvtHandler
virtual void OnErase(wxDC& dc);
virtual void OnEraseContents(wxDC& dc);
virtual void OnHighlight(wxDC& dc);
virtual void OnLeftClick(float x, float y, int keys = 0, int attachment = 0);
virtual void OnRightClick(float x, float y, int keys = 0, int attachment = 0);
virtual void OnSize(float x, float y);
virtual bool OnMovePre(wxDC& dc, float x, float y, float old_x, float old_y, bool display = TRUE);
virtual void OnMovePost(wxDC& dc, float x, float y, float old_x, float old_y, bool display = TRUE);
virtual void OnLeftClick(double x, double y, int keys = 0, int attachment = 0);
virtual void OnRightClick(double x, double y, int keys = 0, int attachment = 0);
virtual void OnSize(double x, double y);
virtual bool OnMovePre(wxDC& dc, double x, double y, double old_x, double old_y, bool display = TRUE);
virtual void OnMovePost(wxDC& dc, double x, double y, double old_x, double old_y, bool display = TRUE);
virtual void OnDragLeft(bool draw, float x, float y, int keys=0, int attachment = 0); // Erase if draw false
virtual void OnBeginDragLeft(float x, float y, int keys=0, int attachment = 0);
virtual void OnEndDragLeft(float x, float y, int keys=0, int attachment = 0);
virtual void OnDragRight(bool draw, float x, float y, int keys=0, int attachment = 0); // Erase if draw false
virtual void OnBeginDragRight(float x, float y, int keys=0, int attachment = 0);
virtual void OnEndDragRight(float x, float y, int keys=0, int attachment = 0);
virtual void OnDrawOutline(wxDC& dc, float x, float y, float w, float h);
virtual void OnDragLeft(bool draw, double x, double y, int keys=0, int attachment = 0); // Erase if draw false
virtual void OnBeginDragLeft(double x, double y, int keys=0, int attachment = 0);
virtual void OnEndDragLeft(double x, double y, int keys=0, int attachment = 0);
virtual void OnDragRight(bool draw, double x, double y, int keys=0, int attachment = 0); // Erase if draw false
virtual void OnBeginDragRight(double x, double y, int keys=0, int attachment = 0);
virtual void OnEndDragRight(double x, double y, int keys=0, int attachment = 0);
virtual void OnDrawOutline(wxDC& dc, double x, double y, double w, double h);
virtual void OnDrawControlPoints(wxDC& dc);
virtual void OnEraseControlPoints(wxDC& dc);
virtual void OnBeginSize(float WXUNUSED(w), float WXUNUSED(h)) { }
virtual void OnEndSize(float WXUNUSED(w), float WXUNUSED(h)) { }
virtual void OnBeginSize(double WXUNUSED(w), double WXUNUSED(h)) { }
virtual void OnEndSize(double WXUNUSED(w), double WXUNUSED(h)) { }
// Control points ('handles') redirect control to the actual shape, to make it easier
// to override sizing behaviour.
virtual void OnSizingDragLeft(wxControlPoint* pt, bool draw, float x, float y, int keys=0, int attachment = 0); // Erase if draw false
virtual void OnSizingBeginDragLeft(wxControlPoint* pt, float x, float y, int keys=0, int attachment = 0);
virtual void OnSizingEndDragLeft(wxControlPoint* pt, float x, float y, int keys=0, int attachment = 0);
virtual void OnSizingDragLeft(wxControlPoint* pt, bool draw, double x, double y, int keys=0, int attachment = 0); // Erase if draw false
virtual void OnSizingBeginDragLeft(wxControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
virtual void OnSizingEndDragLeft(wxControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
virtual void MakeControlPoints();
virtual void DeleteControlPoints(wxDC *dc = NULL);
@@ -260,7 +266,7 @@ class wxShape: public wxShapeEvtHandler
inline bool GetSpaceAttachments() const { return m_spaceAttachments; };
void SetShadowMode(int mode, bool redraw = FALSE);
inline int GetShadowMode() const { return m_shadowMode; }
virtual bool HitTest(float x, float y, int *attachment, float *distance);
virtual bool HitTest(double x, double y, int *attachment, double *distance);
inline void SetCentreResize(bool cr) { m_centreResize = cr; }
inline bool GetCentreResize() const { return m_centreResize; }
inline wxList& GetLines() { return m_lines; }
@@ -278,22 +284,28 @@ class wxShape: public wxShapeEvtHandler
virtual void Show(bool show);
virtual bool IsShown() const { return m_visible; }
virtual void Move(wxDC& dc, float x1, float y1, bool display = TRUE);
virtual void Move(wxDC& dc, double x1, double y1, bool display = TRUE);
virtual void Erase(wxDC& dc);
virtual void EraseContents(wxDC& dc);
virtual void Draw(wxDC& dc);
virtual void Flash();
virtual void MoveLinks(wxDC& dc);
virtual void DrawContents(wxDC& dc); // E.g. for drawing text label
virtual void SetSize(float x, float y, bool recursive = TRUE);
virtual void SetAttachmentSize(float x, float y);
virtual void SetSize(double x, double y, bool recursive = TRUE);
virtual void SetAttachmentSize(double x, double y);
void Attach(wxShapeCanvas *can);
void Detach();
inline virtual bool Constrain() { return FALSE; } ;
void AddLine(wxLineShape *line, wxShape *other,
int attachFrom = 0, int attachTo = 0);
int attachFrom = 0, int attachTo = 0,
// The line ordering
int positionFrom = -1, int positionTo = -1);
// Return the zero-based position in m_lines of line.
int GetLinePosition(wxLineShape* line);
void AddText(const wxString& string);
inline wxPen *GetPen() const { return m_pen; }
@@ -364,21 +376,37 @@ class wxShape: public wxShapeEvtHandler
#endif
// Attachment code
virtual bool GetAttachmentPosition(int attachment, float *x, float *y,
virtual bool GetAttachmentPosition(int attachment, double *x, double *y,
int nth = 0, int no_arcs = 1, wxLineShape *line = NULL);
virtual int GetNumberOfAttachments();
virtual bool AttachmentIsValid(int attachment);
// Assuming the attachment lies along a vertical or horizontal line,
// calculate the position on that point.
wxRealPoint CalcSimpleAttachment(const wxRealPoint& pt1, const wxRealPoint& pt2,
int nth, int noArcs, wxLineShape* line);
// Returns TRUE if pt1 <= pt2 in the sense that one point comes before another on an
// edge of the shape.
// attachmentPoint is the attachment point (= side) in question.
bool AttachmentSortTest(int attachmentPoint, const wxRealPoint& pt1, const wxRealPoint& pt2);
virtual void EraseLinks(wxDC& dc, int attachment = -1, bool recurse = FALSE);
virtual void DrawLinks(wxDC& dc, int attachment = -1, bool recurse = FALSE);
virtual void MoveLineToNewAttachment(wxDC& dc, wxLineShape *to_move,
float x, float y);
double x, double y);
// Reorders the lines coming into the node image at this attachment
// position, in the order in which they appear in linesToSort.
virtual void SortLines(int attachment, wxList& linesToSort);
// Apply an attachment ordering change
void ApplyAttachmentOrdering(wxList& ordering);
// Can override this to prevent or intercept line reordering.
virtual void OnChangeAttachment(int attachment, wxLineShape* line, wxList& ordering);
// This is really to distinguish between lines and other images.
// For lines, want to pass drag to canvas, since lines tend to prevent
// dragging on a canvas (they get in the way.)
@@ -401,8 +429,8 @@ class wxShape: public wxShapeEvtHandler
// (does nothing for most objects)
// But even non-rotating objects should record their notional
// rotation in case it's important (e.g. in dog-leg code).
virtual inline void Rotate(float WXUNUSED(x), float WXUNUSED(y), float theta) { m_rotation = theta; }
virtual inline float GetRotation() const { return m_rotation; }
virtual inline void Rotate(double WXUNUSED(x), double WXUNUSED(y), double theta) { m_rotation = theta; }
virtual inline double GetRotation() const { return m_rotation; }
void ClearAttachments();
@@ -418,7 +446,7 @@ class wxShape: public wxShapeEvtHandler
protected:
wxShapeEvtHandler* m_eventHandler;
bool m_formatted;
float m_xpos, m_ypos;
double m_xpos, m_ypos;
wxPen* m_pen;
wxBrush* m_brush;
wxFont* m_font;
@@ -436,7 +464,7 @@ class wxShape: public wxShapeEvtHandler
bool m_selected;
bool m_highlighted; // Different from selected: user-defined highlighting,
// e.g. thick border.
float m_rotation;
double m_rotation;
int m_sensitivity;
bool m_draggable;
bool m_attachmentMode; // TRUE if using attachments, FALSE otherwise
@@ -469,21 +497,21 @@ class wxPolygonShape: public wxShape
virtual void Create(wxList *points);
virtual void ClearPoints();
void GetBoundingBoxMin(float *w, float *h);
void GetBoundingBoxMin(double *w, double *h);
void CalculateBoundingBox();
bool GetPerimeterPoint(float x1, float y1,
float x2, float y2,
float *x3, float *y3);
bool HitTest(float x, float y, int *attachment, float *distance);
void SetSize(float x, float y, bool recursive = TRUE);
bool GetPerimeterPoint(double x1, double y1,
double x2, double y2,
double *x3, double *y3);
bool HitTest(double x, double y, int *attachment, double *distance);
void SetSize(double x, double y, bool recursive = TRUE);
void OnDraw(wxDC& dc);
void OnDrawOutline(wxDC& dc, float x, float y, float w, float h);
void OnDrawOutline(wxDC& dc, double x, double y, double w, double h);
// Control points ('handles') redirect control to the actual shape, to make it easier
// to override sizing behaviour.
virtual void OnSizingDragLeft(wxControlPoint* pt, bool draw, float x, float y, int keys=0, int attachment = 0);
virtual void OnSizingBeginDragLeft(wxControlPoint* pt, float x, float y, int keys=0, int attachment = 0);
virtual void OnSizingEndDragLeft(wxControlPoint* pt, float x, float y, int keys=0, int attachment = 0);
virtual void OnSizingDragLeft(wxControlPoint* pt, bool draw, double x, double y, int keys=0, int attachment = 0);
virtual void OnSizingBeginDragLeft(wxControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
virtual void OnSizingEndDragLeft(wxControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
// A polygon should have a control point at each vertex,
// with the option of moving the control points individually
@@ -511,7 +539,7 @@ class wxPolygonShape: public wxShape
#endif
int GetNumberOfAttachments();
bool GetAttachmentPosition(int attachment, float *x, float *y,
bool GetAttachmentPosition(int attachment, double *x, double *y,
int nth = 0, int no_arcs = 1, wxLineShape *line = NULL);
bool AttachmentIsValid(int attachment);
// Does the copying for this object
@@ -522,24 +550,24 @@ class wxPolygonShape: public wxShape
private:
wxList* m_points;
wxList* m_originalPoints;
float m_boundWidth;
float m_boundHeight;
float m_originalWidth;
float m_originalHeight;
double m_boundWidth;
double m_boundHeight;
double m_originalWidth;
double m_originalHeight;
};
class wxRectangleShape: public wxShape
{
DECLARE_DYNAMIC_CLASS(wxRectangleShape)
public:
wxRectangleShape(float w = 0.0, float h = 0.0);
void GetBoundingBoxMin(float *w, float *h);
bool GetPerimeterPoint(float x1, float y1,
float x2, float y2,
float *x3, float *y3);
wxRectangleShape(double w = 0.0, double h = 0.0);
void GetBoundingBoxMin(double *w, double *h);
bool GetPerimeterPoint(double x1, double y1,
double x2, double y2,
double *x3, double *y3);
void OnDraw(wxDC& dc);
void SetSize(float x, float y, bool recursive = TRUE);
void SetCornerRadius(float rad); // If > 0, rounded corners
void SetSize(double x, double y, bool recursive = TRUE);
void SetCornerRadius(double rad); // If > 0, rounded corners
#ifdef PROLOGIO
// Prolog database stuff
@@ -548,27 +576,27 @@ class wxRectangleShape: public wxShape
#endif
int GetNumberOfAttachments();
bool GetAttachmentPosition(int attachment, float *x, float *y,
bool GetAttachmentPosition(int attachment, double *x, double *y,
int nth = 0, int no_arcs = 1, wxLineShape *line = NULL);
// Does the copying for this object
void Copy(wxShape& copy);
inline float GetWidth() const { return m_width; }
inline float GetHeight() const { return m_height; }
inline void SetWidth(float w) { m_width = w; }
inline void SetHeight(float h) { m_height = h; }
inline double GetWidth() const { return m_width; }
inline double GetHeight() const { return m_height; }
inline void SetWidth(double w) { m_width = w; }
inline void SetHeight(double h) { m_height = h; }
protected:
float m_width;
float m_height;
float m_cornerRadius;
double m_width;
double m_height;
double m_cornerRadius;
};
class wxTextShape: public wxRectangleShape
{
DECLARE_DYNAMIC_CLASS(wxTextShape)
public:
wxTextShape(float width = 0.0, float height = 0.0);
wxTextShape(double width = 0.0, double height = 0.0);
void OnDraw(wxDC& dc);
@@ -584,15 +612,15 @@ class wxEllipseShape: public wxShape
{
DECLARE_DYNAMIC_CLASS(wxEllipseShape)
public:
wxEllipseShape(float w = 0.0, float h = 0.0);
wxEllipseShape(double w = 0.0, double h = 0.0);
void GetBoundingBoxMin(float *w, float *h);
bool GetPerimeterPoint(float x1, float y1,
float x2, float y2,
float *x3, float *y3);
void GetBoundingBoxMin(double *w, double *h);
bool GetPerimeterPoint(double x1, double y1,
double x2, double y2,
double *x3, double *y3);
void OnDraw(wxDC& dc);
void SetSize(float x, float y, bool recursive = TRUE);
void SetSize(double x, double y, bool recursive = TRUE);
#ifdef PROLOGIO
// Prolog database stuff
@@ -601,29 +629,29 @@ class wxEllipseShape: public wxShape
#endif
int GetNumberOfAttachments();
bool GetAttachmentPosition(int attachment, float *x, float *y,
bool GetAttachmentPosition(int attachment, double *x, double *y,
int nth = 0, int no_arcs = 1, wxLineShape *line = NULL);
// Does the copying for this object
void Copy(wxShape& copy);
inline float GetWidth() const { return m_width; }
inline float GetHeight() const { return m_height; }
inline double GetWidth() const { return m_width; }
inline double GetHeight() const { return m_height; }
protected:
float m_width;
float m_height;
double m_width;
double m_height;
};
class wxCircleShape: public wxEllipseShape
{
DECLARE_DYNAMIC_CLASS(wxCircleShape)
public:
wxCircleShape(float w = 0.0);
wxCircleShape(double w = 0.0);
bool GetPerimeterPoint(float x1, float y1,
float x2, float y2,
float *x3, float *y3);
bool GetPerimeterPoint(double x1, double y1,
double x2, double y2,
double *x3, double *y3);
// Does the copying for this object
void Copy(wxShape& copy);
};
+268 -227
View File
File diff suppressed because it is too large Load Diff
+55 -51
View File
@@ -22,22 +22,22 @@ class wxShapeTextLine: public wxObject
{
DECLARE_DYNAMIC_CLASS(wxShapeTextLine)
public:
wxShapeTextLine(float the_x = 0.0, float the_y = 0.0, const wxString& the_line = "");
wxShapeTextLine(double the_x = 0.0, double the_y = 0.0, const wxString& the_line = "");
~wxShapeTextLine();
inline float GetX() const { return m_x; }
inline float GetY() const { return m_y; }
inline double GetX() const { return m_x; }
inline double GetY() const { return m_y; }
inline void SetX(float x) { m_x = x; }
inline void SetY(float y) { m_y = y; }
inline void SetX(double x) { m_x = x; }
inline void SetY(double y) { m_y = y; }
inline void SetText(const wxString& text) { m_line = text; }
inline wxString GetText() const { return m_line; }
protected:
wxString m_line;
float m_x;
float m_y;
double m_x;
double m_y;
};
class wxShape;
@@ -49,18 +49,18 @@ class wxControlPoint: public wxRectangleShape
friend class wxShape;
public:
wxControlPoint(wxShapeCanvas *the_canvas = NULL, wxShape *object = NULL, float size = 0.0, float the_xoffset = 0.0,
float the_yoffset = 0.0, int the_type = 0);
wxControlPoint(wxShapeCanvas *the_canvas = NULL, wxShape *object = NULL, double size = 0.0, double the_xoffset = 0.0,
double the_yoffset = 0.0, int the_type = 0);
~wxControlPoint();
void OnDraw(wxDC& dc);
void OnErase(wxDC& dc);
void OnDrawContents(wxDC& dc);
void OnDragLeft(bool draw, float x, float y, int keys=0, int attachment = 0);
void OnBeginDragLeft(float x, float y, int keys=0, int attachment = 0);
void OnEndDragLeft(float x, float y, int keys=0, int attachment = 0);
void OnDragLeft(bool draw, double x, double y, int keys=0, int attachment = 0);
void OnBeginDragLeft(double x, double y, int keys=0, int attachment = 0);
void OnEndDragLeft(double x, double y, int keys=0, int attachment = 0);
bool GetAttachmentPosition(int attachment, float *x, float *y,
bool GetAttachmentPosition(int attachment, double *x, double *y,
int nth = 0, int no_arcs = 1, wxLineShape *line = NULL);
int GetNumberOfAttachments();
@@ -68,8 +68,8 @@ class wxControlPoint: public wxRectangleShape
public:
int m_type;
float m_xoffset;
float m_yoffset;
double m_xoffset;
double m_yoffset;
wxShape* m_shape;
wxCursor* m_oldCursor;
bool m_eraseObject; // If TRUE, erases object before dragging handle.
@@ -78,14 +78,14 @@ public:
* Store original top-left, bottom-right coordinates
* in case we're doing non-vertical resizing.
*/
static float controlPointDragStartX;
static float controlPointDragStartY;
static float controlPointDragStartWidth;
static float controlPointDragStartHeight;
static float controlPointDragEndWidth;
static float controlPointDragEndHeight;
static float controlPointDragPosX;
static float controlPointDragPosY;
static double controlPointDragStartX;
static double controlPointDragStartY;
static double controlPointDragStartWidth;
static double controlPointDragStartHeight;
static double controlPointDragEndWidth;
static double controlPointDragEndHeight;
static double controlPointDragPosX;
static double controlPointDragPosY;
};
class wxPolygonShape;
@@ -94,16 +94,16 @@ class wxPolygonControlPoint: public wxControlPoint
DECLARE_DYNAMIC_CLASS(wxPolygonControlPoint)
friend class wxPolygonShape;
public:
wxPolygonControlPoint(wxShapeCanvas *the_canvas = NULL, wxShape *object = NULL, float size = 0.0, wxRealPoint *vertex = NULL,
float the_xoffset = 0.0, float the_yoffset = 0.0);
wxPolygonControlPoint(wxShapeCanvas *the_canvas = NULL, wxShape *object = NULL, double size = 0.0, wxRealPoint *vertex = NULL,
double the_xoffset = 0.0, double the_yoffset = 0.0);
~wxPolygonControlPoint();
void OnDragLeft(bool draw, float x, float y, int keys=0, int attachment = 0);
void OnBeginDragLeft(float x, float y, int keys=0, int attachment = 0);
void OnEndDragLeft(float x, float y, int keys=0, int attachment = 0);
void OnDragLeft(bool draw, double x, double y, int keys=0, int attachment = 0);
void OnBeginDragLeft(double x, double y, int keys=0, int attachment = 0);
void OnEndDragLeft(double x, double y, int keys=0, int attachment = 0);
// Calculate what new size would be, at end of resize
virtual void CalculateNewSize(float x, float y);
virtual void CalculateNewSize(double x, double y);
// Get new size
inline wxRealPoint GetNewSize() const { return m_newSize; };
@@ -111,7 +111,7 @@ class wxPolygonControlPoint: public wxControlPoint
public:
wxRealPoint* m_polygonVertex;
wxRealPoint m_originalSize;
float m_originalDistance;
double m_originalDistance;
wxRealPoint m_newSize;
};
@@ -138,20 +138,20 @@ class wxShapeRegion: public wxObject
// Accessors
inline void SetText(const wxString& s) { m_regionText = s; }
void SetFont(wxFont *f);
void SetMinSize(float w, float h);
void SetSize(float w, float h);
void SetPosition(float x, float y);
void SetProportions(float x, float y);
void SetMinSize(double w, double h);
void SetSize(double w, double h);
void SetPosition(double x, double y);
void SetProportions(double x, double y);
void SetFormatMode(int mode);
inline void SetName(const wxString& s) { m_regionName = s; };
void SetColour(const wxString& col); // Text colour
inline wxString GetText() const { return m_regionText; }
inline wxFont *GetFont() const { return m_font; }
inline void GetMinSize(float *x, float *y) const { *x = m_minWidth; *y = m_minHeight; }
inline void GetProportion(float *x, float *y) const { *x = m_regionProportionX; *y = m_regionProportionY; }
inline void GetSize(float *x, float *y) const { *x = m_width; *y = m_height; }
inline void GetPosition(float *xp, float *yp) const { *xp = m_x; *yp = m_y; }
inline void GetMinSize(double *x, double *y) const { *x = m_minWidth; *y = m_minHeight; }
inline void GetProportion(double *x, double *y) const { *x = m_regionProportionX; *y = m_regionProportionY; }
inline void GetSize(double *x, double *y) const { *x = m_width; *y = m_height; }
inline void GetPosition(double *xp, double *yp) const { *xp = m_x; *yp = m_y; }
inline int GetFormatMode() const { return m_formatMode; }
inline wxString GetName() const { return m_regionName; }
inline wxString GetColour() const { return m_textColour; }
@@ -162,8 +162,8 @@ class wxShapeRegion: public wxObject
inline void SetPenStyle(int style) { m_penStyle = style; m_actualPenObject = NULL; }
void SetPenColour(const wxString& col);
wxPen *GetActualPen();
inline float GetWidth() const { return m_width; }
inline float GetHeight() const { return m_height; }
inline double GetWidth() const { return m_width; }
inline double GetHeight() const { return m_height; }
void ClearText();
@@ -171,16 +171,16 @@ public:
wxString m_regionText;
wxList m_formattedText; // List of wxShapeTextLines
wxFont* m_font;
float m_minHeight; // If zero, hide region.
float m_minWidth; // If zero, hide region.
float m_width;
float m_height;
float m_x;
float m_y;
double m_minHeight; // If zero, hide region.
double m_minWidth; // If zero, hide region.
double m_width;
double m_height;
double m_x;
double m_y;
float m_regionProportionX; // Proportion of total object size;
double m_regionProportionX; // Proportion of total object size;
// -1.0 indicates equal proportion
float m_regionProportionY; // Proportion of total object size;
double m_regionProportionY; // Proportion of total object size;
// -1.0 indicates equal proportion
int m_formatMode; // FORMAT_CENTRE_HORIZ | FORMAT_CENTRE_VERT | FORMAT_NONE
@@ -208,11 +208,15 @@ public:
{
m_id = 0; m_x = 0.0; m_y = 0.0;
}
inline wxAttachmentPoint(int id, double x, double y)
{
m_id = id; m_x = x; m_y = y;
}
public:
int m_id; // Identifier
float m_x; // x offset from centre of object
float m_y; // y offset from centre of object
int m_id; // Identifier
double m_x; // x offset from centre of object
double m_y; // y offset from centre of object
};
#endif
+4 -4
View File
@@ -57,13 +57,13 @@ void wxBitmapShape::OnDraw(wxDC& dc)
wxMemoryDC tempDC;
tempDC.SelectObject(m_bitmap);
float x, y;
x = (long)(m_xpos - m_bitmap.GetWidth() / 2.0);
y = (long)(m_ypos - m_bitmap.GetHeight() / 2.0);
double x, y;
x = WXROUND(m_xpos - m_bitmap.GetWidth() / 2.0);
y = WXROUND(m_ypos - m_bitmap.GetHeight() / 2.0);
dc.Blit(x, y, m_bitmap.GetWidth(), m_bitmap.GetHeight(), &tempDC, 0, 0);
}
void wxBitmapShape::SetSize(float w, float h, bool recursive)
void wxBitmapShape::SetSize(double w, double h, bool recursive)
{
if (m_bitmap.Ok())
{
+1 -1
View File
@@ -37,7 +37,7 @@ class wxBitmapShape: public wxRectangleShape
// Does the copying for this object
void Copy(wxShape& copy);
void SetSize(float w, float h, bool recursive = TRUE);
void SetSize(double w, double h, bool recursive = TRUE);
inline wxBitmap& GetBitmap() const { return (wxBitmap&) m_bitmap; }
void SetBitmap(const wxBitmap& bm);
inline void SetFilename(const wxString& f) { m_filename = f; };
+48 -48
View File
@@ -59,7 +59,7 @@
#define CONTROL_POINT_ENDPOINT_FROM 5
#define CONTROL_POINT_LINE 6
extern wxCursor *GraphicsBullseyeCursor;
extern wxCursor *g_oglBullseyeCursor;
IMPLEMENT_DYNAMIC_CLASS(wxShapeCanvas, wxScrolledWindow)
@@ -105,9 +105,9 @@ void wxShapeCanvas::OnMouseEvent(wxMouseEvent& event)
wxPoint logPos(event.GetLogicalPosition(dc));
float x, y;
x = (float) logPos.x;
y = (float) logPos.y;
double x, y;
x = (double) logPos.x;
y = (double) logPos.y;
int keys = 0;
if (event.ShiftDown())
@@ -144,11 +144,11 @@ void wxShapeCanvas::OnMouseEvent(wxMouseEvent& event)
// If the object isn't m_draggable, transfer message to canvas
if (m_draggedShape->Draggable())
m_draggedShape->GetEventHandler()->OnBeginDragLeft((float)x, (float)y, keys, m_draggedAttachment);
m_draggedShape->GetEventHandler()->OnBeginDragLeft((double)x, (double)y, keys, m_draggedAttachment);
else
{
m_draggedShape = NULL;
OnBeginDragLeft((float)x, (float)y, keys);
OnBeginDragLeft((double)x, (double)y, keys);
}
m_oldDragX = x; m_oldDragY = y;
@@ -157,7 +157,7 @@ void wxShapeCanvas::OnMouseEvent(wxMouseEvent& event)
{
// Continue dragging
m_draggedShape->GetEventHandler()->OnDragLeft(FALSE, m_oldDragX, m_oldDragY, keys, m_draggedAttachment);
m_draggedShape->GetEventHandler()->OnDragLeft(TRUE, (float)x, (float)y, keys, m_draggedAttachment);
m_draggedShape->GetEventHandler()->OnDragLeft(TRUE, (double)x, (double)y, keys, m_draggedAttachment);
m_oldDragX = x; m_oldDragY = y;
}
else if (event.LeftUp() && m_draggedShape && m_dragState == ContinueDraggingLeft)
@@ -167,7 +167,7 @@ void wxShapeCanvas::OnMouseEvent(wxMouseEvent& event)
m_draggedShape->GetEventHandler()->OnDragLeft(FALSE, m_oldDragX, m_oldDragY, keys, m_draggedAttachment);
m_draggedShape->GetEventHandler()->OnEndDragLeft((float)x, (float)y, keys, m_draggedAttachment);
m_draggedShape->GetEventHandler()->OnEndDragLeft((double)x, (double)y, keys, m_draggedAttachment);
m_draggedShape = NULL;
}
else if (dragging && m_draggedShape && m_dragState == StartDraggingRight)
@@ -175,11 +175,11 @@ void wxShapeCanvas::OnMouseEvent(wxMouseEvent& event)
m_dragState = ContinueDraggingRight;
if (m_draggedShape->Draggable())
m_draggedShape->GetEventHandler()->OnBeginDragRight((float)x, (float)y, keys, m_draggedAttachment);
m_draggedShape->GetEventHandler()->OnBeginDragRight((double)x, (double)y, keys, m_draggedAttachment);
else
{
m_draggedShape = NULL;
OnBeginDragRight((float)x, (float)y, keys);
OnBeginDragRight((double)x, (double)y, keys);
}
m_oldDragX = x; m_oldDragY = y;
}
@@ -187,7 +187,7 @@ void wxShapeCanvas::OnMouseEvent(wxMouseEvent& event)
{
// Continue dragging
m_draggedShape->GetEventHandler()->OnDragRight(FALSE, m_oldDragX, m_oldDragY, keys, m_draggedAttachment);
m_draggedShape->GetEventHandler()->OnDragRight(TRUE, (float)x, (float)y, keys, m_draggedAttachment);
m_draggedShape->GetEventHandler()->OnDragRight(TRUE, (double)x, (double)y, keys, m_draggedAttachment);
m_oldDragX = x; m_oldDragY = y;
}
else if (event.RightUp() && m_draggedShape && m_dragState == ContinueDraggingRight)
@@ -197,7 +197,7 @@ void wxShapeCanvas::OnMouseEvent(wxMouseEvent& event)
m_draggedShape->GetEventHandler()->OnDragRight(FALSE, m_oldDragX, m_oldDragY, keys, m_draggedAttachment);
m_draggedShape->GetEventHandler()->OnEndDragRight((float)x, (float)y, keys, m_draggedAttachment);
m_draggedShape->GetEventHandler()->OnEndDragRight((double)x, (double)y, keys, m_draggedAttachment);
m_draggedShape = NULL;
}
@@ -205,14 +205,14 @@ void wxShapeCanvas::OnMouseEvent(wxMouseEvent& event)
else if (dragging && !m_draggedShape && m_dragState == StartDraggingLeft)
{
m_dragState = ContinueDraggingLeft;
OnBeginDragLeft((float)x, (float)y, keys);
OnBeginDragLeft((double)x, (double)y, keys);
m_oldDragX = x; m_oldDragY = y;
}
else if (dragging && !m_draggedShape && m_dragState == ContinueDraggingLeft)
{
// Continue dragging
OnDragLeft(FALSE, m_oldDragX, m_oldDragY, keys);
OnDragLeft(TRUE, (float)x, (float)y, keys);
OnDragLeft(TRUE, (double)x, (double)y, keys);
m_oldDragX = x; m_oldDragY = y;
}
else if (event.LeftUp() && !m_draggedShape && m_dragState == ContinueDraggingLeft)
@@ -221,20 +221,20 @@ void wxShapeCanvas::OnMouseEvent(wxMouseEvent& event)
m_checkTolerance = TRUE;
OnDragLeft(FALSE, m_oldDragX, m_oldDragY, keys);
OnEndDragLeft((float)x, (float)y, keys);
OnEndDragLeft((double)x, (double)y, keys);
m_draggedShape = NULL;
}
else if (dragging && !m_draggedShape && m_dragState == StartDraggingRight)
{
m_dragState = ContinueDraggingRight;
OnBeginDragRight((float)x, (float)y, keys);
OnBeginDragRight((double)x, (double)y, keys);
m_oldDragX = x; m_oldDragY = y;
}
else if (dragging && !m_draggedShape && m_dragState == ContinueDraggingRight)
{
// Continue dragging
OnDragRight(FALSE, m_oldDragX, m_oldDragY, keys);
OnDragRight(TRUE, (float)x, (float)y, keys);
OnDragRight(TRUE, (double)x, (double)y, keys);
m_oldDragX = x; m_oldDragY = y;
}
else if (event.RightUp() && !m_draggedShape && m_dragState == ContinueDraggingRight)
@@ -243,7 +243,7 @@ void wxShapeCanvas::OnMouseEvent(wxMouseEvent& event)
m_checkTolerance = TRUE;
OnDragRight(FALSE, m_oldDragX, m_oldDragY, keys);
OnEndDragRight((float)x, (float)y, keys);
OnEndDragRight((double)x, (double)y, keys);
m_draggedShape = NULL;
}
@@ -270,7 +270,7 @@ void wxShapeCanvas::OnMouseEvent(wxMouseEvent& event)
// N.B. Only register a click if the same object was
// identified for down *and* up.
if (nearest_object == m_draggedShape)
nearest_object->GetEventHandler()->OnLeftClick((float)x, (float)y, keys, attachment);
nearest_object->GetEventHandler()->OnLeftClick((double)x, (double)y, keys, attachment);
m_draggedShape = NULL;
m_dragState = NoDragging;
@@ -286,7 +286,7 @@ void wxShapeCanvas::OnMouseEvent(wxMouseEvent& event)
else if (event.RightUp())
{
if (nearest_object == m_draggedShape)
nearest_object->GetEventHandler()->OnRightClick((float)x, (float)y, keys, attachment);
nearest_object->GetEventHandler()->OnRightClick((double)x, (double)y, keys, attachment);
m_draggedShape = NULL;
m_dragState = NoDragging;
@@ -303,7 +303,7 @@ void wxShapeCanvas::OnMouseEvent(wxMouseEvent& event)
}
else if (event.LeftUp())
{
OnLeftClick((float)x, (float)y, keys);
OnLeftClick((double)x, (double)y, keys);
m_draggedShape = NULL;
m_dragState = NoDragging;
@@ -317,7 +317,7 @@ void wxShapeCanvas::OnMouseEvent(wxMouseEvent& event)
}
else if (event.RightUp())
{
OnRightClick((float)x, (float)y, keys);
OnRightClick((double)x, (double)y, keys);
m_draggedShape = NULL;
m_dragState = NoDragging;
@@ -330,7 +330,7 @@ void wxShapeCanvas::OnMouseEvent(wxMouseEvent& event)
* Try to find a sensitive object, working up the hierarchy of composites.
*
*/
wxShape *wxShapeCanvas::FindFirstSensitiveShape(float x, float y, int *new_attachment, int op)
wxShape *wxShapeCanvas::FindFirstSensitiveShape(double x, double y, int *new_attachment, int op)
{
wxShape *image = FindShape(x, y, new_attachment);
if (!image) return NULL;
@@ -338,7 +338,7 @@ wxShape *wxShapeCanvas::FindFirstSensitiveShape(float x, float y, int *new_attac
wxShape *actualImage = FindFirstSensitiveShape1(image, op);
if (actualImage)
{
float dist;
double dist;
// Find actual attachment
actualImage->HitTest(x, y, new_attachment, &dist);
}
@@ -357,30 +357,30 @@ wxShape *wxShapeCanvas::FindFirstSensitiveShape1(wxShape *image, int op)
// Helper function: TRUE if 'contains' wholly contains 'contained'.
static bool WhollyContains(wxShape *contains, wxShape *contained)
{
float xp1, yp1, xp2, yp2;
float w1, h1, w2, h2;
float left1, top1, right1, bottom1, left2, top2, right2, bottom2;
double xp1, yp1, xp2, yp2;
double w1, h1, w2, h2;
double left1, top1, right1, bottom1, left2, top2, right2, bottom2;
xp1 = contains->GetX(); yp1 = contains->GetY(); xp2 = contained->GetX(); yp2 = contained->GetY();
contains->GetBoundingBoxMax(&w1, &h1);
contained->GetBoundingBoxMax(&w2, &h2);
left1 = (float)(xp1 - (w1 / 2.0));
top1 = (float)(yp1 - (h1 / 2.0));
right1 = (float)(xp1 + (w1 / 2.0));
bottom1 = (float)(yp1 + (h1 / 2.0));
left1 = (double)(xp1 - (w1 / 2.0));
top1 = (double)(yp1 - (h1 / 2.0));
right1 = (double)(xp1 + (w1 / 2.0));
bottom1 = (double)(yp1 + (h1 / 2.0));
left2 = (float)(xp2 - (w2 / 2.0));
top2 = (float)(yp2 - (h2 / 2.0));
right2 = (float)(xp2 + (w2 / 2.0));
bottom2 = (float)(yp2 + (h2 / 2.0));
left2 = (double)(xp2 - (w2 / 2.0));
top2 = (double)(yp2 - (h2 / 2.0));
right2 = (double)(xp2 + (w2 / 2.0));
bottom2 = (double)(yp2 + (h2 / 2.0));
return ((left1 <= left2) && (top1 <= top2) && (right1 >= right2) && (bottom1 >= bottom2));
}
wxShape *wxShapeCanvas::FindShape(float x, float y, int *attachment, wxClassInfo *info, wxShape *notObject)
wxShape *wxShapeCanvas::FindShape(double x, double y, int *attachment, wxClassInfo *info, wxShape *notObject)
{
float nearest = 100000.0;
double nearest = 100000.0;
int nearest_attachment = 0;
wxShape *nearest_object = NULL;
@@ -394,7 +394,7 @@ wxShape *wxShapeCanvas::FindShape(float x, float y, int *attachment, wxClassInfo
{
wxShape *object = (wxShape *)current->Data();
float dist;
double dist;
int temp_attachment;
// First pass for lines, which might be inside a container, so we
@@ -429,7 +429,7 @@ wxShape *wxShapeCanvas::FindShape(float x, float y, int *attachment, wxClassInfo
while (current)
{
wxShape *object = (wxShape *)current->Data();
float dist;
double dist;
int temp_attachment;
// On second pass, only ever consider non-composites or divisions. If children want to pass
@@ -465,35 +465,35 @@ wxShape *wxShapeCanvas::FindShape(float x, float y, int *attachment, wxClassInfo
*
*/
void wxShapeCanvas::OnLeftClick(float x, float y, int keys)
void wxShapeCanvas::OnLeftClick(double x, double y, int keys)
{
}
void wxShapeCanvas::OnRightClick(float x, float y, int keys)
void wxShapeCanvas::OnRightClick(double x, double y, int keys)
{
}
void wxShapeCanvas::OnDragLeft(bool draw, float x, float y, int keys)
void wxShapeCanvas::OnDragLeft(bool draw, double x, double y, int keys)
{
}
void wxShapeCanvas::OnBeginDragLeft(float x, float y, int keys)
void wxShapeCanvas::OnBeginDragLeft(double x, double y, int keys)
{
}
void wxShapeCanvas::OnEndDragLeft(float x, float y, int keys)
void wxShapeCanvas::OnEndDragLeft(double x, double y, int keys)
{
}
void wxShapeCanvas::OnDragRight(bool draw, float x, float y, int keys)
void wxShapeCanvas::OnDragRight(bool draw, double x, double y, int keys)
{
}
void wxShapeCanvas::OnBeginDragRight(float x, float y, int keys)
void wxShapeCanvas::OnBeginDragRight(double x, double y, int keys)
{
}
void wxShapeCanvas::OnEndDragRight(float x, float y, int keys)
void wxShapeCanvas::OnEndDragRight(double x, double y, int keys)
{
}
@@ -507,5 +507,5 @@ bool wxShapeCanvas::GetQuickEditMode()
{ return GetDiagram()->GetQuickEditMode(); }
void wxShapeCanvas::Redraw(wxDC& dc)
{ GetDiagram()->Redraw(dc); }
void wxShapeCanvas::Snap(float *x, float *y)
void wxShapeCanvas::Snap(double *x, double *y)
{ GetDiagram()->Snap(x, y); }
+13 -13
View File
@@ -38,21 +38,21 @@ class wxShapeCanvas: public wxScrolledWindow
inline void SetDiagram(wxDiagram *diag) { m_shapeDiagram = diag; }
inline wxDiagram *GetDiagram() const { return m_shapeDiagram; }
virtual void OnLeftClick(float x, float y, int keys = 0);
virtual void OnRightClick(float x, float y, int keys = 0);
virtual void OnLeftClick(double x, double y, int keys = 0);
virtual void OnRightClick(double x, double y, int keys = 0);
virtual void OnDragLeft(bool draw, float x, float y, int keys=0); // Erase if draw false
virtual void OnBeginDragLeft(float x, float y, int keys=0);
virtual void OnEndDragLeft(float x, float y, int keys=0);
virtual void OnDragLeft(bool draw, double x, double y, int keys=0); // Erase if draw false
virtual void OnBeginDragLeft(double x, double y, int keys=0);
virtual void OnEndDragLeft(double x, double y, int keys=0);
virtual void OnDragRight(bool draw, float x, float y, int keys=0); // Erase if draw false
virtual void OnBeginDragRight(float x, float y, int keys=0);
virtual void OnEndDragRight(float x, float y, int keys=0);
virtual void OnDragRight(bool draw, double x, double y, int keys=0); // Erase if draw false
virtual void OnBeginDragRight(double x, double y, int keys=0);
virtual void OnEndDragRight(double x, double y, int keys=0);
// Find object for mouse click, of given wxClassInfo (NULL for any type).
// If notImage is non-NULL, don't find an object that is equal to or a descendant of notImage
virtual wxShape *FindShape(float x, float y, int *attachment, wxClassInfo *info = NULL, wxShape *notImage = NULL);
wxShape *FindFirstSensitiveShape(float x, float y, int *new_attachment, int op);
virtual wxShape *FindShape(double x, double y, int *attachment, wxClassInfo *info = NULL, wxShape *notImage = NULL);
wxShape *FindFirstSensitiveShape(double x, double y, int *new_attachment, int op);
wxShape *FindFirstSensitiveShape1(wxShape *image, int op);
// Redirect to wxDiagram object
@@ -61,7 +61,7 @@ class wxShapeCanvas: public wxScrolledWindow
virtual void RemoveShape(wxShape *object);
virtual bool GetQuickEditMode();
virtual void Redraw(wxDC& dc);
void Snap(float *x, float *y);
void Snap(double *x, double *y);
// Events
void OnPaint(wxPaintEvent& event);
@@ -70,8 +70,8 @@ class wxShapeCanvas: public wxScrolledWindow
protected:
wxDiagram* m_shapeDiagram;
int m_dragState;
float m_oldDragX, m_oldDragY; // Previous drag coordinates
float m_firstDragX, m_firstDragY; // INITIAL drag coordinates
double m_oldDragX, m_oldDragY; // Previous drag coordinates
double m_firstDragX, m_firstDragY; // INITIAL drag coordinates
bool m_checkTolerance; // Whether to check drag tolerance
wxShape* m_draggedShape;
int m_draggedAttachment;
+144 -144
View File
File diff suppressed because it is too large Load Diff
+21 -21
View File
@@ -35,14 +35,14 @@ public:
void OnDraw(wxDC& dc);
void OnDrawContents(wxDC& dc);
void OnErase(wxDC& dc);
bool OnMovePre(wxDC& dc, float x, float y, float oldX, float oldY, bool display = TRUE);
void OnDragLeft(bool draw, float x, float y, int keys, int attachment = 0);
void OnBeginDragLeft(float x, float y, int keys, int attachment = 0);
void OnEndDragLeft(float x, float y, int keys, int attachment = 0);
bool OnMovePre(wxDC& dc, double x, double y, double oldX, double oldY, bool display = TRUE);
void OnDragLeft(bool draw, double x, double y, int keys, int attachment = 0);
void OnBeginDragLeft(double x, double y, int keys, int attachment = 0);
void OnEndDragLeft(double x, double y, int keys, int attachment = 0);
void OnRightClick(float x, float y, int keys, int attachment = 0);
void OnRightClick(double x, double y, int keys, int attachment = 0);
void SetSize(float w, float h, bool recursive = TRUE);
void SetSize(double w, double h, bool recursive = TRUE);
// Returns TRUE if it settled down
bool Recompute();
@@ -100,8 +100,8 @@ public:
inline wxList& GetConstraints() const { return (wxList&) m_constraints; }
protected:
float m_oldX;
float m_oldY;
double m_oldX;
double m_oldY;
wxList m_constraints;
wxList m_divisions; // In case it's a container
};
@@ -133,16 +133,16 @@ class wxDivisionShape: public wxCompositeShape
void OnDraw(wxDC& dc);
void OnDrawContents(wxDC& dc);
bool OnMovePre(wxDC& dc, float x, float y, float oldX, float oldY, bool display = TRUE);
void OnDragLeft(bool draw, float x, float y, int keys, int attachment = 0);
void OnBeginDragLeft(float x, float y, int keys, int attachment = 0);
void OnEndDragLeft(float x, float y, int keys, int attachment = 0);
bool OnMovePre(wxDC& dc, double x, double y, double oldX, double oldY, bool display = TRUE);
void OnDragLeft(bool draw, double x, double y, int keys, int attachment = 0);
void OnBeginDragLeft(double x, double y, int keys, int attachment = 0);
void OnEndDragLeft(double x, double y, int keys, int attachment = 0);
void OnRightClick(float x, float y, int keys = 0, int attachment = 0);
void OnRightClick(double x, double y, int keys = 0, int attachment = 0);
// Don't want this kind of composite to resize its subdiagrams, so
// override composite's SetSize.
void SetSize(float w, float h, bool recursive = TRUE);
void SetSize(double w, double h, bool recursive = TRUE);
// Similarly for calculating size: it's fixed at whatever SetSize
// set it to, not in terms of children.
@@ -167,20 +167,20 @@ class wxDivisionShape: public wxCompositeShape
// Resize adjoining divisions at the given side. If test is TRUE,
// just see whether it's possible for each adjoining region,
// returning FALSE if it's not.
bool ResizeAdjoining(int side, float newPos, bool test);
bool ResizeAdjoining(int side, double newPos, bool test);
// Adjust a side, returning FALSE if it's not physically possible.
bool AdjustLeft(float left, bool test);
bool AdjustTop(float top, bool test);
bool AdjustRight(float right, bool test);
bool AdjustBottom(float bottom, bool test);
bool AdjustLeft(double left, bool test);
bool AdjustTop(double top, bool test);
bool AdjustRight(double right, bool test);
bool AdjustBottom(double bottom, bool test);
// Edit style of left or top side
void EditEdge(int side);
// Popup menu
void PopupMenu(float x, float y);
void PopupMenu(double x, double y);
inline void SetLeftSide(wxDivisionShape *shape) { m_leftSide = shape; }
inline void SetTopSide(wxDivisionShape *shape) { m_topSide = shape; }
inline void SetRightSide(wxDivisionShape *shape) { m_rightSide = shape; }
+61 -61
View File
@@ -153,9 +153,9 @@ OGLConstraint::~OGLConstraint()
{
}
bool OGLConstraint::Equals(float a, float b)
bool OGLConstraint::Equals(double a, double b)
{
float marg = 0.5;
double marg = 0.5;
bool eq = ((b <= a + marg) && (b >= a - marg));
return eq;
@@ -164,7 +164,7 @@ bool OGLConstraint::Equals(float a, float b)
// Return TRUE if anything changed
bool OGLConstraint::Evaluate()
{
float maxWidth, maxHeight, minWidth, minHeight, x, y;
double maxWidth, maxHeight, minWidth, minHeight, x, y;
m_constrainingObject->GetBoundingBoxMax(&maxWidth, &maxHeight);
m_constrainingObject->GetBoundingBoxMin(&minWidth, &minHeight);
x = m_constrainingObject->GetX();
@@ -178,30 +178,30 @@ bool OGLConstraint::Evaluate()
case gyCONSTRAINT_CENTRED_VERTICALLY:
{
int n = m_constrainedObjects.Number();
float totalObjectHeight = 0.0;
double totalObjectHeight = 0.0;
wxNode *node = m_constrainedObjects.First();
while (node)
{
wxShape *constrainedObject = (wxShape *)node->Data();
float width2, height2;
double width2, height2;
constrainedObject->GetBoundingBoxMax(&width2, &height2);
totalObjectHeight += height2;
node = node->Next();
}
float startY;
float spacingY;
double startY;
double spacingY;
// Check if within the constraining object...
if ((totalObjectHeight + (n + 1)*m_ySpacing) <= minHeight)
{
spacingY = (float)((minHeight - totalObjectHeight)/(n + 1));
startY = (float)(y - (minHeight/2.0));
spacingY = (double)((minHeight - totalObjectHeight)/(n + 1));
startY = (double)(y - (minHeight/2.0));
}
// Otherwise, use default spacing
else
{
spacingY = m_ySpacing;
startY = (float)(y - ((totalObjectHeight + (n+1)*spacingY)/2.0));
startY = (double)(y - ((totalObjectHeight + (n+1)*spacingY)/2.0));
}
// Now position the objects
@@ -210,15 +210,15 @@ bool OGLConstraint::Evaluate()
while (node)
{
wxShape *constrainedObject = (wxShape *)node->Data();
float width2, height2;
double width2, height2;
constrainedObject->GetBoundingBoxMax(&width2, &height2);
startY += (float)(spacingY + (height2/2.0));
startY += (double)(spacingY + (height2/2.0));
if (!Equals(startY, constrainedObject->GetY()))
{
constrainedObject->Move(dc, constrainedObject->GetX(), startY, FALSE);
changed = TRUE;
}
startY += (float)(height2/2.0);
startY += (double)(height2/2.0);
node = node->Next();
}
return changed;
@@ -226,30 +226,30 @@ bool OGLConstraint::Evaluate()
case gyCONSTRAINT_CENTRED_HORIZONTALLY:
{
int n = m_constrainedObjects.Number();
float totalObjectWidth = 0.0;
double totalObjectWidth = 0.0;
wxNode *node = m_constrainedObjects.First();
while (node)
{
wxShape *constrainedObject = (wxShape *)node->Data();
float width2, height2;
double width2, height2;
constrainedObject->GetBoundingBoxMax(&width2, &height2);
totalObjectWidth += width2;
node = node->Next();
}
float startX;
float spacingX;
double startX;
double spacingX;
// Check if within the constraining object...
if ((totalObjectWidth + (n + 1)*m_xSpacing) <= minWidth)
{
spacingX = (float)((minWidth - totalObjectWidth)/(n + 1));
startX = (float)(x - (minWidth/2.0));
spacingX = (double)((minWidth - totalObjectWidth)/(n + 1));
startX = (double)(x - (minWidth/2.0));
}
// Otherwise, use default spacing
else
{
spacingX = m_xSpacing;
startX = (float)(x - ((totalObjectWidth + (n+1)*spacingX)/2.0));
startX = (double)(x - ((totalObjectWidth + (n+1)*spacingX)/2.0));
}
// Now position the objects
@@ -258,15 +258,15 @@ bool OGLConstraint::Evaluate()
while (node)
{
wxShape *constrainedObject = (wxShape *)node->Data();
float width2, height2;
double width2, height2;
constrainedObject->GetBoundingBoxMax(&width2, &height2);
startX += (float)(spacingX + (width2/2.0));
startX += (double)(spacingX + (width2/2.0));
if (!Equals(startX, constrainedObject->GetX()))
{
constrainedObject->Move(dc, startX, constrainedObject->GetY(), FALSE);
changed = TRUE;
}
startX += (float)(width2/2.0);
startX += (double)(width2/2.0);
node = node->Next();
}
return changed;
@@ -274,48 +274,48 @@ bool OGLConstraint::Evaluate()
case gyCONSTRAINT_CENTRED_BOTH:
{
int n = m_constrainedObjects.Number();
float totalObjectWidth = 0.0;
float totalObjectHeight = 0.0;
double totalObjectWidth = 0.0;
double totalObjectHeight = 0.0;
wxNode *node = m_constrainedObjects.First();
while (node)
{
wxShape *constrainedObject = (wxShape *)node->Data();
float width2, height2;
double width2, height2;
constrainedObject->GetBoundingBoxMax(&width2, &height2);
totalObjectWidth += width2;
totalObjectHeight += height2;
node = node->Next();
}
float startX;
float spacingX;
float startY;
float spacingY;
double startX;
double spacingX;
double startY;
double spacingY;
// Check if within the constraining object...
if ((totalObjectWidth + (n + 1)*m_xSpacing) <= minWidth)
{
spacingX = (float)((minWidth - totalObjectWidth)/(n + 1));
startX = (float)(x - (minWidth/2.0));
spacingX = (double)((minWidth - totalObjectWidth)/(n + 1));
startX = (double)(x - (minWidth/2.0));
}
// Otherwise, use default spacing
else
{
spacingX = m_xSpacing;
startX = (float)(x - ((totalObjectWidth + (n+1)*spacingX)/2.0));
startX = (double)(x - ((totalObjectWidth + (n+1)*spacingX)/2.0));
}
// Check if within the constraining object...
if ((totalObjectHeight + (n + 1)*m_ySpacing) <= minHeight)
{
spacingY = (float)((minHeight - totalObjectHeight)/(n + 1));
startY = (float)(y - (minHeight/2.0));
spacingY = (double)((minHeight - totalObjectHeight)/(n + 1));
startY = (double)(y - (minHeight/2.0));
}
// Otherwise, use default spacing
else
{
spacingY = m_ySpacing;
startY = (float)(y - ((totalObjectHeight + (n+1)*spacingY)/2.0));
startY = (double)(y - ((totalObjectHeight + (n+1)*spacingY)/2.0));
}
// Now position the objects
@@ -324,10 +324,10 @@ bool OGLConstraint::Evaluate()
while (node)
{
wxShape *constrainedObject = (wxShape *)node->Data();
float width2, height2;
double width2, height2;
constrainedObject->GetBoundingBoxMax(&width2, &height2);
startX += (float)(spacingX + (width2/2.0));
startY += (float)(spacingY + (height2/2.0));
startX += (double)(spacingX + (width2/2.0));
startY += (double)(spacingY + (height2/2.0));
if ((!Equals(startX, constrainedObject->GetX())) || (!Equals(startY, constrainedObject->GetY())))
{
@@ -335,8 +335,8 @@ bool OGLConstraint::Evaluate()
changed = TRUE;
}
startX += (float)(width2/2.0);
startY += (float)(height2/2.0);
startX += (double)(width2/2.0);
startY += (double)(height2/2.0);
node = node->Next();
}
@@ -351,10 +351,10 @@ bool OGLConstraint::Evaluate()
{
wxShape *constrainedObject = (wxShape *)node->Data();
float width2, height2;
double width2, height2;
constrainedObject->GetBoundingBoxMax(&width2, &height2);
float x3 = (float)(x - (minWidth/2.0) - (width2/2.0) - m_xSpacing);
double x3 = (double)(x - (minWidth/2.0) - (width2/2.0) - m_xSpacing);
if (!Equals(x3, constrainedObject->GetX()))
{
changed = TRUE;
@@ -374,10 +374,10 @@ bool OGLConstraint::Evaluate()
{
wxShape *constrainedObject = (wxShape *)node->Data();
float width2, height2;
double width2, height2;
constrainedObject->GetBoundingBoxMax(&width2, &height2);
float x3 = (float)(x + (minWidth/2.0) + (width2/2.0) + m_xSpacing);
double x3 = (double)(x + (minWidth/2.0) + (width2/2.0) + m_xSpacing);
if (!Equals(x3, constrainedObject->GetX()))
{
changed = TRUE;
@@ -399,10 +399,10 @@ bool OGLConstraint::Evaluate()
{
wxShape *constrainedObject = (wxShape *)node->Data();
float width2, height2;
double width2, height2;
constrainedObject->GetBoundingBoxMax(&width2, &height2);
float y3 = (float)(y - (minHeight/2.0) - (height2/2.0) - m_ySpacing);
double y3 = (double)(y - (minHeight/2.0) - (height2/2.0) - m_ySpacing);
if (!Equals(y3, constrainedObject->GetY()))
{
changed = TRUE;
@@ -422,10 +422,10 @@ bool OGLConstraint::Evaluate()
{
wxShape *constrainedObject = (wxShape *)node->Data();
float width2, height2;
double width2, height2;
constrainedObject->GetBoundingBoxMax(&width2, &height2);
float y3 = (float)(y + (minHeight/2.0) + (height2/2.0) + m_ySpacing);
double y3 = (double)(y + (minHeight/2.0) + (height2/2.0) + m_ySpacing);
if (!Equals(y3, constrainedObject->GetY()))
{
changed = TRUE;
@@ -445,10 +445,10 @@ bool OGLConstraint::Evaluate()
{
wxShape *constrainedObject = (wxShape *)node->Data();
float width2, height2;
double width2, height2;
constrainedObject->GetBoundingBoxMax(&width2, &height2);
float x3 = (float)(x - (minWidth/2.0) + (width2/2.0) + m_xSpacing);
double x3 = (double)(x - (minWidth/2.0) + (width2/2.0) + m_xSpacing);
if (!Equals(x3, constrainedObject->GetX()))
{
changed = TRUE;
@@ -468,10 +468,10 @@ bool OGLConstraint::Evaluate()
{
wxShape *constrainedObject = (wxShape *)node->Data();
float width2, height2;
double width2, height2;
constrainedObject->GetBoundingBoxMax(&width2, &height2);
float x3 = (float)(x + (minWidth/2.0) - (width2/2.0) - m_xSpacing);
double x3 = (double)(x + (minWidth/2.0) - (width2/2.0) - m_xSpacing);
if (!Equals(x3, constrainedObject->GetX()))
{
changed = TRUE;
@@ -493,10 +493,10 @@ bool OGLConstraint::Evaluate()
{
wxShape *constrainedObject = (wxShape *)node->Data();
float width2, height2;
double width2, height2;
constrainedObject->GetBoundingBoxMax(&width2, &height2);
float y3 = (float)(y - (minHeight/2.0) + (height2/2.0) + m_ySpacing);
double y3 = (double)(y - (minHeight/2.0) + (height2/2.0) + m_ySpacing);
if (!Equals(y3, constrainedObject->GetY()))
{
changed = TRUE;
@@ -516,10 +516,10 @@ bool OGLConstraint::Evaluate()
{
wxShape *constrainedObject = (wxShape *)node->Data();
float width2, height2;
double width2, height2;
constrainedObject->GetBoundingBoxMax(&width2, &height2);
float y3 = (float)(y + (minHeight/2.0) - (height2/2.0) - m_ySpacing);
double y3 = (double)(y + (minHeight/2.0) - (height2/2.0) - m_ySpacing);
if (!Equals(y3, constrainedObject->GetY()))
{
changed = TRUE;
@@ -539,7 +539,7 @@ bool OGLConstraint::Evaluate()
{
wxShape *constrainedObject = (wxShape *)node->Data();
float x3 = (float)(x - (minWidth/2.0));
double x3 = (double)(x - (minWidth/2.0));
if (!Equals(x3, constrainedObject->GetX()))
{
changed = TRUE;
@@ -559,7 +559,7 @@ bool OGLConstraint::Evaluate()
{
wxShape *constrainedObject = (wxShape *)node->Data();
float x3 = (float)(x + (minWidth/2.0));
double x3 = (double)(x + (minWidth/2.0));
if (!Equals(x3, constrainedObject->GetX()))
{
changed = TRUE;
@@ -581,7 +581,7 @@ bool OGLConstraint::Evaluate()
{
wxShape *constrainedObject = (wxShape *)node->Data();
float y3 = (float)(y - (minHeight/2.0));
double y3 = (double)(y - (minHeight/2.0));
if (!Equals(y3, constrainedObject->GetY()))
{
changed = TRUE;
@@ -601,7 +601,7 @@ bool OGLConstraint::Evaluate()
{
wxShape *constrainedObject = (wxShape *)node->Data();
float y3 = (float)(y + (minHeight/2.0));
double y3 = (double)(y + (minHeight/2.0));
if (!Equals(y3, constrainedObject->GetY()))
{
changed = TRUE;
+4 -4
View File
@@ -67,11 +67,11 @@ class OGLConstraint: public wxObject
// Returns TRUE if anything changed
bool Evaluate();
inline void SetSpacing(float x, float y) { m_xSpacing = x; m_ySpacing = y; };
bool Equals(float a, float b);
inline void SetSpacing(double x, double y) { m_xSpacing = x; m_ySpacing = y; };
bool Equals(double a, double b);
float m_xSpacing;
float m_ySpacing;
double m_xSpacing;
double m_ySpacing;
int m_constraintType;
wxString m_constraintName;
long m_constraintId;
+80 -80
View File
@@ -43,12 +43,12 @@ class wxDividedShapeControlPoint: public wxControlPoint
public:
wxDividedShapeControlPoint() { regionId = 0; }
wxDividedShapeControlPoint(wxShapeCanvas *the_canvas, wxShape *object, int region,
float size, float the_xoffset, float the_yoffset, int the_type);
double size, double the_xoffset, double the_yoffset, int the_type);
~wxDividedShapeControlPoint();
void OnDragLeft(bool draw, float x, float y, int keys=0, int attachment = 0);
void OnBeginDragLeft(float x, float y, int keys=0, int attachment = 0);
void OnEndDragLeft(float x, float y, int keys=0, int attachment = 0);
void OnDragLeft(bool draw, double x, double y, int keys=0, int attachment = 0);
void OnBeginDragLeft(double x, double y, int keys=0, int attachment = 0);
void OnEndDragLeft(double x, double y, int keys=0, int attachment = 0);
};
IMPLEMENT_DYNAMIC_CLASS(wxDividedShapeControlPoint, wxControlPoint)
@@ -60,7 +60,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxDividedShapeControlPoint, wxControlPoint)
IMPLEMENT_DYNAMIC_CLASS(wxDividedShape, wxRectangleShape)
wxDividedShape::wxDividedShape(float w, float h): wxRectangleShape(w, h)
wxDividedShape::wxDividedShape(double w, double h): wxRectangleShape(w, h)
{
ClearRegions();
}
@@ -76,12 +76,12 @@ void wxDividedShape::OnDraw(wxDC& dc)
void wxDividedShape::OnDrawContents(wxDC& dc)
{
float defaultProportion = (float)(GetRegions().Number() > 0 ? (1.0/((float)(GetRegions().Number()))) : 0.0);
float currentY = (float)(m_ypos - (m_height / 2.0));
float maxY = (float)(m_ypos + (m_height / 2.0));
double defaultProportion = (double)(GetRegions().Number() > 0 ? (1.0/((double)(GetRegions().Number()))) : 0.0);
double currentY = (double)(m_ypos - (m_height / 2.0));
double maxY = (double)(m_ypos + (m_height / 2.0));
float leftX = (float)(m_xpos - (m_width / 2.0));
float rightX = (float)(m_xpos + (m_width / 2.0));
double leftX = (double)(m_xpos - (m_width / 2.0));
double rightX = (double)(m_xpos + (m_width / 2.0));
if (m_pen) dc.SetPen(m_pen);
@@ -102,8 +102,8 @@ void wxDividedShape::OnDrawContents(wxDC& dc)
*/
if (GetDisableLabel()) return;
float xMargin = 2;
float yMargin = 2;
double xMargin = 2;
double yMargin = 2;
dc.SetBackgroundMode(wxTRANSPARENT);
wxNode *node = GetRegions().First();
@@ -113,17 +113,17 @@ void wxDividedShape::OnDrawContents(wxDC& dc)
dc.SetFont(region->GetFont());
dc.SetTextForeground(* region->GetActualColourObject());
float proportion =
double proportion =
region->m_regionProportionY < 0.0 ? defaultProportion : region->m_regionProportionY;
float y = currentY + m_height*proportion;
float actualY = maxY < y ? maxY : y;
double y = currentY + m_height*proportion;
double actualY = maxY < y ? maxY : y;
float centreX = m_xpos;
float centreY = (float)(currentY + (actualY - currentY)/2.0);
double centreX = m_xpos;
double centreY = (double)(currentY + (actualY - currentY)/2.0);
DrawFormattedText(dc, &region->m_formattedText,
(float)(centreX), (float)(centreY), (float)(m_width-2*xMargin), (float)(actualY - currentY - 2*yMargin),
oglDrawFormattedText(dc, &region->m_formattedText,
(double)(centreX), (double)(centreY), (double)(m_width-2*xMargin), (double)(actualY - currentY - 2*yMargin),
region->m_formatMode);
if ((y <= maxY) && (node->Next()))
{
@@ -131,7 +131,7 @@ void wxDividedShape::OnDrawContents(wxDC& dc)
if (regionPen)
{
dc.SetPen(regionPen);
dc.DrawLine(leftX, y, rightX, y);
dc.DrawLine(WXROUND(leftX), WXROUND(y), WXROUND(rightX), WXROUND(y));
}
}
@@ -141,7 +141,7 @@ void wxDividedShape::OnDrawContents(wxDC& dc)
}
}
void wxDividedShape::SetSize(float w, float h, bool recursive)
void wxDividedShape::SetSize(double w, double h, bool recursive)
{
SetAttachmentSize(w, h);
m_width = w;
@@ -154,35 +154,35 @@ void wxDividedShape::SetRegionSizes()
if (GetRegions().Number() == 0)
return;
float defaultProportion = (float)(GetRegions().Number() > 0 ? (1.0/((float)(GetRegions().Number()))) : 0.0);
float currentY = (float)(m_ypos - (m_height / 2.0));
float maxY = (float)(m_ypos + (m_height / 2.0));
double defaultProportion = (double)(GetRegions().Number() > 0 ? (1.0/((double)(GetRegions().Number()))) : 0.0);
double currentY = (double)(m_ypos - (m_height / 2.0));
double maxY = (double)(m_ypos + (m_height / 2.0));
// float leftX = (float)(m_xpos - (m_width / 2.0));
// float rightX = (float)(m_xpos + (m_width / 2.0));
// double leftX = (double)(m_xpos - (m_width / 2.0));
// double rightX = (double)(m_xpos + (m_width / 2.0));
wxNode *node = GetRegions().First();
while (node)
{
wxShapeRegion *region = (wxShapeRegion *)node->Data();
float proportion =
double proportion =
region->m_regionProportionY <= 0.0 ? defaultProportion : region->m_regionProportionY;
float sizeY = (float)proportion*m_height;
float y = currentY + sizeY;
float actualY = maxY < y ? maxY : y;
double sizeY = (double)proportion*m_height;
double y = currentY + sizeY;
double actualY = maxY < y ? maxY : y;
float centreY = (float)(currentY + (actualY - currentY)/2.0);
double centreY = (double)(currentY + (actualY - currentY)/2.0);
region->SetSize(m_width, sizeY);
region->SetPosition(0.0, (float)(centreY - m_ypos));
region->SetPosition(0.0, (double)(centreY - m_ypos));
currentY = actualY;
node = node->Next();
}
}
// Attachment points correspond to regions in the divided box
bool wxDividedShape::GetAttachmentPosition(int attachment, float *x, float *y, int nth, int no_arcs,
bool wxDividedShape::GetAttachmentPosition(int attachment, double *x, double *y, int nth, int no_arcs,
wxLineShape *line)
{
int totalNumberAttachments = (GetRegions().Number() * 2) + 2;
@@ -194,10 +194,10 @@ bool wxDividedShape::GetAttachmentPosition(int attachment, float *x, float *y, i
int n = GetRegions().Number();
bool isEnd = (line && line->IsEnd(this));
float left = (float)(m_xpos - m_width/2.0);
float right = (float)(m_xpos + m_width/2.0);
float top = (float)(m_ypos - m_height/2.0);
float bottom = (float)(m_ypos + m_height/2.0);
double left = (double)(m_xpos - m_width/2.0);
double right = (double)(m_xpos + m_width/2.0);
double top = (double)(m_ypos - m_height/2.0);
double bottom = (double)(m_ypos + m_height/2.0);
// Zero is top, n+1 is bottom.
if (attachment == 0)
@@ -270,8 +270,8 @@ bool wxDividedShape::GetAttachmentPosition(int attachment, float *x, float *y, i
*x = right;
// Calculate top and bottom of region
top = (float)((m_ypos + region->m_y) - (region->m_height/2.0));
bottom = (float)((m_ypos + region->m_y) + (region->m_height/2.0));
top = (double)((m_ypos + region->m_y) - (region->m_height/2.0));
bottom = (double)((m_ypos + region->m_y) + (region->m_height/2.0));
// Assuming we can trust the absolute size and
// position of these regions...
@@ -289,11 +289,11 @@ bool wxDividedShape::GetAttachmentPosition(int attachment, float *x, float *y, i
*y = point->y;
}
else
// *y = (float)(((m_ypos + region->m_y) - (region->m_height/2.0)) + (nth + 1)*region->m_height/(no_arcs+1));
*y = (float)(top + (nth + 1)*region->m_height/(no_arcs+1));
// *y = (double)(((m_ypos + region->m_y) - (region->m_height/2.0)) + (nth + 1)*region->m_height/(no_arcs+1));
*y = (double)(top + (nth + 1)*region->m_height/(no_arcs+1));
}
else
*y = (float)(m_ypos + region->m_y);
*y = (double)(m_ypos + region->m_y);
}
else
{
@@ -352,8 +352,8 @@ void wxDividedShape::MakeControlPoints()
void wxDividedShape::MakeMandatoryControlPoints()
{
float currentY = (float)(GetY() - (m_height / 2.0));
float maxY = (float)(GetY() + (m_height / 2.0));
double currentY = (double)(GetY() - (m_height / 2.0));
double maxY = (double)(GetY() + (m_height / 2.0));
wxNode *node = GetRegions().First();
int i = 0;
@@ -361,15 +361,15 @@ void wxDividedShape::MakeMandatoryControlPoints()
{
wxShapeRegion *region = (wxShapeRegion *)node->Data();
float proportion = region->m_regionProportionY;
double proportion = region->m_regionProportionY;
float y = currentY + m_height*proportion;
float actualY = (float)(maxY < y ? maxY : y);
double y = currentY + m_height*proportion;
double actualY = (double)(maxY < y ? maxY : y);
if (node->Next())
{
wxDividedShapeControlPoint *controlPoint =
new wxDividedShapeControlPoint(m_canvas, this, i, CONTROL_POINT_SIZE, 0.0, (float)(actualY - GetY()), 0);
new wxDividedShapeControlPoint(m_canvas, this, i, CONTROL_POINT_SIZE, 0.0, (double)(actualY - GetY()), 0);
m_canvas->AddShape(controlPoint);
m_controlPoints.Append(controlPoint);
}
@@ -390,8 +390,8 @@ void wxDividedShape::ResetControlPoints()
void wxDividedShape::ResetMandatoryControlPoints()
{
float currentY = (float)(GetY() - (m_height / 2.0));
float maxY = (float)(GetY() + (m_height / 2.0));
double currentY = (double)(GetY() - (m_height / 2.0));
double maxY = (double)(GetY() + (m_height / 2.0));
wxNode *node = m_controlPoints.First();
int i = 0;
@@ -403,13 +403,13 @@ void wxDividedShape::ResetMandatoryControlPoints()
wxNode *node1 = GetRegions().Nth(i);
wxShapeRegion *region = (wxShapeRegion *)node1->Data();
float proportion = region->m_regionProportionY;
double proportion = region->m_regionProportionY;
float y = currentY + m_height*proportion;
float actualY = (float)(maxY < y ? maxY : y);
double y = currentY + m_height*proportion;
double actualY = (double)(maxY < y ? maxY : y);
controlPoint->m_xoffset = 0.0;
controlPoint->m_yoffset = (float)(actualY - GetY());
controlPoint->m_yoffset = (double)(actualY - GetY());
currentY = actualY;
i ++;
}
@@ -569,7 +569,7 @@ void wxDividedShape::EditRegions()
#endif
}
void wxDividedShape::OnRightClick(float x, float y, int keys, int attachment)
void wxDividedShape::OnRightClick(double x, double y, int keys, int attachment)
{
if (keys & KEY_CTRL)
{
@@ -582,7 +582,7 @@ void wxDividedShape::OnRightClick(float x, float y, int keys, int attachment)
}
wxDividedShapeControlPoint::wxDividedShapeControlPoint(wxShapeCanvas *the_canvas, wxShape *object,
int region, float size, float the_m_xoffset, float the_m_yoffset, int the_type):
int region, double size, double the_m_xoffset, double the_m_yoffset, int the_type):
wxControlPoint(the_canvas, object, size, the_m_xoffset, the_m_yoffset, the_type)
{
regionId = region;
@@ -593,7 +593,7 @@ wxDividedShapeControlPoint::~wxDividedShapeControlPoint()
}
// Implement resizing of divided object division
void wxDividedShapeControlPoint::OnDragLeft(bool draw, float x, float y, int keys, int attachment)
void wxDividedShapeControlPoint::OnDragLeft(bool draw, double x, double y, int keys, int attachment)
{
wxClientDC dc(GetCanvas());
GetCanvas()->PrepareDC(dc);
@@ -604,14 +604,14 @@ void wxDividedShapeControlPoint::OnDragLeft(bool draw, float x, float y, int key
dc.SetBrush((* wxTRANSPARENT_BRUSH));
wxDividedShape *dividedObject = (wxDividedShape *)m_shape;
float x1 = (float)(dividedObject->GetX() - (dividedObject->GetWidth()/2.0));
float y1 = y;
float x2 = (float)(dividedObject->GetX() + (dividedObject->GetWidth()/2.0));
float y2 = y;
dc.DrawLine(x1, y1, x2, y2);
double x1 = (double)(dividedObject->GetX() - (dividedObject->GetWidth()/2.0));
double y1 = y;
double x2 = (double)(dividedObject->GetX() + (dividedObject->GetWidth()/2.0));
double y2 = y;
dc.DrawLine(WXROUND(x1), WXROUND(y1), WXROUND(x2), WXROUND(y2));
}
void wxDividedShapeControlPoint::OnBeginDragLeft(float x, float y, int keys, int attachment)
void wxDividedShapeControlPoint::OnBeginDragLeft(double x, double y, int keys, int attachment)
{
wxClientDC dc(GetCanvas());
GetCanvas()->PrepareDC(dc);
@@ -622,15 +622,15 @@ void wxDividedShapeControlPoint::OnBeginDragLeft(float x, float y, int keys, int
dc.SetPen(dottedPen);
dc.SetBrush((* wxTRANSPARENT_BRUSH));
float x1 = (float)(dividedObject->GetX() - (dividedObject->GetWidth()/2.0));
float y1 = y;
float x2 = (float)(dividedObject->GetX() + (dividedObject->GetWidth()/2.0));
float y2 = y;
dc.DrawLine(x1, y1, x2, y2);
double x1 = (double)(dividedObject->GetX() - (dividedObject->GetWidth()/2.0));
double y1 = y;
double x2 = (double)(dividedObject->GetX() + (dividedObject->GetWidth()/2.0));
double y2 = y;
dc.DrawLine(WXROUND(x1), WXROUND(y1), WXROUND(x2), WXROUND(y2));
m_canvas->CaptureMouse();
}
void wxDividedShapeControlPoint::OnEndDragLeft(float x, float y, int keys, int attachment)
void wxDividedShapeControlPoint::OnEndDragLeft(double x, double y, int keys, int attachment)
{
wxClientDC dc(GetCanvas());
GetCanvas()->PrepareDC(dc);
@@ -651,22 +651,22 @@ void wxDividedShapeControlPoint::OnEndDragLeft(float x, float y, int keys, int a
// and calculate the new proportion for this region
// if legal.
float currentY = (float)(dividedObject->GetY() - (dividedObject->GetHeight() / 2.0));
float maxY = (float)(dividedObject->GetY() + (dividedObject->GetHeight() / 2.0));
double currentY = (double)(dividedObject->GetY() - (dividedObject->GetHeight() / 2.0));
double maxY = (double)(dividedObject->GetY() + (dividedObject->GetHeight() / 2.0));
// Save values
float thisRegionTop = 0.0;
float thisRegionBottom = 0.0;
float nextRegionBottom = 0.0;
double thisRegionTop = 0.0;
double thisRegionBottom = 0.0;
double nextRegionBottom = 0.0;
node = dividedObject->GetRegions().First();
while (node)
{
wxShapeRegion *region = (wxShapeRegion *)node->Data();
float proportion = region->m_regionProportionY;
float yy = currentY + (dividedObject->GetHeight()*proportion);
float actualY = (float)(maxY < yy ? maxY : yy);
double proportion = region->m_regionProportionY;
double yy = currentY + (dividedObject->GetHeight()*proportion);
double actualY = (double)(maxY < yy ? maxY : yy);
if (region == thisRegion)
{
@@ -694,11 +694,11 @@ void wxDividedShapeControlPoint::OnEndDragLeft(float x, float y, int keys, int a
dividedObject->EraseLinks(dc);
// Now calculate the new proportions of this region and the next region.
float thisProportion = (float)((y - thisRegionTop)/dividedObject->GetHeight());
float nextProportion = (float)((nextRegionBottom - y)/dividedObject->GetHeight());
double thisProportion = (double)((y - thisRegionTop)/dividedObject->GetHeight());
double nextProportion = (double)((nextRegionBottom - y)/dividedObject->GetHeight());
thisRegion->SetProportions(0.0, thisProportion);
nextRegion->SetProportions(0.0, nextProportion);
m_yoffset = (float)(y - dividedObject->GetY());
m_yoffset = (double)(y - dividedObject->GetY());
// Now reformat text
int i = 0;
+4 -4
View File
@@ -32,13 +32,13 @@ class wxDividedShape: public wxRectangleShape
DECLARE_DYNAMIC_CLASS(wxDividedShape)
public:
wxDividedShape(float w = 0.0, float h = 0.0);
wxDividedShape(double w = 0.0, double h = 0.0);
~wxDividedShape();
void OnDraw(wxDC& dc);
void OnDrawContents(wxDC& dc);
void SetSize(float w, float h, bool recursive = TRUE);
void SetSize(double w, double h, bool recursive = TRUE);
void MakeControlPoints();
void ResetControlPoints();
@@ -62,13 +62,13 @@ class wxDividedShape: public wxRectangleShape
void EditRegions();
// Attachment points correspond to regions in the divided box
bool GetAttachmentPosition(int attachment, float *x, float *y,
bool GetAttachmentPosition(int attachment, double *x, double *y,
int nth = 0, int no_arcs = 1, wxLineShape *line = NULL);
bool AttachmentIsValid(int attachment);
int GetNumberOfAttachments();
// Invoke editor on CTRL-right click
void OnRightClick(float x, float y, int keys = 0, int attachment = 0);
void OnRightClick(double x, double y, int keys = 0, int attachment = 0);
};
#endif
+602 -171
View File
File diff suppressed because it is too large Load Diff
+69 -23
View File
@@ -18,6 +18,9 @@
#include "basic.h"
#define oglMETAFLAGS_OUTLINE 1
#define oglMETAFLAGS_ATTACHMENTS 2
class wxDrawnShape;
class wxPseudoMetaFile: public wxObject
{
@@ -27,27 +30,27 @@ class wxPseudoMetaFile: public wxObject
wxPseudoMetaFile(wxPseudoMetaFile& mf);
~wxPseudoMetaFile();
void Draw(wxDC& dc, float xoffset, float yoffset);
void Draw(wxDC& dc, double xoffset, double yoffset);
#ifdef PROLOGIO
void WritePrologAttributes(wxExpr *clause);
void ReadPrologAttributes(wxExpr *clause);
void WritePrologAttributes(wxExpr *clause, int whichAngle);
void ReadPrologAttributes(wxExpr *clause, int whichAngle);
#endif
void Clear();
void Copy(wxPseudoMetaFile& copy);
void Scale(float sx, float sy);
void ScaleTo(float w, float h); // Scale to fit size
void Translate(float x, float y);
void Scale(double sx, double sy);
void ScaleTo(double w, double h); // Scale to fit size
void Translate(double x, double y);
// Rotate about the given axis by theta radians from the x axis.
void Rotate(float x, float y, float theta);
void Rotate(double x, double y, double theta);
bool LoadFromMetaFile(char *filename, float *width, float *height);
bool LoadFromMetaFile(char *filename, double *width, double *height);
void GetBounds(float *minX, float *minY, float *maxX, float *maxY);
void GetBounds(double *minX, double *minY, double *maxX, double *maxY);
// Calculate size from current operations
void CalculateSize(wxDrawnShape* shape);
@@ -57,7 +60,7 @@ class wxPseudoMetaFile: public wxObject
inline void SetRotateable(bool rot) { m_rotateable = rot; }
inline bool GetRotateable() const { return m_rotateable; }
inline void SetSize(float w, float h) { m_width = w; m_height = h; }
inline void SetSize(double w, double h) { m_width = w; m_height = h; }
inline void SetFillBrush(wxBrush* brush) { m_fillBrush = brush; }
inline wxBrush* GetFillBrush() const { return m_fillBrush; }
@@ -65,6 +68,14 @@ class wxPseudoMetaFile: public wxObject
inline void SetOutlinePen(wxPen* pen) { m_outlinePen = pen; }
inline wxPen* GetOutlinePen() const { return m_outlinePen; }
inline void SetOutlineOp(int op) { m_outlineOp = op; }
inline int GetOutlineOp() const { return m_outlineOp; }
inline wxList& GetOps() const { return (wxList&) m_ops; }
// Is this a valid (non-empty) metafile?
inline bool IsValid() const { return (m_ops.Number() > 0); }
public:
/// Set of functions for drawing into a pseudo metafile.
/// They use integers, but doubles are used internally for accuracy
@@ -73,11 +84,18 @@ public:
virtual void DrawLine(const wxPoint& pt1, const wxPoint& pt2);
virtual void DrawRectangle(const wxRect& rect);
virtual void DrawRoundedRectangle(const wxRect& rect, double radius);
virtual void DrawArc(const wxPoint& centrePt, const wxPoint& startPt, const wxPoint& endPt);
virtual void DrawEllipticArc(const wxRect& rect, double startAngle, double endAngle);
virtual void DrawEllipse(const wxRect& rect);
virtual void DrawPoint(const wxPoint& pt);
virtual void DrawText(const wxString& text, const wxPoint& pt);
virtual void DrawLines(int n, wxPoint pts[]);
virtual void DrawPolygon(int n, wxPoint pts[]);
// flags:
// oglMETAFLAGS_OUTLINE: will be used for drawing the outline and
// also drawing lines/arrows at the circumference.
// oglMETAFLAGS_ATTACHMENTS: will be used for initialising attachment points at
// the vertices (perhaps a rare case...)
virtual void DrawPolygon(int n, wxPoint pts[], int flags = 0);
virtual void DrawSpline(int n, wxPoint pts[]);
virtual void SetClippingRect(const wxRect& rect);
@@ -92,10 +110,11 @@ public:
public:
bool m_rotateable;
float m_width;
float m_height;
double m_width;
double m_height;
wxList m_ops; // List of drawing operations (see drawnp.h)
wxList m_gdiObjects; // List of pens, brushes and fonts for this object.
int m_outlineOp; // The op representing the outline, if any
// Pen/brush specifying outline/fill colours
// to override operations.
@@ -103,9 +122,14 @@ public:
wxBrush* m_fillBrush;
wxList m_outlineColours; // List of the GDI operations that comprise the outline
wxList m_fillColours; // List of the GDI operations that fill the shape
float m_currentRotation;
double m_currentRotation;
};
#define oglDRAWN_ANGLE_0 0
#define oglDRAWN_ANGLE_90 1
#define oglDRAWN_ANGLE_180 2
#define oglDRAWN_ANGLE_270 3
class wxDrawnShape: public wxRectangleShape
{
DECLARE_DYNAMIC_CLASS(wxDrawnShape)
@@ -125,19 +149,27 @@ class wxDrawnShape: public wxRectangleShape
// Does the copying for this object
void Copy(wxShape& copy);
void Scale(float sx, float sy);
void Translate(float x, float y);
void Scale(double sx, double sy);
void Translate(double x, double y);
// Rotate about the given axis by theta radians from the x axis.
void Rotate(float x, float y, float theta);
void Rotate(double x, double y, double theta);
// Get current rotation
inline float GetRotation() const { return m_rotation; }
inline double GetRotation() const { return m_rotation; }
void SetSize(float w, float h, bool recursive = TRUE);
void SetSize(double w, double h, bool recursive = TRUE);
bool LoadFromMetaFile(char *filename);
inline void SetSaveToFile(bool save) { m_saveToFile = save; }
inline wxPseudoMetaFile& GetMetaFile() const { return (wxPseudoMetaFile&) m_metafile; }
inline wxPseudoMetaFile& GetMetaFile(int which = 0) const { return (wxPseudoMetaFile&) m_metafiles[which]; }
void OnDrawOutline(wxDC& dc, double x, double y, double w, double h);
// Get the perimeter point using the special outline op, if there is one,
// otherwise use default wxRectangleShape scheme
bool GetPerimeterPoint(double x1, double y1,
double x2, double y2,
double *x3, double *y3);
/// Set of functions for drawing into a pseudo metafile.
/// They use integers, but doubles are used internally for accuracy
@@ -146,11 +178,13 @@ class wxDrawnShape: public wxRectangleShape
virtual void DrawLine(const wxPoint& pt1, const wxPoint& pt2);
virtual void DrawRectangle(const wxRect& rect);
virtual void DrawRoundedRectangle(const wxRect& rect, double radius);
virtual void DrawArc(const wxPoint& centrePt, const wxPoint& startPt, const wxPoint& endPt);
virtual void DrawEllipticArc(const wxRect& rect, double startAngle, double endAngle);
virtual void DrawEllipse(const wxRect& rect);
virtual void DrawPoint(const wxPoint& pt);
virtual void DrawText(const wxString& text, const wxPoint& pt);
virtual void DrawLines(int n, wxPoint pts[]);
virtual void DrawPolygon(int n, wxPoint pts[]);
virtual void DrawPolygon(int n, wxPoint pts[], int flags = 0);
virtual void DrawSpline(int n, wxPoint pts[]);
virtual void SetClippingRect(const wxRect& rect);
@@ -165,14 +199,26 @@ class wxDrawnShape: public wxRectangleShape
// Set the width/height according to the shapes in the metafile.
// Call this after drawing into the shape.
inline void CalculateSize() { m_metafile.CalculateSize(this); }
inline void CalculateSize() { m_metafiles[m_currentAngle].CalculateSize(this); }
inline void DrawAtAngle(int angle) { m_currentAngle = angle; };
inline int GetAngle() const { return m_currentAngle; }
// Which metafile do we use now? Based on current rotation and validity
// of metafiles.
int DetermineMetaFile(double rotation);
private:
wxPseudoMetaFile m_metafile;
// One metafile for each 90 degree rotation (or just a single one).
wxPseudoMetaFile m_metafiles[4];
// Don't save all wxDrawnShape metafiles to file: sometimes
// we take the metafile data from a symbol library.
bool m_saveToFile;
// Which angle are we using/drawing into?
int m_currentAngle;
};
#endif
+56 -31
View File
@@ -48,6 +48,7 @@
#define DRAWOP_DRAW_ARC 27
#define DRAWOP_DRAW_TEXT 28
#define DRAWOP_DRAW_SPLINE 29
#define DRAWOP_DRAW_ELLIPTIC_ARC 30
/*
* Base, virtual class
@@ -59,18 +60,30 @@ class wxDrawOp: public wxObject
public:
inline wxDrawOp(int theOp) { m_op = theOp; }
inline ~wxDrawOp() {}
inline virtual void Scale(float xScale, float yScale) {};
inline virtual void Translate(float x, float y) {};
inline virtual void Rotate(float x, float y, float sinTheta, float cosTheta) {};
virtual void Do(wxDC& dc, float xoffset, float yoffset) = 0;
inline virtual void Scale(double xScale, double yScale) {};
inline virtual void Translate(double x, double y) {};
inline virtual void Rotate(double x, double y, double theta, double sinTheta, double cosTheta) {};
virtual void Do(wxDC& dc, double xoffset, double yoffset) = 0;
virtual wxDrawOp *Copy(wxPseudoMetaFile *newImage) = 0;
virtual wxExpr *WriteExpr(wxPseudoMetaFile *image) = 0;
virtual void ReadExpr(wxPseudoMetaFile *image, wxExpr *expr) = 0;
int GetOp() const { return m_op; }
inline int GetOp() const { return m_op; }
// Draw an outline using the current operation. By default, return FALSE (not drawn)
virtual bool OnDrawOutline(wxDC& dc, double x, double y, double w, double h,
double oldW, double oldH) { return FALSE; }
// Get the perimeter point using this data
virtual bool GetPerimeterPoint(double x1, double y1,
double x2, double y2,
double *x3, double *y3,
double xOffset, double yOffset,
bool attachmentMode)
{ return FALSE; }
protected:
int m_op;
int m_op;
};
@@ -83,7 +96,7 @@ class wxOpSetGDI: public wxDrawOp
{
public:
wxOpSetGDI(int theOp, wxPseudoMetaFile *theImage, int theGdiIndex, int theMode = 0);
void Do(wxDC& dc, float xoffset, float yoffset);
void Do(wxDC& dc, double xoffset, double yoffset);
wxDrawOp *Copy(wxPseudoMetaFile *newImage);
wxExpr *WriteExpr(wxPseudoMetaFile *image);
void ReadExpr(wxPseudoMetaFile *image, wxExpr *expr);
@@ -105,19 +118,19 @@ public:
class wxOpSetClipping: public wxDrawOp
{
public:
wxOpSetClipping(int theOp, float theX1, float theY1, float theX2, float theY2);
void Do(wxDC& dc, float xoffset, float yoffset);
void Scale(float xScale, float yScale);
void Translate(float x, float y);
wxOpSetClipping(int theOp, double theX1, double theY1, double theX2, double theY2);
void Do(wxDC& dc, double xoffset, double yoffset);
void Scale(double xScale, double yScale);
void Translate(double x, double y);
wxDrawOp *Copy(wxPseudoMetaFile *newImage);
wxExpr *WriteExpr(wxPseudoMetaFile *image);
void ReadExpr(wxPseudoMetaFile *image, wxExpr *expr);
public:
float m_x1;
float m_y1;
float m_x2;
float m_y2;
double m_x1;
double m_y1;
double m_x2;
double m_y2;
};
/*
@@ -128,24 +141,25 @@ public:
class wxOpDraw: public wxDrawOp
{
public:
wxOpDraw(int theOp, float theX1, float theY1, float theX2, float theY2,
float radius = 0.0, char *s = NULL);
wxOpDraw(int theOp, double theX1, double theY1, double theX2, double theY2,
double radius = 0.0, char *s = NULL);
~wxOpDraw();
void Do(wxDC& dc, float xoffset, float yoffset);
void Scale(float scaleX, float scaleY);
void Translate(float x, float y);
void Rotate(float x, float y, float sinTheta, float cosTheta);
void Do(wxDC& dc, double xoffset, double yoffset);
void Scale(double scaleX, double scaleY);
void Translate(double x, double y);
void Rotate(double x, double y, double theta, double sinTheta, double cosTheta);
wxDrawOp *Copy(wxPseudoMetaFile *newImage);
wxExpr *WriteExpr(wxPseudoMetaFile *image);
void ReadExpr(wxPseudoMetaFile *image, wxExpr *expr);
public:
float m_x1;
float m_y1;
float m_x2;
float m_y2;
float m_x3;
float m_radius;
double m_x1;
double m_y1;
double m_x2;
double m_y2;
double m_x3;
double m_y3;
double m_radius;
char* m_textString;
};
@@ -160,14 +174,25 @@ class wxOpPolyDraw: public wxDrawOp
public:
wxOpPolyDraw(int theOp, int n, wxRealPoint *thePoints);
~wxOpPolyDraw();
void Do(wxDC& dc, float xoffset, float yoffset);
void Scale(float scaleX, float scaleY);
void Translate(float x, float y);
void Rotate(float x, float y, float sinTheta, float cosTheta);
void Do(wxDC& dc, double xoffset, double yoffset);
void Scale(double scaleX, double scaleY);
void Translate(double x, double y);
void Rotate(double x, double y, double theta, double sinTheta, double cosTheta);
wxDrawOp *Copy(wxPseudoMetaFile *newImage);
wxExpr *WriteExpr(wxPseudoMetaFile *image);
void ReadExpr(wxPseudoMetaFile *image, wxExpr *expr);
// Draw an outline using the current operation.
virtual bool OnDrawOutline(wxDC& dc, double x, double y, double w, double h,
double oldW, double oldH);
// Get the perimeter point using this data
bool GetPerimeterPoint(double x1, double y1,
double x2, double y2,
double *x3, double *y3,
double xOffset, double yOffset,
bool attachmentMode);
public:
wxRealPoint* m_points;
int m_noPoints;
+230 -231
View File
File diff suppressed because it is too large Load Diff
+40 -38
View File
@@ -51,7 +51,7 @@ class wxArrowHead: public wxObject
DECLARE_DYNAMIC_CLASS(wxArrowHead)
public:
wxArrowHead(WXTYPE type = 0, int end = 0, float size = 0.0, float dist = 0.0, const wxString& name = "", wxPseudoMetaFile *mf = NULL,
wxArrowHead(WXTYPE type = 0, int end = 0, double size = 0.0, double dist = 0.0, const wxString& name = "", wxPseudoMetaFile *mf = NULL,
long arrowId = -1);
~wxArrowHead();
wxArrowHead(wxArrowHead& toCopy);
@@ -59,28 +59,28 @@ class wxArrowHead: public wxObject
inline WXTYPE _GetType() const { return m_arrowType; }
inline int GetPosition() const { return m_arrowEnd; }
inline void SetPosition(int pos) { m_arrowEnd = pos; }
inline float GetXOffset() const { return m_xOffset; }
inline float GetYOffset() const { return m_yOffset; }
inline float GetSpacing() const { return m_spacing; }
inline float GetSize() const { return m_arrowSize; }
inline double GetXOffset() const { return m_xOffset; }
inline double GetYOffset() const { return m_yOffset; }
inline double GetSpacing() const { return m_spacing; }
inline double GetSize() const { return m_arrowSize; }
inline wxString GetName() const { return m_arrowName; }
inline void SetXOffset(float x) { m_xOffset = x; }
inline void SetYOffset(float y) { m_yOffset = y; }
inline void SetXOffset(double x) { m_xOffset = x; }
inline void SetYOffset(double y) { m_yOffset = y; }
inline wxPseudoMetaFile *GetMetaFile() const { return m_metaFile; }
inline long GetId() const { return m_id; }
inline int GetArrowEnd() const { return m_arrowEnd; }
inline float GetArrowSize() const { return m_arrowSize; }
void SetSize(float size);
inline void SetSpacing(float sp) { m_spacing = sp; }
inline double GetArrowSize() const { return m_arrowSize; }
void SetSize(double size);
inline void SetSpacing(double sp) { m_spacing = sp; }
protected:
WXTYPE m_arrowType;
int m_arrowEnd; // Position on line
float m_xOffset; // Distance from arc start or end, w.r.t. point on arrowhead
double m_xOffset; // Distance from arc start or end, w.r.t. point on arrowhead
// nearest start or end. If zero, use default spacing.
float m_yOffset; // vertical offset (w.r.t. a horizontal line). Normally zero.
float m_spacing; // Spacing from the last arrowhead
float m_arrowSize; // Length of arrowhead
double m_yOffset; // vertical offset (w.r.t. a horizontal line). Normally zero.
double m_spacing; // Spacing from the last arrowhead
double m_arrowSize; // Length of arrowhead
wxString m_arrowName; // Name of arrow
bool m_saveToFile; // TRUE if we want to save custom arrowheads to file.
wxPseudoMetaFile* m_metaFile; // Pseudo metafile if this is a custom arrowhead
@@ -101,18 +101,18 @@ class wxLineShape: public wxShape
// moveControlPoints must be disabled when a control point is being
// dragged.
void OnMoveLink(wxDC& dc, bool moveControlPoints = TRUE);
bool OnMovePre(wxDC& dc, float x, float y, float old_x, float old_y, bool display = TRUE);
bool OnMovePre(wxDC& dc, double x, double y, double old_x, double old_y, bool display = TRUE);
void OnDraw(wxDC& dc);
void OnDrawContents(wxDC& dc);
void OnDrawControlPoints(wxDC& dc);
void OnEraseControlPoints(wxDC& dc);
void OnErase(wxDC& dc);
virtual inline void OnMoveControlPoint(int WXUNUSED(which), float WXUNUSED(x), float WXUNUSED(y)) {}
void OnDrawOutline(wxDC& dc, float x, float y, float w, float h);
void GetBoundingBoxMin(float *w, float *h);
virtual inline void OnMoveControlPoint(int WXUNUSED(which), double WXUNUSED(x), double WXUNUSED(y)) {}
void OnDrawOutline(wxDC& dc, double x, double y, double w, double h);
void GetBoundingBoxMin(double *w, double *h);
void FormatText(wxDC& dc, const wxString& s, int regionId = 0);
virtual void SetEnds(float x1, float y1, float x2, float y2);
virtual void GetEnds(float *x1, float *y1, float *x2, float *y2);
virtual void SetEnds(double x1, double y1, double x2, double y2);
virtual void GetEnds(double *x1, double *y1, double *x2, double *y2);
inline virtual wxShape *GetFrom() { return m_from; }
inline virtual wxShape *GetTo() { return m_to; }
inline virtual int GetAttachmentFrom() { return m_attachmentFrom; }
@@ -126,18 +126,18 @@ class wxLineShape: public wxShape
// This function can be used by e.g. line-routing routines to
// get the actual points on the two node images where the lines will be drawn
// to/from.
void FindLineEndPoints(float *fromX, float *fromY, float *toX, float *toY);
void FindLineEndPoints(double *fromX, double *fromY, double *toX, double *toY);
// Format one region at this position
void DrawRegion(wxDC& dc, wxShapeRegion *region, float x, float y);
void DrawRegion(wxDC& dc, wxShapeRegion *region, double x, double y);
// Erase one region at this position
void EraseRegion(wxDC& dc, wxShapeRegion *region, float x, float y);
void EraseRegion(wxDC& dc, wxShapeRegion *region, double x, double y);
// Get the reference point for a label. Region x and y
// are offsets from this.
// position is 0 (middle), 1 (start), 2 (end)
void GetLabelPosition(int position, float *x, float *y);
void GetLabelPosition(int position, double *x, double *y);
// Straighten verticals and horizontals
virtual void Straighten(wxDC& dc);
@@ -158,15 +158,15 @@ class wxLineShape: public wxShape
inline wxList *GetLineControlPoints() { return m_lineControlPoints; }
// Override dragging behaviour - don't want to be able to drag lines!
void OnDragLeft(bool draw, float x, float y, int keys=0, int attachment = 0);
void OnBeginDragLeft(float x, float y, int keys=0, int attachment = 0);
void OnEndDragLeft(float x, float y, int keys=0, int attachment = 0);
void OnDragLeft(bool draw, double x, double y, int keys=0, int attachment = 0);
void OnBeginDragLeft(double x, double y, int keys=0, int attachment = 0);
void OnEndDragLeft(double x, double y, int keys=0, int attachment = 0);
// Control points ('handles') redirect control to the actual shape, to make it easier
// to override sizing behaviour.
virtual void OnSizingDragLeft(wxControlPoint* pt, bool draw, float x, float y, int keys=0, int attachment = 0);
virtual void OnSizingBeginDragLeft(wxControlPoint* pt, float x, float y, int keys=0, int attachment = 0);
virtual void OnSizingEndDragLeft(wxControlPoint* pt, float x, float y, int keys=0, int attachment = 0);
virtual void OnSizingDragLeft(wxControlPoint* pt, bool draw, double x, double y, int keys=0, int attachment = 0);
virtual void OnSizingBeginDragLeft(wxControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
virtual void OnSizingEndDragLeft(wxControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
// Override select, to create/delete temporary label-moving objects
void Select(bool select = TRUE, wxDC* dc = NULL);
@@ -177,8 +177,10 @@ class wxLineShape: public wxShape
void Unlink();
void SetAttachments(int from_attach, int to_attach);
inline void SetAttachmentFrom(int attach) { m_attachmentFrom = attach; }
inline void SetAttachmentTo(int attach) { m_attachmentTo = attach; }
bool HitTest(float x, float y, int *attachment, float *distance);
bool HitTest(double x, double y, int *attachment, double *distance);
#ifdef PROLOGIO
// Prolog database stuff
@@ -191,7 +193,7 @@ class wxLineShape: public wxShape
// Find which position we're talking about at this (x, y).
// Returns ARROW_POSITION_START, ARROW_POSITION_MIDDLE, ARROW_POSITION_END
int FindLinePosition(float x, float y);
int FindLinePosition(double x, double y);
// This is really to distinguish between lines and other images.
// For lines, want to pass drag to canvas, since lines tend to prevent
@@ -203,7 +205,7 @@ class wxLineShape: public wxShape
// Add an arrowhead.
wxArrowHead *AddArrow(WXTYPE type, int end = ARROW_POSITION_END,
float arrowSize = 10.0, float xOffset = 0.0, const wxString& name = "",
double arrowSize = 10.0, double xOffset = 0.0, const wxString& name = "",
wxPseudoMetaFile *mf = NULL, long arrowId = -1);
// Add an arrowhead in the position indicated by the reference
@@ -225,14 +227,14 @@ class wxLineShape: public wxShape
wxArrowHead *FindArrowHead(long arrowId);
bool DeleteArrowHead(int position, const wxString& name);
bool DeleteArrowHead(long arrowId);
void DrawArrow(wxDC& dc, wxArrowHead *arrow, float xOffset, bool proportionalOffset);
void DrawArrow(wxDC& dc, wxArrowHead *arrow, double xOffset, bool proportionalOffset);
inline void SetIgnoreOffsets(bool ignore) { m_ignoreArrowOffsets = ignore; }
inline wxList& GetArrows() const { return (wxList&) m_arcArrows; }
// Find horizontal width for drawing a line with
// arrows in minimum space. Assume arrows at
// END only
float FindMinimumWidth();
double FindMinimumWidth();
// Set alignment flags. ALIGNMENT NOT IMPLEMENTED.
void SetAlignmentOrientation(bool isEnd, bool isHoriz);
@@ -269,14 +271,14 @@ protected:
// probably be the same)
wxList* m_lineControlPoints;
float m_arrowSpacing; // Separation between adjacent arrows
double m_arrowSpacing; // Separation between adjacent arrows
wxShape* m_to;
wxShape* m_from;
/*
float m_actualTextWidth; // Space the text takes up
float m_actualTextHeight; // (depends on text content unlike nodes)
double m_actualTextWidth; // Space the text takes up
double m_actualTextHeight; // (depends on text content unlike nodes)
*/
int m_attachmentTo; // Attachment point at one end
int m_attachmentFrom; // Attachment point at other end
+21 -17
View File
@@ -23,18 +23,22 @@ class wxLineControlPoint: public wxControlPoint
friend class wxLineShape;
public:
wxLineControlPoint(wxShapeCanvas *the_canvas = NULL, wxShape *object = NULL, float size = 0.0,
float x = 0.0, float y = 0.0, int the_type = 0);
wxLineControlPoint(wxShapeCanvas *the_canvas = NULL, wxShape *object = NULL, double size = 0.0,
double x = 0.0, double y = 0.0, int the_type = 0);
~wxLineControlPoint();
void OnDraw(wxDC& dc);
void OnDragLeft(bool draw, float x, float y, int keys=0, int attachment = 0);
void OnBeginDragLeft(float x, float y, int keys=0, int attachment = 0);
void OnEndDragLeft(float x, float y, int keys=0, int attachment = 0);
void OnDragLeft(bool draw, double x, double y, int keys=0, int attachment = 0);
void OnBeginDragLeft(double x, double y, int keys=0, int attachment = 0);
void OnEndDragLeft(double x, double y, int keys=0, int attachment = 0);
void OnDragRight(bool draw, float x, float y, int keys=0, int attachment = 0);
void OnBeginDragRight(float x, float y, int keys=0, int attachment = 0);
void OnEndDragRight(float x, float y, int keys=0, int attachment = 0);
// Obsolete (left-dragging now moves attachment point to new relative position OR new
// attachment id)
#if 0
void OnDragRight(bool draw, double x, double y, int keys=0, int attachment = 0);
void OnBeginDragRight(double x, double y, int keys=0, int attachment = 0);
void OnEndDragRight(double x, double y, int keys=0, int attachment = 0);
#endif
public:
@@ -52,17 +56,17 @@ class wxLabelShape: public wxRectangleShape
DECLARE_DYNAMIC_CLASS(wxLabelShape)
public:
wxLabelShape(wxLineShape *parent = NULL, wxShapeRegion *region = NULL, float w = 0.0, float h = 0.0);
wxLabelShape(wxLineShape *parent = NULL, wxShapeRegion *region = NULL, double w = 0.0, double h = 0.0);
~wxLabelShape();
void OnDraw(wxDC& dc);
void OnDrawContents(wxDC& dc);
void OnLeftClick(float x, float y, int keys = 0, int attachment = 0);
void OnRightClick(float x, float y, int keys = 0, int attachment = 0);
void OnDragLeft(bool draw, float x, float y, int keys=0, int attachment = 0);
void OnBeginDragLeft(float x, float y, int keys=0, int attachment = 0);
void OnEndDragLeft(float x, float y, int keys=0, int attachment = 0);
bool OnMovePre(wxDC& dc, float x, float y, float old_x, float old_y, bool display = TRUE);
void OnLeftClick(double x, double y, int keys = 0, int attachment = 0);
void OnRightClick(double x, double y, int keys = 0, int attachment = 0);
void OnDragLeft(bool draw, double x, double y, int keys=0, int attachment = 0);
void OnBeginDragLeft(double x, double y, int keys=0, int attachment = 0);
void OnEndDragLeft(double x, double y, int keys=0, int attachment = 0);
bool OnMovePre(wxDC& dc, double x, double y, double old_x, double old_y, bool display = TRUE);
public:
wxLineShape* m_lineShape;
@@ -76,8 +80,8 @@ public:
* returned values in x and y
*/
void GetPointOnLine(float x1, float y1, float x2, float y2,
float length, float *x, float *y);
void GetPointOnLine(double x1, double y1, double x2, double y2,
double length, double *x, double *y);
#endif
// _OGL_LINESP_H_
+16 -16
View File
@@ -179,17 +179,17 @@ bool wxXMetaFile::ReadFile(char *file)
iRight = getsignedshort(handle);
iBottom = getsignedshort(handle);
left = (float)iLeft;
top = (float)iTop;
right = (float)iRight;
bottom = (float)iBottom;
left = (double)iLeft;
top = (double)iTop;
right = (double)iRight;
bottom = (double)iBottom;
int inch = getshort(handle);
long reserved = getint(handle);
int checksum = getshort(handle);
/*
float widthInUnits = (float)right - left;
float heightInUnits = (float)bottom - top;
double widthInUnits = (double)right - left;
double heightInUnits = (double)bottom - top;
*width = (int)((widthInUnits*1440.0)/inch);
*height = (int)((heightInUnits*1440.0)/inch);
*/
@@ -792,13 +792,13 @@ bool wxXMetaFile::Play(wxDC *dc)
{
long x1 = rec->param1;
long y1 = rec->param2;
dc->DrawLine(lastX, lastY, (float)x1, (float)y1);
dc->DrawLine(lastX, lastY, (double)x1, (double)y1);
break;
}
case META_MOVETO:
{
lastX = (float)rec->param1;
lastY = (float)rec->param2;
lastX = (double)rec->param1;
lastY = (double)rec->param2;
break;
}
case META_EXCLUDECLIPRECT:
@@ -818,17 +818,17 @@ bool wxXMetaFile::Play(wxDC *dc)
// case META_PIE: // DO!!!
case META_RECTANGLE:
{
dc->DrawRectangle((float)rec->param1, (float)rec->param2,
(float)rec->param3 - rec->param1,
(float)rec->param4 - rec->param2);
dc->DrawRectangle((double)rec->param1, (double)rec->param2,
(double)rec->param3 - rec->param1,
(double)rec->param4 - rec->param2);
break;
}
case META_ROUNDRECT:
{
dc->DrawRoundedRectangle((float)rec->param1, (float)rec->param2,
(float)rec->param3 - rec->param1,
(float)rec->param4 - rec->param2,
(float)rec->param5);
dc->DrawRoundedRectangle((double)rec->param1, (double)rec->param2,
(double)rec->param3 - rec->param1,
(double)rec->param4 - rec->param2,
(double)rec->param5);
break;
}
// case META_PATBLT:
+7 -7
View File
@@ -183,15 +183,15 @@ class wxMetaRecord: public wxObject
class wxXMetaFile: public wxObject
{
public:
float lastX;
float lastY;
double lastX;
double lastY;
bool ok;
float left;
float top;
float right;
float bottom;
double left;
double top;
double right;
double bottom;
wxList metaRecords;
wxList gdiObjects; // List of wxMetaRecord objects created with Create...,
// referenced by position in list by SelectObject
+179 -175
View File
File diff suppressed because it is too large Load Diff
+45 -45
View File
@@ -18,7 +18,7 @@
// List to use when copying objects; may need to associate elements of new objects
// with elements of old objects, e.g. when copying constraint.s
extern wxList wxObjectCopyMapping;
extern wxList oglObjectCopyMapping;
/*
* TEXT FORMATTING FUNCTIONS
@@ -27,55 +27,55 @@ extern wxList wxObjectCopyMapping;
// Centres the given list of wxShapeTextLine strings in the given box
// (changing the positions in situ). Doesn't actually draw into the DC.
void CentreText(wxDC& dc, wxList *text, float m_xpos, float m_ypos,
float width, float height,
void oglCentreText(wxDC& dc, wxList *text, double m_xpos, double m_ypos,
double width, double height,
int formatMode = FORMAT_CENTRE_HORIZ | FORMAT_CENTRE_VERT);
// Given a string, returns a list of strings that fit within the given
// width of box. Height is ignored.
wxList *FormatText(wxDC& dc, const wxString& text, float width, float height, int formatMode = 0);
wxStringList *oglFormatText(wxDC& dc, const wxString& text, double width, double height, int formatMode = 0);
// Centres the list of wxShapeTextLine strings, doesn't clip.
// Doesn't actually draw into the DC.
void CentreTextNoClipping(wxDC& dc, wxList *text_list,
float m_xpos, float m_ypos, float width, float height);
void oglCentreTextNoClipping(wxDC& dc, wxList *text_list,
double m_xpos, double m_ypos, double width, double height);
// Gets the maximum width and height of the given list of wxShapeTextLines.
void GetCentredTextExtent(wxDC& dc, wxList *text_list,
float m_xpos, float m_ypos, float width, float height,
float *actual_width, float *actual_height);
void oglGetCentredTextExtent(wxDC& dc, wxList *text_list,
double m_xpos, double m_ypos, double width, double height,
double *actual_width, double *actual_height);
// Actually draw the preformatted list of wxShapeTextLines.
void DrawFormattedText(wxDC& context, wxList *text_list,
float m_xpos, float m_ypos, float width, float height,
void oglDrawFormattedText(wxDC& context, wxList *text_list,
double m_xpos, double m_ypos, double width, double height,
int formatMode = FORMAT_CENTRE_HORIZ | FORMAT_CENTRE_VERT);
// Give it a list of points, finds the centre.
void find_polyline_centroid(wxList *points, float *x, float *y);
void oglFindPolylineCentroid(wxList *points, double *x, double *y);
void check_line_intersection(float x1, float y1, float x2, float y2,
float x3, float y3, float x4, float y4,
float *ratio1, float *ratio2);
void oglCheckLineIntersection(double x1, double y1, double x2, double y2,
double x3, double y3, double x4, double y4,
double *ratio1, double *ratio2);
void find_end_for_polyline(float n, float xvec[], float yvec[],
float x1, float y1, float x2, float y2, float *x3, float *y3);
void oglFindEndForPolyline(double n, double xvec[], double yvec[],
double x1, double y1, double x2, double y2, double *x3, double *y3);
void find_end_for_box(float width, float height,
float x1, float y1, // Centre of box (possibly)
float x2, float y2, // other end of line
float *x3, float *y3); // End on box edge
void oglFindEndForBox(double width, double height,
double x1, double y1, // Centre of box (possibly)
double x2, double y2, // other end of line
double *x3, double *y3); // End on box edge
void find_end_for_circle(float radius,
float x1, float y1, // Centre of circle
float x2, float y2, // Other end of line
float *x3, float *y3);
void oglFindEndForCircle(double radius,
double x1, double y1, // Centre of circle
double x2, double y2, // Other end of line
double *x3, double *y3);
void get_arrow_points(float x1, float y1, float x2, float y2,
float length, float width,
float *tip_x, float *tip_y,
float *side1_x, float *side1_y,
float *side2_x, float *side2_y);
void oglGetArrowPoints(double x1, double y1, double x2, double y2,
double length, double width,
double *tip_x, double *tip_y,
double *side1_x, double *side1_y,
double *side2_x, double *side2_y);
/*
* Given an ellipse and endpoints of a line, returns the point at which
@@ -88,25 +88,25 @@ void get_arrow_points(float x1, float y1, float x2, float y2,
* Author: Ian Harrison
*/
void draw_arc_to_ellipse(float x1, float y1, float a1, float b1, float x2, float y2, float x3, float y3,
float *x4, float *y4);
void oglDrawArcToEllipse(double x1, double y1, double a1, double b1, double x2, double y2, double x3, double y3,
double *x4, double *y4);
extern wxFont *g_oglNormalFont;
extern wxPen *black_pen;
bool oglRoughlyEqual(double val1, double val2, double tol = 0.00001);
extern wxPen *white_background_pen;
extern wxPen *transparent_pen;
extern wxBrush *white_background_brush;
extern wxPen *black_foreground_pen;
extern wxFont* g_oglNormalFont;
extern wxPen* g_oglBlackPen;
extern wxPen* g_oglWhiteBackgroundPen;
extern wxPen* g_oglTransparentPen;
extern wxBrush* g_oglWhiteBackgroundBrush;
extern wxPen* g_oglBlackForegroundPen;
extern wxCursor* g_oglBullseyeCursor;
extern wxCursor *GraphicsBullseyeCursor;
extern wxFont* oglMatchFont(int point_size);
extern wxFont *MatchFont(int point_size);
extern wxString oglColourToHex(const wxColour& colour);
extern wxColour oglHexToColour(const wxString& hex);
extern void oglDecToHex(unsigned int dec, char *buf);
extern unsigned int oglHexToDec(char* buf);
extern wxString oglColourToHex(const wxColour& colour);
extern wxColour oglHexToColour(const wxString& hex);
extern void oglDecToHex(unsigned int dec, char *buf);
extern unsigned int oglHexToDec(char* buf);
#endif
+3 -3
View File
@@ -71,12 +71,12 @@ void wxDiagram::SetSnapToGrid(bool snap)
m_snapToGrid = snap;
}
void wxDiagram::SetGridSpacing(float spacing)
void wxDiagram::SetGridSpacing(double spacing)
{
m_gridSpacing = spacing;
}
void wxDiagram::Snap(float *x, float *y)
void wxDiagram::Snap(double *x, double *y)
{
if (m_snapToGrid)
{
@@ -181,7 +181,7 @@ void wxDiagram::ShowAll(bool show)
}
}
void wxDiagram::DrawOutline(wxDC& dc, float x1, float y1, float x2, float y2)
void wxDiagram::DrawOutline(wxDC& dc, double x1, double y1, double x2, double y2)
{
wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT);
dc.SetPen(dottedPen);
+5 -5
View File
@@ -33,7 +33,7 @@ public:
virtual void Redraw(wxDC& dc);
virtual void Clear(wxDC& dc);
virtual void DrawOutline(wxDC& dc, float x1, float y1, float x2, float y2);
virtual void DrawOutline(wxDC& dc, double x1, double y1, double x2, double y2);
// Add object to end of object list (if addAfter is NULL)
// or just after addAfter.
@@ -43,10 +43,10 @@ public:
virtual void InsertShape(wxShape *object);
void SetSnapToGrid(bool snap);
void SetGridSpacing(float spacing);
inline float GetGridSpacing() { return m_gridSpacing; }
void SetGridSpacing(double spacing);
inline double GetGridSpacing() { return m_gridSpacing; }
inline bool GetSnapToGrid() const { return m_snapToGrid; }
void Snap(float *x, float *y);
void Snap(double *x, double *y);
inline void SetQuickEditMode(bool qem) { m_quickEditMode = qem; }
inline bool GetQuickEditMode() const { return m_quickEditMode; }
@@ -85,7 +85,7 @@ protected:
wxShapeCanvas* m_diagramCanvas;
bool m_quickEditMode;
bool m_snapToGrid;
float m_gridSpacing;
double m_gridSpacing;
int m_mouseTolerance;
wxList* m_shapeList;
};