Warning fixes and deprecated method elimination from ABX.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24494 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Mattia Barbon
2003-11-09 21:40:34 +00:00
parent 6937991694
commit 8552e6f031
42 changed files with 370 additions and 416 deletions

View File

@@ -70,10 +70,10 @@ bool wxDiagramClipboard::DoCopy(wxDiagram* diagramFrom, wxDiagram* diagramTo, bo
// First copy all node shapes.
wxList* shapeList = diagramFrom->GetShapeList();
wxNode* node = shapeList->First();
wxNode* node = shapeList->GetFirst();
while (node)
{
wxShape* shape = (wxShape*) node->Data();
wxShape* shape = (wxShape*) node->GetData();
if (((diagramFrom == this) || shape->Selected()) && !shape->IsKindOf(CLASSINFO(wxLineShape)))
{
wxShape* newShape = shape->CreateNewCopy();
@@ -90,13 +90,13 @@ bool wxDiagramClipboard::DoCopy(wxDiagram* diagramFrom, wxDiagram* diagramTo, bo
OnAddShape(diagramTo, newShape, dc);
}
node = node->Next();
node = node->GetNext();
}
node = shapeList->First();
node = shapeList->GetFirst();
while (node)
{
wxShape* shape = (wxShape*) node->Data();
wxShape* shape = (wxShape*) node->GetData();
if (((diagramFrom == this) || shape->Selected()) && shape->IsKindOf(CLASSINFO(wxLineShape)))
{
wxLineShape* lineShape = (wxLineShape*) shape;
@@ -122,14 +122,14 @@ bool wxDiagramClipboard::DoCopy(wxDiagram* diagramFrom, wxDiagram* diagramTo, bo
}
}
node = node->Next();
node = node->GetNext();
}
// Now make sure line ordering is correct
node = shapeList->First();
node = shapeList->GetFirst();
while (node)
{
wxShape* shape = (wxShape*) node->Data();
wxShape* shape = (wxShape*) node->GetData();
if (((diagramFrom == this) || shape->Selected()) && !shape->IsKindOf(CLASSINFO(wxLineShape)))
{
wxShape* newShape = (wxShape*) mapping.Get((long) shape);
@@ -137,10 +137,10 @@ 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().First();
wxNode* lineNode = shape->GetLines().GetFirst();
while (lineNode)
{
wxLineShape* lineShape = (wxLineShape*) lineNode->Data();
wxLineShape* lineShape = (wxLineShape*) lineNode->GetData();
if ((diagramFrom == this) || (lineShape->GetTo()->Selected() && lineShape->GetFrom()->Selected()))
{
wxLineShape* newLineShape = (wxLineShape*) mapping.Get((long) lineShape);
@@ -150,13 +150,13 @@ bool wxDiagramClipboard::DoCopy(wxDiagram* diagramFrom, wxDiagram* diagramTo, bo
newLines.Append(newLineShape);
}
lineNode = lineNode->Next();
lineNode = lineNode->GetNext();
}
if (newLines.Number() > 0)
if (newLines.GetCount() > 0)
newShape->ApplyAttachmentOrdering(newLines);
}
node = node->Next();
node = node->GetNext();
}
OnEndCopy(diagramTo);
@@ -284,7 +284,7 @@ bool csDiagramClipboard::OnEndCopy(wxDiagram* diagramTo)
if (m_currentCmd)
{
if (m_currentCmd->GetStates().Number() == 0)
if (m_currentCmd->GetStates().GetCount() == 0)
{
delete m_currentCmd;
}

View File

@@ -100,13 +100,19 @@ csSettingsDialog::csSettingsDialog(wxWindow* parent):
m_generalSettings = new wxPanel;
bool success = wxLoadFromResource(m_generalSettings, m_notebook, _T("general_settings_dialog"));
#ifdef __WXDEBUG__
bool success =
#endif
wxLoadFromResource(m_generalSettings, m_notebook, _T("general_settings_dialog"));
wxASSERT_MSG( (success), _T("Could not load general settings panel."));
m_notebook->AddPage(m_generalSettings, _T("General"), TRUE);
m_diagramSettings = new wxPanel;
success = wxLoadFromResource(m_diagramSettings, m_notebook, _T("diagram_settings_dialog"));
#ifdef __WXDEBUG__
success =
#endif
wxLoadFromResource(m_diagramSettings, m_notebook, _T("diagram_settings_dialog"));
wxASSERT_MSG( (success), _T("Could not load diagram settings panel."));
m_notebook->AddPage(m_diagramSettings, _T("Diagram"));
@@ -199,10 +205,10 @@ bool csSettingsDialog::TransferDataFromWindow()
}
// Apply settings to all open diagram documents
wxNode* node = wxGetApp().GetDocManager()->GetDocuments().First();
wxNode* node = wxGetApp().GetDocManager()->GetDocuments().GetFirst();
while (node)
{
wxDocument* doc = (wxDocument*) node->Data();
wxDocument* doc = (wxDocument*) node->GetData();
if (doc->IsKindOf(CLASSINFO(csDiagramDocument)))
{
csDiagramDocument* diagramDoc = (csDiagramDocument*) doc;
@@ -228,7 +234,7 @@ bool csSettingsDialog::TransferDataFromWindow()
}
}
}
node = node->Next();
node = node->GetNext();
}
return TRUE;
@@ -262,12 +268,14 @@ csShapePropertiesDialog::csShapePropertiesDialog(wxWindow* parent, const wxStrin
wxPoint(2, 2), wxSize(SHAPE_PROPERTY_DIALOG_WIDTH - 4, SHAPE_PROPERTY_DIALOG_HEIGHT - 4));
m_generalPropertiesDialog = new csGeneralShapePropertiesDialog;
bool success = wxLoadFromResource(m_generalPropertiesDialog, m_notebook, _T("general_shape_properties_dialog"));
#ifdef __WXDEBUG__
bool success =
#endif
wxLoadFromResource(m_generalPropertiesDialog, m_notebook, _T("general_shape_properties_dialog"));
wxASSERT_MSG( (success), _T("Could not load general properties panel."));
m_notebook->AddPage(m_generalPropertiesDialog, _T("General"));
success = wxLoadFromResource(m_attributeDialog, m_notebook, attributeDialogName);
if (!success)
if (!wxLoadFromResource(m_attributeDialog, m_notebook, attributeDialogName))
{
wxMessageBox(_T("Could not load the attribute dialog for this shape."), _T("Studio"), wxICON_EXCLAMATION);
delete m_attributeDialog;
@@ -282,8 +290,7 @@ csShapePropertiesDialog::csShapePropertiesDialog(wxWindow* parent, const wxStrin
wxString str(attributeDialogName);
str += _T("1");
m_alternativeAttributeDialog = new wxPanel;
success = wxLoadFromResource(m_alternativeAttributeDialog, m_notebook, str);
if (success)
if (wxLoadFromResource(m_alternativeAttributeDialog, m_notebook, str))
{
m_notebook->AddPage(m_alternativeAttributeDialog, _T("Attributes (alternative)"));
}
@@ -358,31 +365,31 @@ void csShapePropertiesDialog::SetDefaults()
if (!m_attributeDialog)
return;
wxNode* node = m_attributeDialog->GetChildren().First();
wxWindowListNode* node = m_attributeDialog->GetChildren().GetFirst();
while (node)
{
wxWindow* child = (wxWindow*) node->Data();
wxWindow* child = (wxWindow*) node->GetData();
if (child->IsKindOf(CLASSINFO(wxChoice)))
{
wxChoice* choice = (wxChoice*) child;
choice->SetSelection(0);
}
node = node->Next();
node = node->GetNext();
}
if (!m_alternativeAttributeDialog)
return;
node = m_alternativeAttributeDialog->GetChildren().First();
node = m_alternativeAttributeDialog->GetChildren().GetFirst();
while (node)
{
wxWindow* child = (wxWindow*) node->Data();
wxWindow* child = (wxWindow*) node->GetData();
if (child->IsKindOf(CLASSINFO(wxChoice)))
{
wxChoice* choice = (wxChoice*) child;
choice->SetSelection(0);
}
node = node->Next();
node = node->GetNext();
}
}

View File

@@ -120,12 +120,12 @@ csDiagramCommand::csDiagramCommand(const wxString& name, csDiagramDocument *doc,
csDiagramCommand::~csDiagramCommand()
{
wxNode* node = m_states.First();
wxNode* node = m_states.GetFirst();
while (node)
{
csCommandState* state = (csCommandState*) node->Data();
csCommandState* state = (csCommandState*) node->GetData();
delete state;
node = node->Next();
node = node->GetNext();
}
}
@@ -147,51 +147,51 @@ void csDiagramCommand::InsertState(csCommandState* state)
// Schedule all lines connected to the states to be cut.
void csDiagramCommand::RemoveLines()
{
wxNode* node = m_states.First();
wxNode* node = m_states.GetFirst();
while (node)
{
csCommandState* state = (csCommandState*) node->Data();
csCommandState* state = (csCommandState*) node->GetData();
wxShape* shape = state->GetShapeOnCanvas();
wxASSERT( (shape != NULL) );
wxNode *node1 = shape->GetLines().First();
wxNode *node1 = shape->GetLines().GetFirst();
while (node1)
{
wxLineShape *line = (wxLineShape *)node1->Data();
wxLineShape *line = (wxLineShape *)node1->GetData();
if (!FindStateByShape(line))
{
csCommandState* newState = new csCommandState(ID_CS_CUT, NULL, line);
InsertState(newState);
}
node1 = node1->Next();
node1 = node1->GetNext();
}
node = node->Next();
node = node->GetNext();
}
}
csCommandState* csDiagramCommand::FindStateByShape(wxShape* shape)
{
wxNode* node = m_states.First();
wxNode* node = m_states.GetFirst();
while (node)
{
csCommandState* state = (csCommandState*) node->Data();
csCommandState* state = (csCommandState*) node->GetData();
if (shape == state->GetShapeOnCanvas() || shape == state->GetSavedState())
return state;
node = node->Next();
node = node->GetNext();
}
return NULL;
}
bool csDiagramCommand::Do()
{
wxNode* node = m_states.First();
wxNode* node = m_states.GetFirst();
while (node)
{
csCommandState* state = (csCommandState*) node->Data();
csCommandState* state = (csCommandState*) node->GetData();
if (!state->Do())
return FALSE;
node = node->Next();
node = node->GetNext();
}
return TRUE;
}
@@ -200,13 +200,13 @@ bool csDiagramCommand::Undo()
{
// Undo in reverse order, so e.g. shapes get added
// back before the lines do.
wxNode* node = m_states.Last();
wxNode* node = m_states.GetLast();
while (node)
{
csCommandState* state = (csCommandState*) node->Data();
csCommandState* state = (csCommandState*) node->GetData();
if (!state->Undo())
return FALSE;
node = node->Previous();
node = node->GetPrevious();
}
return TRUE;
}
@@ -457,7 +457,7 @@ bool csCommandState::Do()
m_shapeOnCanvas->Show(TRUE);
// Recursively redraw links if we have a composite.
if (m_shapeOnCanvas->GetChildren().Number() > 0)
if (m_shapeOnCanvas->GetChildren().GetCount() > 0)
m_shapeOnCanvas->DrawLinks(dc, -1, TRUE);
m_shapeOnCanvas->GetEventHandler()->OnEndSize(width, height);

View File

@@ -31,7 +31,7 @@ BEGIN_EVENT_TABLE(csProjectTreeCtrl, wxTreeCtrl)
END_EVENT_TABLE()
// Define my frame constructor
csProjectTreeCtrl::csProjectTreeCtrl(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size,
csProjectTreeCtrl::csProjectTreeCtrl(wxWindow *parent, const wxWindowID id, const wxPoint& pos, const wxSize& size,
long style):
wxTreeCtrl(parent, id, pos, size, style),

View File

@@ -199,7 +199,7 @@ void csEvtHandler::OnBeginDragRight(double x, double y, int WXUNUSED(keys), int
dc.SetPen(dottedPen);
double xp, yp;
GetShape()->GetAttachmentPositionEdge(attachment, &xp, &yp);
dc.DrawLine(xp, yp, x, y);
dc.DrawLine((wxCoord)xp, (wxCoord)yp, (wxCoord)x, (wxCoord)y);
GetShape()->GetCanvas()->CaptureMouse();
}
@@ -213,7 +213,7 @@ void csEvtHandler::OnDragRight(bool WXUNUSED(draw), double x, double y, int WXUN
dc.SetPen(dottedPen);
double xp, yp;
GetShape()->GetAttachmentPositionEdge(attachment, &xp, &yp);
dc.DrawLine(xp, yp, x, y);
dc.DrawLine((wxCoord)xp, (wxCoord)yp, (wxCoord)x, (wxCoord)y);
}
void csEvtHandler::OnEndDragRight(double x, double y, int WXUNUSED(keys), int attachment)
@@ -299,16 +299,16 @@ void csEvtHandler::OnDragLeft(bool draw, double x, double y, int keys, int attac
GetShape()->GetEventHandler()->OnDrawOutline(dc, xx, yy, w, h);
// Draw bounding box for other selected shapes
wxNode* node = GetShape()->GetCanvas()->GetDiagram()->GetShapeList()->First();
wxNode* node = GetShape()->GetCanvas()->GetDiagram()->GetShapeList()->GetFirst();
while (node)
{
wxShape* shape = (wxShape*) node->Data();
wxShape* shape = (wxShape*) node->GetData();
if (shape->Selected() && !shape->IsKindOf(CLASSINFO(wxLineShape)) && (shape != GetShape()))
{
shape->GetBoundingBoxMax(&w, &h);
shape->OnDrawOutline(dc, shape->GetX() + offsetX, shape->GetY() + offsetY, w, h);
}
node = node->Next();
node = node->GetNext();
}
}
@@ -358,16 +358,16 @@ void csEvtHandler::OnBeginDragLeft(double x, double y, int keys, int attachment)
GetShape()->GetEventHandler()->OnDrawOutline(dc, xx, yy, w, h);
// Draw bounding box for other selected shapes
wxNode* node = GetShape()->GetCanvas()->GetDiagram()->GetShapeList()->First();
wxNode* node = GetShape()->GetCanvas()->GetDiagram()->GetShapeList()->GetFirst();
while (node)
{
wxShape* shape = (wxShape*) node->Data();
wxShape* shape = (wxShape*) node->GetData();
if (shape->Selected() && !shape->IsKindOf(CLASSINFO(wxLineShape)) && (shape != GetShape()))
{
shape->GetBoundingBoxMax(&w, &h);
shape->OnDrawOutline(dc, shape->GetX() + offsetX, shape->GetY() + offsetY, w, h);
}
node = node->Next();
node = node->GetNext();
}
GetShape()->GetCanvas()->CaptureMouse();
@@ -413,40 +413,40 @@ void csEvtHandler::OnEndDragLeft(double x, double y, int keys, int attachment)
new csCommandState(ID_CS_MOVE, newShape, GetShape()));
// Move line points
wxNode* node = GetShape()->GetCanvas()->GetDiagram()->GetShapeList()->First();
wxNode* node = GetShape()->GetCanvas()->GetDiagram()->GetShapeList()->GetFirst();
while (node)
{
wxShape* shape = (wxShape*) node->Data();
wxShape* shape = (wxShape*) node->GetData();
// Only move the line point(s) if both ends move too
if (shape->IsKindOf(CLASSINFO(wxLineShape)) &&
((wxLineShape*)shape)->GetTo()->Selected() && ((wxLineShape*)shape)->GetFrom()->Selected())
{
wxLineShape* lineShape = (wxLineShape*) shape;
if (lineShape->GetLineControlPoints()->Number() > 2)
if (lineShape->GetLineControlPoints()->GetCount() > 2)
{
wxLineShape* newLineShape = (wxLineShape*) lineShape->CreateNewCopy();
wxNode *node1 = newLineShape->GetLineControlPoints()->First();
wxNode *node1 = newLineShape->GetLineControlPoints()->GetFirst();
while (node1)
{
wxRealPoint *point = (wxRealPoint *)node1->Data();
wxRealPoint *point = (wxRealPoint *)node1->GetData();
point->x += offsetX;
point->y += offsetY;
node1 = node1->Next();
node1 = node1->GetNext();
}
cmd->AddState(new csCommandState(ID_CS_MOVE_LINE_POINT, newLineShape, lineShape));
lineShape->Erase(dc);
}
}
node = node->Next();
node = node->GetNext();
}
// Add other selected node shapes, if any
node = GetShape()->GetCanvas()->GetDiagram()->GetShapeList()->First();
node = GetShape()->GetCanvas()->GetDiagram()->GetShapeList()->GetFirst();
while (node)
{
wxShape* shape = (wxShape*) node->Data();
wxShape* shape = (wxShape*) node->GetData();
if (shape->Selected() && !shape->IsKindOf(CLASSINFO(wxLineShape)) && (shape != GetShape()))
{
wxShape* newShape2 = shape->CreateNewCopy();
@@ -454,7 +454,7 @@ void csEvtHandler::OnEndDragLeft(double x, double y, int keys, int attachment)
newShape2->SetY(shape->GetY() + offsetY);
cmd->AddState(new csCommandState(ID_CS_MOVE, newShape2, shape));
}
node = node->Next();
node = node->GetNext();
}
canvas->GetView()->GetDocument()->GetCommandProcessor()->Submit(cmd);
@@ -736,7 +736,7 @@ csThinRectangleShape::csThinRectangleShape()
double w = csSTANDARD_SHAPE_WIDTH/2;
double h = csSTANDARD_SHAPE_WIDTH;
DrawRectangle(wxRect(- w/2, - h/2, w, h));
DrawRectangle(wxRect((int)(- w/2), (int)(- h/2), (int)(w), (int)(h)));
CalculateSize();
SetAttachmentMode(ATTACHMENT_MODE_BRANCHING);
@@ -755,7 +755,7 @@ csWideRectangleShape::csWideRectangleShape()
double w = csSTANDARD_SHAPE_WIDTH;
double h = w/2.0;
DrawRoundedRectangle(wxRect(- w/2, - h/2, w, h), -0.3);
DrawRoundedRectangle(wxRect((int)(- w/2), (int)(- h/2), (int)(w), (int)(h)), -0.3);
CalculateSize();
SetAttachmentMode(ATTACHMENT_MODE_BRANCHING);
@@ -778,9 +778,9 @@ csTriangleShape::csTriangleShape()
wxPoint* points = new wxPoint[3];
points[0] = wxPoint( 0 , - h / 2 );
points[1] = wxPoint( w / 2 , h / 2 );
points[2] = wxPoint( -w / 2, h / 2 );
points[0] = wxPoint( 0 , (int)(- h / 2) );
points[1] = wxPoint( (int)(w / 2) , (int)(h / 2) );
points[2] = wxPoint( (int)(-w / 2), (int)(h / 2) );
DrawPolygon(3, points, oglMETAFLAGS_OUTLINE);
@@ -834,14 +834,14 @@ csSemiCircleShape::csSemiCircleShape()
// bounding box, since we can't calculate the bounding box for
// an arbitrary arc (not implemented)
DrawRectangle(wxRect(-w/2.0, -h/2.0, w, h));
DrawRectangle(wxRect((int)(-w/2.0), (int)(-h/2.0), (int)(w), (int)(h)));
SetDrawnPen(wxBLACK_PEN);
wxBrush* brush = wxTheBrushList->FindOrCreateBrush(wxColour(220, 220, 220), wxSOLID);
SetDrawnBrush(brush);
DrawEllipticArc(wxRect(-w/2, -h/2, w, 2*h), 0.0, 180.0);
DrawLine(wxPoint(-w/2, h/2), wxPoint(w/2, h/2));
DrawEllipticArc(wxRect((int)(-w/2), (int)(-h/2), (int)(w), (int)(2*h)), 0.0, 180.0);
DrawLine(wxPoint((int)(-w/2), (int)(h/2)), wxPoint((int)(w/2), (int)(h/2)));
CalculateSize();
@@ -855,13 +855,13 @@ csSemiCircleShape::csSemiCircleShape()
SetDrawnPen(wxTRANSPARENT_PEN);
SetDrawnBrush(wxTRANSPARENT_BRUSH);
DrawRectangle(wxRect(-w/2, -h/2, w, h));
DrawRectangle(wxRect((int)(-w/2), (int)(-h/2), (int)(w), (int)(h)));
SetDrawnPen(wxBLACK_PEN);
SetDrawnBrush(brush);
DrawEllipticArc(wxRect(-w/2 - w, -h/2, 2*w, h), 270.0, 90.0);
DrawLine(wxPoint(-w/2, -h/2), wxPoint(-w/2, h/2));
DrawEllipticArc(wxRect((int)(-w/2 - w), (int)(-h/2), (int)(2*w), (int)(h)), 270.0, 90.0);
DrawLine(wxPoint((int)(-w/2), (int)(-h/2)), wxPoint((int)(-w/2), (int)(h/2)));
CalculateSize();
@@ -875,13 +875,13 @@ csSemiCircleShape::csSemiCircleShape()
SetDrawnPen(wxTRANSPARENT_PEN);
SetDrawnBrush(wxTRANSPARENT_BRUSH);
DrawRectangle(wxRect(-w/2, -h/2, w, h));
DrawRectangle(wxRect((int)(-w/2), (int)(-h/2), (int)(w), (int)(h)));
SetDrawnPen(wxBLACK_PEN);
SetDrawnBrush(brush);
DrawEllipticArc(wxRect(-w/2, -h/2 - h, w, 2*h), 180.0, 0.0);
DrawLine(wxPoint(-w/2, -h/2), wxPoint(w/2, -h/2));
DrawEllipticArc(wxRect((int)(-w/2), (int)(-h/2 - h), (int)(w), (int)(2*h)), 180.0, 0.0);
DrawLine(wxPoint((int)(-w/2), (int)(-h/2)), wxPoint((int)(w/2), (int)(-h/2)));
CalculateSize();
@@ -895,13 +895,13 @@ csSemiCircleShape::csSemiCircleShape()
SetDrawnPen(wxTRANSPARENT_PEN);
SetDrawnBrush(wxTRANSPARENT_BRUSH);
DrawRectangle(wxRect(-w/2, -h/2, w, h));
DrawRectangle(wxRect((int)(-w/2), (int)(-h/2), (int)(w), (int)(h)));
SetDrawnPen(wxBLACK_PEN);
SetDrawnBrush(brush);
DrawEllipticArc(wxRect(-w/2, -h/2, 2*w, h), 90.0, 270.0);
DrawLine(wxPoint(w/2, -h/2), wxPoint(w/2, h/2));
DrawEllipticArc(wxRect((int)(-w/2), (int)(-h/2), (int)(2*w), (int)(h)), 90.0, 270.0);
DrawLine(wxPoint((int)(w/2),(int)(-h/2)), wxPoint((int)(w/2), (int)(h/2)));
CalculateSize();

View File

@@ -244,9 +244,7 @@ wxMDIChildFrame *csApp::CreateChildFrame(wxDocument *doc, wxView *view, wxMenu**
fileMenu->AppendSeparator();
fileMenu->Append(wxID_EXIT, _T("E&xit"));
wxMenu *editMenu = NULL;
editMenu = new wxMenu;
wxMenu* editMenu = new wxMenu;
editMenu->Append(wxID_UNDO, _T("&Undo\tCtrl+Z"));
editMenu->Append(wxID_REDO, _T("&Redo\tCtrl+Y"));
editMenu->AppendSeparator();

View File

@@ -74,41 +74,41 @@ void csSymbolDatabase::AddSymbol(csSymbol* symbol)
void csSymbolDatabase::ClearSymbols()
{
wxNode* node = m_symbols.First();
wxNode* node = m_symbols.GetFirst();
while (node)
{
csSymbol* symbol = (csSymbol*) node->Data();
csSymbol* symbol = (csSymbol*) node->GetData();
delete symbol;
node = node->Next();
node = node->GetNext();
}
m_symbols.Clear();
}
csSymbol* csSymbolDatabase::FindSymbol(const wxString& name) const
{
wxNode* node = m_symbols.First();
wxNode* node = m_symbols.GetFirst();
while (node)
{
csSymbol* symbol = (csSymbol*) node->Data();
csSymbol* symbol = (csSymbol*) node->GetData();
if (symbol->GetName() == name)
return symbol;
node = node->Next();
node = node->GetNext();
}
return NULL;
}
csSymbol* csSymbolDatabase::FindSymbol(int toolId) const
{
wxNode* node = m_symbols.First();
wxNode* node = m_symbols.GetFirst();
while (node)
{
csSymbol* symbol = (csSymbol*) node->Data();
csSymbol* symbol = (csSymbol*) node->GetData();
if (symbol->GetToolId() == toolId)
return symbol;
node = node->Next();
node = node->GetNext();
}
return NULL;
}

View File

@@ -199,16 +199,16 @@ wxShape *csDiagramView::FindFirstSelectedShape(void)
{
csDiagramDocument *doc = (csDiagramDocument *)GetDocument();
wxShape *theShape = NULL;
wxNode *node = doc->GetDiagram()->GetShapeList()->First();
wxNode *node = doc->GetDiagram()->GetShapeList()->GetFirst();
while (node)
{
wxShape *eachShape = (wxShape *)node->Data();
wxShape *eachShape = (wxShape *)node->GetData();
if ((eachShape->GetParent() == NULL) && !eachShape->IsKindOf(CLASSINFO(wxLabelShape)) && eachShape->Selected())
{
theShape = eachShape;
node = NULL;
}
else node = node->Next();
else node = node->GetNext();
}
return theShape;
}
@@ -216,15 +216,15 @@ wxShape *csDiagramView::FindFirstSelectedShape(void)
void csDiagramView::FindSelectedShapes(wxList& selections, wxClassInfo* toFind)
{
csDiagramDocument *doc = (csDiagramDocument *)GetDocument();
wxNode *node = doc->GetDiagram()->GetShapeList()->First();
wxNode *node = doc->GetDiagram()->GetShapeList()->GetFirst();
while (node)
{
wxShape *eachShape = (wxShape *)node->Data();
wxShape *eachShape = (wxShape *)node->GetData();
if ((eachShape->GetParent() == NULL) && !eachShape->IsKindOf(CLASSINFO(wxLabelShape)) && eachShape->Selected() && ((toFind == NULL) || (eachShape->IsKindOf(toFind))))
{
selections.Append(eachShape);
}
node = node->Next();
node = node->GetNext();
}
}
@@ -296,17 +296,17 @@ void csDiagramView::OnDuplicate(wxCommandEvent& WXUNUSED(event))
void csDiagramView::OnCutUpdate(wxUpdateUIEvent& event)
{
event.Enable( (m_selections.Number() > 0) );
event.Enable( (m_selections.GetCount() > 0) );
}
void csDiagramView::OnClearUpdate(wxUpdateUIEvent& event)
{
event.Enable( (m_selections.Number() > 0) );
event.Enable( (m_selections.GetCount() > 0) );
}
void csDiagramView::OnCopyUpdate(wxUpdateUIEvent& event)
{
event.Enable( (m_selections.Number() > 0) );
event.Enable( (m_selections.GetCount() > 0) );
}
void csDiagramView::OnPasteUpdate(wxUpdateUIEvent& event)
@@ -320,21 +320,21 @@ void csDiagramView::OnPasteUpdate(wxUpdateUIEvent& event)
void csDiagramView::OnDuplicateUpdate(wxUpdateUIEvent& event)
{
event.Enable( (m_selections.Number() > 0) );
event.Enable( (m_selections.GetCount() > 0) );
}
void csDiagramView::DoCut(wxList& shapes)
{
csDiagramDocument *doc = (csDiagramDocument *)GetDocument();
if (shapes.Number() > 0)
if (shapes.GetCount() > 0)
{
csDiagramCommand* cmd = new csDiagramCommand(_T("Cut"), doc);
wxNode* node = shapes.First();
wxNode* node = shapes.GetFirst();
while (node)
{
wxShape *theShape = (wxShape*) node->Data();
wxShape *theShape = (wxShape*) node->GetData();
csCommandState* state = new csCommandState(ID_CS_CUT, NULL, theShape);
// Insert lines at the front, so they are cut first.
@@ -345,7 +345,7 @@ void csDiagramView::DoCut(wxList& shapes)
else
cmd->AddState(state);
node = node->Next();
node = node->GetNext();
}
cmd->RemoveLines(); // Schedule any connected lines, not already mentioned,
// to be removed first
@@ -359,21 +359,21 @@ void csDiagramView::DoCmd(wxList& shapes, wxList& oldShapes, int cmd, const wxSt
{
csDiagramDocument *doc = (csDiagramDocument *)GetDocument();
if (shapes.Number() > 0)
if (shapes.GetCount() > 0)
{
csDiagramCommand* command = new csDiagramCommand(op, doc);
wxNode* node = shapes.First();
wxNode* node1 = oldShapes.First();
wxNode* node = shapes.GetFirst();
wxNode* node1 = oldShapes.GetFirst();
while (node && node1)
{
wxShape *theShape = (wxShape*) node->Data();
wxShape *oldShape = (wxShape*) node1->Data();
wxShape *theShape = (wxShape*) node->GetData();
wxShape *oldShape = (wxShape*) node1->GetData();
csCommandState* state = new csCommandState(cmd, theShape, oldShape);
command->AddState(state);
node = node->Next();
node1 = node1->Next();
node = node->GetNext();
node1 = node1->GetNext();
}
doc->GetCommandProcessor()->Submit(command);
}
@@ -386,13 +386,13 @@ void csDiagramView::OnChangeBackgroundColour(wxCommandEvent& WXUNUSED(event))
wxList selections;
FindSelectedShapes(selections);
if (selections.Number() > 0)
if (selections.GetCount() > 0)
{
wxColourData data;
data.SetChooseFull(TRUE);
if (selections.Number() == 1)
if (selections.GetCount() == 1)
{
wxShape* firstShape = (wxShape*) selections.First()->Data();
wxShape* firstShape = (wxShape*) selections.GetFirst()->GetData();
data.SetColour(firstShape->GetBrush()->GetColour());
}
@@ -410,17 +410,17 @@ void csDiagramView::OnChangeBackgroundColour(wxCommandEvent& WXUNUSED(event))
csDiagramCommand* cmd = new csDiagramCommand(_T("Change colour"), doc);
wxNode* node = selections.First();
wxNode* node = selections.GetFirst();
while (node)
{
wxShape *theShape = (wxShape*) node->Data();
wxShape *theShape = (wxShape*) node->GetData();
wxShape* newShape = theShape->CreateNewCopy();
newShape->SetBrush(theBrush);
csCommandState* state = new csCommandState(ID_CS_CHANGE_BACKGROUND_COLOUR, newShape, theShape);
cmd->AddState(state);
node = node->Next();
node = node->GetNext();
}
doc->GetCommandProcessor()->Submit(cmd);
}
@@ -437,7 +437,7 @@ void csDiagramView::OnEditPropertiesUpdate(wxUpdateUIEvent& event)
{
wxList selections;
FindSelectedShapes(selections);
event.Enable( (selections.Number() > 0) );
event.Enable( (selections.GetCount() > 0) );
}
void csDiagramView::OnPointSizeComboSel(wxCommandEvent& event)
@@ -475,14 +475,14 @@ void csDiagramView::ApplyPointSize(int pointSize)
wxList selections;
FindSelectedShapes(selections);
if (selections.Number() > 0)
if (selections.GetCount() > 0)
{
csDiagramCommand* cmd = new csDiagramCommand(_T("Point size"), doc);
wxNode* node = selections.First();
wxNode* node = selections.GetFirst();
while (node)
{
wxShape *theShape = (wxShape*) node->Data();
wxShape *theShape = (wxShape*) node->GetData();
wxShape *newShape = theShape->CreateNewCopy();
wxFont* newFont = wxTheFontList->FindOrCreateFont(pointSize,
@@ -498,7 +498,7 @@ void csDiagramView::ApplyPointSize(int pointSize)
cmd->AddState(state);
node = node->Next();
node = node->GetNext();
}
doc->GetCommandProcessor()->Submit(cmd);
}
@@ -531,23 +531,23 @@ void csDiagramView::SelectAll(bool select)
wxList selections;
FindSelectedShapes(selections);
wxNode* node = selections.First();
wxNode* node = selections.GetFirst();
while (node)
{
wxShape *theShape = (wxShape*) node->Data();
wxShape *theShape = (wxShape*) node->GetData();
theShape->Select(FALSE, &dc);
SelectShape(theShape, FALSE);
node = node->Next();
node = node->GetNext();
}
}
else
{
csDiagramDocument *doc = (csDiagramDocument *)GetDocument();
wxNode *node = doc->GetDiagram()->GetShapeList()->First();
wxNode *node = doc->GetDiagram()->GetShapeList()->GetFirst();
while (node)
{
wxShape *eachShape = (wxShape *)node->Data();
wxShape *eachShape = (wxShape *)node->GetData();
if (eachShape->GetParent() == NULL &&
!eachShape->IsKindOf(CLASSINFO(wxControlPoint)) &&
!eachShape->IsKindOf(CLASSINFO(wxLabelShape)))
@@ -555,7 +555,7 @@ void csDiagramView::SelectAll(bool select)
eachShape->Select(TRUE, &dc);
SelectShape(eachShape, TRUE);
}
node = node->Next();
node = node->GetNext();
}
}
}
@@ -575,20 +575,20 @@ void csDiagramView::OnToggleArrowTool(wxCommandEvent& WXUNUSED(event))
wxList selections;
FindSelectedShapes(selections, CLASSINFO(wxLineShape));
if (selections.Number() > 0)
if (selections.GetCount() > 0)
{
csDiagramCommand* cmd = new csDiagramCommand(stateName, doc);
wxNode* node = selections.First();
wxNode* node = selections.GetFirst();
while (node)
{
wxLineShape *theShape = (wxLineShape*) node->Data();
wxLineShape *theShape = (wxLineShape*) node->GetData();
wxLineShape *newShape = NULL;
if (state)
{
// Add arrow
if (theShape->GetArrows().Number() == 0)
if (theShape->GetArrows().GetCount() == 0)
{
newShape = (wxLineShape*) theShape->CreateNewCopy();
newShape->AddArrow(ARROW_ARROW, ARROW_POSITION_MIDDLE, 10.0, 0.0, _T("Normal arrowhead"));
@@ -596,7 +596,7 @@ void csDiagramView::OnToggleArrowTool(wxCommandEvent& WXUNUSED(event))
}
else
{
if (theShape->GetArrows().Number() > 0)
if (theShape->GetArrows().GetCount() > 0)
{
newShape = (wxLineShape*) theShape->CreateNewCopy();
newShape->ClearArrowsAtPosition();
@@ -610,7 +610,7 @@ void csDiagramView::OnToggleArrowTool(wxCommandEvent& WXUNUSED(event))
cmd->AddState(state);
}
node = node->Next();
node = node->GetNext();
}
doc->GetCommandProcessor()->Submit(cmd);
}
@@ -620,7 +620,7 @@ void csDiagramView::OnToggleArrowToolUpdate(wxUpdateUIEvent& event)
{
wxList selections;
FindSelectedShapes(selections, CLASSINFO(wxLineShape));
event.Enable( (selections.Number() > 0) );
event.Enable( (selections.GetCount() > 0) );
}
// Make the point size combobox reflect this
@@ -634,13 +634,13 @@ void csDiagramView::ReflectPointSize(int pointSize)
void csDiagramView::ReflectArrowState(wxLineShape* lineShape)
{
bool haveArrow = FALSE;
wxNode *node = lineShape->GetArrows().First();
wxNode *node = lineShape->GetArrows().GetFirst();
while (node)
{
wxArrowHead *arrow = (wxArrowHead *)node->Data();
wxArrowHead *arrow = (wxArrowHead *)node->GetData();
if (ARROW_POSITION_MIDDLE == arrow->GetArrowEnd())
haveArrow = TRUE;
node = node->Next();
node = node->GetNext();
}
wxGetApp().GetDiagramToolBar()->ToggleTool(DIAGRAM_TOOLBAR_LINE_ARROW, haveArrow);
@@ -651,35 +651,35 @@ 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().First();
wxNode* node = GetSelectionList().GetFirst();
while (node)
{
wxShape* shape = (wxShape*) node->Data();
wxShape* shape = (wxShape*) node->GetData();
if ((shape->GetParent() == NULL) && (!shape->IsKindOf(CLASSINFO(wxLineShape))))
{
selections.Append(shape);
}
node = node->Next();
node = node->GetNext();
}
if (selections.Number() == 0)
if (selections.GetCount() == 0)
return;
csDiagramDocument *doc = (csDiagramDocument *)GetDocument();
csDiagramCommand* cmd = new csDiagramCommand(_T("Align"), doc);
node = selections.First();
wxShape* firstShape = (wxShape*) node->Data();
node = selections.GetFirst();
wxShape* firstShape = (wxShape*) node->GetData();
double x = firstShape->GetX();
double y = firstShape->GetY();
double width, height;
firstShape->GetBoundingBoxMax(&width, &height);
node = selections.First();
node = selections.GetFirst();
while (node)
{
wxShape* shape = (wxShape*) node->Data();
wxShape* shape = (wxShape*) node->GetData();
if (shape != firstShape)
{
/* double x1 = */ shape->GetX();
@@ -734,7 +734,7 @@ void csDiagramView::OnAlign(wxCommandEvent& event)
csCommandState* state = new csCommandState(ID_CS_ALIGN, newShape, shape);
cmd->AddState(state);
}
node = node->Next();
node = node->GetNext();
}
doc->GetCommandProcessor()->Submit(cmd);
}
@@ -743,7 +743,7 @@ void csDiagramView::OnAlignUpdate(wxUpdateUIEvent& event)
{
// This is an approximation, since there may be lines
// amongst the selections.
event.Enable( (m_selections.Number() > 1) ) ;
event.Enable( (m_selections.GetCount() > 1) ) ;
}
void csDiagramView::OnNewLinePoint(wxCommandEvent& WXUNUSED(event))
@@ -751,10 +751,10 @@ void csDiagramView::OnNewLinePoint(wxCommandEvent& WXUNUSED(event))
csDiagramDocument *doc = (csDiagramDocument *)GetDocument();
csDiagramCommand* cmd = new csDiagramCommand(_T("New line point"), doc);
wxNode* node = m_selections.First();
wxNode* node = m_selections.GetFirst();
while (node)
{
wxShape* shape = (wxShape*) node->Data();
wxShape* shape = (wxShape*) node->GetData();
if (shape->IsKindOf(CLASSINFO(wxLineShape)))
{
wxShape* newShape = shape->CreateNewCopy();
@@ -762,7 +762,7 @@ void csDiagramView::OnNewLinePoint(wxCommandEvent& WXUNUSED(event))
csCommandState* state = new csCommandState(ID_CS_NEW_POINT, newShape, shape);
cmd->AddState(state);
}
node = node->Next();
node = node->GetNext();
}
doc->GetCommandProcessor()->Submit(cmd);
}
@@ -772,10 +772,10 @@ void csDiagramView::OnCutLinePoint(wxCommandEvent& WXUNUSED(event))
csDiagramDocument *doc = (csDiagramDocument *)GetDocument();
csDiagramCommand* cmd = new csDiagramCommand(_T("Cut line point"), doc);
wxNode* node = m_selections.First();
wxNode* node = m_selections.GetFirst();
while (node)
{
wxShape* shape = (wxShape*) node->Data();
wxShape* shape = (wxShape*) node->GetData();
if (shape->IsKindOf(CLASSINFO(wxLineShape)))
{
wxShape* newShape = shape->CreateNewCopy();
@@ -783,7 +783,7 @@ void csDiagramView::OnCutLinePoint(wxCommandEvent& WXUNUSED(event))
csCommandState* state = new csCommandState(ID_CS_CUT_POINT, newShape, shape);
cmd->AddState(state);
}
node = node->Next();
node = node->GetNext();
}
doc->GetCommandProcessor()->Submit(cmd);
}
@@ -793,10 +793,10 @@ void csDiagramView::OnStraightenLines(wxCommandEvent& WXUNUSED(event))
csDiagramDocument *doc = (csDiagramDocument *)GetDocument();
csDiagramCommand* cmd = new csDiagramCommand(_T("Straighten lines"), doc);
wxNode* node = m_selections.First();
wxNode* node = m_selections.GetFirst();
while (node)
{
wxShape* shape = (wxShape*) node->Data();
wxShape* shape = (wxShape*) node->GetData();
if (shape->IsKindOf(CLASSINFO(wxLineShape)))
{
wxShape* newShape = shape->CreateNewCopy();
@@ -804,7 +804,7 @@ void csDiagramView::OnStraightenLines(wxCommandEvent& WXUNUSED(event))
csCommandState* state = new csCommandState(ID_CS_STRAIGHTEN, newShape, shape);
cmd->AddState(state);
}
node = node->Next();
node = node->GetNext();
}
doc->GetCommandProcessor()->Submit(cmd);
}
@@ -813,21 +813,21 @@ void csDiagramView::OnNewLinePointUpdate(wxUpdateUIEvent& event)
{
wxList selections;
FindSelectedShapes(selections, CLASSINFO(wxLineShape));
event.Enable( (selections.Number() > 0) );
event.Enable( (selections.GetCount() > 0) );
}
void csDiagramView::OnCutLinePointUpdate(wxUpdateUIEvent& event)
{
wxList selections;
FindSelectedShapes(selections, CLASSINFO(wxLineShape));
event.Enable( (selections.Number() > 0) );
event.Enable( (selections.GetCount() > 0) );
}
void csDiagramView::OnStraightenLinesUpdate(wxUpdateUIEvent& event)
{
wxList selections;
FindSelectedShapes(selections, CLASSINFO(wxLineShape));
event.Enable( (selections.Number() > 0) );
event.Enable( (selections.GetCount() > 0) );
}
/*
@@ -999,10 +999,10 @@ 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()->First();
wxNode *node = GetDiagram()->GetShapeList()->GetFirst();
while (node)
{
wxShape *shape = (wxShape *)node->Data();
wxShape *shape = (wxShape *)node->GetData();
if (shape->GetParent() == NULL && !shape->IsKindOf(CLASSINFO(wxControlPoint)))
{
float image_x = shape->GetX();
@@ -1014,7 +1014,7 @@ void csCanvas::OnEndDragLeft(double x, double y, int WXUNUSED(keys))
GetView()->SelectShape(shape, TRUE);
}
}
node = node->Next();
node = node->GetNext();
}
}