Commit Graph

32497 Commits

Author SHA1 Message Date
Jean-Marc Lasgouttes
7734270163 Speed-up drawing when text is not justified.
Do not cut strings at separators in RowPainter when text is not
justified. This speeds-up painting by reducing the number of strings
to draw.

Do also a modest cleanup of paintChar (remove dubious optimization).
2014-07-08 21:24:01 +02:00
Jean-Marc Lasgouttes
3013ce3716 Implement a better solution for painting of RTL text
Instead of relying on character range (Hebrew or Arabic) or character
direction, use RLO unicode character (Right-to-Left override) to force
painting in the direction indicated by the current font. This should
be as close as we can to the old LyX behavior (and requires less
code).

If this code works as intended, it will be possible to remove a lot of
code from Encodings.cpp.
2014-07-08 21:24:00 +02:00
Jean-Marc Lasgouttes
ea1a5cb80e Draw right-to-left text string-wise using Qt
We rely on Qt built-in unicode support for handling Arabic and Hebrew
compose characters. This allows to avoid to use our homegrown
machinery.

This  should provide a nice speedup at a low cost and
will eventually allow us to get rid of:
 * most of our Arabic/Hebrew machinery in Encodings.cpp,
 * Paragraph::transformChar,
 * and probably more.
2014-07-08 21:24:00 +02:00
Jean-Marc Lasgouttes
b8170e0e01 Fix various selection-related problems
All these problems are related to what happens at the extreme points of rows

 * since VIRTUAL elements have a width but no contents, they have to
   be treated specially at some places. It would have been better to
   avoid testing for them explicitly, but I did not find a way.

 * Improve and cleanup the code in breakRow and fix in passing a crash
   when clicking on the right of an incomplete MARGIN_MANUAL
   paragraph.

 * improve the computation of row width in TextMetrics::computeRowMetrics.

 * handle properly the case where a position if not found on the row
   in both cursorX and getPosNearX (actually, this happens when
   selecting).

 * Some code cleanup and comments.
2014-07-08 21:23:59 +02:00
Jean-Marc Lasgouttes
7167d90b50 Fix bug #9040: In RtL documents end-of-paragraph marker shifts the row display
The fact that the bug was still present in the features/str-metrics
branch comes from a goof in the initial implementation of 'virtual'
row elements (completion and end-of-par markers). Now that this is
corrected, everything works as it should.

The fact that the bug is present in master is due to some other reason
that is not useful to investigate now.
2014-07-08 21:23:59 +02:00
Jean-Marc Lasgouttes
1a4b3201e7 Update README and do a small code cleanup 2014-07-08 21:23:58 +02:00
Jean-Marc Lasgouttes
f686375eec Change getColumnNearX to getPosNearX
The semantics was bad: the old implementation would return pos - row.pos(), and then all user of the function had to re-add row.pos().
2014-07-08 21:10:47 +02:00
Jean-Marc Lasgouttes
9ba97a85f0 Small fixes to cursor positioning.
Two small fixed to Row::Element::x2pos:
* fix position for elements that are not strings
* make rounding match the old code
2014-06-25 17:55:30 +02:00
Jean-Marc Lasgouttes
79014c7551 More fixes to cursorX
In Row::Element::pos2x, handle the boundaries in a cleaner way.
2014-06-25 17:55:30 +02:00
Jean-Marc Lasgouttes
8649ac7fe6 Some fixes related to RTL text
* fix handling of boundary situations in Row::Elements::x2pos;

 * fix handling of boundary situations in TextMetrics::getColumnNearX;

 * make sure to always use Font::isVisibleRightToLeft instead of Font::isRightToLeft;

 * Improve debug messages.
2014-06-25 17:55:30 +02:00
Jean-Marc Lasgouttes
443a453427 New reverseRTL implementation
The old version was a bit complicated and wrong for RtL paragraphs
containing LtR text. THe new one is clearer.
2014-06-25 17:55:30 +02:00
Jean-Marc Lasgouttes
059de2d04c Fix getColumnNearX for nested insets
The horizontal position of the inset was not taken in account.
The rounding is not always the same as with the old code, but this
is not really important.

Additional changes:

 * improve debug output of rows

 * remove Bidi& argument of the RowPainter constructor, since it is always
   an empty Bifi that is passed. This means that the Bidi class is not
   used at all any more in TextMetrics.cpp. The only remaining user is
   RowPainter.
2014-06-25 17:55:30 +02:00
Jean-Marc Lasgouttes
6258cebb77 Fix line breaking algorithm
Break words longer than the screen width. The code is more complicated
than I would like, but I have no better idea right now.

