From: Angus Leeming Date: Mon, 13 Jan 2003 23:38:01 +0000 (+0000) Subject: (Michael Schmitt): the proper fix for the off-by-one cropping of graphics X-Git-Tag: 1.6.10~17689 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=dd16b2eff7feb1b4ead013eab9f997c965a871cc;p=features.git (Michael Schmitt): the proper fix for the off-by-one cropping of graphics images. Tested and verified to work beautifully. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5951 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/frontends/xforms/ChangeLog b/src/frontends/xforms/ChangeLog index 11bea1a8ca..2f0c4487f2 100644 --- a/src/frontends/xforms/ChangeLog +++ b/src/frontends/xforms/ChangeLog @@ -1,3 +1,8 @@ +2003-01-13 Michael Schmitt + + * xformsImage.C (getWidth): revert "fix" that breaks behavior with + xforms 1.0. + 2003-01-13 John Levon * forms/form_spellchecker.fd: remove replicated M-R shortcut. diff --git a/src/frontends/xforms/xformsImage.C b/src/frontends/xforms/xformsImage.C index 2171221ea2..23ae842235 100644 --- a/src/frontends/xforms/xformsImage.C +++ b/src/frontends/xforms/xformsImage.C @@ -155,9 +155,7 @@ unsigned int xformsImage::getWidth() const if (!image_) return 0; - // Why, oh why, do we need such hacks? - // Angus 12 July 2002 - return image_->w + 4; + return image_->w; } diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index 5ffd9c5dfe..f8c8422018 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,7 @@ +2003-01-12 Michael Schmitt + + * insetgraphics.C (draw, width): Fix spacing around graphics inset + 2002-12-17 Juergen Vigna * insettext.C (localDispatch): hopefully fixed cursor up down diff --git a/src/insets/insetgraphics.C b/src/insets/insetgraphics.C index 5fb9e60572..3e075742e8 100644 --- a/src/insets/insetgraphics.C +++ b/src/insets/insetgraphics.C @@ -287,7 +287,7 @@ int InsetGraphics::descent(BufferView *, LyXFont const &) const int InsetGraphics::width(BufferView *, LyXFont const & font) const { if (imageIsDrawable()) - return cache_->loader.image()->getWidth(); + return cache_->loader.image()->getWidth() + 2 * TEXT_TO_INSET_OFFSET; else { int font_width = 0; @@ -358,15 +358,14 @@ void InsetGraphics::draw(BufferView * bv, LyXFont const & font, Painter & paint = bv->painter(); if (imageIsDrawable()) { - paint.image(old_x + 2, baseline - lascent, - lwidth - 4, lascent + ldescent, + paint.image(old_x + TEXT_TO_INSET_OFFSET, baseline - lascent, + lwidth - 2 * TEXT_TO_INSET_OFFSET, lascent + ldescent, *cache_->loader.image()); } else { - paint.rectangle(old_x + 2, baseline - lascent, - lwidth - 4, - lascent + ldescent); + paint.rectangle(old_x + TEXT_TO_INSET_OFFSET, baseline - lascent, + lwidth - 2 * TEXT_TO_INSET_OFFSET, lascent + ldescent); // Print the file name. LyXFont msgFont(font); @@ -374,7 +373,7 @@ void InsetGraphics::draw(BufferView * bv, LyXFont const & font, string const justname = OnlyFilename (params().filename); if (!justname.empty()) { msgFont.setSize(LyXFont::SIZE_FOOTNOTE); - paint.text(old_x + 8, + paint.text(old_x + TEXT_TO_INSET_OFFSET + 6, baseline - font_metrics::maxAscent(msgFont) - 4, justname, msgFont); } @@ -383,7 +382,7 @@ void InsetGraphics::draw(BufferView * bv, LyXFont const & font, string const msg = statusMessage(); if (!msg.empty()) { msgFont.setSize(LyXFont::SIZE_TINY); - paint.text(old_x + 8, baseline - 4, msg, msgFont); + paint.text(old_x + TEXT_TO_INSET_OFFSET + 6, baseline - 4, msg, msgFont); } } diff --git a/src/mathed/ChangeLog b/src/mathed/ChangeLog index 2c02539e09..905b6c9eee 100644 --- a/src/mathed/ChangeLog +++ b/src/mathed/ChangeLog @@ -1,3 +1,7 @@ +2003-01-12 Michael Schmitt + + * formula.C (draw, width): Fix spacing around previewed formula. + 2003-01-13 Michael Schmitt * formulabse.C (localDispatch): make CTRL-Pos1/End behave a little diff --git a/src/mathed/formula.C b/src/mathed/formula.C index 670cb182b1..40dbc4afc0 100644 --- a/src/mathed/formula.C +++ b/src/mathed/formula.C @@ -213,7 +213,7 @@ void InsetFormula::draw(BufferView * bv, LyXFont const & font, MathPainterInfo pi(bv->painter()); if (use_preview) { - pi.pain.image(x, y - a, w, h, + pi.pain.image(x + 1, y - a, w, h, // one pixel gap in front *(preview_->pimage()->image(*this, *bv))); } else { pi.base.style = LM_ST_TEXT; @@ -291,7 +291,8 @@ int InsetFormula::width(BufferView * bv, LyXFont const & font) const { metrics(bv, font); return preview_->previewReady() ? - preview_->pimage()->width() : par_->width(); + 1 + preview_->pimage()->width() : par_->width(); + // insert a one pixel gap in front of the formula }