#include "wx/confbase.h"
#include "wx/file.h"
#include "wx/cmdproc.h"
+#include "wx/tokenzr.h"
#include <stdio.h>
#include <string.h>
void wxView::OnChangeFilename()
{
- if (GetFrame() && GetDocument())
- {
- wxString title;
+ // GetFrame can return wxWindow rather than wxTopLevelWindow due to
+ // generic MDI implementation so use SetLabel rather than SetTitle.
+ // It should cause SetTitle() for top level windows.
+ wxWindow *win = GetFrame();
+ if (!win) return;
- GetDocument()->GetPrintableName(title);
+ wxDocument *doc = GetDocument();
+ if (!doc) return;
- GetFrame()->SetTitle(title);
- }
+ wxString name;
+ doc->GetPrintableName(name);
+ win->SetLabel(name);
}
void wxView::SetDocument(wxDocument *doc)
// 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));
}
#endif // wxUSE_STD_IOSTREAM/!wxUSE_STD_IOSTREAM
#endif // wxUSE_DOC_VIEW_ARCHITECTURE
-