]> git.lyx.org Git - lyx.git/blobdiff - src/rowpainter.C
fix nullstream also in pch files
[lyx.git] / src / rowpainter.C
index 104e434b03970af2ba5c0f9597c8c60d5a99b840..2b8193f5ea9d8c38cbb7271a59563e4d8d48a383 100644 (file)
@@ -71,7 +71,7 @@ public:
        void paintText();
 
 private:
-       void paintForeignMark(double orig_x, LyXFont const & font);
+       void paintForeignMark(double orig_x, LyXFont const & font, int desc = 0);
        void paintHebrewComposeChar(lyx::pos_type & vpos, LyXFont const & font);
        void paintArabicComposeChar(lyx::pos_type & vpos, LyXFont const & font);
        void paintChars(lyx::pos_type & vpos, LyXFont font, 
@@ -159,7 +159,7 @@ void RowPainter::paintInset(pos_type const pos, LyXFont const & font)
        // FIXME: We should always use font, see documentation of
        // noFontChange() in insetbase.h.
        pi.base.font = inset->noFontChange() ?
-               bv_.buffer()->params().getLyXTextClass().defaultfont() :
+               bv_.buffer()->params().getFont() :
                font;
        pi.ltr_pos = (text_.bidi.level(pos) % 2 == 0);
        pi.erased_ = erased_ || isDeletedText(par_, pos);
@@ -288,7 +288,7 @@ void RowPainter::paintChars(pos_type & vpos, LyXFont font,
 }
 
 
-void RowPainter::paintForeignMark(double orig_x, LyXFont const & font)
+void RowPainter::paintForeignMark(double orig_x, LyXFont const & font, int desc)
 {
        if (!lyxrc.mark_foreign_language)
                return;
@@ -297,7 +297,7 @@ void RowPainter::paintForeignMark(double orig_x, LyXFont const & font)
        if (font.language() == bv_.buffer()->params().language)
                return;
 
-       int const y = yo_ + 1;
+       int const y = yo_ + 1 + desc;
        pain_.line(int(orig_x), y, int(x_), y, LColor::language);
 }
 
@@ -306,14 +306,14 @@ void RowPainter::paintFromPos(pos_type & vpos)
 {
        pos_type const pos = text_.bidi.vis2log(vpos);
        LyXFont orig_font = text_.getFont(par_, pos);
-       text_.applyOuterFont(orig_font);
 
        double const orig_x = x_;
 
        if (par_.isInset(pos)) {
                paintInset(pos, orig_font);
                ++vpos;
-               paintForeignMark(orig_x, orig_font);
+               paintForeignMark(orig_x, orig_font,
+                       par_.getInset(pos)->descent());
                return;
        }
 
@@ -657,7 +657,8 @@ void RowPainter::paintText()
                if (running_strikeout && (highly_editable_inset || !is_struckout)) {
                        // Calculate 1/3 height of the buffer's default font
                        int const middle =
-                               yo_ - font_metrics::maxAscent(text_.defaultfont_) / 3;
+                               yo_ -
+                               font_metrics::maxAscent(bv_.buffer()->params().getFont()) / 3;
                        pain_.line(last_strikeout_x, middle, int(x_), middle,
                                LColor::strikeout, Painter::line_solid, Painter::line_thin);
                        running_strikeout = false;
@@ -710,7 +711,8 @@ void RowPainter::paintText()
        if (running_strikeout) {
                // calculate 1/3 height of the buffer's default font
                int const middle =
-                       yo_ - font_metrics::maxAscent(text_.defaultfont_) / 3;
+                       yo_ -
+                       font_metrics::maxAscent(bv_.buffer()->params().getFont()) / 3;
                pain_.line(last_strikeout_x, middle, int(x_), middle,
                        LColor::strikeout, Painter::line_solid, Painter::line_thin);
                running_strikeout = false;
@@ -735,7 +737,7 @@ bool isCursorOnRow(PainterInfo & pi, pit_type pit, RowList::const_iterator rit)
        for (lyx::size_type d = 0; d < cur.depth(); d++)
                if (cur[d].pit() == pit
                    && cur[d].pos() >= rit->pos()
-                   && cur[d].pos() < rit->endpos())
+                   && cur[d].pos() <= rit->endpos())
                        return true;
        return false;
 }