]> git.lyx.org Git - features.git/commitdiff
Don't save background color in Text. Hand it down at drawing time.
authorAbdelrazak Younes <younes@lyx.org>
Sun, 2 Sep 2007 14:34:15 +0000 (14:34 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Sun, 2 Sep 2007 14:34:15 +0000 (14:34 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20002 a592a061-630c-0410-9148-cb99ea01b6c8

src/BufferView.cpp
src/MetricsInfo.cpp
src/MetricsInfo.h
src/Text.cpp
src/Text.h
src/Text2.cpp
src/TextMetrics.cpp
src/insets/InsetCollapsable.cpp

index 7fbd7187be614a96428e28cd8da0884345738d13..a4185096250703965050569052e0f91350220276 100644 (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];
 
index b9c903f1435333ea0be178ded53351010ab867b4..0ddf21ca17ec11b5d930ae5b8adff6b72629354c 100644 (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;
 }
index fc62d226da0e4a0b9fa38d2e0b42b6439bfcaf8c..055b172732dc1438237685fd205f96770d20ecbd 100644 (file)
@@ -98,6 +98,8 @@ public:
        bool erased_;
        ///
        bool full_repaint;
+       ///
+       int background_color;
 };
 
 class TextMetricsInfo {};
index 35912086a85f0619a227f5a27fd3e8d65b5135a2..8250030e36bbe4be22e037c9c90f4f056011b2ec 100644 (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());
index 766229dce9055ab65187863d1ca239f9bdc68c0f..a586998225e4824745d7a53e0b8867790ac14a86 100644 (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_;
 
index 14afb1a49b933991d4bf1c422391a626205a4feb..0d4358d8f342ad0c68da7288865510db563c5bc7 100644 (file)
@@ -71,8 +71,7 @@ using std::istringstream;
 namespace lyx {
 
 Text::Text()
-       : background_color_(Color::background),
-         autoBreakRows_(false)
+       : autoBreakRows_(false)
 {}
 
 
index cb5946266832028daa23517cadf5e5a92fb5b783..06982eab97a9f4dd4c0eddcb447e2a2f930c6244 100644 (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
index 2534109cec7a2b300a1db1c3f395b08c656f8a63..fc842f7d6e6af7afbcf64e180205606d5c7893c5 100644 (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