From 0cbcc8a166d0fd798478bddf8c078819f1193bc9 Mon Sep 17 00:00:00 2001 From: Georg Baum Date: Thu, 16 Jul 2015 20:44:47 +0200 Subject: [PATCH] Remove InsetGraphics noUnzip parameter Being able to compile document with zipped .eps files was a useful feature of the graphicxs package 20 years ago, but the LyX support is no longer relevant: - The flag is ignored if preview is on - If pdflatex is used then uncompressing happens during the compilation anyway - If set, the flag prevents LyX from issuing proper error messages if something with the image is wrong - For hard disk capacities from 20 years ago not uncompressing is a useful feature, but for current hard disk capacities it does not matter - The external inset does not have it, and if we want to merge both insets one day we would need to implement it there, which is even more difficult than in InsetGraphics --- development/FORMAT | 4 + lib/doc/EmbeddedObjects.lyx | 82 ------------------- lib/doc/UserGuide.lyx | 29 ------- lib/doc/id/UserGuide.lyx | 25 ------ lib/lyx2lyx/LyX.py | 2 +- lib/lyx2lyx/lyx_2_2.py | 26 +++++- src/frontends/qt4/GuiGraphics.cpp | 6 -- src/frontends/qt4/ui/GraphicsUi.ui | 11 --- src/insets/InsetGraphics.cpp | 37 --------- src/insets/InsetGraphicsParams.cpp | 7 -- src/insets/InsetGraphicsParams.h | 2 - src/tex2lyx/test/CJK.lyx.lyx | 2 +- src/tex2lyx/test/CJKutf8.lyx.lyx | 2 +- src/tex2lyx/test/DummyDocument.lyx.lyx | 2 +- src/tex2lyx/test/Dummy~Document.lyx.lyx | 2 +- src/tex2lyx/test/XeTeX-polyglossia.lyx.lyx | 2 +- src/tex2lyx/test/algo2e.lyx.lyx | 2 +- .../test/box-color-size-space-align.lyx.lyx | 2 +- src/tex2lyx/test/test-insets-basic.lyx.lyx | 2 +- src/tex2lyx/test/test-insets.lyx.lyx | 2 +- src/tex2lyx/test/test-memoir.lyx.lyx | 2 +- src/tex2lyx/test/test-modules.lyx.lyx | 2 +- .../test/test-refstyle-theorems.lyx.lyx | 2 +- src/tex2lyx/test/test-scr.lyx.lyx | 2 +- src/tex2lyx/test/test-structure.lyx.lyx | 2 +- src/tex2lyx/test/test.lyx.lyx | 2 +- src/tex2lyx/test/verbatim.lyx.lyx | 2 +- src/version.h | 4 +- 28 files changed, 48 insertions(+), 219 deletions(-) diff --git a/development/FORMAT b/development/FORMAT index 770ceaa40d..f1a513a9e0 100644 --- a/development/FORMAT +++ b/development/FORMAT @@ -11,6 +11,10 @@ adjustments are made to tex2lyx and bugs are fixed in lyx2lyx. ----------------------- +2015-07-16 Georg Baum + * Format incremented to 496 + Remove noUnzip parameter of InsetGraphics + 2015-05-24 Jürgen Spitzmüller * Format incremented to 495: Rename sub: refprefix to subsec: in order to prevent clash of \\subref command with subfloat package. diff --git a/lib/doc/EmbeddedObjects.lyx b/lib/doc/EmbeddedObjects.lyx index 94502877ed..33180fd35b 100644 --- a/lib/doc/EmbeddedObjects.lyx +++ b/lib/doc/EmbeddedObjects.lyx @@ -603,88 +603,6 @@ mode \begin_inset Newline newline \end_inset -The -\family sans -Don't -\begin_inset space ~ -\end_inset - -unzip -\begin_inset space ~ -\end_inset - -on -\begin_inset space ~ -\end_inset - -export -\family default - option only affects zipped EPS-graphics, e. -\begin_inset space \thinspace{} -\end_inset - -g. -\begin_inset space \space{} -\end_inset - - -\emph on -x.eps.gz -\emph default -. - When the option is used the images will not be unzipped on export, since - \SpecialChar LaTeX - can handle them as they are. -\begin_inset Newline newline -\end_inset - -Zipped EPS-graphics are useful to save disk space when you choose PostScript - as output format, see appendix -\begin_inset space ~ -\end_inset - - -\begin_inset CommandInset ref -LatexCommand ref -reference "sec:PostScript" - -\end_inset - -. - To zip EPS-graphics, use the following commands in a UNIX-shell or a Windows - console: -\begin_inset Newline newline -\end_inset - - -\series bold -gzip x.eps -\series default - -\begin_inset Newline newline -\end_inset - - -\series bold -zgrep %%Bounding x.eps.gz > x.eps.bb -\series default - -\begin_inset Newline newline -\end_inset - -The second command creates the bounding box file -\begin_inset Quotes eld -\end_inset - -x.eps.bb -\begin_inset Quotes erd -\end_inset - - that is needed by \SpecialChar LaTeX - for zipped graphics. -\begin_inset Newline newline -\end_inset - In the section \family sans Graphics diff --git a/lib/doc/UserGuide.lyx b/lib/doc/UserGuide.lyx index 9facac2600..12cd21d7ee 100644 --- a/lib/doc/UserGuide.lyx +++ b/lib/doc/UserGuide.lyx @@ -18355,35 +18355,6 @@ mode \family default has the effect that the image doesn't appear in the output, only a frame with the image size is printed. - The option -\family sans -Don't -\begin_inset space ~ -\end_inset - -unzip -\begin_inset space ~ -\end_inset - -on -\begin_inset space ~ -\end_inset - -export -\family default - is explained in the -\emph on -Embedded -\begin_inset space ~ -\end_inset - -Objects -\emph default - manual in section -\emph on -Graphics Dialog -\emph default -. \end_layout \begin_layout Standard diff --git a/lib/doc/id/UserGuide.lyx b/lib/doc/id/UserGuide.lyx index 505f0c38e0..0817500d16 100644 --- a/lib/doc/id/UserGuide.lyx +++ b/lib/doc/id/UserGuide.lyx @@ -17110,31 +17110,6 @@ mode \family default has the effect that the image doesn't appear in the output, only a frame with the image size is printed. - The option -\family sans -Don't -\begin_inset space ~ -\end_inset - -unzip -\begin_inset space ~ -\end_inset - -on -\begin_inset space ~ -\end_inset - -export -\family default - is explained in the -\emph on -Embedded Objects -\emph default - manual in section -\emph on -Graphics Dialog -\emph default -. \end_layout \begin_layout Standard diff --git a/lib/lyx2lyx/LyX.py b/lib/lyx2lyx/LyX.py index 73818fa827..1beccdba1b 100644 --- a/lib/lyx2lyx/LyX.py +++ b/lib/lyx2lyx/LyX.py @@ -85,7 +85,7 @@ format_relation = [("0_06", [200], minor_versions("0.6" , 4)), ("1_6", list(range(277,346)), minor_versions("1.6" , 10)), ("2_0", list(range(346,414)), minor_versions("2.0" , 8)), ("2_1", list(range(414,475)), minor_versions("2.1" , 0)), - ("2_2", list(range(475,496)), minor_versions("2.2" , 0)) + ("2_2", list(range(475,497)), minor_versions("2.2" , 0)) ] #################################################################### diff --git a/lib/lyx2lyx/lyx_2_2.py b/lib/lyx2lyx/lyx_2_2.py index 65b1268538..aa13aa63b8 100644 --- a/lib/lyx2lyx/lyx_2_2.py +++ b/lib/lyx2lyx/lyx_2_2.py @@ -1505,6 +1505,28 @@ def revert_subref(document): i += 1 +def convert_nounzip(document): + " remove the noUnzip parameter of graphics insets " + + rx = re.compile(r'\s*noUnzip\s*$') + i = 0 + while True: + i = find_token(document.body, "\\begin_inset Graphics", i) + if i == -1: + break + j = find_end_of_inset(document.body, i) + if j == -1: + document.warning("Malformed LyX document: Can't find end of graphics inset at line " + str(i)) + i += 1 + continue + + k = find_re(document.body, rx, i, j) + if k != -1: + del document.body[k] + j = j - 1 + i = j + 1 + + ## # Conversion hub # @@ -1534,10 +1556,12 @@ convert = [ [492, [convert_colorbox]], [493, []], [494, []], - [495, [convert_subref]] + [495, [convert_subref]], + [496, [convert_nounzip]] ] revert = [ + [495, []], # nothing to do since the noUnzip parameter was optional [494, [revert_subref]], [493, [revert_jss]], [492, [revert_mathmulticol]], diff --git a/src/frontends/qt4/GuiGraphics.cpp b/src/frontends/qt4/GuiGraphics.cpp index 04f768567f..979cd2774e 100644 --- a/src/frontends/qt4/GuiGraphics.cpp +++ b/src/frontends/qt4/GuiGraphics.cpp @@ -196,8 +196,6 @@ GuiGraphics::GuiGraphics(GuiView & lv) this, SLOT(change_adaptor())); connect(draftCB, SIGNAL(stateChanged(int)), this, SLOT(change_adaptor())); - connect(unzipCB, SIGNAL(stateChanged(int)), - this, SLOT(change_adaptor())); // FIXME: we should connect to clicked() when we move to Qt 4.2 because // the toggled(bool) signal is also trigged when we update the widgets // (rgh-4/07) this isn't as much or a problem as it was, because we're now @@ -223,11 +221,9 @@ GuiGraphics::GuiGraphics(GuiView & lv) bc().addReadOnly(filenameL); bc().addReadOnly(filename); bc().addReadOnly(browsePB); - bc().addReadOnly(unzipCB); bc().addReadOnly(bbFrame); bc().addReadOnly(draftCB); bc().addReadOnly(clip); - bc().addReadOnly(unzipCB); bc().addReadOnly(displayGB); bc().addReadOnly(sizeGB); bc().addReadOnly(rotationGB); @@ -582,7 +578,6 @@ void GuiGraphics::paramsToDialog(InsetGraphicsParams const & igp) // Update the draft and clip mode draftCB->setChecked(igp.draft); clip->setChecked(igp.clip); - unzipCB->setChecked(igp.noUnzip); displayGB->setChecked(igp.display); displayscale->setText(toqstr(convert(igp.lyxscale))); @@ -732,7 +727,6 @@ void GuiGraphics::applyView() igp.keepAspectRatio = aspectratio->isChecked(); } - igp.noUnzip = unzipCB->isChecked(); igp.lyxscale = displayscale->text().toInt(); igp.rotateAngle = widgetToDoubleStr(angle); diff --git a/src/frontends/qt4/ui/GraphicsUi.ui b/src/frontends/qt4/ui/GraphicsUi.ui index 5ee064c2a3..3942651e83 100644 --- a/src/frontends/qt4/ui/GraphicsUi.ui +++ b/src/frontends/qt4/ui/GraphicsUi.ui @@ -454,16 +454,6 @@ 6 - - - - Don't uncompress image before exporting to LaTeX - - - Don't un&zip on export - - - @@ -810,7 +800,6 @@ getPB latexoptions draftCB - unzipCB displayGB diff --git a/src/insets/InsetGraphics.cpp b/src/insets/InsetGraphics.cpp index 25726690f8..b3293ce37c 100644 --- a/src/insets/InsetGraphics.cpp +++ b/src/insets/InsetGraphics.cpp @@ -627,44 +627,7 @@ string InsetGraphics::prepareFile(OutputParams const & runparams) const // determine the export format string const tex_format = flavor2format(runparams.flavor); - // If the file is compressed and we have specified that it - // should not be uncompressed, then just return its name and - // let LaTeX do the rest! if (formats.isZippedFile(params().filename)) { - if (params().noUnzip) { - // We don't know whether latex can actually handle - // this file, but we can't check, because that would - // mean to unzip the file and thereby making the - // noUnzip parameter meaningless. - LYXERR(Debug::GRAPHICS, "\tpass zipped file to LaTeX."); - - FileName const bb_orig_file = - FileName(changeExtension(orig_file, "bb")); - if (runparams.nice) { - runparams.exportdata->addExternalFile(tex_format, - bb_orig_file, - changeExtension(output_file, "bb")); - } else { - // LaTeX needs the bounding box file in the - // tmp dir - FileName bb_file = - FileName(changeExtension(temp_file.absFileName(), "bb")); - boost::tie(status, bb_file) = - copyFileIfNeeded(bb_orig_file, bb_file); - if (status == FAILURE) - return orig_file; - runparams.exportdata->addExternalFile(tex_format, - bb_file); - } - runparams.exportdata->addExternalFile(tex_format, - source_file, output_file); - runparams.exportdata->addExternalFile("dvi", - source_file, output_file); - // We can't strip the extension, because we don't know - // the unzipped file format - return latex_path(output_file, EXCLUDE_EXTENSION); - } - FileName const unzipped_temp_file = FileName(unzippedFileName(temp_file.absFileName())); output_file = unzippedFileName(output_file); diff --git a/src/insets/InsetGraphicsParams.cpp b/src/insets/InsetGraphicsParams.cpp index f4cd119f6e..1a03fdd391 100644 --- a/src/insets/InsetGraphicsParams.cpp +++ b/src/insets/InsetGraphicsParams.cpp @@ -70,7 +70,6 @@ void InsetGraphicsParams::init() height = Length(); keepAspectRatio = false; // for LaTeX output draft = false; // draft mode - noUnzip = false; // unzip files scaleBeforeRotation = false; // scale image before rotating bb = string(); // bounding box @@ -93,7 +92,6 @@ void InsetGraphicsParams::copy(InsetGraphicsParams const & igp) height = igp.height; keepAspectRatio = igp.keepAspectRatio; draft = igp.draft; - noUnzip = igp.noUnzip; scaleBeforeRotation = igp.scaleBeforeRotation; bb = igp.bb; @@ -117,7 +115,6 @@ bool operator==(InsetGraphicsParams const & left, left.height == right.height && left.keepAspectRatio == right.keepAspectRatio && left.draft == right.draft && - left.noUnzip == right.noUnzip && left.scaleBeforeRotation == right.scaleBeforeRotation && left.bb == right.bb && @@ -160,8 +157,6 @@ void InsetGraphicsParams::Write(ostream & os, Buffer const & buffer) const os << "\tkeepAspectRatio\n"; if (draft) // draft mode os << "\tdraft\n"; - if (noUnzip) - os << "\tnoUnzip\n"; if (scaleBeforeRotation) os << "\tscaleBeforeRotation\n"; @@ -209,8 +204,6 @@ bool InsetGraphicsParams::Read(Lexer & lex, string const & token, string const & keepAspectRatio = true; } else if (token == "draft") { draft = true; - } else if (token == "noUnzip") { - noUnzip = true; } else if (token == "scaleBeforeRotation") { scaleBeforeRotation = true; } else if (token == "BoundingBox") { diff --git a/src/insets/InsetGraphicsParams.h b/src/insets/InsetGraphicsParams.h index 33471bf643..4e40dd703f 100644 --- a/src/insets/InsetGraphicsParams.h +++ b/src/insets/InsetGraphicsParams.h @@ -48,8 +48,6 @@ public: bool keepAspectRatio; /// draft mode bool draft; - /// what to do with zipped files - bool noUnzip; /// scale image before rotating bool scaleBeforeRotation; diff --git a/src/tex2lyx/test/CJK.lyx.lyx b/src/tex2lyx/test/CJK.lyx.lyx index c1087e09ac..3c3dfff96e 100644 --- a/src/tex2lyx/test/CJK.lyx.lyx +++ b/src/tex2lyx/test/CJK.lyx.lyx @@ -1,5 +1,5 @@ #LyX file created by tex2lyx 2.2 -\lyxformat 495 +\lyxformat 496 \begin_document \begin_header \origin roundtrip diff --git a/src/tex2lyx/test/CJKutf8.lyx.lyx b/src/tex2lyx/test/CJKutf8.lyx.lyx index 4eb58a7565..0e75b843f5 100644 --- a/src/tex2lyx/test/CJKutf8.lyx.lyx +++ b/src/tex2lyx/test/CJKutf8.lyx.lyx @@ -1,5 +1,5 @@ #LyX file created by tex2lyx 2.2 -\lyxformat 495 +\lyxformat 496 \begin_document \begin_header \origin roundtrip diff --git a/src/tex2lyx/test/DummyDocument.lyx.lyx b/src/tex2lyx/test/DummyDocument.lyx.lyx index bc23e3aa56..422680732f 100644 --- a/src/tex2lyx/test/DummyDocument.lyx.lyx +++ b/src/tex2lyx/test/DummyDocument.lyx.lyx @@ -1,5 +1,5 @@ #LyX file created by tex2lyx 2.2 -\lyxformat 495 +\lyxformat 496 \begin_document \begin_header \origin roundtrip diff --git a/src/tex2lyx/test/Dummy~Document.lyx.lyx b/src/tex2lyx/test/Dummy~Document.lyx.lyx index 7a00ca908a..1286c36946 100644 --- a/src/tex2lyx/test/Dummy~Document.lyx.lyx +++ b/src/tex2lyx/test/Dummy~Document.lyx.lyx @@ -1,5 +1,5 @@ #LyX file created by tex2lyx 2.2 -\lyxformat 495 +\lyxformat 496 \begin_document \begin_header \origin roundtrip diff --git a/src/tex2lyx/test/XeTeX-polyglossia.lyx.lyx b/src/tex2lyx/test/XeTeX-polyglossia.lyx.lyx index 5e843d1169..18d89eb0fc 100644 --- a/src/tex2lyx/test/XeTeX-polyglossia.lyx.lyx +++ b/src/tex2lyx/test/XeTeX-polyglossia.lyx.lyx @@ -1,5 +1,5 @@ #LyX file created by tex2lyx 2.2 -\lyxformat 495 +\lyxformat 496 \begin_document \begin_header \origin roundtrip diff --git a/src/tex2lyx/test/algo2e.lyx.lyx b/src/tex2lyx/test/algo2e.lyx.lyx index a8b2c406b7..580743dd63 100644 --- a/src/tex2lyx/test/algo2e.lyx.lyx +++ b/src/tex2lyx/test/algo2e.lyx.lyx @@ -1,5 +1,5 @@ #LyX file created by tex2lyx 2.2 -\lyxformat 495 +\lyxformat 496 \begin_document \begin_header \origin roundtrip diff --git a/src/tex2lyx/test/box-color-size-space-align.lyx.lyx b/src/tex2lyx/test/box-color-size-space-align.lyx.lyx index 70a523cffb..ece2d4e9c4 100644 --- a/src/tex2lyx/test/box-color-size-space-align.lyx.lyx +++ b/src/tex2lyx/test/box-color-size-space-align.lyx.lyx @@ -1,5 +1,5 @@ #LyX file created by tex2lyx 2.2 -\lyxformat 495 +\lyxformat 496 \begin_document \begin_header \origin roundtrip diff --git a/src/tex2lyx/test/test-insets-basic.lyx.lyx b/src/tex2lyx/test/test-insets-basic.lyx.lyx index e3b1ddc242..a87825cb0d 100644 --- a/src/tex2lyx/test/test-insets-basic.lyx.lyx +++ b/src/tex2lyx/test/test-insets-basic.lyx.lyx @@ -1,5 +1,5 @@ #LyX file created by tex2lyx 2.2 -\lyxformat 495 +\lyxformat 496 \begin_document \begin_header \origin roundtrip diff --git a/src/tex2lyx/test/test-insets.lyx.lyx b/src/tex2lyx/test/test-insets.lyx.lyx index 23a82b77ff..392f1248d1 100644 --- a/src/tex2lyx/test/test-insets.lyx.lyx +++ b/src/tex2lyx/test/test-insets.lyx.lyx @@ -1,5 +1,5 @@ #LyX file created by tex2lyx 2.2 -\lyxformat 495 +\lyxformat 496 \begin_document \begin_header \origin roundtrip diff --git a/src/tex2lyx/test/test-memoir.lyx.lyx b/src/tex2lyx/test/test-memoir.lyx.lyx index 70896f4920..624d75a5f7 100644 --- a/src/tex2lyx/test/test-memoir.lyx.lyx +++ b/src/tex2lyx/test/test-memoir.lyx.lyx @@ -1,5 +1,5 @@ #LyX file created by tex2lyx 2.2 -\lyxformat 495 +\lyxformat 496 \begin_document \begin_header \origin roundtrip diff --git a/src/tex2lyx/test/test-modules.lyx.lyx b/src/tex2lyx/test/test-modules.lyx.lyx index f661dcffa4..4220eff9ad 100644 --- a/src/tex2lyx/test/test-modules.lyx.lyx +++ b/src/tex2lyx/test/test-modules.lyx.lyx @@ -1,5 +1,5 @@ #LyX file created by tex2lyx 2.2 -\lyxformat 495 +\lyxformat 496 \begin_document \begin_header \origin roundtrip diff --git a/src/tex2lyx/test/test-refstyle-theorems.lyx.lyx b/src/tex2lyx/test/test-refstyle-theorems.lyx.lyx index 63e553f3af..bce3f15e3a 100644 --- a/src/tex2lyx/test/test-refstyle-theorems.lyx.lyx +++ b/src/tex2lyx/test/test-refstyle-theorems.lyx.lyx @@ -1,5 +1,5 @@ #LyX file created by tex2lyx 2.2 -\lyxformat 495 +\lyxformat 496 \begin_document \begin_header \origin roundtrip diff --git a/src/tex2lyx/test/test-scr.lyx.lyx b/src/tex2lyx/test/test-scr.lyx.lyx index cca36f9912..9802206cbd 100644 --- a/src/tex2lyx/test/test-scr.lyx.lyx +++ b/src/tex2lyx/test/test-scr.lyx.lyx @@ -1,5 +1,5 @@ #LyX file created by tex2lyx 2.2 -\lyxformat 495 +\lyxformat 496 \begin_document \begin_header \origin roundtrip diff --git a/src/tex2lyx/test/test-structure.lyx.lyx b/src/tex2lyx/test/test-structure.lyx.lyx index 3205f42232..ed63454817 100644 --- a/src/tex2lyx/test/test-structure.lyx.lyx +++ b/src/tex2lyx/test/test-structure.lyx.lyx @@ -1,5 +1,5 @@ #LyX file created by tex2lyx 2.2 -\lyxformat 495 +\lyxformat 496 \begin_document \begin_header \origin roundtrip diff --git a/src/tex2lyx/test/test.lyx.lyx b/src/tex2lyx/test/test.lyx.lyx index 6bcceaf171..380fec7c46 100644 --- a/src/tex2lyx/test/test.lyx.lyx +++ b/src/tex2lyx/test/test.lyx.lyx @@ -1,5 +1,5 @@ #LyX file created by tex2lyx 2.2 -\lyxformat 495 +\lyxformat 496 \begin_document \begin_header \origin roundtrip diff --git a/src/tex2lyx/test/verbatim.lyx.lyx b/src/tex2lyx/test/verbatim.lyx.lyx index bee461c291..cac06b293e 100644 --- a/src/tex2lyx/test/verbatim.lyx.lyx +++ b/src/tex2lyx/test/verbatim.lyx.lyx @@ -1,5 +1,5 @@ #LyX file created by tex2lyx 2.2 -\lyxformat 495 +\lyxformat 496 \begin_document \begin_header \origin roundtrip diff --git a/src/version.h b/src/version.h index 79ea6cc901..4caaf1ce98 100644 --- a/src/version.h +++ b/src/version.h @@ -32,8 +32,8 @@ extern char const * const lyx_version_info; // Do not remove the comment below, so we get merge conflict in // independent branches. Instead add your own. -#define LYX_FORMAT_LYX 495 // spitz: subsection ref prefix change -#define LYX_FORMAT_TEX2LYX 495 +#define LYX_FORMAT_LYX 496 // gb: remove noUnzip parameter of InsetGraphics +#define LYX_FORMAT_TEX2LYX 496 #if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX #ifndef _MSC_VER -- 2.39.5