Implement properly the notion of a row broken by a display inset. This is useful in different places.

Also fix a bug with last line of a paragraph spotted by Kornel.
2014-06-25 17:55:30 +02:00
Jean-Marc Lasgouttes
ff608f46fd Handle boundary in getColumnNearX (and more)
Use proper font everywhere for end-of-par marker

Fix getColumnNearX for RTL text and for centered/right-justified paragraphs.

Let computeRowMetrics update the row width.
2014-06-25 17:55:30 +02:00
Jean-Marc Lasgouttes
f215bb3b92 Re-implement getColumNearX using row elements
The code is now so much shorter that it is scary... Expect that
further changes will be necessary

Cursor boundary is not handled yet.
2014-06-25 17:55:30 +02:00
Jean-Marc Lasgouttes
01c9bcb432 Get rid of ugly font metrics workarounds.
Now we have proper ligatures and kerning on screen...
2014-06-25 17:55:16 +02:00
Jean-Marc Lasgouttes
35d47698c6 Convert cursorX() and computeRowMetrics() to the new scheme
* convert cursorX to new scheme; old computation is still there for the sake of comparison.

* use Row to compute separator width in computeRowMetrics; again, the old code is retained for now.

* Get rid of rowWidth()
2014-06-25 17:54:27 +02:00
Jean-Marc Lasgouttes
d32f76f7fe Small Inset isXXX methods cleanup
* rename isStretchableSpace to isHfill
 * inline a trivial method
 * remove InsetIPAMacro::isLineSeparator, which has the same value as default.
2014-06-25 17:54:26 +02:00
Jean-Marc Lasgouttes
b2eba66083 Implement proper handling of RtL in Rows
Now the row elements are sorted according to RtL/LtR.

Some additional cleanup.
2014-06-25 17:54:26 +02:00
Jean-Marc Lasgouttes
452fb60359 Store in the Row object the list of elements it contains
* Row now contains a vector of Elements
* replace Row::dump by a proper << operator
* the width is updated as elements are added
* breakRow is reimplmented to use this infrastructure
2014-06-25 17:54:26 +02:00
Jean-Marc Lasgouttes
8539f756ed Implement real string width computation
Important features:
* widths are cached in a map
* old behavior is still used when lyxrc.force_paint_single_char is true.
2014-06-25 17:54:15 +02:00
Jean-Marc Lasgouttes
b044696d59 Add a readme file describing the state of the branch 2014-06-25 17:53:35 +02:00
Jean-Marc Lasgouttes
cf31077932 Change TextMetrics::rowHeight to setRowHeight
This new function takes a row as parameter.

Also, add direct access to Row::dim_
2014-06-25 17:53:34 +02:00
Jean-Marc Lasgouttes
fe8c3b4348 Cleanup TextMetrics::rowBreakPoint.
Collect properly all strings to compute string metrics

Some changes with respect to existing code
 - end of paragraph font is now the one of the text
 - words longer than a line are not broken anymore. I think this is not useful  if we have horizontal scrollbar

Other than that, the code is still compatible with rowWidth and friends.
2014-06-25 17:53:34 +02:00
Jean-Marc Lasgouttes
edcedf3324 Revert temporarily changes related to InsetSeparator
This is to avoid many conflicts with the str-metrics branch.
2014-06-25 17:53:09 +02:00
Scott Kostyshak
c62a53b78b Remove an incorrect/expired FIXME
Both Richard and JMarc think it is incorrect. See
  https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg184758.html
2014-06-23 08:03:44 -04:00
Scott Kostyshak
78b7045ed8 CMake: full path of an include needed for ver <3.0 2014-06-21 20:43:06 -04:00
Kornel Benko
7bc0a6f388 Cmake tests: Optimizing the cmake configuration time
The configuration time suffers mostly on checking, which of the export tests
is to be reverted.
1.) There is a new configuration flag now, "LYX_ENABLE_EXOPRT_TESTS.
   If not set (default) no export tests are created.
2.) If set, then the optimization halves the time needed for creation of tests.

The effect on my side:
        a.) Until now the time was:        ~ 26 seconds
        b.) The optimized time is now:     ~ 16 seconds
        c.) With not enabled export tests: ~  5 seconds
2014-06-21 21:15:54 +02:00
Kornel Benko
c9a6939ebb ctests: Use regular expressions 2014-06-19 21:04:18 +02:00
Scott Kostyshak
e11ae599ea Update ctests to reflect inputenc changes
There were changes to inputenc and luainputenc that are now
released in Tex Live 2014 that affect several exports. Some
exports that produced good PDFs now fail. Others that produced
incorrect PDFs (with gibberish) now correctly fail. Several
IEEEtran-* exports failed before and now export correct PDFs.

