wxUSE_STL fixes.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28428 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba
2004-07-23 18:04:12 +00:00
parent 4b7ded8bad
commit 5e0dbc8dd9
11 changed files with 42 additions and 54 deletions

View File

@@ -176,19 +176,17 @@ bool DiagramView::OnClose(bool WXUNUSED(deleteWindow))
wxShape *DiagramView::FindSelectedShape(void) wxShape *DiagramView::FindSelectedShape(void)
{ {
DiagramDocument *doc = (DiagramDocument *)GetDocument(); DiagramDocument *doc = (DiagramDocument *)GetDocument();
wxShape *theShape = NULL;
wxObjectList::compatibility_iterator node = doc->GetDiagram()->GetShapeList()->GetFirst(); wxObjectList::compatibility_iterator node = doc->GetDiagram()->GetShapeList()->GetFirst();
while (node) while (node)
{ {
wxShape *eachShape = (wxShape *)node->GetData(); wxShape *eachShape = (wxShape *)node->GetData();
if ((eachShape->GetParent() == NULL) && eachShape->Selected()) if ((eachShape->GetParent() == NULL) && eachShape->Selected())
{ {
theShape = eachShape; return eachShape;
node = NULL;
} }
else node = node->GetNext(); else node = node->GetNext();
} }
return theShape; return NULL;
} }
void DiagramView::OnCut(wxCommandEvent& WXUNUSED(event)) void DiagramView::OnCut(wxCommandEvent& WXUNUSED(event))

View File

