OGL improvements
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@677 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1,21 +1,20 @@
|
|||||||
src/*.cpp
|
src/*.cpp
|
||||||
src/*.c
|
|
||||||
src/*.h
|
src/*.h
|
||||||
src/*.rc
|
src/*.rc
|
||||||
src/*.def
|
src/*.def
|
||||||
src/*.xbm
|
src/*.xbm
|
||||||
src/make*.*
|
src/*.xpm
|
||||||
|
src/makefile*
|
||||||
src/*.txt
|
src/*.txt
|
||||||
src/*.ico
|
src/*.ico
|
||||||
src/*.bmp
|
src/*.bmp
|
||||||
|
|
||||||
samples/ogledit/*.cpp
|
samples/ogledit/*.cpp
|
||||||
samples/ogledit/*.c
|
|
||||||
samples/ogledit/*.h
|
samples/ogledit/*.h
|
||||||
samples/ogledit/*.rc
|
samples/ogledit/*.rc
|
||||||
samples/ogledit/*.def
|
samples/ogledit/*.def
|
||||||
samples/ogledit/*.xbm
|
samples/ogledit/*.xbm
|
||||||
samples/ogledit/make*.*
|
samples/ogledit/makefile*
|
||||||
samples/ogledit/*.txt
|
samples/ogledit/*.txt
|
||||||
|
|
||||||
samples/ogledit/*.ico
|
samples/ogledit/*.ico
|
||||||
@@ -23,6 +22,7 @@ samples/ogledit/*.bmp
|
|||||||
samples/ogledit/bitmaps/*.bmp
|
samples/ogledit/bitmaps/*.bmp
|
||||||
samples/ogledit/bitmaps/*.gif
|
samples/ogledit/bitmaps/*.gif
|
||||||
samples/ogledit/bitmaps/*.xbm
|
samples/ogledit/bitmaps/*.xbm
|
||||||
|
samples/ogledit/bitmaps/*.xpm
|
||||||
|
|
||||||
distrib/*.rsp
|
distrib/*.rsp
|
||||||
distrib/*.bat
|
distrib/*.bat
|
||||||
|
@@ -1056,11 +1056,11 @@ bool wxShape::AttachmentSortTest(int attachmentPoint, const wxRealPoint& pt1, co
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxShape::MoveLineToNewAttachment(wxDC& dc, wxLineShape *to_move,
|
bool wxShape::MoveLineToNewAttachment(wxDC& dc, wxLineShape *to_move,
|
||||||
double x, double y)
|
double x, double y)
|
||||||
{
|
{
|
||||||
if (!GetAttachmentMode())
|
if (!GetAttachmentMode())
|
||||||
return;
|
return FALSE;
|
||||||
|
|
||||||
int newAttachment, oldAttachment;
|
int newAttachment, oldAttachment;
|
||||||
double distance;
|
double distance;
|
||||||
@@ -1069,7 +1069,7 @@ void wxShape::MoveLineToNewAttachment(wxDC& dc, wxLineShape *to_move,
|
|||||||
// the user has moved the point to
|
// the user has moved the point to
|
||||||
bool hit = HitTest(x, y, &newAttachment, &distance);
|
bool hit = HitTest(x, y, &newAttachment, &distance);
|
||||||
if (!hit)
|
if (!hit)
|
||||||
return;
|
return FALSE;
|
||||||
|
|
||||||
EraseLinks(dc);
|
EraseLinks(dc);
|
||||||
|
|
||||||
@@ -1138,6 +1138,8 @@ void wxShape::MoveLineToNewAttachment(wxDC& dc, wxLineShape *to_move,
|
|||||||
newOrdering.Append(to_move);
|
newOrdering.Append(to_move);
|
||||||
|
|
||||||
GetEventHandler()->OnChangeAttachment(newAttachment, to_move, newOrdering);
|
GetEventHandler()->OnChangeAttachment(newAttachment, to_move, newOrdering);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxShape::OnChangeAttachment(int attachment, wxLineShape* line, wxList& ordering)
|
void wxShape::OnChangeAttachment(int attachment, wxLineShape* line, wxList& ordering)
|
||||||
@@ -1467,15 +1469,15 @@ void wxShape::Move(wxDC& dc, double x, double y, bool display)
|
|||||||
double old_x = m_xpos;
|
double old_x = m_xpos;
|
||||||
double old_y = m_ypos;
|
double old_y = m_ypos;
|
||||||
|
|
||||||
m_xpos = x; m_ypos = y;
|
|
||||||
|
|
||||||
if (!GetEventHandler()->OnMovePre(dc, x, y, old_x, old_y, display))
|
if (!GetEventHandler()->OnMovePre(dc, x, y, old_x, old_y, display))
|
||||||
{
|
{
|
||||||
m_xpos = old_x;
|
// m_xpos = old_x;
|
||||||
m_ypos = old_y;
|
// m_ypos = old_y;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_xpos = x; m_ypos = y;
|
||||||
|
|
||||||
ResetControlPoints();
|
ResetControlPoints();
|
||||||
|
|
||||||
if (display)
|
if (display)
|
||||||
|
@@ -394,7 +394,7 @@ class wxShape: public wxShapeEvtHandler
|
|||||||
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 bool MoveLineToNewAttachment(wxDC& dc, wxLineShape *to_move,
|
||||||
double x, double 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
|
||||||
@@ -638,6 +638,9 @@ class wxEllipseShape: public wxShape
|
|||||||
inline double GetWidth() const { return m_width; }
|
inline double GetWidth() const { return m_width; }
|
||||||
inline double GetHeight() const { return m_height; }
|
inline double GetHeight() const { return m_height; }
|
||||||
|
|
||||||
|
inline void SetWidth(double w) { m_width = w; }
|
||||||
|
inline void SetHeight(double h) { m_height = h; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
double m_width;
|
double m_width;
|
||||||
double m_height;
|
double m_height;
|
||||||
|
@@ -1583,9 +1583,10 @@ void wxShape::OnSizingBeginDragLeft(wxControlPoint* pt, double x, double y, int
|
|||||||
|
|
||||||
wxClientDC dc(GetCanvas());
|
wxClientDC dc(GetCanvas());
|
||||||
GetCanvas()->PrepareDC(dc);
|
GetCanvas()->PrepareDC(dc);
|
||||||
|
/*
|
||||||
if (pt->m_eraseObject)
|
if (pt->m_eraseObject)
|
||||||
this->Erase(dc);
|
this->Erase(dc);
|
||||||
|
*/
|
||||||
|
|
||||||
dc.SetLogicalFunction(wxXOR);
|
dc.SetLogicalFunction(wxXOR);
|
||||||
|
|
||||||
@@ -1694,8 +1695,11 @@ void wxShape::OnSizingEndDragLeft(wxControlPoint* pt, double x, double y, int ke
|
|||||||
this->Recompute();
|
this->Recompute();
|
||||||
this->ResetControlPoints();
|
this->ResetControlPoints();
|
||||||
|
|
||||||
|
this->Erase(dc);
|
||||||
|
/*
|
||||||
if (!pt->m_eraseObject)
|
if (!pt->m_eraseObject)
|
||||||
this->Show(FALSE);
|
this->Show(FALSE);
|
||||||
|
*/
|
||||||
|
|
||||||
this->SetSize(pt->controlPointDragEndWidth, pt->controlPointDragEndHeight);
|
this->SetSize(pt->controlPointDragEndWidth, pt->controlPointDragEndHeight);
|
||||||
|
|
||||||
@@ -1711,8 +1715,10 @@ void wxShape::OnSizingEndDragLeft(wxControlPoint* pt, double x, double y, int ke
|
|||||||
else
|
else
|
||||||
theObject->Move(dc, pt->controlPointDragPosX, pt->controlPointDragPosY);
|
theObject->Move(dc, pt->controlPointDragPosX, pt->controlPointDragPosY);
|
||||||
|
|
||||||
|
/*
|
||||||
if (!eraseIt)
|
if (!eraseIt)
|
||||||
theObject->Show(TRUE);
|
theObject->Show(TRUE);
|
||||||
|
*/
|
||||||
|
|
||||||
// Recursively redraw links if we have a composite.
|
// Recursively redraw links if we have a composite.
|
||||||
if (theObject->GetChildren().Number() > 0)
|
if (theObject->GetChildren().Number() > 0)
|
||||||
|
@@ -249,7 +249,7 @@ void wxLineShape::FormatText(wxDC& dc, const wxString& s, int i)
|
|||||||
EraseRegion(dc, region, xx, yy);
|
EraseRegion(dc, region, xx, yy);
|
||||||
if (m_labelObjects[i])
|
if (m_labelObjects[i])
|
||||||
{
|
{
|
||||||
m_labelObjects[i]->Select(FALSE);
|
m_labelObjects[i]->Select(FALSE, &dc);
|
||||||
m_labelObjects[i]->Erase(dc);
|
m_labelObjects[i]->Erase(dc);
|
||||||
m_labelObjects[i]->SetSize(actualW, actualH);
|
m_labelObjects[i]->SetSize(actualW, actualH);
|
||||||
}
|
}
|
||||||
@@ -391,12 +391,13 @@ void GraphicsStraightenLine(wxRealPoint *point1, wxRealPoint *point2)
|
|||||||
else point2->y = point1->y;
|
else point2->y = point1->y;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxLineShape::Straighten(wxDC& dc)
|
void wxLineShape::Straighten(wxDC *dc)
|
||||||
{
|
{
|
||||||
if (!m_lineControlPoints || m_lineControlPoints->Number() < 3)
|
if (!m_lineControlPoints || m_lineControlPoints->Number() < 3)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Erase(dc);
|
if (dc)
|
||||||
|
Erase(* dc);
|
||||||
|
|
||||||
wxNode *first_point_node = m_lineControlPoints->First();
|
wxNode *first_point_node = m_lineControlPoints->First();
|
||||||
wxNode *last_point_node = m_lineControlPoints->Last();
|
wxNode *last_point_node = m_lineControlPoints->Last();
|
||||||
@@ -417,7 +418,8 @@ void wxLineShape::Straighten(wxDC& dc)
|
|||||||
node = node->Next();
|
node = node->Next();
|
||||||
}
|
}
|
||||||
|
|
||||||
Draw(dc);
|
if (dc)
|
||||||
|
Draw(* dc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1496,7 +1498,7 @@ void wxLineShape::ReadPrologAttributes(wxExpr *clause)
|
|||||||
m_attachmentFrom = 0;
|
m_attachmentFrom = 0;
|
||||||
|
|
||||||
clause->AssignAttributeValue("attachment_to", &m_attachmentTo);
|
clause->AssignAttributeValue("attachment_to", &m_attachmentTo);
|
||||||
clause->AssignAttributeValue("attachmen_from", &m_attachmentFrom);
|
clause->AssignAttributeValue("attachment_from", &m_attachmentFrom);
|
||||||
|
|
||||||
wxExpr *line_list = NULL;
|
wxExpr *line_list = NULL;
|
||||||
|
|
||||||
@@ -1666,12 +1668,12 @@ void wxLineShape::Select(bool select, wxDC* dc)
|
|||||||
m_labelObjects[i]->RemoveFromCanvas(m_canvas);
|
m_labelObjects[i]->RemoveFromCanvas(m_canvas);
|
||||||
delete m_labelObjects[i];
|
delete m_labelObjects[i];
|
||||||
}
|
}
|
||||||
m_labelObjects[i] = new wxLabelShape(this, region, w, h);
|
m_labelObjects[i] = OnCreateLabelShape(this, region, w, h);
|
||||||
m_labelObjects[i]->AddToCanvas(m_canvas);
|
m_labelObjects[i]->AddToCanvas(m_canvas);
|
||||||
m_labelObjects[i]->Show(TRUE);
|
m_labelObjects[i]->Show(TRUE);
|
||||||
if (dc)
|
if (dc)
|
||||||
m_labelObjects[i]->Move(*dc, (double)(x + xx), (double)(y + yy));
|
m_labelObjects[i]->Move(*dc, (double)(x + xx), (double)(y + yy));
|
||||||
m_labelObjects[i]->Select(TRUE);
|
m_labelObjects[i]->Select(TRUE, dc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1683,6 +1685,7 @@ void wxLineShape::Select(bool select, wxDC* dc)
|
|||||||
if (m_labelObjects[i])
|
if (m_labelObjects[i])
|
||||||
{
|
{
|
||||||
m_labelObjects[i]->Select(FALSE, dc);
|
m_labelObjects[i]->Select(FALSE, dc);
|
||||||
|
m_labelObjects[i]->Erase(*dc);
|
||||||
m_labelObjects[i]->RemoveFromCanvas(m_canvas);
|
m_labelObjects[i]->RemoveFromCanvas(m_canvas);
|
||||||
delete m_labelObjects[i];
|
delete m_labelObjects[i];
|
||||||
m_labelObjects[i] = NULL;
|
m_labelObjects[i] = NULL;
|
||||||
@@ -1704,6 +1707,7 @@ wxLineControlPoint::wxLineControlPoint(wxShapeCanvas *theCanvas, wxShape *object
|
|||||||
m_xpos = x;
|
m_xpos = x;
|
||||||
m_ypos = y;
|
m_ypos = y;
|
||||||
m_type = the_type;
|
m_type = the_type;
|
||||||
|
m_point = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxLineControlPoint::~wxLineControlPoint()
|
wxLineControlPoint::~wxLineControlPoint()
|
||||||
@@ -1770,7 +1774,7 @@ void wxLineShape::OnSizingDragLeft(wxControlPoint* pt, bool draw, double x, doub
|
|||||||
|
|
||||||
if (lpt->m_type == CONTROL_POINT_ENDPOINT_FROM || lpt->m_type == CONTROL_POINT_ENDPOINT_TO)
|
if (lpt->m_type == CONTROL_POINT_ENDPOINT_FROM || lpt->m_type == CONTROL_POINT_ENDPOINT_TO)
|
||||||
{
|
{
|
||||||
lpt->SetX(x); lpt->SetY(y);
|
// lpt->SetX(x); lpt->SetY(y);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1785,6 +1789,7 @@ void wxLineShape::OnSizingBeginDragLeft(wxControlPoint* pt, double x, double y,
|
|||||||
wxLineShape *lineShape = (wxLineShape *)this;
|
wxLineShape *lineShape = (wxLineShape *)this;
|
||||||
if (lpt->m_type == CONTROL_POINT_LINE)
|
if (lpt->m_type == CONTROL_POINT_LINE)
|
||||||
{
|
{
|
||||||
|
lpt->m_originalPos = * (lpt->m_point);
|
||||||
m_canvas->Snap(&x, &y);
|
m_canvas->Snap(&x, &y);
|
||||||
|
|
||||||
this->Erase(dc);
|
this->Erase(dc);
|
||||||
@@ -1817,18 +1822,6 @@ void wxLineShape::OnSizingBeginDragLeft(wxControlPoint* pt, double x, double y,
|
|||||||
|
|
||||||
if (lpt->m_type == CONTROL_POINT_ENDPOINT_FROM || lpt->m_type == CONTROL_POINT_ENDPOINT_TO)
|
if (lpt->m_type == CONTROL_POINT_ENDPOINT_FROM || lpt->m_type == CONTROL_POINT_ENDPOINT_TO)
|
||||||
{
|
{
|
||||||
lpt->Erase(dc);
|
|
||||||
lineShape->OnDraw(dc);
|
|
||||||
if (lpt->m_type == CONTROL_POINT_ENDPOINT_FROM)
|
|
||||||
{
|
|
||||||
lineShape->GetFrom()->OnDraw(dc);
|
|
||||||
lineShape->GetFrom()->OnDrawContents(dc);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
lineShape->GetTo()->OnDraw(dc);
|
|
||||||
lineShape->GetTo()->OnDrawContents(dc);
|
|
||||||
}
|
|
||||||
m_canvas->SetCursor(g_oglBullseyeCursor);
|
m_canvas->SetCursor(g_oglBullseyeCursor);
|
||||||
lpt->m_oldCursor = wxSTANDARD_CURSOR;
|
lpt->m_oldCursor = wxSTANDARD_CURSOR;
|
||||||
}
|
}
|
||||||
@@ -1848,19 +1841,26 @@ void wxLineShape::OnSizingEndDragLeft(wxControlPoint* pt, double x, double y, in
|
|||||||
{
|
{
|
||||||
m_canvas->Snap(&x, &y);
|
m_canvas->Snap(&x, &y);
|
||||||
|
|
||||||
dc.SetLogicalFunction(wxCOPY);
|
wxRealPoint pt = wxRealPoint(x, y);
|
||||||
lpt->m_xpos = x; lpt->m_ypos = y;
|
|
||||||
lpt->m_point->x = x; lpt->m_point->y = y;
|
|
||||||
|
|
||||||
lineShape->GetEventHandler()->OnMoveLink(dc);
|
// Move the control point back to where it was;
|
||||||
|
// MoveControlPoint will move it to the new position
|
||||||
|
// if it decides it wants. We only moved the position
|
||||||
|
// during user feedback so we could redraw the line
|
||||||
|
// as it changed shape.
|
||||||
|
lpt->m_xpos = lpt->m_originalPos.x; lpt->m_ypos = lpt->m_originalPos.y;
|
||||||
|
lpt->m_point->x = lpt->m_originalPos.x; lpt->m_point->y = lpt->m_originalPos.y;
|
||||||
|
|
||||||
|
OnMoveMiddleControlPoint(dc, lpt, pt);
|
||||||
}
|
}
|
||||||
if (lpt->m_type == CONTROL_POINT_ENDPOINT_FROM)
|
if (lpt->m_type == CONTROL_POINT_ENDPOINT_FROM)
|
||||||
{
|
{
|
||||||
if (lpt->m_oldCursor)
|
if (lpt->m_oldCursor)
|
||||||
m_canvas->SetCursor(lpt->m_oldCursor);
|
m_canvas->SetCursor(lpt->m_oldCursor);
|
||||||
this->Erase(dc);
|
|
||||||
|
|
||||||
lpt->m_xpos = x; lpt->m_ypos = y;
|
// this->Erase(dc);
|
||||||
|
|
||||||
|
// lpt->m_xpos = x; lpt->m_ypos = y;
|
||||||
|
|
||||||
if (lineShape->GetFrom())
|
if (lineShape->GetFrom())
|
||||||
{
|
{
|
||||||
@@ -1872,7 +1872,7 @@ void wxLineShape::OnSizingEndDragLeft(wxControlPoint* pt, double x, double y, in
|
|||||||
if (lpt->m_oldCursor)
|
if (lpt->m_oldCursor)
|
||||||
m_canvas->SetCursor(lpt->m_oldCursor);
|
m_canvas->SetCursor(lpt->m_oldCursor);
|
||||||
|
|
||||||
lpt->m_xpos = x; lpt->m_ypos = y;
|
// lpt->m_xpos = x; lpt->m_ypos = y;
|
||||||
|
|
||||||
if (lineShape->GetTo())
|
if (lineShape->GetTo())
|
||||||
{
|
{
|
||||||
@@ -1890,13 +1890,22 @@ void wxLineShape::OnSizingEndDragLeft(wxControlPoint* pt, double x, double y, in
|
|||||||
// N.B. in OnMoveControlPoint, an event handler in Hardy could have deselected
|
// N.B. in OnMoveControlPoint, an event handler in Hardy could have deselected
|
||||||
// the line and therefore deleted 'this'. -> GPF, intermittently.
|
// the line and therefore deleted 'this'. -> GPF, intermittently.
|
||||||
// So assume at this point that we've been blown away.
|
// So assume at this point that we've been blown away.
|
||||||
wxLineShape *lineObj = lineShape;
|
|
||||||
wxShapeCanvas *objCanvas = m_canvas;
|
|
||||||
|
|
||||||
lineObj->OnMoveControlPoint(i+1, x, y);
|
lineShape->OnMoveControlPoint(i+1, x, y);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This is called only when a non-end control point is moved.
|
||||||
|
bool wxLineShape::OnMoveMiddleControlPoint(wxDC& dc, wxLineControlPoint* lpt, const wxRealPoint& pt)
|
||||||
|
{
|
||||||
|
lpt->m_xpos = pt.x; lpt->m_ypos = pt.y;
|
||||||
|
lpt->m_point->x = pt.x; lpt->m_point->y = pt.y;
|
||||||
|
|
||||||
|
GetEventHandler()->OnMoveLink(dc);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
// Implement movement of endpoint to a new attachment
|
// Implement movement of endpoint to a new attachment
|
||||||
// OBSOLETE: done by dragging with the left button.
|
// OBSOLETE: done by dragging with the left button.
|
||||||
|
|
||||||
@@ -2394,6 +2403,12 @@ void wxArrowHead::SetSize(double size)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Can override this to create a different class of label shape
|
||||||
|
wxLabelShape* wxLineShape::OnCreateLabelShape(wxLineShape *parent, wxShapeRegion *region, double w, double h)
|
||||||
|
{
|
||||||
|
return new wxLabelShape(parent, region, w, h);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Label object
|
* Label object
|
||||||
*
|
*
|
||||||
@@ -2456,14 +2471,19 @@ void wxLabelShape::OnEndDragLeft(double x, double y, int keys, int attachment)
|
|||||||
|
|
||||||
bool wxLabelShape::OnMovePre(wxDC& dc, double x, double y, double old_x, double old_y, bool display)
|
bool wxLabelShape::OnMovePre(wxDC& dc, double x, double y, double old_x, double old_y, bool display)
|
||||||
{
|
{
|
||||||
m_shapeRegion->SetSize(m_width, m_height);
|
return m_lineShape->OnLabelMovePre(dc, this, x, y, old_x, old_y, display);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxLineShape::OnLabelMovePre(wxDC& dc, wxLabelShape* labelShape, double x, double y, double old_x, double old_y, bool display)
|
||||||
|
{
|
||||||
|
labelShape->m_shapeRegion->SetSize(labelShape->GetWidth(), labelShape->GetHeight());
|
||||||
|
|
||||||
// Find position in line's region list
|
// Find position in line's region list
|
||||||
int i = 0;
|
int i = 0;
|
||||||
wxNode *node = m_lineShape->GetRegions().First();
|
wxNode *node = GetRegions().First();
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
if (m_shapeRegion == (wxShapeRegion *)node->Data())
|
if (labelShape->m_shapeRegion == (wxShapeRegion *)node->Data())
|
||||||
node = NULL;
|
node = NULL;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -2472,18 +2492,21 @@ bool wxLabelShape::OnMovePre(wxDC& dc, double x, double y, double old_x, double
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
double xx, yy;
|
double xx, yy;
|
||||||
m_lineShape->GetLabelPosition(i, &xx, &yy);
|
GetLabelPosition(i, &xx, &yy);
|
||||||
// Set the region's offset, relative to the default position for
|
// Set the region's offset, relative to the default position for
|
||||||
// each region.
|
// each region.
|
||||||
m_shapeRegion->SetPosition((double)(x - xx), (double)(y - yy));
|
labelShape->m_shapeRegion->SetPosition((double)(x - xx), (double)(y - yy));
|
||||||
|
|
||||||
|
labelShape->SetX(x);
|
||||||
|
labelShape->SetY(y);
|
||||||
|
|
||||||
// Need to reformat to fit region.
|
// Need to reformat to fit region.
|
||||||
if (m_shapeRegion->GetText())
|
if (labelShape->m_shapeRegion->GetText())
|
||||||
{
|
{
|
||||||
|
|
||||||
wxString s(m_shapeRegion->GetText());
|
wxString s(labelShape->m_shapeRegion->GetText());
|
||||||
m_lineShape->FormatText(dc, s, i);
|
labelShape->FormatText(dc, s, i);
|
||||||
m_lineShape->DrawRegion(dc, m_shapeRegion, xx, yy);
|
DrawRegion(dc, labelShape->m_shapeRegion, xx, yy);
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@@ -88,6 +88,7 @@ class wxArrowHead: public wxObject
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Line object
|
// Line object
|
||||||
|
class wxLabelShape;
|
||||||
class wxLineShape: public wxShape
|
class wxLineShape: public wxShape
|
||||||
{
|
{
|
||||||
DECLARE_DYNAMIC_CLASS(wxLineShape)
|
DECLARE_DYNAMIC_CLASS(wxLineShape)
|
||||||
@@ -107,7 +108,9 @@ class wxLineShape: public wxShape
|
|||||||
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), double WXUNUSED(x), double WXUNUSED(y)) {}
|
virtual bool OnMoveControlPoint(int WXUNUSED(which), double WXUNUSED(x), double WXUNUSED(y)) { return FALSE; }
|
||||||
|
virtual bool OnMoveMiddleControlPoint(wxDC& dc, wxLineControlPoint* lpt, const wxRealPoint& pt);
|
||||||
|
virtual bool OnLabelMovePre(wxDC& dc, wxLabelShape* labelShape, double x, double y, double old_x, double old_y, bool display);
|
||||||
void OnDrawOutline(wxDC& dc, double x, double y, double w, double h);
|
void OnDrawOutline(wxDC& dc, double x, double y, double w, double h);
|
||||||
void GetBoundingBoxMin(double *w, double *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);
|
||||||
@@ -139,8 +142,11 @@ class wxLineShape: public wxShape
|
|||||||
// position is 0 (middle), 1 (start), 2 (end)
|
// position is 0 (middle), 1 (start), 2 (end)
|
||||||
void GetLabelPosition(int position, double *x, double *y);
|
void GetLabelPosition(int position, double *x, double *y);
|
||||||
|
|
||||||
|
// Can override this to create a different class of label shape
|
||||||
|
virtual wxLabelShape* OnCreateLabelShape(wxLineShape *parent = NULL, wxShapeRegion *region = NULL, double w = 0.0, double h = 0.0);
|
||||||
|
|
||||||
// Straighten verticals and horizontals
|
// Straighten verticals and horizontals
|
||||||
virtual void Straighten(wxDC& dc);
|
virtual void Straighten(wxDC* dc = NULL);
|
||||||
|
|
||||||
// Not implemented
|
// Not implemented
|
||||||
inline void SetMaintainStraightLines(bool flag) { m_maintainStraightLines = flag; }
|
inline void SetMaintainStraightLines(bool flag) { m_maintainStraightLines = flag; }
|
||||||
|
@@ -44,6 +44,7 @@ public:
|
|||||||
|
|
||||||
int m_type;
|
int m_type;
|
||||||
wxRealPoint* m_point; // Line point
|
wxRealPoint* m_point; // Line point
|
||||||
|
wxRealPoint m_originalPos;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -51,7 +51,7 @@ CPPFLAGS=$(DEBUG_FLAGS) $(OPT) @$(CFG)
|
|||||||
CFLAGS=$(DEBUG_FLAGS) $(OPT) @$(CFG)
|
CFLAGS=$(DEBUG_FLAGS) $(OPT) @$(CFG)
|
||||||
|
|
||||||
OBJECTS = basic.obj basic2.obj canvas.obj ogldiag.obj lines.obj misc.obj divided.obj constrnt.obj\
|
OBJECTS = basic.obj basic2.obj canvas.obj ogldiag.obj lines.obj misc.obj divided.obj constrnt.obj\
|
||||||
composit.obj drawn.obj bitmap.obj mfutils.obj
|
composit.obj drawn.obj bmpshape.obj mfutils.obj
|
||||||
|
|
||||||
all: $(OGLLIB)
|
all: $(OGLLIB)
|
||||||
|
|
||||||
|
@@ -26,7 +26,7 @@ LOCALDOCDIR=$(WXDIR)\utils\ogl\docs
|
|||||||
PROGRAM=test
|
PROGRAM=test
|
||||||
|
|
||||||
OBJECTS = basic.obj basic2.obj canvas.obj ogldiag.obj lines.obj misc.obj divided.obj constrnt.obj\
|
OBJECTS = basic.obj basic2.obj canvas.obj ogldiag.obj lines.obj misc.obj divided.obj constrnt.obj\
|
||||||
composit.obj drawn.obj bitmap.obj mfutils.obj
|
composit.obj drawn.obj bmpshape.obj mfutils.obj
|
||||||
|
|
||||||
LIBTARGET=$(WXDIR)\lib\ogl.lib
|
LIBTARGET=$(WXDIR)\lib\ogl.lib
|
||||||
|
|
||||||
@@ -104,7 +104,7 @@ drawn.obj: drawn.$(SRCSUFF) basic.h misc.h canvas.h drawn.h drawnp.h basicp
|
|||||||
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
|
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
|
||||||
<<
|
<<
|
||||||
|
|
||||||
bitmap.obj: bitmap.$(SRCSUFF) basic.h misc.h canvas.h bitmap.h
|
bmpshape.obj: bmpshape.$(SRCSUFF) basic.h misc.h canvas.h bmpshape.h
|
||||||
cl @<<
|
cl @<<
|
||||||
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
|
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF)
|
||||||
<<
|
<<
|
||||||
|
@@ -400,6 +400,7 @@ void wxDiagram::ReadLines(wxExprDatabase& database)
|
|||||||
shape->Show(TRUE);
|
shape->Show(TRUE);
|
||||||
|
|
||||||
OnShapeLoad(database, *shape, *clause);
|
OnShapeLoad(database, *shape, *clause);
|
||||||
|
shape->SetCanvas(GetCanvas());
|
||||||
|
|
||||||
long image_to = -1; long image_from = -1;
|
long image_to = -1; long image_from = -1;
|
||||||
clause->GetAttributeValue("to", image_to);
|
clause->GetAttributeValue("to", image_to);
|
||||||
|
Reference in New Issue
Block a user