mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Set endlabel color correctly when there is a selection
Current code would change the color of static endlabel when the _start_ of line is selected. This is only used with hollywood and broadway layouts, though. Change the box endlabel painting code to use Color_selectiontext as needed. Follow-up to bug #10972.
This commit is contained in:
parent
5f93099b88
commit
76a8ca27a7
@ -73,11 +73,12 @@ RowPainter::RowPainter(PainterInfo & pi,
|
||||
}
|
||||
|
||||
|
||||
FontInfo RowPainter::labelFont() const
|
||||
FontInfo RowPainter::labelFont(bool end) const
|
||||
{
|
||||
FontInfo f = text_.labelFont(par_);
|
||||
// selected text?
|
||||
if (row_.begin_margin_sel || pi_.selected)
|
||||
if ((end ? row_.end_margin_sel : row_.begin_margin_sel)
|
||||
|| pi_.selected)
|
||||
f.setPaintColor(Color_selectiontext);
|
||||
return f;
|
||||
}
|
||||
@ -397,7 +398,7 @@ void RowPainter::paintLabel() const
|
||||
return;
|
||||
|
||||
Layout const & layout = par_.layout();
|
||||
FontInfo const font = labelFont();
|
||||
FontInfo const font = labelFont(false);
|
||||
FontMetrics const & fm = theFontMetrics(font);
|
||||
double x = x_;
|
||||
|
||||
@ -415,7 +416,7 @@ void RowPainter::paintTopLevelLabel() const
|
||||
BufferParams const & bparams = pi_.base.bv->buffer().params();
|
||||
ParagraphParameters const & pparams = par_.params();
|
||||
Layout const & layout = par_.layout();
|
||||
FontInfo const font = labelFont();
|
||||
FontInfo const font = labelFont(false);
|
||||
docstring const str = par_.labelString();
|
||||
if (str.empty())
|
||||
return;
|
||||
@ -508,7 +509,9 @@ void RowPainter::paintLast() const
|
||||
switch (endlabel) {
|
||||
case END_LABEL_BOX:
|
||||
case END_LABEL_FILLED_BOX: {
|
||||
FontInfo const font = labelFont();
|
||||
FontInfo font = labelFont(true);
|
||||
if (font.realColor() != Color_selectiontext)
|
||||
font.setPaintColor(Color_eolmarker);
|
||||
FontMetrics const & fm = theFontMetrics(font);
|
||||
int const size = int(0.75 * fm.maxAscent());
|
||||
int const y = yo_ - size;
|
||||
@ -525,14 +528,14 @@ void RowPainter::paintLast() const
|
||||
}
|
||||
|
||||
if (endlabel == END_LABEL_BOX)
|
||||
pi_.pain.rectangle(x, y, size, size, Color_eolmarker);
|
||||
pi_.pain.rectangle(x, y, size, size, font.realColor());
|
||||
else
|
||||
pi_.pain.fillRectangle(x, y, size, size, Color_eolmarker);
|
||||
pi_.pain.fillRectangle(x, y, size, size, font.realColor());
|
||||
break;
|
||||
}
|
||||
|
||||
case END_LABEL_STATIC: {
|
||||
FontInfo const font = labelFont();
|
||||
FontInfo const font = labelFont(true);
|
||||
FontMetrics const & fm = theFontMetrics(font);
|
||||
docstring const & str = par_.layout().endlabelstring();
|
||||
double const x = row_.isRTL() ? x_ - fm.width(str) : x_;
|
||||
|
@ -64,8 +64,8 @@ private:
|
||||
void paintAppendixStart(int y) const;
|
||||
void paintInset(Row::Element const & e) const;
|
||||
|
||||
/// return the label font for this row
|
||||
FontInfo labelFont() const;
|
||||
/// return the label font for this row (end label when \c end is true)
|
||||
FontInfo labelFont(bool end) const;
|
||||
|
||||
///
|
||||
void paintLabel() const;
|
||||
|
Loading…
Reference in New Issue
Block a user