Commit Graph

35496 Commits

Author SHA1 Message Date
Jean-Marc Lasgouttes
0311718215 Split TextMetrics::setRowHeight in three parts
The new functions parBottomSpaging and parTopSapcing return below/above each paragraph.

This allows to remove the TopBottomSpace argument and makes the code a
bit clearer.
2016-05-30 14:55:41 +02: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
095c390fe2 Update PAINTING_ANALYSIS and add a new task 2016-05-30 14:55:41 +02:00
Jean-Marc Lasgouttes
656b7f5ab7 Set vertical margins in redoParagraph, not setRowHeight
It is actually easier to set the 20 pixels margin in redoParagraph, since it is not necessary to take newlines in account when deciding what is the real last row of the paragraph.

Moreover this solves the following bug (present in 2.1.x too): when the document ends with a newling, the bottom margin disappears.

Update PAINTING_ANALYSIS with new tasks.
2016-05-30 14:55:41 +02:00
Jean-Marc Lasgouttes
598f7e4a45 Cleanup Painter text() API
* remove optional arguments to the helpers that use a FontInfo
* add a textwidth argument to the text() methods that are used by rowpainter.

Now textwidth is only computed if a null value was passed to the
text() method. This means that in the use case of rowpainter, no
textwidth needs to be computed.
2016-05-30 14:55:41 +02:00
Jean-Marc Lasgouttes
333f6fcf07 Make the different Painter::text void methods
The textwidth value that was returned is not used anymore. Now in some
cases we can avoid to compute it at all.
2016-05-30 14:55:41 +02:00
Jean-Marc Lasgouttes
51b1cfab72 Do not use the return value of Painter::text for logos
This will allow to get rid of this return value (and avoid computing it).
2016-05-30 14:55:41 +02:00
Jean-Marc Lasgouttes
ac759b4368 Rewrite setRowHeight using row information
The initial values for maxasc and maxdes (renamed from maxdesc) is obtained as a maximum of max ascents/descents of all row elements.

This allows to get rid of Paragraph::highestFontInRange and FontList::highestInRange.

Some auxilliary variables declarations are also moved to where they are needed.
2016-05-30 14:55:41 +02:00
Jean-Marc Lasgouttes
1751626776 Simplify redoParagraph by merging duplicate code
Let breakRow return a boolean indicating whether an additional row is
required (after a newline) and use that to replace the code that added
an extra row when a paragraph ends with a newline.
2016-05-30 14:55:41 +02:00
Jean-Marc Lasgouttes
78eaf8333b Update PAINTING_ANALYSIS
Some things were wrong, and some new ideas are added (some are done in
this branch already).
2016-05-30 14:55:41 +02:00
Jean-Marc Lasgouttes
fc73ebc16c Make the non-drawing cases faster in TextMetrics::drawParagraph
There are two main cases:
* when drawing is disabled from the start, use a simplified code that only paints insets (in order to cache positions).
* when the row is not visible, do the same.

