X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/54cbdc641494472360fe8f51a58b7443ffeaeaff..a7d696f13d3e38b5502999f0c19d482157881ae8:/src/common/docview.cpp diff --git a/src/common/docview.cpp b/src/common/docview.cpp index 69e5061128..86d1783490 100644 --- a/src/common/docview.cpp +++ b/src/common/docview.cpp @@ -1087,7 +1087,7 @@ void wxDocManager::OnMRUFile(wxCommandEvent& event) // Check if the id is in the range assigned to MRU list entries. const int id = event.GetId(); if ( id >= wxID_FILE1 && - id < wxID_FILE1 + m_fileHistory->GetBaseId() ) + id < wxID_FILE1 + static_cast(m_fileHistory->GetCount()) ) { DoOpenMRUFile(id - wxID_FILE1); } @@ -1894,6 +1894,20 @@ void wxDocManager::DisassociateTemplate(wxDocTemplate *temp) m_templates.DeleteObject(temp); } +wxDocTemplate* wxDocManager::FindTemplate(const wxClassInfo* classinfo) +{ + for ( wxList::compatibility_iterator node = m_templates.GetFirst(); + node; + node = node->GetNext() ) + { + wxDocTemplate* t = wxStaticCast(node->GetData(), wxDocTemplate); + if ( t->GetDocClassInfo() == classinfo ) + return t; + } + + return NULL; +} + // Add and remove a document from the manager's list void wxDocManager::AddDocument(wxDocument *doc) {