This allows to somewhat simplify the text and avoid some uses of
Paragraph (in the long term, RowPainter should not have to access
these things).
At the same time do a small cleanup to RowPainter: rename
text_metrics_ to tm_, remove pm_ and width_.
* Inset::canTrackChange() had two meanings: can it deal with change tracking?
Will it paint its own CT status? The latter information is now given by
Inset::canPaintChange().
* Line thickness computation is moved from RowPainter to MetricsBase.
* Painting function for Changes moved to lyx::Change. (One new, that strikes
diagonally.)
Now that Row has a pit() member, it is possible to use it instead of passing an extra pit_type parameter to a function which already has access to a Row.
Change the various paint* helpers to take a single row element as argument.
Do not update x_ in the various paint* helpers. Constify them. Update x_ in paintText and paintOnlyInsets instead.
Remove an empty call to paintForeignMark in paintInset (the call did nothing since orig_x == x_ at this point).
* GuiFontMetrics::pos2x, x2pos: add support for inter-word spacing.
* GuiPainter::text: idem
* Row::Element::countSeparators:
Row::countSeparators: new methods that count spaces in strings.
Row::setSeparatorExtraWidth: new method (code lifted from TextMetrics.cpp).
* TextMetrics::computeRowMetrics: rely on the above methods.
* RowPainter::paintMispelledMarked: pass only a Row::Element object reference
RowPainter::paintStringAndSel: idem; do not rely on values returned by
Painter::text (trailing spaces do not honor wordspacing value).
There are many things that are not necessary anymore:
* remove methods paintText2, paintFromPos, leftMargin, paintInlineCompletion
* Remove use of Bidi class.
* add a Font and a Change parameter to paintInset.
Also remove a comment that describes what we have just done.
The new version of paintText is quite short. Elements are treated one
by one. They are already in the right ordering.
The other changes are:
* a new paintChange method is added (using code lifted from old version)
* in paintLast, the support for end of paragraph markers is removed
(this is already part of the Row object.
There is a mismatch between the way text is tokenized in Row objects
and the way it is shown on screen. When metrics are computed,
continuous spell checking has not been done yet. Yet, the row painter
explicitly breaks words at spell status boundaries. This creates
problem with a text like "PMP," (see bug #9649), where there is a
negative kerning before the comma.
This is solved by not taking in account spell status when drawing
text, and drawing spell underlines separately.
* replace Paragraph::isSameSpellRange with new method getSpellRange.
* merge RowPainter::paintChars into RowPainter::paintFromPos
* move the actual text painting code into the new paintTextAndSel.
* merge some code from paintFromPos to paintMisspelledMark
* in paintMisspelledMark, scan the string which needs to be annotated
and add dashed line below text marked as misspelled.
Fixes bug #9649.
There is no need for real-valued line width in painters. Actually, this even leads to uneven dashes for continuous spell checker.
The new code is supposed to be equivalent to the old one, just more readable. From this, we can try to see whether some lines need to be made thicker on HiDPI screens.