X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2695a14e85544fe0075f84d841893d612b62f530..7b9da2077d0975db6c965a85c91d5aca671ab5e3:/src/common/docview.cpp diff --git a/src/common/docview.cpp b/src/common/docview.cpp index 317dbfbc7f..a2863a485c 100644 --- a/src/common/docview.cpp +++ b/src/common/docview.cpp @@ -528,7 +528,7 @@ wxView::wxView() wxView::~wxView() { - GetDocumentManager()->ActivateView(this, FALSE, TRUE); +// GetDocumentManager()->ActivateView(this, FALSE, TRUE); m_viewDocument->RemoveView(this); } @@ -1191,7 +1191,7 @@ wxDocTemplate *wxDocManager::FindTemplateForPath(const wxString& path) // template extension. wxDocTemplate *wxDocManager::SelectDocumentPath(wxDocTemplate **templates, -#ifdef __WXMSW__ +#if defined(__WXMSW__) || defined(__WXGTK__) int noTemplates, #else int WXUNUSED(noTemplates), @@ -1200,8 +1200,8 @@ wxDocTemplate *wxDocManager::SelectDocumentPath(wxDocTemplate **templates, long WXUNUSED(flags), bool WXUNUSED(save)) { - // We can only have multiple filters in Windows -#ifdef __WXMSW__ + // We can only have multiple filters in Windows and GTK +#if defined(__WXMSW__) || defined(__WXGTK__) wxString descrBuf; int i; @@ -1931,11 +1931,21 @@ void wxFileHistory::RemoveFileFromHistory(int i) // 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) + // delete the last separator too if no more files are left + if ( m_fileHistoryN == 1 ) + { + wxMenuItemList::Node *node = menu->GetMenuItems().GetLast(); + if ( node ) + { + wxMenuItem *menuItem = node->GetData(); + if ( menuItem->IsSeparator() ) + { + menu->Delete(menuItem); + } + //else: should we search backwards for the last separator? + } + //else: menu is empty somehow + } } m_fileHistoryN--;