Don't save background color in Text. Hand it down at drawing time.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20002 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2007-09-02 14:34:15 +00:00
parent 070a7fc290
commit bc6304d760
8 changed files with 10 additions and 19 deletions

View File

@ -1545,7 +1545,8 @@ void BufferView::draw(frontend::Painter & pain)
if (pi.full_repaint)
// Clear background (if not delegated to rows)
pain.fillRectangle(0, metrics_info_.y1, width_,
metrics_info_.y2 - metrics_info_.y1, text.backgroundColor());
metrics_info_.y2 - metrics_info_.y1,
buffer_.inset().backgroundColor());
TextMetrics const & tm = text_metrics_[&text];

View File

@ -50,7 +50,8 @@ MetricsInfo::MetricsInfo(BufferView * bv, Font const & font, int textwidth)
PainterInfo::PainterInfo(BufferView * bv, lyx::frontend::Painter & painter)
: pain(painter), ltr_pos(false), erased_(false), full_repaint(true)
: pain(painter), ltr_pos(false), erased_(false), full_repaint(true),
background_color(Color::background)
{
base.bv = bv;
}

View File

@ -98,6 +98,8 @@ public:
bool erased_;
///
bool full_repaint;
///
int background_color;
};
class TextMetricsInfo {};

View File

@ -356,12 +356,6 @@ double Text::spacing(Buffer const & buffer,
}
Color_color Text::backgroundColor() const
{
return Color_color(Color::color(background_color_));
}
void Text::breakParagraph(Cursor & cur, bool keep_layout)
{
BOOST_ASSERT(this == cur.text());

View File

@ -244,9 +244,6 @@ public:
/// FIXME: replace Cursor with DocIterator.
void insertStringAsParagraphs(Cursor & cur, docstring const & str);
/// return the color of the canvas
Color_color backgroundColor() const;
/// access to our paragraphs
ParagraphList const & paragraphs() const { return pars_; }
ParagraphList & paragraphs() { return pars_; }
@ -289,9 +286,6 @@ public:
void deleteEmptyParagraphMechanism(pit_type first, pit_type last, bool trackChanges);
public:
///
int background_color_;
///
ParagraphList pars_;

View File

@ -71,8 +71,7 @@ using std::istringstream;
namespace lyx {
Text::Text()
: background_color_(Color::background),
autoBreakRows_(false)
: autoBreakRows_(false)
{}

View File

@ -1716,8 +1716,8 @@ void TextMetrics::drawParagraph(PainterInfo & pi, pit_type pit, int x, int y) co
// (if paragraph background was not cleared)
if (!pi.full_repaint && row_has_changed) {
pi.pain.fillRectangle(x, y - rit->ascent(),
width(), rit->height(),
text_->backgroundColor());
width(), rit->height(),
Color_color(Color::color(pi.background_color)));
}
// Instrumentation for testing row cache (see also

View File

@ -244,7 +244,7 @@ bool InsetCollapsable::setMouseHover(bool mouse_hover)
void InsetCollapsable::draw(PainterInfo & pi, int x, int y) const
{
autoOpen_ = pi.base.bv->cursor().isInside(this);
text_.background_color_ = backgroundColor();
pi.background_color = backgroundColor();
const int xx = x + TEXT_TO_INSET_OFFSET;
// Draw button first -- top, left or only