branch: Fix bug #4889: Painting problem with some insets.

-RowPainter::paintOnlyInsets is only meant to paint nested Insets, so I guess only the InsetText? based insets.
-Fix the painting of the labels of InsetCaption? insets.

see r36630, r36639 and r36640.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_6_X@36679 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Vincent van Ravesteijn 2010-12-03 10:23:51 +00:00
parent 9fd75e3702
commit 64af9accff
4 changed files with 19 additions and 3 deletions

View File

@ -31,6 +31,7 @@
#include "Paragraph.h"
#include "paragraph_funcs.h"
#include "TextClass.h"
#include "TextMetrics.h"
#include "TocBackend.h"
#include "frontends/FontMetrics.h"
@ -139,6 +140,15 @@ void InsetCaption::metrics(MetricsInfo & mi, Dimension & dim) const
}
void InsetCaption::drawBackground(PainterInfo & pi, int x, int y) const
{
TextMetrics & tm = pi.base.bv->textMetrics(&text());
int const h = tm.height() + 2 * TEXT_TO_INSET_OFFSET;
int const yy = y - TEXT_TO_INSET_OFFSET - tm.ascent();
pi.pain.fillRectangle(x, yy, labelwidth_, h, pi.backgroundColor(this));
}
void InsetCaption::draw(PainterInfo & pi, int x, int y) const
{
// We must draw the label, we should get the label string
@ -151,7 +161,8 @@ void InsetCaption::draw(PainterInfo & pi, int x, int y) const
FontInfo tmpfont = pi.base.font;
pi.base.font = pi.base.bv->buffer().params().getFont().fontInfo();
pi.pain.text(x, y, full_label_, pi.base.font);
int const xx = x + TEXT_TO_INSET_OFFSET;
pi.pain.text(xx, y, full_label_, pi.base.font);
InsetText::draw(pi, x + labelwidth_, y);
pi.base.font = tmpfont;
}

View File

@ -50,6 +50,8 @@ private:
bool descendable(BufferView const &) const { return true; }
///
void metrics(MetricsInfo & mi, Dimension & dim) const;
///
void drawBackground(PainterInfo & pi, int x, int y) const;
///
void draw(PainterInfo & pi, int x, int y) const;
///

View File

@ -686,7 +686,7 @@ void RowPainter::paintOnlyInsets()
for (pos_type pos = row_.pos(); pos != end; ++pos) {
// If outer row has changed, nested insets are repaint completely.
Inset const * inset = par_.getInset(pos);
if (!inset)
if (!inset || !inset->asInsetText())
continue;
if (x_ > pi_.base.bv->workWidth()
|| !cache.getInsets().has(inset))

View File

@ -90,8 +90,11 @@ What's new
- Update the status of the button in the Text Style dialog when the
cursor is moved (bug 6952).
- Correctly toggle the numbering of an equation when issuing the
- Correctly toggle the numbering of an equation when issuing the
"Insert->Numbered equation" on a displayed equation (bug 6709).
- Fix the painting of non-InsetText insets with a transparent
background as well as the description of an InsetCaption (bug 4889).
* DOCUMENTATION AND LOCALIZATION