For more information, see

  http://tug.org/pipermail/tex-live/2014-May/035338.html
  https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg184435.html
2014-06-19 10:26:15 -04:00
Scott Kostyshak
7ae0700c7e Fix a comment 2014-06-19 10:26:01 -04:00
Scott Kostyshak
8c5be96164 Give more tips in beamer-article.lyx 2014-06-19 01:44:15 -04:00
Kornel Benko
d553ec88bb * sk.po: spellcheck changes 2014-06-18 15:51:27 +02:00
Pavel Sanda
0eb94a3e61 Fix license string according to http://spdx.org/licenses/.
https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg184749.html
2014-06-17 09:50:28 -07:00
Peter Kümmel
2f17858115 On Linux show in crash message box the backtrace 2014-06-14 11:25:25 +02:00
Scott Kostyshak
bcbc162665 Select word on double click even when at boundary
Now when double clicking on a boundary of a word, the
word is selected. This also causes single-letter words
to now be selected (fixes #9159).
2014-06-13 10:48:49 -04:00
Jean-Marc Lasgouttes
01ba22efff Fix checkmark on current entry for InsetSeparator context menu
The code supposed to do that contained a typo and was not completely correct.
2014-06-13 10:30:25 +02:00
Uwe Stöhr
8cb15c218b French documentation files: port today's changes 2014-06-13 01:27:19 +02:00
Scott Kostyshak
5594b43d2c Add comment and fix a typo 2014-06-12 17:56:57 -04:00
Kornel Benko
3b14de740d Cmake build: Symplify use of linking optional libraries found via find_package 2014-06-12 19:02:29 +02:00
Stephan Witt
e67e37d759 Apple has builtin native spell checker, no need to warn for missing Aspell, hunspell or Enchant 2014-06-12 14:55:56 +02:00
Kornel Benko
1b3e4c73f8 Cmake tests: Added parser_tools test to the lyx2lyx group tests 2014-06-12 09:07:57 +02:00
Kornel Benko
207cd7a1b7 Cmake build: Use LYX_USE_QT to determine if QT uses X11 2014-06-12 07:52:45 +02:00
Kornel Benko
2b0511510a Cmake build: Added magic library to some link commands.
Needed due to the use of magic_(open|load|error|file|close) after recent changes.
2014-06-12 07:49:17 +02:00
Enrico Forestieri
f439609304 Make binary file detection more robust.
The magic library can detect the charset used by a file. While this
detection is not full proof, actually the library seems to be infallible
as regards the binary nature of a file. So, use libmagic for the detection
and fallback to the previous method if the library is not installed or
its database cannot be loaded.
2014-06-11 23:04:39 +02:00
Enrico Forestieri
82faa66192 Set the default locale at startup.
On startup, the default locale is "C", meaning that all system
functions assume an ascii codeset. The environment's locale
settings should be selected by calling setlocale(LC_ALL,"").
This is done by Qt during the QCoreApplication initialization
but this inizialization is never performed for batch processing
and, as a result, LyX is not able to process files whose names
contain non-ascii characters. This is not an issue on Windows,
where the file names are always stored as UTF-16, so the call is
only performed for unix-like platforms (this also includes cygwin,
due to its own filenames management that allows using characters
which are forbidden to native programs).
2014-06-11 18:23:44 +02:00
Georg Baum
f76d6997b7 Fix thinko in loop detection 2014-06-09 22:06:58 +02:00
Georg Baum
f792e70d0a Fix wrong "externally modified" message
This was a regression of 10364082c8.
2014-06-09 13:17:40 +02:00
Georg Baum
f09a9fe2e6 Remove unsafe method FileName::tempName()
FileName::tempName() created a new temp file name by using qt to create a
temporary file with a unique name, and then deleting that file and returning
the name. This was unsafe, since other processes or even other threads of the
running LyX could create files with the same name between deletion and then
using the temp name.
This is fixed by using the TempFile class instead. As a side effect, a few
cases where the temp files were not deleted after usage were fixed as well.
The only place that is still unsafe is createTmpDir().
2014-06-09 13:05:50 +02:00
Georg Baum
ae15b59734 Don't double delete by making TempFile noncopyable
The compiler generated copy constructor and assignment operator are wrong.
This could easily be fixed by implementing them manually, but a) they are
not needed, and b) the semantics would be unclear (should the copy point
to a new temp file or not?), so it is better to forbid them.
2014-06-09 13:03:32 +02:00