X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2b2739754f76da41764a922b4bb35b420d703956..feef75abcaa27ee25336900cbc7e6d4dd7977f94:/src/common/docview.cpp diff --git a/src/common/docview.cpp b/src/common/docview.cpp index 93f4e5e81e..3d582f8807 100644 --- a/src/common/docview.cpp +++ b/src/common/docview.cpp @@ -103,7 +103,7 @@ static inline wxString FindExtension(const wxChar *path); // local constants // ---------------------------------------------------------------------------- -static const char *s_MRUEntryFormat = wxT("&%d %s"); +static const wxChar *s_MRUEntryFormat = wxT("&%d %s"); // ============================================================================ // implementation @@ -528,7 +528,7 @@ wxView::wxView() wxView::~wxView() { - GetDocumentManager()->ActivateView(this, FALSE, TRUE); +// GetDocumentManager()->ActivateView(this, FALSE, TRUE); m_viewDocument->RemoveView(this); } @@ -1309,7 +1309,7 @@ wxDocTemplate *wxDocManager::SelectDocumentType(wxDocTemplate **templates, } wxDocTemplate *theTemplate = (wxDocTemplate *)wxGetSingleChoiceData(_("Select a document template"), _("Templates"), n, - strings, (char **)data); + strings, (void **)data); delete[] strings; delete[] data; return theTemplate; @@ -1332,7 +1332,7 @@ wxDocTemplate *wxDocManager::SelectViewType(wxDocTemplate **templates, } } wxDocTemplate *theTemplate = (wxDocTemplate *)wxGetSingleChoiceData(_("Select a document view"), _("Views"), n, - strings, (char **)data); + strings, (void **)data); delete[] strings; delete[] data; return theTemplate; @@ -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--;