Commit Graph

23 Commits

Author SHA1 Message Date
Jean-Marc Lasgouttes
038f003be6 Rewrite RowPainter::paintOnlyInsets to use row elements 2015-07-18 20:37:53 +02:00
Jean-Marc Lasgouttes
412a724aaf Some fixups to row margins
In breakRow set left and right margin properly for RTL paragraphs.
Remove corresponding code from ComputeRowMetrics.

In row painter, check the use of left and right margin depending on
context. The problem in the original text is that the various
leftMargin() methods actually represent right margin for RTL
paragraphs. This should be fixed eventually.
2015-07-18 00:17:00 +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
cb0dbfdadb Avoid crash when inserting space in the middle of misspelled character
This is a fixup to commit 4796e6b3.
2015-07-15 20:38:07 +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
1136bc4fb2 Convert a few more variables to int
This avoids warnings with windows compiler. It is a pity that even
clang does not give those. Maybe I missed them with the large amount
of boost warnings that it spits.
2015-07-15 10:16:42 +02:00
Jean-Marc Lasgouttes
8f73d1e56b Fix comment. 2015-07-14 18:03:58 +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
Enrico Forestieri
bc8717b297 Fix compilation after e93444e7
Stephan, please check whether RowPainter::paintMisspelledMark has
to be extended to use a third parameter, instead.
2015-05-08 14:15:38 +02:00
Stephan Witt
e93444e7e9 #9514 improved document iterator for correct check of speller disabled state 2015-05-08 11:13:51 +02:00
Stephan Witt
93b0f9c080 #9514 contents inside of LyX insets with spell check disabled should be ignored by spell checker.
The document iterator now skips math insets and insets like notes where spell check is disabled.
The continuous spell checking is part of the row painter drawing and the spell check disabled state
has to be passed down recursively while doing the inset painting.
2015-05-06 18:39:24 +02:00
Jean-Marc Lasgouttes
6e519e7727 Fix two warnings about conversion from double to int. 2015-01-11 19:55:05 +01:00
Jean-Marc Lasgouttes
9c55af4a22 Merge remote-tracking branch 'features/scroll-reloaded'
This implement horizontal scrolling of rows to allow editing insets
(math, tabular...) that are larger then the screen. The scrolling happens
as the cursor moves, in order to make sure that the cursor is always visible.
This effectively closes an 11 years old bug.

This feature is the result of the work of Hashini Senaratne as part of
Google Summer of Code 2013. The code has been cleaned-up for inclusion
and remaining bugs have been fixed.

Fixes bug: #1083.
2015-01-10 18:39:09 +01: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
e32a3e7f57 Reduce use of double variables in Row
All the code that is run before row metrics have been computed should use int arithmetic. After metrics have been computed, we still need doubles because fully justified rows use double for Row::Element::extra.

Rename Row::x to Row::left_margin and change its type to int.

Rename Row::Element::width() to full_width(). In some places of the code, use dim.wid (the int version without the extra separator) because metrics have not been computed.

Let Row::Element::x2pos take a int& argument instead of double&

Let Row::Element::breakAt take a int argument instead of double
2014-12-22 14:07:24 +01:00
Jean-Marc
fca332bace Rename FontSpan::inside(pos) to contains(pos) 2014-07-28 20:42:01 +02:00
Jean-Marc Lasgouttes
8fb1aa51f8 Whitespace only 2014-07-25 22:40:48 +02:00
Jean-Marc Lasgouttes
5e126d2920 Whitespace only 2014-07-25 22:36:20 +02: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