]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/docview.cpp
Provide a task-dialog based wxMSW wxMessageDialog implementation.
[wxWidgets.git] / src / common / docview.cpp
index 71c1b15b1fbe9e6468552e3a58f5b5599a418758..e2ff18c915eb8c32a2ebc1b6490076f434dde366 100644 (file)
@@ -1036,14 +1036,8 @@ wxFileHistory *wxDocManager::OnCreateFileHistory()
 void wxDocManager::OnFileClose(wxCommandEvent& WXUNUSED(event))
 {
     wxDocument *doc = GetCurrentDocument();
-    if (!doc)
-        return;
-    if (doc->Close())
-    {
-        doc->DeleteAllViews();
-        if (m_docs.Member(doc))
-            delete doc;
-    }
+    if (doc)
+        CloseDocument(doc);
 }
 
 void wxDocManager::OnFileCloseAll(wxCommandEvent& WXUNUSED(event))
@@ -1093,7 +1087,7 @@ void wxDocManager::OnMRUFile(wxCommandEvent& event)
     // Check if the id is in the range assigned to MRU list entries.
     const int id = event.GetId();
     if ( id >= wxID_FILE1 &&
-            id < wxID_FILE1 + m_fileHistory->GetBaseId() )
+            id < wxID_FILE1 + static_cast<int>(m_fileHistory->GetCount()) )
     {
         DoOpenMRUFile(id - wxID_FILE1);
     }
@@ -1414,6 +1408,7 @@ wxDocument *wxDocManager::CreateDocument(const wxString& pathOrig, long flags)
             {
                 // file already open, just activate it and return
                 ActivateDocument(doc);
+                return doc;
             }
         }
     }
@@ -1953,8 +1948,7 @@ bool wxDocChildFrameAnyBase::CloseView(wxCloseEvent& event)
         // deleted directly not by us as indicated by its doc child frame
         // pointer still being set
         m_childView->SetDocChildFrame(NULL);
-        delete m_childView;
-        m_childView = NULL;
+        wxDELETE(m_childView);
     }
 
     m_childDocument = NULL;