+
+ wxString pathTmp = wxFileSelector(_("Select a file"), _T(""), _T(""), _T(""),
+ descrBuf, 0, wxTheApp->GetTopWindow());
+
+ if (!pathTmp.IsEmpty())
+ {
+ path = pathTmp;
+ wxString theExt = FindExtension(path);
+ if (!theExt)
+ return (wxDocTemplate *) NULL;
+
+ // This is dodgy in that we're selecting the template on the
+ // basis of the file extension, which may not be a standard
+ // one. We really want to know exactly which template was
+ // chosen by using a more advanced file selector.
+ wxDocTemplate *theTemplate = FindTemplateForPath(path);
+ return theTemplate;
+ }
+ else
+ {
+ path = "";
+ return (wxDocTemplate *) NULL;
+ }
+#if 0
+ // In all other windowing systems, until we have more advanced
+ // file selectors, we must select the document type (template) first, and
+ // _then_ pop up the file selector.
+ wxDocTemplate *temp = SelectDocumentType(templates, noTemplates);
+ if (!temp)
+ return (wxDocTemplate *) NULL;
+
+ char *pathTmp = wxFileSelector(_("Select a file"), "", "",
+ temp->GetDefaultExtension(),
+ temp->GetFileFilter(),
+ 0, wxTheApp->GetTopWindow());
+
+ if (pathTmp)
+ {
+ path = pathTmp;
+ return temp;
+ }
+ else
+ return (wxDocTemplate *) NULL;
+#endif // 0