]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/docview.cpp
Don't return invalid size from wxDir::GetTotalSize() for empty dirs.
[wxWidgets.git] / src / common / docview.cpp
index 265a6e54a6ef09d18357b89dd9d70e639fff08dc..635a2529bb8f31d9a5adcd3273df6ae7a0226bbe 100644 (file)
@@ -1114,6 +1114,15 @@ void wxDocManager::OnPrint(wxCommandEvent& WXUNUSED(event))
 #endif // wxUSE_PRINTING_ARCHITECTURE
 }
 
+#if wxUSE_PRINTING_ARCHITECTURE
+wxPreviewFrame* wxDocManager::CreatePreviewFrame(wxPrintPreviewBase* preview,
+                                                 wxWindow *parent,
+                                                 const wxString& title)
+{
+    return new wxPreviewFrame(preview, parent, title);
+}
+#endif // wxUSE_PRINTING_ARCHITECTURE
+
 void wxDocManager::OnPreview(wxCommandEvent& WXUNUSED(event))
 {
 #if wxUSE_PRINTING_ARCHITECTURE
@@ -1135,9 +1144,11 @@ void wxDocManager::OnPreview(wxCommandEvent& WXUNUSED(event))
             return;
         }
 
-        wxPreviewFrame *
-            frame = new wxPreviewFrame(preview, wxTheApp->GetTopWindow(),
-                                       _("Print Preview"));
+        wxPreviewFrame* frame = CreatePreviewFrame(preview,
+                                                   wxTheApp->GetTopWindow(),
+                                                   _("Print Preview"));
+        wxCHECK_RET( frame, "should create a print preview frame" );
+
         frame->Centre(wxBOTH);
         frame->Initialize();
         frame->Show(true);
@@ -1614,7 +1625,8 @@ wxDocTemplate *wxDocManager::SelectDocumentPath(wxDocTemplate **templates,
                                         GetLastDirectory(),
                                         wxEmptyString,
                                         &FilterIndex,
-                                        descrBuf);
+                                        descrBuf,
+                                        wxFD_OPEN | wxFD_FILE_MUST_EXIST);
 
     wxDocTemplate *theTemplate = NULL;
     if (!pathTmp.empty())