X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FInsetGraphics.cpp;h=b41d72bc70083d132742ee48ef3b851aeb576251;hb=3391fed36a574fb729f243888258d1b6d45b0251;hp=4619c610a3f7eef35f3685669cc397a42f6d9c33;hpb=e1f597e3da26865cb01eab5bef6ad5d9e862ff7a;p=features.git diff --git a/src/insets/InsetGraphics.cpp b/src/insets/InsetGraphics.cpp index 4619c610a3..b41d72bc70 100644 --- a/src/insets/InsetGraphics.cpp +++ b/src/insets/InsetGraphics.cpp @@ -962,10 +962,20 @@ docstring InsetGraphics::xhtml(XHTMLStream & xs, OutputParams const & op) const // really be better to do width and height conversion, rather than to output // these parameters here. string imgstyle; - if (!params().width.zero()) - imgstyle += "width:" + params().width.asHTMLString() + ";"; - if (!params().height.zero()) - imgstyle += " height:" + params().height.asHTMLString() + ";"; + bool const havewidth = !params().width.zero(); + bool const haveheight = !params().height.zero(); + if (havewidth || haveheight) { + if (havewidth) + imgstyle += "width:" + params().width.asHTMLString() + ";"; + if (haveheight) + imgstyle += " height:" + params().height.asHTMLString() + ";"; + } else if (params().scale != "100") { + // Note that this will not have the same effect as in LaTeX export: + // There, the image will be scaled from its original size. Here, the + // percentage will be interpreted by the browser, and the image will + // be scaled to a percentage of the window size. + imgstyle = "width:" + params().scale + "%;"; + } if (!imgstyle.empty()) imgstyle = "style='" + imgstyle + "' "; @@ -1026,11 +1036,13 @@ void InsetGraphics::editGraphics(InsetGraphicsParams const & p) const void InsetGraphics::addToToc(DocIterator const & cpit, bool output_active, - UpdateType) const + UpdateType, TocBackend & backend) const { //FIXME UNICODE docstring const str = from_utf8(params_.filename.onlyFileName()); - buffer().tocBackend().toc("graphics")->push_back(TocItem(cpit, 0, str, output_active)); + TocBuilder & b = backend.builder("graphics"); + b.pushItem(cpit, str, output_active); + b.pop(); }