Commit Graph

16 Commits

Author SHA1 Message Date
Guillaume Munch
760bca8265 Change tracking cue: paint over labels in text and prepare for further work
* 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.)
2016-06-13 08:46:15 +01:00
Jean-Marc Lasgouttes
e39e4cf96b Do not require an extra pit parameter when a row is available
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.
2016-05-30 14:55:41 +02:00
Jean-Marc Lasgouttes
4c19c5149d RowPainter const cleanup
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).
2016-05-30 14:55:41 +02:00
Jean-Marc Lasgouttes
5792606ff9 Directly pass a Row::Element to RowPainter::paintInset 2016-05-29 17:55:45 -04:00
Jean-Marc Lasgouttes
1546b91f27 Make spellchecker dotted underlines thicker. 2015-12-02 21:49:54 +01:00
Jean-Marc Lasgouttes
44acd4a3cb Remove variable y_top that was computed but not used. 2015-10-12 11:55:38 +02:00
Jean-Marc Lasgouttes
b68f391232 Re-implement text justification
* 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).
2015-07-20 23:43:05 +02:00
Jean-Marc Lasgouttes
f750d9b5cf Remove old cruft
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.
2015-07-16 23:56:24 +02:00
Jean-Marc Lasgouttes
83afe2e547 Rely on Row elements to draw rows.
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.
2015-07-16 23:24:45 +02:00
Jean-Marc Lasgouttes
1de0d2a19b Code cleanup in RowPainter
* move some code that handle selection to paintInset()

* change the arguments of paintSeparator()
2015-07-16 23:24:28 +02:00
Jean-Marc Lasgouttes
6c8520f100 Rename paintTextAndSel to paintStringAndSel 2015-07-15 22:47:47 +02:00
Jean-Marc Lasgouttes
4796e6b337 Avoid breaking kerning with continuous spell checking
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.
2015-07-15 12:13:24 +02:00
Jean-Marc Lasgouttes
463bd17d75 Use integer line thickness in painter
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.
2015-07-14 17:42:45 +02:00
Jean-Marc Lasgouttes
c8c1ee72bc Constify RowPainter (no intended change) 2015-06-29 16:12:11 +02:00
Jean-Marc Lasgouttes
52236503d3 Add marks to indicate when a row is too large
A dotted line is shown on the left or on the right to indicate that a part of the row is not visible.

Add a color code for the scroll indicator
2015-01-07 22:55:11 +01:00
Jean-Marc Lasgouttes
b54deb3683 Rename rowpainter.* to RowPainter.*
This is the convention for files that define classes.
2014-07-25 21:55:08 +02:00