The goal of this optimization is to be able to always run a no-drawing draw after the metrics have been computed.
2016-05-30 14:55:41 +02:00
Jean-Marc Lasgouttes
96fee0ed7a Move some horizontal scrolling code from TextMetrics to BufferView
It is better to have all the code in the same place, and it will avoid code duplication later.
2016-05-30 14:55:41 +02:00
Jean-Marc Lasgouttes
77ef48d093 Only add inset postion to cache in paintInset
It was also added in paintText and paintOnlyInsets.
2016-05-30 14:55:41 +02:00
Kornel Benko
30ef73ab66 Cmake xhtml export tests: Missing script for commit 4162424762 2016-05-30 10:22:59 +02:00
Kornel Benko
4162424762 Cmake xhtml export tests: Use command xmllint to test the export result 2016-05-30 09:50:22 +02:00
Kornel Benko
161cf52363 Dont use invalid tag '<pre></pre>' in xhtml export 2016-05-30 09:48:06 +02:00
Kornel Benko
6823115d17 Cmake tests: Allow test of LongestLabelWithUnderscore_xhtml 2016-05-30 09:46:01 +02:00
Kornel Benko
7a86fe3e0b Cmake: Allow test for X11 with QT5.6
Used for key-test tests.
2016-05-30 08:22:15 +02:00
Uwe Stöhr
dd0330c349 UserGuide.lyx: update 2 images 2016-05-30 04:27:36 +02:00
Uwe Stöhr
978eea2173 CMake: add 2 build scripts to compile LyX with Qt 5 and MSVC 2015 2016-05-30 02:03:16 +02:00
Uwe Stöhr
234d482e1e tufte-handout.lyx: add the lost \origon tag
That the origin tag is automatically removed sucks. It consumes a lot of time to re-add it again and again.
2016-05-30 01:46:16 +02:00
Uwe Stöhr
be5ec39cf2 tufte-handout.lyx: remove some unnecessary TeX code 2016-05-30 01:42:00 +02:00
Uwe Stöhr
b917c4e40f Merge branch 'master' of git.lyx.org:lyx 2016-05-29 23:58:10 +02:00
Uwe Stöhr
e7aaaeded3 Win installer: push the changes that are already part of the 2.2.0 installer 2016-05-29 23:57:37 +02:00
Kornel Benko
82e0ad3efa Correct wrong path for included lyx-file
Although the fix affects only a content of a LyX note, it is
still surprising to get a dialog-window demanding creation
a new document if trying to edit the subdocument.
2016-05-29 17:55:55 -04:00
Jean-Marc Lasgouttes
d30fe45f4c Fixup 1b2aad9 : Cleanup of spacing in mathed
Now that 5mu are added on each side of : (because it is a relation), there is no need to do the same in the definition of \vcentcolon.

This is closer to what is done in mathtools.sty.
2016-05-29 17:55:55 -04:00
Jean-Marc Lasgouttes
65a6cc1fc3 Cleanup of spacing in mathed
This is a first cleanup step. More complex rules have to be
implemented on top of this.

Use proper spacing \thinmuskip, \medmuskip and \thickmuskip instead of
ad-hoc values.

Rename isRelOp to isMathRel and introduce isMathBin and isMathPunct
(for InsetMathChar and InsetMathSymbol). Update the categories of
characters in InsetMathChar according to LaTeX source (fontmath.ltx).

Set correctly the spacing around mathrel, mathbin and mathpunct
elements. Use \thinmuskip around MathDelim instead of a hardcoded 4.

This is related to bug #8883.
2016-05-29 17:55:55 -04:00
Günter Milde
320b616c50 Improve documentation of LyX' "smart quotes" feature. 2016-05-29 17:55:55 -04:00
Jean-Marc Lasgouttes
68149e380d Remove extra spacing around InsetCommand buttons
There is already a spacing of 2 pixels on each side of a button (e.g. collapsed inset). There is no need to add one extra pixel for command insets.

