X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/18f42b94df62068a19258b96ac7f569d4d3ba400..14619f10b0bdb630206607abd0ce0319d45e095a:/samples/docview/docview.cpp?ds=sidebyside diff --git a/samples/docview/docview.cpp b/samples/docview/docview.cpp index 57eeef7c52..c8d4adcf73 100644 --- a/samples/docview/docview.cpp +++ b/samples/docview/docview.cpp @@ -55,12 +55,13 @@ #include "view.h" #include "wx/cmdline.h" +#include "wx/config.h" #ifdef __WXMAC__ #include "wx/filename.h" #endif -#if !defined(__WXMSW__) && !defined(__WXPM__) +#ifndef wxHAS_IMAGES_IN_RESOURCES #include "doc.xpm" #include "chart.xpm" #include "notepad.xpm" @@ -150,7 +151,10 @@ bool MyApp::OnInit() ::wxInitAllImageHandlers(); - SetAppName("DocView Sample"); + // Fill in the application information fields before creating wxConfig. + SetVendorName("wxWidgets"); + SetAppName("wx_docview_sample"); + SetAppDisplayName("wxWidgets DocView Sample"); //// Create a document manager wxDocManager *docManager = new wxDocManager; @@ -217,6 +221,10 @@ bool MyApp::OnInit() // A nice touch: a history of files visited. Use this menu. docManager->FileHistoryUseMenu(menuFile); +#if wxUSE_CONFIG + docManager->FileHistoryLoad(*wxConfig::Get()); +#endif // wxUSE_CONFIG + if ( m_mode == Mode_Single ) { @@ -236,7 +244,11 @@ bool MyApp::OnInit() int MyApp::OnExit() { - delete wxDocManager::GetDocumentManager(); + wxDocManager * const manager = wxDocManager::GetDocumentManager(); +#if wxUSE_CONFIG + manager->FileHistorySave(*wxConfig::Get()); +#endif // wxUSE_CONFIG + delete manager; return wxApp::OnExit(); } @@ -374,15 +386,24 @@ void MyApp::OnAbout(wxCommandEvent& WXUNUSED(event)) wxFAIL_MSG( "unknown mode "); } +#ifdef __VISUALC6__ + const int docsCount = + wxDocManager::GetDocumentManager()->GetDocuments().GetCount(); +#else + const int docsCount = + wxDocManager::GetDocumentManager()->GetDocumentsVector().size(); +#endif + wxLogMessage ( "This is the wxWidgets Document/View Sample\n" "running in %s mode.\n" + "%d open documents.\n" "\n" "Authors: Julian Smart, Vadim Zeitlin\n" "\n" "Usage: docview [--{mdi,sdi,single}]", - modeName + modeName, + docsCount ); } -