break;
}
+ case LFUN_MOUSE_RELEASE: {
+ if (cmd.modifier() == ControlModifier) {
+ FileName const incfile = includedFileName(buffer(), params());
+ string const & incname = incfile.absFileName();
+ editIncluded(incname);
+ break;
+ }
+ }
+ // fall through
+
//pass everything else up the chain
default:
InsetCommand::doDispatch(cur, cmd);
}
-void InsetInclude::editIncluded(string const & file)
+void InsetInclude::editIncluded(string const & f)
{
- string const ext = support::getExtension(file);
- if (ext == "lyx") {
- FuncRequest fr(LFUN_BUFFER_CHILD_OPEN, file);
+ if (isLyXFileName(f)) {
+ FuncRequest fr(LFUN_BUFFER_CHILD_OPEN, f);
lyx::dispatch(fr);
} else
// tex file or other text file in verbatim mode
theFormats().edit(buffer(),
- support::makeAbsPath(file, support::onlyPath(buffer().absFileName())),
+ support::makeAbsPath(f, support::onlyPath(buffer().absFileName())),
"text");
}
temp = buffer().B_("Input");
break;
case VERB:
- temp = buffer().B_("Verbatim Input");
+ temp = buffer().B_("Verbatim");
break;
case VERBAST:
- temp = buffer().B_("Verbatim Input*");
+ temp = buffer().B_("Verbatim*");
break;
case INCLUDE:
if (isChildIncluded())
Buffer * child = theBufferList().getBuffer(included_file);
if (!child) {
// the readonly flag can/will be wrong, not anymore I think.
- if (!included_file.exists())
+ if (!included_file.exists()) {
+ failedtoload_ = true;
return 0;
+ }
child = theBufferList().newBuffer(included_file.absFileName());
if (!child)
string exppath = incfile;
if (!runparams.export_folder.empty()) {
exppath = makeAbsPath(exppath, runparams.export_folder).realPath();
- FileName(exppath).onlyPath().createPath();
}
// write it to a file (so far the complete file)
Language const * const oldLang = runparams.master_language;
// If the master uses non-TeX fonts (XeTeX, LuaTeX),
// the children must be encoded in plain utf8!
- runparams.encoding = masterBuffer->params().useNonTeXFonts ?
- encodings.fromLyXName("utf8-plain") : oldEnc;
+ if (masterBuffer->params().useNonTeXFonts)
+ runparams.encoding = encodings.fromLyXName("utf8-plain");
+ else if (oldEnc)
+ runparams.encoding = oldEnc;
+ else runparams.encoding = &tmp->params().encoding();
runparams.master_language = buffer().params().language;
runparams.par_begin = 0;
runparams.par_end = tmp->paragraphs().size();
// If needed, use converters to produce a latex file from the child
if (tmpwritefile != writefile) {
ErrorList el;
- Converters::RetVal const retval =
+ Converters::RetVal const conv_retval =
theConverters().convert(tmp, tmpwritefile, writefile,
included_file, inc_format, tex_format, el);
- if (retval == Converters::KILLED && buffer().isClone() &&
+ if (conv_retval == Converters::KILLED && buffer().isClone() &&
buffer().isExporting()) {
// We really shouldn't get here, I don't think.
LYXERR0("No conversion exception?");
throw ConversionException();
- } else if (retval != Converters::SUCCESS && !runparams.silent) {
+ } else if (conv_retval != Converters::SUCCESS && !runparams.silent) {
docstring msg = bformat(_("Included file `%1$s' "
"was not exported correctly.\n "
"LaTeX export is probably incomplete."),
b.pushItem(cpit, screenLabel(), output_active);
InsetListingsParams p(to_utf8(params()["lstparams"]));
b.argumentItem(from_utf8(p.getParamValue("caption")));
- b.pop();
- } else {
+ b.pop();
+ } else if (isVerbatim(params())) {
+ TocBuilder & b = backend.builder("child");
+ b.pushItem(cpit, screenLabel(), output_active);
+ b.pop();
+ } else {
Buffer const * const childbuffer = getChildBuffer();
TocBuilder & b = backend.builder("child");