From 5e0dbc8dd94d7ba16cb97cb050c9588db4c3a12f Mon Sep 17 00:00:00 2001 From: =?utf8?q?W=C5=82odzimierz=20Skiba?= Date: Fri, 23 Jul 2004 18:04:12 +0000 Subject: [PATCH] wxUSE_STL fixes. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28428 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- contrib/samples/ogl/ogledit/view.cpp | 6 ++---- contrib/samples/ogl/studio/csprint.cpp | 4 ++-- contrib/samples/ogl/studio/dialogs.cpp | 4 ++-- contrib/samples/ogl/studio/view.cpp | 20 +++++++++----------- contrib/src/fl/frmview.cpp | 2 +- contrib/src/mmedia/sndwin.cpp | 2 +- contrib/src/ogl/basic2.cpp | 4 ++-- contrib/src/ogl/canvas.cpp | 4 ++-- contrib/src/ogl/divided.cpp | 24 ++++++++---------------- contrib/src/ogl/mfutils.cpp | 8 ++++---- contrib/src/ogl/oglmisc.cpp | 18 +++++++++--------- 11 files changed, 42 insertions(+), 54 deletions(-) diff --git a/contrib/samples/ogl/ogledit/view.cpp b/contrib/samples/ogl/ogledit/view.cpp index f3655f821c..1942b2c820 100644 --- a/contrib/samples/ogl/ogledit/view.cpp +++ b/contrib/samples/ogl/ogledit/view.cpp @@ -176,19 +176,17 @@ bool DiagramView::OnClose(bool WXUNUSED(deleteWindow)) wxShape *DiagramView::FindSelectedShape(void) { DiagramDocument *doc = (DiagramDocument *)GetDocument(); - wxShape *theShape = NULL; wxObjectList::compatibility_iterator node = doc->GetDiagram()->GetShapeList()->GetFirst(); while (node) { wxShape *eachShape = (wxShape *)node->GetData(); if ((eachShape->GetParent() == NULL) && eachShape->Selected()) { - theShape = eachShape; - node = NULL; + return eachShape; } else node = node->GetNext(); } - return theShape; + return NULL; } void DiagramView::OnCut(wxCommandEvent& WXUNUSED(event)) diff --git a/contrib/samples/ogl/studio/csprint.cpp b/contrib/samples/ogl/studio/csprint.cpp index ff3e0ec461..cebd060248 100644 --- a/contrib/samples/ogl/studio/csprint.cpp +++ b/contrib/samples/ogl/studio/csprint.cpp @@ -70,7 +70,7 @@ bool wxDiagramClipboard::DoCopy(wxDiagram* diagramFrom, wxDiagram* diagramTo, bo // First copy all node shapes. wxList* shapeList = diagramFrom->GetShapeList(); - wxNode* node = shapeList->GetFirst(); + wxObjectList::compatibility_iterator node = shapeList->GetFirst(); while (node) { wxShape* shape = (wxShape*) node->GetData(); @@ -137,7 +137,7 @@ bool wxDiagramClipboard::DoCopy(wxDiagram* diagramFrom, wxDiagram* diagramTo, bo // Make a list of all the new lines, in the same order as the old lines. // Then apply the list of new lines to the shape. wxList newLines; - wxNode* lineNode = shape->GetLines().GetFirst(); + wxObjectList::compatibility_iterator lineNode = shape->GetLines().GetFirst(); while (lineNode) { wxLineShape* lineShape = (wxLineShape*) lineNode->GetData(); diff --git a/contrib/samples/ogl/studio/dialogs.cpp b/contrib/samples/ogl/studio/dialogs.cpp index 5445c1bc51..09e91a5fb8 100644 --- a/contrib/samples/ogl/studio/dialogs.cpp +++ b/contrib/samples/ogl/studio/dialogs.cpp @@ -205,7 +205,7 @@ bool csSettingsDialog::TransferDataFromWindow() } // Apply settings to all open diagram documents - wxNode* node = wxGetApp().GetDocManager()->GetDocuments().GetFirst(); + wxObjectList::compatibility_iterator node = wxGetApp().GetDocManager()->GetDocuments().GetFirst(); while (node) { wxDocument* doc = (wxDocument*) node->GetData(); @@ -365,7 +365,7 @@ void csShapePropertiesDialog::SetDefaults() if (!m_attributeDialog) return; - wxWindowListNode* node = m_attributeDialog->GetChildren().GetFirst(); + wxWindowList::compatibility_iterator node = m_attributeDialog->GetChildren().GetFirst(); while (node) { wxWindow* child = (wxWindow*) node->GetData(); diff --git a/contrib/samples/ogl/studio/view.cpp b/contrib/samples/ogl/studio/view.cpp index f15c1cfed9..f3073fc44a 100644 --- a/contrib/samples/ogl/studio/view.cpp +++ b/contrib/samples/ogl/studio/view.cpp @@ -198,19 +198,17 @@ void csDiagramView::OnSelectAll(wxCommandEvent& WXUNUSED(event)) wxShape *csDiagramView::FindFirstSelectedShape(void) { csDiagramDocument *doc = (csDiagramDocument *)GetDocument(); - wxShape *theShape = NULL; wxObjectList::compatibility_iterator node = doc->GetDiagram()->GetShapeList()->GetFirst(); while (node) { wxShape *eachShape = (wxShape *)node->GetData(); if ((eachShape->GetParent() == NULL) && !eachShape->IsKindOf(CLASSINFO(wxLabelShape)) && eachShape->Selected()) { - theShape = eachShape; - node = NULL; + return eachShape; } else node = node->GetNext(); } - return theShape; + return NULL; } void csDiagramView::FindSelectedShapes(wxList& selections, wxClassInfo* toFind) @@ -579,7 +577,7 @@ void csDiagramView::OnToggleArrowTool(wxCommandEvent& WXUNUSED(event)) { csDiagramCommand* cmd = new csDiagramCommand(stateName, doc); - wxNode* node = selections.GetFirst(); + wxObjectList::compatibility_iterator node = selections.GetFirst(); while (node) { wxLineShape *theShape = (wxLineShape*) node->GetData(); @@ -634,7 +632,7 @@ void csDiagramView::ReflectPointSize(int pointSize) void csDiagramView::ReflectArrowState(wxLineShape* lineShape) { bool haveArrow = false; - wxNode *node = lineShape->GetArrows().GetFirst(); + wxObjectList::compatibility_iterator node = lineShape->GetArrows().GetFirst(); while (node) { wxArrowHead *arrow = (wxArrowHead *)node->GetData(); @@ -651,7 +649,7 @@ void csDiagramView::OnAlign(wxCommandEvent& event) // Make a copy of the selections, keeping only those shapes // that are top-level non-line shapes. wxList selections; - wxNode* node = GetSelectionList().GetFirst(); + wxObjectList::compatibility_iterator node = GetSelectionList().GetFirst(); while (node) { wxShape* shape = (wxShape*) node->GetData(); @@ -751,7 +749,7 @@ void csDiagramView::OnNewLinePoint(wxCommandEvent& WXUNUSED(event)) csDiagramDocument *doc = (csDiagramDocument *)GetDocument(); csDiagramCommand* cmd = new csDiagramCommand(_T("New line point"), doc); - wxNode* node = m_selections.GetFirst(); + wxObjectList::compatibility_iterator node = m_selections.GetFirst(); while (node) { wxShape* shape = (wxShape*) node->GetData(); @@ -772,7 +770,7 @@ void csDiagramView::OnCutLinePoint(wxCommandEvent& WXUNUSED(event)) csDiagramDocument *doc = (csDiagramDocument *)GetDocument(); csDiagramCommand* cmd = new csDiagramCommand(_T("Cut line point"), doc); - wxNode* node = m_selections.GetFirst(); + wxObjectList::compatibility_iterator node = m_selections.GetFirst(); while (node) { wxShape* shape = (wxShape*) node->GetData(); @@ -793,7 +791,7 @@ void csDiagramView::OnStraightenLines(wxCommandEvent& WXUNUSED(event)) csDiagramDocument *doc = (csDiagramDocument *)GetDocument(); csDiagramCommand* cmd = new csDiagramCommand(_T("Straighten lines"), doc); - wxNode* node = m_selections.GetFirst(); + wxObjectList::compatibility_iterator node = m_selections.GetFirst(); while (node) { wxShape* shape = (wxShape*) node->GetData(); @@ -999,7 +997,7 @@ void csCanvas::OnEndDragLeft(double x, double y, int WXUNUSED(keys)) min_y = wxMin(y, sg_initialY); max_y = wxMax(y, sg_initialY); - wxNode *node = GetDiagram()->GetShapeList()->GetFirst(); + wxObjectList::compatibility_iterator node = GetDiagram()->GetShapeList()->GetFirst(); while (node) { wxShape *shape = (wxShape *)node->GetData(); diff --git a/contrib/src/fl/frmview.cpp b/contrib/src/fl/frmview.cpp index 67ee842b1a..22e59c57ad 100644 --- a/contrib/src/fl/frmview.cpp +++ b/contrib/src/fl/frmview.cpp @@ -208,7 +208,7 @@ void wxFrameManager::EnableMenusForView( wxFrameView* pView, bool enable ) if ( !pMenuBar ) return; - wxStringListNode* pNode = pView->mTopMenus.GetFirst(); + wxStringList::compatibility_iterator pNode = pView->mTopMenus.GetFirst(); int i; while ( pNode ) diff --git a/contrib/src/mmedia/sndwin.cpp b/contrib/src/mmedia/sndwin.cpp index b058747e4a..1b1b3f6c42 100644 --- a/contrib/src/mmedia/sndwin.cpp +++ b/contrib/src/mmedia/sndwin.cpp @@ -50,7 +50,7 @@ wxList *wxSoundHandleList = NULL; static inline wxSoundStreamWin *wxFindSoundFromHandle(WXHWND hWnd) { - wxNode *node = wxSoundHandleList->Find((long)hWnd); + wxObjectList::compatibility_iterator node = wxSoundHandleList->Find((long)hWnd); if (!node) return NULL; return (wxSoundStreamWin *)node->GetData(); diff --git a/contrib/src/ogl/basic2.cpp b/contrib/src/ogl/basic2.cpp index 658d93a725..0526495e72 100644 --- a/contrib/src/ogl/basic2.cpp +++ b/contrib/src/ogl/basic2.cpp @@ -1819,9 +1819,9 @@ void wxShapeRegion::ClearText() while (node) { wxShapeTextLine *line = (wxShapeTextLine *)node->GetData(); - wxNode *next = node->GetNext(); + wxObjectList::compatibility_iterator next = node->GetNext(); delete line; - delete node; + m_formattedText.Erase(node); node = next; } } diff --git a/contrib/src/ogl/canvas.cpp b/contrib/src/ogl/canvas.cpp index 239fcd000b..fc06964cf0 100644 --- a/contrib/src/ogl/canvas.cpp +++ b/contrib/src/ogl/canvas.cpp @@ -393,7 +393,7 @@ wxShape *wxShapeCanvas::FindShape(double x, double y, int *attachment, wxClassIn // the other objects // (b) to find the control points FIRST if they exist - wxNode *current = GetDiagram()->GetShapeList()->GetLast(); + wxObjectList::compatibility_iterator current = GetDiagram()->GetShapeList()->GetLast(); while (current) { wxShape *object = (wxShape *)current->GetData(); @@ -451,7 +451,7 @@ wxShape *wxShapeCanvas::FindShape(double x, double y, int *attachment, wxClassIn { nearest_object = object; nearest_attachment = temp_attachment; - current = NULL; + current = GetDiagram()->GetShapeList()->GetFirst()->GetPrevious(); // finish loop } } } diff --git a/contrib/src/ogl/divided.cpp b/contrib/src/ogl/divided.cpp index d8ced84d43..23d246154c 100644 --- a/contrib/src/ogl/divided.cpp +++ b/contrib/src/ogl/divided.cpp @@ -102,7 +102,7 @@ void wxDividedShape::OnDrawContents(wxDC& dc) double yMargin = 2; dc.SetBackgroundMode(wxTRANSPARENT); - wxNode *node = GetRegions().GetFirst(); + wxObjectList::compatibility_iterator node = GetRegions().GetFirst(); while (node) { wxShapeRegion *region = (wxShapeRegion *)node->GetData(); @@ -157,7 +157,7 @@ void wxDividedShape::SetRegionSizes() // double leftX = (double)(m_xpos - (m_width / 2.0)); // double rightX = (double)(m_xpos + (m_width / 2.0)); - wxNode *node = GetRegions().GetFirst(); + wxObjectList::compatibility_iterator node = GetRegions().GetFirst(); while (node) { wxShapeRegion *region = (wxShapeRegion *)node->GetData(); @@ -245,7 +245,7 @@ bool wxDividedShape::GetAttachmentPosition(int attachment, double *x, double *y, { bool isLeft = !(attachment < (n+1)); int i = (isLeft) ? (totalNumberAttachments - attachment - 1) : (attachment-1); - wxNode *node = GetRegions().Item(i); + wxObjectList::compatibility_iterator node = GetRegions().Item(i); if (node) { wxShapeRegion *region = (wxShapeRegion *)node->GetData(); @@ -298,7 +298,7 @@ int wxDividedShape::GetNumberOfAttachments() const int n = (GetRegions().GetCount() * 2) + 2; int maxN = n - 1; - wxNode *node = m_attachmentPoints.GetFirst(); + wxObjectList::compatibility_iterator node = m_attachmentPoints.GetFirst(); while (node) { wxAttachmentPoint *point = (wxAttachmentPoint *)node->GetData(); @@ -341,7 +341,7 @@ void wxDividedShape::MakeMandatoryControlPoints() double currentY = (double)(GetY() - (m_height / 2.0)); double maxY = (double)(GetY() + (m_height / 2.0)); - wxNode *node = GetRegions().GetFirst(); + wxObjectList::compatibility_iterator node = GetRegions().GetFirst(); int i = 0; while (node) { @@ -379,14 +379,14 @@ void wxDividedShape::ResetMandatoryControlPoints() double currentY = (double)(GetY() - (m_height / 2.0)); double maxY = (double)(GetY() + (m_height / 2.0)); - wxNode *node = m_controlPoints.GetFirst(); + wxObjectList::compatibility_iterator node = m_controlPoints.GetFirst(); int i = 0; while (node) { wxControlPoint *controlPoint = (wxControlPoint *)node->GetData(); if (controlPoint->IsKindOf(CLASSINFO(wxDividedShapeControlPoint))) { - wxNode *node1 = GetRegions().Item(i); + wxObjectList::compatibility_iterator node1 = GetRegions().Item(i); wxShapeRegion *region = (wxShapeRegion *)node1->GetData(); double proportion = region->m_regionProportionY; @@ -622,7 +622,7 @@ void wxDividedShapeControlPoint::OnEndDragLeft(double WXUNUSED(x), double y, int GetCanvas()->PrepareDC(dc); wxDividedShape *dividedObject = (wxDividedShape *)m_shape; - wxNode *node = dividedObject->GetRegions().Item(regionId); + wxObjectList::compatibility_iterator node = dividedObject->GetRegions().Item(regionId); if (!node) return; @@ -642,10 +642,6 @@ void wxDividedShapeControlPoint::OnEndDragLeft(double WXUNUSED(x), double y, int // Save values double thisRegionTop = 0.0; - #if 0 - // this variable is not readed later - double thisRegionBottom = 0.0; - #endif double nextRegionBottom = 0.0; node = dividedObject->GetRegions().GetFirst(); @@ -660,10 +656,6 @@ void wxDividedShapeControlPoint::OnEndDragLeft(double WXUNUSED(x), double y, int if (region == thisRegion) { thisRegionTop = currentY; - #if 0 - // no need for assignment if value is not used later - thisRegionBottom = actualY; - #endif if (node->GetNext()) nextRegion = (wxShapeRegion *)node->GetNext()->GetData(); } diff --git a/contrib/src/ogl/mfutils.cpp b/contrib/src/ogl/mfutils.cpp index 6c268e8425..229895912b 100644 --- a/contrib/src/ogl/mfutils.cpp +++ b/contrib/src/ogl/mfutils.cpp @@ -728,13 +728,13 @@ bool wxXMetaFile::ReadFile(const wxChar *file) wxXMetaFile::~wxXMetaFile(void) { - wxNode *node = metaRecords.GetFirst(); + wxObjectList::compatibility_iterator node = metaRecords.GetFirst(); while (node) { wxMetaRecord *rec = (wxMetaRecord *)node->GetData(); delete rec; - wxNode *next = node->GetNext(); - delete node; + wxObjectList::compatibility_iterator next = node->GetNext(); + metaRecords.Erase(node); node = next; } } @@ -746,7 +746,7 @@ bool wxXMetaFile::SetClipboard(int WXUNUSED(width), int WXUNUSED(height)) bool wxXMetaFile::Play(wxDC *dc) { - wxNode *node = metaRecords.GetFirst(); + wxObjectList::compatibility_iterator node = metaRecords.GetFirst(); while (node) { wxMetaRecord *rec = (wxMetaRecord *)node->GetData(); diff --git a/contrib/src/ogl/oglmisc.cpp b/contrib/src/ogl/oglmisc.cpp index 9b575499d5..19976f0fbf 100644 --- a/contrib/src/ogl/oglmisc.cpp +++ b/contrib/src/ogl/oglmisc.cpp @@ -220,7 +220,7 @@ void oglCentreText(wxDC& dc, wxList *text_list, // Store text extents for speed double *widths = new double[n]; - wxNode *current = text_list->GetFirst(); + wxObjectList::compatibility_iterator current = text_list->GetFirst(); int i = 0; while (current) { @@ -303,7 +303,7 @@ void oglCentreTextNoClipping(wxDC& dc, wxList *text_list, // Store text extents for speed double *widths = new double[n]; - wxNode *current = text_list->GetFirst(); + wxObjectList::compatibility_iterator current = text_list->GetFirst(); int i = 0; while (current) { @@ -359,7 +359,7 @@ void oglGetCentredTextExtent(wxDC& dc, wxList *text_list, long max_width = 0; long current_width = 0; - wxNode *current = text_list->GetFirst(); + wxObjectList::compatibility_iterator current = text_list->GetFirst(); while (current) { wxShapeTextLine *line = (wxShapeTextLine *)current->GetData(); @@ -444,15 +444,15 @@ wxStringList *oglFormatText(wxDC& dc, const wxString& text, double width, double wxStringList *string_list = new wxStringList; wxString buffer; - wxStringListNode *node = word_list.GetFirst(); + wxStringList::compatibility_iterator node = word_list.GetFirst(); long x, y; while (node) { wxString oldBuffer(buffer); - wxChar *s = (wxChar *)node->GetData(); - if (!s) + wxString s = node->GetData(); + if (s.IsEmpty()) { // FORCE NEW LINE if (buffer.Length() > 0) @@ -507,7 +507,7 @@ void oglDrawFormattedText(wxDC& dc, wxList *text_list, (long)(m_xpos - width/2.0), (long)(m_ypos - height/2.0), (long)width+1, (long)height+1); // +1 to allow for rounding errors - wxNode *current = text_list->GetFirst(); + wxObjectList::compatibility_iterator current = text_list->GetFirst(); while (current) { wxShapeTextLine *line = (wxShapeTextLine *)current->GetData(); @@ -529,7 +529,7 @@ void oglFindPolylineCentroid(wxList *points, double *x, double *y) double xcount = 0; double ycount = 0; - wxNode *node = points->GetFirst(); + wxObjectList::compatibility_iterator node = points->GetFirst(); while (node) { wxRealPoint *point = (wxRealPoint *)node->GetData(); @@ -807,7 +807,7 @@ void UpdateListBox(wxListBox *item, wxList *list) if (!list) return; - wxNode *node = list->GetFirst(); + wxObjectList::compatibility_iterator node = list->GetFirst(); while (node) { wxChar *s = (wxChar *)node->GetData(); -- 2.45.2