(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
This commit is contained in:
Angus Leeming 2003-01-13 23:38:01 +00:00
parent cc4e6a8499
commit dd16b2eff7
6 changed files with 24 additions and 13 deletions

View File

@ -1,3 +1,8 @@
2003-01-13 Michael Schmitt <michael.schmitt@teststep.org>
* xformsImage.C (getWidth): revert "fix" that breaks behavior with
xforms 1.0.
2003-01-13 John Levon <levon@movementarian.org> 2003-01-13 John Levon <levon@movementarian.org>
* forms/form_spellchecker.fd: remove replicated M-R shortcut. * forms/form_spellchecker.fd: remove replicated M-R shortcut.

View File

@ -155,9 +155,7 @@ unsigned int xformsImage::getWidth() const
if (!image_) if (!image_)
return 0; return 0;
// Why, oh why, do we need such hacks? return image_->w;
// Angus 12 July 2002
return image_->w + 4;
} }

View File

@ -1,3 +1,7 @@
2003-01-12 Michael Schmitt <michael.schmitt@teststep.org>
* insetgraphics.C (draw, width): Fix spacing around graphics inset
2002-12-17 Juergen Vigna <jug@lyx.org> 2002-12-17 Juergen Vigna <jug@lyx.org>
* insettext.C (localDispatch): hopefully fixed cursor up down * insettext.C (localDispatch): hopefully fixed cursor up down

View File

@ -287,7 +287,7 @@ int InsetGraphics::descent(BufferView *, LyXFont const &) const
int InsetGraphics::width(BufferView *, LyXFont const & font) const int InsetGraphics::width(BufferView *, LyXFont const & font) const
{ {
if (imageIsDrawable()) if (imageIsDrawable())
return cache_->loader.image()->getWidth(); return cache_->loader.image()->getWidth() + 2 * TEXT_TO_INSET_OFFSET;
else { else {
int font_width = 0; int font_width = 0;
@ -358,15 +358,14 @@ void InsetGraphics::draw(BufferView * bv, LyXFont const & font,
Painter & paint = bv->painter(); Painter & paint = bv->painter();
if (imageIsDrawable()) { if (imageIsDrawable()) {
paint.image(old_x + 2, baseline - lascent, paint.image(old_x + TEXT_TO_INSET_OFFSET, baseline - lascent,
lwidth - 4, lascent + ldescent, lwidth - 2 * TEXT_TO_INSET_OFFSET, lascent + ldescent,
*cache_->loader.image()); *cache_->loader.image());
} else { } else {
paint.rectangle(old_x + 2, baseline - lascent, paint.rectangle(old_x + TEXT_TO_INSET_OFFSET, baseline - lascent,
lwidth - 4, lwidth - 2 * TEXT_TO_INSET_OFFSET, lascent + ldescent);
lascent + ldescent);
// Print the file name. // Print the file name.
LyXFont msgFont(font); LyXFont msgFont(font);
@ -374,7 +373,7 @@ void InsetGraphics::draw(BufferView * bv, LyXFont const & font,
string const justname = OnlyFilename (params().filename); string const justname = OnlyFilename (params().filename);
if (!justname.empty()) { if (!justname.empty()) {
msgFont.setSize(LyXFont::SIZE_FOOTNOTE); 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, baseline - font_metrics::maxAscent(msgFont) - 4,
justname, msgFont); justname, msgFont);
} }
@ -383,7 +382,7 @@ void InsetGraphics::draw(BufferView * bv, LyXFont const & font,
string const msg = statusMessage(); string const msg = statusMessage();
if (!msg.empty()) { if (!msg.empty()) {
msgFont.setSize(LyXFont::SIZE_TINY); 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);
} }
} }

View File

@ -1,3 +1,7 @@
2003-01-12 Michael Schmitt <michael.schmitt@teststep.org>
* formula.C (draw, width): Fix spacing around previewed formula.
2003-01-13 Michael Schmitt <Michael.Schmitt@teststep.org> 2003-01-13 Michael Schmitt <Michael.Schmitt@teststep.org>
* formulabse.C (localDispatch): make CTRL-Pos1/End behave a little * formulabse.C (localDispatch): make CTRL-Pos1/End behave a little

View File

@ -213,7 +213,7 @@ void InsetFormula::draw(BufferView * bv, LyXFont const & font,
MathPainterInfo pi(bv->painter()); MathPainterInfo pi(bv->painter());
if (use_preview) { 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))); *(preview_->pimage()->image(*this, *bv)));
} else { } else {
pi.base.style = LM_ST_TEXT; pi.base.style = LM_ST_TEXT;
@ -291,7 +291,8 @@ int InsetFormula::width(BufferView * bv, LyXFont const & font) const
{ {
metrics(bv, font); metrics(bv, font);
return preview_->previewReady() ? return preview_->previewReady() ?
preview_->pimage()->width() : par_->width(); 1 + preview_->pimage()->width() : par_->width();
// insert a one pixel gap in front of the formula
} }