From 0f30d8e39e7f896fc3767d086fe747efc1696d3b Mon Sep 17 00:00:00 2001 From: =?utf8?q?W=C5=82odzimierz=20Skiba?= Date: Tue, 21 Feb 2006 19:53:31 +0000 Subject: [PATCH] Fixed using list of wildcards in filter of wxDocTemplate. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37659 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 1 + src/common/docview.cpp | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/docs/changes.txt b/docs/changes.txt index adbf971..493d21b 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -89,6 +89,7 @@ All (GUI): - Added XRC tag for wxToolBar elements and for wxToolBar itself. - Fixed centering of top level windows on secondary displays. - Implemented wxDisplay::GetFromWindow() for platforms other than MSW. +- More than one filter allowed in in wxDocTemplate filter. wxMSW: diff --git a/src/common/docview.cpp b/src/common/docview.cpp index 8673687..22fc22e 100644 --- a/src/common/docview.cpp +++ b/src/common/docview.cpp @@ -60,6 +60,7 @@ #include "wx/confbase.h" #include "wx/file.h" #include "wx/cmdproc.h" +#include "wx/tokenzr.h" #include #include @@ -796,6 +797,17 @@ wxView *wxDocTemplate::CreateView(wxDocument *doc, long flags) // that of the template bool wxDocTemplate::FileMatchesTemplate(const wxString& path) { + wxStringTokenizer parser (GetFileFilter(), wxT(";")); + wxString anything = wxT ("*"); + while (parser.HasMoreTokens()) + { + wxString filter = parser.GetNextToken(); + wxString filterExt = FindExtension (filter); + if ( filter.IsSameAs (anything) || + filterExt.IsSameAs (anything) || + filterExt.IsSameAs (FindExtension (path)) ) + return true; + } return GetDefaultExtension().IsSameAs(FindExtension(path)); } -- 2.7.4