Rename PainterMetrics::change_ to change

This is not a private variable.
This commit is contained in:
Jean-Marc Lasgouttes 2020-01-14 11:50:44 +01:00
parent 5bb9ded4d6
commit a187cbeb64
8 changed files with 26 additions and 26 deletions

View File

@ -131,7 +131,7 @@ MetricsInfo::MetricsInfo(BufferView * bv, FontInfo font, int textwidth,
/////////////////////////////////////////////////////////////////////////
PainterInfo::PainterInfo(BufferView * bv, lyx::frontend::Painter & painter)
: pain(painter), ltr_pos(false), change_(), selected(false),
: pain(painter), ltr_pos(false), change(), selected(false),
do_spellcheck(true), full_repaint(true), background_color(Color_background),
leftx(0), rightx(0)
{
@ -178,8 +178,8 @@ ColorCode PainterInfo::backgroundColor(Inset const * inset, bool sel) const
Color PainterInfo::textColor(Color const & color) const
{
if (change_.changed())
return change_.color();
if (change.changed())
return change.color();
if (selected)
return Color_selectiontext;
return color;

View File

@ -134,7 +134,7 @@ public:
/// Whether the text at this point is right-to-left (for insets)
bool ltr_pos;
/// The change the parent is part of (change tracking)
Change change_;
Change change;
/// Whether the parent is selected as a whole
bool selected;
/// Whether the spell checker is enabled for the parent

View File

@ -95,12 +95,12 @@ void RowPainter::paintInset(Row::Element const & e) const
// requires a full repaint
bool const pi_full_repaint = pi_.full_repaint;
bool const pi_do_spellcheck = pi_.do_spellcheck;
Change const pi_change = pi_.change_;
Change const pi_change = pi_.change;
pi_.base.font = e.inset->inheritFont() ? e.font.fontInfo() :
pi_.base.bv->buffer().params().getFont().fontInfo();
pi_.ltr_pos = !e.font.isVisibleRightToLeft();
pi_.change_ = pi_.change_.changed() ? pi_.change_ : e.change;
pi_.change = pi_.change.changed() ? pi_.change : e.change;
pi_.do_spellcheck &= e.inset->allowSpellCheck();
int const x1 = int(x_);
@ -115,7 +115,7 @@ void RowPainter::paintInset(Row::Element const & e) const
// Restore full_repaint status.
pi_.full_repaint = pi_full_repaint;
pi_.change_ = pi_change;
pi_.change = pi_change;
pi_.do_spellcheck = pi_do_spellcheck;
pi_.selected = pi_selected;

View File

@ -268,7 +268,7 @@ void InsetCollapsible::draw(PainterInfo & pi, int x, int y) const
// Draw the change tracking cue on the label, unless RowPainter already
// takes care of it.
if (canPaintChange(bv))
pi.change_.paintCue(pi, x, y, x + dimc.width(), labelfont);
pi.change.paintCue(pi, x, y, x + dimc.width(), labelfont);
} else {
view_[&bv].button_dim_.x1 = 0;
view_[&bv].button_dim_.y1 = 0;
@ -292,8 +292,8 @@ void InsetCollapsible::draw(PainterInfo & pi, int x, int y) const
}
// Do not draw the cue for INSERTED -- it is already in the button and
// that's enough.
Changer cdummy = (pi.change_.type == Change::INSERTED)
? make_change(pi.change_, Change())
Changer cdummy = (pi.change.type == Change::INSERTED)
? make_change(pi.change, Change())
: Changer();
InsetText::draw(pi, textx, texty);
break;
@ -312,7 +312,7 @@ void InsetCollapsible::draw(PainterInfo & pi, int x, int y) const
// We will take care of the frame and the change tracking cue
// ourselves, below.
{
Changer cdummy = make_change(pi.change_, Change());
Changer cdummy = make_change(pi.change, Change());
const_cast<InsetCollapsible *>(this)->setDrawFrame(false);
InsetText::draw(pi, textx, texty);
const_cast<InsetCollapsible *>(this)->setDrawFrame(true);
@ -323,7 +323,7 @@ void InsetCollapsible::draw(PainterInfo & pi, int x, int y) const
desc -= 3;
// Colour the frame according to the change type. (Like for tables.)
Color colour = pi.change_.changed() ? pi.change_.color()
Color colour = pi.change.changed() ? pi.change.color()
: Color_foreground;
const int xx1 = x + TEXT_TO_INSET_OFFSET - 1;
const int xx2 = x + textdim.wid - TEXT_TO_INSET_OFFSET + 1;
@ -345,7 +345,7 @@ void InsetCollapsible::draw(PainterInfo & pi, int x, int y) const
// the label below the text. Can be toggled.
if (g == SubLabel) {
FontInfo font(getLabelfont());
if (pi.change_.changed())
if (pi.change.changed())
font.setPaintColor(colour);
font.realize(sane_font);
font.decSize();
@ -371,8 +371,8 @@ void InsetCollapsible::draw(PainterInfo & pi, int x, int y) const
}
// Strike through the inset if deleted and not already handled by
// RowPainter.
if (pi.change_.deleted() && canPaintChange(bv))
pi.change_.paintCue(pi, xx1, y1, xx2, y + desc);
if (pi.change.deleted() && canPaintChange(bv))
pi.change.paintCue(pi, xx1, y1, xx2, y + desc);
break;
}
}

View File

@ -228,7 +228,7 @@ void InsetText::draw(PainterInfo & pi, int x, int y) const
Changer dummy = make_change(pi.background_color,
pi.backgroundColor(this, false));
// The change tracking cue must not be inherited
Changer dummy2 = make_change(pi.change_, Change());
Changer dummy2 = make_change(pi.change, Change());
tm.draw(pi, x + TEXT_TO_INSET_OFFSET, y);
}
@ -237,7 +237,7 @@ void InsetText::draw(PainterInfo & pi, int x, int y) const
// Only do so if the color is not custom. But do so even if RowPainter
// handles the strike-through already.
Color c;
if (pi.change_.changed()
if (pi.change.changed()
// Originally, these are the colors with role Text, from role() in
// ColorCache.cpp. The code is duplicated to avoid depending on Qt
// types, and also maybe it need not match in the future.
@ -246,18 +246,18 @@ void InsetText::draw(PainterInfo & pi, int x, int y) const
|| frameColor() == Color_preview
|| frameColor() == Color_tabularline
|| frameColor() == Color_previewframe)) {
c = pi.change_.color();
c = pi.change.color();
change_drawn = true;
} else
c = frameColor();
pi.pain.rectangle(xframe, yframe, w, h, c);
}
if (canPaintChange(*pi.base.bv) && (!change_drawn || pi.change_.deleted()))
if (canPaintChange(*pi.base.bv) && (!change_drawn || pi.change.deleted()))
// Do not draw the change tracking cue if already done by RowPainter and
// do not draw the cue for INSERTED if the information is already in the
// color of the frame
pi.change_.paintCue(pi, xframe, yframe, xframe + w, yframe + h);
pi.change.paintCue(pi, xframe, yframe, xframe + w, yframe + h);
}