@@ -70,7 +70,7 @@ bool wxDiagramClipboard::DoCopy(wxDiagram* diagramFrom, wxDiagram* diagramTo, bo
// First copy all node shapes. // First copy all node shapes.
wxList* shapeList = diagramFrom->GetShapeList(); wxList* shapeList = diagramFrom->GetShapeList();
wxNode* node = shapeList->GetFirst(); wxObjectList::compatibility_iterator node = shapeList->GetFirst();
while (node) while (node)
{ {
wxShape* shape = (wxShape*) node->GetData(); 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. // 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. // Then apply the list of new lines to the shape.
wxList newLines; wxList newLines;
wxNode* lineNode = shape->GetLines().GetFirst(); wxObjectList::compatibility_iterator lineNode = shape->GetLines().GetFirst();
while (lineNode) while (lineNode)
{ {
wxLineShape* lineShape = (wxLineShape*) lineNode->GetData(); wxLineShape* lineShape = (wxLineShape*) lineNode->GetData();

View File

@@ -205,7 +205,7 @@ bool csSettingsDialog::TransferDataFromWindow()
} }
// Apply settings to all open diagram documents // Apply settings to all open diagram documents
wxNode* node = wxGetApp().GetDocManager()->GetDocuments().GetFirst(); wxObjectList::compatibility_iterator node = wxGetApp().GetDocManager()->GetDocuments().GetFirst();
while (node) while (node)
{ {
wxDocument* doc = (wxDocument*) node->GetData(); wxDocument* doc = (wxDocument*) node->GetData();
@@ -365,7 +365,7 @@ void csShapePropertiesDialog::SetDefaults()
if (!m_attributeDialog) if (!m_attributeDialog)
return; return;
wxWindowListNode* node = m_attributeDialog->GetChildren().GetFirst(); wxWindowList::compatibility_iterator node = m_attributeDialog->GetChildren().GetFirst();
while (node) while (node)
{ {
wxWindow* child = (wxWindow*) node->GetData(); wxWindow* child = (wxWindow*) node->GetData();

View File

@@ -198,19 +198,17 @@ void csDiagramView::OnSelectAll(wxCommandEvent& WXUNUSED(event))
wxShape *csDiagramView::FindFirstSelectedShape(void) wxShape *csDiagramView::FindFirstSelectedShape(void)
{ {
csDiagramDocument *doc = (csDiagramDocument *)GetDocument(); csDiagramDocument *doc = (csDiagramDocument *)GetDocument();
wxShape *theShape = NULL;
wxObjectList::compatibility_iterator node = doc->GetDiagram()->GetShapeList()->GetFirst(); wxObjectList::compatibility_iterator node = doc->GetDiagram()->GetShapeList()->GetFirst();
while (node) while (node)
{ {
wxShape *eachShape = (wxShape *)node->GetData(); wxShape *eachShape = (wxShape *)node->GetData();
if ((eachShape->GetParent() == NULL) && !eachShape->IsKindOf(CLASSINFO(wxLabelShape)) && eachShape->Selected()) if ((eachShape->GetParent() == NULL) && !eachShape->IsKindOf(CLASSINFO(wxLabelShape)) && eachShape->Selected())
{ {
theShape = eachShape; return eachShape;
node = NULL;
} }
else node = node->GetNext(); else node = node->GetNext();
} }
return theShape; return NULL;
} }
void csDiagramView::FindSelectedShapes(wxList& selections, wxClassInfo* toFind) void csDiagramView::FindSelectedShapes(wxList& selections, wxClassInfo* toFind)
@@ -579,7 +577,7 @@ void csDiagramView::OnToggleArrowTool(wxCommandEvent& WXUNUSED(event))
{ {
csDiagramCommand* cmd = new csDiagramCommand(stateName, doc); csDiagramCommand* cmd = new csDiagramCommand(stateName, doc);
wxNode* node = selections.GetFirst(); wxObjectList::compatibility_iterator node = selections.GetFirst();
while (node) while (node)
{ {
wxLineShape *theShape = (wxLineShape*) node->GetData(); wxLineShape *theShape = (wxLineShape*) node->GetData();
@@ -634,7 +632,7 @@ void csDiagramView::ReflectPointSize(int pointSize)
void csDiagramView::ReflectArrowState(wxLineShape* lineShape) void csDiagramView::ReflectArrowState(wxLineShape* lineShape)
{ {
bool haveArrow = false; bool haveArrow = false;
wxNode *node = lineShape->GetArrows().GetFirst(); wxObjectList::compatibility_iterator node = lineShape->GetArrows().GetFirst();
while (node) while (node)
{ {
wxArrowHead *arrow = (wxArrowHead *)node->GetData(); wxArrowHead *arrow = (wxArrowHead *)node->GetData();
@@ -651,7 +649,7 @@ void csDiagramView::OnAlign(wxCommandEvent& event)
// Make a copy of the selections, keeping only those shapes // Make a copy of the selections, keeping only those shapes
// that are top-level non-line shapes. // that are top-level non-line shapes.
wxList selections; wxList selections;
wxNode* node = GetSelectionList().GetFirst(); wxObjectList::compatibility_iterator node = GetSelectionList().GetFirst();
while (node) while (node)
{ {
wxShape* shape = (wxShape*) node->GetData(); wxShape* shape = (wxShape*) node->GetData();
@@ -751,7 +749,7 @@ void csDiagramView::OnNewLinePoint(wxCommandEvent& WXUNUSED(event))
csDiagramDocument *doc = (csDiagramDocument *)GetDocument(); csDiagramDocument *doc = (csDiagramDocument *)GetDocument();
csDiagramCommand* cmd = new csDiagramCommand(_T("New line point"), doc); csDiagramCommand* cmd = new csDiagramCommand(_T("New line point"), doc);
wxNode* node = m_selections.GetFirst(); wxObjectList::compatibility_iterator node = m_selections.GetFirst();
while (node) while (node)
{ {
wxShape* shape = (wxShape*) node->GetData(); wxShape* shape = (wxShape*) node->GetData();
@@ -772,7 +770,7 @@ void csDiagramView::OnCutLinePoint(wxCommandEvent& WXUNUSED(event))
csDiagramDocument *doc = (csDiagramDocument *)GetDocument(); csDiagramDocument *doc = (csDiagramDocument *)GetDocument();
csDiagramCommand* cmd = new csDiagramCommand(_T("Cut line point"), doc); csDiagramCommand* cmd = new csDiagramCommand(_T("Cut line point"), doc);
wxNode* node = m_selections.GetFirst(); wxObjectList::compatibility_iterator node = m_selections.GetFirst();
while (node) while (node)
{ {
wxShape* shape = (wxShape*) node->GetData(); wxShape* shape = (wxShape*) node->GetData();
@@ -793,7 +791,7 @@ void csDiagramView::OnStraightenLines(wxCommandEvent& WXUNUSED(event))
csDiagramDocument *doc = (csDiagramDocument *)GetDocument(); csDiagramDocument *doc = (csDiagramDocument *)GetDocument();
csDiagramCommand* cmd = new csDiagramCommand(_T("Straighten lines"), doc); csDiagramCommand* cmd = new csDiagramCommand(_T("Straighten lines"), doc);
wxNode* node = m_selections.GetFirst(); wxObjectList::compatibility_iterator node = m_selections.GetFirst();
while (node) while (node)
{ {
wxShape* shape = (wxShape*) node->GetData(); 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); min_y = wxMin(y, sg_initialY);
max_y = wxMax(y, sg_initialY); max_y = wxMax(y, sg_initialY);
wxNode *node = GetDiagram()->GetShapeList()->GetFirst(); wxObjectList::compatibility_iterator node = GetDiagram()->GetShapeList()->GetFirst();
while (node) while (node)
{ {
wxShape *shape = (wxShape *)node->GetData(); wxShape *shape = (wxShape *)node->GetData();

View File

@@ -208,7 +208,7 @@ void wxFrameManager::EnableMenusForView( wxFrameView* pView, bool enable )
if ( !pMenuBar ) if ( !pMenuBar )
return; return;
wxStringListNode* pNode = pView->mTopMenus.GetFirst(); wxStringList::compatibility_iterator pNode = pView->mTopMenus.GetFirst();
int i; int i;
while ( pNode ) while ( pNode )

View File

@@ -50,7 +50,7 @@ wxList *wxSoundHandleList = NULL;
static inline wxSoundStreamWin *wxFindSoundFromHandle(WXHWND hWnd) static inline wxSoundStreamWin *wxFindSoundFromHandle(WXHWND hWnd)
{ {
wxNode *node = wxSoundHandleList->Find((long)hWnd); wxObjectList::compatibility_iterator node = wxSoundHandleList->Find((long)hWnd);
if (!node) if (!node)
return NULL; return NULL;
return (wxSoundStreamWin *)node->GetData(); return (wxSoundStreamWin *)node->GetData();

View File

@@ -1819,9 +1819,9 @@ void wxShapeRegion::ClearText()
while (node) while (node)
{ {
wxShapeTextLine *line = (wxShapeTextLine *)node->GetData(); wxShapeTextLine *line = (wxShapeTextLine *)node->GetData();
wxNode *next = node->GetNext(); wxObjectList::compatibility_iterator next = node->GetNext();
delete line; delete line;
delete node; m_formattedText.Erase(node);
node = next; node = next;
} }
} }

View File

@@ -393,7 +393,7 @@ wxShape *wxShapeCanvas::FindShape(double x, double y, int *attachment, wxClassIn
// the other objects // the other objects
// (b) to find the control points FIRST if they exist // (b) to find the control points FIRST if they exist
wxNode *current = GetDiagram()->GetShapeList()->GetLast(); wxObjectList::compatibility_iterator current = GetDiagram()->GetShapeList()->GetLast();
while (current) while (current)
{ {
wxShape *object = (wxShape *)current->GetData(); wxShape *object = (wxShape *)current->GetData();
@@ -451,7 +451,7 @@ wxShape *wxShapeCanvas::FindShape(double x, double y, int *attachment, wxClassIn
{ {
nearest_object = object; nearest_object = object;
nearest_attachment = temp_attachment; nearest_attachment = temp_attachment;
current = NULL; current = GetDiagram()->GetShapeList()->GetFirst()->GetPrevious(); // finish loop
} }
} }
} }

View File

@@ -102,7 +102,7 @@ void wxDividedShape::OnDrawContents(wxDC& dc)
double yMargin = 2; double yMargin = 2;
dc.SetBackgroundMode(wxTRANSPARENT); dc.SetBackgroundMode(wxTRANSPARENT);
wxNode *node = GetRegions().GetFirst(); wxObjectList::compatibility_iterator node = GetRegions().GetFirst();
while (node) while (node)
{ {
wxShapeRegion *region = (wxShapeRegion *)node->GetData(); wxShapeRegion *region = (wxShapeRegion *)node->GetData();
@@ -157,7 +157,7 @@ void wxDividedShape::SetRegionSizes()
// double leftX = (double)(m_xpos - (m_width / 2.0)); // double leftX = (double)(m_xpos - (m_width / 2.0));
// double rightX = (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) while (node)
{ {
wxShapeRegion *region = (wxShapeRegion *)node->GetData(); wxShapeRegion *region = (wxShapeRegion *)node->GetData();
@@ -245,7 +245,7 @@ bool wxDividedShape::GetAttachmentPosition(int attachment, double *x, double *y,
{ {
bool isLeft = !(attachment < (n+1)); bool isLeft = !(attachment < (n+1));
int i = (isLeft) ? (totalNumberAttachments - attachment - 1) : (attachment-1); int i = (isLeft) ? (totalNumberAttachments - attachment - 1) : (attachment-1);
wxNode *node = GetRegions().Item(i); wxObjectList::compatibility_iterator node = GetRegions().Item(i);
if (node) if (node)
{ {
wxShapeRegion *region = (wxShapeRegion *)node->GetData(); wxShapeRegion *region = (wxShapeRegion *)node->GetData();
@@ -298,7 +298,7 @@ int wxDividedShape::GetNumberOfAttachments() const
int n = (GetRegions().GetCount() * 2) + 2; int n = (GetRegions().GetCount() * 2) + 2;
int maxN = n - 1; int maxN = n - 1;
wxNode *node = m_attachmentPoints.GetFirst(); wxObjectList::compatibility_iterator node = m_attachmentPoints.GetFirst();
while (node) while (node)
{ {
wxAttachmentPoint *point = (wxAttachmentPoint *)node->GetData(); wxAttachmentPoint *point = (wxAttachmentPoint *)node->GetData();
@@ -341,7 +341,7 @@ void wxDividedShape::MakeMandatoryControlPoints()
double currentY = (double)(GetY() - (m_height / 2.0)); double currentY = (double)(GetY() - (m_height / 2.0));
double maxY = (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; int i = 0;
while (node) while (node)
{ {
@@ -379,14 +379,14 @@ void wxDividedShape::ResetMandatoryControlPoints()
double currentY = (double)(GetY() - (m_height / 2.0)); double currentY = (double)(GetY() - (m_height / 2.0));
double maxY = (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; int i = 0;
while (node) while (node)
{ {
wxControlPoint *controlPoint = (wxControlPoint *)node->GetData(); wxControlPoint *controlPoint = (wxControlPoint *)node->GetData();
if (controlPoint->IsKindOf(CLASSINFO(wxDividedShapeControlPoint))) if (controlPoint->IsKindOf(CLASSINFO(wxDividedShapeControlPoint)))
{ {
wxNode *node1 = GetRegions().Item(i); wxObjectList::compatibility_iterator node1 = GetRegions().Item(i);
wxShapeRegion *region = (wxShapeRegion *)node1->GetData(); wxShapeRegion *region = (wxShapeRegion *)node1->GetData();
double proportion = region->m_regionProportionY; double proportion = region->m_regionProportionY;
@@ -622,7 +622,7 @@ void wxDividedShapeControlPoint::OnEndDragLeft(double WXUNUSED(x), double y, int
GetCanvas()->PrepareDC(dc); GetCanvas()->PrepareDC(dc);
wxDividedShape *dividedObject = (wxDividedShape *)m_shape; wxDividedShape *dividedObject = (wxDividedShape *)m_shape;
wxNode *node = dividedObject->GetRegions().Item(regionId); wxObjectList::compatibility_iterator node = dividedObject->GetRegions().Item(regionId);
if (!node) if (!node)
return; return;
@@ -642,10 +642,6 @@ void wxDividedShapeControlPoint::OnEndDragLeft(double WXUNUSED(x), double y, int
// Save values // Save values
double thisRegionTop = 0.0; double thisRegionTop = 0.0;
#if 0
// this variable is not readed later
double thisRegionBottom = 0.0;
#endif
double nextRegionBottom = 0.0; double nextRegionBottom = 0.0;
node = dividedObject->GetRegions().GetFirst(); node = dividedObject->GetRegions().GetFirst();
@@ -660,10 +656,6 @@ void wxDividedShapeControlPoint::OnEndDragLeft(double WXUNUSED(x), double y, int
if (region == thisRegion) if (region == thisRegion)
{ {
thisRegionTop = currentY; thisRegionTop = currentY;
#if 0
// no need for assignment if value is not used later
thisRegionBottom = actualY;
#endif
if (node->GetNext()) if (node->GetNext())
nextRegion = (wxShapeRegion *)node->GetNext()->GetData(); nextRegion = (wxShapeRegion *)node->GetNext()->GetData();
} }

View File

@@ -728,13 +728,13 @@ bool wxXMetaFile::ReadFile(const wxChar *file)
wxXMetaFile::~wxXMetaFile(void) wxXMetaFile::~wxXMetaFile(void)
{ {
wxNode *node = metaRecords.GetFirst(); wxObjectList::compatibility_iterator node = metaRecords.GetFirst();
while (node) while (node)
{ {
wxMetaRecord *rec = (wxMetaRecord *)node->GetData(); wxMetaRecord *rec = (wxMetaRecord *)node->GetData();
delete rec; delete rec;
wxNode *next = node->GetNext(); wxObjectList::compatibility_iterator next = node->GetNext();
delete node; metaRecords.Erase(node);
node = next; node = next;
} }
} }
@@ -746,7 +746,7 @@ bool wxXMetaFile::SetClipboard(int WXUNUSED(width), int WXUNUSED(height))
bool wxXMetaFile::Play(wxDC *dc) bool wxXMetaFile::Play(wxDC *dc)
{ {
wxNode *node = metaRecords.GetFirst(); wxObjectList::compatibility_iterator node = metaRecords.GetFirst();
while (node) while (node)
{ {
wxMetaRecord *rec = (wxMetaRecord *)node->GetData(); wxMetaRecord *rec = (wxMetaRecord *)node->GetData();

View File

@@ -220,7 +220,7 @@ void oglCentreText(wxDC& dc, wxList *text_list,
// Store text extents for speed // Store text extents for speed
double *widths = new double[n]; double *widths = new double[n];
wxNode *current = text_list->GetFirst(); wxObjectList::compatibility_iterator current = text_list->GetFirst();
int i = 0; int i = 0;
while (current) while (current)
{ {
@@ -303,7 +303,7 @@ void oglCentreTextNoClipping(wxDC& dc, wxList *text_list,
// Store text extents for speed // Store text extents for speed
double *widths = new double[n]; double *widths = new double[n];
wxNode *current = text_list->GetFirst(); wxObjectList::compatibility_iterator current = text_list->GetFirst();
int i = 0; int i = 0;
while (current) while (current)
{ {
@@ -359,7 +359,7 @@ void oglGetCentredTextExtent(wxDC& dc, wxList *text_list,
long max_width = 0; long max_width = 0;
long current_width = 0; long current_width = 0;
wxNode *current = text_list->GetFirst(); wxObjectList::compatibility_iterator current = text_list->GetFirst();
while (current) while (current)
{ {
wxShapeTextLine *line = (wxShapeTextLine *)current->GetData(); wxShapeTextLine *line = (wxShapeTextLine *)current->GetData();
@@ -444,15 +444,15 @@ wxStringList *oglFormatText(wxDC& dc, const wxString& text, double width, double
wxStringList *string_list = new wxStringList; wxStringList *string_list = new wxStringList;
wxString buffer; wxString buffer;
wxStringListNode *node = word_list.GetFirst(); wxStringList::compatibility_iterator node = word_list.GetFirst();
long x, y; long x, y;
while (node) while (node)
{ {
wxString oldBuffer(buffer); wxString oldBuffer(buffer);
wxChar *s = (wxChar *)node->GetData(); wxString s = node->GetData();
if (!s) if (s.IsEmpty())
{ {
// FORCE NEW LINE // FORCE NEW LINE
if (buffer.Length() > 0) 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)(m_xpos - width/2.0), (long)(m_ypos - height/2.0),
(long)width+1, (long)height+1); // +1 to allow for rounding errors (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) while (current)
{ {
wxShapeTextLine *line = (wxShapeTextLine *)current->GetData(); wxShapeTextLine *line = (wxShapeTextLine *)current->GetData();
@@ -529,7 +529,7 @@ void oglFindPolylineCentroid(wxList *points, double *x, double *y)
double xcount = 0; double xcount = 0;
double ycount = 0; double ycount = 0;
wxNode *node = points->GetFirst(); wxObjectList::compatibility_iterator node = points->GetFirst();
while (node) while (node)
{ {
wxRealPoint *point = (wxRealPoint *)node->GetData(); wxRealPoint *point = (wxRealPoint *)node->GetData();
@@ -807,7 +807,7 @@ void UpdateListBox(wxListBox *item, wxList *list)
if (!list) if (!list)
return; return;
wxNode *node = list->GetFirst(); wxObjectList::compatibility_iterator node = list->GetFirst();
while (node) while (node)
{ {
wxChar *s = (wxChar *)node->GetData(); wxChar *s = (wxChar *)node->GetData();