]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/docview.cpp
removing outdated files for mac
[wxWidgets.git] / src / common / docview.cpp
index 5c52d6059ac3a76839d467f6806775c05894c4bd..fd55bcb89f0574787222595091976045377146db 100644 (file)
@@ -298,8 +298,12 @@ bool wxDocument::SaveAs()
 #else
     wxString filter = docTemplate->GetFileFilter() ;
 #endif
 #else
     wxString filter = docTemplate->GetFileFilter() ;
 #endif
-    wxString tmp = wxFileSelector(_("Save as"),
-            docTemplate->GetDirectory(),
+    wxString defaultDir = docTemplate->GetDirectory();
+    if (defaultDir.IsEmpty())
+        defaultDir = wxPathOnly(GetFilename());
+
+    wxString tmp = wxFileSelector(_("Save As"),
+            defaultDir,
             wxFileNameFromPath(GetFilename()),
             docTemplate->GetDefaultExtension(),
             filter,
             wxFileNameFromPath(GetFilename()),
             docTemplate->GetDefaultExtension(),
             filter,
@@ -1505,7 +1509,7 @@ void wxDocManager::FileHistoryRemoveMenu(wxMenu *menu)
 }
 
 #if wxUSE_CONFIG
 }
 
 #if wxUSE_CONFIG
-void wxDocManager::FileHistoryLoad(wxConfigBase& config)
+void wxDocManager::FileHistoryLoad(const wxConfigBase& config)
 {
     if (m_fileHistory)
         m_fileHistory->Load(config);
 {
     if (m_fileHistory)
         m_fileHistory->Load(config);
@@ -1617,7 +1621,7 @@ wxDocTemplate *wxDocManager::SelectDocumentPath(wxDocTemplate **templates,
 
     wxWindow* parent = wxFindSuitableParent();
 
 
     wxWindow* parent = wxFindSuitableParent();
 
-    wxString pathTmp = wxFileSelectorEx(_("Select a file"),
+    wxString pathTmp = wxFileSelectorEx(_("Open File"),
                                         m_lastDirectory,
                                         wxEmptyString,
                                         &FilterIndex,
                                         m_lastDirectory,
                                         wxEmptyString,
                                         &FilterIndex,
@@ -2216,7 +2220,7 @@ void wxFileHistory::RemoveFileFromHistory(size_t i)
     wxCHECK_RET( i < m_fileHistory.GetCount(),
                  wxT("invalid index in wxFileHistory::RemoveFileFromHistory") );
 
     wxCHECK_RET( i < m_fileHistory.GetCount(),
                  wxT("invalid index in wxFileHistory::RemoveFileFromHistory") );
 
-    // delete the element from the array 
+    // delete the element from the array
     m_fileHistory.RemoveAt(i);
 
     wxList::compatibility_iterator node = m_fileMenus.GetFirst();
     m_fileHistory.RemoveAt(i);
 
     wxList::compatibility_iterator node = m_fileMenus.GetFirst();
@@ -2271,7 +2275,7 @@ void wxFileHistory::RemoveMenu(wxMenu *menu)
 }
 
 #if wxUSE_CONFIG
 }
 
 #if wxUSE_CONFIG
-void wxFileHistory::Load(wxConfigBase& config)
+void wxFileHistory::Load(const wxConfigBase& config)
 {
     m_fileHistory.Clear();
 
 {
     m_fileHistory.Clear();
 
@@ -2279,7 +2283,7 @@ void wxFileHistory::Load(wxConfigBase& config)
     buf.Printf(wxT("file%d"), 1);
 
     wxString historyFile;
     buf.Printf(wxT("file%d"), 1);
 
     wxString historyFile;
-    while ((m_fileHistory.GetCount() < m_fileMaxFiles) && 
+    while ((m_fileHistory.GetCount() < m_fileMaxFiles) &&
            config.Read(buf, &historyFile) && !historyFile.empty())
     {
         m_fileHistory.Add(historyFile);
            config.Read(buf, &historyFile) && !historyFile.empty())
     {
         m_fileHistory.Add(historyFile);
@@ -2435,15 +2439,22 @@ bool wxTransferStreamToFile(wxInputStream& stream, const wxString& filename)
         return false;
 
     char buf[4096];
         return false;
 
     char buf[4096];
-    do
+    for ( ;; )
     {
         stream.Read(buf, WXSIZEOF(buf));
 
         const size_t nRead = stream.LastRead();
     {
         stream.Read(buf, WXSIZEOF(buf));
 
         const size_t nRead = stream.LastRead();
-        if ( !nRead || !file.Write(buf, nRead) )
+        if ( !nRead )
+        {
+            if ( stream.Eof() )
+                break;
+
+            return false;
+        }
+
+        if ( !file.Write(buf, nRead) )
             return false;
     }
             return false;
     }
-    while ( !stream.Eof() );
 
     return true;
 }
 
     return true;
 }