- switch (cmd)
- {
- case DOODLE_CUT:
- {
- // Paste the segment
- if (segment)
- {
- doc->GetDoodleSegments().Append(segment);
- doc->Modify(true);
- doc->UpdateAllViews();
- segment = (DoodleSegment *) NULL;
- }
- doc->Modify(true);
- doc->UpdateAllViews();
- break;
- }
- case DOODLE_ADD:
- {
- // Cut the last segment
- if (doc->GetDoodleSegments().GetCount() > 0)
- {
- wxList::compatibility_iterator node = doc->GetDoodleSegments().GetLast();
- DoodleSegment *seg = (DoodleSegment *)node->GetData();
- delete seg;
- doc->GetDoodleSegments().Erase(node);
-
- doc->Modify(true);
- doc->UpdateAllViews();
- }
- }
- }
- return true;
-}
-
-IMPLEMENT_DYNAMIC_CLASS(TextEditDocument, wxDocument)
-
-// Since text windows have their own method for saving to/loading from files,
-// we override OnSave/OpenDocument instead of Save/LoadObject
-bool TextEditDocument::OnSaveDocument(const wxString& filename)
-{
- TextEditView *view = (TextEditView *)GetFirstView();
-
- if (!view->textsw->SaveFile(filename))
- return false;
- Modify(false);
-#ifdef __WXMAC__
- wxFileName fn(filename) ;
- fn.MacSetDefaultTypeAndCreator() ;
-#endif
- return true;
-}