]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetInclude.cpp
Do not output deleted rows columns if show changes in output is false
[lyx.git] / src / insets / InsetInclude.cpp
old mode 100755 (executable)
new mode 100644 (file)
index 87a8173..09d4be3
@@ -318,6 +318,16 @@ void InsetInclude::doDispatch(Cursor & cur, FuncRequest & cmd)
                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);
@@ -326,16 +336,15 @@ void InsetInclude::doDispatch(Cursor & cur, FuncRequest & 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");
 }
 
@@ -401,10 +410,10 @@ docstring InsetInclude::screenLabel() const
                        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())
@@ -471,8 +480,10 @@ Buffer * InsetInclude::loadIfNeeded() const
        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)
@@ -563,7 +574,6 @@ void InsetInclude::latex(otexstream & os, OutputParams const & runparams) const
        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)
@@ -840,9 +850,11 @@ void InsetInclude::latex(otexstream & os, OutputParams const & runparams) const
                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")
-                       : &tmp->params().encoding();
+               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();
@@ -876,15 +888,15 @@ void InsetInclude::latex(otexstream & os, OutputParams const & runparams) const
                // 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."),
@@ -1306,8 +1318,12 @@ void InsetInclude::addToToc(DocIterator const & cpit, bool output_active,
                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");