]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/docview.cpp
Slightly improved check whether or not to execute wxPropertyGrid::RecalculateVirtualS...
[wxWidgets.git] / src / common / docview.cpp
index 4e7c5624d118637020261155272fa2d4f8503da9..6e1ef4c162a87ba5abb2062a4ec9ba1c0fcf1cd3 100644 (file)
@@ -339,15 +339,6 @@ bool wxDocument::SaveAs()
     if (fileName.empty())
         return false; // cancelled by user
 
     if (fileName.empty())
         return false; // cancelled by user
 
-    wxString ext;
-    wxFileName::SplitPath(fileName, NULL, NULL, &ext);
-
-    if (ext.empty())
-    {
-        fileName += wxT(".");
-        fileName += docTemplate->GetDefaultExtension();
-    }
-
     // Files that were not saved correctly are not added to the FileHistory.
     if (!OnSaveDocument(fileName))
         return false;
     // Files that were not saved correctly are not added to the FileHistory.
     if (!OnSaveDocument(fileName))
         return false;
@@ -355,16 +346,16 @@ bool wxDocument::SaveAs()
     SetTitle(wxFileNameFromPath(fileName));
     SetFilename(fileName, true);    // will call OnChangeFileName automatically
 
     SetTitle(wxFileNameFromPath(fileName));
     SetFilename(fileName, true);    // will call OnChangeFileName automatically
 
-   // A file that doesn't use the default extension of its document template
-   // cannot be opened via the FileHistory, so we do not add it.
-   if (docTemplate->FileMatchesTemplate(fileName))
-   {
-       GetDocumentManager()->AddFileToHistory(fileName);
-   }
-   //else: the user will probably not be able to open the file again, so we
-   //      could warn about the wrong file-extension here
+    // A file that doesn't use the default extension of its document template
+    // cannot be opened via the FileHistory, so we do not add it.
+    if (docTemplate->FileMatchesTemplate(fileName))
+    {
+        GetDocumentManager()->AddFileToHistory(fileName);
+    }
+    //else: the user will probably not be able to open the file again, so we
+    //      could warn about the wrong file-extension here
 
 
-   return true;
+    return true;
 }
 
 bool wxDocument::OnSaveDocument(const wxString& file)
 }
 
 bool wxDocument::OnSaveDocument(const wxString& file)
@@ -660,7 +651,8 @@ wxView::wxView()
 
 wxView::~wxView()
 {
 
 wxView::~wxView()
 {
-    GetDocumentManager()->ActivateView(this, false);
+    if (m_viewDocument && GetDocumentManager())
+        GetDocumentManager()->ActivateView(this, false);
 
     // reset our frame view first, before removing it from the document as
     // SetView(NULL) is a simple call while RemoveView() may result in user
 
     // reset our frame view first, before removing it from the document as
     // SetView(NULL) is a simple call while RemoveView() may result in user