X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/223d09f6b523aac674ef9b72a883dfa8d37c5d4e..8fb3a512a85572ebf4b4f46eaf536727dfe4e01e:/src/common/docview.cpp?ds=inline diff --git a/src/common/docview.cpp b/src/common/docview.cpp index 2c827b697a..93f4e5e81e 100644 --- a/src/common/docview.cpp +++ b/src/common/docview.cpp @@ -1224,7 +1224,7 @@ wxDocTemplate *wxDocManager::SelectDocumentPath(wxDocTemplate **templates, int FilterIndex = 0; wxString pathTmp = wxFileSelectorEx(_("Select a file"), - wxT(""), + m_lastDirectory, wxT(""), &FilterIndex, descrBuf, @@ -1233,6 +1233,8 @@ wxDocTemplate *wxDocManager::SelectDocumentPath(wxDocTemplate **templates, if (!pathTmp.IsEmpty()) { + m_lastDirectory = wxPathOnly(pathTmp); + path = pathTmp; wxString theExt = FindExtension(path); if (!theExt) @@ -1907,12 +1909,6 @@ void wxFileHistory::RemoveFileFromHistory(int i) { wxMenu* menu = (wxMenu*) node->Data(); - // wxMenu::Delete() is missing from wxGTK, so this can't be done :-( -#if 0 - // delete the menu items - menu->Delete(wxID_FILE1 + i); -#endif - // delete the element from the array (could use memmove() too...) delete [] m_fileHistory[i]; @@ -1930,22 +1926,34 @@ void wxFileHistory::RemoveFileFromHistory(int i) menu->SetLabel(wxID_FILE1 + j, buf); } - // to be removed as soon as wxMenu::Delete() is implemented -#if 1 - menu->SetLabel(wxID_FILE1 + m_fileHistoryN - 1, wxT("")); -#endif - node = node->Next(); + + // delete the last menu item which is unused now + menu->Delete(wxID_FILE1 + m_fileHistoryN - 1); + + // unfortunately, we can't delete separator (there is no function to + // delete item by position, only by id - and what if there are several + // separators in this menu?) - so we will be always left with at least + // one and, even worse, we will add another one if this was the last + // file... (FIXME) } + m_fileHistoryN--; } wxString wxFileHistory::GetHistoryFile(int i) const { - if (i < m_fileHistoryN) - return wxString(m_fileHistory[i]); + wxString s; + if ( i < m_fileHistoryN ) + { + s = m_fileHistory[i]; + } else - return wxString(""); + { + wxFAIL_MSG( wxT("bad index in wxFileHistory::GetHistoryFile") ); + } + + return s; } void wxFileHistory::UseMenu(wxMenu *menu)