#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,
}
#if wxUSE_CONFIG
-void wxDocManager::FileHistoryLoad(wxConfigBase& config)
+void wxDocManager::FileHistoryLoad(const wxConfigBase& config)
{
if (m_fileHistory)
m_fileHistory->Load(config);
wxWindow* parent = wxFindSuitableParent();
- wxString pathTmp = wxFileSelectorEx(_("Select a file"),
+ wxString pathTmp = wxFileSelectorEx(_("Open File"),
m_lastDirectory,
wxEmptyString,
&FilterIndex,
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();
}
#if wxUSE_CONFIG
-void wxFileHistory::Load(wxConfigBase& config)
+void wxFileHistory::Load(const wxConfigBase& config)
{
m_fileHistory.Clear();
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);
return false;
char buf[4096];
- do
+ for ( ;; )
{
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;
}
- while ( !stream.Eof() );
return true;
}