]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/docview/docview.cpp
eliminate possibility of configure enabling gnomeprint with GTK3
[wxWidgets.git] / samples / docview / docview.cpp
index e95442160835af699edf22237e0133c12f627ddf..6c11e54648932fcd6eba6e555d24ca185b72837f 100644 (file)
 #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 )
     {
@@ -231,13 +239,16 @@ bool MyApp::OnInit()
     frame->Centre();
     frame->Show();
 
-    SetTopWindow(frame);
     return true;
 }
 
 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();
 }