From e85eaef3fa3238c3bb387f17b1f00217b1d4c278 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 29 Aug 2008 11:38:12 +0000 Subject: [PATCH] override DoOpen/SaveDocument() instead of OnOpen/SaveDocument(), just as in docmdi sample after r55141/r55142/r55143 changes (#9892) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@55342 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- samples/docvwmdi/doc.cpp | 30 +++++++++--------------------- samples/docvwmdi/doc.h | 4 ++-- 2 files changed, 11 insertions(+), 23 deletions(-) diff --git a/samples/docvwmdi/doc.cpp b/samples/docvwmdi/doc.cpp index d2933881a5..1cb8e4e1fc 100644 --- a/samples/docvwmdi/doc.cpp +++ b/samples/docvwmdi/doc.cpp @@ -321,42 +321,30 @@ bool DrawingCommand::Undo(void) 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) +// we override DoSave/OpenDocument instead of Save/LoadObject +bool TextEditDocument::DoSaveDocument(const wxString& filename) { - TextEditView* view = GetFirstView(); - - if (!view->m_textsw->SaveFile(filename)) - return false; - Modify(false); - return true; + return GetFirstView()->m_textsw->SaveFile(filename); } -bool TextEditDocument::OnOpenDocument(const wxString& filename) +bool TextEditDocument::DoOpenDocument(const wxString& filename) { - TextEditView *view = GetFirstView(); - if (!view->m_textsw->LoadFile(filename)) - return false; - - SetFilename(filename, true); - Modify(false); - UpdateAllViews(); - return true; + return GetFirstView()->m_textsw->LoadFile(filename); } bool TextEditDocument::IsModified(void) const { - TextEditView* view = GetFirstView(); - return (wxDocument::IsModified() || (view && view->m_textsw->IsModified())); + TextEditView *view = GetFirstView(); + return wxDocument::IsModified() || (view && view->m_textsw->IsModified()); } void TextEditDocument::Modify(bool mod) { - TextEditView* view = GetFirstView(); + TextEditView *view = GetFirstView(); wxDocument::Modify(mod); - if ((!mod) && view && view->m_textsw) + if (!mod && view && view->m_textsw) { view->m_textsw->DiscardEdits(); } diff --git a/samples/docvwmdi/doc.h b/samples/docvwmdi/doc.h index 26f2f95148..2aa3201253 100644 --- a/samples/docvwmdi/doc.h +++ b/samples/docvwmdi/doc.h @@ -94,8 +94,8 @@ public: */ TextEditView* GetFirstView() const; - virtual bool OnSaveDocument(const wxString& filename); - virtual bool OnOpenDocument(const wxString& filename); + virtual bool DoSaveDocument(const wxString& filename); + virtual bool DoOpenDocument(const wxString& filename); virtual bool IsModified() const; virtual void Modify(bool mod); -- 2.45.2