Fixes part of bug #10149.
2016-05-29 17:55:46 -04:00
Jean-Marc Lasgouttes
516d5d29dc Fix drawing of buttonText (enforce same left/right spacing)
The computation of the width of the button was wrong. If <--> stands for TEXT_TO_INSET_OFFSET/2 spacing, and if `[]' marks the button's limits, then the intent is
  <-->[<-->button text<-->]<-->

Therefore the physical grey rectangle width is
   width - Inset::TEXT_TO_INSET_OFFSET

With this change, the spacing on the right of the button is not larger than the  left one.

Fixes bug #10147.
2016-05-29 17:55:46 -04:00
Jean-Marc Lasgouttes
ccc8ad4744 Cleanup handling of LFUN_LAYOUT_PARAGRAPH in getStatus
The way it works is:
* the inset defines allowParagraphCustomization() correctly
* Text::getStatus acts on it.

Note that, in Text::getStatus, testing for cur.inset().allowParagraphCustomization() does not make much sense, since one should pass the cursor idx as parameter. Actually, for some reason the safest bet is to use the owner of the Text object as inset.
2016-05-29 17:55:46 -04:00
Jean-Marc Lasgouttes
0d21dca360 Cleanup handling of LFUN_LAYOUT in getStatus
The way it works is:
* the inset defines forcePlainLayout() correctly
* Text::getStatus acts on it.

Note that, in Text::getStatus, testing for cur.inset().forcePlainLayout() does not make much sense, since one should pass the cursor idx as parameter.

There are many other lfuns that do not have to be handled directly by insets. InsetScript in particular has tests for way too many lfuns.
2016-05-29 17:55:46 -04:00
Jean-Marc Lasgouttes
f78967a802 Rename badly named variable 2016-05-29 17:55:46 -04:00
Jean-Marc Lasgouttes
019fceda3f Remove variables set but not used
This was found by cppcheck.
2016-05-29 17:55:46 -04:00
Jean-Marc Lasgouttes
a8cfeb1538 Move one Text::setCursor instance to CursorSlice
This method did access more CursorSlice than Text. It is only a setter for
CursorSlice with some bound checking. The new signature is
setPitPos(pit_type, pos_type).
2016-05-29 17:55:46 -04:00
Jean-Marc Lasgouttes
0437d8dc1a Variables of type pit_type should be named pit, not par
It is easier to use always the same conventions for naming.
2016-05-29 17:55:46 -04:00
Jean-Marc Lasgouttes
83d8e12cc1 Rename Cursor::setSelection(bool) to selection(bool)
The old name would be confusing wrt setSelection(), which does additional checks.
This one is a pure acessor, and the more complete methods are
* setSelection(), which avoids empty selections
* clearSelection(), which resets anchor, and sets word selection and mark more to false.

Most of the code should use these two instead of selection(bool), but this is for later.
2016-05-29 17:55:46 -04:00
Jean-Marc Lasgouttes
9fbee19a7f Avoid incorrect "Autocorrect Off" message 2016-05-29 17:55:46 -04:00
Jean-Marc Lasgouttes
5739433feb FindAndReplace: reorder includes 2016-05-29 17:55:45 -04:00
Jean-Marc Lasgouttes
641691bc12 TextMetrics: Use shorter names for font metrics
This keeps code easier to read.
2016-05-29 17:55:45 -04:00
Jean-Marc Lasgouttes
700e480a18 Cleanup bruteFind. 2016-05-29 17:55:45 -04:00
Jean-Marc Lasgouttes
27bc2e4b63 Remove unused bruteFind* functions
And rename bruteFind2 to bruteFind.
2016-05-29 17:55:45 -04:00
Jean-Marc Lasgouttes
171fe0cb43 Remove unused CursorData::logicalpos_
This was introduced in 41ecabf5, probably by mistake.
2016-05-29 17:55:45 -04:00
Jean-Marc Lasgouttes
5792606ff9 Directly pass a Row::Element to RowPainter::paintInset 2016-05-29 17:55:45 -04:00
Jean-Marc Lasgouttes
e52a83549d Remove unused TextMetrics::maxWidth() 2016-05-29 17:55:45 -04:00
Jean-Marc Lasgouttes
4fb8e9b639 Use isMainText() instead of doing explicit tests 2016-05-29 17:55:45 -04:00
Jean-Marc Lasgouttes
d0a318c742 We do not use <boost/scoped_array.hpp> anymore
The code using it  was removed at 81959251.
2016-05-29 17:55:45 -04:00
Jean-Marc Lasgouttes
5ee778af75 Remove support/metahash.h
It turns out that it did not take off since introduced in 2011. It is better to remove it and the associated boost headers (extract.sh was run against boost 1.60 to do the update).

Since we will move away from several boost classes when transitioning to C++11, it is good to start by removing lesser used ones.
2016-05-29 17:55:45 -04:00
Jean-Marc Lasgouttes
68a1f9a44e Do not use of boost::tokenizer
It is easier to use instead getVectorFromString for the use we have of this tokenizer. The two places are environment.cpp (path stuff) and qt_helpers (file fileters). The new code is much shorter.

This allow to remove boost/tokenizer.hpp and friends from our boost tree.
2016-05-29 17:55:45 -04:00