/*! * \brief Open an existing document. * */ bool CNutConfDoc::OnOpenDocument(const wxString & filename) { /* * Check if the current document has been modified. */ if (!OnSaveModified()) return false; SetFilename(filename, true); Modify(false); UpdateAllViews(); return true; }
bool csDiagramDocument::OnOpenDocument(const wxString& file) { if (!OnSaveModified()) return false; wxString msgTitle; if (wxTheApp->GetAppName() != wxEmptyString) msgTitle = wxTheApp->GetAppName(); else msgTitle = wxString(_T("File error")); m_diagram.DeleteAllShapes(); if (!m_diagram.LoadFile(file)) { (void)wxMessageBox(_T("Sorry, could not open this file."), msgTitle, wxOK|wxICON_EXCLAMATION, GetDocumentWindow()); return false; } SetFilename(file, true); Modify(false); UpdateAllViews(); return true; }