X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FInsetGraphics.cpp;h=94182a73269fa5585adf4cce8de06e6d5d149b59;hb=4947476da8d7e42ded2c53ee984dc4c38db1d528;hp=6e8ad051b864d8a57a04403fcfc7aa1667da940c;hpb=75bfed55079cab6b73fbea6ce4ae3f10d1af3b91;p=lyx.git diff --git a/src/insets/InsetGraphics.cpp b/src/insets/InsetGraphics.cpp index 6e8ad051b8..94182a7326 100644 --- a/src/insets/InsetGraphics.cpp +++ b/src/insets/InsetGraphics.cpp @@ -165,7 +165,7 @@ void readInsetGraphics(Lexer & lex, Buffer const & buf, bool allowOrigin, } } -} // namespace anon +} // namespace InsetGraphics::InsetGraphics(Buffer * buf) @@ -304,17 +304,19 @@ void InsetGraphics::read(Lexer & lex) } -string InsetGraphics::createLatexOptions() const +string InsetGraphics::createLatexOptions(bool const ps) const { // Calculate the options part of the command, we must do it to a string // stream since we might have a trailing comma that we would like to remove // before writing it to the output stream. ostringstream options; - if (!params().bbox.empty()) - options << "bb=" << params().bbox.xl.asLatexString() << ' ' + if (!params().bbox.empty()) { + string const key = ps ? "bb=" : "viewport="; + options << key << params().bbox.xl.asLatexString() << ' ' << params().bbox.yb.asLatexString() << ' ' << params().bbox.xr.asLatexString() << ' ' << params().bbox.yt.asLatexString() << ','; + } if (params().draft) options << "draft,"; if (params().clip) @@ -559,7 +561,7 @@ string const stripExtensionIfPossible(string const & file, string const & to, bo return latex_path(file, EXCLUDE_EXTENSION); } -} // namespace anon +} // namespace string InsetGraphics::prepareFile(OutputParams const & runparams) const @@ -765,7 +767,9 @@ void InsetGraphics::latex(otexstream & os, before += "\\includegraphics"; // Write the options if there are any. - string const opts = createLatexOptions(); + bool const ps = runparams.flavor == OutputParams::LATEX + || runparams.flavor == OutputParams::DVILUATEX; + string const opts = createLatexOptions(ps); LYXERR(Debug::GRAPHICS, "\tOpts = " << opts); if (!opts.empty() && !message.empty())