]> git.lyx.org Git - features.git/blobdiff - src/RowPainter.cpp
The way this was done here is inconsistent with how it is done
[features.git] / src / RowPainter.cpp
index 5e3444abb383ad5ee119a9dc760930c0f14f906a..1b7c33dcd215f90bc081fef3dc67498480866b96 100644 (file)
@@ -83,7 +83,7 @@ RowPainter::RowPainter(PainterInfo & pi,
                dotted_line_offset_ = int(0.5 * dotted_line_thickness_) + 1;
        }
 
-       x_ = row_.x + xo_;
+       x_ = row_.left_margin + xo_;
 
        //lyxerr << "RowPainter: x: " << x_ << " xo: " << xo_ << " yo: " << yo_ << endl;
        //row_.dump();
@@ -121,13 +121,15 @@ void RowPainter::paintInset(Inset const * inset, pos_type const pos)
        LASSERT(inset, return);
        // Backup full_repaint status because some insets (InsetTabular)
        // requires a full repaint
-       bool pi_full_repaint = pi_.full_repaint;
+       bool const pi_full_repaint = pi_.full_repaint;
+       bool const pi_do_spellcheck = pi_.do_spellcheck;
 
        pi_.base.font = inset->inheritFont() ? font.fontInfo() :
                pi_.base.bv->buffer().params().getFont().fontInfo();
        pi_.ltr_pos = (bidi_.level(pos) % 2 == 0);
        Change prev_change = change_;
        pi_.change_ = change_.changed() ? change_ : par_.lookupChange(pos);
+       pi_.do_spellcheck &= inset->allowSpellCheck();
 
        int const x1 = int(x_);
        pi_.base.bv->coordCache().insets().add(inset, x1, yo_);
@@ -147,6 +149,7 @@ void RowPainter::paintInset(Inset const * inset, pos_type const pos)
        // Restore full_repaint status.
        pi_.full_repaint = pi_full_repaint;
        pi_.change_ = prev_change;
+       pi_.do_spellcheck = pi_do_spellcheck;
 
 #ifdef DEBUG_METRICS
        int const x2 = x1 + dim.wid;
@@ -183,7 +186,7 @@ void RowPainter::paintChars(pos_type & vpos, Font const & font)
        for (++vpos ; vpos < end ; ++vpos) {
                pos = bidi_.vis2log(vpos);
 
-               if (!font_span.inside(pos))
+               if (!font_span.contains(pos))
                        break;
 
                bool const new_spell_state =
@@ -327,7 +330,7 @@ void RowPainter::paintFromPos(pos_type & vpos, bool changed)
                                --cpos;
                        new_word = par_.isSameSpellRange(pos, cpos) ;
                }
-               if (!new_word)
+               if (!new_word && pi_.do_spellcheck)
                        paintMisspelledMark(orig_x, changed);
        }
 }
@@ -442,16 +445,16 @@ int RowPainter::paintAppendixStart(int y)
 void RowPainter::paintTooLargeMarks(bool const left, bool const right)
 {
        if (left)
-               pi_.pain.line(dotted_line_thickness_, yo_ - row_.ascent(),
-                             dotted_line_thickness_, yo_ + row_.descent(),
-                             Color_scroll,
-                             Painter::line_onoffdash, dotted_line_thickness_);
+               pi_.pain.line(int(dotted_line_thickness_), yo_ - row_.ascent(),
+                                         int(dotted_line_thickness_), yo_ + row_.descent(),
+                                         Color_scroll,
+                                         Painter::line_onoffdash, dotted_line_thickness_);
        if (right) {
-               int const wwidth = pi_.base.bv->workWidth() - dotted_line_thickness_;
+               int const wwidth = pi_.base.bv->workWidth() - int(dotted_line_thickness_);
                pi_.pain.line(wwidth, yo_ - row_.ascent(),
-                             wwidth, yo_ + row_.descent(),
-                             Color_scroll,
-                             Painter::line_onoffdash, dotted_line_thickness_);
+                                         wwidth, yo_ + row_.descent(),
+                                         Color_scroll,
+                                         Painter::line_onoffdash, dotted_line_thickness_);
        }
 }
 
@@ -753,13 +756,13 @@ void RowPainter::paintText()
                }
 
                // Use font span to speed things up, see above
-               if (!font_span.inside(pos)) {
+               if (!font_span.contains(pos)) {
                        font_span = par_.fontSpan(pos);
                        font = text_metrics_.displayFont(pit_, pos);
 
                        // split font span if inline completion is inside
                        if (inlineCompletionVPos != -1
-                           && font_span.inside(inlineCompletionPos.pos()))
+                           && font_span.contains(inlineCompletionPos.pos()))
                                font_span.last = inlineCompletionPos.pos();
                }