View File

@ -199,7 +199,7 @@ void RenderGraphic::draw(PainterInfo & pi, int x, int y) const
pi.pain.image(x1, y1, w, h, *loader_.image());
else {
Color c = pi.change_.changed() ? pi.change_.color() : Color_foreground;
Color c = pi.change.changed() ? pi.change.color() : Color_foreground;
pi.pain.rectangle(x1, y1, w, h, c);
// Print the file name.
@ -221,7 +221,7 @@ void RenderGraphic::draw(PainterInfo & pi, int x, int y) const
pi.pain.text(x1 + 6, y - 4, msg, msgFont);
}
}
pi.change_.paintCue(pi, x1, y1, x1 + w, y1 + h);
pi.change.paintCue(pi, x1, y1, x1 + w, y1 + h);
}

View File

@ -183,8 +183,8 @@ void RenderPreview::draw(PainterInfo & pi, int x, int y) const
y - theFontMetrics(font).maxAscent() - 4,
stat, font);
}
pi.change_.paintCue(pi, x, y - dim_.asc,
x + dim_.width(), y - dim_.asc + dim_.height());
pi.change.paintCue(pi, x, y - dim_.asc,
x + dim_.width(), y - dim_.asc + dim_.height());
}

View File

@ -650,7 +650,7 @@ void InsetMathHull::draw(PainterInfo & pi, int x, int y) const
if (previewState(bv)) {
// Do not draw change tracking cue if taken care of by RowPainter
// already.
Changer dummy = !canPaintChange(*bv) ? make_change(pi.change_, Change())
Changer dummy = !canPaintChange(*bv) ? make_change(pi.change, Change())
: Changer();
if (previewTooSmall(pi.base, dim)) {
// we have an extra frame
@ -700,7 +700,7 @@ void InsetMathHull::draw(PainterInfo & pi, int x, int y) const
if (canPaintChange(*bv)) {
// like in metrics()
int const display_margin = display() ? pi.base.inPixels(Length(12, Length::PT)) : 0;
pi.change_.paintCue(pi, x + 1, y + 1 - dim.asc + display_margin,
pi.change.paintCue(pi, x + 1, y + 1 - dim.asc + display_margin,
x + dim.wid, y + dim.des - display_margin);
}
}