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
This commit is contained in:
Georg Baum 2015-07-16 20:44:47 +02:00
parent d87ce2c91f
commit 0cbcc8a166
28 changed files with 48 additions and 219 deletions

View File

@ -11,6 +11,10 @@ adjustments are made to tex2lyx and bugs are fixed in lyx2lyx.
-----------------------
2015-07-16 Georg Baum <Georg.Baum@post.rwth-aachen.de>
* Format incremented to 496
Remove noUnzip parameter of InsetGraphics
2015-05-24 Jürgen Spitzmüller <spitz@lyx.org>
* Format incremented to 495: Rename sub: refprefix to subsec: in order
to prevent clash of \\subref command with subfloat package.

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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))
]
####################################################################

View File

@ -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]],

View File

@ -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<string>(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);

View File

@ -454,16 +454,6 @@
<property name="spacing" >
<number>6</number>
</property>
<item row="2" column="0" colspan="3" >
<widget class="QCheckBox" name="unzipCB" >
<property name="toolTip" >
<string>Don't uncompress image before exporting to LaTeX</string>
</property>
<property name="text" >
<string>Don't un&amp;zip on export</string>
</property>
</widget>
</item>
<item row="0" column="2" >
<spacer>
<property name="orientation" >
@ -810,7 +800,6 @@
<tabstop>getPB</tabstop>
<tabstop>latexoptions</tabstop>
<tabstop>draftCB</tabstop>
<tabstop>unzipCB</tabstop>
<tabstop>displayGB</tabstop>
</tabstops>
<includes>

View File

@ -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);

View File

@ -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") {

View File

@ -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;

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.2
\lyxformat 495
\lyxformat 496
\begin_document
\begin_header
\origin roundtrip

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.2
\lyxformat 495
\lyxformat 496
\begin_document
\begin_header
\origin roundtrip

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.2
\lyxformat 495
\lyxformat 496
\begin_document
\begin_header
\origin roundtrip

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.2
\lyxformat 495
\lyxformat 496
\begin_document
\begin_header
\origin roundtrip

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.2
\lyxformat 495
\lyxformat 496
\begin_document
\begin_header
\origin roundtrip

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.2
\lyxformat 495
\lyxformat 496
\begin_document
\begin_header
\origin roundtrip

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.2
\lyxformat 495
\lyxformat 496
\begin_document
\begin_header
\origin roundtrip

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.2
\lyxformat 495
\lyxformat 496
\begin_document
\begin_header
\origin roundtrip

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.2
\lyxformat 495
\lyxformat 496
\begin_document
\begin_header
\origin roundtrip

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.2
\lyxformat 495
\lyxformat 496
\begin_document
\begin_header
\origin roundtrip

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.2
\lyxformat 495
\lyxformat 496
\begin_document
\begin_header
\origin roundtrip

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.2
\lyxformat 495
\lyxformat 496
\begin_document
\begin_header
\origin roundtrip

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.2
\lyxformat 495
\lyxformat 496
\begin_document
\begin_header
\origin roundtrip

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.2
\lyxformat 495
\lyxformat 496
\begin_document
\begin_header
\origin roundtrip

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.2
\lyxformat 495
\lyxformat 496
\begin_document
\begin_header
\origin roundtrip

View File

@ -1,5 +1,5 @@
#LyX file created by tex2lyx 2.2
\lyxformat 495
\lyxformat 496
\begin_document
\begin_header
\origin roundtrip

View File

@ -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