Applied patch [ 1163322 ] Patch to prevent MDI app from opening the same file twice

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@33185 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart 2005-03-30 16:35:07 +00:00
parent 8e15e610d1
commit 6489e7ee02

View File

@ -1288,6 +1288,28 @@ wxDocument *wxDocManager::CreateDocument(const wxString& path, long flags)
}
}
//see if this file is already open
for (size_t i = 0; i < GetDocuments().GetCount(); ++i)
{
wxDocument* currentDoc = (wxDocument*)(GetDocuments().Item(i)->GetData());
#ifdef __WXMSW__
//file paths are case-insensitive on Windows
if (path2.CmpNoCase(currentDoc->GetFilename()) == 0)
#else
if (path2.Cmp(currentDoc->GetFilename()) == 0)
#endif
{
//file already open. Just activate it and return
if (currentDoc->GetFirstView())
{
ActivateView(currentDoc->GetFirstView(), true);
if (currentDoc->GetDocumentWindow())
currentDoc->GetDocumentWindow()->SetFocus();
return currentDoc;
}
}
}
wxDocument *newDoc = temp->CreateDocument(path2, flags);
if (newDoc)
{