Example #1
0
/*!
 * \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;
}
Example #2
0
File: doc.cpp Project: EdgarTx/wx
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;
}