X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Finsets%2FRenderGraphic.cpp;h=e01bcd3997afe190162312005e16c48d23de8708;hb=87a7f728ca9b8b4d358cf06de980f61b67a927ac;hp=9d9cf31789aeb955d88edc6ac24dc790ee1166ba;hpb=325fbab4636507b62773e3873090e5f35590c95c;p=lyx.git diff --git a/src/insets/RenderGraphic.cpp b/src/insets/RenderGraphic.cpp index 9d9cf31789..e01bcd3997 100644 --- a/src/insets/RenderGraphic.cpp +++ b/src/insets/RenderGraphic.cpp @@ -14,6 +14,7 @@ #include "insets/Inset.h" +#include "Buffer.h" #include "LyX.h" #include "LyXRC.h" #include "MetricsInfo.h" @@ -35,6 +36,7 @@ namespace lyx { RenderGraphic::RenderGraphic(Inset const * inset) + : loader_(inset->buffer().fileName()) { loader_.connect(bind(&Inset::updateFrontend, inset)); } @@ -130,7 +132,7 @@ bool readyToDisplay(graphics::Loader const & loader) return loader.image()->isDrawable(); } -} // namespace anon +} // namespace void RenderGraphic::metrics(MetricsInfo & mi, Dimension & dim) const @@ -140,6 +142,7 @@ void RenderGraphic::metrics(MetricsInfo & mi, Dimension & dim) const loader_.startLoading(); if (!loader_.monitoring()) loader_.startMonitoring(); + loader_.checkModifiedAsync(); } bool const image_ready = displayGraphic(params_) && readyToDisplay(loader_); @@ -154,6 +157,7 @@ void RenderGraphic::metrics(MetricsInfo & mi, Dimension & dim) const dim.des = 0; int font_width = 0; + int font_height = 0; FontInfo msgFont(mi.base.font); msgFont.setFamily(SANS_FAMILY); @@ -163,6 +167,7 @@ void RenderGraphic::metrics(MetricsInfo & mi, Dimension & dim) const if (!justname.empty()) { msgFont.setSize(FONT_SIZE_FOOTNOTE); font_width = theFontMetrics(msgFont).width(justname); + font_height = theFontMetrics(msgFont).maxHeight(); } docstring const msg = statusMessage(params_, loader_.status()); @@ -170,9 +175,12 @@ void RenderGraphic::metrics(MetricsInfo & mi, Dimension & dim) const msgFont.setSize(FONT_SIZE_TINY); font_width = max(font_width, theFontMetrics(msgFont).width(msg)); + font_height += theFontMetrics(msgFont).maxAscent(); + dim.des = theFontMetrics(msgFont).maxDescent(); } dim.wid = max(50, font_width + 15); + dim.asc = max(50, font_height + 15); dim_ = dim; }