+ return !filenameED->text().isEmpty() && validate_listings_params().empty();
+}
+
+
+docstring GuiInclude::browse(docstring const & in_name, Type in_type) const
+{
+ docstring const title = _("Select document to include");
+
+ // input TeX, verbatim, or LyX file ?
+ FileFilterList filters;
+ switch (in_type) {
+ case INCLUDE:
+ case INPUT:
+ filters = FileFilterList(_("LaTeX/LyX Documents (*.tex *.lyx)"));
+ break;
+ case VERBATIM:
+ case LISTINGS:
+ break;
+ }
+
+ docstring const docpath = from_utf8(onlyPath(buffer().absFileName()));
+
+ return browseRelFile(in_name, docpath, title, filters, false,
+ _("Documents|#o#O"), from_utf8(lyxrc.document_path));
+}
+
+
+void GuiInclude::edit(string const & file)
+{
+ string const ext = support::getExtension(file);
+ if (ext == "lyx")
+ dispatch(FuncRequest(LFUN_BUFFER_CHILD_OPEN, file));
+ else
+ // tex file or other text file in verbatim mode
+ formats.edit(buffer(),
+ makeAbsPath(file, onlyPath(buffer().absFileName())),
+ "text");