Am Sonntag, 8. Januar 2006 19:54 schrieb Lars Gullik Bjønnes: > can you attach the patch please?
Here it is again. Georg
Index: src/ChangeLog =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/ChangeLog,v retrieving revision 1.2352 diff -u -p -r1.2352 ChangeLog --- src/ChangeLog 4 Jan 2006 14:24:39 -0000 1.2352 +++ src/ChangeLog 7 Jan 2006 12:18:37 -0000 @@ -1,3 +1,7 @@ +2006-01-07 Georg Baum <[EMAIL PROTECTED]> + + * outputparams.[Ch]: add new flag inComment + 2006-01-04 Jean-Marc Lasgouttes <[EMAIL PROTECTED]> * text2.C (deleteEmptyParagraphMechanism): since we delete a Index: src/outputparams.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/outputparams.C,v retrieving revision 1.4 diff -u -p -r1.4 outputparams.C --- src/outputparams.C 9 Sep 2005 11:04:52 -0000 1.4 +++ src/outputparams.C 7 Jan 2006 12:18:37 -0000 @@ -18,7 +18,8 @@ OutputParams::OutputParams() : flavor(LATEX), nice(false), moving_arg(false), local_font(0), free_spacing(false), use_babel(false), linelen(0), depth(0), - exportdata(new ExportData) + exportdata(new ExportData), + inComment(false) {} Index: src/outputparams.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/outputparams.h,v retrieving revision 1.14 diff -u -p -r1.14 outputparams.h --- src/outputparams.h 9 Sep 2005 11:04:52 -0000 1.14 +++ src/outputparams.h 7 Jan 2006 12:18:37 -0000 @@ -89,6 +89,14 @@ public: OutputParams instances. */ boost::shared_ptr<ExportData> exportdata; + + /** Whether we are inside a comment inset. Insets that are including + * external files like InsetGraphics, InsetInclude and InsetExternal + * may only write the usual output and must not attempt to do + * something with the included files (e.g. copying, converting) + * if this flag is true, since they may not exist. + */ + bool inComment; }; #endif // NOT OUTPUTPARAMS_H Index: src/insets/ChangeLog =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/ChangeLog,v retrieving revision 1.1210 diff -u -p -r1.1210 ChangeLog --- src/insets/ChangeLog 1 Jan 2006 20:28:04 -0000 1.1210 +++ src/insets/ChangeLog 7 Jan 2006 12:18:39 -0000 @@ -1,3 +1,16 @@ +2006-01-07 Georg Baum <[EMAIL PROTECTED]> + + * ExternalSupport.[Ch] (updateExternal): add external_in_comment flag + * insetexternal.C (latex, linuxdoc, docbook, plaintext): Don't copy + files inside comments + * insetbibtex.C (latex): ditto + * insetinclude.C (latex, linuxdoc, docbook, plaintext): ditto + * insetnote.C (latex): set inComment flag in runparams and ignore + exported files for comment insets + * insetnote.C (linuxdoc): ditto + * insetnote.C (docbook): ditto + * insetnote.C (plaintext): ditto + 2006-01-01 <[EMAIL PROTECTED]> * insetcharstyle.h: fix syntax error Index: src/insets/ExternalSupport.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/ExternalSupport.C,v retrieving revision 1.21 diff -u -p -r1.21 ExternalSupport.C --- src/insets/ExternalSupport.C 10 Jul 2005 09:31:27 -0000 1.21 +++ src/insets/ExternalSupport.C 7 Jan 2006 12:18:40 -0000 @@ -333,7 +333,8 @@ int writeExternal(InsetExternalParams co string const & format, Buffer const & buffer, ostream & os, ExportData & exportdata, - bool external_in_tmpdir) + bool external_in_tmpdir, + bool external_in_comment) { Template const * const et_ptr = getTemplatePtr(params); if (!et_ptr) @@ -349,7 +350,9 @@ int writeExternal(InsetExternalParams co return 0; } - updateExternal(params, format, buffer, exportdata, external_in_tmpdir); + if (!external_in_comment) + updateExternal(params, format, buffer, exportdata, + external_in_tmpdir); bool const use_latex_path = format == "LaTeX"; string str = doSubstitution(params, buffer, cit->second.product, Index: src/insets/ExternalSupport.h =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/ExternalSupport.h,v retrieving revision 1.4 diff -u -p -r1.4 ExternalSupport.h --- src/insets/ExternalSupport.h 18 Apr 2005 17:43:10 -0000 1.4 +++ src/insets/ExternalSupport.h 7 Jan 2006 12:18:40 -0000 @@ -65,7 +65,8 @@ int writeExternal(InsetExternalParams co Buffer const &, std::ostream &, ExportData &, - bool external_in_tmpdir = false); + bool external_in_tmpdir, + bool external_in_comment); } // namespace external } // namespace lyx Index: src/insets/insetexternal.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetexternal.C,v retrieving revision 1.163 diff -u -p -r1.163 insetexternal.C --- src/insets/insetexternal.C 10 Jul 2005 09:31:27 -0000 1.163 +++ src/insets/insetexternal.C 7 Jan 2006 12:18:40 -0000 @@ -18,7 +18,6 @@ #include "insets/render_preview.h" #include "buffer.h" -#include "BufferView.h" #include "cursor.h" #include "debug.h" #include "dispatchresult.h" @@ -706,11 +705,13 @@ int InsetExternal::latex(Buffer const & return external::writeExternal(params_, "PDFLaTeX", buf, os, *(runparams.exportdata), - external_in_tmpdir); + external_in_tmpdir, + runparams.inComment); } return external::writeExternal(params_, "LaTeX", buf, os, *(runparams.exportdata), - external_in_tmpdir); + external_in_tmpdir, + runparams.inComment); } @@ -718,7 +719,8 @@ int InsetExternal::plaintext(Buffer cons OutputParams const & runparams) const { return external::writeExternal(params_, "Ascii", buf, os, - *(runparams.exportdata)); + *(runparams.exportdata), false, + runparams.inComment); } @@ -726,7 +728,8 @@ int InsetExternal::linuxdoc(Buffer const OutputParams const & runparams) const { return external::writeExternal(params_, "LinuxDoc", buf, os, - *(runparams.exportdata)); + *(runparams.exportdata), false, + runparams.inComment); } @@ -734,7 +737,8 @@ int InsetExternal::docbook(Buffer const OutputParams const & runparams) const { return external::writeExternal(params_, "DocBook", buf, os, - *(runparams.exportdata)); + *(runparams.exportdata), false, + runparams.inComment); } Index: src/insets/insetinclude.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetinclude.C,v retrieving revision 1.207 diff -u -p -r1.207 insetinclude.C --- src/insets/insetinclude.C 2 Aug 2005 22:31:56 -0000 1.207 +++ src/insets/insetinclude.C 7 Jan 2006 12:18:40 -0000 @@ -359,7 +359,10 @@ int InsetInclude::latex(Buffer const & b lyxerr[Debug::LATEX] << "exportfile:" << exportfile << endl; lyxerr[Debug::LATEX] << "writefile:" << writefile << endl; - if (loadIfNeeded(buffer, params_)) { + if (runparams.inComment) + // Don't try to load or copy the file + ; + else if (loadIfNeeded(buffer, params_)) { Buffer * tmp = bufferlist.getBuffer(included_file); if (tmp->params().textclass != m_buffer->params().textclass) { @@ -376,6 +379,7 @@ int InsetInclude::latex(Buffer const & b tmp->markDepClean(m_buffer->temppath()); #ifdef WITH_WARNINGS +#warning handle non existing files #warning Second argument is irrelevant! // since only_body is true, makeLaTeXFile will not look at second // argument. Should we set it to string(), or should makeLaTeXFile Index: src/insets/insetgraphics.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetgraphics.C,v retrieving revision 1.282 diff -u -p -r1.282 insetgraphics.C --- src/insets/insetgraphics.C 10 Jul 2005 09:31:27 -0000 1.282 +++ src/insets/insetgraphics.C 7 Jan 2006 12:18:40 -0000 @@ -578,10 +578,11 @@ string const InsetGraphics::prepareFile( // of include files Buffer const * m_buffer = buf.getMasterBuffer(); - // Return the output name if the file does not exist. + // Return the output name if we are inside a comment or the file does + // not exist. // We are not going to change the extension or using the name of the // temporary file, the code is already complicated enough. - if (!IsFileReadable(orig_file)) + if (runparams.inComment || !IsFileReadable(orig_file)) return params().filename.outputFilename(m_buffer->filePath()); // We place all temporary files in the master buffer's temp dir. Index: src/insets/insetbibtex.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetbibtex.C,v retrieving revision 1.57 diff -u -p -r1.57 insetbibtex.C --- src/insets/insetbibtex.C 18 Nov 2005 08:57:56 -0000 1.57 +++ src/insets/insetbibtex.C 7 Jan 2006 12:18:40 -0000 @@ -160,7 +160,8 @@ int InsetBibtex::latex(Buffer const & bu normalize_name(buffer, runparams, input, ".bib"); string const in_file = database + ".bib"; - if (!runparams.nice && IsFileReadable(in_file)) { + if (!runparams.inComment && !runparams.nice && + IsFileReadable(in_file)) { database = FileName(database).mangledFilename(); string const out_file = MakeAbsPath(database + ".bib", Index: src/insets/insetnote.C =================================================================== RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insetnote.C,v retrieving revision 1.81 diff -u -p -r1.81 insetnote.C --- src/insets/insetnote.C 9 May 2005 17:29:22 -0000 1.81 +++ src/insets/insetnote.C 7 Jan 2006 12:18:40 -0000 @@ -18,6 +18,7 @@ #include "cursor.h" #include "debug.h" #include "dispatchresult.h" +#include "exporter.h" #include "funcrequest.h" #include "FuncStatus.h" #include "gettext.h" @@ -25,6 +26,7 @@ #include "LColor.h" #include "lyxlex.h" #include "metricsinfo.h" +#include "outputparams.h" #include "paragraph.h" #include "support/lyxalgo.h" @@ -229,15 +231,19 @@ bool InsetNote::getStatus(LCursor & cur, int InsetNote::latex(Buffer const & buf, ostream & os, - OutputParams const & runparams) const + OutputParams const & runparams_in) const { if (params_.type == InsetNoteParams::Note) return 0; + OutputParams runparams(runparams_in); string type; - if (params_.type == InsetNoteParams::Comment) + if (params_.type == InsetNoteParams::Comment) { type = "comment"; - else if (params_.type == InsetNoteParams::Greyedout) + runparams.inComment = true; + // Ignore files that are exported inside a comment + runparams.exportdata.reset(new ExportData); + } else if (params_.type == InsetNoteParams::Greyedout) type = "lyxgreyedout"; ostringstream ss; @@ -253,14 +259,19 @@ int InsetNote::latex(Buffer const & buf, int InsetNote::linuxdoc(Buffer const & buf, std::ostream & os, - OutputParams const & runparams) const + OutputParams const & runparams_in) const { if (params_.type == InsetNoteParams::Note) return 0; + OutputParams runparams(runparams_in); ostringstream ss; - if (params_.type == InsetNoteParams::Comment) + if (params_.type == InsetNoteParams::Comment) { ss << "<comment>\n"; + runparams.inComment = true; + // Ignore files that are exported inside a comment + runparams.exportdata.reset(new ExportData); + } InsetText::linuxdoc(buf, ss, runparams); @@ -275,14 +286,19 @@ int InsetNote::linuxdoc(Buffer const & b int InsetNote::docbook(Buffer const & buf, std::ostream & os, - OutputParams const & runparams) const + OutputParams const & runparams_in) const { if (params_.type == InsetNoteParams::Note) return 0; + OutputParams runparams(runparams_in); ostringstream ss; - if (params_.type == InsetNoteParams::Comment) + if (params_.type == InsetNoteParams::Comment) { ss << "<remark>\n"; + runparams.inComment = true; + // Ignore files that are exported inside a comment + runparams.exportdata.reset(new ExportData); + } InsetText::docbook(buf, ss, runparams); @@ -297,11 +313,17 @@ int InsetNote::docbook(Buffer const & bu int InsetNote::plaintext(Buffer const & buf, std::ostream & os, - OutputParams const & runparams) const + OutputParams const & runparams_in) const { if (params_.type == InsetNoteParams::Note) return 0; + OutputParams runparams(runparams_in); + if (params_.type == InsetNoteParams::Comment) { + runparams.inComment = true; + // Ignore files that are exported inside a comment + runparams.exportdata.reset(new ExportData); + } ostringstream ss; ss << "["; InsetText::plaintext(buf, ss, runparams);