OGL improvements
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@616 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -84,7 +84,7 @@ istream& DiagramDocument::LoadObject(istream& stream)
|
|||||||
* Implementation of drawing command
|
* 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):
|
bool sel, wxShape *theShape, wxShape *fs, wxShape *ts):
|
||||||
wxCommand(TRUE, name)
|
wxCommand(TRUE, name)
|
||||||
{
|
{
|
||||||
@@ -394,7 +394,7 @@ void DiagramCommand::RemoveLines(wxShape *shape)
|
|||||||
* MyEvtHandler: an event handler class for all shapes
|
* 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());
|
wxClientDC dc(GetShape()->GetCanvas());
|
||||||
GetShape()->GetCanvas()->PrepareDC(dc);
|
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.
|
* 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
|
// 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.
|
// 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);
|
wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT);
|
||||||
dc.SetLogicalFunction(wxXOR);
|
dc.SetLogicalFunction(wxXOR);
|
||||||
dc.SetPen(dottedPen);
|
dc.SetPen(dottedPen);
|
||||||
float xp, yp;
|
double xp, yp;
|
||||||
GetShape()->GetAttachmentPosition(attachment, &xp, &yp);
|
GetShape()->GetAttachmentPosition(attachment, &xp, &yp);
|
||||||
dc.DrawLine(xp, yp, x, y);
|
dc.DrawLine(xp, yp, x, y);
|
||||||
GetShape()->GetCanvas()->CaptureMouse();
|
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
|
// Force attachment to be zero for now
|
||||||
attachment = 0;
|
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);
|
wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT);
|
||||||
dc.SetLogicalFunction(wxXOR);
|
dc.SetLogicalFunction(wxXOR);
|
||||||
dc.SetPen(dottedPen);
|
dc.SetPen(dottedPen);
|
||||||
float xp, yp;
|
double xp, yp;
|
||||||
GetShape()->GetAttachmentPosition(attachment, &xp, &yp);
|
GetShape()->GetAttachmentPosition(attachment, &xp, &yp);
|
||||||
dc.DrawLine(xp, yp, x, y);
|
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();
|
GetShape()->GetCanvas()->ReleaseMouse();
|
||||||
MyCanvas *canvas = (MyCanvas *)GetShape()->GetCanvas();
|
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());
|
wxClientDC dc(GetShape()->GetCanvas());
|
||||||
GetShape()->GetCanvas()->PrepareDC(dc);
|
GetShape()->GetCanvas()->PrepareDC(dc);
|
||||||
@@ -534,16 +534,16 @@ bool MyDiagram::OnShapeLoad(wxExprDatabase& db, wxShape& shape, wxExpr& expr)
|
|||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxRoundedRectangleShape, wxRectangleShape)
|
IMPLEMENT_DYNAMIC_CLASS(wxRoundedRectangleShape, wxRectangleShape)
|
||||||
|
|
||||||
wxRoundedRectangleShape::wxRoundedRectangleShape(float w, float h):
|
wxRoundedRectangleShape::wxRoundedRectangleShape(double w, double h):
|
||||||
wxRectangleShape(w, h)
|
wxRectangleShape(w, h)
|
||||||
{
|
{
|
||||||
// 0.3 of the smaller rectangle dimension
|
// 0.3 of the smaller rectangle dimension
|
||||||
SetCornerRadius((float) -0.3);
|
SetCornerRadius((double) -0.3);
|
||||||
}
|
}
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxDiamondShape, wxPolygonShape)
|
IMPLEMENT_DYNAMIC_CLASS(wxDiamondShape, wxPolygonShape)
|
||||||
|
|
||||||
wxDiamondShape::wxDiamondShape(float w, float h):
|
wxDiamondShape::wxDiamondShape(double w, double h):
|
||||||
wxPolygonShape()
|
wxPolygonShape()
|
||||||
{
|
{
|
||||||
// wxPolygonShape::SetSize relies on the shape having non-zero
|
// wxPolygonShape::SetSize relies on the shape having non-zero
|
||||||
|
@@ -44,7 +44,7 @@ class wxRoundedRectangleShape: public wxRectangleShape
|
|||||||
DECLARE_DYNAMIC_CLASS(wxRoundedRectangleShape)
|
DECLARE_DYNAMIC_CLASS(wxRoundedRectangleShape)
|
||||||
private:
|
private:
|
||||||
public:
|
public:
|
||||||
wxRoundedRectangleShape(float w = 0.0, float h = 0.0);
|
wxRoundedRectangleShape(double w = 0.0, double h = 0.0);
|
||||||
};
|
};
|
||||||
|
|
||||||
class wxDiamondShape: public wxPolygonShape
|
class wxDiamondShape: public wxPolygonShape
|
||||||
@@ -52,7 +52,7 @@ class wxDiamondShape: public wxPolygonShape
|
|||||||
DECLARE_DYNAMIC_CLASS(wxDiamondShape)
|
DECLARE_DYNAMIC_CLASS(wxDiamondShape)
|
||||||
private:
|
private:
|
||||||
public:
|
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)
|
~MyEvtHandler(void)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
void OnLeftClick(float x, float y, int keys = 0, int attachment = 0);
|
void OnLeftClick(double x, double y, int keys = 0, int attachment = 0);
|
||||||
void OnBeginDragRight(float x, float y, int keys = 0, int attachment = 0);
|
void OnBeginDragRight(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 OnDragRight(bool draw, double x, double y, int keys = 0, int attachment = 0);
|
||||||
void OnEndDragRight(float x, float y, int keys = 0, int attachment = 0);
|
void OnEndDragRight(double x, double y, int keys = 0, int attachment = 0);
|
||||||
void OnEndSize(float x, float y);
|
void OnEndSize(double x, double y);
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -135,8 +135,8 @@ class DiagramCommand: public wxCommand
|
|||||||
wxShape *fromShape;
|
wxShape *fromShape;
|
||||||
wxShape *toShape;
|
wxShape *toShape;
|
||||||
wxClassInfo *shapeInfo;
|
wxClassInfo *shapeInfo;
|
||||||
float x;
|
double x;
|
||||||
float y;
|
double y;
|
||||||
bool selected;
|
bool selected;
|
||||||
bool deleteShape;
|
bool deleteShape;
|
||||||
|
|
||||||
@@ -147,7 +147,7 @@ class DiagramCommand: public wxCommand
|
|||||||
public:
|
public:
|
||||||
// Multi-purpose constructor for creating, deleting shapes
|
// Multi-purpose constructor for creating, deleting shapes
|
||||||
DiagramCommand(char *name, int cmd, DiagramDocument *ddoc, wxClassInfo *shapeInfo = NULL,
|
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
|
// Property-changing command constructors
|
||||||
DiagramCommand(char *name, int cmd, DiagramDocument *ddoc, wxBrush *backgroundColour, wxShape *theShape);
|
DiagramCommand(char *name, int cmd, DiagramDocument *ddoc, wxBrush *backgroundColour, wxShape *theShape);
|
||||||
|
@@ -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;
|
EditorToolPalette *palette = wxGetApp().frame->palette;
|
||||||
wxClassInfo *info = NULL;
|
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)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -34,16 +34,16 @@ class MyCanvas: public wxShapeCanvas
|
|||||||
void OnMouseEvent(wxMouseEvent& event);
|
void OnMouseEvent(wxMouseEvent& event);
|
||||||
void OnPaint(wxPaintEvent& event);
|
void OnPaint(wxPaintEvent& event);
|
||||||
|
|
||||||
virtual void OnLeftClick(float x, float y, int keys = 0);
|
virtual void OnLeftClick(double x, double y, int keys = 0);
|
||||||
virtual void OnRightClick(float x, float 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 OnDragLeft(bool draw, double x, double y, int keys=0); // Erase if draw false
|
||||||
virtual void OnBeginDragLeft(float x, float y, int keys=0);
|
virtual void OnBeginDragLeft(double x, double y, int keys=0);
|
||||||
virtual void OnEndDragLeft(float x, float 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 OnDragRight(bool draw, double x, double y, int keys=0); // Erase if draw false
|
||||||
virtual void OnBeginDragRight(float x, float y, int keys=0);
|
virtual void OnBeginDragRight(double x, double y, int keys=0);
|
||||||
virtual void OnEndDragRight(float x, float y, int keys=0);
|
virtual void OnEndDragRight(double x, double y, int keys=0);
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -106,6 +106,9 @@ class WXDLLEXPORT wxExpr;
|
|||||||
class WXDLLEXPORT wxExprDatabase;
|
class WXDLLEXPORT wxExprDatabase;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Round up
|
||||||
|
#define WXROUND(x) ( (long) (x + 0.5) )
|
||||||
|
|
||||||
class wxShapeEvtHandler: public wxObject
|
class wxShapeEvtHandler: public wxObject
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxShapeEvtHandler)
|
DECLARE_DYNAMIC_CLASS(wxShapeEvtHandler)
|
||||||
@@ -128,31 +131,34 @@ class wxShapeEvtHandler: public wxObject
|
|||||||
virtual void OnErase(wxDC& dc);
|
virtual void OnErase(wxDC& dc);
|
||||||
virtual void OnEraseContents(wxDC& dc);
|
virtual void OnEraseContents(wxDC& dc);
|
||||||
virtual void OnHighlight(wxDC& dc);
|
virtual void OnHighlight(wxDC& dc);
|
||||||
virtual void OnLeftClick(float x, float y, int keys = 0, int attachment = 0);
|
virtual void OnLeftClick(double x, double y, int keys = 0, int attachment = 0);
|
||||||
virtual void OnRightClick(float x, float y, int keys = 0, int attachment = 0);
|
virtual void OnRightClick(double x, double y, int keys = 0, int attachment = 0);
|
||||||
virtual void OnSize(float x, float y);
|
virtual void OnSize(double x, double y);
|
||||||
virtual bool OnMovePre(wxDC& dc, float x, float y, float old_x, float old_y, bool display = TRUE);
|
virtual bool OnMovePre(wxDC& dc, double x, double y, double old_x, double 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 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 OnDragLeft(bool draw, double x, double 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 OnBeginDragLeft(double x, double y, int keys=0, int attachment = 0);
|
||||||
virtual void OnEndDragLeft(float x, float 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, float x, float y, int keys=0, int attachment = 0); // Erase if draw false
|
virtual void OnDragRight(bool draw, double x, double 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 OnBeginDragRight(double x, double y, int keys=0, int attachment = 0);
|
||||||
virtual void OnEndDragRight(float x, float 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, float x, float y, float w, float h);
|
virtual void OnDrawOutline(wxDC& dc, double x, double y, double w, double h);
|
||||||
virtual void OnDrawControlPoints(wxDC& dc);
|
virtual void OnDrawControlPoints(wxDC& dc);
|
||||||
virtual void OnEraseControlPoints(wxDC& dc);
|
virtual void OnEraseControlPoints(wxDC& dc);
|
||||||
virtual void OnMoveLink(wxDC& dc, bool moveControlPoints = TRUE);
|
virtual void OnMoveLink(wxDC& dc, bool moveControlPoints = TRUE);
|
||||||
|
|
||||||
// Control points ('handles') redirect control to the actual shape, to make it easier
|
// Control points ('handles') redirect control to the actual shape, to make it easier
|
||||||
// to override sizing behaviour.
|
// 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 OnSizingDragLeft(wxControlPoint* pt, bool draw, double x, double 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 OnSizingBeginDragLeft(wxControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
|
||||||
virtual void OnSizingEndDragLeft(wxControlPoint* pt, float x, float 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 OnBeginSize(double WXUNUSED(w), double WXUNUSED(h)) { }
|
||||||
virtual void OnEndSize(float WXUNUSED(w), float 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.
|
// Creates a copy of this event handler.
|
||||||
wxShapeEvtHandler *CreateNewCopy();
|
wxShapeEvtHandler *CreateNewCopy();
|
||||||
@@ -174,21 +180,21 @@ class wxShape: public wxShapeEvtHandler
|
|||||||
|
|
||||||
wxShape(wxShapeCanvas *can = NULL);
|
wxShape(wxShapeCanvas *can = NULL);
|
||||||
virtual ~wxShape();
|
virtual ~wxShape();
|
||||||
virtual void GetBoundingBoxMax(float *width, float *height);
|
virtual void GetBoundingBoxMax(double *width, double *height);
|
||||||
virtual void GetBoundingBoxMin(float *width, float *height) = 0;
|
virtual void GetBoundingBoxMin(double *width, double *height) = 0;
|
||||||
virtual bool GetPerimeterPoint(float x1, float y1,
|
virtual bool GetPerimeterPoint(double x1, double y1,
|
||||||
float x2, float y2,
|
double x2, double y2,
|
||||||
float *x3, float *y3);
|
double *x3, double *y3);
|
||||||
inline wxShapeCanvas *GetCanvas() { return m_canvas; }
|
inline wxShapeCanvas *GetCanvas() { return m_canvas; }
|
||||||
void SetCanvas(wxShapeCanvas *the_canvas);
|
void SetCanvas(wxShapeCanvas *the_canvas);
|
||||||
virtual void AddToCanvas(wxShapeCanvas *the_canvas, wxShape *addAfter = NULL);
|
virtual void AddToCanvas(wxShapeCanvas *the_canvas, wxShape *addAfter = NULL);
|
||||||
virtual void InsertInCanvas(wxShapeCanvas *the_canvas);
|
virtual void InsertInCanvas(wxShapeCanvas *the_canvas);
|
||||||
|
|
||||||
virtual void RemoveFromCanvas(wxShapeCanvas *the_canvas);
|
virtual void RemoveFromCanvas(wxShapeCanvas *the_canvas);
|
||||||
inline float GetX() const { return m_xpos; }
|
inline double GetX() const { return m_xpos; }
|
||||||
inline float GetY() const { return m_ypos; }
|
inline double GetY() const { return m_ypos; }
|
||||||
inline void SetX(float x) { m_xpos = x; }
|
inline void SetX(double x) { m_xpos = x; }
|
||||||
inline void SetY(float y) { m_ypos = y; }
|
inline void SetY(double y) { m_ypos = y; }
|
||||||
|
|
||||||
inline wxShape *GetParent() const { return m_parent; }
|
inline wxShape *GetParent() const { return m_parent; }
|
||||||
inline void SetParent(wxShape *p) { m_parent = p; }
|
inline void SetParent(wxShape *p) { m_parent = p; }
|
||||||
@@ -204,30 +210,30 @@ class wxShape: public wxShapeEvtHandler
|
|||||||
virtual void OnErase(wxDC& dc);
|
virtual void OnErase(wxDC& dc);
|
||||||
virtual void OnEraseContents(wxDC& dc);
|
virtual void OnEraseContents(wxDC& dc);
|
||||||
virtual void OnHighlight(wxDC& dc);
|
virtual void OnHighlight(wxDC& dc);
|
||||||
virtual void OnLeftClick(float x, float y, int keys = 0, int attachment = 0);
|
virtual void OnLeftClick(double x, double y, int keys = 0, int attachment = 0);
|
||||||
virtual void OnRightClick(float x, float y, int keys = 0, int attachment = 0);
|
virtual void OnRightClick(double x, double y, int keys = 0, int attachment = 0);
|
||||||
virtual void OnSize(float x, float y);
|
virtual void OnSize(double x, double y);
|
||||||
virtual bool OnMovePre(wxDC& dc, float x, float y, float old_x, float old_y, bool display = TRUE);
|
virtual bool OnMovePre(wxDC& dc, double x, double y, double old_x, double 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 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 OnDragLeft(bool draw, double x, double 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 OnBeginDragLeft(double x, double y, int keys=0, int attachment = 0);
|
||||||
virtual void OnEndDragLeft(float x, float 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, float x, float y, int keys=0, int attachment = 0); // Erase if draw false
|
virtual void OnDragRight(bool draw, double x, double 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 OnBeginDragRight(double x, double y, int keys=0, int attachment = 0);
|
||||||
virtual void OnEndDragRight(float x, float 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, float x, float y, float w, float h);
|
virtual void OnDrawOutline(wxDC& dc, double x, double y, double w, double h);
|
||||||
virtual void OnDrawControlPoints(wxDC& dc);
|
virtual void OnDrawControlPoints(wxDC& dc);
|
||||||
virtual void OnEraseControlPoints(wxDC& dc);
|
virtual void OnEraseControlPoints(wxDC& dc);
|
||||||
|
|
||||||
virtual void OnBeginSize(float WXUNUSED(w), float WXUNUSED(h)) { }
|
virtual void OnBeginSize(double WXUNUSED(w), double WXUNUSED(h)) { }
|
||||||
virtual void OnEndSize(float WXUNUSED(w), float WXUNUSED(h)) { }
|
virtual void OnEndSize(double WXUNUSED(w), double WXUNUSED(h)) { }
|
||||||
|
|
||||||
// Control points ('handles') redirect control to the actual shape, to make it easier
|
// Control points ('handles') redirect control to the actual shape, to make it easier
|
||||||
// to override sizing behaviour.
|
// 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 OnSizingDragLeft(wxControlPoint* pt, bool draw, double x, double 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 OnSizingBeginDragLeft(wxControlPoint* pt, double x, double y, int keys=0, int attachment = 0);
|
||||||
virtual void OnSizingEndDragLeft(wxControlPoint* pt, float x, float 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 MakeControlPoints();
|
||||||
virtual void DeleteControlPoints(wxDC *dc = NULL);
|
virtual void DeleteControlPoints(wxDC *dc = NULL);
|
||||||
@@ -260,7 +266,7 @@ class wxShape: public wxShapeEvtHandler
|
|||||||
inline bool GetSpaceAttachments() const { return m_spaceAttachments; };
|
inline bool GetSpaceAttachments() const { return m_spaceAttachments; };
|
||||||
void SetShadowMode(int mode, bool redraw = FALSE);
|
void SetShadowMode(int mode, bool redraw = FALSE);
|
||||||
inline int GetShadowMode() const { return m_shadowMode; }
|
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 void SetCentreResize(bool cr) { m_centreResize = cr; }
|
||||||
inline bool GetCentreResize() const { return m_centreResize; }
|
inline bool GetCentreResize() const { return m_centreResize; }
|
||||||
inline wxList& GetLines() { return m_lines; }
|
inline wxList& GetLines() { return m_lines; }
|
||||||
@@ -278,22 +284,28 @@ class wxShape: public wxShapeEvtHandler
|
|||||||
|
|
||||||
virtual void Show(bool show);
|
virtual void Show(bool show);
|
||||||
virtual bool IsShown() const { return m_visible; }
|
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 Erase(wxDC& dc);
|
||||||
virtual void EraseContents(wxDC& dc);
|
virtual void EraseContents(wxDC& dc);
|
||||||
virtual void Draw(wxDC& dc);
|
virtual void Draw(wxDC& dc);
|
||||||
virtual void Flash();
|
virtual void Flash();
|
||||||
virtual void MoveLinks(wxDC& dc);
|
virtual void MoveLinks(wxDC& dc);
|
||||||
virtual void DrawContents(wxDC& dc); // E.g. for drawing text label
|
virtual void DrawContents(wxDC& dc); // E.g. for drawing text label
|
||||||
virtual void SetSize(float x, float y, bool recursive = TRUE);
|
virtual void SetSize(double x, double y, bool recursive = TRUE);
|
||||||
virtual void SetAttachmentSize(float x, float y);
|
virtual void SetAttachmentSize(double x, double y);
|
||||||
void Attach(wxShapeCanvas *can);
|
void Attach(wxShapeCanvas *can);
|
||||||
void Detach();
|
void Detach();
|
||||||
|
|
||||||
inline virtual bool Constrain() { return FALSE; } ;
|
inline virtual bool Constrain() { return FALSE; } ;
|
||||||
|
|
||||||
void AddLine(wxLineShape *line, wxShape *other,
|
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);
|
void AddText(const wxString& string);
|
||||||
|
|
||||||
inline wxPen *GetPen() const { return m_pen; }
|
inline wxPen *GetPen() const { return m_pen; }
|
||||||
@@ -364,21 +376,37 @@ class wxShape: public wxShapeEvtHandler
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Attachment code
|
// 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);
|
int nth = 0, int no_arcs = 1, wxLineShape *line = NULL);
|
||||||
virtual int GetNumberOfAttachments();
|
virtual int GetNumberOfAttachments();
|
||||||
virtual bool AttachmentIsValid(int attachment);
|
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 EraseLinks(wxDC& dc, int attachment = -1, bool recurse = FALSE);
|
||||||
virtual void DrawLinks(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,
|
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
|
// Reorders the lines coming into the node image at this attachment
|
||||||
// position, in the order in which they appear in linesToSort.
|
// position, in the order in which they appear in linesToSort.
|
||||||
virtual void SortLines(int attachment, wxList& 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.
|
// This is really to distinguish between lines and other images.
|
||||||
// For lines, want to pass drag to canvas, since lines tend to prevent
|
// For lines, want to pass drag to canvas, since lines tend to prevent
|
||||||
// dragging on a canvas (they get in the way.)
|
// dragging on a canvas (they get in the way.)
|
||||||
@@ -401,8 +429,8 @@ class wxShape: public wxShapeEvtHandler
|
|||||||
// (does nothing for most objects)
|
// (does nothing for most objects)
|
||||||
// But even non-rotating objects should record their notional
|
// But even non-rotating objects should record their notional
|
||||||
// rotation in case it's important (e.g. in dog-leg code).
|
// 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 void Rotate(double WXUNUSED(x), double WXUNUSED(y), double theta) { m_rotation = theta; }
|
||||||
virtual inline float GetRotation() const { return m_rotation; }
|
virtual inline double GetRotation() const { return m_rotation; }
|
||||||
|
|
||||||
void ClearAttachments();
|
void ClearAttachments();
|
||||||
|
|
||||||
@@ -418,7 +446,7 @@ class wxShape: public wxShapeEvtHandler
|
|||||||
protected:
|
protected:
|
||||||
wxShapeEvtHandler* m_eventHandler;
|
wxShapeEvtHandler* m_eventHandler;
|
||||||
bool m_formatted;
|
bool m_formatted;
|
||||||
float m_xpos, m_ypos;
|
double m_xpos, m_ypos;
|
||||||
wxPen* m_pen;
|
wxPen* m_pen;
|
||||||
wxBrush* m_brush;
|
wxBrush* m_brush;
|
||||||
wxFont* m_font;
|
wxFont* m_font;
|
||||||
@@ -436,7 +464,7 @@ class wxShape: public wxShapeEvtHandler
|
|||||||
bool m_selected;
|
bool m_selected;
|
||||||
bool m_highlighted; // Different from selected: user-defined highlighting,
|
bool m_highlighted; // Different from selected: user-defined highlighting,
|
||||||
// e.g. thick border.
|
// e.g. thick border.
|
||||||
float m_rotation;
|
double m_rotation;
|
||||||
int m_sensitivity;
|
int m_sensitivity;
|
||||||
bool m_draggable;
|
bool m_draggable;
|
||||||
bool m_attachmentMode; // TRUE if using attachments, FALSE otherwise
|
bool m_attachmentMode; // TRUE if using attachments, FALSE otherwise
|
||||||
@@ -469,21 +497,21 @@ class wxPolygonShape: public wxShape
|
|||||||
virtual void Create(wxList *points);
|
virtual void Create(wxList *points);
|
||||||
virtual void ClearPoints();
|
virtual void ClearPoints();
|
||||||
|
|
||||||
void GetBoundingBoxMin(float *w, float *h);
|
void GetBoundingBoxMin(double *w, double *h);
|
||||||
void CalculateBoundingBox();
|
void CalculateBoundingBox();
|
||||||
bool GetPerimeterPoint(float x1, float y1,
|
bool GetPerimeterPoint(double x1, double y1,
|
||||||
float x2, float y2,
|
double x2, double y2,
|
||||||
float *x3, float *y3);
|
double *x3, double *y3);
|
||||||
bool HitTest(float x, float y, int *attachment, float *distance);
|
bool HitTest(double x, double y, int *attachment, double *distance);
|
||||||
void SetSize(float x, float y, bool recursive = TRUE);
|
void SetSize(double x, double y, bool recursive = TRUE);
|
||||||
void OnDraw(wxDC& dc);
|
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
|
// Control points ('handles') redirect control to the actual shape, to make it easier
|
||||||
// to override sizing behaviour.
|
// to override sizing behaviour.
|
||||||
virtual void OnSizingDragLeft(wxControlPoint* pt, bool draw, 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, float x, float 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, float x, float 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,
|
// A polygon should have a control point at each vertex,
|
||||||
// with the option of moving the control points individually
|
// with the option of moving the control points individually
|
||||||
@@ -511,7 +539,7 @@ class wxPolygonShape: public wxShape
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
int GetNumberOfAttachments();
|
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);
|
int nth = 0, int no_arcs = 1, wxLineShape *line = NULL);
|
||||||
bool AttachmentIsValid(int attachment);
|
bool AttachmentIsValid(int attachment);
|
||||||
// Does the copying for this object
|
// Does the copying for this object
|
||||||
@@ -522,24 +550,24 @@ class wxPolygonShape: public wxShape
|
|||||||
private:
|
private:
|
||||||
wxList* m_points;
|
wxList* m_points;
|
||||||
wxList* m_originalPoints;
|
wxList* m_originalPoints;
|
||||||
float m_boundWidth;
|
double m_boundWidth;
|
||||||
float m_boundHeight;
|
double m_boundHeight;
|
||||||
float m_originalWidth;
|
double m_originalWidth;
|
||||||
float m_originalHeight;
|
double m_originalHeight;
|
||||||
};
|
};
|
||||||
|
|
||||||
class wxRectangleShape: public wxShape
|
class wxRectangleShape: public wxShape
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxRectangleShape)
|
DECLARE_DYNAMIC_CLASS(wxRectangleShape)
|
||||||
public:
|
public:
|
||||||
wxRectangleShape(float w = 0.0, float h = 0.0);
|
wxRectangleShape(double w = 0.0, double h = 0.0);
|
||||||
void GetBoundingBoxMin(float *w, float *h);
|
void GetBoundingBoxMin(double *w, double *h);
|
||||||
bool GetPerimeterPoint(float x1, float y1,
|
bool GetPerimeterPoint(double x1, double y1,
|
||||||
float x2, float y2,
|
double x2, double y2,
|
||||||
float *x3, float *y3);
|
double *x3, double *y3);
|
||||||
void OnDraw(wxDC& dc);
|
void OnDraw(wxDC& dc);
|
||||||
void SetSize(float x, float y, bool recursive = TRUE);
|
void SetSize(double x, double y, bool recursive = TRUE);
|
||||||
void SetCornerRadius(float rad); // If > 0, rounded corners
|
void SetCornerRadius(double rad); // If > 0, rounded corners
|
||||||
|
|
||||||
#ifdef PROLOGIO
|
#ifdef PROLOGIO
|
||||||
// Prolog database stuff
|
// Prolog database stuff
|
||||||
@@ -548,27 +576,27 @@ class wxRectangleShape: public wxShape
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
int GetNumberOfAttachments();
|
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);
|
int nth = 0, int no_arcs = 1, wxLineShape *line = NULL);
|
||||||
// Does the copying for this object
|
// Does the copying for this object
|
||||||
void Copy(wxShape& copy);
|
void Copy(wxShape& copy);
|
||||||
|
|
||||||
inline float GetWidth() const { return m_width; }
|
inline double GetWidth() const { return m_width; }
|
||||||
inline float GetHeight() const { return m_height; }
|
inline double GetHeight() const { return m_height; }
|
||||||
inline void SetWidth(float w) { m_width = w; }
|
inline void SetWidth(double w) { m_width = w; }
|
||||||
inline void SetHeight(float h) { m_height = h; }
|
inline void SetHeight(double h) { m_height = h; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
float m_width;
|
double m_width;
|
||||||
float m_height;
|
double m_height;
|
||||||
float m_cornerRadius;
|
double m_cornerRadius;
|
||||||
};
|
};
|
||||||
|
|
||||||
class wxTextShape: public wxRectangleShape
|
class wxTextShape: public wxRectangleShape
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxTextShape)
|
DECLARE_DYNAMIC_CLASS(wxTextShape)
|
||||||
public:
|
public:
|
||||||
wxTextShape(float width = 0.0, float height = 0.0);
|
wxTextShape(double width = 0.0, double height = 0.0);
|
||||||
|
|
||||||
void OnDraw(wxDC& dc);
|
void OnDraw(wxDC& dc);
|
||||||
|
|
||||||
@@ -584,15 +612,15 @@ class wxEllipseShape: public wxShape
|
|||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxEllipseShape)
|
DECLARE_DYNAMIC_CLASS(wxEllipseShape)
|
||||||
public:
|
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);
|
void GetBoundingBoxMin(double *w, double *h);
|
||||||
bool GetPerimeterPoint(float x1, float y1,
|
bool GetPerimeterPoint(double x1, double y1,
|
||||||
float x2, float y2,
|
double x2, double y2,
|
||||||
float *x3, float *y3);
|
double *x3, double *y3);
|
||||||
|
|
||||||
void OnDraw(wxDC& dc);
|
void OnDraw(wxDC& dc);
|
||||||
void SetSize(float x, float y, bool recursive = TRUE);
|
void SetSize(double x, double y, bool recursive = TRUE);
|
||||||
|
|
||||||
#ifdef PROLOGIO
|
#ifdef PROLOGIO
|
||||||
// Prolog database stuff
|
// Prolog database stuff
|
||||||
@@ -601,29 +629,29 @@ class wxEllipseShape: public wxShape
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
int GetNumberOfAttachments();
|
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);
|
int nth = 0, int no_arcs = 1, wxLineShape *line = NULL);
|
||||||
|
|
||||||
// Does the copying for this object
|
// Does the copying for this object
|
||||||
void Copy(wxShape& copy);
|
void Copy(wxShape& copy);
|
||||||
|
|
||||||
inline float GetWidth() const { return m_width; }
|
inline double GetWidth() const { return m_width; }
|
||||||
inline float GetHeight() const { return m_height; }
|
inline double GetHeight() const { return m_height; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
float m_width;
|
double m_width;
|
||||||
float m_height;
|
double m_height;
|
||||||
};
|
};
|
||||||
|
|
||||||
class wxCircleShape: public wxEllipseShape
|
class wxCircleShape: public wxEllipseShape
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxCircleShape)
|
DECLARE_DYNAMIC_CLASS(wxCircleShape)
|
||||||
public:
|
public:
|
||||||
wxCircleShape(float w = 0.0);
|
wxCircleShape(double w = 0.0);
|
||||||
|
|
||||||
bool GetPerimeterPoint(float x1, float y1,
|
bool GetPerimeterPoint(double x1, double y1,
|
||||||
float x2, float y2,
|
double x2, double y2,
|
||||||
float *x3, float *y3);
|
double *x3, double *y3);
|
||||||
// Does the copying for this object
|
// Does the copying for this object
|
||||||
void Copy(wxShape& copy);
|
void Copy(wxShape& copy);
|
||||||
};
|
};
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -22,22 +22,22 @@ class wxShapeTextLine: public wxObject
|
|||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxShapeTextLine)
|
DECLARE_DYNAMIC_CLASS(wxShapeTextLine)
|
||||||
public:
|
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();
|
~wxShapeTextLine();
|
||||||
|
|
||||||
inline float GetX() const { return m_x; }
|
inline double GetX() const { return m_x; }
|
||||||
inline float GetY() const { return m_y; }
|
inline double GetY() const { return m_y; }
|
||||||
|
|
||||||
inline void SetX(float x) { m_x = x; }
|
inline void SetX(double x) { m_x = x; }
|
||||||
inline void SetY(float y) { m_y = y; }
|
inline void SetY(double y) { m_y = y; }
|
||||||
|
|
||||||
inline void SetText(const wxString& text) { m_line = text; }
|
inline void SetText(const wxString& text) { m_line = text; }
|
||||||
inline wxString GetText() const { return m_line; }
|
inline wxString GetText() const { return m_line; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
wxString m_line;
|
wxString m_line;
|
||||||
float m_x;
|
double m_x;
|
||||||
float m_y;
|
double m_y;
|
||||||
};
|
};
|
||||||
|
|
||||||
class wxShape;
|
class wxShape;
|
||||||
@@ -49,18 +49,18 @@ class wxControlPoint: public wxRectangleShape
|
|||||||
friend class wxShape;
|
friend class wxShape;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
wxControlPoint(wxShapeCanvas *the_canvas = NULL, wxShape *object = NULL, float size = 0.0, float the_xoffset = 0.0,
|
wxControlPoint(wxShapeCanvas *the_canvas = NULL, wxShape *object = NULL, double size = 0.0, double the_xoffset = 0.0,
|
||||||
float the_yoffset = 0.0, int the_type = 0);
|
double the_yoffset = 0.0, int the_type = 0);
|
||||||
~wxControlPoint();
|
~wxControlPoint();
|
||||||
|
|
||||||
void OnDraw(wxDC& dc);
|
void OnDraw(wxDC& dc);
|
||||||
void OnErase(wxDC& dc);
|
void OnErase(wxDC& dc);
|
||||||
void OnDrawContents(wxDC& dc);
|
void OnDrawContents(wxDC& dc);
|
||||||
void OnDragLeft(bool draw, 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(float x, float y, int keys=0, int attachment = 0);
|
void OnBeginDragLeft(double x, double y, int keys=0, int attachment = 0);
|
||||||
void OnEndDragLeft(float x, float 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 nth = 0, int no_arcs = 1, wxLineShape *line = NULL);
|
||||||
int GetNumberOfAttachments();
|
int GetNumberOfAttachments();
|
||||||
|
|
||||||
@@ -68,8 +68,8 @@ class wxControlPoint: public wxRectangleShape
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
int m_type;
|
int m_type;
|
||||||
float m_xoffset;
|
double m_xoffset;
|
||||||
float m_yoffset;
|
double m_yoffset;
|
||||||
wxShape* m_shape;
|
wxShape* m_shape;
|
||||||
wxCursor* m_oldCursor;
|
wxCursor* m_oldCursor;
|
||||||
bool m_eraseObject; // If TRUE, erases object before dragging handle.
|
bool m_eraseObject; // If TRUE, erases object before dragging handle.
|
||||||
@@ -78,14 +78,14 @@ public:
|
|||||||
* Store original top-left, bottom-right coordinates
|
* Store original top-left, bottom-right coordinates
|
||||||
* in case we're doing non-vertical resizing.
|
* in case we're doing non-vertical resizing.
|
||||||
*/
|
*/
|
||||||
static float controlPointDragStartX;
|
static double controlPointDragStartX;
|
||||||
static float controlPointDragStartY;
|
static double controlPointDragStartY;
|
||||||
static float controlPointDragStartWidth;
|
static double controlPointDragStartWidth;
|
||||||
static float controlPointDragStartHeight;
|
static double controlPointDragStartHeight;
|
||||||
static float controlPointDragEndWidth;
|
static double controlPointDragEndWidth;
|
||||||
static float controlPointDragEndHeight;
|
static double controlPointDragEndHeight;
|
||||||
static float controlPointDragPosX;
|
static double controlPointDragPosX;
|
||||||
static float controlPointDragPosY;
|
static double controlPointDragPosY;
|
||||||
};
|
};
|
||||||
|
|
||||||
class wxPolygonShape;
|
class wxPolygonShape;
|
||||||
@@ -94,16 +94,16 @@ class wxPolygonControlPoint: public wxControlPoint
|
|||||||
DECLARE_DYNAMIC_CLASS(wxPolygonControlPoint)
|
DECLARE_DYNAMIC_CLASS(wxPolygonControlPoint)
|
||||||
friend class wxPolygonShape;
|
friend class wxPolygonShape;
|
||||||
public:
|
public:
|
||||||
wxPolygonControlPoint(wxShapeCanvas *the_canvas = NULL, wxShape *object = NULL, float size = 0.0, wxRealPoint *vertex = NULL,
|
wxPolygonControlPoint(wxShapeCanvas *the_canvas = NULL, wxShape *object = NULL, double size = 0.0, wxRealPoint *vertex = NULL,
|
||||||
float the_xoffset = 0.0, float the_yoffset = 0.0);
|
double the_xoffset = 0.0, double the_yoffset = 0.0);
|
||||||
~wxPolygonControlPoint();
|
~wxPolygonControlPoint();
|
||||||
|
|
||||||
void OnDragLeft(bool draw, 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(float x, float y, int keys=0, int attachment = 0);
|
void OnBeginDragLeft(double x, double y, int keys=0, int attachment = 0);
|
||||||
void OnEndDragLeft(float x, float 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
|
// 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
|
// Get new size
|
||||||
inline wxRealPoint GetNewSize() const { return m_newSize; };
|
inline wxRealPoint GetNewSize() const { return m_newSize; };
|
||||||
@@ -111,7 +111,7 @@ class wxPolygonControlPoint: public wxControlPoint
|
|||||||
public:
|
public:
|
||||||
wxRealPoint* m_polygonVertex;
|
wxRealPoint* m_polygonVertex;
|
||||||
wxRealPoint m_originalSize;
|
wxRealPoint m_originalSize;
|
||||||
float m_originalDistance;
|
double m_originalDistance;
|
||||||
wxRealPoint m_newSize;
|
wxRealPoint m_newSize;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -138,20 +138,20 @@ class wxShapeRegion: public wxObject
|
|||||||
// Accessors
|
// Accessors
|
||||||
inline void SetText(const wxString& s) { m_regionText = s; }
|
inline void SetText(const wxString& s) { m_regionText = s; }
|
||||||
void SetFont(wxFont *f);
|
void SetFont(wxFont *f);
|
||||||
void SetMinSize(float w, float h);
|
void SetMinSize(double w, double h);
|
||||||
void SetSize(float w, float h);
|
void SetSize(double w, double h);
|
||||||
void SetPosition(float x, float y);
|
void SetPosition(double x, double y);
|
||||||
void SetProportions(float x, float y);
|
void SetProportions(double x, double y);
|
||||||
void SetFormatMode(int mode);
|
void SetFormatMode(int mode);
|
||||||
inline void SetName(const wxString& s) { m_regionName = s; };
|
inline void SetName(const wxString& s) { m_regionName = s; };
|
||||||
void SetColour(const wxString& col); // Text colour
|
void SetColour(const wxString& col); // Text colour
|
||||||
|
|
||||||
inline wxString GetText() const { return m_regionText; }
|
inline wxString GetText() const { return m_regionText; }
|
||||||
inline wxFont *GetFont() const { return m_font; }
|
inline wxFont *GetFont() const { return m_font; }
|
||||||
inline void GetMinSize(float *x, float *y) const { *x = m_minWidth; *y = m_minHeight; }
|
inline void GetMinSize(double *x, double *y) const { *x = m_minWidth; *y = m_minHeight; }
|
||||||
inline void GetProportion(float *x, float *y) const { *x = m_regionProportionX; *y = m_regionProportionY; }
|
inline void GetProportion(double *x, double *y) const { *x = m_regionProportionX; *y = m_regionProportionY; }
|
||||||
inline void GetSize(float *x, float *y) const { *x = m_width; *y = m_height; }
|
inline void GetSize(double *x, double *y) const { *x = m_width; *y = m_height; }
|
||||||
inline void GetPosition(float *xp, float *yp) const { *xp = m_x; *yp = m_y; }
|
inline void GetPosition(double *xp, double *yp) const { *xp = m_x; *yp = m_y; }
|
||||||
inline int GetFormatMode() const { return m_formatMode; }
|
inline int GetFormatMode() const { return m_formatMode; }
|
||||||
inline wxString GetName() const { return m_regionName; }
|
inline wxString GetName() const { return m_regionName; }
|
||||||
inline wxString GetColour() const { return m_textColour; }
|
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; }
|
inline void SetPenStyle(int style) { m_penStyle = style; m_actualPenObject = NULL; }
|
||||||
void SetPenColour(const wxString& col);
|
void SetPenColour(const wxString& col);
|
||||||
wxPen *GetActualPen();
|
wxPen *GetActualPen();
|
||||||
inline float GetWidth() const { return m_width; }
|
inline double GetWidth() const { return m_width; }
|
||||||
inline float GetHeight() const { return m_height; }
|
inline double GetHeight() const { return m_height; }
|
||||||
|
|
||||||
void ClearText();
|
void ClearText();
|
||||||
|
|
||||||
@@ -171,16 +171,16 @@ public:
|
|||||||
wxString m_regionText;
|
wxString m_regionText;
|
||||||
wxList m_formattedText; // List of wxShapeTextLines
|
wxList m_formattedText; // List of wxShapeTextLines
|
||||||
wxFont* m_font;
|
wxFont* m_font;
|
||||||
float m_minHeight; // If zero, hide region.
|
double m_minHeight; // If zero, hide region.
|
||||||
float m_minWidth; // If zero, hide region.
|
double m_minWidth; // If zero, hide region.
|
||||||
float m_width;
|
double m_width;
|
||||||
float m_height;
|
double m_height;
|
||||||
float m_x;
|
double m_x;
|
||||||
float m_y;
|
double m_y;
|
||||||
|
|
||||||
float m_regionProportionX; // Proportion of total object size;
|
double m_regionProportionX; // Proportion of total object size;
|
||||||
// -1.0 indicates equal proportion
|
// -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
|
// -1.0 indicates equal proportion
|
||||||
|
|
||||||
int m_formatMode; // FORMAT_CENTRE_HORIZ | FORMAT_CENTRE_VERT | FORMAT_NONE
|
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;
|
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:
|
public:
|
||||||
int m_id; // Identifier
|
int m_id; // Identifier
|
||||||
float m_x; // x offset from centre of object
|
double m_x; // x offset from centre of object
|
||||||
float m_y; // y offset from centre of object
|
double m_y; // y offset from centre of object
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -57,13 +57,13 @@ void wxBitmapShape::OnDraw(wxDC& dc)
|
|||||||
|
|
||||||
wxMemoryDC tempDC;
|
wxMemoryDC tempDC;
|
||||||
tempDC.SelectObject(m_bitmap);
|
tempDC.SelectObject(m_bitmap);
|
||||||
float x, y;
|
double x, y;
|
||||||
x = (long)(m_xpos - m_bitmap.GetWidth() / 2.0);
|
x = WXROUND(m_xpos - m_bitmap.GetWidth() / 2.0);
|
||||||
y = (long)(m_ypos - m_bitmap.GetHeight() / 2.0);
|
y = WXROUND(m_ypos - m_bitmap.GetHeight() / 2.0);
|
||||||
dc.Blit(x, y, m_bitmap.GetWidth(), m_bitmap.GetHeight(), &tempDC, 0, 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())
|
if (m_bitmap.Ok())
|
||||||
{
|
{
|
||||||
|
@@ -37,7 +37,7 @@ class wxBitmapShape: public wxRectangleShape
|
|||||||
// Does the copying for this object
|
// Does the copying for this object
|
||||||
void Copy(wxShape& copy);
|
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; }
|
inline wxBitmap& GetBitmap() const { return (wxBitmap&) m_bitmap; }
|
||||||
void SetBitmap(const wxBitmap& bm);
|
void SetBitmap(const wxBitmap& bm);
|
||||||
inline void SetFilename(const wxString& f) { m_filename = f; };
|
inline void SetFilename(const wxString& f) { m_filename = f; };
|
||||||
|
@@ -59,7 +59,7 @@
|
|||||||
#define CONTROL_POINT_ENDPOINT_FROM 5
|
#define CONTROL_POINT_ENDPOINT_FROM 5
|
||||||
#define CONTROL_POINT_LINE 6
|
#define CONTROL_POINT_LINE 6
|
||||||
|
|
||||||
extern wxCursor *GraphicsBullseyeCursor;
|
extern wxCursor *g_oglBullseyeCursor;
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxShapeCanvas, wxScrolledWindow)
|
IMPLEMENT_DYNAMIC_CLASS(wxShapeCanvas, wxScrolledWindow)
|
||||||
|
|
||||||
@@ -105,9 +105,9 @@ void wxShapeCanvas::OnMouseEvent(wxMouseEvent& event)
|
|||||||
|
|
||||||
wxPoint logPos(event.GetLogicalPosition(dc));
|
wxPoint logPos(event.GetLogicalPosition(dc));
|
||||||
|
|
||||||
float x, y;
|
double x, y;
|
||||||
x = (float) logPos.x;
|
x = (double) logPos.x;
|
||||||
y = (float) logPos.y;
|
y = (double) logPos.y;
|
||||||
|
|
||||||
int keys = 0;
|
int keys = 0;
|
||||||
if (event.ShiftDown())
|
if (event.ShiftDown())
|
||||||
@@ -144,11 +144,11 @@ void wxShapeCanvas::OnMouseEvent(wxMouseEvent& event)
|
|||||||
|
|
||||||
// If the object isn't m_draggable, transfer message to canvas
|
// If the object isn't m_draggable, transfer message to canvas
|
||||||
if (m_draggedShape->Draggable())
|
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
|
else
|
||||||
{
|
{
|
||||||
m_draggedShape = NULL;
|
m_draggedShape = NULL;
|
||||||
OnBeginDragLeft((float)x, (float)y, keys);
|
OnBeginDragLeft((double)x, (double)y, keys);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_oldDragX = x; m_oldDragY = y;
|
m_oldDragX = x; m_oldDragY = y;
|
||||||
@@ -157,7 +157,7 @@ void wxShapeCanvas::OnMouseEvent(wxMouseEvent& event)
|
|||||||
{
|
{
|
||||||
// Continue dragging
|
// Continue dragging
|
||||||
m_draggedShape->GetEventHandler()->OnDragLeft(FALSE, m_oldDragX, m_oldDragY, keys, m_draggedAttachment);
|
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;
|
m_oldDragX = x; m_oldDragY = y;
|
||||||
}
|
}
|
||||||
else if (event.LeftUp() && m_draggedShape && m_dragState == ContinueDraggingLeft)
|
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()->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;
|
m_draggedShape = NULL;
|
||||||
}
|
}
|
||||||
else if (dragging && m_draggedShape && m_dragState == StartDraggingRight)
|
else if (dragging && m_draggedShape && m_dragState == StartDraggingRight)
|
||||||
@@ -175,11 +175,11 @@ void wxShapeCanvas::OnMouseEvent(wxMouseEvent& event)
|
|||||||
m_dragState = ContinueDraggingRight;
|
m_dragState = ContinueDraggingRight;
|
||||||
|
|
||||||
if (m_draggedShape->Draggable())
|
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
|
else
|
||||||
{
|
{
|
||||||
m_draggedShape = NULL;
|
m_draggedShape = NULL;
|
||||||
OnBeginDragRight((float)x, (float)y, keys);
|
OnBeginDragRight((double)x, (double)y, keys);
|
||||||
}
|
}
|
||||||
m_oldDragX = x; m_oldDragY = y;
|
m_oldDragX = x; m_oldDragY = y;
|
||||||
}
|
}
|
||||||
@@ -187,7 +187,7 @@ void wxShapeCanvas::OnMouseEvent(wxMouseEvent& event)
|
|||||||
{
|
{
|
||||||
// Continue dragging
|
// Continue dragging
|
||||||
m_draggedShape->GetEventHandler()->OnDragRight(FALSE, m_oldDragX, m_oldDragY, keys, m_draggedAttachment);
|
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;
|
m_oldDragX = x; m_oldDragY = y;
|
||||||
}
|
}
|
||||||
else if (event.RightUp() && m_draggedShape && m_dragState == ContinueDraggingRight)
|
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()->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;
|
m_draggedShape = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -205,14 +205,14 @@ void wxShapeCanvas::OnMouseEvent(wxMouseEvent& event)
|
|||||||
else if (dragging && !m_draggedShape && m_dragState == StartDraggingLeft)
|
else if (dragging && !m_draggedShape && m_dragState == StartDraggingLeft)
|
||||||
{
|
{
|
||||||
m_dragState = ContinueDraggingLeft;
|
m_dragState = ContinueDraggingLeft;
|
||||||
OnBeginDragLeft((float)x, (float)y, keys);
|
OnBeginDragLeft((double)x, (double)y, keys);
|
||||||
m_oldDragX = x; m_oldDragY = y;
|
m_oldDragX = x; m_oldDragY = y;
|
||||||
}
|
}
|
||||||
else if (dragging && !m_draggedShape && m_dragState == ContinueDraggingLeft)
|
else if (dragging && !m_draggedShape && m_dragState == ContinueDraggingLeft)
|
||||||
{
|
{
|
||||||
// Continue dragging
|
// Continue dragging
|
||||||
OnDragLeft(FALSE, m_oldDragX, m_oldDragY, keys);
|
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;
|
m_oldDragX = x; m_oldDragY = y;
|
||||||
}
|
}
|
||||||
else if (event.LeftUp() && !m_draggedShape && m_dragState == ContinueDraggingLeft)
|
else if (event.LeftUp() && !m_draggedShape && m_dragState == ContinueDraggingLeft)
|
||||||
@@ -221,20 +221,20 @@ void wxShapeCanvas::OnMouseEvent(wxMouseEvent& event)
|
|||||||
m_checkTolerance = TRUE;
|
m_checkTolerance = TRUE;
|
||||||
|
|
||||||
OnDragLeft(FALSE, m_oldDragX, m_oldDragY, keys);
|
OnDragLeft(FALSE, m_oldDragX, m_oldDragY, keys);
|
||||||
OnEndDragLeft((float)x, (float)y, keys);
|
OnEndDragLeft((double)x, (double)y, keys);
|
||||||
m_draggedShape = NULL;
|
m_draggedShape = NULL;
|
||||||
}
|
}
|
||||||
else if (dragging && !m_draggedShape && m_dragState == StartDraggingRight)
|
else if (dragging && !m_draggedShape && m_dragState == StartDraggingRight)
|
||||||
{
|
{
|
||||||
m_dragState = ContinueDraggingRight;
|
m_dragState = ContinueDraggingRight;
|
||||||
OnBeginDragRight((float)x, (float)y, keys);
|
OnBeginDragRight((double)x, (double)y, keys);
|
||||||
m_oldDragX = x; m_oldDragY = y;
|
m_oldDragX = x; m_oldDragY = y;
|
||||||
}
|
}
|
||||||
else if (dragging && !m_draggedShape && m_dragState == ContinueDraggingRight)
|
else if (dragging && !m_draggedShape && m_dragState == ContinueDraggingRight)
|
||||||
{
|
{
|
||||||
// Continue dragging
|
// Continue dragging
|
||||||
OnDragRight(FALSE, m_oldDragX, m_oldDragY, keys);
|
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;
|
m_oldDragX = x; m_oldDragY = y;
|
||||||
}
|
}
|
||||||
else if (event.RightUp() && !m_draggedShape && m_dragState == ContinueDraggingRight)
|
else if (event.RightUp() && !m_draggedShape && m_dragState == ContinueDraggingRight)
|
||||||
@@ -243,7 +243,7 @@ void wxShapeCanvas::OnMouseEvent(wxMouseEvent& event)
|
|||||||
m_checkTolerance = TRUE;
|
m_checkTolerance = TRUE;
|
||||||
|
|
||||||
OnDragRight(FALSE, m_oldDragX, m_oldDragY, keys);
|
OnDragRight(FALSE, m_oldDragX, m_oldDragY, keys);
|
||||||
OnEndDragRight((float)x, (float)y, keys);
|
OnEndDragRight((double)x, (double)y, keys);
|
||||||
m_draggedShape = NULL;
|
m_draggedShape = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -270,7 +270,7 @@ void wxShapeCanvas::OnMouseEvent(wxMouseEvent& event)
|
|||||||
// N.B. Only register a click if the same object was
|
// N.B. Only register a click if the same object was
|
||||||
// identified for down *and* up.
|
// identified for down *and* up.
|
||||||
if (nearest_object == m_draggedShape)
|
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_draggedShape = NULL;
|
||||||
m_dragState = NoDragging;
|
m_dragState = NoDragging;
|
||||||
@@ -286,7 +286,7 @@ void wxShapeCanvas::OnMouseEvent(wxMouseEvent& event)
|
|||||||
else if (event.RightUp())
|
else if (event.RightUp())
|
||||||
{
|
{
|
||||||
if (nearest_object == m_draggedShape)
|
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_draggedShape = NULL;
|
||||||
m_dragState = NoDragging;
|
m_dragState = NoDragging;
|
||||||
@@ -303,7 +303,7 @@ void wxShapeCanvas::OnMouseEvent(wxMouseEvent& event)
|
|||||||
}
|
}
|
||||||
else if (event.LeftUp())
|
else if (event.LeftUp())
|
||||||
{
|
{
|
||||||
OnLeftClick((float)x, (float)y, keys);
|
OnLeftClick((double)x, (double)y, keys);
|
||||||
|
|
||||||
m_draggedShape = NULL;
|
m_draggedShape = NULL;
|
||||||
m_dragState = NoDragging;
|
m_dragState = NoDragging;
|
||||||
@@ -317,7 +317,7 @@ void wxShapeCanvas::OnMouseEvent(wxMouseEvent& event)
|
|||||||
}
|
}
|
||||||
else if (event.RightUp())
|
else if (event.RightUp())
|
||||||
{
|
{
|
||||||
OnRightClick((float)x, (float)y, keys);
|
OnRightClick((double)x, (double)y, keys);
|
||||||
|
|
||||||
m_draggedShape = NULL;
|
m_draggedShape = NULL;
|
||||||
m_dragState = NoDragging;
|
m_dragState = NoDragging;
|
||||||
@@ -330,7 +330,7 @@ void wxShapeCanvas::OnMouseEvent(wxMouseEvent& event)
|
|||||||
* Try to find a sensitive object, working up the hierarchy of composites.
|
* 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);
|
wxShape *image = FindShape(x, y, new_attachment);
|
||||||
if (!image) return NULL;
|
if (!image) return NULL;
|
||||||
@@ -338,7 +338,7 @@ wxShape *wxShapeCanvas::FindFirstSensitiveShape(float x, float y, int *new_attac
|
|||||||
wxShape *actualImage = FindFirstSensitiveShape1(image, op);
|
wxShape *actualImage = FindFirstSensitiveShape1(image, op);
|
||||||
if (actualImage)
|
if (actualImage)
|
||||||
{
|
{
|
||||||
float dist;
|
double dist;
|
||||||
// Find actual attachment
|
// Find actual attachment
|
||||||
actualImage->HitTest(x, y, new_attachment, &dist);
|
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'.
|
// Helper function: TRUE if 'contains' wholly contains 'contained'.
|
||||||
static bool WhollyContains(wxShape *contains, wxShape *contained)
|
static bool WhollyContains(wxShape *contains, wxShape *contained)
|
||||||
{
|
{
|
||||||
float xp1, yp1, xp2, yp2;
|
double xp1, yp1, xp2, yp2;
|
||||||
float w1, h1, w2, h2;
|
double w1, h1, w2, h2;
|
||||||
float left1, top1, right1, bottom1, left2, top2, right2, bottom2;
|
double left1, top1, right1, bottom1, left2, top2, right2, bottom2;
|
||||||
|
|
||||||
xp1 = contains->GetX(); yp1 = contains->GetY(); xp2 = contained->GetX(); yp2 = contained->GetY();
|
xp1 = contains->GetX(); yp1 = contains->GetY(); xp2 = contained->GetX(); yp2 = contained->GetY();
|
||||||
contains->GetBoundingBoxMax(&w1, &h1);
|
contains->GetBoundingBoxMax(&w1, &h1);
|
||||||
contained->GetBoundingBoxMax(&w2, &h2);
|
contained->GetBoundingBoxMax(&w2, &h2);
|
||||||
|
|
||||||
left1 = (float)(xp1 - (w1 / 2.0));
|
left1 = (double)(xp1 - (w1 / 2.0));
|
||||||
top1 = (float)(yp1 - (h1 / 2.0));
|
top1 = (double)(yp1 - (h1 / 2.0));
|
||||||
right1 = (float)(xp1 + (w1 / 2.0));
|
right1 = (double)(xp1 + (w1 / 2.0));
|
||||||
bottom1 = (float)(yp1 + (h1 / 2.0));
|
bottom1 = (double)(yp1 + (h1 / 2.0));
|
||||||
|
|
||||||
left2 = (float)(xp2 - (w2 / 2.0));
|
left2 = (double)(xp2 - (w2 / 2.0));
|
||||||
top2 = (float)(yp2 - (h2 / 2.0));
|
top2 = (double)(yp2 - (h2 / 2.0));
|
||||||
right2 = (float)(xp2 + (w2 / 2.0));
|
right2 = (double)(xp2 + (w2 / 2.0));
|
||||||
bottom2 = (float)(yp2 + (h2 / 2.0));
|
bottom2 = (double)(yp2 + (h2 / 2.0));
|
||||||
|
|
||||||
return ((left1 <= left2) && (top1 <= top2) && (right1 >= right2) && (bottom1 >= bottom2));
|
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;
|
int nearest_attachment = 0;
|
||||||
wxShape *nearest_object = NULL;
|
wxShape *nearest_object = NULL;
|
||||||
|
|
||||||
@@ -394,7 +394,7 @@ wxShape *wxShapeCanvas::FindShape(float x, float y, int *attachment, wxClassInfo
|
|||||||
{
|
{
|
||||||
wxShape *object = (wxShape *)current->Data();
|
wxShape *object = (wxShape *)current->Data();
|
||||||
|
|
||||||
float dist;
|
double dist;
|
||||||
int temp_attachment;
|
int temp_attachment;
|
||||||
|
|
||||||
// First pass for lines, which might be inside a container, so we
|
// 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)
|
while (current)
|
||||||
{
|
{
|
||||||
wxShape *object = (wxShape *)current->Data();
|
wxShape *object = (wxShape *)current->Data();
|
||||||
float dist;
|
double dist;
|
||||||
int temp_attachment;
|
int temp_attachment;
|
||||||
|
|
||||||
// On second pass, only ever consider non-composites or divisions. If children want to pass
|
// 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(); }
|
{ return GetDiagram()->GetQuickEditMode(); }
|
||||||
void wxShapeCanvas::Redraw(wxDC& dc)
|
void wxShapeCanvas::Redraw(wxDC& dc)
|
||||||
{ GetDiagram()->Redraw(dc); }
|
{ GetDiagram()->Redraw(dc); }
|
||||||
void wxShapeCanvas::Snap(float *x, float *y)
|
void wxShapeCanvas::Snap(double *x, double *y)
|
||||||
{ GetDiagram()->Snap(x, y); }
|
{ GetDiagram()->Snap(x, y); }
|
||||||
|
@@ -38,21 +38,21 @@ class wxShapeCanvas: public wxScrolledWindow
|
|||||||
inline void SetDiagram(wxDiagram *diag) { m_shapeDiagram = diag; }
|
inline void SetDiagram(wxDiagram *diag) { m_shapeDiagram = diag; }
|
||||||
inline wxDiagram *GetDiagram() const { return m_shapeDiagram; }
|
inline wxDiagram *GetDiagram() const { return m_shapeDiagram; }
|
||||||
|
|
||||||
virtual void OnLeftClick(float x, float y, int keys = 0);
|
virtual void OnLeftClick(double x, double y, int keys = 0);
|
||||||
virtual void OnRightClick(float x, float 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 OnDragLeft(bool draw, double x, double y, int keys=0); // Erase if draw false
|
||||||
virtual void OnBeginDragLeft(float x, float y, int keys=0);
|
virtual void OnBeginDragLeft(double x, double y, int keys=0);
|
||||||
virtual void OnEndDragLeft(float x, float 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 OnDragRight(bool draw, double x, double y, int keys=0); // Erase if draw false
|
||||||
virtual void OnBeginDragRight(float x, float y, int keys=0);
|
virtual void OnBeginDragRight(double x, double y, int keys=0);
|
||||||
virtual void OnEndDragRight(float x, float 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).
|
// 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
|
// 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);
|
virtual wxShape *FindShape(double x, double y, int *attachment, wxClassInfo *info = NULL, wxShape *notImage = NULL);
|
||||||
wxShape *FindFirstSensitiveShape(float x, float y, int *new_attachment, int op);
|
wxShape *FindFirstSensitiveShape(double x, double y, int *new_attachment, int op);
|
||||||
wxShape *FindFirstSensitiveShape1(wxShape *image, int op);
|
wxShape *FindFirstSensitiveShape1(wxShape *image, int op);
|
||||||
|
|
||||||
// Redirect to wxDiagram object
|
// Redirect to wxDiagram object
|
||||||
@@ -61,7 +61,7 @@ class wxShapeCanvas: public wxScrolledWindow
|
|||||||
virtual void RemoveShape(wxShape *object);
|
virtual void RemoveShape(wxShape *object);
|
||||||
virtual bool GetQuickEditMode();
|
virtual bool GetQuickEditMode();
|
||||||
virtual void Redraw(wxDC& dc);
|
virtual void Redraw(wxDC& dc);
|
||||||
void Snap(float *x, float *y);
|
void Snap(double *x, double *y);
|
||||||
|
|
||||||
// Events
|
// Events
|
||||||
void OnPaint(wxPaintEvent& event);
|
void OnPaint(wxPaintEvent& event);
|
||||||
@@ -70,8 +70,8 @@ class wxShapeCanvas: public wxScrolledWindow
|
|||||||
protected:
|
protected:
|
||||||
wxDiagram* m_shapeDiagram;
|
wxDiagram* m_shapeDiagram;
|
||||||
int m_dragState;
|
int m_dragState;
|
||||||
float m_oldDragX, m_oldDragY; // Previous drag coordinates
|
double m_oldDragX, m_oldDragY; // Previous drag coordinates
|
||||||
float m_firstDragX, m_firstDragY; // INITIAL drag coordinates
|
double m_firstDragX, m_firstDragY; // INITIAL drag coordinates
|
||||||
bool m_checkTolerance; // Whether to check drag tolerance
|
bool m_checkTolerance; // Whether to check drag tolerance
|
||||||
wxShape* m_draggedShape;
|
wxShape* m_draggedShape;
|
||||||
int m_draggedAttachment;
|
int m_draggedAttachment;
|
||||||
|
@@ -51,12 +51,12 @@ class wxDivisionControlPoint: public wxControlPoint
|
|||||||
DECLARE_DYNAMIC_CLASS(wxDivisionControlPoint)
|
DECLARE_DYNAMIC_CLASS(wxDivisionControlPoint)
|
||||||
public:
|
public:
|
||||||
wxDivisionControlPoint() {}
|
wxDivisionControlPoint() {}
|
||||||
wxDivisionControlPoint(wxShapeCanvas *the_canvas, wxShape *object, float size, float the_xoffset, float the_yoffset, int the_type);
|
wxDivisionControlPoint(wxShapeCanvas *the_canvas, wxShape *object, double size, double the_xoffset, double the_yoffset, int the_type);
|
||||||
~wxDivisionControlPoint();
|
~wxDivisionControlPoint();
|
||||||
|
|
||||||
void OnDragLeft(bool draw, 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(float x, float y, int keys=0, int attachment = 0);
|
void OnBeginDragLeft(double x, double y, int keys=0, int attachment = 0);
|
||||||
void OnEndDragLeft(float x, float y, int keys=0, int attachment = 0);
|
void OnEndDragLeft(double x, double y, int keys=0, int attachment = 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxDivisionControlPoint, wxControlPoint)
|
IMPLEMENT_DYNAMIC_CLASS(wxDivisionControlPoint, wxControlPoint)
|
||||||
@@ -97,20 +97,20 @@ wxCompositeShape::~wxCompositeShape()
|
|||||||
|
|
||||||
void wxCompositeShape::OnDraw(wxDC& dc)
|
void wxCompositeShape::OnDraw(wxDC& dc)
|
||||||
{
|
{
|
||||||
float x1 = (float)(m_xpos - m_width/2.0);
|
double x1 = (double)(m_xpos - m_width/2.0);
|
||||||
float y1 = (float)(m_ypos - m_height/2.0);
|
double y1 = (double)(m_ypos - m_height/2.0);
|
||||||
|
|
||||||
if (m_shadowMode != SHADOW_NONE)
|
if (m_shadowMode != SHADOW_NONE)
|
||||||
{
|
{
|
||||||
if (m_shadowBrush)
|
if (m_shadowBrush)
|
||||||
dc.SetBrush(m_shadowBrush);
|
dc.SetBrush(m_shadowBrush);
|
||||||
dc.SetPen(transparent_pen);
|
dc.SetPen(g_oglTransparentPen);
|
||||||
|
|
||||||
if (m_cornerRadius != 0.0)
|
if (m_cornerRadius != 0.0)
|
||||||
dc.DrawRoundedRectangle(x1 + m_shadowOffsetX, y1 + m_shadowOffsetY,
|
dc.DrawRoundedRectangle(WXROUND(x1 + m_shadowOffsetX), WXROUND(y1 + m_shadowOffsetY),
|
||||||
m_width, m_height, m_cornerRadius);
|
WXROUND(m_width), WXROUND(m_height), m_cornerRadius);
|
||||||
else
|
else
|
||||||
dc.DrawRectangle(x1 + m_shadowOffsetX, y1 + m_shadowOffsetY, m_width, m_height);
|
dc.DrawRectangle(WXROUND(x1 + m_shadowOffsetX), WXROUND(y1 + m_shadowOffsetY), WXROUND(m_width), WXROUND(m_height));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,10 +127,10 @@ void wxCompositeShape::OnDrawContents(wxDC& dc)
|
|||||||
wxShape::OnDrawContents(dc);
|
wxShape::OnDrawContents(dc);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxCompositeShape::OnMovePre(wxDC& dc, float x, float y, float oldx, float oldy, bool display)
|
bool wxCompositeShape::OnMovePre(wxDC& dc, double x, double y, double oldx, double oldy, bool display)
|
||||||
{
|
{
|
||||||
float diffX = x - oldx;
|
double diffX = x - oldx;
|
||||||
float diffY = y - oldy;
|
double diffY = y - oldy;
|
||||||
wxNode *node = m_children.First();
|
wxNode *node = m_children.First();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
@@ -156,16 +156,16 @@ void wxCompositeShape::OnErase(wxDC& dc)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static float objectStartX = 0.0;
|
static double objectStartX = 0.0;
|
||||||
static float objectStartY = 0.0;
|
static double objectStartY = 0.0;
|
||||||
|
|
||||||
void wxCompositeShape::OnDragLeft(bool draw, float x, float y, int keys, int attachment)
|
void wxCompositeShape::OnDragLeft(bool draw, double x, double y, int keys, int attachment)
|
||||||
{
|
{
|
||||||
float xx = x;
|
double xx = x;
|
||||||
float yy = y;
|
double yy = y;
|
||||||
m_canvas->Snap(&xx, &yy);
|
m_canvas->Snap(&xx, &yy);
|
||||||
float offsetX = xx - objectStartX;
|
double offsetX = xx - objectStartX;
|
||||||
float offsetY = yy - objectStartY;
|
double offsetY = yy - objectStartY;
|
||||||
|
|
||||||
wxClientDC dc(GetCanvas());
|
wxClientDC dc(GetCanvas());
|
||||||
GetCanvas()->PrepareDC(dc);
|
GetCanvas()->PrepareDC(dc);
|
||||||
@@ -179,7 +179,7 @@ void wxCompositeShape::OnDragLeft(bool draw, float x, float y, int keys, int att
|
|||||||
// wxShape::OnDragLeft(draw, x, y, keys, attachment);
|
// wxShape::OnDragLeft(draw, x, y, keys, attachment);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxCompositeShape::OnBeginDragLeft(float x, float y, int keys, int attachment)
|
void wxCompositeShape::OnBeginDragLeft(double x, double y, int keys, int attachment)
|
||||||
{
|
{
|
||||||
objectStartX = x;
|
objectStartX = x;
|
||||||
objectStartY = y;
|
objectStartY = y;
|
||||||
@@ -196,18 +196,18 @@ void wxCompositeShape::OnBeginDragLeft(float x, float y, int keys, int attachmen
|
|||||||
dc.SetBrush((* wxTRANSPARENT_BRUSH));
|
dc.SetBrush((* wxTRANSPARENT_BRUSH));
|
||||||
m_canvas->CaptureMouse();
|
m_canvas->CaptureMouse();
|
||||||
|
|
||||||
float xx = x;
|
double xx = x;
|
||||||
float yy = y;
|
double yy = y;
|
||||||
m_canvas->Snap(&xx, &yy);
|
m_canvas->Snap(&xx, &yy);
|
||||||
float offsetX = xx - objectStartX;
|
double offsetX = xx - objectStartX;
|
||||||
float offsetY = yy - objectStartY;
|
double offsetY = yy - objectStartY;
|
||||||
|
|
||||||
GetEventHandler()->OnDrawOutline(dc, GetX() + offsetX, GetY() + offsetY, GetWidth(), GetHeight());
|
GetEventHandler()->OnDrawOutline(dc, GetX() + offsetX, GetY() + offsetY, GetWidth(), GetHeight());
|
||||||
|
|
||||||
// wxShape::OnBeginDragLeft(x, y, keys, attachment);
|
// wxShape::OnBeginDragLeft(x, y, keys, attachment);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxCompositeShape::OnEndDragLeft(float x, float y, int keys, int attachment)
|
void wxCompositeShape::OnEndDragLeft(double x, double y, int keys, int attachment)
|
||||||
{
|
{
|
||||||
// wxShape::OnEndDragLeft(x, y, keys, attachment);
|
// wxShape::OnEndDragLeft(x, y, keys, attachment);
|
||||||
|
|
||||||
@@ -223,18 +223,18 @@ void wxCompositeShape::OnEndDragLeft(float x, float y, int keys, int attachment)
|
|||||||
}
|
}
|
||||||
|
|
||||||
dc.SetLogicalFunction(wxCOPY);
|
dc.SetLogicalFunction(wxCOPY);
|
||||||
float xx = x;
|
double xx = x;
|
||||||
float yy = y;
|
double yy = y;
|
||||||
m_canvas->Snap(&xx, &yy);
|
m_canvas->Snap(&xx, &yy);
|
||||||
float offsetX = xx - objectStartX;
|
double offsetX = xx - objectStartX;
|
||||||
float offsetY = yy - objectStartY;
|
double offsetY = yy - objectStartY;
|
||||||
|
|
||||||
Move(dc, GetX() + offsetX, GetY() + offsetY);
|
Move(dc, GetX() + offsetX, GetY() + offsetY);
|
||||||
|
|
||||||
if (m_canvas && !m_canvas->GetQuickEditMode()) m_canvas->Redraw(dc);
|
if (m_canvas && !m_canvas->GetQuickEditMode()) m_canvas->Redraw(dc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxCompositeShape::OnRightClick(float x, float y, int keys, int attachment)
|
void wxCompositeShape::OnRightClick(double x, double y, int keys, int attachment)
|
||||||
{
|
{
|
||||||
// If we get a ctrl-right click, this means send the message to
|
// If we get a ctrl-right click, this means send the message to
|
||||||
// the division, so we can invoke a user interface for dealing with regions.
|
// the division, so we can invoke a user interface for dealing with regions.
|
||||||
@@ -246,7 +246,7 @@ void wxCompositeShape::OnRightClick(float x, float y, int keys, int attachment)
|
|||||||
wxDivisionShape *division = (wxDivisionShape *)node->Data();
|
wxDivisionShape *division = (wxDivisionShape *)node->Data();
|
||||||
wxNode *next = node->Next();
|
wxNode *next = node->Next();
|
||||||
int attach = 0;
|
int attach = 0;
|
||||||
float dist = 0.0;
|
double dist = 0.0;
|
||||||
if (division->HitTest(x, y, &attach, &dist))
|
if (division->HitTest(x, y, &attach, &dist))
|
||||||
{
|
{
|
||||||
division->GetEventHandler()->OnRightClick(x, y, keys, attach);
|
division->GetEventHandler()->OnRightClick(x, y, keys, attach);
|
||||||
@@ -258,12 +258,12 @@ void wxCompositeShape::OnRightClick(float x, float y, int keys, int attachment)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxCompositeShape::SetSize(float w, float h, bool recursive)
|
void wxCompositeShape::SetSize(double w, double h, bool recursive)
|
||||||
{
|
{
|
||||||
SetAttachmentSize(w, h);
|
SetAttachmentSize(w, h);
|
||||||
|
|
||||||
float xScale = (float)(w/(wxMax(1.0, GetWidth())));
|
double xScale = (double)(w/(wxMax(1.0, GetWidth())));
|
||||||
float yScale = (float)(h/(wxMax(1.0, GetHeight())));
|
double yScale = (double)(h/(wxMax(1.0, GetHeight())));
|
||||||
|
|
||||||
m_width = w;
|
m_width = w;
|
||||||
m_height = h;
|
m_height = h;
|
||||||
@@ -275,14 +275,14 @@ void wxCompositeShape::SetSize(float w, float h, bool recursive)
|
|||||||
wxClientDC dc(GetCanvas());
|
wxClientDC dc(GetCanvas());
|
||||||
GetCanvas()->PrepareDC(dc);
|
GetCanvas()->PrepareDC(dc);
|
||||||
|
|
||||||
float xBound, yBound;
|
double xBound, yBound;
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxShape *object = (wxShape *)node->Data();
|
wxShape *object = (wxShape *)node->Data();
|
||||||
|
|
||||||
// Scale the position first
|
// Scale the position first
|
||||||
float newX = (float)(((object->GetX() - GetX())*xScale) + GetX());
|
double newX = (double)(((object->GetX() - GetX())*xScale) + GetX());
|
||||||
float newY = (float)(((object->GetY() - GetY())*yScale) + GetY());
|
double newY = (double)(((object->GetY() - GetY())*yScale) + GetY());
|
||||||
object->Show(FALSE);
|
object->Show(FALSE);
|
||||||
object->Move(dc, newX, newY);
|
object->Move(dc, newX, newY);
|
||||||
object->Show(TRUE);
|
object->Show(TRUE);
|
||||||
@@ -369,7 +369,7 @@ void wxCompositeShape::Copy(wxShape& copy)
|
|||||||
wxCompositeShape& compositeCopy = (wxCompositeShape&) copy;
|
wxCompositeShape& compositeCopy = (wxCompositeShape&) copy;
|
||||||
|
|
||||||
// Associate old and new copies for compositeCopying constraints and division geometry
|
// Associate old and new copies for compositeCopying constraints and division geometry
|
||||||
wxObjectCopyMapping.Append((long)this, &compositeCopy);
|
oglObjectCopyMapping.Append((long)this, &compositeCopy);
|
||||||
|
|
||||||
// Copy the children
|
// Copy the children
|
||||||
wxNode *node = m_children.First();
|
wxNode *node = m_children.First();
|
||||||
@@ -387,7 +387,7 @@ void wxCompositeShape::Copy(wxShape& copy)
|
|||||||
if (m_divisions.Member(object))
|
if (m_divisions.Member(object))
|
||||||
compositeCopy.m_divisions.Append(newObject);
|
compositeCopy.m_divisions.Append(newObject);
|
||||||
|
|
||||||
wxObjectCopyMapping.Append((long)object, newObject);
|
oglObjectCopyMapping.Append((long)object, newObject);
|
||||||
|
|
||||||
node = node->Next();
|
node = node->Next();
|
||||||
}
|
}
|
||||||
@@ -398,14 +398,14 @@ void wxCompositeShape::Copy(wxShape& copy)
|
|||||||
{
|
{
|
||||||
OGLConstraint *constraint = (OGLConstraint *)node->Data();
|
OGLConstraint *constraint = (OGLConstraint *)node->Data();
|
||||||
|
|
||||||
wxShape *newConstraining = (wxShape *)(wxObjectCopyMapping.Find((long)constraint->m_constrainingObject)->Data());
|
wxShape *newConstraining = (wxShape *)(oglObjectCopyMapping.Find((long)constraint->m_constrainingObject)->Data());
|
||||||
|
|
||||||
wxList newConstrainedList;
|
wxList newConstrainedList;
|
||||||
wxNode *node2 = constraint->m_constrainedObjects.First();
|
wxNode *node2 = constraint->m_constrainedObjects.First();
|
||||||
while (node2)
|
while (node2)
|
||||||
{
|
{
|
||||||
wxShape *constrainedObject = (wxShape *)node2->Data();
|
wxShape *constrainedObject = (wxShape *)node2->Data();
|
||||||
wxShape *newConstrained = (wxShape *)(wxObjectCopyMapping.Find((long)constrainedObject)->Data());
|
wxShape *newConstrained = (wxShape *)(oglObjectCopyMapping.Find((long)constrainedObject)->Data());
|
||||||
newConstrainedList.Append(newConstrained);
|
newConstrainedList.Append(newConstrained);
|
||||||
node2 = node2->Next();
|
node2 = node2->Next();
|
||||||
}
|
}
|
||||||
@@ -428,19 +428,19 @@ void wxCompositeShape::Copy(wxShape& copy)
|
|||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxDivisionShape *division = (wxDivisionShape *)node->Data();
|
wxDivisionShape *division = (wxDivisionShape *)node->Data();
|
||||||
wxNode *node1 = wxObjectCopyMapping.Find((long)division);
|
wxNode *node1 = oglObjectCopyMapping.Find((long)division);
|
||||||
wxNode *leftNode = NULL;
|
wxNode *leftNode = NULL;
|
||||||
wxNode *topNode = NULL;
|
wxNode *topNode = NULL;
|
||||||
wxNode *rightNode = NULL;
|
wxNode *rightNode = NULL;
|
||||||
wxNode *bottomNode = NULL;
|
wxNode *bottomNode = NULL;
|
||||||
if (division->GetLeftSide())
|
if (division->GetLeftSide())
|
||||||
leftNode = wxObjectCopyMapping.Find((long)division->GetLeftSide());
|
leftNode = oglObjectCopyMapping.Find((long)division->GetLeftSide());
|
||||||
if (division->GetTopSide())
|
if (division->GetTopSide())
|
||||||
topNode = wxObjectCopyMapping.Find((long)division->GetTopSide());
|
topNode = oglObjectCopyMapping.Find((long)division->GetTopSide());
|
||||||
if (division->GetRightSide())
|
if (division->GetRightSide())
|
||||||
rightNode = wxObjectCopyMapping.Find((long)division->GetRightSide());
|
rightNode = oglObjectCopyMapping.Find((long)division->GetRightSide());
|
||||||
if (division->GetBottomSide())
|
if (division->GetBottomSide())
|
||||||
bottomNode = wxObjectCopyMapping.Find((long)division->GetBottomSide());
|
bottomNode = oglObjectCopyMapping.Find((long)division->GetBottomSide());
|
||||||
if (node1)
|
if (node1)
|
||||||
{
|
{
|
||||||
wxDivisionShape *newDivision = (wxDivisionShape *)node1->Data();
|
wxDivisionShape *newDivision = (wxDivisionShape *)node1->Data();
|
||||||
@@ -527,12 +527,12 @@ void wxCompositeShape::DeleteConstraint(OGLConstraint *constraint)
|
|||||||
|
|
||||||
void wxCompositeShape::CalculateSize()
|
void wxCompositeShape::CalculateSize()
|
||||||
{
|
{
|
||||||
float maxX = (float) -999999.9;
|
double maxX = (double) -999999.9;
|
||||||
float maxY = (float) -999999.9;
|
double maxY = (double) -999999.9;
|
||||||
float minX = (float) 999999.9;
|
double minX = (double) 999999.9;
|
||||||
float minY = (float) 999999.9;
|
double minY = (double) 999999.9;
|
||||||
|
|
||||||
float w, h;
|
double w, h;
|
||||||
wxNode *node = m_children.First();
|
wxNode *node = m_children.First();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
@@ -544,20 +544,20 @@ void wxCompositeShape::CalculateSize()
|
|||||||
|
|
||||||
object->GetBoundingBoxMax(&w, &h);
|
object->GetBoundingBoxMax(&w, &h);
|
||||||
if ((object->GetX() + (w/2.0)) > maxX)
|
if ((object->GetX() + (w/2.0)) > maxX)
|
||||||
maxX = (float)(object->GetX() + (w/2.0));
|
maxX = (double)(object->GetX() + (w/2.0));
|
||||||
if ((object->GetX() - (w/2.0)) < minX)
|
if ((object->GetX() - (w/2.0)) < minX)
|
||||||
minX = (float)(object->GetX() - (w/2.0));
|
minX = (double)(object->GetX() - (w/2.0));
|
||||||
if ((object->GetY() + (h/2.0)) > maxY)
|
if ((object->GetY() + (h/2.0)) > maxY)
|
||||||
maxY = (float)(object->GetY() + (h/2.0));
|
maxY = (double)(object->GetY() + (h/2.0));
|
||||||
if ((object->GetY() - (h/2.0)) < minY)
|
if ((object->GetY() - (h/2.0)) < minY)
|
||||||
minY = (float)(object->GetY() - (h/2.0));
|
minY = (double)(object->GetY() - (h/2.0));
|
||||||
|
|
||||||
node = node->Next();
|
node = node->Next();
|
||||||
}
|
}
|
||||||
m_width = maxX - minX;
|
m_width = maxX - minX;
|
||||||
m_height = maxY - minY;
|
m_height = maxY - minY;
|
||||||
m_xpos = (float)(m_width/2.0 + minX);
|
m_xpos = (double)(m_width/2.0 + minX);
|
||||||
m_ypos = (float)(m_height/2.0 + minY);
|
m_ypos = (double)(m_height/2.0 + minY);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxCompositeShape::Recompute()
|
bool wxCompositeShape::Recompute()
|
||||||
@@ -699,8 +699,8 @@ void wxCompositeShape::ReadConstraints(wxExpr *clause, wxExprDatabase *database)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
int cType = 0;
|
int cType = 0;
|
||||||
float cXSpacing = 0.0;
|
double cXSpacing = 0.0;
|
||||||
float cYSpacing = 0.0;
|
double cYSpacing = 0.0;
|
||||||
wxString cName("");
|
wxString cName("");
|
||||||
long cId = 0;
|
long cId = 0;
|
||||||
wxShape *m_constrainingObject = NULL;
|
wxShape *m_constrainingObject = NULL;
|
||||||
@@ -846,25 +846,25 @@ void wxDivisionShape::OnDraw(wxDC& dc)
|
|||||||
dc.SetBrush(wxTRANSPARENT_BRUSH);
|
dc.SetBrush(wxTRANSPARENT_BRUSH);
|
||||||
dc.SetBackgroundMode(wxTRANSPARENT);
|
dc.SetBackgroundMode(wxTRANSPARENT);
|
||||||
|
|
||||||
float x1 = (float)(GetX() - (GetWidth()/2.0));
|
double x1 = (double)(GetX() - (GetWidth()/2.0));
|
||||||
float y1 = (float)(GetY() - (GetHeight()/2.0));
|
double y1 = (double)(GetY() - (GetHeight()/2.0));
|
||||||
float x2 = (float)(GetX() + (GetWidth()/2.0));
|
double x2 = (double)(GetX() + (GetWidth()/2.0));
|
||||||
float y2 = (float)(GetY() + (GetHeight()/2.0));
|
double y2 = (double)(GetY() + (GetHeight()/2.0));
|
||||||
|
|
||||||
// Should subtract 1 pixel if drawing under Windows
|
// Should subtract 1 pixel if drawing under Windows
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
y2 -= (float)1.0;
|
y2 -= (double)1.0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (m_leftSide)
|
if (m_leftSide)
|
||||||
{
|
{
|
||||||
dc.SetPen(m_leftSidePen);
|
dc.SetPen(m_leftSidePen);
|
||||||
dc.DrawLine(x1, y2, x1, y1);
|
dc.DrawLine(WXROUND(x1), WXROUND(y2), WXROUND(x1), WXROUND(y1));
|
||||||
}
|
}
|
||||||
if (m_topSide)
|
if (m_topSide)
|
||||||
{
|
{
|
||||||
dc.SetPen(m_topSidePen);
|
dc.SetPen(m_topSidePen);
|
||||||
dc.DrawLine(x1, y1, x2, y1);
|
dc.DrawLine(WXROUND(x1), WXROUND(y1), WXROUND(x2), WXROUND(y1));
|
||||||
}
|
}
|
||||||
|
|
||||||
// For testing purposes, draw a rectangle so we know
|
// For testing purposes, draw a rectangle so we know
|
||||||
@@ -878,10 +878,10 @@ void wxDivisionShape::OnDrawContents(wxDC& dc)
|
|||||||
wxCompositeShape::OnDrawContents(dc);
|
wxCompositeShape::OnDrawContents(dc);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxDivisionShape::OnMovePre(wxDC& dc, float x, float y, float oldx, float oldy, bool display)
|
bool wxDivisionShape::OnMovePre(wxDC& dc, double x, double y, double oldx, double oldy, bool display)
|
||||||
{
|
{
|
||||||
float diffX = x - oldx;
|
double diffX = x - oldx;
|
||||||
float diffY = y - oldy;
|
double diffY = y - oldy;
|
||||||
wxNode *node = m_children.First();
|
wxNode *node = m_children.First();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
@@ -893,12 +893,12 @@ bool wxDivisionShape::OnMovePre(wxDC& dc, float x, float y, float oldx, float ol
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDivisionShape::OnDragLeft(bool draw, float x, float y, int keys, int attachment)
|
void wxDivisionShape::OnDragLeft(bool draw, double x, double y, int keys, int attachment)
|
||||||
{
|
{
|
||||||
if ((m_sensitivity & OP_DRAG_LEFT) != OP_DRAG_LEFT)
|
if ((m_sensitivity & OP_DRAG_LEFT) != OP_DRAG_LEFT)
|
||||||
{
|
{
|
||||||
attachment = 0;
|
attachment = 0;
|
||||||
float dist;
|
double dist;
|
||||||
if (m_parent)
|
if (m_parent)
|
||||||
{
|
{
|
||||||
m_parent->HitTest(x, y, &attachment, &dist);
|
m_parent->HitTest(x, y, &attachment, &dist);
|
||||||
@@ -909,12 +909,12 @@ void wxDivisionShape::OnDragLeft(bool draw, float x, float y, int keys, int atta
|
|||||||
wxShape::OnDragLeft(draw, x, y, keys, attachment);
|
wxShape::OnDragLeft(draw, x, y, keys, attachment);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDivisionShape::OnBeginDragLeft(float x, float y, int keys, int attachment)
|
void wxDivisionShape::OnBeginDragLeft(double x, double y, int keys, int attachment)
|
||||||
{
|
{
|
||||||
if ((m_sensitivity & OP_DRAG_LEFT) != OP_DRAG_LEFT)
|
if ((m_sensitivity & OP_DRAG_LEFT) != OP_DRAG_LEFT)
|
||||||
{
|
{
|
||||||
attachment = 0;
|
attachment = 0;
|
||||||
float dist;
|
double dist;
|
||||||
if (m_parent)
|
if (m_parent)
|
||||||
{
|
{
|
||||||
m_parent->HitTest(x, y, &attachment, &dist);
|
m_parent->HitTest(x, y, &attachment, &dist);
|
||||||
@@ -926,13 +926,13 @@ void wxDivisionShape::OnBeginDragLeft(float x, float y, int keys, int attachment
|
|||||||
wxShape::OnBeginDragLeft(x, y, keys, attachment);
|
wxShape::OnBeginDragLeft(x, y, keys, attachment);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDivisionShape::OnEndDragLeft(float x, float y, int keys, int attachment)
|
void wxDivisionShape::OnEndDragLeft(double x, double y, int keys, int attachment)
|
||||||
{
|
{
|
||||||
m_canvas->ReleaseMouse();
|
m_canvas->ReleaseMouse();
|
||||||
if ((m_sensitivity & OP_DRAG_LEFT) != OP_DRAG_LEFT)
|
if ((m_sensitivity & OP_DRAG_LEFT) != OP_DRAG_LEFT)
|
||||||
{
|
{
|
||||||
attachment = 0;
|
attachment = 0;
|
||||||
float dist;
|
double dist;
|
||||||
if (m_parent)
|
if (m_parent)
|
||||||
{
|
{
|
||||||
m_parent->HitTest(x, y, &attachment, &dist);
|
m_parent->HitTest(x, y, &attachment, &dist);
|
||||||
@@ -957,7 +957,7 @@ void wxDivisionShape::OnEndDragLeft(float x, float y, int keys, int attachment)
|
|||||||
if (m_canvas && !m_canvas->GetQuickEditMode()) m_canvas->Redraw(dc);
|
if (m_canvas && !m_canvas->GetQuickEditMode()) m_canvas->Redraw(dc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDivisionShape::SetSize(float w, float h, bool recursive)
|
void wxDivisionShape::SetSize(double w, double h, bool recursive)
|
||||||
{
|
{
|
||||||
m_width = w;
|
m_width = w;
|
||||||
m_height = h;
|
m_height = h;
|
||||||
@@ -1022,7 +1022,7 @@ void wxDivisionShape::ReadPrologAttributes(wxExpr *clause)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Experimental
|
// Experimental
|
||||||
void wxDivisionShape::OnRightClick(float x, float y, int keys, int attachment)
|
void wxDivisionShape::OnRightClick(double x, double y, int keys, int attachment)
|
||||||
{
|
{
|
||||||
if (keys & KEY_CTRL)
|
if (keys & KEY_CTRL)
|
||||||
{
|
{
|
||||||
@@ -1046,7 +1046,7 @@ void wxDivisionShape::OnRightClick(float x, float y, int keys, int attachment)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
attachment = 0;
|
attachment = 0;
|
||||||
float dist;
|
double dist;
|
||||||
if (m_parent)
|
if (m_parent)
|
||||||
{
|
{
|
||||||
m_parent->HitTest(x, y, &attachment, &dist);
|
m_parent->HitTest(x, y, &attachment, &dist);
|
||||||
@@ -1061,11 +1061,11 @@ void wxDivisionShape::OnRightClick(float x, float y, int keys, int attachment)
|
|||||||
bool wxDivisionShape::Divide(int direction)
|
bool wxDivisionShape::Divide(int direction)
|
||||||
{
|
{
|
||||||
// Calculate existing top-left, bottom-right
|
// Calculate existing top-left, bottom-right
|
||||||
float x1 = (float)(GetX() - (GetWidth()/2.0));
|
double x1 = (double)(GetX() - (GetWidth()/2.0));
|
||||||
float y1 = (float)(GetY() - (GetHeight()/2.0));
|
double y1 = (double)(GetY() - (GetHeight()/2.0));
|
||||||
wxCompositeShape *compositeParent = (wxCompositeShape *)GetParent();
|
wxCompositeShape *compositeParent = (wxCompositeShape *)GetParent();
|
||||||
float oldWidth = GetWidth();
|
double oldWidth = GetWidth();
|
||||||
float oldHeight = GetHeight();
|
double oldHeight = GetHeight();
|
||||||
if (Selected())
|
if (Selected())
|
||||||
Select(FALSE);
|
Select(FALSE);
|
||||||
|
|
||||||
@@ -1076,10 +1076,10 @@ bool wxDivisionShape::Divide(int direction)
|
|||||||
{
|
{
|
||||||
// Dividing vertically means notionally putting a horizontal line through it.
|
// Dividing vertically means notionally putting a horizontal line through it.
|
||||||
// Break existing piece into two.
|
// Break existing piece into two.
|
||||||
float newXPos1 = GetX();
|
double newXPos1 = GetX();
|
||||||
float newYPos1 = (float)(y1 + (GetHeight()/4.0));
|
double newYPos1 = (double)(y1 + (GetHeight()/4.0));
|
||||||
float newXPos2 = GetX();
|
double newXPos2 = GetX();
|
||||||
float newYPos2 = (float)(y1 + (3.0*GetHeight()/4.0));
|
double newYPos2 = (double)(y1 + (3.0*GetHeight()/4.0));
|
||||||
wxDivisionShape *newDivision = compositeParent->OnCreateDivision();
|
wxDivisionShape *newDivision = compositeParent->OnCreateDivision();
|
||||||
newDivision->Show(TRUE);
|
newDivision->Show(TRUE);
|
||||||
|
|
||||||
@@ -1117,20 +1117,20 @@ bool wxDivisionShape::Divide(int direction)
|
|||||||
m_handleSide = DIVISION_SIDE_BOTTOM;
|
m_handleSide = DIVISION_SIDE_BOTTOM;
|
||||||
newDivision->SetHandleSide(DIVISION_SIDE_TOP);
|
newDivision->SetHandleSide(DIVISION_SIDE_TOP);
|
||||||
|
|
||||||
SetSize(oldWidth, (float)(oldHeight/2.0));
|
SetSize(oldWidth, (double)(oldHeight/2.0));
|
||||||
Move(dc, newXPos1, newYPos1);
|
Move(dc, newXPos1, newYPos1);
|
||||||
|
|
||||||
newDivision->SetSize(oldWidth, (float)(oldHeight/2.0));
|
newDivision->SetSize(oldWidth, (double)(oldHeight/2.0));
|
||||||
newDivision->Move(dc, newXPos2, newYPos2);
|
newDivision->Move(dc, newXPos2, newYPos2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Dividing horizontally means notionally putting a vertical line through it.
|
// Dividing horizontally means notionally putting a vertical line through it.
|
||||||
// Break existing piece into two.
|
// Break existing piece into two.
|
||||||
float newXPos1 = (float)(x1 + (GetWidth()/4.0));
|
double newXPos1 = (double)(x1 + (GetWidth()/4.0));
|
||||||
float newYPos1 = GetY();
|
double newYPos1 = GetY();
|
||||||
float newXPos2 = (float)(x1 + (3.0*GetWidth()/4.0));
|
double newXPos2 = (double)(x1 + (3.0*GetWidth()/4.0));
|
||||||
float newYPos2 = GetY();
|
double newYPos2 = GetY();
|
||||||
wxDivisionShape *newDivision = compositeParent->OnCreateDivision();
|
wxDivisionShape *newDivision = compositeParent->OnCreateDivision();
|
||||||
newDivision->Show(TRUE);
|
newDivision->Show(TRUE);
|
||||||
|
|
||||||
@@ -1158,10 +1158,10 @@ bool wxDivisionShape::Divide(int direction)
|
|||||||
m_handleSide = DIVISION_SIDE_RIGHT;
|
m_handleSide = DIVISION_SIDE_RIGHT;
|
||||||
newDivision->SetHandleSide(DIVISION_SIDE_LEFT);
|
newDivision->SetHandleSide(DIVISION_SIDE_LEFT);
|
||||||
|
|
||||||
SetSize((float)(oldWidth/2.0), oldHeight);
|
SetSize((double)(oldWidth/2.0), oldHeight);
|
||||||
Move(dc, newXPos1, newYPos1);
|
Move(dc, newXPos1, newYPos1);
|
||||||
|
|
||||||
newDivision->SetSize((float)(oldWidth/2.0), oldHeight);
|
newDivision->SetSize((double)(oldWidth/2.0), oldHeight);
|
||||||
newDivision->Move(dc, newXPos2, newYPos2);
|
newDivision->Move(dc, newXPos2, newYPos2);
|
||||||
}
|
}
|
||||||
if (compositeParent->Selected())
|
if (compositeParent->Selected())
|
||||||
@@ -1182,15 +1182,15 @@ void wxDivisionShape::MakeControlPoints()
|
|||||||
|
|
||||||
void wxDivisionShape::MakeMandatoryControlPoints()
|
void wxDivisionShape::MakeMandatoryControlPoints()
|
||||||
{
|
{
|
||||||
float maxX, maxY;
|
double maxX, maxY;
|
||||||
|
|
||||||
GetBoundingBoxMax(&maxX, &maxY);
|
GetBoundingBoxMax(&maxX, &maxY);
|
||||||
float x, y;
|
double x, y;
|
||||||
int direction;
|
int direction;
|
||||||
/*
|
/*
|
||||||
if (m_leftSide)
|
if (m_leftSide)
|
||||||
{
|
{
|
||||||
x = (float)(-maxX/2.0);
|
x = (double)(-maxX/2.0);
|
||||||
y = 0.0;
|
y = 0.0;
|
||||||
wxDivisionControlPoint *control = new wxDivisionControlPoint(m_canvas, this, CONTROL_POINT_SIZE, x, y,
|
wxDivisionControlPoint *control = new wxDivisionControlPoint(m_canvas, this, CONTROL_POINT_SIZE, x, y,
|
||||||
CONTROL_POINT_HORIZONTAL);
|
CONTROL_POINT_HORIZONTAL);
|
||||||
@@ -1200,7 +1200,7 @@ void wxDivisionShape::MakeMandatoryControlPoints()
|
|||||||
if (m_topSide)
|
if (m_topSide)
|
||||||
{
|
{
|
||||||
x = 0.0;
|
x = 0.0;
|
||||||
y = (float)(-maxY/2.0);
|
y = (double)(-maxY/2.0);
|
||||||
wxDivisionControlPoint *control = new wxDivisionControlPoint(m_canvas, this, CONTROL_POINT_SIZE, x, y,
|
wxDivisionControlPoint *control = new wxDivisionControlPoint(m_canvas, this, CONTROL_POINT_SIZE, x, y,
|
||||||
CONTROL_POINT_VERTICAL);
|
CONTROL_POINT_VERTICAL);
|
||||||
m_canvas->AddShape(control);
|
m_canvas->AddShape(control);
|
||||||
@@ -1211,7 +1211,7 @@ void wxDivisionShape::MakeMandatoryControlPoints()
|
|||||||
{
|
{
|
||||||
case DIVISION_SIDE_LEFT:
|
case DIVISION_SIDE_LEFT:
|
||||||
{
|
{
|
||||||
x = (float)(-maxX/2.0);
|
x = (double)(-maxX/2.0);
|
||||||
y = 0.0;
|
y = 0.0;
|
||||||
direction = CONTROL_POINT_HORIZONTAL;
|
direction = CONTROL_POINT_HORIZONTAL;
|
||||||
break;
|
break;
|
||||||
@@ -1219,13 +1219,13 @@ void wxDivisionShape::MakeMandatoryControlPoints()
|
|||||||
case DIVISION_SIDE_TOP:
|
case DIVISION_SIDE_TOP:
|
||||||
{
|
{
|
||||||
x = 0.0;
|
x = 0.0;
|
||||||
y = (float)(-maxY/2.0);
|
y = (double)(-maxY/2.0);
|
||||||
direction = CONTROL_POINT_VERTICAL;
|
direction = CONTROL_POINT_VERTICAL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case DIVISION_SIDE_RIGHT:
|
case DIVISION_SIDE_RIGHT:
|
||||||
{
|
{
|
||||||
x = (float)(maxX/2.0);
|
x = (double)(maxX/2.0);
|
||||||
y = 0.0;
|
y = 0.0;
|
||||||
direction = CONTROL_POINT_HORIZONTAL;
|
direction = CONTROL_POINT_HORIZONTAL;
|
||||||
break;
|
break;
|
||||||
@@ -1233,7 +1233,7 @@ void wxDivisionShape::MakeMandatoryControlPoints()
|
|||||||
case DIVISION_SIDE_BOTTOM:
|
case DIVISION_SIDE_BOTTOM:
|
||||||
{
|
{
|
||||||
x = 0.0;
|
x = 0.0;
|
||||||
y = (float)(maxY/2.0);
|
y = (double)(maxY/2.0);
|
||||||
direction = CONTROL_POINT_VERTICAL;
|
direction = CONTROL_POINT_VERTICAL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1259,7 +1259,7 @@ void wxDivisionShape::ResetMandatoryControlPoints()
|
|||||||
if (m_controlPoints.Number() < 1)
|
if (m_controlPoints.Number() < 1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
float maxX, maxY;
|
double maxX, maxY;
|
||||||
|
|
||||||
GetBoundingBoxMax(&maxX, &maxY);
|
GetBoundingBoxMax(&maxX, &maxY);
|
||||||
/*
|
/*
|
||||||
@@ -1269,11 +1269,11 @@ void wxDivisionShape::ResetMandatoryControlPoints()
|
|||||||
wxDivisionControlPoint *control = (wxDivisionControlPoint *)node->Data();
|
wxDivisionControlPoint *control = (wxDivisionControlPoint *)node->Data();
|
||||||
if (control->type == CONTROL_POINT_HORIZONTAL)
|
if (control->type == CONTROL_POINT_HORIZONTAL)
|
||||||
{
|
{
|
||||||
control->xoffset = (float)(-maxX/2.0); control->m_yoffset = 0.0;
|
control->xoffset = (double)(-maxX/2.0); control->m_yoffset = 0.0;
|
||||||
}
|
}
|
||||||
else if (control->type == CONTROL_POINT_VERTICAL)
|
else if (control->type == CONTROL_POINT_VERTICAL)
|
||||||
{
|
{
|
||||||
control->xoffset = 0.0; control->m_yoffset = (float)(-maxY/2.0);
|
control->xoffset = 0.0; control->m_yoffset = (double)(-maxY/2.0);
|
||||||
}
|
}
|
||||||
node = node->Next();
|
node = node->Next();
|
||||||
}
|
}
|
||||||
@@ -1282,40 +1282,40 @@ void wxDivisionShape::ResetMandatoryControlPoints()
|
|||||||
if ((m_handleSide == DIVISION_SIDE_LEFT) && node)
|
if ((m_handleSide == DIVISION_SIDE_LEFT) && node)
|
||||||
{
|
{
|
||||||
wxDivisionControlPoint *control = (wxDivisionControlPoint *)node->Data();
|
wxDivisionControlPoint *control = (wxDivisionControlPoint *)node->Data();
|
||||||
control->m_xoffset = (float)(-maxX/2.0); control->m_yoffset = 0.0;
|
control->m_xoffset = (double)(-maxX/2.0); control->m_yoffset = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((m_handleSide == DIVISION_SIDE_TOP) && node)
|
if ((m_handleSide == DIVISION_SIDE_TOP) && node)
|
||||||
{
|
{
|
||||||
wxDivisionControlPoint *control = (wxDivisionControlPoint *)node->Data();
|
wxDivisionControlPoint *control = (wxDivisionControlPoint *)node->Data();
|
||||||
control->m_xoffset = 0.0; control->m_yoffset = (float)(-maxY/2.0);
|
control->m_xoffset = 0.0; control->m_yoffset = (double)(-maxY/2.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((m_handleSide == DIVISION_SIDE_RIGHT) && node)
|
if ((m_handleSide == DIVISION_SIDE_RIGHT) && node)
|
||||||
{
|
{
|
||||||
wxDivisionControlPoint *control = (wxDivisionControlPoint *)node->Data();
|
wxDivisionControlPoint *control = (wxDivisionControlPoint *)node->Data();
|
||||||
control->m_xoffset = (float)(maxX/2.0); control->m_yoffset = 0.0;
|
control->m_xoffset = (double)(maxX/2.0); control->m_yoffset = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((m_handleSide == DIVISION_SIDE_BOTTOM) && node)
|
if ((m_handleSide == DIVISION_SIDE_BOTTOM) && node)
|
||||||
{
|
{
|
||||||
wxDivisionControlPoint *control = (wxDivisionControlPoint *)node->Data();
|
wxDivisionControlPoint *control = (wxDivisionControlPoint *)node->Data();
|
||||||
control->m_xoffset = 0.0; control->m_yoffset = (float)(maxY/2.0);
|
control->m_xoffset = 0.0; control->m_yoffset = (double)(maxY/2.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Adjust a side, returning FALSE if it's not physically possible.
|
// Adjust a side, returning FALSE if it's not physically possible.
|
||||||
bool wxDivisionShape::AdjustLeft(float left, bool test)
|
bool wxDivisionShape::AdjustLeft(double left, bool test)
|
||||||
{
|
{
|
||||||
float x2 = (float)(GetX() + (GetWidth()/2.0));
|
double x2 = (double)(GetX() + (GetWidth()/2.0));
|
||||||
|
|
||||||
if (left >= x2)
|
if (left >= x2)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (test)
|
if (test)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
float newW = x2 - left;
|
double newW = x2 - left;
|
||||||
float newX = (float)(left + newW/2.0);
|
double newX = (double)(left + newW/2.0);
|
||||||
SetSize(newW, GetHeight());
|
SetSize(newW, GetHeight());
|
||||||
|
|
||||||
wxClientDC dc(GetCanvas());
|
wxClientDC dc(GetCanvas());
|
||||||
@@ -1326,17 +1326,17 @@ bool wxDivisionShape::AdjustLeft(float left, bool test)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxDivisionShape::AdjustTop(float top, bool test)
|
bool wxDivisionShape::AdjustTop(double top, bool test)
|
||||||
{
|
{
|
||||||
float y2 = (float)(GetY() + (GetHeight()/2.0));
|
double y2 = (double)(GetY() + (GetHeight()/2.0));
|
||||||
|
|
||||||
if (top >= y2)
|
if (top >= y2)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (test)
|
if (test)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
float newH = y2 - top;
|
double newH = y2 - top;
|
||||||
float newY = (float)(top + newH/2.0);
|
double newY = (double)(top + newH/2.0);
|
||||||
SetSize(GetWidth(), newH);
|
SetSize(GetWidth(), newH);
|
||||||
|
|
||||||
wxClientDC dc(GetCanvas());
|
wxClientDC dc(GetCanvas());
|
||||||
@@ -1347,17 +1347,17 @@ bool wxDivisionShape::AdjustTop(float top, bool test)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxDivisionShape::AdjustRight(float right, bool test)
|
bool wxDivisionShape::AdjustRight(double right, bool test)
|
||||||
{
|
{
|
||||||
float x1 = (float)(GetX() - (GetWidth()/2.0));
|
double x1 = (double)(GetX() - (GetWidth()/2.0));
|
||||||
|
|
||||||
if (right <= x1)
|
if (right <= x1)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (test)
|
if (test)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
float newW = right - x1;
|
double newW = right - x1;
|
||||||
float newX = (float)(x1 + newW/2.0);
|
double newX = (double)(x1 + newW/2.0);
|
||||||
SetSize(newW, GetHeight());
|
SetSize(newW, GetHeight());
|
||||||
|
|
||||||
wxClientDC dc(GetCanvas());
|
wxClientDC dc(GetCanvas());
|
||||||
@@ -1368,17 +1368,17 @@ bool wxDivisionShape::AdjustRight(float right, bool test)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxDivisionShape::AdjustBottom(float bottom, bool test)
|
bool wxDivisionShape::AdjustBottom(double bottom, bool test)
|
||||||
{
|
{
|
||||||
float y1 = (float)(GetY() - (GetHeight()/2.0));
|
double y1 = (double)(GetY() - (GetHeight()/2.0));
|
||||||
|
|
||||||
if (bottom <= y1)
|
if (bottom <= y1)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (test)
|
if (test)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
float newH = bottom - y1;
|
double newH = bottom - y1;
|
||||||
float newY = (float)(y1 + newH/2.0);
|
double newY = (double)(y1 + newH/2.0);
|
||||||
SetSize(GetWidth(), newH);
|
SetSize(GetWidth(), newH);
|
||||||
|
|
||||||
wxClientDC dc(GetCanvas());
|
wxClientDC dc(GetCanvas());
|
||||||
@@ -1389,7 +1389,7 @@ bool wxDivisionShape::AdjustBottom(float bottom, bool test)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxDivisionControlPoint::wxDivisionControlPoint(wxShapeCanvas *the_canvas, wxShape *object, float size, float the_xoffset, float the_yoffset, int the_type):
|
wxDivisionControlPoint::wxDivisionControlPoint(wxShapeCanvas *the_canvas, wxShape *object, double size, double the_xoffset, double the_yoffset, int the_type):
|
||||||
wxControlPoint(the_canvas, object, size, the_xoffset, the_yoffset, the_type)
|
wxControlPoint(the_canvas, object, size, the_xoffset, the_yoffset, the_type)
|
||||||
{
|
{
|
||||||
SetEraseObject(FALSE);
|
SetEraseObject(FALSE);
|
||||||
@@ -1399,18 +1399,18 @@ wxDivisionControlPoint::~wxDivisionControlPoint()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static float originalX = 0.0;
|
static double originalX = 0.0;
|
||||||
static float originalY = 0.0;
|
static double originalY = 0.0;
|
||||||
static float originalW = 0.0;
|
static double originalW = 0.0;
|
||||||
static float originalH = 0.0;
|
static double originalH = 0.0;
|
||||||
|
|
||||||
// Implement resizing of canvas object
|
// Implement resizing of canvas object
|
||||||
void wxDivisionControlPoint::OnDragLeft(bool draw, float x, float y, int keys, int attachment)
|
void wxDivisionControlPoint::OnDragLeft(bool draw, double x, double y, int keys, int attachment)
|
||||||
{
|
{
|
||||||
wxControlPoint::OnDragLeft(draw, x, y, keys, attachment);
|
wxControlPoint::OnDragLeft(draw, x, y, keys, attachment);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDivisionControlPoint::OnBeginDragLeft(float x, float y, int keys, int attachment)
|
void wxDivisionControlPoint::OnBeginDragLeft(double x, double y, int keys, int attachment)
|
||||||
{
|
{
|
||||||
wxDivisionShape *division = (wxDivisionShape *)m_shape;
|
wxDivisionShape *division = (wxDivisionShape *)m_shape;
|
||||||
originalX = division->GetX();
|
originalX = division->GetX();
|
||||||
@@ -1421,7 +1421,7 @@ void wxDivisionControlPoint::OnBeginDragLeft(float x, float y, int keys, int att
|
|||||||
wxControlPoint::OnBeginDragLeft(x, y, keys, attachment);
|
wxControlPoint::OnBeginDragLeft(x, y, keys, attachment);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDivisionControlPoint::OnEndDragLeft(float x, float y, int keys, int attachment)
|
void wxDivisionControlPoint::OnEndDragLeft(double x, double y, int keys, int attachment)
|
||||||
{
|
{
|
||||||
wxControlPoint::OnEndDragLeft(x, y, keys, attachment);
|
wxControlPoint::OnEndDragLeft(x, y, keys, attachment);
|
||||||
|
|
||||||
@@ -1432,16 +1432,16 @@ void wxDivisionControlPoint::OnEndDragLeft(float x, float y, int keys, int attac
|
|||||||
wxCompositeShape *divisionParent = (wxCompositeShape *)division->GetParent();
|
wxCompositeShape *divisionParent = (wxCompositeShape *)division->GetParent();
|
||||||
|
|
||||||
// Need to check it's within the bounds of the parent composite.
|
// Need to check it's within the bounds of the parent composite.
|
||||||
float x1 = (float)(divisionParent->GetX() - (divisionParent->GetWidth()/2.0));
|
double x1 = (double)(divisionParent->GetX() - (divisionParent->GetWidth()/2.0));
|
||||||
float y1 = (float)(divisionParent->GetY() - (divisionParent->GetHeight()/2.0));
|
double y1 = (double)(divisionParent->GetY() - (divisionParent->GetHeight()/2.0));
|
||||||
float x2 = (float)(divisionParent->GetX() + (divisionParent->GetWidth()/2.0));
|
double x2 = (double)(divisionParent->GetX() + (divisionParent->GetWidth()/2.0));
|
||||||
float y2 = (float)(divisionParent->GetY() + (divisionParent->GetHeight()/2.0));
|
double y2 = (double)(divisionParent->GetY() + (divisionParent->GetHeight()/2.0));
|
||||||
|
|
||||||
// Need to check it has not made the division zero or negative width/height
|
// Need to check it has not made the division zero or negative width/height
|
||||||
float dx1 = (float)(division->GetX() - (division->GetWidth()/2.0));
|
double dx1 = (double)(division->GetX() - (division->GetWidth()/2.0));
|
||||||
float dy1 = (float)(division->GetY() - (division->GetHeight()/2.0));
|
double dy1 = (double)(division->GetY() - (division->GetHeight()/2.0));
|
||||||
float dx2 = (float)(division->GetX() + (division->GetWidth()/2.0));
|
double dx2 = (double)(division->GetX() + (division->GetWidth()/2.0));
|
||||||
float dy2 = (float)(division->GetY() + (division->GetHeight()/2.0));
|
double dy2 = (double)(division->GetY() + (division->GetHeight()/2.0));
|
||||||
|
|
||||||
bool success = TRUE;
|
bool success = TRUE;
|
||||||
switch (division->GetHandleSide())
|
switch (division->GetHandleSide())
|
||||||
@@ -1512,7 +1512,7 @@ void wxDivisionControlPoint::OnEndDragLeft(float x, float y, int keys, int attac
|
|||||||
If size goes to zero or end position is other side of start position,
|
If size goes to zero or end position is other side of start position,
|
||||||
resize to original size and return.
|
resize to original size and return.
|
||||||
*/
|
*/
|
||||||
bool wxDivisionShape::ResizeAdjoining(int side, float newPos, bool test)
|
bool wxDivisionShape::ResizeAdjoining(int side, double newPos, bool test)
|
||||||
{
|
{
|
||||||
wxCompositeShape *divisionParent = (wxCompositeShape *)GetParent();
|
wxCompositeShape *divisionParent = (wxCompositeShape *)GetParent();
|
||||||
wxNode *node = divisionParent->GetDivisions().First();
|
wxNode *node = divisionParent->GetDivisions().First();
|
||||||
@@ -1714,7 +1714,7 @@ void wxDivisionShape::EditEdge(int side)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Popup menu
|
// Popup menu
|
||||||
void wxDivisionShape::PopupMenu(float x, float y)
|
void wxDivisionShape::PopupMenu(double x, double y)
|
||||||
{
|
{
|
||||||
oglPopupDivisionMenu->SetClientData((char *)this);
|
oglPopupDivisionMenu->SetClientData((char *)this);
|
||||||
if (m_leftSide)
|
if (m_leftSide)
|
||||||
|
@@ -35,14 +35,14 @@ public:
|
|||||||
void OnDraw(wxDC& dc);
|
void OnDraw(wxDC& dc);
|
||||||
void OnDrawContents(wxDC& dc);
|
void OnDrawContents(wxDC& dc);
|
||||||
void OnErase(wxDC& dc);
|
void OnErase(wxDC& dc);
|
||||||
bool OnMovePre(wxDC& dc, float x, float y, float oldX, float oldY, bool display = TRUE);
|
bool OnMovePre(wxDC& dc, double x, double y, double oldX, double oldY, bool display = TRUE);
|
||||||
void OnDragLeft(bool draw, float x, float y, int keys, int attachment = 0);
|
void OnDragLeft(bool draw, double x, double y, int keys, int attachment = 0);
|
||||||
void OnBeginDragLeft(float x, float y, int keys, int attachment = 0);
|
void OnBeginDragLeft(double x, double y, int keys, int attachment = 0);
|
||||||
void OnEndDragLeft(float x, float 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
|
// Returns TRUE if it settled down
|
||||||
bool Recompute();
|
bool Recompute();
|
||||||
@@ -100,8 +100,8 @@ public:
|
|||||||
inline wxList& GetConstraints() const { return (wxList&) m_constraints; }
|
inline wxList& GetConstraints() const { return (wxList&) m_constraints; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
float m_oldX;
|
double m_oldX;
|
||||||
float m_oldY;
|
double m_oldY;
|
||||||
wxList m_constraints;
|
wxList m_constraints;
|
||||||
wxList m_divisions; // In case it's a container
|
wxList m_divisions; // In case it's a container
|
||||||
};
|
};
|
||||||
@@ -133,16 +133,16 @@ class wxDivisionShape: public wxCompositeShape
|
|||||||
|
|
||||||
void OnDraw(wxDC& dc);
|
void OnDraw(wxDC& dc);
|
||||||
void OnDrawContents(wxDC& dc);
|
void OnDrawContents(wxDC& dc);
|
||||||
bool OnMovePre(wxDC& dc, float x, float y, float oldX, float oldY, bool display = TRUE);
|
bool OnMovePre(wxDC& dc, double x, double y, double oldX, double oldY, bool display = TRUE);
|
||||||
void OnDragLeft(bool draw, float x, float y, int keys, int attachment = 0);
|
void OnDragLeft(bool draw, double x, double y, int keys, int attachment = 0);
|
||||||
void OnBeginDragLeft(float x, float y, int keys, int attachment = 0);
|
void OnBeginDragLeft(double x, double y, int keys, int attachment = 0);
|
||||||
void OnEndDragLeft(float x, float 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
|
// Don't want this kind of composite to resize its subdiagrams, so
|
||||||
// override composite's SetSize.
|
// 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
|
// Similarly for calculating size: it's fixed at whatever SetSize
|
||||||
// set it to, not in terms of children.
|
// 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,
|
// Resize adjoining divisions at the given side. If test is TRUE,
|
||||||
// just see whether it's possible for each adjoining region,
|
// just see whether it's possible for each adjoining region,
|
||||||
// returning FALSE if it's not.
|
// 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.
|
// Adjust a side, returning FALSE if it's not physically possible.
|
||||||
bool AdjustLeft(float left, bool test);
|
bool AdjustLeft(double left, bool test);
|
||||||
bool AdjustTop(float top, bool test);
|
bool AdjustTop(double top, bool test);
|
||||||
bool AdjustRight(float right, bool test);
|
bool AdjustRight(double right, bool test);
|
||||||
bool AdjustBottom(float bottom, bool test);
|
bool AdjustBottom(double bottom, bool test);
|
||||||
|
|
||||||
// Edit style of left or top side
|
// Edit style of left or top side
|
||||||
void EditEdge(int side);
|
void EditEdge(int side);
|
||||||
|
|
||||||
// Popup menu
|
// Popup menu
|
||||||
void PopupMenu(float x, float y);
|
void PopupMenu(double x, double y);
|
||||||
|
|
||||||
inline void SetLeftSide(wxDivisionShape *shape) { m_leftSide = shape; }
|
inline void SetLeftSide(wxDivisionShape *shape) { m_leftSide = shape; }
|
||||||
inline void SetTopSide(wxDivisionShape *shape) { m_topSide = shape; }
|
inline void SetTopSide(wxDivisionShape *shape) { m_topSide = shape; }
|
||||||
inline void SetRightSide(wxDivisionShape *shape) { m_rightSide = shape; }
|
inline void SetRightSide(wxDivisionShape *shape) { m_rightSide = shape; }
|
||||||
|
@@ -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));
|
bool eq = ((b <= a + marg) && (b >= a - marg));
|
||||||
return eq;
|
return eq;
|
||||||
@@ -164,7 +164,7 @@ bool OGLConstraint::Equals(float a, float b)
|
|||||||
// Return TRUE if anything changed
|
// Return TRUE if anything changed
|
||||||
bool OGLConstraint::Evaluate()
|
bool OGLConstraint::Evaluate()
|
||||||
{
|
{
|
||||||
float maxWidth, maxHeight, minWidth, minHeight, x, y;
|
double maxWidth, maxHeight, minWidth, minHeight, x, y;
|
||||||
m_constrainingObject->GetBoundingBoxMax(&maxWidth, &maxHeight);
|
m_constrainingObject->GetBoundingBoxMax(&maxWidth, &maxHeight);
|
||||||
m_constrainingObject->GetBoundingBoxMin(&minWidth, &minHeight);
|
m_constrainingObject->GetBoundingBoxMin(&minWidth, &minHeight);
|
||||||
x = m_constrainingObject->GetX();
|
x = m_constrainingObject->GetX();
|
||||||
@@ -178,30 +178,30 @@ bool OGLConstraint::Evaluate()
|
|||||||
case gyCONSTRAINT_CENTRED_VERTICALLY:
|
case gyCONSTRAINT_CENTRED_VERTICALLY:
|
||||||
{
|
{
|
||||||
int n = m_constrainedObjects.Number();
|
int n = m_constrainedObjects.Number();
|
||||||
float totalObjectHeight = 0.0;
|
double totalObjectHeight = 0.0;
|
||||||
wxNode *node = m_constrainedObjects.First();
|
wxNode *node = m_constrainedObjects.First();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxShape *constrainedObject = (wxShape *)node->Data();
|
wxShape *constrainedObject = (wxShape *)node->Data();
|
||||||
|
|
||||||
float width2, height2;
|
double width2, height2;
|
||||||
constrainedObject->GetBoundingBoxMax(&width2, &height2);
|
constrainedObject->GetBoundingBoxMax(&width2, &height2);
|
||||||
totalObjectHeight += height2;
|
totalObjectHeight += height2;
|
||||||
node = node->Next();
|
node = node->Next();
|
||||||
}
|
}
|
||||||
float startY;
|
double startY;
|
||||||
float spacingY;
|
double spacingY;
|
||||||
// Check if within the constraining object...
|
// Check if within the constraining object...
|
||||||
if ((totalObjectHeight + (n + 1)*m_ySpacing) <= minHeight)
|
if ((totalObjectHeight + (n + 1)*m_ySpacing) <= minHeight)
|
||||||
{
|
{
|
||||||
spacingY = (float)((minHeight - totalObjectHeight)/(n + 1));
|
spacingY = (double)((minHeight - totalObjectHeight)/(n + 1));
|
||||||
startY = (float)(y - (minHeight/2.0));
|
startY = (double)(y - (minHeight/2.0));
|
||||||
}
|
}
|
||||||
// Otherwise, use default spacing
|
// Otherwise, use default spacing
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
spacingY = m_ySpacing;
|
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
|
// Now position the objects
|
||||||
@@ -210,15 +210,15 @@ bool OGLConstraint::Evaluate()
|
|||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxShape *constrainedObject = (wxShape *)node->Data();
|
wxShape *constrainedObject = (wxShape *)node->Data();
|
||||||
float width2, height2;
|
double width2, height2;
|
||||||
constrainedObject->GetBoundingBoxMax(&width2, &height2);
|
constrainedObject->GetBoundingBoxMax(&width2, &height2);
|
||||||
startY += (float)(spacingY + (height2/2.0));
|
startY += (double)(spacingY + (height2/2.0));
|
||||||
if (!Equals(startY, constrainedObject->GetY()))
|
if (!Equals(startY, constrainedObject->GetY()))
|
||||||
{
|
{
|
||||||
constrainedObject->Move(dc, constrainedObject->GetX(), startY, FALSE);
|
constrainedObject->Move(dc, constrainedObject->GetX(), startY, FALSE);
|
||||||
changed = TRUE;
|
changed = TRUE;
|
||||||
}
|
}
|
||||||
startY += (float)(height2/2.0);
|
startY += (double)(height2/2.0);
|
||||||
node = node->Next();
|
node = node->Next();
|
||||||
}
|
}
|
||||||
return changed;
|
return changed;
|
||||||
@@ -226,30 +226,30 @@ bool OGLConstraint::Evaluate()
|
|||||||
case gyCONSTRAINT_CENTRED_HORIZONTALLY:
|
case gyCONSTRAINT_CENTRED_HORIZONTALLY:
|
||||||
{
|
{
|
||||||
int n = m_constrainedObjects.Number();
|
int n = m_constrainedObjects.Number();
|
||||||
float totalObjectWidth = 0.0;
|
double totalObjectWidth = 0.0;
|
||||||
wxNode *node = m_constrainedObjects.First();
|
wxNode *node = m_constrainedObjects.First();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxShape *constrainedObject = (wxShape *)node->Data();
|
wxShape *constrainedObject = (wxShape *)node->Data();
|
||||||
|
|
||||||
float width2, height2;
|
double width2, height2;
|
||||||
constrainedObject->GetBoundingBoxMax(&width2, &height2);
|
constrainedObject->GetBoundingBoxMax(&width2, &height2);
|
||||||
totalObjectWidth += width2;
|
totalObjectWidth += width2;
|
||||||
node = node->Next();
|
node = node->Next();
|
||||||
}
|
}
|
||||||
float startX;
|
double startX;
|
||||||
float spacingX;
|
double spacingX;
|
||||||
// Check if within the constraining object...
|
// Check if within the constraining object...
|
||||||
if ((totalObjectWidth + (n + 1)*m_xSpacing) <= minWidth)
|
if ((totalObjectWidth + (n + 1)*m_xSpacing) <= minWidth)
|
||||||
{
|
{
|
||||||
spacingX = (float)((minWidth - totalObjectWidth)/(n + 1));
|
spacingX = (double)((minWidth - totalObjectWidth)/(n + 1));
|
||||||
startX = (float)(x - (minWidth/2.0));
|
startX = (double)(x - (minWidth/2.0));
|
||||||
}
|
}
|
||||||
// Otherwise, use default spacing
|
// Otherwise, use default spacing
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
spacingX = m_xSpacing;
|
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
|
// Now position the objects
|
||||||
@@ -258,15 +258,15 @@ bool OGLConstraint::Evaluate()
|
|||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxShape *constrainedObject = (wxShape *)node->Data();
|
wxShape *constrainedObject = (wxShape *)node->Data();
|
||||||
float width2, height2;
|
double width2, height2;
|
||||||
constrainedObject->GetBoundingBoxMax(&width2, &height2);
|
constrainedObject->GetBoundingBoxMax(&width2, &height2);
|
||||||
startX += (float)(spacingX + (width2/2.0));
|
startX += (double)(spacingX + (width2/2.0));
|
||||||
if (!Equals(startX, constrainedObject->GetX()))
|
if (!Equals(startX, constrainedObject->GetX()))
|
||||||
{
|
{
|
||||||
constrainedObject->Move(dc, startX, constrainedObject->GetY(), FALSE);
|
constrainedObject->Move(dc, startX, constrainedObject->GetY(), FALSE);
|
||||||
changed = TRUE;
|
changed = TRUE;
|
||||||
}
|
}
|
||||||
startX += (float)(width2/2.0);
|
startX += (double)(width2/2.0);
|
||||||
node = node->Next();
|
node = node->Next();
|
||||||
}
|
}
|
||||||
return changed;
|
return changed;
|
||||||
@@ -274,48 +274,48 @@ bool OGLConstraint::Evaluate()
|
|||||||
case gyCONSTRAINT_CENTRED_BOTH:
|
case gyCONSTRAINT_CENTRED_BOTH:
|
||||||
{
|
{
|
||||||
int n = m_constrainedObjects.Number();
|
int n = m_constrainedObjects.Number();
|
||||||
float totalObjectWidth = 0.0;
|
double totalObjectWidth = 0.0;
|
||||||
float totalObjectHeight = 0.0;
|
double totalObjectHeight = 0.0;
|
||||||
wxNode *node = m_constrainedObjects.First();
|
wxNode *node = m_constrainedObjects.First();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxShape *constrainedObject = (wxShape *)node->Data();
|
wxShape *constrainedObject = (wxShape *)node->Data();
|
||||||
|
|
||||||
float width2, height2;
|
double width2, height2;
|
||||||
constrainedObject->GetBoundingBoxMax(&width2, &height2);
|
constrainedObject->GetBoundingBoxMax(&width2, &height2);
|
||||||
totalObjectWidth += width2;
|
totalObjectWidth += width2;
|
||||||
totalObjectHeight += height2;
|
totalObjectHeight += height2;
|
||||||
node = node->Next();
|
node = node->Next();
|
||||||
}
|
}
|
||||||
float startX;
|
double startX;
|
||||||
float spacingX;
|
double spacingX;
|
||||||
float startY;
|
double startY;
|
||||||
float spacingY;
|
double spacingY;
|
||||||
|
|
||||||
// Check if within the constraining object...
|
// Check if within the constraining object...
|
||||||
if ((totalObjectWidth + (n + 1)*m_xSpacing) <= minWidth)
|
if ((totalObjectWidth + (n + 1)*m_xSpacing) <= minWidth)
|
||||||
{
|
{
|
||||||
spacingX = (float)((minWidth - totalObjectWidth)/(n + 1));
|
spacingX = (double)((minWidth - totalObjectWidth)/(n + 1));
|
||||||
startX = (float)(x - (minWidth/2.0));
|
startX = (double)(x - (minWidth/2.0));
|
||||||
}
|
}
|
||||||
// Otherwise, use default spacing
|
// Otherwise, use default spacing
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
spacingX = m_xSpacing;
|
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...
|
// Check if within the constraining object...
|
||||||
if ((totalObjectHeight + (n + 1)*m_ySpacing) <= minHeight)
|
if ((totalObjectHeight + (n + 1)*m_ySpacing) <= minHeight)
|
||||||
{
|
{
|
||||||
spacingY = (float)((minHeight - totalObjectHeight)/(n + 1));
|
spacingY = (double)((minHeight - totalObjectHeight)/(n + 1));
|
||||||
startY = (float)(y - (minHeight/2.0));
|
startY = (double)(y - (minHeight/2.0));
|
||||||
}
|
}
|
||||||
// Otherwise, use default spacing
|
// Otherwise, use default spacing
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
spacingY = m_ySpacing;
|
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
|
// Now position the objects
|
||||||
@@ -324,10 +324,10 @@ bool OGLConstraint::Evaluate()
|
|||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxShape *constrainedObject = (wxShape *)node->Data();
|
wxShape *constrainedObject = (wxShape *)node->Data();
|
||||||
float width2, height2;
|
double width2, height2;
|
||||||
constrainedObject->GetBoundingBoxMax(&width2, &height2);
|
constrainedObject->GetBoundingBoxMax(&width2, &height2);
|
||||||
startX += (float)(spacingX + (width2/2.0));
|
startX += (double)(spacingX + (width2/2.0));
|
||||||
startY += (float)(spacingY + (height2/2.0));
|
startY += (double)(spacingY + (height2/2.0));
|
||||||
|
|
||||||
if ((!Equals(startX, constrainedObject->GetX())) || (!Equals(startY, constrainedObject->GetY())))
|
if ((!Equals(startX, constrainedObject->GetX())) || (!Equals(startY, constrainedObject->GetY())))
|
||||||
{
|
{
|
||||||
@@ -335,8 +335,8 @@ bool OGLConstraint::Evaluate()
|
|||||||
changed = TRUE;
|
changed = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
startX += (float)(width2/2.0);
|
startX += (double)(width2/2.0);
|
||||||
startY += (float)(height2/2.0);
|
startY += (double)(height2/2.0);
|
||||||
|
|
||||||
node = node->Next();
|
node = node->Next();
|
||||||
}
|
}
|
||||||
@@ -351,10 +351,10 @@ bool OGLConstraint::Evaluate()
|
|||||||
{
|
{
|
||||||
wxShape *constrainedObject = (wxShape *)node->Data();
|
wxShape *constrainedObject = (wxShape *)node->Data();
|
||||||
|
|
||||||
float width2, height2;
|
double width2, height2;
|
||||||
constrainedObject->GetBoundingBoxMax(&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()))
|
if (!Equals(x3, constrainedObject->GetX()))
|
||||||
{
|
{
|
||||||
changed = TRUE;
|
changed = TRUE;
|
||||||
@@ -374,10 +374,10 @@ bool OGLConstraint::Evaluate()
|
|||||||
{
|
{
|
||||||
wxShape *constrainedObject = (wxShape *)node->Data();
|
wxShape *constrainedObject = (wxShape *)node->Data();
|
||||||
|
|
||||||
float width2, height2;
|
double width2, height2;
|
||||||
constrainedObject->GetBoundingBoxMax(&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()))
|
if (!Equals(x3, constrainedObject->GetX()))
|
||||||
{
|
{
|
||||||
changed = TRUE;
|
changed = TRUE;
|
||||||
@@ -399,10 +399,10 @@ bool OGLConstraint::Evaluate()
|
|||||||
{
|
{
|
||||||
wxShape *constrainedObject = (wxShape *)node->Data();
|
wxShape *constrainedObject = (wxShape *)node->Data();
|
||||||
|
|
||||||
float width2, height2;
|
double width2, height2;
|
||||||
constrainedObject->GetBoundingBoxMax(&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()))
|
if (!Equals(y3, constrainedObject->GetY()))
|
||||||
{
|
{
|
||||||
changed = TRUE;
|
changed = TRUE;
|
||||||
@@ -422,10 +422,10 @@ bool OGLConstraint::Evaluate()
|
|||||||
{
|
{
|
||||||
wxShape *constrainedObject = (wxShape *)node->Data();
|
wxShape *constrainedObject = (wxShape *)node->Data();
|
||||||
|
|
||||||
float width2, height2;
|
double width2, height2;
|
||||||
constrainedObject->GetBoundingBoxMax(&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()))
|
if (!Equals(y3, constrainedObject->GetY()))
|
||||||
{
|
{
|
||||||
changed = TRUE;
|
changed = TRUE;
|
||||||
@@ -445,10 +445,10 @@ bool OGLConstraint::Evaluate()
|
|||||||
{
|
{
|
||||||
wxShape *constrainedObject = (wxShape *)node->Data();
|
wxShape *constrainedObject = (wxShape *)node->Data();
|
||||||
|
|
||||||
float width2, height2;
|
double width2, height2;
|
||||||
constrainedObject->GetBoundingBoxMax(&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()))
|
if (!Equals(x3, constrainedObject->GetX()))
|
||||||
{
|
{
|
||||||
changed = TRUE;
|
changed = TRUE;
|
||||||
@@ -468,10 +468,10 @@ bool OGLConstraint::Evaluate()
|
|||||||
{
|
{
|
||||||
wxShape *constrainedObject = (wxShape *)node->Data();
|
wxShape *constrainedObject = (wxShape *)node->Data();
|
||||||
|
|
||||||
float width2, height2;
|
double width2, height2;
|
||||||
constrainedObject->GetBoundingBoxMax(&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()))
|
if (!Equals(x3, constrainedObject->GetX()))
|
||||||
{
|
{
|
||||||
changed = TRUE;
|
changed = TRUE;
|
||||||
@@ -493,10 +493,10 @@ bool OGLConstraint::Evaluate()
|
|||||||
{
|
{
|
||||||
wxShape *constrainedObject = (wxShape *)node->Data();
|
wxShape *constrainedObject = (wxShape *)node->Data();
|
||||||
|
|
||||||
float width2, height2;
|
double width2, height2;
|
||||||
constrainedObject->GetBoundingBoxMax(&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()))
|
if (!Equals(y3, constrainedObject->GetY()))
|
||||||
{
|
{
|
||||||
changed = TRUE;
|
changed = TRUE;
|
||||||
@@ -516,10 +516,10 @@ bool OGLConstraint::Evaluate()
|
|||||||
{
|
{
|
||||||
wxShape *constrainedObject = (wxShape *)node->Data();
|
wxShape *constrainedObject = (wxShape *)node->Data();
|
||||||
|
|
||||||
float width2, height2;
|
double width2, height2;
|
||||||
constrainedObject->GetBoundingBoxMax(&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()))
|
if (!Equals(y3, constrainedObject->GetY()))
|
||||||
{
|
{
|
||||||
changed = TRUE;
|
changed = TRUE;
|
||||||
@@ -539,7 +539,7 @@ bool OGLConstraint::Evaluate()
|
|||||||
{
|
{
|
||||||
wxShape *constrainedObject = (wxShape *)node->Data();
|
wxShape *constrainedObject = (wxShape *)node->Data();
|
||||||
|
|
||||||
float x3 = (float)(x - (minWidth/2.0));
|
double x3 = (double)(x - (minWidth/2.0));
|
||||||
if (!Equals(x3, constrainedObject->GetX()))
|
if (!Equals(x3, constrainedObject->GetX()))
|
||||||
{
|
{
|
||||||
changed = TRUE;
|
changed = TRUE;
|
||||||
@@ -559,7 +559,7 @@ bool OGLConstraint::Evaluate()
|
|||||||
{
|
{
|
||||||
wxShape *constrainedObject = (wxShape *)node->Data();
|
wxShape *constrainedObject = (wxShape *)node->Data();
|
||||||
|
|
||||||
float x3 = (float)(x + (minWidth/2.0));
|
double x3 = (double)(x + (minWidth/2.0));
|
||||||
if (!Equals(x3, constrainedObject->GetX()))
|
if (!Equals(x3, constrainedObject->GetX()))
|
||||||
{
|
{
|
||||||
changed = TRUE;
|
changed = TRUE;
|
||||||
@@ -581,7 +581,7 @@ bool OGLConstraint::Evaluate()
|
|||||||
{
|
{
|
||||||
wxShape *constrainedObject = (wxShape *)node->Data();
|
wxShape *constrainedObject = (wxShape *)node->Data();
|
||||||
|
|
||||||
float y3 = (float)(y - (minHeight/2.0));
|
double y3 = (double)(y - (minHeight/2.0));
|
||||||
if (!Equals(y3, constrainedObject->GetY()))
|
if (!Equals(y3, constrainedObject->GetY()))
|
||||||
{
|
{
|
||||||
changed = TRUE;
|
changed = TRUE;
|
||||||
@@ -601,7 +601,7 @@ bool OGLConstraint::Evaluate()
|
|||||||
{
|
{
|
||||||
wxShape *constrainedObject = (wxShape *)node->Data();
|
wxShape *constrainedObject = (wxShape *)node->Data();
|
||||||
|
|
||||||
float y3 = (float)(y + (minHeight/2.0));
|
double y3 = (double)(y + (minHeight/2.0));
|
||||||
if (!Equals(y3, constrainedObject->GetY()))
|
if (!Equals(y3, constrainedObject->GetY()))
|
||||||
{
|
{
|
||||||
changed = TRUE;
|
changed = TRUE;
|
||||||
|
@@ -67,11 +67,11 @@ class OGLConstraint: public wxObject
|
|||||||
|
|
||||||
// Returns TRUE if anything changed
|
// Returns TRUE if anything changed
|
||||||
bool Evaluate();
|
bool Evaluate();
|
||||||
inline void SetSpacing(float x, float y) { m_xSpacing = x; m_ySpacing = y; };
|
inline void SetSpacing(double x, double y) { m_xSpacing = x; m_ySpacing = y; };
|
||||||
bool Equals(float a, float b);
|
bool Equals(double a, double b);
|
||||||
|
|
||||||
float m_xSpacing;
|
double m_xSpacing;
|
||||||
float m_ySpacing;
|
double m_ySpacing;
|
||||||
int m_constraintType;
|
int m_constraintType;
|
||||||
wxString m_constraintName;
|
wxString m_constraintName;
|
||||||
long m_constraintId;
|
long m_constraintId;
|
||||||
|
@@ -43,12 +43,12 @@ class wxDividedShapeControlPoint: public wxControlPoint
|
|||||||
public:
|
public:
|
||||||
wxDividedShapeControlPoint() { regionId = 0; }
|
wxDividedShapeControlPoint() { regionId = 0; }
|
||||||
wxDividedShapeControlPoint(wxShapeCanvas *the_canvas, wxShape *object, int region,
|
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();
|
~wxDividedShapeControlPoint();
|
||||||
|
|
||||||
void OnDragLeft(bool draw, 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(float x, float y, int keys=0, int attachment = 0);
|
void OnBeginDragLeft(double x, double y, int keys=0, int attachment = 0);
|
||||||
void OnEndDragLeft(float x, float y, int keys=0, int attachment = 0);
|
void OnEndDragLeft(double x, double y, int keys=0, int attachment = 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxDividedShapeControlPoint, wxControlPoint)
|
IMPLEMENT_DYNAMIC_CLASS(wxDividedShapeControlPoint, wxControlPoint)
|
||||||
@@ -60,7 +60,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxDividedShapeControlPoint, wxControlPoint)
|
|||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxDividedShape, wxRectangleShape)
|
IMPLEMENT_DYNAMIC_CLASS(wxDividedShape, wxRectangleShape)
|
||||||
|
|
||||||
wxDividedShape::wxDividedShape(float w, float h): wxRectangleShape(w, h)
|
wxDividedShape::wxDividedShape(double w, double h): wxRectangleShape(w, h)
|
||||||
{
|
{
|
||||||
ClearRegions();
|
ClearRegions();
|
||||||
}
|
}
|
||||||
@@ -76,12 +76,12 @@ void wxDividedShape::OnDraw(wxDC& dc)
|
|||||||
|
|
||||||
void wxDividedShape::OnDrawContents(wxDC& dc)
|
void wxDividedShape::OnDrawContents(wxDC& dc)
|
||||||
{
|
{
|
||||||
float defaultProportion = (float)(GetRegions().Number() > 0 ? (1.0/((float)(GetRegions().Number()))) : 0.0);
|
double defaultProportion = (double)(GetRegions().Number() > 0 ? (1.0/((double)(GetRegions().Number()))) : 0.0);
|
||||||
float currentY = (float)(m_ypos - (m_height / 2.0));
|
double currentY = (double)(m_ypos - (m_height / 2.0));
|
||||||
float maxY = (float)(m_ypos + (m_height / 2.0));
|
double maxY = (double)(m_ypos + (m_height / 2.0));
|
||||||
|
|
||||||
float leftX = (float)(m_xpos - (m_width / 2.0));
|
double leftX = (double)(m_xpos - (m_width / 2.0));
|
||||||
float rightX = (float)(m_xpos + (m_width / 2.0));
|
double rightX = (double)(m_xpos + (m_width / 2.0));
|
||||||
|
|
||||||
if (m_pen) dc.SetPen(m_pen);
|
if (m_pen) dc.SetPen(m_pen);
|
||||||
|
|
||||||
@@ -102,8 +102,8 @@ void wxDividedShape::OnDrawContents(wxDC& dc)
|
|||||||
*/
|
*/
|
||||||
if (GetDisableLabel()) return;
|
if (GetDisableLabel()) return;
|
||||||
|
|
||||||
float xMargin = 2;
|
double xMargin = 2;
|
||||||
float yMargin = 2;
|
double yMargin = 2;
|
||||||
dc.SetBackgroundMode(wxTRANSPARENT);
|
dc.SetBackgroundMode(wxTRANSPARENT);
|
||||||
|
|
||||||
wxNode *node = GetRegions().First();
|
wxNode *node = GetRegions().First();
|
||||||
@@ -113,17 +113,17 @@ void wxDividedShape::OnDrawContents(wxDC& dc)
|
|||||||
dc.SetFont(region->GetFont());
|
dc.SetFont(region->GetFont());
|
||||||
dc.SetTextForeground(* region->GetActualColourObject());
|
dc.SetTextForeground(* region->GetActualColourObject());
|
||||||
|
|
||||||
float proportion =
|
double proportion =
|
||||||
region->m_regionProportionY < 0.0 ? defaultProportion : region->m_regionProportionY;
|
region->m_regionProportionY < 0.0 ? defaultProportion : region->m_regionProportionY;
|
||||||
|
|
||||||
float y = currentY + m_height*proportion;
|
double y = currentY + m_height*proportion;
|
||||||
float actualY = maxY < y ? maxY : y;
|
double actualY = maxY < y ? maxY : y;
|
||||||
|
|
||||||
float centreX = m_xpos;
|
double centreX = m_xpos;
|
||||||
float centreY = (float)(currentY + (actualY - currentY)/2.0);
|
double centreY = (double)(currentY + (actualY - currentY)/2.0);
|
||||||
|
|
||||||
DrawFormattedText(dc, ®ion->m_formattedText,
|
oglDrawFormattedText(dc, ®ion->m_formattedText,
|
||||||
(float)(centreX), (float)(centreY), (float)(m_width-2*xMargin), (float)(actualY - currentY - 2*yMargin),
|
(double)(centreX), (double)(centreY), (double)(m_width-2*xMargin), (double)(actualY - currentY - 2*yMargin),
|
||||||
region->m_formatMode);
|
region->m_formatMode);
|
||||||
if ((y <= maxY) && (node->Next()))
|
if ((y <= maxY) && (node->Next()))
|
||||||
{
|
{
|
||||||
@@ -131,7 +131,7 @@ void wxDividedShape::OnDrawContents(wxDC& dc)
|
|||||||
if (regionPen)
|
if (regionPen)
|
||||||
{
|
{
|
||||||
dc.SetPen(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);
|
SetAttachmentSize(w, h);
|
||||||
m_width = w;
|
m_width = w;
|
||||||
@@ -154,35 +154,35 @@ void wxDividedShape::SetRegionSizes()
|
|||||||
if (GetRegions().Number() == 0)
|
if (GetRegions().Number() == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
float defaultProportion = (float)(GetRegions().Number() > 0 ? (1.0/((float)(GetRegions().Number()))) : 0.0);
|
double defaultProportion = (double)(GetRegions().Number() > 0 ? (1.0/((double)(GetRegions().Number()))) : 0.0);
|
||||||
float currentY = (float)(m_ypos - (m_height / 2.0));
|
double currentY = (double)(m_ypos - (m_height / 2.0));
|
||||||
float maxY = (float)(m_ypos + (m_height / 2.0));
|
double maxY = (double)(m_ypos + (m_height / 2.0));
|
||||||
|
|
||||||
// float leftX = (float)(m_xpos - (m_width / 2.0));
|
// double leftX = (double)(m_xpos - (m_width / 2.0));
|
||||||
// float rightX = (float)(m_xpos + (m_width / 2.0));
|
// double rightX = (double)(m_xpos + (m_width / 2.0));
|
||||||
|
|
||||||
wxNode *node = GetRegions().First();
|
wxNode *node = GetRegions().First();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxShapeRegion *region = (wxShapeRegion *)node->Data();
|
wxShapeRegion *region = (wxShapeRegion *)node->Data();
|
||||||
float proportion =
|
double proportion =
|
||||||
region->m_regionProportionY <= 0.0 ? defaultProportion : region->m_regionProportionY;
|
region->m_regionProportionY <= 0.0 ? defaultProportion : region->m_regionProportionY;
|
||||||
|
|
||||||
float sizeY = (float)proportion*m_height;
|
double sizeY = (double)proportion*m_height;
|
||||||
float y = currentY + sizeY;
|
double y = currentY + sizeY;
|
||||||
float actualY = maxY < y ? maxY : y;
|
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->SetSize(m_width, sizeY);
|
||||||
region->SetPosition(0.0, (float)(centreY - m_ypos));
|
region->SetPosition(0.0, (double)(centreY - m_ypos));
|
||||||
currentY = actualY;
|
currentY = actualY;
|
||||||
node = node->Next();
|
node = node->Next();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attachment points correspond to regions in the divided box
|
// 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)
|
wxLineShape *line)
|
||||||
{
|
{
|
||||||
int totalNumberAttachments = (GetRegions().Number() * 2) + 2;
|
int totalNumberAttachments = (GetRegions().Number() * 2) + 2;
|
||||||
@@ -194,10 +194,10 @@ bool wxDividedShape::GetAttachmentPosition(int attachment, float *x, float *y, i
|
|||||||
int n = GetRegions().Number();
|
int n = GetRegions().Number();
|
||||||
bool isEnd = (line && line->IsEnd(this));
|
bool isEnd = (line && line->IsEnd(this));
|
||||||
|
|
||||||
float left = (float)(m_xpos - m_width/2.0);
|
double left = (double)(m_xpos - m_width/2.0);
|
||||||
float right = (float)(m_xpos + m_width/2.0);
|
double right = (double)(m_xpos + m_width/2.0);
|
||||||
float top = (float)(m_ypos - m_height/2.0);
|
double top = (double)(m_ypos - m_height/2.0);
|
||||||
float bottom = (float)(m_ypos + m_height/2.0);
|
double bottom = (double)(m_ypos + m_height/2.0);
|
||||||
|
|
||||||
// Zero is top, n+1 is bottom.
|
// Zero is top, n+1 is bottom.
|
||||||
if (attachment == 0)
|
if (attachment == 0)
|
||||||
@@ -270,8 +270,8 @@ bool wxDividedShape::GetAttachmentPosition(int attachment, float *x, float *y, i
|
|||||||
*x = right;
|
*x = right;
|
||||||
|
|
||||||
// Calculate top and bottom of region
|
// Calculate top and bottom of region
|
||||||
top = (float)((m_ypos + region->m_y) - (region->m_height/2.0));
|
top = (double)((m_ypos + region->m_y) - (region->m_height/2.0));
|
||||||
bottom = (float)((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
|
// Assuming we can trust the absolute size and
|
||||||
// position of these regions...
|
// position of these regions...
|
||||||
@@ -289,11 +289,11 @@ bool wxDividedShape::GetAttachmentPosition(int attachment, float *x, float *y, i
|
|||||||
*y = point->y;
|
*y = point->y;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
// *y = (float)(((m_ypos + region->m_y) - (region->m_height/2.0)) + (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 = (float)(top + (nth + 1)*region->m_height/(no_arcs+1));
|
*y = (double)(top + (nth + 1)*region->m_height/(no_arcs+1));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
*y = (float)(m_ypos + region->m_y);
|
*y = (double)(m_ypos + region->m_y);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -352,8 +352,8 @@ void wxDividedShape::MakeControlPoints()
|
|||||||
|
|
||||||
void wxDividedShape::MakeMandatoryControlPoints()
|
void wxDividedShape::MakeMandatoryControlPoints()
|
||||||
{
|
{
|
||||||
float currentY = (float)(GetY() - (m_height / 2.0));
|
double currentY = (double)(GetY() - (m_height / 2.0));
|
||||||
float maxY = (float)(GetY() + (m_height / 2.0));
|
double maxY = (double)(GetY() + (m_height / 2.0));
|
||||||
|
|
||||||
wxNode *node = GetRegions().First();
|
wxNode *node = GetRegions().First();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@@ -361,15 +361,15 @@ void wxDividedShape::MakeMandatoryControlPoints()
|
|||||||
{
|
{
|
||||||
wxShapeRegion *region = (wxShapeRegion *)node->Data();
|
wxShapeRegion *region = (wxShapeRegion *)node->Data();
|
||||||
|
|
||||||
float proportion = region->m_regionProportionY;
|
double proportion = region->m_regionProportionY;
|
||||||
|
|
||||||
float y = currentY + m_height*proportion;
|
double y = currentY + m_height*proportion;
|
||||||
float actualY = (float)(maxY < y ? maxY : y);
|
double actualY = (double)(maxY < y ? maxY : y);
|
||||||
|
|
||||||
if (node->Next())
|
if (node->Next())
|
||||||
{
|
{
|
||||||
wxDividedShapeControlPoint *controlPoint =
|
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_canvas->AddShape(controlPoint);
|
||||||
m_controlPoints.Append(controlPoint);
|
m_controlPoints.Append(controlPoint);
|
||||||
}
|
}
|
||||||
@@ -390,8 +390,8 @@ void wxDividedShape::ResetControlPoints()
|
|||||||
|
|
||||||
void wxDividedShape::ResetMandatoryControlPoints()
|
void wxDividedShape::ResetMandatoryControlPoints()
|
||||||
{
|
{
|
||||||
float currentY = (float)(GetY() - (m_height / 2.0));
|
double currentY = (double)(GetY() - (m_height / 2.0));
|
||||||
float maxY = (float)(GetY() + (m_height / 2.0));
|
double maxY = (double)(GetY() + (m_height / 2.0));
|
||||||
|
|
||||||
wxNode *node = m_controlPoints.First();
|
wxNode *node = m_controlPoints.First();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@@ -403,13 +403,13 @@ void wxDividedShape::ResetMandatoryControlPoints()
|
|||||||
wxNode *node1 = GetRegions().Nth(i);
|
wxNode *node1 = GetRegions().Nth(i);
|
||||||
wxShapeRegion *region = (wxShapeRegion *)node1->Data();
|
wxShapeRegion *region = (wxShapeRegion *)node1->Data();
|
||||||
|
|
||||||
float proportion = region->m_regionProportionY;
|
double proportion = region->m_regionProportionY;
|
||||||
|
|
||||||
float y = currentY + m_height*proportion;
|
double y = currentY + m_height*proportion;
|
||||||
float actualY = (float)(maxY < y ? maxY : y);
|
double actualY = (double)(maxY < y ? maxY : y);
|
||||||
|
|
||||||
controlPoint->m_xoffset = 0.0;
|
controlPoint->m_xoffset = 0.0;
|
||||||
controlPoint->m_yoffset = (float)(actualY - GetY());
|
controlPoint->m_yoffset = (double)(actualY - GetY());
|
||||||
currentY = actualY;
|
currentY = actualY;
|
||||||
i ++;
|
i ++;
|
||||||
}
|
}
|
||||||
@@ -569,7 +569,7 @@ void wxDividedShape::EditRegions()
|
|||||||
#endif
|
#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)
|
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,
|
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)
|
wxControlPoint(the_canvas, object, size, the_m_xoffset, the_m_yoffset, the_type)
|
||||||
{
|
{
|
||||||
regionId = region;
|
regionId = region;
|
||||||
@@ -593,7 +593,7 @@ wxDividedShapeControlPoint::~wxDividedShapeControlPoint()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Implement resizing of divided object division
|
// 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());
|
wxClientDC dc(GetCanvas());
|
||||||
GetCanvas()->PrepareDC(dc);
|
GetCanvas()->PrepareDC(dc);
|
||||||
@@ -604,14 +604,14 @@ void wxDividedShapeControlPoint::OnDragLeft(bool draw, float x, float y, int key
|
|||||||
dc.SetBrush((* wxTRANSPARENT_BRUSH));
|
dc.SetBrush((* wxTRANSPARENT_BRUSH));
|
||||||
|
|
||||||
wxDividedShape *dividedObject = (wxDividedShape *)m_shape;
|
wxDividedShape *dividedObject = (wxDividedShape *)m_shape;
|
||||||
float x1 = (float)(dividedObject->GetX() - (dividedObject->GetWidth()/2.0));
|
double x1 = (double)(dividedObject->GetX() - (dividedObject->GetWidth()/2.0));
|
||||||
float y1 = y;
|
double y1 = y;
|
||||||
float x2 = (float)(dividedObject->GetX() + (dividedObject->GetWidth()/2.0));
|
double x2 = (double)(dividedObject->GetX() + (dividedObject->GetWidth()/2.0));
|
||||||
float y2 = y;
|
double y2 = y;
|
||||||
dc.DrawLine(x1, y1, x2, y2);
|
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());
|
wxClientDC dc(GetCanvas());
|
||||||
GetCanvas()->PrepareDC(dc);
|
GetCanvas()->PrepareDC(dc);
|
||||||
@@ -622,15 +622,15 @@ void wxDividedShapeControlPoint::OnBeginDragLeft(float x, float y, int keys, int
|
|||||||
dc.SetPen(dottedPen);
|
dc.SetPen(dottedPen);
|
||||||
dc.SetBrush((* wxTRANSPARENT_BRUSH));
|
dc.SetBrush((* wxTRANSPARENT_BRUSH));
|
||||||
|
|
||||||
float x1 = (float)(dividedObject->GetX() - (dividedObject->GetWidth()/2.0));
|
double x1 = (double)(dividedObject->GetX() - (dividedObject->GetWidth()/2.0));
|
||||||
float y1 = y;
|
double y1 = y;
|
||||||
float x2 = (float)(dividedObject->GetX() + (dividedObject->GetWidth()/2.0));
|
double x2 = (double)(dividedObject->GetX() + (dividedObject->GetWidth()/2.0));
|
||||||
float y2 = y;
|
double y2 = y;
|
||||||
dc.DrawLine(x1, y1, x2, y2);
|
dc.DrawLine(WXROUND(x1), WXROUND(y1), WXROUND(x2), WXROUND(y2));
|
||||||
m_canvas->CaptureMouse();
|
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());
|
wxClientDC dc(GetCanvas());
|
||||||
GetCanvas()->PrepareDC(dc);
|
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
|
// and calculate the new proportion for this region
|
||||||
// if legal.
|
// if legal.
|
||||||
|
|
||||||
float currentY = (float)(dividedObject->GetY() - (dividedObject->GetHeight() / 2.0));
|
double currentY = (double)(dividedObject->GetY() - (dividedObject->GetHeight() / 2.0));
|
||||||
float maxY = (float)(dividedObject->GetY() + (dividedObject->GetHeight() / 2.0));
|
double maxY = (double)(dividedObject->GetY() + (dividedObject->GetHeight() / 2.0));
|
||||||
|
|
||||||
// Save values
|
// Save values
|
||||||
float thisRegionTop = 0.0;
|
double thisRegionTop = 0.0;
|
||||||
float thisRegionBottom = 0.0;
|
double thisRegionBottom = 0.0;
|
||||||
float nextRegionBottom = 0.0;
|
double nextRegionBottom = 0.0;
|
||||||
|
|
||||||
node = dividedObject->GetRegions().First();
|
node = dividedObject->GetRegions().First();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
wxShapeRegion *region = (wxShapeRegion *)node->Data();
|
wxShapeRegion *region = (wxShapeRegion *)node->Data();
|
||||||
|
|
||||||
float proportion = region->m_regionProportionY;
|
double proportion = region->m_regionProportionY;
|
||||||
float yy = currentY + (dividedObject->GetHeight()*proportion);
|
double yy = currentY + (dividedObject->GetHeight()*proportion);
|
||||||
float actualY = (float)(maxY < yy ? maxY : yy);
|
double actualY = (double)(maxY < yy ? maxY : yy);
|
||||||
|
|
||||||
if (region == thisRegion)
|
if (region == thisRegion)
|
||||||
{
|
{
|
||||||
@@ -694,11 +694,11 @@ void wxDividedShapeControlPoint::OnEndDragLeft(float x, float y, int keys, int a
|
|||||||
dividedObject->EraseLinks(dc);
|
dividedObject->EraseLinks(dc);
|
||||||
|
|
||||||
// Now calculate the new proportions of this region and the next region.
|
// Now calculate the new proportions of this region and the next region.
|
||||||
float thisProportion = (float)((y - thisRegionTop)/dividedObject->GetHeight());
|
double thisProportion = (double)((y - thisRegionTop)/dividedObject->GetHeight());
|
||||||
float nextProportion = (float)((nextRegionBottom - y)/dividedObject->GetHeight());
|
double nextProportion = (double)((nextRegionBottom - y)/dividedObject->GetHeight());
|
||||||
thisRegion->SetProportions(0.0, thisProportion);
|
thisRegion->SetProportions(0.0, thisProportion);
|
||||||
nextRegion->SetProportions(0.0, nextProportion);
|
nextRegion->SetProportions(0.0, nextProportion);
|
||||||
m_yoffset = (float)(y - dividedObject->GetY());
|
m_yoffset = (double)(y - dividedObject->GetY());
|
||||||
|
|
||||||
// Now reformat text
|
// Now reformat text
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
@@ -32,13 +32,13 @@ class wxDividedShape: public wxRectangleShape
|
|||||||
DECLARE_DYNAMIC_CLASS(wxDividedShape)
|
DECLARE_DYNAMIC_CLASS(wxDividedShape)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
wxDividedShape(float w = 0.0, float h = 0.0);
|
wxDividedShape(double w = 0.0, double h = 0.0);
|
||||||
~wxDividedShape();
|
~wxDividedShape();
|
||||||
|
|
||||||
void OnDraw(wxDC& dc);
|
void OnDraw(wxDC& dc);
|
||||||
void OnDrawContents(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 MakeControlPoints();
|
||||||
void ResetControlPoints();
|
void ResetControlPoints();
|
||||||
@@ -62,13 +62,13 @@ class wxDividedShape: public wxRectangleShape
|
|||||||
void EditRegions();
|
void EditRegions();
|
||||||
|
|
||||||
// Attachment points correspond to regions in the divided box
|
// 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);
|
int nth = 0, int no_arcs = 1, wxLineShape *line = NULL);
|
||||||
bool AttachmentIsValid(int attachment);
|
bool AttachmentIsValid(int attachment);
|
||||||
int GetNumberOfAttachments();
|
int GetNumberOfAttachments();
|
||||||
|
|
||||||
// Invoke editor on CTRL-right click
|
// 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
|
#endif
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -18,6 +18,9 @@
|
|||||||
|
|
||||||
#include "basic.h"
|
#include "basic.h"
|
||||||
|
|
||||||
|
#define oglMETAFLAGS_OUTLINE 1
|
||||||
|
#define oglMETAFLAGS_ATTACHMENTS 2
|
||||||
|
|
||||||
class wxDrawnShape;
|
class wxDrawnShape;
|
||||||
class wxPseudoMetaFile: public wxObject
|
class wxPseudoMetaFile: public wxObject
|
||||||
{
|
{
|
||||||
@@ -27,27 +30,27 @@ class wxPseudoMetaFile: public wxObject
|
|||||||
wxPseudoMetaFile(wxPseudoMetaFile& mf);
|
wxPseudoMetaFile(wxPseudoMetaFile& mf);
|
||||||
~wxPseudoMetaFile();
|
~wxPseudoMetaFile();
|
||||||
|
|
||||||
void Draw(wxDC& dc, float xoffset, float yoffset);
|
void Draw(wxDC& dc, double xoffset, double yoffset);
|
||||||
|
|
||||||
#ifdef PROLOGIO
|
#ifdef PROLOGIO
|
||||||
void WritePrologAttributes(wxExpr *clause);
|
void WritePrologAttributes(wxExpr *clause, int whichAngle);
|
||||||
void ReadPrologAttributes(wxExpr *clause);
|
void ReadPrologAttributes(wxExpr *clause, int whichAngle);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void Clear();
|
void Clear();
|
||||||
|
|
||||||
void Copy(wxPseudoMetaFile& copy);
|
void Copy(wxPseudoMetaFile& copy);
|
||||||
|
|
||||||
void Scale(float sx, float sy);
|
void Scale(double sx, double sy);
|
||||||
void ScaleTo(float w, float h); // Scale to fit size
|
void ScaleTo(double w, double h); // Scale to fit size
|
||||||
void Translate(float x, float y);
|
void Translate(double x, double y);
|
||||||
|
|
||||||
// Rotate about the given axis by theta radians from the x axis.
|
// 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
|
// Calculate size from current operations
|
||||||
void CalculateSize(wxDrawnShape* shape);
|
void CalculateSize(wxDrawnShape* shape);
|
||||||
@@ -57,7 +60,7 @@ class wxPseudoMetaFile: public wxObject
|
|||||||
inline void SetRotateable(bool rot) { m_rotateable = rot; }
|
inline void SetRotateable(bool rot) { m_rotateable = rot; }
|
||||||
inline bool GetRotateable() const { return m_rotateable; }
|
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 void SetFillBrush(wxBrush* brush) { m_fillBrush = brush; }
|
||||||
inline wxBrush* GetFillBrush() const { return m_fillBrush; }
|
inline wxBrush* GetFillBrush() const { return m_fillBrush; }
|
||||||
@@ -65,6 +68,14 @@ class wxPseudoMetaFile: public wxObject
|
|||||||
inline void SetOutlinePen(wxPen* pen) { m_outlinePen = pen; }
|
inline void SetOutlinePen(wxPen* pen) { m_outlinePen = pen; }
|
||||||
inline wxPen* GetOutlinePen() const { return m_outlinePen; }
|
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:
|
public:
|
||||||
/// Set of functions for drawing into a pseudo metafile.
|
/// Set of functions for drawing into a pseudo metafile.
|
||||||
/// They use integers, but doubles are used internally for accuracy
|
/// 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 DrawLine(const wxPoint& pt1, const wxPoint& pt2);
|
||||||
virtual void DrawRectangle(const wxRect& rect);
|
virtual void DrawRectangle(const wxRect& rect);
|
||||||
virtual void DrawRoundedRectangle(const wxRect& rect, double radius);
|
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 DrawEllipse(const wxRect& rect);
|
||||||
virtual void DrawPoint(const wxPoint& pt);
|
virtual void DrawPoint(const wxPoint& pt);
|
||||||
virtual void DrawText(const wxString& text, const wxPoint& pt);
|
virtual void DrawText(const wxString& text, const wxPoint& pt);
|
||||||
virtual void DrawLines(int n, wxPoint pts[]);
|
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 DrawSpline(int n, wxPoint pts[]);
|
||||||
|
|
||||||
virtual void SetClippingRect(const wxRect& rect);
|
virtual void SetClippingRect(const wxRect& rect);
|
||||||
@@ -92,10 +110,11 @@ public:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
bool m_rotateable;
|
bool m_rotateable;
|
||||||
float m_width;
|
double m_width;
|
||||||
float m_height;
|
double m_height;
|
||||||
wxList m_ops; // List of drawing operations (see drawnp.h)
|
wxList m_ops; // List of drawing operations (see drawnp.h)
|
||||||
wxList m_gdiObjects; // List of pens, brushes and fonts for this object.
|
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
|
// Pen/brush specifying outline/fill colours
|
||||||
// to override operations.
|
// to override operations.
|
||||||
@@ -103,9 +122,14 @@ public:
|
|||||||
wxBrush* m_fillBrush;
|
wxBrush* m_fillBrush;
|
||||||
wxList m_outlineColours; // List of the GDI operations that comprise the outline
|
wxList m_outlineColours; // List of the GDI operations that comprise the outline
|
||||||
wxList m_fillColours; // List of the GDI operations that fill the shape
|
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
|
class wxDrawnShape: public wxRectangleShape
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxDrawnShape)
|
DECLARE_DYNAMIC_CLASS(wxDrawnShape)
|
||||||
@@ -125,19 +149,27 @@ class wxDrawnShape: public wxRectangleShape
|
|||||||
// Does the copying for this object
|
// Does the copying for this object
|
||||||
void Copy(wxShape& copy);
|
void Copy(wxShape& copy);
|
||||||
|
|
||||||
void Scale(float sx, float sy);
|
void Scale(double sx, double sy);
|
||||||
void Translate(float x, float y);
|
void Translate(double x, double y);
|
||||||
// Rotate about the given axis by theta radians from the x axis.
|
// 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
|
// 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);
|
bool LoadFromMetaFile(char *filename);
|
||||||
|
|
||||||
inline void SetSaveToFile(bool save) { m_saveToFile = save; }
|
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.
|
/// Set of functions for drawing into a pseudo metafile.
|
||||||
/// They use integers, but doubles are used internally for accuracy
|
/// 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 DrawLine(const wxPoint& pt1, const wxPoint& pt2);
|
||||||
virtual void DrawRectangle(const wxRect& rect);
|
virtual void DrawRectangle(const wxRect& rect);
|
||||||
virtual void DrawRoundedRectangle(const wxRect& rect, double radius);
|
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 DrawEllipse(const wxRect& rect);
|
||||||
virtual void DrawPoint(const wxPoint& pt);
|
virtual void DrawPoint(const wxPoint& pt);
|
||||||
virtual void DrawText(const wxString& text, const wxPoint& pt);
|
virtual void DrawText(const wxString& text, const wxPoint& pt);
|
||||||
virtual void DrawLines(int n, wxPoint pts[]);
|
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 DrawSpline(int n, wxPoint pts[]);
|
||||||
|
|
||||||
virtual void SetClippingRect(const wxRect& rect);
|
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.
|
// Set the width/height according to the shapes in the metafile.
|
||||||
// Call this after drawing into the shape.
|
// 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:
|
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
|
// Don't save all wxDrawnShape metafiles to file: sometimes
|
||||||
// we take the metafile data from a symbol library.
|
// we take the metafile data from a symbol library.
|
||||||
bool m_saveToFile;
|
bool m_saveToFile;
|
||||||
|
|
||||||
|
// Which angle are we using/drawing into?
|
||||||
|
int m_currentAngle;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -48,6 +48,7 @@
|
|||||||
#define DRAWOP_DRAW_ARC 27
|
#define DRAWOP_DRAW_ARC 27
|
||||||
#define DRAWOP_DRAW_TEXT 28
|
#define DRAWOP_DRAW_TEXT 28
|
||||||
#define DRAWOP_DRAW_SPLINE 29
|
#define DRAWOP_DRAW_SPLINE 29
|
||||||
|
#define DRAWOP_DRAW_ELLIPTIC_ARC 30
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Base, virtual class
|
* Base, virtual class
|
||||||
@@ -59,18 +60,30 @@ class wxDrawOp: public wxObject
|
|||||||
public:
|
public:
|
||||||
inline wxDrawOp(int theOp) { m_op = theOp; }
|
inline wxDrawOp(int theOp) { m_op = theOp; }
|
||||||
inline ~wxDrawOp() {}
|
inline ~wxDrawOp() {}
|
||||||
inline virtual void Scale(float xScale, float yScale) {};
|
inline virtual void Scale(double xScale, double yScale) {};
|
||||||
inline virtual void Translate(float x, float y) {};
|
inline virtual void Translate(double x, double y) {};
|
||||||
inline virtual void Rotate(float x, float y, float sinTheta, float cosTheta) {};
|
inline virtual void Rotate(double x, double y, double theta, double sinTheta, double cosTheta) {};
|
||||||
virtual void Do(wxDC& dc, float xoffset, float yoffset) = 0;
|
virtual void Do(wxDC& dc, double xoffset, double yoffset) = 0;
|
||||||
virtual wxDrawOp *Copy(wxPseudoMetaFile *newImage) = 0;
|
virtual wxDrawOp *Copy(wxPseudoMetaFile *newImage) = 0;
|
||||||
virtual wxExpr *WriteExpr(wxPseudoMetaFile *image) = 0;
|
virtual wxExpr *WriteExpr(wxPseudoMetaFile *image) = 0;
|
||||||
virtual void ReadExpr(wxPseudoMetaFile *image, wxExpr *expr) = 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:
|
protected:
|
||||||
int m_op;
|
int m_op;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -83,7 +96,7 @@ class wxOpSetGDI: public wxDrawOp
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxOpSetGDI(int theOp, wxPseudoMetaFile *theImage, int theGdiIndex, int theMode = 0);
|
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);
|
wxDrawOp *Copy(wxPseudoMetaFile *newImage);
|
||||||
wxExpr *WriteExpr(wxPseudoMetaFile *image);
|
wxExpr *WriteExpr(wxPseudoMetaFile *image);
|
||||||
void ReadExpr(wxPseudoMetaFile *image, wxExpr *expr);
|
void ReadExpr(wxPseudoMetaFile *image, wxExpr *expr);
|
||||||
@@ -105,19 +118,19 @@ public:
|
|||||||
class wxOpSetClipping: public wxDrawOp
|
class wxOpSetClipping: public wxDrawOp
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxOpSetClipping(int theOp, float theX1, float theY1, float theX2, float theY2);
|
wxOpSetClipping(int theOp, double theX1, double theY1, double theX2, double theY2);
|
||||||
void Do(wxDC& dc, float xoffset, float yoffset);
|
void Do(wxDC& dc, double xoffset, double yoffset);
|
||||||
void Scale(float xScale, float yScale);
|
void Scale(double xScale, double yScale);
|
||||||
void Translate(float x, float y);
|
void Translate(double x, double y);
|
||||||
wxDrawOp *Copy(wxPseudoMetaFile *newImage);
|
wxDrawOp *Copy(wxPseudoMetaFile *newImage);
|
||||||
wxExpr *WriteExpr(wxPseudoMetaFile *image);
|
wxExpr *WriteExpr(wxPseudoMetaFile *image);
|
||||||
void ReadExpr(wxPseudoMetaFile *image, wxExpr *expr);
|
void ReadExpr(wxPseudoMetaFile *image, wxExpr *expr);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
float m_x1;
|
double m_x1;
|
||||||
float m_y1;
|
double m_y1;
|
||||||
float m_x2;
|
double m_x2;
|
||||||
float m_y2;
|
double m_y2;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -128,24 +141,25 @@ public:
|
|||||||
class wxOpDraw: public wxDrawOp
|
class wxOpDraw: public wxDrawOp
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxOpDraw(int theOp, float theX1, float theY1, float theX2, float theY2,
|
wxOpDraw(int theOp, double theX1, double theY1, double theX2, double theY2,
|
||||||
float radius = 0.0, char *s = NULL);
|
double radius = 0.0, char *s = NULL);
|
||||||
~wxOpDraw();
|
~wxOpDraw();
|
||||||
void Do(wxDC& dc, float xoffset, float yoffset);
|
void Do(wxDC& dc, double xoffset, double yoffset);
|
||||||
void Scale(float scaleX, float scaleY);
|
void Scale(double scaleX, double scaleY);
|
||||||
void Translate(float x, float y);
|
void Translate(double x, double y);
|
||||||
void Rotate(float x, float y, float sinTheta, float cosTheta);
|
void Rotate(double x, double y, double theta, double sinTheta, double cosTheta);
|
||||||
wxDrawOp *Copy(wxPseudoMetaFile *newImage);
|
wxDrawOp *Copy(wxPseudoMetaFile *newImage);
|
||||||
wxExpr *WriteExpr(wxPseudoMetaFile *image);
|
wxExpr *WriteExpr(wxPseudoMetaFile *image);
|
||||||
void ReadExpr(wxPseudoMetaFile *image, wxExpr *expr);
|
void ReadExpr(wxPseudoMetaFile *image, wxExpr *expr);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
float m_x1;
|
double m_x1;
|
||||||
float m_y1;
|
double m_y1;
|
||||||
float m_x2;
|
double m_x2;
|
||||||
float m_y2;
|
double m_y2;
|
||||||
float m_x3;
|
double m_x3;
|
||||||
float m_radius;
|
double m_y3;
|
||||||
|
double m_radius;
|
||||||
char* m_textString;
|
char* m_textString;
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -160,14 +174,25 @@ class wxOpPolyDraw: public wxDrawOp
|
|||||||
public:
|
public:
|
||||||
wxOpPolyDraw(int theOp, int n, wxRealPoint *thePoints);
|
wxOpPolyDraw(int theOp, int n, wxRealPoint *thePoints);
|
||||||
~wxOpPolyDraw();
|
~wxOpPolyDraw();
|
||||||
void Do(wxDC& dc, float xoffset, float yoffset);
|
void Do(wxDC& dc, double xoffset, double yoffset);
|
||||||
void Scale(float scaleX, float scaleY);
|
void Scale(double scaleX, double scaleY);
|
||||||
void Translate(float x, float y);
|
void Translate(double x, double y);
|
||||||
void Rotate(float x, float y, float sinTheta, float cosTheta);
|
void Rotate(double x, double y, double theta, double sinTheta, double cosTheta);
|
||||||
wxDrawOp *Copy(wxPseudoMetaFile *newImage);
|
wxDrawOp *Copy(wxPseudoMetaFile *newImage);
|
||||||
wxExpr *WriteExpr(wxPseudoMetaFile *image);
|
wxExpr *WriteExpr(wxPseudoMetaFile *image);
|
||||||
void ReadExpr(wxPseudoMetaFile *image, wxExpr *expr);
|
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:
|
public:
|
||||||
wxRealPoint* m_points;
|
wxRealPoint* m_points;
|
||||||
int m_noPoints;
|
int m_noPoints;
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -51,7 +51,7 @@ class wxArrowHead: public wxObject
|
|||||||
DECLARE_DYNAMIC_CLASS(wxArrowHead)
|
DECLARE_DYNAMIC_CLASS(wxArrowHead)
|
||||||
|
|
||||||
public:
|
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);
|
long arrowId = -1);
|
||||||
~wxArrowHead();
|
~wxArrowHead();
|
||||||
wxArrowHead(wxArrowHead& toCopy);
|
wxArrowHead(wxArrowHead& toCopy);
|
||||||
@@ -59,28 +59,28 @@ class wxArrowHead: public wxObject
|
|||||||
inline WXTYPE _GetType() const { return m_arrowType; }
|
inline WXTYPE _GetType() const { return m_arrowType; }
|
||||||
inline int GetPosition() const { return m_arrowEnd; }
|
inline int GetPosition() const { return m_arrowEnd; }
|
||||||
inline void SetPosition(int pos) { m_arrowEnd = pos; }
|
inline void SetPosition(int pos) { m_arrowEnd = pos; }
|
||||||
inline float GetXOffset() const { return m_xOffset; }
|
inline double GetXOffset() const { return m_xOffset; }
|
||||||
inline float GetYOffset() const { return m_yOffset; }
|
inline double GetYOffset() const { return m_yOffset; }
|
||||||
inline float GetSpacing() const { return m_spacing; }
|
inline double GetSpacing() const { return m_spacing; }
|
||||||
inline float GetSize() const { return m_arrowSize; }
|
inline double GetSize() const { return m_arrowSize; }
|
||||||
inline wxString GetName() const { return m_arrowName; }
|
inline wxString GetName() const { return m_arrowName; }
|
||||||
inline void SetXOffset(float x) { m_xOffset = x; }
|
inline void SetXOffset(double x) { m_xOffset = x; }
|
||||||
inline void SetYOffset(float y) { m_yOffset = y; }
|
inline void SetYOffset(double y) { m_yOffset = y; }
|
||||||
inline wxPseudoMetaFile *GetMetaFile() const { return m_metaFile; }
|
inline wxPseudoMetaFile *GetMetaFile() const { return m_metaFile; }
|
||||||
inline long GetId() const { return m_id; }
|
inline long GetId() const { return m_id; }
|
||||||
inline int GetArrowEnd() const { return m_arrowEnd; }
|
inline int GetArrowEnd() const { return m_arrowEnd; }
|
||||||
inline float GetArrowSize() const { return m_arrowSize; }
|
inline double GetArrowSize() const { return m_arrowSize; }
|
||||||
void SetSize(float size);
|
void SetSize(double size);
|
||||||
inline void SetSpacing(float sp) { m_spacing = sp; }
|
inline void SetSpacing(double sp) { m_spacing = sp; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
WXTYPE m_arrowType;
|
WXTYPE m_arrowType;
|
||||||
int m_arrowEnd; // Position on line
|
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.
|
// nearest start or end. If zero, use default spacing.
|
||||||
float m_yOffset; // vertical offset (w.r.t. a horizontal line). Normally zero.
|
double m_yOffset; // vertical offset (w.r.t. a horizontal line). Normally zero.
|
||||||
float m_spacing; // Spacing from the last arrowhead
|
double m_spacing; // Spacing from the last arrowhead
|
||||||
float m_arrowSize; // Length of arrowhead
|
double m_arrowSize; // Length of arrowhead
|
||||||
wxString m_arrowName; // Name of arrow
|
wxString m_arrowName; // Name of arrow
|
||||||
bool m_saveToFile; // TRUE if we want to save custom arrowheads to file.
|
bool m_saveToFile; // TRUE if we want to save custom arrowheads to file.
|
||||||
wxPseudoMetaFile* m_metaFile; // Pseudo metafile if this is a custom arrowhead
|
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
|
// moveControlPoints must be disabled when a control point is being
|
||||||
// dragged.
|
// dragged.
|
||||||
void OnMoveLink(wxDC& dc, bool moveControlPoints = TRUE);
|
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 OnDraw(wxDC& dc);
|
||||||
void OnDrawContents(wxDC& dc);
|
void OnDrawContents(wxDC& dc);
|
||||||
void OnDrawControlPoints(wxDC& dc);
|
void OnDrawControlPoints(wxDC& dc);
|
||||||
void OnEraseControlPoints(wxDC& dc);
|
void OnEraseControlPoints(wxDC& dc);
|
||||||
void OnErase(wxDC& dc);
|
void OnErase(wxDC& dc);
|
||||||
virtual inline void OnMoveControlPoint(int WXUNUSED(which), float WXUNUSED(x), float WXUNUSED(y)) {}
|
virtual inline void OnMoveControlPoint(int WXUNUSED(which), double WXUNUSED(x), double WXUNUSED(y)) {}
|
||||||
void OnDrawOutline(wxDC& dc, float x, float y, float w, float h);
|
void OnDrawOutline(wxDC& dc, double x, double y, double w, double h);
|
||||||
void GetBoundingBoxMin(float *w, float *h);
|
void GetBoundingBoxMin(double *w, double *h);
|
||||||
void FormatText(wxDC& dc, const wxString& s, int regionId = 0);
|
void FormatText(wxDC& dc, const wxString& s, int regionId = 0);
|
||||||
virtual void SetEnds(float x1, float y1, float x2, float y2);
|
virtual void SetEnds(double x1, double y1, double x2, double y2);
|
||||||
virtual void GetEnds(float *x1, float *y1, float *x2, float *y2);
|
virtual void GetEnds(double *x1, double *y1, double *x2, double *y2);
|
||||||
inline virtual wxShape *GetFrom() { return m_from; }
|
inline virtual wxShape *GetFrom() { return m_from; }
|
||||||
inline virtual wxShape *GetTo() { return m_to; }
|
inline virtual wxShape *GetTo() { return m_to; }
|
||||||
inline virtual int GetAttachmentFrom() { return m_attachmentFrom; }
|
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
|
// 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
|
// get the actual points on the two node images where the lines will be drawn
|
||||||
// to/from.
|
// 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
|
// 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
|
// 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
|
// Get the reference point for a label. Region x and y
|
||||||
// are offsets from this.
|
// are offsets from this.
|
||||||
// position is 0 (middle), 1 (start), 2 (end)
|
// 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
|
// Straighten verticals and horizontals
|
||||||
virtual void Straighten(wxDC& dc);
|
virtual void Straighten(wxDC& dc);
|
||||||
@@ -158,15 +158,15 @@ class wxLineShape: public wxShape
|
|||||||
inline wxList *GetLineControlPoints() { return m_lineControlPoints; }
|
inline wxList *GetLineControlPoints() { return m_lineControlPoints; }
|
||||||
|
|
||||||
// Override dragging behaviour - don't want to be able to drag lines!
|
// 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 OnDragLeft(bool draw, double x, double y, int keys=0, int attachment = 0);
|
||||||
void OnBeginDragLeft(float x, float y, int keys=0, int attachment = 0);
|
void OnBeginDragLeft(double x, double y, int keys=0, int attachment = 0);
|
||||||
void OnEndDragLeft(float x, float 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
|
// Control points ('handles') redirect control to the actual shape, to make it easier
|
||||||
// to override sizing behaviour.
|
// to override sizing behaviour.
|
||||||
virtual void OnSizingDragLeft(wxControlPoint* pt, bool draw, 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, float x, float 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, float x, float 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
|
// Override select, to create/delete temporary label-moving objects
|
||||||
void Select(bool select = TRUE, wxDC* dc = NULL);
|
void Select(bool select = TRUE, wxDC* dc = NULL);
|
||||||
@@ -177,8 +177,10 @@ class wxLineShape: public wxShape
|
|||||||
|
|
||||||
void Unlink();
|
void Unlink();
|
||||||
void SetAttachments(int from_attach, int to_attach);
|
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
|
#ifdef PROLOGIO
|
||||||
// Prolog database stuff
|
// Prolog database stuff
|
||||||
@@ -191,7 +193,7 @@ class wxLineShape: public wxShape
|
|||||||
|
|
||||||
// Find which position we're talking about at this (x, y).
|
// Find which position we're talking about at this (x, y).
|
||||||
// Returns ARROW_POSITION_START, ARROW_POSITION_MIDDLE, ARROW_POSITION_END
|
// 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.
|
// This is really to distinguish between lines and other images.
|
||||||
// For lines, want to pass drag to canvas, since lines tend to prevent
|
// For lines, want to pass drag to canvas, since lines tend to prevent
|
||||||
@@ -203,7 +205,7 @@ class wxLineShape: public wxShape
|
|||||||
|
|
||||||
// Add an arrowhead.
|
// Add an arrowhead.
|
||||||
wxArrowHead *AddArrow(WXTYPE type, int end = ARROW_POSITION_END,
|
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);
|
wxPseudoMetaFile *mf = NULL, long arrowId = -1);
|
||||||
|
|
||||||
// Add an arrowhead in the position indicated by the reference
|
// Add an arrowhead in the position indicated by the reference
|
||||||
@@ -225,14 +227,14 @@ class wxLineShape: public wxShape
|
|||||||
wxArrowHead *FindArrowHead(long arrowId);
|
wxArrowHead *FindArrowHead(long arrowId);
|
||||||
bool DeleteArrowHead(int position, const wxString& name);
|
bool DeleteArrowHead(int position, const wxString& name);
|
||||||
bool DeleteArrowHead(long arrowId);
|
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 void SetIgnoreOffsets(bool ignore) { m_ignoreArrowOffsets = ignore; }
|
||||||
inline wxList& GetArrows() const { return (wxList&) m_arcArrows; }
|
inline wxList& GetArrows() const { return (wxList&) m_arcArrows; }
|
||||||
|
|
||||||
// Find horizontal width for drawing a line with
|
// Find horizontal width for drawing a line with
|
||||||
// arrows in minimum space. Assume arrows at
|
// arrows in minimum space. Assume arrows at
|
||||||
// END only
|
// END only
|
||||||
float FindMinimumWidth();
|
double FindMinimumWidth();
|
||||||
|
|
||||||
// Set alignment flags. ALIGNMENT NOT IMPLEMENTED.
|
// Set alignment flags. ALIGNMENT NOT IMPLEMENTED.
|
||||||
void SetAlignmentOrientation(bool isEnd, bool isHoriz);
|
void SetAlignmentOrientation(bool isEnd, bool isHoriz);
|
||||||
@@ -269,14 +271,14 @@ protected:
|
|||||||
// probably be the same)
|
// probably be the same)
|
||||||
wxList* m_lineControlPoints;
|
wxList* m_lineControlPoints;
|
||||||
|
|
||||||
float m_arrowSpacing; // Separation between adjacent arrows
|
double m_arrowSpacing; // Separation between adjacent arrows
|
||||||
|
|
||||||
wxShape* m_to;
|
wxShape* m_to;
|
||||||
wxShape* m_from;
|
wxShape* m_from;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
float m_actualTextWidth; // Space the text takes up
|
double m_actualTextWidth; // Space the text takes up
|
||||||
float m_actualTextHeight; // (depends on text content unlike nodes)
|
double m_actualTextHeight; // (depends on text content unlike nodes)
|
||||||
*/
|
*/
|
||||||
int m_attachmentTo; // Attachment point at one end
|
int m_attachmentTo; // Attachment point at one end
|
||||||
int m_attachmentFrom; // Attachment point at other end
|
int m_attachmentFrom; // Attachment point at other end
|
||||||
|
@@ -23,18 +23,22 @@ class wxLineControlPoint: public wxControlPoint
|
|||||||
friend class wxLineShape;
|
friend class wxLineShape;
|
||||||
public:
|
public:
|
||||||
|
|
||||||
wxLineControlPoint(wxShapeCanvas *the_canvas = NULL, wxShape *object = NULL, float size = 0.0,
|
wxLineControlPoint(wxShapeCanvas *the_canvas = NULL, wxShape *object = NULL, double size = 0.0,
|
||||||
float x = 0.0, float y = 0.0, int the_type = 0);
|
double x = 0.0, double y = 0.0, int the_type = 0);
|
||||||
~wxLineControlPoint();
|
~wxLineControlPoint();
|
||||||
|
|
||||||
void OnDraw(wxDC& dc);
|
void OnDraw(wxDC& dc);
|
||||||
void OnDragLeft(bool draw, 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(float x, float y, int keys=0, int attachment = 0);
|
void OnBeginDragLeft(double x, double y, int keys=0, int attachment = 0);
|
||||||
void OnEndDragLeft(float x, float 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);
|
// Obsolete (left-dragging now moves attachment point to new relative position OR new
|
||||||
void OnBeginDragRight(float x, float y, int keys=0, int attachment = 0);
|
// attachment id)
|
||||||
void OnEndDragRight(float x, float y, int keys=0, int attachment = 0);
|
#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:
|
public:
|
||||||
|
|
||||||
@@ -52,17 +56,17 @@ class wxLabelShape: public wxRectangleShape
|
|||||||
DECLARE_DYNAMIC_CLASS(wxLabelShape)
|
DECLARE_DYNAMIC_CLASS(wxLabelShape)
|
||||||
|
|
||||||
public:
|
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();
|
~wxLabelShape();
|
||||||
|
|
||||||
void OnDraw(wxDC& dc);
|
void OnDraw(wxDC& dc);
|
||||||
void OnDrawContents(wxDC& dc);
|
void OnDrawContents(wxDC& dc);
|
||||||
void OnLeftClick(float x, float y, int keys = 0, int attachment = 0);
|
void OnLeftClick(double x, double y, int keys = 0, 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);
|
||||||
void OnDragLeft(bool draw, 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(float x, float y, int keys=0, int attachment = 0);
|
void OnBeginDragLeft(double x, double y, int keys=0, int attachment = 0);
|
||||||
void OnEndDragLeft(float x, float y, int keys=0, int attachment = 0);
|
void OnEndDragLeft(double x, double y, int keys=0, int attachment = 0);
|
||||||
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);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
wxLineShape* m_lineShape;
|
wxLineShape* m_lineShape;
|
||||||
@@ -76,8 +80,8 @@ public:
|
|||||||
* returned values in x and y
|
* returned values in x and y
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void GetPointOnLine(float x1, float y1, float x2, float y2,
|
void GetPointOnLine(double x1, double y1, double x2, double y2,
|
||||||
float length, float *x, float *y);
|
double length, double *x, double *y);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
// _OGL_LINESP_H_
|
// _OGL_LINESP_H_
|
||||||
|
@@ -179,17 +179,17 @@ bool wxXMetaFile::ReadFile(char *file)
|
|||||||
iRight = getsignedshort(handle);
|
iRight = getsignedshort(handle);
|
||||||
iBottom = getsignedshort(handle);
|
iBottom = getsignedshort(handle);
|
||||||
|
|
||||||
left = (float)iLeft;
|
left = (double)iLeft;
|
||||||
top = (float)iTop;
|
top = (double)iTop;
|
||||||
right = (float)iRight;
|
right = (double)iRight;
|
||||||
bottom = (float)iBottom;
|
bottom = (double)iBottom;
|
||||||
|
|
||||||
int inch = getshort(handle);
|
int inch = getshort(handle);
|
||||||
long reserved = getint(handle);
|
long reserved = getint(handle);
|
||||||
int checksum = getshort(handle);
|
int checksum = getshort(handle);
|
||||||
/*
|
/*
|
||||||
float widthInUnits = (float)right - left;
|
double widthInUnits = (double)right - left;
|
||||||
float heightInUnits = (float)bottom - top;
|
double heightInUnits = (double)bottom - top;
|
||||||
*width = (int)((widthInUnits*1440.0)/inch);
|
*width = (int)((widthInUnits*1440.0)/inch);
|
||||||
*height = (int)((heightInUnits*1440.0)/inch);
|
*height = (int)((heightInUnits*1440.0)/inch);
|
||||||
*/
|
*/
|
||||||
@@ -792,13 +792,13 @@ bool wxXMetaFile::Play(wxDC *dc)
|
|||||||
{
|
{
|
||||||
long x1 = rec->param1;
|
long x1 = rec->param1;
|
||||||
long y1 = rec->param2;
|
long y1 = rec->param2;
|
||||||
dc->DrawLine(lastX, lastY, (float)x1, (float)y1);
|
dc->DrawLine(lastX, lastY, (double)x1, (double)y1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case META_MOVETO:
|
case META_MOVETO:
|
||||||
{
|
{
|
||||||
lastX = (float)rec->param1;
|
lastX = (double)rec->param1;
|
||||||
lastY = (float)rec->param2;
|
lastY = (double)rec->param2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case META_EXCLUDECLIPRECT:
|
case META_EXCLUDECLIPRECT:
|
||||||
@@ -818,17 +818,17 @@ bool wxXMetaFile::Play(wxDC *dc)
|
|||||||
// case META_PIE: // DO!!!
|
// case META_PIE: // DO!!!
|
||||||
case META_RECTANGLE:
|
case META_RECTANGLE:
|
||||||
{
|
{
|
||||||
dc->DrawRectangle((float)rec->param1, (float)rec->param2,
|
dc->DrawRectangle((double)rec->param1, (double)rec->param2,
|
||||||
(float)rec->param3 - rec->param1,
|
(double)rec->param3 - rec->param1,
|
||||||
(float)rec->param4 - rec->param2);
|
(double)rec->param4 - rec->param2);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case META_ROUNDRECT:
|
case META_ROUNDRECT:
|
||||||
{
|
{
|
||||||
dc->DrawRoundedRectangle((float)rec->param1, (float)rec->param2,
|
dc->DrawRoundedRectangle((double)rec->param1, (double)rec->param2,
|
||||||
(float)rec->param3 - rec->param1,
|
(double)rec->param3 - rec->param1,
|
||||||
(float)rec->param4 - rec->param2,
|
(double)rec->param4 - rec->param2,
|
||||||
(float)rec->param5);
|
(double)rec->param5);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// case META_PATBLT:
|
// case META_PATBLT:
|
||||||
|
@@ -183,15 +183,15 @@ class wxMetaRecord: public wxObject
|
|||||||
class wxXMetaFile: public wxObject
|
class wxXMetaFile: public wxObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
float lastX;
|
double lastX;
|
||||||
float lastY;
|
double lastY;
|
||||||
bool ok;
|
bool ok;
|
||||||
|
|
||||||
float left;
|
double left;
|
||||||
float top;
|
double top;
|
||||||
float right;
|
double right;
|
||||||
float bottom;
|
double bottom;
|
||||||
|
|
||||||
wxList metaRecords;
|
wxList metaRecords;
|
||||||
wxList gdiObjects; // List of wxMetaRecord objects created with Create...,
|
wxList gdiObjects; // List of wxMetaRecord objects created with Create...,
|
||||||
// referenced by position in list by SelectObject
|
// referenced by position in list by SelectObject
|
||||||
|
@@ -45,36 +45,35 @@
|
|||||||
#include "constrnt.h"
|
#include "constrnt.h"
|
||||||
#include "composit.h"
|
#include "composit.h"
|
||||||
|
|
||||||
wxFont *g_oglNormalFont;
|
wxFont* g_oglNormalFont;
|
||||||
|
wxPen* g_oglBlackPen;
|
||||||
|
wxPen* g_oglWhiteBackgroundPen;
|
||||||
|
wxPen* g_oglTransparentPen;
|
||||||
|
wxBrush* g_oglWhiteBackgroundBrush;
|
||||||
|
wxPen* g_oglBlackForegroundPen;
|
||||||
|
wxCursor* g_oglBullseyeCursor = NULL;
|
||||||
|
|
||||||
wxPen *black_pen;
|
char* oglBuffer = NULL;
|
||||||
wxPen *white_background_pen;
|
|
||||||
wxPen *transparent_pen;
|
|
||||||
wxBrush *white_background_brush;
|
|
||||||
wxPen *black_foreground_pen;
|
|
||||||
|
|
||||||
char *GraphicsBuffer = NULL;
|
wxList oglObjectCopyMapping(wxKEY_INTEGER);
|
||||||
wxCursor *GraphicsBullseyeCursor = NULL;
|
|
||||||
|
|
||||||
wxList wxObjectCopyMapping(wxKEY_INTEGER);
|
|
||||||
|
|
||||||
void wxOGLInitialize()
|
void wxOGLInitialize()
|
||||||
{
|
{
|
||||||
GraphicsBullseyeCursor = new wxCursor(wxCURSOR_BULLSEYE);
|
g_oglBullseyeCursor = new wxCursor(wxCURSOR_BULLSEYE);
|
||||||
|
|
||||||
g_oglNormalFont = new wxFont(10, wxSWISS, wxNORMAL, wxNORMAL);
|
g_oglNormalFont = new wxFont(10, wxSWISS, wxNORMAL, wxNORMAL);
|
||||||
|
|
||||||
black_pen = new wxPen("BLACK", 1, wxSOLID);
|
g_oglBlackPen = new wxPen("BLACK", 1, wxSOLID);
|
||||||
|
|
||||||
white_background_pen = new wxPen("WHITE", 1, wxSOLID);
|
g_oglWhiteBackgroundPen = new wxPen("WHITE", 1, wxSOLID);
|
||||||
transparent_pen = new wxPen("WHITE", 1, wxTRANSPARENT);
|
g_oglTransparentPen = new wxPen("WHITE", 1, wxTRANSPARENT);
|
||||||
white_background_brush = new wxBrush("WHITE", wxSOLID);
|
g_oglWhiteBackgroundBrush = new wxBrush("WHITE", wxSOLID);
|
||||||
black_foreground_pen = new wxPen("BLACK", 1, wxSOLID);
|
g_oglBlackForegroundPen = new wxPen("BLACK", 1, wxSOLID);
|
||||||
|
|
||||||
OGLInitializeConstraintTypes();
|
OGLInitializeConstraintTypes();
|
||||||
|
|
||||||
// Initialize big buffer used when writing images
|
// Initialize big buffer used when writing images
|
||||||
GraphicsBuffer = new char[3000];
|
oglBuffer = new char[3000];
|
||||||
|
|
||||||
if (!oglPopupDivisionMenu)
|
if (!oglPopupDivisionMenu)
|
||||||
{
|
{
|
||||||
@@ -89,52 +88,58 @@ void wxOGLInitialize()
|
|||||||
|
|
||||||
void wxOGLCleanUp()
|
void wxOGLCleanUp()
|
||||||
{
|
{
|
||||||
if (GraphicsBuffer)
|
if (oglBuffer)
|
||||||
{
|
{
|
||||||
delete[] GraphicsBuffer;
|
delete[] oglBuffer;
|
||||||
GraphicsBuffer = NULL;
|
oglBuffer = NULL;
|
||||||
}
|
}
|
||||||
GraphicsBuffer = NULL;
|
oglBuffer = NULL;
|
||||||
if (oglPopupDivisionMenu)
|
if (oglPopupDivisionMenu)
|
||||||
{
|
{
|
||||||
delete oglPopupDivisionMenu;
|
delete oglPopupDivisionMenu;
|
||||||
oglPopupDivisionMenu = NULL;
|
oglPopupDivisionMenu = NULL;
|
||||||
}
|
}
|
||||||
|
if (g_oglBullseyeCursor)
|
||||||
|
{
|
||||||
|
delete g_oglBullseyeCursor;
|
||||||
|
g_oglBullseyeCursor = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (g_oglNormalFont)
|
if (g_oglNormalFont)
|
||||||
{
|
{
|
||||||
delete g_oglNormalFont;
|
delete g_oglNormalFont;
|
||||||
g_oglNormalFont = NULL;
|
g_oglNormalFont = NULL;
|
||||||
}
|
}
|
||||||
if (black_pen)
|
if (g_oglBlackPen)
|
||||||
{
|
{
|
||||||
delete black_pen;
|
delete g_oglBlackPen;
|
||||||
black_pen = NULL;
|
g_oglBlackPen = NULL;
|
||||||
}
|
}
|
||||||
if (white_background_pen)
|
if (g_oglWhiteBackgroundPen)
|
||||||
{
|
{
|
||||||
delete white_background_pen;
|
delete g_oglWhiteBackgroundPen;
|
||||||
white_background_pen = NULL;
|
g_oglWhiteBackgroundPen = NULL;
|
||||||
}
|
}
|
||||||
if (transparent_pen)
|
if (g_oglTransparentPen)
|
||||||
{
|
{
|
||||||
delete transparent_pen;
|
delete g_oglTransparentPen;
|
||||||
transparent_pen = NULL;
|
g_oglTransparentPen = NULL;
|
||||||
}
|
}
|
||||||
if (white_background_brush)
|
if (g_oglWhiteBackgroundBrush)
|
||||||
{
|
{
|
||||||
delete white_background_brush;
|
delete g_oglWhiteBackgroundBrush;
|
||||||
white_background_brush = NULL;
|
g_oglWhiteBackgroundBrush = NULL;
|
||||||
}
|
}
|
||||||
if (black_foreground_pen)
|
if (g_oglBlackForegroundPen)
|
||||||
{
|
{
|
||||||
delete black_foreground_pen;
|
delete g_oglBlackForegroundPen;
|
||||||
black_foreground_pen = NULL;
|
g_oglBlackForegroundPen = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
OGLCleanUpConstraintTypes();
|
OGLCleanUpConstraintTypes();
|
||||||
}
|
}
|
||||||
|
|
||||||
wxFont *MatchFont(int point_size)
|
wxFont *oglMatchFont(int point_size)
|
||||||
{
|
{
|
||||||
wxFont *font = wxTheFontList->FindOrCreateFont(point_size, wxSWISS, wxNORMAL, wxNORMAL);
|
wxFont *font = wxTheFontList->FindOrCreateFont(point_size, wxSWISS, wxNORMAL, wxNORMAL);
|
||||||
#if 0
|
#if 0
|
||||||
@@ -202,7 +207,7 @@ int FontSizeDialog(wxFrame *parent, int old_size)
|
|||||||
{
|
{
|
||||||
int size;
|
int size;
|
||||||
sscanf(ans, "%d", &size);
|
sscanf(ans, "%d", &size);
|
||||||
return MatchFont(size);
|
return oglMatchFont(size);
|
||||||
}
|
}
|
||||||
else return NULL;
|
else return NULL;
|
||||||
*/
|
*/
|
||||||
@@ -211,8 +216,8 @@ int FontSizeDialog(wxFrame *parent, int old_size)
|
|||||||
// Centre a list of strings in the given box. xOffset and yOffset are the
|
// Centre a list of strings in the given box. xOffset and yOffset are the
|
||||||
// the positions that these lines should be relative to, and this might be
|
// the positions that these lines should be relative to, and this might be
|
||||||
// the same as m_xpos, m_ypos, but might be zero if formatting from left-justifying.
|
// the same as m_xpos, m_ypos, but might be zero if formatting from left-justifying.
|
||||||
void CentreText(wxDC& dc, wxList *text_list,
|
void oglCentreText(wxDC& dc, wxList *text_list,
|
||||||
float m_xpos, float m_ypos, float width, float height,
|
double m_xpos, double m_ypos, double width, double height,
|
||||||
int formatMode)
|
int formatMode)
|
||||||
{
|
{
|
||||||
int n = text_list->Number();
|
int n = text_list->Number();
|
||||||
@@ -222,12 +227,12 @@ void CentreText(wxDC& dc, wxList *text_list,
|
|||||||
|
|
||||||
// First, get maximum dimensions of box enclosing text
|
// First, get maximum dimensions of box enclosing text
|
||||||
|
|
||||||
float char_height = 0;
|
long char_height = 0;
|
||||||
float max_width = 0;
|
long max_width = 0;
|
||||||
float current_width = 0;
|
long current_width = 0;
|
||||||
|
|
||||||
// Store text extents for speed
|
// Store text extents for speed
|
||||||
float *widths = new float[n];
|
double *widths = new double[n];
|
||||||
|
|
||||||
wxNode *current = text_list->First();
|
wxNode *current = text_list->First();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@@ -243,16 +248,16 @@ void CentreText(wxDC& dc, wxList *text_list,
|
|||||||
i ++;
|
i ++;
|
||||||
}
|
}
|
||||||
|
|
||||||
float max_height = n*char_height;
|
double max_height = n*char_height;
|
||||||
|
|
||||||
float xoffset, yoffset, xOffset, yOffset;
|
double xoffset, yoffset, xOffset, yOffset;
|
||||||
|
|
||||||
if (formatMode & FORMAT_CENTRE_VERT)
|
if (formatMode & FORMAT_CENTRE_VERT)
|
||||||
{
|
{
|
||||||
if (max_height < height)
|
if (max_height < height)
|
||||||
yoffset = (float)(m_ypos - (height/2.0) + (height - max_height)/2.0);
|
yoffset = (double)(m_ypos - (height/2.0) + (height - max_height)/2.0);
|
||||||
else
|
else
|
||||||
yoffset = (float)(m_ypos - (height/2.0));
|
yoffset = (double)(m_ypos - (height/2.0));
|
||||||
yOffset = m_ypos;
|
yOffset = m_ypos;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -263,7 +268,7 @@ void CentreText(wxDC& dc, wxList *text_list,
|
|||||||
|
|
||||||
if (formatMode & FORMAT_CENTRE_HORIZ)
|
if (formatMode & FORMAT_CENTRE_HORIZ)
|
||||||
{
|
{
|
||||||
xoffset = (float)(m_xpos - width/2.0);
|
xoffset = (double)(m_xpos - width/2.0);
|
||||||
xOffset = m_xpos;
|
xOffset = m_xpos;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -279,12 +284,12 @@ void CentreText(wxDC& dc, wxList *text_list,
|
|||||||
{
|
{
|
||||||
wxShapeTextLine *line = (wxShapeTextLine *)current->Data();
|
wxShapeTextLine *line = (wxShapeTextLine *)current->Data();
|
||||||
|
|
||||||
float x;
|
double x;
|
||||||
if ((formatMode & FORMAT_CENTRE_HORIZ) && (widths[i] < width))
|
if ((formatMode & FORMAT_CENTRE_HORIZ) && (widths[i] < width))
|
||||||
x = (float)((width - widths[i])/2.0 + xoffset);
|
x = (double)((width - widths[i])/2.0 + xoffset);
|
||||||
else
|
else
|
||||||
x = xoffset;
|
x = xoffset;
|
||||||
float y = (float)(i*char_height + yoffset);
|
double y = (double)(i*char_height + yoffset);
|
||||||
|
|
||||||
line->SetX( x - xOffset ); line->SetY( y - yOffset );
|
line->SetX( x - xOffset ); line->SetY( y - yOffset );
|
||||||
current = current->Next();
|
current = current->Next();
|
||||||
@@ -295,8 +300,8 @@ void CentreText(wxDC& dc, wxList *text_list,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Centre a list of strings in the given box
|
// Centre a list of strings in the given box
|
||||||
void CentreTextNoClipping(wxDC& dc, wxList *text_list,
|
void oglCentreTextNoClipping(wxDC& dc, wxList *text_list,
|
||||||
float m_xpos, float m_ypos, float width, float height)
|
double m_xpos, double m_ypos, double width, double height)
|
||||||
{
|
{
|
||||||
int n = text_list->Number();
|
int n = text_list->Number();
|
||||||
|
|
||||||
@@ -305,12 +310,12 @@ void CentreTextNoClipping(wxDC& dc, wxList *text_list,
|
|||||||
|
|
||||||
// First, get maximum dimensions of box enclosing text
|
// First, get maximum dimensions of box enclosing text
|
||||||
|
|
||||||
float char_height = 0;
|
long char_height = 0;
|
||||||
float max_width = 0;
|
long max_width = 0;
|
||||||
float current_width = 0;
|
long current_width = 0;
|
||||||
|
|
||||||
// Store text extents for speed
|
// Store text extents for speed
|
||||||
float *widths = new float[n];
|
double *widths = new double[n];
|
||||||
|
|
||||||
wxNode *current = text_list->First();
|
wxNode *current = text_list->First();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@@ -326,11 +331,11 @@ void CentreTextNoClipping(wxDC& dc, wxList *text_list,
|
|||||||
i ++;
|
i ++;
|
||||||
}
|
}
|
||||||
|
|
||||||
float max_height = n*char_height;
|
double max_height = n*char_height;
|
||||||
|
|
||||||
float yoffset = (float)(m_ypos - (height/2.0) + (height - max_height)/2.0);
|
double yoffset = (double)(m_ypos - (height/2.0) + (height - max_height)/2.0);
|
||||||
|
|
||||||
float xoffset = (float)(m_xpos - width/2.0);
|
double xoffset = (double)(m_xpos - width/2.0);
|
||||||
|
|
||||||
current = text_list->First();
|
current = text_list->First();
|
||||||
i = 0;
|
i = 0;
|
||||||
@@ -339,8 +344,8 @@ void CentreTextNoClipping(wxDC& dc, wxList *text_list,
|
|||||||
{
|
{
|
||||||
wxShapeTextLine *line = (wxShapeTextLine *)current->Data();
|
wxShapeTextLine *line = (wxShapeTextLine *)current->Data();
|
||||||
|
|
||||||
float x = (float)((width - widths[i])/2.0 + xoffset);
|
double x = (double)((width - widths[i])/2.0 + xoffset);
|
||||||
float y = (float)(i*char_height + yoffset);
|
double y = (double)(i*char_height + yoffset);
|
||||||
|
|
||||||
line->SetX( x - m_xpos ); line->SetY( y - m_ypos );
|
line->SetX( x - m_xpos ); line->SetY( y - m_ypos );
|
||||||
current = current->Next();
|
current = current->Next();
|
||||||
@@ -349,9 +354,9 @@ void CentreTextNoClipping(wxDC& dc, wxList *text_list,
|
|||||||
delete widths;
|
delete widths;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GetCentredTextExtent(wxDC& dc, wxList *text_list,
|
void oglGetCentredTextExtent(wxDC& dc, wxList *text_list,
|
||||||
float m_xpos, float m_ypos, float width, float height,
|
double m_xpos, double m_ypos, double width, double height,
|
||||||
float *actual_width, float *actual_height)
|
double *actual_width, double *actual_height)
|
||||||
{
|
{
|
||||||
int n = text_list->Number();
|
int n = text_list->Number();
|
||||||
|
|
||||||
@@ -364,9 +369,9 @@ void GetCentredTextExtent(wxDC& dc, wxList *text_list,
|
|||||||
|
|
||||||
// First, get maximum dimensions of box enclosing text
|
// First, get maximum dimensions of box enclosing text
|
||||||
|
|
||||||
float char_height = 0;
|
long char_height = 0;
|
||||||
float max_width = 0;
|
long max_width = 0;
|
||||||
float current_width = 0;
|
long current_width = 0;
|
||||||
|
|
||||||
wxNode *current = text_list->First();
|
wxNode *current = text_list->First();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
@@ -387,10 +392,10 @@ void GetCentredTextExtent(wxDC& dc, wxList *text_list,
|
|||||||
|
|
||||||
// Format a string to a list of strings that fit in the given box.
|
// Format a string to a list of strings that fit in the given box.
|
||||||
// Interpret %n and 10 or 13 as a new line.
|
// Interpret %n and 10 or 13 as a new line.
|
||||||
wxList *FormatText(wxDC& dc, const wxString& text, float width, float height, int formatMode)
|
wxStringList *oglFormatText(wxDC& dc, const wxString& text, double width, double height, int formatMode)
|
||||||
{
|
{
|
||||||
// First, parse the string into a list of words
|
// First, parse the string into a list of words
|
||||||
wxList word_list;
|
wxStringList word_list;
|
||||||
|
|
||||||
// Make new lines into NULL strings at this point
|
// Make new lines into NULL strings at this point
|
||||||
int i = 0; int j = 0; int len = strlen(text);
|
int i = 0; int j = 0; int len = strlen(text);
|
||||||
@@ -451,25 +456,23 @@ wxList *FormatText(wxDC& dc, const wxString& text, float width, float height, in
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Now, make a list of strings which can fit in the box
|
// Now, make a list of strings which can fit in the box
|
||||||
wxList *string_list = new wxList;
|
wxStringList *string_list = new wxStringList;
|
||||||
|
|
||||||
char buffer[400];
|
char buffer[400];
|
||||||
buffer[0] = 0;
|
buffer[0] = 0;
|
||||||
wxNode *node = word_list.First();
|
wxNode *node = word_list.First();
|
||||||
float x, y;
|
long x, y;
|
||||||
|
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
char *keep_string = copystring(buffer);
|
wxString oldBuffer(buffer);
|
||||||
|
|
||||||
char *s = (char *)node->Data();
|
char *s = (char *)node->Data();
|
||||||
if (!s)
|
if (!s)
|
||||||
{
|
{
|
||||||
// FORCE NEW LINE
|
// FORCE NEW LINE
|
||||||
if (strlen(keep_string) > 0)
|
if (strlen(buffer) > 0)
|
||||||
string_list->Append((wxObject *)keep_string);
|
string_list->Add(buffer);
|
||||||
else
|
|
||||||
delete[] keep_string;
|
|
||||||
|
|
||||||
buffer[0] = 0;
|
buffer[0] = 0;
|
||||||
}
|
}
|
||||||
@@ -485,52 +488,47 @@ wxList *FormatText(wxDC& dc, const wxString& text, float width, float height, in
|
|||||||
if ((x > width) && !(formatMode & FORMAT_SIZE_TO_CONTENTS))
|
if ((x > width) && !(formatMode & FORMAT_SIZE_TO_CONTENTS))
|
||||||
{
|
{
|
||||||
// Deal with first word being wider than box
|
// Deal with first word being wider than box
|
||||||
if (strlen(keep_string) > 0)
|
if (oldBuffer.Length() > 0)
|
||||||
string_list->Append((wxObject *)keep_string);
|
string_list->Add(oldBuffer);
|
||||||
else
|
|
||||||
delete[] keep_string;
|
|
||||||
|
|
||||||
buffer[0] = 0;
|
buffer[0] = 0;
|
||||||
strcat(buffer, s);
|
strcat(buffer, s);
|
||||||
delete[] s;
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
delete[] keep_string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
node = node->Next();
|
node = node->Next();
|
||||||
}
|
}
|
||||||
if (buffer[0] != 0)
|
if (buffer[0] != 0)
|
||||||
string_list->Append((wxObject *)copystring(buffer));
|
string_list->Add(buffer);
|
||||||
|
|
||||||
return string_list;
|
return string_list;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawFormattedText(wxDC& dc, wxList *text_list,
|
void oglDrawFormattedText(wxDC& dc, wxList *text_list,
|
||||||
float m_xpos, float m_ypos, float width, float height,
|
double m_xpos, double m_ypos, double width, double height,
|
||||||
int formatMode)
|
int formatMode)
|
||||||
{
|
{
|
||||||
float xoffset, yoffset;
|
double xoffset, yoffset;
|
||||||
if (formatMode & FORMAT_CENTRE_HORIZ)
|
if (formatMode & FORMAT_CENTRE_HORIZ)
|
||||||
xoffset = m_xpos;
|
xoffset = m_xpos;
|
||||||
else
|
else
|
||||||
xoffset = (float)(m_xpos - (width / 2.0));
|
xoffset = (double)(m_xpos - (width / 2.0));
|
||||||
|
|
||||||
if (formatMode & FORMAT_CENTRE_VERT)
|
if (formatMode & FORMAT_CENTRE_VERT)
|
||||||
yoffset = m_ypos;
|
yoffset = m_ypos;
|
||||||
else
|
else
|
||||||
yoffset = (float)(m_ypos - (height / 2.0));
|
yoffset = (double)(m_ypos - (height / 2.0));
|
||||||
|
|
||||||
dc.SetClippingRegion(
|
dc.SetClippingRegion(
|
||||||
(float)(m_xpos - width/2.0), (float)(m_ypos - height/2.0),
|
(double)(m_xpos - width/2.0), (double)(m_ypos - height/2.0),
|
||||||
(float)width, (float)height);
|
(double)width, (double)height);
|
||||||
|
|
||||||
wxNode *current = text_list->First();
|
wxNode *current = text_list->First();
|
||||||
while (current)
|
while (current)
|
||||||
{
|
{
|
||||||
wxShapeTextLine *line = (wxShapeTextLine *)current->Data();
|
wxShapeTextLine *line = (wxShapeTextLine *)current->Data();
|
||||||
|
|
||||||
dc.DrawText(line->GetText(), xoffset + line->GetX(), yoffset + line->GetY());
|
dc.DrawText(line->GetText(), WXROUND(xoffset + line->GetX()), WXROUND(yoffset + line->GetY()));
|
||||||
current = current->Next();
|
current = current->Next();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -542,10 +540,10 @@ void DrawFormattedText(wxDC& dc, wxList *text_list,
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void find_polyline_centroid(wxList *points, float *x, float *y)
|
void oglFindPolylineCentroid(wxList *points, double *x, double *y)
|
||||||
{
|
{
|
||||||
float xcount = 0;
|
double xcount = 0;
|
||||||
float ycount = 0;
|
double ycount = 0;
|
||||||
|
|
||||||
wxNode *node = points->First();
|
wxNode *node = points->First();
|
||||||
while (node)
|
while (node)
|
||||||
@@ -567,16 +565,16 @@ void find_polyline_centroid(wxList *points, float *x, float *y)
|
|||||||
* Used by functions below.
|
* Used by functions below.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void check_line_intersection(float x1, float y1, float x2, float y2,
|
void oglCheckLineIntersection(double x1, double y1, double x2, double y2,
|
||||||
float x3, float y3, float x4, float y4,
|
double x3, double y3, double x4, double y4,
|
||||||
float *ratio1, float *ratio2)
|
double *ratio1, double *ratio2)
|
||||||
{
|
{
|
||||||
float denominator_term = (y4 - y3)*(x2 - x1) - (y2 - y1)*(x4 - x3);
|
double denominator_term = (y4 - y3)*(x2 - x1) - (y2 - y1)*(x4 - x3);
|
||||||
float numerator_term = (x3 - x1)*(y4 - y3) + (x4 - x3)*(y1 - y3);
|
double numerator_term = (x3 - x1)*(y4 - y3) + (x4 - x3)*(y1 - y3);
|
||||||
|
|
||||||
float line_constant;
|
double line_constant;
|
||||||
float length_ratio = 1.0;
|
double length_ratio = 1.0;
|
||||||
float k_line = 1.0;
|
double k_line = 1.0;
|
||||||
|
|
||||||
// Check for parallel lines
|
// Check for parallel lines
|
||||||
if ((denominator_term < 0.005) && (denominator_term > -0.005))
|
if ((denominator_term < 0.005) && (denominator_term > -0.005))
|
||||||
@@ -607,20 +605,20 @@ void check_line_intersection(float x1, float y1, float x2, float y2,
|
|||||||
* (*x3, *y3) is the point where it hits.
|
* (*x3, *y3) is the point where it hits.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void find_end_for_polyline(float n, float xvec[], float yvec[],
|
void oglFindEndForPolyline(double n, double xvec[], double yvec[],
|
||||||
float x1, float y1, float x2, float y2, float *x3, float *y3)
|
double x1, double y1, double x2, double y2, double *x3, double *y3)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
float lastx = xvec[0];
|
double lastx = xvec[0];
|
||||||
float lasty = yvec[0];
|
double lasty = yvec[0];
|
||||||
|
|
||||||
float min_ratio = 1.0;
|
double min_ratio = 1.0;
|
||||||
float line_ratio;
|
double line_ratio;
|
||||||
float other_ratio;
|
double other_ratio;
|
||||||
|
|
||||||
for (i = 1; i < n; i++)
|
for (i = 1; i < n; i++)
|
||||||
{
|
{
|
||||||
check_line_intersection(x1, y1, x2, y2, lastx, lasty, xvec[i], yvec[i],
|
oglCheckLineIntersection(x1, y1, x2, y2, lastx, lasty, xvec[i], yvec[i],
|
||||||
&line_ratio, &other_ratio);
|
&line_ratio, &other_ratio);
|
||||||
lastx = xvec[i];
|
lastx = xvec[i];
|
||||||
lasty = yvec[i];
|
lasty = yvec[i];
|
||||||
@@ -629,10 +627,10 @@ void find_end_for_polyline(float n, float xvec[], float yvec[],
|
|||||||
min_ratio = line_ratio;
|
min_ratio = line_ratio;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do last (implicit) line if last and first floats are not identical
|
// Do last (implicit) line if last and first doubles are not identical
|
||||||
if (!(xvec[0] == lastx && yvec[0] == lasty))
|
if (!(xvec[0] == lastx && yvec[0] == lasty))
|
||||||
{
|
{
|
||||||
check_line_intersection(x1, y1, x2, y2, lastx, lasty, xvec[0], yvec[0],
|
oglCheckLineIntersection(x1, y1, x2, y2, lastx, lasty, xvec[0], yvec[0],
|
||||||
&line_ratio, &other_ratio);
|
&line_ratio, &other_ratio);
|
||||||
|
|
||||||
if (line_ratio < min_ratio)
|
if (line_ratio < min_ratio)
|
||||||
@@ -649,26 +647,26 @@ void find_end_for_polyline(float n, float xvec[], float yvec[],
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void find_end_for_box(float width, float height,
|
void oglFindEndForBox(double width, double height,
|
||||||
float x1, float y1, // Centre of box (possibly)
|
double x1, double y1, // Centre of box (possibly)
|
||||||
float x2, float y2, // other end of line
|
double x2, double y2, // other end of line
|
||||||
float *x3, float *y3) // End on box edge
|
double *x3, double *y3) // End on box edge
|
||||||
{
|
{
|
||||||
float xvec[5];
|
double xvec[5];
|
||||||
float yvec[5];
|
double yvec[5];
|
||||||
|
|
||||||
xvec[0] = (float)(x1 - width/2.0);
|
xvec[0] = (double)(x1 - width/2.0);
|
||||||
yvec[0] = (float)(y1 - height/2.0);
|
yvec[0] = (double)(y1 - height/2.0);
|
||||||
xvec[1] = (float)(x1 - width/2.0);
|
xvec[1] = (double)(x1 - width/2.0);
|
||||||
yvec[1] = (float)(y1 + height/2.0);
|
yvec[1] = (double)(y1 + height/2.0);
|
||||||
xvec[2] = (float)(x1 + width/2.0);
|
xvec[2] = (double)(x1 + width/2.0);
|
||||||
yvec[2] = (float)(y1 + height/2.0);
|
yvec[2] = (double)(y1 + height/2.0);
|
||||||
xvec[3] = (float)(x1 + width/2.0);
|
xvec[3] = (double)(x1 + width/2.0);
|
||||||
yvec[3] = (float)(y1 - height/2.0);
|
yvec[3] = (double)(y1 - height/2.0);
|
||||||
xvec[4] = (float)(x1 - width/2.0);
|
xvec[4] = (double)(x1 - width/2.0);
|
||||||
yvec[4] = (float)(y1 - height/2.0);
|
yvec[4] = (double)(y1 - height/2.0);
|
||||||
|
|
||||||
find_end_for_polyline(5, xvec, yvec, x2, y2, x1, y1, x3, y3);
|
oglFindEndForPolyline(5, xvec, yvec, x2, y2, x1, y1, x3, y3);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -676,12 +674,12 @@ void find_end_for_box(float width, float height,
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void find_end_for_circle(float radius,
|
void oglFindEndForCircle(double radius,
|
||||||
float x1, float y1, // Centre of circle
|
double x1, double y1, // Centre of circle
|
||||||
float x2, float y2, // Other end of line
|
double x2, double y2, // Other end of line
|
||||||
float *x3, float *y3)
|
double *x3, double *y3)
|
||||||
{
|
{
|
||||||
float H = (float)sqrt((x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1));
|
double H = (double)sqrt((x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1));
|
||||||
|
|
||||||
if (H == 0.0)
|
if (H == 0.0)
|
||||||
{
|
{
|
||||||
@@ -701,22 +699,22 @@ void find_end_for_circle(float radius,
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void get_arrow_points(float x1, float y1, float x2, float y2,
|
void oglGetArrowPoints(double x1, double y1, double x2, double y2,
|
||||||
float length, float width,
|
double length, double width,
|
||||||
float *tip_x, float *tip_y,
|
double *tip_x, double *tip_y,
|
||||||
float *side1_x, float *side1_y,
|
double *side1_x, double *side1_y,
|
||||||
float *side2_x, float *side2_y)
|
double *side2_x, double *side2_y)
|
||||||
{
|
{
|
||||||
float l = (float)sqrt((x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1));
|
double l = (double)sqrt((x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1));
|
||||||
|
|
||||||
if (l < 0.01)
|
if (l < 0.01)
|
||||||
l = (float) 0.01;
|
l = (double) 0.01;
|
||||||
|
|
||||||
float i_bar = (x2 - x1)/l;
|
double i_bar = (x2 - x1)/l;
|
||||||
float j_bar = (y2 - y1)/l;
|
double j_bar = (y2 - y1)/l;
|
||||||
|
|
||||||
float x3 = (- length*i_bar) + x2;
|
double x3 = (- length*i_bar) + x2;
|
||||||
float y3 = (- length*j_bar) + y2;
|
double y3 = (- length*j_bar) + y2;
|
||||||
|
|
||||||
*side1_x = width*(-j_bar) + x3;
|
*side1_x = width*(-j_bar) + x3;
|
||||||
*side1_y = width*i_bar + y3;
|
*side1_y = width*i_bar + y3;
|
||||||
@@ -738,24 +736,24 @@ void get_arrow_points(float x1, float y1, float x2, float y2,
|
|||||||
* Author: Ian Harrison
|
* Author: Ian Harrison
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void draw_arc_to_ellipse(float x1, float y1, float width1, float height1, float x2, float y2, float x3, float y3,
|
void oglDrawArcToEllipse(double x1, double y1, double width1, double height1, double x2, double y2, double x3, double y3,
|
||||||
float *x4, float *y4)
|
double *x4, double *y4)
|
||||||
{
|
{
|
||||||
float a1 = (float)(width1/2.0);
|
double a1 = (double)(width1/2.0);
|
||||||
float b1 = (float)(height1/2.0);
|
double b1 = (double)(height1/2.0);
|
||||||
|
|
||||||
// These are required to give top left x and y coordinates for DrawEllipse
|
// These are required to give top left x and y coordinates for DrawEllipse
|
||||||
// float top_left_x1 = (float)(x1 - a1);
|
// double top_left_x1 = (double)(x1 - a1);
|
||||||
// float top_left_y1 = (float)(y1 - b1);
|
// double top_left_y1 = (double)(y1 - b1);
|
||||||
/*
|
/*
|
||||||
// Check for vertical line
|
// Check for vertical line
|
||||||
if (fabs(x2 - x3) < 0.05)
|
if (fabs(x2 - x3) < 0.05)
|
||||||
{
|
{
|
||||||
*x4 = x3;
|
*x4 = x3;
|
||||||
if (y2 < y3)
|
if (y2 < y3)
|
||||||
*y4 = (float)(y1 - b1);
|
*y4 = (double)(y1 - b1);
|
||||||
else
|
else
|
||||||
*y4 = (float)(y1 + b1);
|
*y4 = (double)(y1 + b1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
@@ -764,39 +762,39 @@ void draw_arc_to_ellipse(float x1, float y1, float width1, float height1, float
|
|||||||
{
|
{
|
||||||
*x4 = x2;
|
*x4 = x2;
|
||||||
if (y3 > y2)
|
if (y3 > y2)
|
||||||
*y4 = (float)(y1 - sqrt((b1*b1 - (((x2-x1)*(x2-x1))*(b1*b1)/(a1*a1)))));
|
*y4 = (double)(y1 - sqrt((b1*b1 - (((x2-x1)*(x2-x1))*(b1*b1)/(a1*a1)))));
|
||||||
else
|
else
|
||||||
*y4 = (float)(y1 + sqrt((b1*b1 - (((x2-x1)*(x2-x1))*(b1*b1)/(a1*a1)))));
|
*y4 = (double)(y1 + sqrt((b1*b1 - (((x2-x1)*(x2-x1))*(b1*b1)/(a1*a1)))));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate the x and y coordinates of the point where arc intersects ellipse
|
// Calculate the x and y coordinates of the point where arc intersects ellipse
|
||||||
|
|
||||||
float A, B, C, D, E, F, G, H, K;
|
double A, B, C, D, E, F, G, H, K;
|
||||||
float ellipse1_x, ellipse1_y;
|
double ellipse1_x, ellipse1_y;
|
||||||
|
|
||||||
A = (float)(1/(a1 * a1));
|
A = (double)(1/(a1 * a1));
|
||||||
B = (float)((y3 - y2) * (y3 - y2)) / ((x3 - x2) * (x3 - x2) * b1 * b1);
|
B = (double)((y3 - y2) * (y3 - y2)) / ((x3 - x2) * (x3 - x2) * b1 * b1);
|
||||||
C = (float)(2 * (y3 - y2) * (y2 - y1)) / ((x3 - x2) * b1 * b1);
|
C = (double)(2 * (y3 - y2) * (y2 - y1)) / ((x3 - x2) * b1 * b1);
|
||||||
D = (float)((y2 - y1) * (y2 - y1)) / (b1 * b1);
|
D = (double)((y2 - y1) * (y2 - y1)) / (b1 * b1);
|
||||||
E = (float)(A + B);
|
E = (double)(A + B);
|
||||||
F = (float)(C - (2 * A * x1) - (2 * B * x2));
|
F = (double)(C - (2 * A * x1) - (2 * B * x2));
|
||||||
G = (float)((A * x1 * x1) + (B * x2 * x2) - (C * x2) + D - 1);
|
G = (double)((A * x1 * x1) + (B * x2 * x2) - (C * x2) + D - 1);
|
||||||
H = (float)((y3 - y2) / (x3 - x2));
|
H = (double)((y3 - y2) / (x3 - x2));
|
||||||
K = (float)((F * F) - (4 * E * G));
|
K = (double)((F * F) - (4 * E * G));
|
||||||
|
|
||||||
if (K >= 0)
|
if (K >= 0)
|
||||||
// In this case the line intersects the ellipse, so calculate intersection
|
// In this case the line intersects the ellipse, so calculate intersection
|
||||||
{
|
{
|
||||||
if(x2 >= x1)
|
if(x2 >= x1)
|
||||||
{
|
{
|
||||||
ellipse1_x = (float)(((F * -1) + sqrt(K)) / (2 * E));
|
ellipse1_x = (double)(((F * -1) + sqrt(K)) / (2 * E));
|
||||||
ellipse1_y = (float)((H * (ellipse1_x - x2)) + y2);
|
ellipse1_y = (double)((H * (ellipse1_x - x2)) + y2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ellipse1_x = (float)(((F * -1) - sqrt(K)) / (2 * E));
|
ellipse1_x = (double)(((F * -1) - sqrt(K)) / (2 * E));
|
||||||
ellipse1_y = (float)((H * (ellipse1_x - x2)) + y2);
|
ellipse1_y = (double)((H * (ellipse1_x - x2)) + y2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -812,8 +810,8 @@ void draw_arc_to_ellipse(float x1, float y1, float width1, float height1, float
|
|||||||
// Draw a little circle (radius = 2) at the end of the arc where it hits
|
// Draw a little circle (radius = 2) at the end of the arc where it hits
|
||||||
// the ellipse .
|
// the ellipse .
|
||||||
|
|
||||||
float circle_x = ellipse1_x - 2.0;
|
double circle_x = ellipse1_x - 2.0;
|
||||||
float circle_y = ellipse1_y - 2.0;
|
double circle_y = ellipse1_y - 2.0;
|
||||||
m_canvas->DrawEllipse(circle_x, circle_y, 4.0, 4.0);
|
m_canvas->DrawEllipse(circle_x, circle_y, 4.0, 4.0);
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
@@ -834,6 +832,12 @@ void UpdateListBox(wxListBox *item, wxList *list)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool oglRoughlyEqual(double val1, double val2, double tol)
|
||||||
|
{
|
||||||
|
return ( (val1 < (val2 + tol)) && (val1 > (val2 - tol)) &&
|
||||||
|
(val2 < (val1 + tol)) && (val2 > (val1 - tol)));
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Hex<->Dec conversion
|
* Hex<->Dec conversion
|
||||||
*/
|
*/
|
||||||
|
@@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
// List to use when copying objects; may need to associate elements of new objects
|
// 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
|
// with elements of old objects, e.g. when copying constraint.s
|
||||||
extern wxList wxObjectCopyMapping;
|
extern wxList oglObjectCopyMapping;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TEXT FORMATTING FUNCTIONS
|
* TEXT FORMATTING FUNCTIONS
|
||||||
@@ -27,55 +27,55 @@ extern wxList wxObjectCopyMapping;
|
|||||||
|
|
||||||
// Centres the given list of wxShapeTextLine strings in the given box
|
// Centres the given list of wxShapeTextLine strings in the given box
|
||||||
// (changing the positions in situ). Doesn't actually draw into the DC.
|
// (changing the positions in situ). Doesn't actually draw into the DC.
|
||||||
void CentreText(wxDC& dc, wxList *text, float m_xpos, float m_ypos,
|
void oglCentreText(wxDC& dc, wxList *text, double m_xpos, double m_ypos,
|
||||||
float width, float height,
|
double width, double height,
|
||||||
int formatMode = FORMAT_CENTRE_HORIZ | FORMAT_CENTRE_VERT);
|
int formatMode = FORMAT_CENTRE_HORIZ | FORMAT_CENTRE_VERT);
|
||||||
|
|
||||||
// Given a string, returns a list of strings that fit within the given
|
// Given a string, returns a list of strings that fit within the given
|
||||||
// width of box. Height is ignored.
|
// 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.
|
// Centres the list of wxShapeTextLine strings, doesn't clip.
|
||||||
// Doesn't actually draw into the DC.
|
// Doesn't actually draw into the DC.
|
||||||
void CentreTextNoClipping(wxDC& dc, wxList *text_list,
|
void oglCentreTextNoClipping(wxDC& dc, wxList *text_list,
|
||||||
float m_xpos, float m_ypos, float width, float height);
|
double m_xpos, double m_ypos, double width, double height);
|
||||||
|
|
||||||
// Gets the maximum width and height of the given list of wxShapeTextLines.
|
// Gets the maximum width and height of the given list of wxShapeTextLines.
|
||||||
void GetCentredTextExtent(wxDC& dc, wxList *text_list,
|
void oglGetCentredTextExtent(wxDC& dc, wxList *text_list,
|
||||||
float m_xpos, float m_ypos, float width, float height,
|
double m_xpos, double m_ypos, double width, double height,
|
||||||
float *actual_width, float *actual_height);
|
double *actual_width, double *actual_height);
|
||||||
|
|
||||||
// Actually draw the preformatted list of wxShapeTextLines.
|
// Actually draw the preformatted list of wxShapeTextLines.
|
||||||
void DrawFormattedText(wxDC& context, wxList *text_list,
|
void oglDrawFormattedText(wxDC& context, wxList *text_list,
|
||||||
float m_xpos, float m_ypos, float width, float height,
|
double m_xpos, double m_ypos, double width, double height,
|
||||||
int formatMode = FORMAT_CENTRE_HORIZ | FORMAT_CENTRE_VERT);
|
int formatMode = FORMAT_CENTRE_HORIZ | FORMAT_CENTRE_VERT);
|
||||||
|
|
||||||
// Give it a list of points, finds the centre.
|
// 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,
|
void oglCheckLineIntersection(double x1, double y1, double x2, double y2,
|
||||||
float x3, float y3, float x4, float y4,
|
double x3, double y3, double x4, double y4,
|
||||||
float *ratio1, float *ratio2);
|
double *ratio1, double *ratio2);
|
||||||
|
|
||||||
void find_end_for_polyline(float n, float xvec[], float yvec[],
|
void oglFindEndForPolyline(double n, double xvec[], double yvec[],
|
||||||
float x1, float y1, float x2, float y2, float *x3, float *y3);
|
double x1, double y1, double x2, double y2, double *x3, double *y3);
|
||||||
|
|
||||||
|
|
||||||
void find_end_for_box(float width, float height,
|
void oglFindEndForBox(double width, double height,
|
||||||
float x1, float y1, // Centre of box (possibly)
|
double x1, double y1, // Centre of box (possibly)
|
||||||
float x2, float y2, // other end of line
|
double x2, double y2, // other end of line
|
||||||
float *x3, float *y3); // End on box edge
|
double *x3, double *y3); // End on box edge
|
||||||
|
|
||||||
void find_end_for_circle(float radius,
|
void oglFindEndForCircle(double radius,
|
||||||
float x1, float y1, // Centre of circle
|
double x1, double y1, // Centre of circle
|
||||||
float x2, float y2, // Other end of line
|
double x2, double y2, // Other end of line
|
||||||
float *x3, float *y3);
|
double *x3, double *y3);
|
||||||
|
|
||||||
void get_arrow_points(float x1, float y1, float x2, float y2,
|
void oglGetArrowPoints(double x1, double y1, double x2, double y2,
|
||||||
float length, float width,
|
double length, double width,
|
||||||
float *tip_x, float *tip_y,
|
double *tip_x, double *tip_y,
|
||||||
float *side1_x, float *side1_y,
|
double *side1_x, double *side1_y,
|
||||||
float *side2_x, float *side2_y);
|
double *side2_x, double *side2_y);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Given an ellipse and endpoints of a line, returns the point at which
|
* 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
|
* Author: Ian Harrison
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void draw_arc_to_ellipse(float x1, float y1, float a1, float b1, float x2, float y2, float x3, float y3,
|
void oglDrawArcToEllipse(double x1, double y1, double a1, double b1, double x2, double y2, double x3, double y3,
|
||||||
float *x4, float *y4);
|
double *x4, double *y4);
|
||||||
|
|
||||||
extern wxFont *g_oglNormalFont;
|
bool oglRoughlyEqual(double val1, double val2, double tol = 0.00001);
|
||||||
extern wxPen *black_pen;
|
|
||||||
|
|
||||||
extern wxPen *white_background_pen;
|
extern wxFont* g_oglNormalFont;
|
||||||
extern wxPen *transparent_pen;
|
extern wxPen* g_oglBlackPen;
|
||||||
extern wxBrush *white_background_brush;
|
extern wxPen* g_oglWhiteBackgroundPen;
|
||||||
extern wxPen *black_foreground_pen;
|
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 wxString oglColourToHex(const wxColour& colour);
|
extern void oglDecToHex(unsigned int dec, char *buf);
|
||||||
extern wxColour oglHexToColour(const wxString& hex);
|
extern unsigned int oglHexToDec(char* buf);
|
||||||
extern void oglDecToHex(unsigned int dec, char *buf);
|
|
||||||
extern unsigned int oglHexToDec(char* buf);
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -71,12 +71,12 @@ void wxDiagram::SetSnapToGrid(bool snap)
|
|||||||
m_snapToGrid = snap;
|
m_snapToGrid = snap;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDiagram::SetGridSpacing(float spacing)
|
void wxDiagram::SetGridSpacing(double spacing)
|
||||||
{
|
{
|
||||||
m_gridSpacing = spacing;
|
m_gridSpacing = spacing;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxDiagram::Snap(float *x, float *y)
|
void wxDiagram::Snap(double *x, double *y)
|
||||||
{
|
{
|
||||||
if (m_snapToGrid)
|
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);
|
wxPen dottedPen(wxColour(0, 0, 0), 1, wxDOT);
|
||||||
dc.SetPen(dottedPen);
|
dc.SetPen(dottedPen);
|
||||||
|
@@ -33,7 +33,7 @@ public:
|
|||||||
|
|
||||||
virtual void Redraw(wxDC& dc);
|
virtual void Redraw(wxDC& dc);
|
||||||
virtual void Clear(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)
|
// Add object to end of object list (if addAfter is NULL)
|
||||||
// or just after addAfter.
|
// or just after addAfter.
|
||||||
@@ -43,10 +43,10 @@ public:
|
|||||||
virtual void InsertShape(wxShape *object);
|
virtual void InsertShape(wxShape *object);
|
||||||
|
|
||||||
void SetSnapToGrid(bool snap);
|
void SetSnapToGrid(bool snap);
|
||||||
void SetGridSpacing(float spacing);
|
void SetGridSpacing(double spacing);
|
||||||
inline float GetGridSpacing() { return m_gridSpacing; }
|
inline double GetGridSpacing() { return m_gridSpacing; }
|
||||||
inline bool GetSnapToGrid() const { return m_snapToGrid; }
|
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 void SetQuickEditMode(bool qem) { m_quickEditMode = qem; }
|
||||||
inline bool GetQuickEditMode() const { return m_quickEditMode; }
|
inline bool GetQuickEditMode() const { return m_quickEditMode; }
|
||||||
@@ -85,7 +85,7 @@ protected:
|
|||||||
wxShapeCanvas* m_diagramCanvas;
|
wxShapeCanvas* m_diagramCanvas;
|
||||||
bool m_quickEditMode;
|
bool m_quickEditMode;
|
||||||
bool m_snapToGrid;
|
bool m_snapToGrid;
|
||||||
float m_gridSpacing;
|
double m_gridSpacing;
|
||||||
int m_mouseTolerance;
|
int m_mouseTolerance;
|
||||||
wxList* m_shapeList;
|
wxList* m_shapeList;
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user