X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b1d4dd7add411ebff1ce4a8d1d992e0e43ee26b1..f2ac038698d45e486f0300e8b7a2f83392c1d153:/samples/docvwmdi/doc.cpp?ds=sidebyside diff --git a/samples/docvwmdi/doc.cpp b/samples/docvwmdi/doc.cpp index 5f620dbe38..4b7ee90dae 100644 --- a/samples/docvwmdi/doc.cpp +++ b/samples/docvwmdi/doc.cpp @@ -5,7 +5,7 @@ // Modified by: // Created: 04/01/98 // RCS-ID: $Id$ -// Copyright: (c) Julian Smart and Markus Holzem +// Copyright: (c) Julian Smart // Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// @@ -40,7 +40,7 @@ DrawingDocument::DrawingDocument(void) DrawingDocument::~DrawingDocument(void) { - doodleSegments.DeleteContents(TRUE); + WX_CLEAR_LIST(wxList, doodleSegments); } #if wxUSE_STD_IOSTREAM @@ -51,7 +51,7 @@ wxSTD ostream& DrawingDocument::SaveObject(wxSTD ostream& stream) wxInt32 n = doodleSegments.GetCount(); stream << n << _T('\n'); - wxNode *node = doodleSegments.GetFirst(); + wxList::compatibility_iterator node = doodleSegments.GetFirst(); while (node) { DoodleSegment *segment = (DoodleSegment *)node->GetData(); @@ -73,7 +73,7 @@ wxOutputStream& DrawingDocument::SaveObject(wxOutputStream& stream) wxInt32 n = doodleSegments.GetCount(); text_stream << n << _T('\n'); - wxNode *node = doodleSegments.GetFirst(); + wxList::compatibility_iterator node = doodleSegments.GetFirst(); while (node) { DoodleSegment *segment = (DoodleSegment *)node->GetData(); @@ -130,7 +130,7 @@ DoodleSegment::DoodleSegment(void) DoodleSegment::DoodleSegment(DoodleSegment& seg) { - wxNode *node = seg.lines.GetFirst(); + wxList::compatibility_iterator node = seg.lines.GetFirst(); while (node) { DoodleLine *line = (DoodleLine *)node->GetData(); @@ -148,7 +148,7 @@ DoodleSegment::DoodleSegment(DoodleSegment& seg) DoodleSegment::~DoodleSegment(void) { - lines.DeleteContents(TRUE); + WX_CLEAR_LIST(wxList, lines); } #if wxUSE_STD_IOSTREAM @@ -157,7 +157,7 @@ wxSTD ostream& DoodleSegment::SaveObject(wxSTD ostream& stream) wxInt32 n = lines.GetCount(); stream << n << _T('\n'); - wxNode *node = lines.GetFirst(); + wxList::compatibility_iterator node = lines.GetFirst(); while (node) { DoodleLine *line = (DoodleLine *)node->GetData(); @@ -178,7 +178,7 @@ wxOutputStream &DoodleSegment::SaveObject(wxOutputStream& stream) wxInt32 n = lines.GetCount(); text_stream << n << _T('\n'); - wxNode *node = lines.GetFirst(); + wxList::compatibility_iterator node = lines.GetFirst(); while (node) { DoodleLine *line = (DoodleLine *)node->GetData(); @@ -234,7 +234,7 @@ wxInputStream &DoodleSegment::LoadObject(wxInputStream& stream) #endif void DoodleSegment::Draw(wxDC *dc) { - wxNode *node = lines.GetFirst(); + wxList::compatibility_iterator node = lines.GetFirst(); while (node) { DoodleLine *line = (DoodleLine *)node->GetData(); @@ -248,7 +248,7 @@ void DoodleSegment::Draw(wxDC *dc) */ DrawingCommand::DrawingCommand(const wxString& name, int command, DrawingDocument *ddoc, DoodleSegment *seg): - wxCommand(TRUE, name) + wxCommand(true, name) { doc = ddoc; segment = seg; @@ -270,14 +270,14 @@ bool DrawingCommand::Do(void) // Cut the last segment if (doc->GetDoodleSegments().GetCount() > 0) { - wxNode *node = doc->GetDoodleSegments().GetLast(); + wxList::compatibility_iterator node = doc->GetDoodleSegments().GetLast(); if (segment) delete segment; segment = (DoodleSegment *)node->GetData(); - delete node; + doc->GetDoodleSegments().Erase(node); - doc->Modify(TRUE); + doc->Modify(true); doc->UpdateAllViews(); } break; @@ -285,12 +285,12 @@ bool DrawingCommand::Do(void) case DOODLE_ADD: { doc->GetDoodleSegments().Append(new DoodleSegment(*segment)); - doc->Modify(TRUE); + doc->Modify(true); doc->UpdateAllViews(); break; } } - return TRUE; + return true; } bool DrawingCommand::Undo(void) @@ -303,11 +303,11 @@ bool DrawingCommand::Undo(void) if (segment) { doc->GetDoodleSegments().Append(segment); - doc->Modify(TRUE); + doc->Modify(true); doc->UpdateAllViews(); segment = (DoodleSegment *) NULL; } - doc->Modify(TRUE); + doc->Modify(true); doc->UpdateAllViews(); break; } @@ -316,17 +316,17 @@ bool DrawingCommand::Undo(void) // Cut the last segment if (doc->GetDoodleSegments().GetCount() > 0) { - wxNode *node = doc->GetDoodleSegments().GetLast(); + wxList::compatibility_iterator node = doc->GetDoodleSegments().GetLast(); DoodleSegment *seg = (DoodleSegment *)node->GetData(); delete seg; - delete node; + doc->GetDoodleSegments().Erase(node); - doc->Modify(TRUE); + doc->Modify(true); doc->UpdateAllViews(); } } } - return TRUE; + return true; } IMPLEMENT_DYNAMIC_CLASS(TextEditDocument, wxDocument) @@ -338,21 +338,21 @@ bool TextEditDocument::OnSaveDocument(const wxString& filename) TextEditView *view = (TextEditView *)GetFirstView(); if (!view->textsw->SaveFile(filename)) - return FALSE; - Modify(FALSE); - return TRUE; + return false; + Modify(false); + return true; } bool TextEditDocument::OnOpenDocument(const wxString& filename) { TextEditView *view = (TextEditView *)GetFirstView(); if (!view->textsw->LoadFile(filename)) - return FALSE; + return false; - SetFilename(filename, TRUE); - Modify(FALSE); + SetFilename(filename, true); + Modify(false); UpdateAllViews(); - return TRUE; + return true; } bool TextEditDocument::IsModified(void) const