mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-14 09:32:20 +00:00
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:
parent
9fd75e3702
commit
64af9accff
@ -31,6 +31,7 @@
|
|||||||
#include "Paragraph.h"
|
#include "Paragraph.h"
|
||||||
#include "paragraph_funcs.h"
|
#include "paragraph_funcs.h"
|
||||||
#include "TextClass.h"
|
#include "TextClass.h"
|
||||||
|
#include "TextMetrics.h"
|
||||||
#include "TocBackend.h"
|
#include "TocBackend.h"
|
||||||
|
|
||||||
#include "frontends/FontMetrics.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
|
void InsetCaption::draw(PainterInfo & pi, int x, int y) const
|
||||||
{
|
{
|
||||||
// We must draw the label, we should get the label string
|
// 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;
|
FontInfo tmpfont = pi.base.font;
|
||||||
pi.base.font = pi.base.bv->buffer().params().getFont().fontInfo();
|
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);
|
InsetText::draw(pi, x + labelwidth_, y);
|
||||||
pi.base.font = tmpfont;
|
pi.base.font = tmpfont;
|
||||||
}
|
}
|
||||||
|
@ -51,6 +51,8 @@ private:
|
|||||||
///
|
///
|
||||||
void metrics(MetricsInfo & mi, Dimension & dim) const;
|
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;
|
void draw(PainterInfo & pi, int x, int y) const;
|
||||||
///
|
///
|
||||||
void edit(Cursor & cur, bool front, EntryDirection entry_from);
|
void edit(Cursor & cur, bool front, EntryDirection entry_from);
|
||||||
|
@ -686,7 +686,7 @@ void RowPainter::paintOnlyInsets()
|
|||||||
for (pos_type pos = row_.pos(); pos != end; ++pos) {
|
for (pos_type pos = row_.pos(); pos != end; ++pos) {
|
||||||
// If outer row has changed, nested insets are repaint completely.
|
// If outer row has changed, nested insets are repaint completely.
|
||||||
Inset const * inset = par_.getInset(pos);
|
Inset const * inset = par_.getInset(pos);
|
||||||
if (!inset)
|
if (!inset || !inset->asInsetText())
|
||||||
continue;
|
continue;
|
||||||
if (x_ > pi_.base.bv->workWidth()
|
if (x_ > pi_.base.bv->workWidth()
|
||||||
|| !cache.getInsets().has(inset))
|
|| !cache.getInsets().has(inset))
|
||||||
|
@ -93,6 +93,9 @@ What's new
|
|||||||
- 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).
|
"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
|
* DOCUMENTATION AND LOCALIZATION
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user