X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/67d54b58cb92e83364b39c7534079c3699b9b6ea..084db46c8b4f3f8d5e6a5f55e09e04f5a680c8a5:/contrib/src/ogl/basic.cpp?ds=sidebyside diff --git a/contrib/src/ogl/basic.cpp b/contrib/src/ogl/basic.cpp index 29e50b9c93..a145099919 100644 --- a/contrib/src/ogl/basic.cpp +++ b/contrib/src/ogl/basic.cpp @@ -24,18 +24,14 @@ #include #endif -#include +#if wxUSE_DEPRECATED +#include +#endif #ifdef new #undef new #endif -#if wxUSE_IOSTREAMH -#include -#else -#include -#endif - #include #include #include @@ -286,9 +282,8 @@ wxShape::wxShape(wxShapeCanvas *can) m_brush = wxWHITE_BRUSH; m_font = g_oglNormalFont; m_textColour = wxBLACK; - m_textColourName = "BLACK"; + m_textColourName = wxT("BLACK"); m_visible = FALSE; - m_clientData = NULL; m_selected = FALSE; m_attachmentMode = ATTACHMENT_MODE_NONE; m_spaceAttachments = TRUE; @@ -306,7 +301,7 @@ wxShape::wxShape(wxShapeCanvas *can) m_shadowBrush = wxBLACK_BRUSH; m_textMarginX = 5; m_textMarginY = 5; - m_regionName = "0"; + m_regionName = wxT("0"); m_centreResize = TRUE; m_maintainAspectRatio = FALSE; m_highlighted = FALSE; @@ -320,10 +315,10 @@ wxShape::wxShape(wxShapeCanvas *can) // the region eventually (the duplication is for compatibility) wxShapeRegion *region = new wxShapeRegion; m_regions.Append(region); - region->SetName("0"); + region->SetName(wxT("0")); region->SetFont(g_oglNormalFont); region->SetFormatMode(FORMAT_CENTRE_HORIZ | FORMAT_CENTRE_VERT); - region->SetColour("BLACK"); + region->SetColour(wxT("BLACK")); } wxShape::~wxShape() @@ -338,11 +333,6 @@ wxShape::~wxShape() if (m_canvas) m_canvas->RemoveShape(this); - if (m_clientData) { - delete m_clientData; - m_clientData = NULL; - } - GetEventHandler()->OnDelete(); } @@ -351,12 +341,12 @@ void wxShape::SetHighlight(bool hi, bool recurse) m_highlighted = hi; if (recurse) { - wxNode *node = m_children.First(); + wxNode *node = m_children.GetFirst(); while (node) { - wxShape *child = (wxShape *)node->Data(); + wxShape *child = (wxShape *)node->GetData(); child->SetHighlight(hi, recurse); - node = node->Next(); + node = node->GetNext(); } } } @@ -371,12 +361,12 @@ void wxShape::SetSensitivityFilter(int sens, bool recursive) m_sensitivity = sens; if (recursive) { - wxNode *node = m_children.First(); + wxNode *node = m_children.GetFirst(); while (node) { - wxShape *obj = (wxShape *)node->Data(); + wxShape *obj = (wxShape *)node->GetData(); obj->SetSensitivityFilter(sens, TRUE); - node = node->Next(); + node = node->GetNext(); } } } @@ -392,12 +382,12 @@ void wxShape::SetDraggable(bool drag, bool recursive) if (recursive) { - wxNode *node = m_children.First(); + wxNode *node = m_children.GetFirst(); while (node) { - wxShape *obj = (wxShape *)node->Data(); + wxShape *obj = (wxShape *)node->GetData(); obj->SetDraggable(drag, TRUE); - node = node->Next(); + node = node->GetNext(); } } } @@ -405,12 +395,12 @@ void wxShape::SetDraggable(bool drag, bool recursive) void wxShape::SetDrawHandles(bool drawH) { m_drawHandles = drawH; - wxNode *node = m_children.First(); + wxNode *node = m_children.GetFirst(); while (node) { - wxShape *obj = (wxShape *)node->Data(); + wxShape *obj = (wxShape *)node->GetData(); obj->SetDrawHandles(drawH); - node = node->Next(); + node = node->GetNext(); } } @@ -435,27 +425,27 @@ void wxShape::SetShadowMode(int mode, bool redraw) void wxShape::SetCanvas(wxShapeCanvas *theCanvas) { m_canvas = theCanvas; - wxNode *node = m_children.First(); + wxNode *node = m_children.GetFirst(); while (node) { - wxShape *child = (wxShape *)node->Data(); + wxShape *child = (wxShape *)node->GetData(); child->SetCanvas(theCanvas); - node = node->Next(); + node = node->GetNext(); } } void wxShape::AddToCanvas(wxShapeCanvas *theCanvas, wxShape *addAfter) { theCanvas->AddShape(this, addAfter); - wxNode *node = m_children.First(); + wxNode *node = m_children.GetFirst(); wxShape *lastImage = this; while (node) { - wxShape *object = (wxShape *)node->Data(); + wxShape *object = (wxShape *)node->GetData(); object->AddToCanvas(theCanvas, lastImage); lastImage = object; - node = node->Next(); + node = node->GetNext(); } } @@ -463,15 +453,15 @@ void wxShape::AddToCanvas(wxShapeCanvas *theCanvas, wxShape *addAfter) void wxShape::InsertInCanvas(wxShapeCanvas *theCanvas) { theCanvas->InsertShape(this); - wxNode *node = m_children.First(); + wxNode *node = m_children.GetFirst(); wxShape *lastImage = this; while (node) { - wxShape *object = (wxShape *)node->Data(); + wxShape *object = (wxShape *)node->GetData(); object->AddToCanvas(theCanvas, lastImage); lastImage = object; - node = node->Next(); + node = node->GetNext(); } } @@ -480,24 +470,24 @@ void wxShape::RemoveFromCanvas(wxShapeCanvas *theCanvas) if (Selected()) Select(FALSE); theCanvas->RemoveShape(this); - wxNode *node = m_children.First(); + wxNode *node = m_children.GetFirst(); while (node) { - wxShape *object = (wxShape *)node->Data(); + wxShape *object = (wxShape *)node->GetData(); object->RemoveFromCanvas(theCanvas); - node = node->Next(); + node = node->GetNext(); } } void wxShape::ClearAttachments() { - wxNode *node = m_attachmentPoints.First(); + wxNode *node = m_attachmentPoints.GetFirst(); while (node) { - wxAttachmentPoint *point = (wxAttachmentPoint *)node->Data(); + wxAttachmentPoint *point = (wxAttachmentPoint *)node->GetData(); delete point; - node = node->Next(); + node = node->GetNext(); } m_attachmentPoints.Clear(); } @@ -510,20 +500,20 @@ void wxShape::ClearText(int regionId) m_text.Clear(); m_text.DeleteContents(FALSE); } - wxNode *node = m_regions.Nth(regionId); + wxNode *node = m_regions.Item(regionId); if (!node) return; - wxShapeRegion *region = (wxShapeRegion *)node->Data(); + wxShapeRegion *region = (wxShapeRegion *)node->GetData(); region->ClearText(); } void wxShape::ClearRegions() { - wxNode *node = m_regions.First(); + wxNode *node = m_regions.GetFirst(); while (node) { - wxShapeRegion *region = (wxShapeRegion *)node->Data(); - wxNode *next = node->Next(); + wxShapeRegion *region = (wxShapeRegion *)node->GetData(); + wxNode *next = node->GetNext(); delete region; delete node; node = next; @@ -537,9 +527,9 @@ void wxShape::AddRegion(wxShapeRegion *region) void wxShape::SetDefaultRegionSize() { - wxNode *node = m_regions.First(); + wxNode *node = m_regions.GetFirst(); if (!node) return; - wxShapeRegion *region = (wxShapeRegion *)node->Data(); + wxShapeRegion *region = (wxShapeRegion *)node->GetData(); double w, h; GetBoundingBoxMin(&w, &h); region->SetSize(w, h); @@ -606,26 +596,27 @@ void wxShape::FormatText(wxDC& dc, const wxString& s, int i) double w, h; ClearText(i); - if (m_regions.Number() < 1) + if (m_regions.GetCount() < 1) return; - wxNode *node = m_regions.Nth(i); + wxNode *node = m_regions.Item(i); if (!node) return; - wxShapeRegion *region = (wxShapeRegion *)node->Data(); - region->SetText(s); + wxShapeRegion *region = (wxShapeRegion *)node->GetData(); + // region->SetText(s); // don't set the formatted text yet, it will be done below + region->m_regionText = s; dc.SetFont(* region->GetFont()); region->GetSize(&w, &h); wxStringList *stringList = oglFormatText(dc, s, (w-5), (h-5), region->GetFormatMode()); - node = stringList->First(); + node = (wxNode*)stringList->GetFirst(); while (node) { - char *s = (char *)node->Data(); + wxChar *s = (wxChar *)node->GetData(); wxShapeTextLine *line = new wxShapeTextLine(0.0, 0.0, s); region->GetFormattedText().Append((wxObject *)line); - node = node->Next(); + node = node->GetNext(); } delete stringList; double actualW = w; @@ -633,8 +624,8 @@ void wxShape::FormatText(wxDC& dc, const wxString& s, int i) // Don't try to resize an object with more than one image (this case should be dealt // with by overriden handlers) if ((region->GetFormatMode() & FORMAT_SIZE_TO_CONTENTS) && - (region->GetFormattedText().Number() > 0) && - (m_regions.Number() == 1) && !GraphicsInSizeToContents) + (region->GetFormattedText().GetCount() > 0) && + (m_regions.GetCount() == 1) && !GraphicsInSizeToContents) { oglGetCentredTextExtent(dc, &(region->GetFormattedText()), m_xpos, m_ypos, w, h, &actualW, &actualH); if ((actualW+m_textMarginX != w ) || (actualH+m_textMarginY != h)) @@ -684,13 +675,13 @@ void wxShape::Recentre(wxDC& dc) double w, h; GetBoundingBoxMin(&w, &h); - int noRegions = m_regions.Number(); + int noRegions = m_regions.GetCount(); for (int i = 0; i < noRegions; i++) { - wxNode *node = m_regions.Nth(i); + wxNode *node = m_regions.Item(i); if (node) { - wxShapeRegion *region = (wxShapeRegion *)node->Data(); + wxShapeRegion *region = (wxShapeRegion *)node->GetData(); oglCentreText(dc, &(region->GetFormattedText()), m_xpos, m_ypos, w, h, region->GetFormatMode()); } } @@ -731,37 +722,37 @@ wxShape *wxShape::GetTopAncestor() void wxShape::SetFont(wxFont *the_font, int regionId) { m_font = the_font; - wxNode *node = m_regions.Nth(regionId); + wxNode *node = m_regions.Item(regionId); if (!node) return; - wxShapeRegion *region = (wxShapeRegion *)node->Data(); + wxShapeRegion *region = (wxShapeRegion *)node->GetData(); region->SetFont(the_font); } wxFont *wxShape::GetFont(int n) const { - wxNode *node = m_regions.Nth(n); + wxNode *node = m_regions.Item(n); if (!node) return NULL; - wxShapeRegion *region = (wxShapeRegion *)node->Data(); + wxShapeRegion *region = (wxShapeRegion *)node->GetData(); return region->GetFont(); } void wxShape::SetFormatMode(int mode, int regionId) { - wxNode *node = m_regions.Nth(regionId); + wxNode *node = m_regions.Item(regionId); if (!node) return; - wxShapeRegion *region = (wxShapeRegion *)node->Data(); + wxShapeRegion *region = (wxShapeRegion *)node->GetData(); region->SetFormatMode(mode); } int wxShape::GetFormatMode(int regionId) const { - wxNode *node = m_regions.Nth(regionId); + wxNode *node = m_regions.Item(regionId); if (!node) return 0; - wxShapeRegion *region = (wxShapeRegion *)node->Data(); + wxShapeRegion *region = (wxShapeRegion *)node->GetData(); return region->GetFormatMode(); } @@ -771,50 +762,50 @@ void wxShape::SetTextColour(const wxString& the_colour, int regionId) m_textColour = wxcolour; m_textColourName = the_colour; - wxNode *node = m_regions.Nth(regionId); + wxNode *node = m_regions.Item(regionId); if (!node) return; - wxShapeRegion *region = (wxShapeRegion *)node->Data(); + wxShapeRegion *region = (wxShapeRegion *)node->GetData(); region->SetColour(the_colour); } wxString wxShape::GetTextColour(int regionId) const { - wxNode *node = m_regions.Nth(regionId); + wxNode *node = m_regions.Item(regionId); if (!node) - return wxString(""); - wxShapeRegion *region = (wxShapeRegion *)node->Data(); + return wxEmptyString; + wxShapeRegion *region = (wxShapeRegion *)node->GetData(); return region->GetColour(); } void wxShape::SetRegionName(const wxString& name, int regionId) { - wxNode *node = m_regions.Nth(regionId); + wxNode *node = m_regions.Item(regionId); if (!node) return; - wxShapeRegion *region = (wxShapeRegion *)node->Data(); + wxShapeRegion *region = (wxShapeRegion *)node->GetData(); region->SetName(name); } wxString wxShape::GetRegionName(int regionId) { - wxNode *node = m_regions.Nth(regionId); + wxNode *node = m_regions.Item(regionId); if (!node) - return wxString(""); - wxShapeRegion *region = (wxShapeRegion *)node->Data(); + return wxEmptyString; + wxShapeRegion *region = (wxShapeRegion *)node->GetData(); return region->GetName(); } int wxShape::GetRegionId(const wxString& name) { - wxNode *node = m_regions.First(); + wxNode *node = m_regions.GetFirst(); int i = 0; while (node) { - wxShapeRegion *region = (wxShapeRegion *)node->Data(); + wxShapeRegion *region = (wxShapeRegion *)node->GetData(); if (region->GetName() == name) return i; - node = node->Next(); + node = node->GetNext(); i ++; } return -1; @@ -824,26 +815,27 @@ int wxShape::GetRegionId(const wxString& name) void wxShape::NameRegions(const wxString& parentName) { int n = GetNumberOfTextRegions(); - char buf[100]; + wxString buff; for (int i = 0; i < n; i++) { if (parentName.Length() > 0) - sprintf(buf, "%s.%d", (const char*) parentName, i); + buff << parentName << wxT(".") << i; else - sprintf(buf, "%d", i); - SetRegionName(buf, i); + buff << i; + SetRegionName(buff, i); } - wxNode *node = m_children.First(); + wxNode *node = m_children.GetFirst(); int j = 0; while (node) { - wxShape *child = (wxShape *)node->Data(); + buff.Empty(); + wxShape *child = (wxShape *)node->GetData(); if (parentName.Length() > 0) - sprintf(buf, "%s.%d", (const char*) parentName, j); + buff << parentName << wxT(".") << j; else - sprintf(buf, "%d", j); - child->NameRegions(buf); - node = node->Next(); + buff << j; + child->NameRegions(buff); + node = node->GetNext(); j ++; } } @@ -858,14 +850,14 @@ wxShape *wxShape::FindRegion(const wxString& name, int *regionId) return this; } - wxNode *node = m_children.First(); + wxNode *node = m_children.GetFirst(); while (node) { - wxShape *child = (wxShape *)node->Data(); + wxShape *child = (wxShape *)node->GetData(); wxShape *actualImage = child->FindRegion(name, regionId); if (actualImage) return actualImage; - node = node->Next(); + node = node->GetNext(); } return NULL; } @@ -878,15 +870,15 @@ void wxShape::FindRegionNames(wxStringList& list) for (int i = 0; i < n; i++) { wxString name(GetRegionName(i)); - list.Add((const char*) name); + list.Add(name); } - wxNode *node = m_children.First(); + wxNode *node = m_children.GetFirst(); while (node) { - wxShape *child = (wxShape *)node->Data(); + wxShape *child = (wxShape *)node->GetData(); child->FindRegionNames(list); - node = node->Next(); + node = node->GetNext(); } } @@ -894,12 +886,12 @@ void wxShape::AssignNewIds() { // if (m_id == 0) m_id = wxNewId(); - wxNode *node = m_children.First(); + wxNode *node = m_children.GetFirst(); while (node) { - wxShape *child = (wxShape *)node->Data(); + wxShape *child = (wxShape *)node->GetData(); child->AssignNewIds(); - node = node->Next(); + node = node->GetNext(); } } @@ -912,12 +904,12 @@ void wxShape::OnMoveLinks(wxDC& dc) // Want to set the ends of all attached links // to point to/from this object - wxNode *current = m_lines.First(); + wxNode *current = m_lines.GetFirst(); while (current) { - wxLineShape *line = (wxLineShape *)current->Data(); + wxLineShape *line = (wxLineShape *)current->GetData(); line->GetEventHandler()->OnMoveLink(dc); - current = current->Next(); + current = current->GetNext(); } } @@ -926,11 +918,11 @@ void wxShape::OnDrawContents(wxDC& dc) { double bound_x, bound_y; GetBoundingBoxMin(&bound_x, &bound_y); - if (m_regions.Number() < 1) return; + if (m_regions.GetCount() < 1) return; if (m_pen) dc.SetPen(* m_pen); - wxShapeRegion *region = (wxShapeRegion *)m_regions.First()->Data(); + wxShapeRegion *region = (wxShapeRegion *)m_regions.GetFirst()->GetData(); if (region->GetFont()) dc.SetFont(* region->GetFont()); dc.SetTextForeground(* (region->GetActualColourObject())); @@ -970,12 +962,12 @@ void wxShape::OnErase(wxDC& dc) return; // Erase links - wxNode *current = m_lines.First(); + wxNode *current = m_lines.GetFirst(); while (current) { - wxLineShape *line = (wxLineShape *)current->Data(); + wxLineShape *line = (wxLineShape *)current->GetData(); line->GetEventHandler()->OnErase(dc); - current = current->Next(); + current = current->GetNext(); } GetEventHandler()->OnEraseContents(dc); } @@ -1009,23 +1001,23 @@ void wxShape::EraseLinks(wxDC& dc, int attachment, bool recurse) if (!m_visible) return; - wxNode *current = m_lines.First(); + wxNode *current = m_lines.GetFirst(); while (current) { - wxLineShape *line = (wxLineShape *)current->Data(); + wxLineShape *line = (wxLineShape *)current->GetData(); if (attachment == -1 || ((line->GetTo() == this && line->GetAttachmentTo() == attachment) || (line->GetFrom() == this && line->GetAttachmentFrom() == attachment))) line->GetEventHandler()->OnErase(dc); - current = current->Next(); + current = current->GetNext(); } if (recurse) { - wxNode *node = m_children.First(); + wxNode *node = m_children.GetFirst(); while (node) { - wxShape *child = (wxShape *)node->Data(); + wxShape *child = (wxShape *)node->GetData(); child->EraseLinks(dc, attachment, recurse); - node = node->Next(); + node = node->GetNext(); } } } @@ -1035,24 +1027,24 @@ void wxShape::DrawLinks(wxDC& dc, int attachment, bool recurse) if (!m_visible) return; - wxNode *current = m_lines.First(); + wxNode *current = m_lines.GetFirst(); while (current) { - wxLineShape *line = (wxLineShape *)current->Data(); + wxLineShape *line = (wxLineShape *)current->GetData(); if (attachment == -1 || (line->GetTo() == this && line->GetAttachmentTo() == attachment) || (line->GetFrom() == this && line->GetAttachmentFrom() == attachment)) line->Draw(dc); - current = current->Next(); + current = current->GetNext(); } if (recurse) { - wxNode *node = m_children.First(); + wxNode *node = m_children.GetFirst(); while (node) { - wxShape *child = (wxShape *)node->Data(); + wxShape *child = (wxShape *)node->GetData(); child->DrawLinks(dc, attachment, recurse); - node = node->Next(); + node = node->GetNext(); } } } @@ -1110,11 +1102,11 @@ bool wxShape::MoveLineToNewAttachment(wxDC& dc, wxLineShape *to_move, wxList newOrdering; // First, add all links to the new list. - wxNode *node = m_lines.First(); + wxNode *node = m_lines.GetFirst(); while (node) { - newOrdering.Append(node->Data()); - node = node->Next(); + newOrdering.Append(node->GetData()); + node = node->GetNext(); } // Delete the line object from the list of links; we're going to move @@ -1124,12 +1116,12 @@ bool wxShape::MoveLineToNewAttachment(wxDC& dc, wxLineShape *to_move, double old_x = (double) -99999.9; double old_y = (double) -99999.9; - node = newOrdering.First(); + node = newOrdering.GetFirst(); bool found = FALSE; while (!found && node) { - wxLineShape *line = (wxLineShape *)node->Data(); + wxLineShape *line = (wxLineShape *)node->GetData(); if ((line->GetTo() == this && oldAttachment == line->GetAttachmentTo()) || (line->GetFrom() == this && oldAttachment == line->GetAttachmentFrom())) { @@ -1159,7 +1151,7 @@ bool wxShape::MoveLineToNewAttachment(wxDC& dc, wxLineShape *to_move, old_x = xp; old_y = yp; } - node = node->Next(); + node = node->GetNext(); } if (!found) @@ -1193,36 +1185,36 @@ void wxShape::ApplyAttachmentOrdering(wxList& linesToSort) // This is a temporary store of all the lines. wxList linesStore; - wxNode *node = m_lines.First(); + wxNode *node = m_lines.GetFirst(); while (node) { - wxLineShape *line = (wxLineShape *)node->Data(); + wxLineShape *line = (wxLineShape *)node->GetData(); linesStore.Append(line); - node = node->Next();; + node = node->GetNext();; } m_lines.Clear(); - node = linesToSort.First(); + node = linesToSort.GetFirst(); while (node) { - wxLineShape *line = (wxLineShape *)node->Data(); + wxLineShape *line = (wxLineShape *)node->GetData(); if (linesStore.Member(line)) { // Done this one linesStore.DeleteObject(line); m_lines.Append(line); } - node = node->Next(); + node = node->GetNext(); } // Now add any lines that haven't been listed in linesToSort. - node = linesStore.First(); + node = linesStore.GetFirst(); while (node) { - wxLineShape *line = (wxLineShape *)node->Data(); + wxLineShape *line = (wxLineShape *)node->GetData(); m_lines.Append(line); - node = node->Next(); + node = node->GetNext(); } } @@ -1235,11 +1227,11 @@ void wxShape::SortLines(int attachment, wxList& linesToSort) // point. We'll tick them off as we've processed them. wxList linesAtThisAttachment; - wxNode *node = m_lines.First(); + wxNode *node = m_lines.GetFirst(); while (node) { - wxLineShape *line = (wxLineShape *)node->Data(); - wxNode *next = node->Next(); + wxLineShape *line = (wxLineShape *)node->GetData(); + wxNode *next = node->GetNext(); if ((line->GetTo() == this && line->GetAttachmentTo() == attachment) || (line->GetFrom() == this && line->GetAttachmentFrom() == attachment)) { @@ -1247,29 +1239,29 @@ void wxShape::SortLines(int attachment, wxList& linesToSort) delete node; node = next; } - else node = node->Next(); + else node = node->GetNext(); } - node = linesToSort.First(); + node = linesToSort.GetFirst(); while (node) { - wxLineShape *line = (wxLineShape *)node->Data(); + wxLineShape *line = (wxLineShape *)node->GetData(); if (linesAtThisAttachment.Member(line)) { // Done this one linesAtThisAttachment.DeleteObject(line); m_lines.Append(line); } - node = node->Next(); + node = node->GetNext(); } // Now add any lines that haven't been listed in linesToSort. - node = linesAtThisAttachment.First(); + node = linesAtThisAttachment.GetFirst(); while (node) { - wxLineShape *line = (wxLineShape *)node->Data(); + wxLineShape *line = (wxLineShape *)node->GetData(); m_lines.Append(line); - node = node->Next(); + node = node->GetNext(); } } @@ -1550,12 +1542,12 @@ void wxShape::Flash() void wxShape::Show(bool show) { m_visible = show; - wxNode *node = m_children.First(); + wxNode *node = m_children.GetFirst(); while (node) { - wxShape *image = (wxShape *)node->Data(); + wxShape *image = (wxShape *)node->GetData(); image->Show(show); - node = node->Next(); + node = node->GetNext(); } } @@ -1573,10 +1565,10 @@ void wxShape::EraseContents(wxDC& dc) void wxShape::AddText(const wxString& string) { - wxNode *node = m_regions.First(); + wxNode *node = m_regions.GetFirst(); if (!node) return; - wxShapeRegion *region = (wxShapeRegion *)node->Data(); + wxShapeRegion *region = (wxShapeRegion *)node->GetData(); region->ClearText(); wxShapeTextLine *new_line = new wxShapeTextLine(0.0, 0.0, string); @@ -1604,13 +1596,13 @@ void wxShape::SetAttachmentSize(double w, double h) scaleY = 1.0; else scaleY = h/height; - wxNode *node = m_attachmentPoints.First(); + wxNode *node = m_attachmentPoints.GetFirst(); while (node) { - wxAttachmentPoint *point = (wxAttachmentPoint *)node->Data(); + wxAttachmentPoint *point = (wxAttachmentPoint *)node->GetData(); point->m_x = (double)(point->m_x * scaleX); point->m_y = (double)(point->m_y * scaleY); - node = node->Next(); + node = node->GetNext(); } } @@ -1629,9 +1621,9 @@ void wxShape::AddLine(wxLineShape *line, wxShape *other, { // Don't preserve old ordering if we have new ordering instructions m_lines.DeleteObject(line); - if (positionFrom < m_lines.Number()) + if (positionFrom < m_lines.GetCount()) { - wxNode* node = m_lines.Nth(positionFrom); + wxNode* node = m_lines.Item(positionFrom); m_lines.Insert(node, line); } else @@ -1647,9 +1639,9 @@ void wxShape::AddLine(wxLineShape *line, wxShape *other, { // Don't preserve old ordering if we have new ordering instructions other->m_lines.DeleteObject(line); - if (positionTo < other->m_lines.Number()) + if (positionTo < other->m_lines.GetCount()) { - wxNode* node = other->m_lines.Nth(positionTo); + wxNode* node = other->m_lines.Item(positionTo); other->m_lines.Insert(node, line); } else @@ -1664,9 +1656,9 @@ void wxShape::AddLine(wxLineShape *line, wxShape *other, m_lines.Append(line); else { - if (positionFrom < m_lines.Number()) + if (positionFrom < m_lines.GetCount()) { - wxNode* node = m_lines.Nth(positionFrom); + wxNode* node = m_lines.Item(positionFrom); m_lines.Insert(node, line); } else @@ -1677,9 +1669,9 @@ void wxShape::AddLine(wxLineShape *line, wxShape *other, other->m_lines.Append(line); else { - if (positionTo < other->m_lines.Number()) + if (positionTo < other->m_lines.GetCount()) { - wxNode* node = other->m_lines.Nth(positionTo); + wxNode* node = other->m_lines.Item(positionTo); other->m_lines.Insert(node, line); } else @@ -1702,7 +1694,7 @@ void wxShape::RemoveLine(wxLineShape *line) m_lines.DeleteObject(line); } -#ifdef PROLOGIO +#if wxUSE_PROLOGIO void wxShape::WriteAttributes(wxExpr *clause) { clause->AddAttributeValueString("type", GetClassInfo()->GetClassName()); @@ -1747,17 +1739,17 @@ void wxShape::WriteAttributes(wxExpr *clause) // Output line ids - int n_lines = m_lines.Number(); + int n_lines = m_lines.GetCount(); if (n_lines > 0) { wxExpr *list = new wxExpr(wxExprList); - wxNode *node = m_lines.First(); + wxNode *node = m_lines.GetFirst(); while (node) { - wxShape *line = (wxShape *)node->Data(); + wxShape *line = (wxShape *)node->GetData(); wxExpr *id_expr = new wxExpr(line->GetId()); list->Append(id_expr); - node = node->Next(); + node = node->GetNext(); } clause->AddAttributeValue("arcs", list); } @@ -1796,19 +1788,19 @@ void wxShape::WriteAttributes(wxExpr *clause) } // Write user-defined attachment points, if any - if (m_attachmentPoints.Number() > 0) + if (m_attachmentPoints.GetCount() > 0) { wxExpr *attachmentList = new wxExpr(wxExprList); - wxNode *node = m_attachmentPoints.First(); + wxNode *node = m_attachmentPoints.GetFirst(); while (node) { - wxAttachmentPoint *point = (wxAttachmentPoint *)node->Data(); + wxAttachmentPoint *point = (wxAttachmentPoint *)node->GetData(); wxExpr *pointExpr = new wxExpr(wxExprList); pointExpr->Append(new wxExpr((long)point->m_id)); pointExpr->Append(new wxExpr(point->m_x)); pointExpr->Append(new wxExpr(point->m_y)); attachmentList->Append(pointExpr); - node = node->Next(); + node = node->GetNext(); } clause->AddAttributeValue("user_attachments", attachmentList); } @@ -1824,10 +1816,10 @@ void wxShape::WriteRegions(wxExpr *clause) int regionNo = 1; char regionNameBuf[20]; char textNameBuf[20]; - wxNode *node = m_regions.First(); + wxNode *node = m_regions.GetFirst(); while (node) { - wxShapeRegion *region = (wxShapeRegion *)node->Data(); + wxShapeRegion *region = (wxShapeRegion *)node->GetData(); sprintf(regionNameBuf, "region%d", regionNo); sprintf(textNameBuf, "text%d", regionNo); @@ -1864,23 +1856,23 @@ void wxShape::WriteRegions(wxExpr *clause) // text1 = ((x y string) (x y string) ...) wxExpr *textExpr = new wxExpr(wxExprList); - wxNode *textNode = region->m_formattedText.First(); + wxNode *textNode = region->m_formattedText.GetFirst(); while (textNode) { - wxShapeTextLine *line = (wxShapeTextLine *)textNode->Data(); + wxShapeTextLine *line = (wxShapeTextLine *)textNode->GetData(); wxExpr *list2 = new wxExpr(wxExprList); list2->Append(new wxExpr(line->GetX())); list2->Append(new wxExpr(line->GetY())); list2->Append(new wxExpr(wxExprString, line->GetText())); textExpr->Append(list2); - textNode = textNode->Next(); + textNode = textNode->GetNext(); } // Now add both attributes to the clause clause->AddAttributeValue(regionNameBuf, regionExpr); clause->AddAttributeValue(textNameBuf, textExpr); - node = node->Next(); + node = node->GetNext(); regionNo ++; } } @@ -1937,7 +1929,7 @@ void wxShape::ReadAttributes(wxExpr *clause) } } wxShapeTextLine *line = - new wxShapeTextLine(the_x, the_y, (char*) (const char*) the_string); + new wxShapeTextLine(the_x, the_y, the_string); m_text.Append(line); node = node->next; @@ -2232,7 +2224,7 @@ void wxShape::ReadRegions(wxExpr *clause) if (the_string) { wxShapeTextLine *line = - new wxShapeTextLine(the_x, the_y, (char*) (const char*) the_string); + new wxShapeTextLine(the_x, the_y, the_string); region->m_formattedText.Append(line); } node = node->next; @@ -2247,21 +2239,21 @@ void wxShape::ReadRegions(wxExpr *clause) // Compatibility: check for no regions (old file). // Lines and divided rectangles must deal with this compatibility // theirselves. Composites _may_ not have any regions anyway. - if ((m_regions.Number() == 0) && + if ((m_regions.GetCount() == 0) && !this->IsKindOf(CLASSINFO(wxLineShape)) && !this->IsKindOf(CLASSINFO(wxDividedShape)) && !this->IsKindOf(CLASSINFO(wxCompositeShape))) { wxShapeRegion *newRegion = new wxShapeRegion; newRegion->SetName("0"); m_regions.Append((wxObject *)newRegion); - if (m_text.Number() > 0) + if (m_text.GetCount() > 0) { newRegion->ClearText(); - wxNode *node = m_text.First(); + wxNode *node = m_text.GetFirst(); while (node) { - wxShapeTextLine *textLine = (wxShapeTextLine *)node->Data(); - wxNode *next = node->Next(); + wxShapeTextLine *textLine = (wxShapeTextLine *)node->GetData(); + wxNode *next = node->GetNext(); newRegion->GetFormattedText().Append((wxObject *)textLine); delete node; node = next; @@ -2308,37 +2300,37 @@ void wxShape::Copy(wxShape& copy) // Copy text regions copy.ClearRegions(); - wxNode *node = m_regions.First(); + wxNode *node = m_regions.GetFirst(); while (node) { - wxShapeRegion *region = (wxShapeRegion *)node->Data(); + wxShapeRegion *region = (wxShapeRegion *)node->GetData(); wxShapeRegion *newRegion = new wxShapeRegion(*region); copy.m_regions.Append(newRegion); - node = node->Next(); + node = node->GetNext(); } // Copy attachments copy.ClearAttachments(); - node = m_attachmentPoints.First(); + node = m_attachmentPoints.GetFirst(); while (node) { - wxAttachmentPoint *point = (wxAttachmentPoint *)node->Data(); + wxAttachmentPoint *point = (wxAttachmentPoint *)node->GetData(); wxAttachmentPoint *newPoint = new wxAttachmentPoint; newPoint->m_id = point->m_id; newPoint->m_x = point->m_x; newPoint->m_y = point->m_y; copy.m_attachmentPoints.Append((wxObject *)newPoint); - node = node->Next(); + node = node->GetNext(); } // Copy lines copy.m_lines.Clear(); - node = m_lines.First(); + node = m_lines.GetFirst(); while (node) { - wxLineShape* line = (wxLineShape*) node->Data(); + wxLineShape* line = (wxLineShape*) node->GetData(); copy.m_lines.Append(line); - node = node->Next(); + node = node->GetNext(); } } @@ -2446,23 +2438,23 @@ void wxShape::MakeControlPoints() void wxShape::MakeMandatoryControlPoints() { - wxNode *node = m_children.First(); + wxNode *node = m_children.GetFirst(); while (node) { - wxShape *child = (wxShape *)node->Data(); + wxShape *child = (wxShape *)node->GetData(); child->MakeMandatoryControlPoints(); - node = node->Next(); + node = node->GetNext(); } } void wxShape::ResetMandatoryControlPoints() { - wxNode *node = m_children.First(); + wxNode *node = m_children.GetFirst(); while (node) { - wxShape *child = (wxShape *)node->Data(); + wxShape *child = (wxShape *)node->GetData(); child->ResetMandatoryControlPoints(); - node = node->Next(); + node = node->GetNext(); } } @@ -2470,7 +2462,7 @@ void wxShape::ResetControlPoints() { ResetMandatoryControlPoints(); - if (m_controlPoints.Number() < 1) + if (m_controlPoints.GetCount() < 1) return; double maxX, maxY, minX, minY; @@ -2487,55 +2479,55 @@ void wxShape::ResetControlPoints() double left = (double)(- (widthMin / 2.0)); double right = (double)(widthMin / 2.0 + (maxX - minX)); - wxNode *node = m_controlPoints.First(); - wxControlPoint *control = (wxControlPoint *)node->Data(); + wxNode *node = m_controlPoints.GetFirst(); + wxControlPoint *control = (wxControlPoint *)node->GetData(); control->m_xoffset = left; control->m_yoffset = top; - node = node->Next(); control = (wxControlPoint *)node->Data(); + node = node->GetNext(); control = (wxControlPoint *)node->GetData(); control->m_xoffset = 0; control->m_yoffset = top; - node = node->Next(); control = (wxControlPoint *)node->Data(); + node = node->GetNext(); control = (wxControlPoint *)node->GetData(); control->m_xoffset = right; control->m_yoffset = top; - node = node->Next(); control = (wxControlPoint *)node->Data(); + node = node->GetNext(); control = (wxControlPoint *)node->GetData(); control->m_xoffset = right; control->m_yoffset = 0; - node = node->Next(); control = (wxControlPoint *)node->Data(); + node = node->GetNext(); control = (wxControlPoint *)node->GetData(); control->m_xoffset = right; control->m_yoffset = bottom; - node = node->Next(); control = (wxControlPoint *)node->Data(); + node = node->GetNext(); control = (wxControlPoint *)node->GetData(); control->m_xoffset = 0; control->m_yoffset = bottom; - node = node->Next(); control = (wxControlPoint *)node->Data(); + node = node->GetNext(); control = (wxControlPoint *)node->GetData(); control->m_xoffset = left; control->m_yoffset = bottom; - node = node->Next(); control = (wxControlPoint *)node->Data(); + node = node->GetNext(); control = (wxControlPoint *)node->GetData(); control->m_xoffset = left; control->m_yoffset = 0; } void wxShape::DeleteControlPoints(wxDC *dc) { - wxNode *node = m_controlPoints.First(); + wxNode *node = m_controlPoints.GetFirst(); while (node) { - wxControlPoint *control = (wxControlPoint *)node->Data(); + wxControlPoint *control = (wxControlPoint *)node->GetData(); if (dc) control->GetEventHandler()->OnErase(*dc); m_canvas->RemoveShape(control); delete control; delete node; - node = m_controlPoints.First(); + node = m_controlPoints.GetFirst(); } // Children of divisions are contained objects, // so stop here if (!IsKindOf(CLASSINFO(wxDivisionShape))) { - node = m_children.First(); + node = m_children.GetFirst(); while (node) { - wxShape *child = (wxShape *)node->Data(); + wxShape *child = (wxShape *)node->GetData(); child->DeleteControlPoints(dc); - node = node->Next(); + node = node->GetNext(); } } } @@ -2548,12 +2540,12 @@ void wxShape::OnDrawControlPoints(wxDC& dc) dc.SetBrush(* wxBLACK_BRUSH); dc.SetPen(* wxBLACK_PEN); - wxNode *node = m_controlPoints.First(); + wxNode *node = m_controlPoints.GetFirst(); while (node) { - wxControlPoint *control = (wxControlPoint *)node->Data(); + wxControlPoint *control = (wxControlPoint *)node->GetData(); control->Draw(dc); - node = node->Next(); + node = node->GetNext(); } // Children of divisions are contained objects, // so stop here. @@ -2561,33 +2553,33 @@ void wxShape::OnDrawControlPoints(wxDC& dc) // (critical when drawing) if (!IsKindOf(CLASSINFO(wxDivisionShape))) { - node = m_children.First(); + node = m_children.GetFirst(); while (node) { - wxShape *child = (wxShape *)node->Data(); + wxShape *child = (wxShape *)node->GetData(); child->GetEventHandler()->OnDrawControlPoints(dc); - node = node->Next(); + node = node->GetNext(); } } } void wxShape::OnEraseControlPoints(wxDC& dc) { - wxNode *node = m_controlPoints.First(); + wxNode *node = m_controlPoints.GetFirst(); while (node) { - wxControlPoint *control = (wxControlPoint *)node->Data(); + wxControlPoint *control = (wxControlPoint *)node->GetData(); control->Erase(dc); - node = node->Next(); + node = node->GetNext(); } if (!IsKindOf(CLASSINFO(wxDivisionShape))) { - node = m_children.First(); + node = m_children.GetFirst(); while (node) { - wxShape *child = (wxShape *)node->Data(); + wxShape *child = (wxShape *)node->GetData(); child->GetEventHandler()->OnEraseControlPoints(dc); - node = node->Next(); + node = node->GetNext(); } } } @@ -2602,12 +2594,12 @@ void wxShape::Select(bool select, wxDC* dc) // so stop here if (!IsKindOf(CLASSINFO(wxDivisionShape))) { - wxNode *node = m_children.First(); + wxNode *node = m_children.GetFirst(); while (node) { - wxShape *child = (wxShape *)node->Data(); + wxShape *child = (wxShape *)node->GetData(); child->MakeMandatoryControlPoints(); - node = node->Next(); + node = node->GetNext(); } } if (dc) @@ -2618,12 +2610,12 @@ void wxShape::Select(bool select, wxDC* dc) DeleteControlPoints(dc); if (!IsKindOf(CLASSINFO(wxDivisionShape))) { - wxNode *node = m_children.First(); + wxNode *node = m_children.GetFirst(); while (node) { - wxShape *child = (wxShape *)node->Data(); + wxShape *child = (wxShape *)node->GetData(); child->DeleteControlPoints(dc); - node = node->Next(); + node = node->GetNext(); } } } @@ -2648,18 +2640,18 @@ int wxShape::GetNumberOfAttachments() const // Should return the MAXIMUM attachment point id here, // so higher-level functions can iterate through all attachments, // even if they're not contiguous. - if (m_attachmentPoints.Number() == 0) + if (m_attachmentPoints.GetCount() == 0) return 4; else { int maxN = 3; - wxNode *node = m_attachmentPoints.First(); + wxNode *node = m_attachmentPoints.GetFirst(); while (node) { - wxAttachmentPoint *point = (wxAttachmentPoint *)node->Data(); + wxAttachmentPoint *point = (wxAttachmentPoint *)node->GetData(); if (point->m_id > maxN) maxN = point->m_id; - node = node->Next(); + node = node->GetNext(); } return maxN+1;; } @@ -2667,18 +2659,18 @@ int wxShape::GetNumberOfAttachments() const bool wxShape::AttachmentIsValid(int attachment) const { - if (m_attachmentPoints.Number() == 0) + if (m_attachmentPoints.GetCount() == 0) { return ((attachment >= 0) && (attachment < 4)) ; } - wxNode *node = m_attachmentPoints.First(); + wxNode *node = m_attachmentPoints.GetFirst(); while (node) { - wxAttachmentPoint *point = (wxAttachmentPoint *)node->Data(); + wxAttachmentPoint *point = (wxAttachmentPoint *)node->GetData(); if (point->m_id == attachment) return TRUE; - node = node->Next(); + node = node->GetNext(); } return FALSE; } @@ -2701,19 +2693,19 @@ bool wxShape::GetAttachmentPosition(int attachment, double *x, double *y, } else if (m_attachmentMode == ATTACHMENT_MODE_EDGE) { - if (m_attachmentPoints.Number() > 0) + if (m_attachmentPoints.GetCount() > 0) { - wxNode *node = m_attachmentPoints.First(); + wxNode *node = m_attachmentPoints.GetFirst(); while (node) { - wxAttachmentPoint *point = (wxAttachmentPoint *)node->Data(); + wxAttachmentPoint *point = (wxAttachmentPoint *)node->GetData(); if (point->m_id == attachment) { *x = (double)(m_xpos + point->m_x); *y = (double)(m_ypos + point->m_y); return TRUE; } - node = node->Next(); + node = node->GetNext(); } *x = m_xpos; *y = m_ypos; return FALSE; @@ -2797,14 +2789,14 @@ bool wxShape::HasDescendant(wxShape *image) { if (image == this) return TRUE; - wxNode *node = m_children.First(); + wxNode *node = m_children.GetFirst(); while (node) { - wxShape *child = (wxShape *)node->Data(); + wxShape *child = (wxShape *)node->GetData(); bool ans = child->HasDescendant(image); if (ans) return TRUE; - node = node->Next(); + node = node->GetNext(); } return FALSE; } @@ -2812,13 +2804,13 @@ bool wxShape::HasDescendant(wxShape *image) // Clears points from a list of wxRealPoints, and clears list void wxShape::ClearPointList(wxList& list) { - wxNode* node = list.First(); + wxNode* node = list.GetFirst(); while (node) { - wxRealPoint* pt = (wxRealPoint*) node->Data(); + wxRealPoint* pt = (wxRealPoint*) node->GetData(); delete pt; - node = node->Next(); + node = node->GetNext(); } list.Clear(); } @@ -2913,8 +2905,8 @@ wxRealPoint wxShape::CalcSimpleAttachment(const wxRealPoint& pt1, const wxRealPo int wxShape::GetLinePosition(wxLineShape* line) { int i = 0; - for (i = 0; i < m_lines.Number(); i++) - if ((wxLineShape*) (m_lines.Nth(i)->Data()) == line) + for (i = 0; i < m_lines.GetCount(); i++) + if ((wxLineShape*) (m_lines.Item(i)->GetData()) == line) return i; return 0; @@ -2998,7 +2990,7 @@ bool wxShape::GetBranchingAttachmentInfo(int attachment, wxRealPoint& root, wxRe } default: { - wxFAIL_MSG( "Unrecognised attachment point in GetBranchingAttachmentInfo." ); + wxFAIL_MSG( wxT("Unrecognised attachment point in GetBranchingAttachmentInfo.") ); break; } } @@ -3057,7 +3049,7 @@ bool wxShape::GetBranchingAttachmentPoint(int attachment, int n, wxRealPoint& pt } default: { - wxFAIL_MSG( "Unrecognised attachment point in GetBranchingAttachmentPoint." ); + wxFAIL_MSG( wxT("Unrecognised attachment point in GetBranchingAttachmentPoint.") ); break; } } @@ -3069,16 +3061,16 @@ bool wxShape::GetBranchingAttachmentPoint(int attachment, int n, wxRealPoint& pt int wxShape::GetAttachmentLineCount(int attachment) const { int count = 0; - wxNode* node = m_lines.First(); + wxNode* node = m_lines.GetFirst(); while (node) { - wxLineShape* lineShape = (wxLineShape*) node->Data(); + wxLineShape* lineShape = (wxLineShape*) node->GetData(); if ((lineShape->GetFrom() == this) && (lineShape->GetAttachmentFrom() == attachment)) count ++; else if ((lineShape->GetTo() == this) && (lineShape->GetAttachmentTo() == attachment)) count ++; - node = node->Next(); + node = node->GetNext(); } return count; } @@ -3122,7 +3114,7 @@ wxRealPoint wxShape::GetBranchingAttachmentRoot(int attachment) } default: { - wxFAIL_MSG( "Unrecognised attachment point in GetBranchingAttachmentRoot." ); + wxFAIL_MSG( wxT("Unrecognised attachment point in GetBranchingAttachmentRoot.") ); break; } }