]> git.lyx.org Git - features.git/commitdiff
* RowPainter::paintFromPos(): transfer inset part to paintInset()
authorAbdelrazak Younes <younes@lyx.org>
Thu, 30 Aug 2007 09:01:30 +0000 (09:01 +0000)
committerAbdelrazak Younes <younes@lyx.org>
Thu, 30 Aug 2007 09:01:30 +0000 (09:01 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19910 a592a061-630c-0410-9148-cb99ea01b6c8

src/rowpainter.cpp
src/rowpainter.h

index 81d9271018c5e0e1441caa5021a0b4508f51cf96..68330aa7445fa3357ab5b086c8541cce13662fbc 100644 (file)
@@ -88,12 +88,15 @@ int RowPainter::leftMargin() const
 
 
 // If you want to debug inset metrics uncomment the following line:
-// #define DEBUG_METRICS
+//#define DEBUG_METRICS
 // This draws green lines around each inset.
 
 
-void RowPainter::paintInset(pos_type const pos, Font const & font)
+void RowPainter::paintInset(pos_type & vpos)
 {
+       pos_type const pos = bidi_.vis2log(vpos);
+       Font font = text_.getFont(bv_.buffer(), par_, pos);
+
        Inset const * inset = par_.getInset(pos);
        BOOST_ASSERT(inset);
        PainterInfo pi(const_cast<BufferView *>(&bv_), pain_);
@@ -104,15 +107,18 @@ void RowPainter::paintInset(pos_type const pos, Font const & font)
                font;
        pi.ltr_pos = (bidi_.level(pos) % 2 == 0);
        pi.erased_ = erased_ || par_.isDeleted(pos);
-#ifdef DEBUG_METRICS
-       int const x1 = int(x_);
-#endif
        bv_.coordCache().insets().add(inset, int(x_), yo_);
        // insets are painted completely. Recursive
        inset->drawSelection(pi, int(x_), yo_);
        inset->draw(pi, int(x_), yo_);
+
+       ++vpos;
+       paintForeignMark(x_, font, inset->descent());
+
        x_ += inset->width();
+
 #ifdef DEBUG_METRICS
+       int const x1 = int(x_ - inset->width());
        Dimension dim;
        BOOST_ASSERT(max_witdh_ > 0);
        int right_margin = text_metrics_.rightMargin(pm_);
@@ -319,18 +325,8 @@ void RowPainter::paintFromPos(pos_type & vpos)
 {
        pos_type const pos = bidi_.vis2log(vpos);
        Font orig_font = text_.getFont(bv_.buffer(), par_, pos);
-
        double const orig_x = x_;
 
-       if (par_.isInset(pos)) {
-               // If outer row has changed, nested insets are repaint completely.
-               paintInset(pos, orig_font);
-               ++vpos;
-               paintForeignMark(orig_x, orig_font,
-                       par_.getInset(pos)->descent());
-               return;
-       }
-
        // usual characters, no insets
        char_type const c = par_.getChar(pos);
 
@@ -755,6 +751,7 @@ void RowPainter::paintText()
                        }
                        x_ += 2;
                        ++vpos;
+
                } else if (par_.isSeparator(pos)) {
                        Font orig_font = text_.getFont(bv_.buffer(), par_, pos);
                        double const orig_x = x_;
@@ -763,6 +760,11 @@ void RowPainter::paintText()
                                x_ += row_.separator;
                        ++vpos;
                        paintForeignMark(orig_x, orig_font);
+
+               } else if (par_.isInset(pos)) {
+                       // If outer row has changed, nested insets are repaint completely.
+                       paintInset(vpos);
+
                } else {
                        paintFromPos(vpos);
                }
index 47369cdd482932938e0388ed4f77c44d54044517..b036904133a2615e7af0a9456cbf1f4f4df99220 100644 (file)
@@ -59,7 +59,7 @@ private:
                        bool hebrew, bool arabic);
        int paintAppendixStart(int y);
        void paintFromPos(pos_type & vpos);
-       void paintInset(pos_type const pos, Font const & font);
+       void paintInset(pos_type & vpos);
 
        /// return left margin
        int leftMargin() const;