This commit replaces almost all occurrences of Q_WS_WIN to comply
with Qt5. The remaining occurrences should *not* be replaced,
because the guarded code won't compile on Qt5.
The command line argument -geometry WIDTHxHEIGHT±XOFF±YOFF
specifies a preferred size and location for the main window.
Currently, this is semi-broken on Windows. Indeed, only
specifying WIDTH and HEIGHT places the main window such that
the left and top borders are invisible such that the window cannot
be moved. Moreover, the XOFF and YOFF parts (when present) are
used to specify the distance of the window from the left and top
or right and bottom edges of the screen, when using '+' or '-',
respectively. However, -geometry 800x600-20-20, instead of placing
the window such that its bottom and right edges are at a distance
of 20 pixels from the corresponding screen edges, places the
window such that its left and top borders are out of the screen.
This is corrected by this commit, which also addresses the fact
that Qt5 does not define Q_WS_WIN anymore.
Empty selections can cause confusing behavior for a few reasons:
(1) some functions behave differently depending on whether there is a
selection. If I press delete, nothing happens (where I expect the
character or inset before the cusor to be deleted). If I toggle bold or
emphasize nothing happens (where if there is no selection the entire
word is toggled). There are other LyX functions that depend on whether
there is a selection or not. Further, I wonder if any part of LyX's code
assumes that if there is a selection it is non-empty.
(2) menu options are incorrectly set. For example, the scissors icon.
For remaining empty selection issues, see #9222.
For more information, see:
https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg184758.html
This branch implements string-wise metrics computation. The goal is to
have both good metrics computation (and font with proper kerning and
ligatures) and better performance than what we have with
force_paint_single_char. Moreover there has been some code
factorization in TextMetrics, where the same row-breaking algorithm
was basically implemented 3 times.
Globally, the new code is a bit shorter than the existing one, and it
is much cleaner. There is still a lot of potential for code removal,
especially in the RowPainter, which should be rewritten to use the new
Row information.
The bugs fixed and caused by this branch are tracked at ticket #9003:
http://www.lyx.org/trac/ticket/9003
What is done:
* Make TextMetrics methods operate on Row objects: breakRow and
setRowHeight instead of rowBreakPoint and rowHeight.
* Change breakRow operation to operate at strings level to compute
metrics The list of elements is stored in the row object in visual
ordering, not logical. This will eventually allow to get rid of the
Bidi class.
* rename getColumnNearX to getPosNearX (and change code accordingly).
It does not make sense to return a position relative to the start of
row, since nobody needs this.
* Re-implement cursorX and getPosNearX using row elements.
* Get rid of lyxrc.force_paint_single_char. This was a workaround that
is not necessary anymore.
* Implement proper string metrics computation (with cache). Remove
useless workarounds which disable kerning and ligatures.
* Draw also RtL text string-wise. This speeds-up drawing.
* Do not cut strings at selection boundary in RowPainter. This avoids
ligature/kerning breaking in latin text, and bad rendering problems
in Arabic.
* Remove homebrew Arabic and Hebrew support from Encoding.cpp. We now
rely on Qt to do handle complex scripts.
* Get rid of LyXRC::rtl_support, which does not have a real use case.
* Fix display of [] and {} delimiters in Arabic scripts.
The use of RLO/LRO overrides to force text orientation was really hackish and the way it was done caused dropped letters in Mac OS X (for some unknown reasons).
This new approach is much cleaner, except that it relies on features not advertised in documentation
but present at least from Qt 4.5 to Qt 5.3:
* TextFlag enum values TextForceLeftToRight and TextForceRightToLeft, which are strong versions
of QPainter::setLayoutDirection; they are passed as a parameter of QPainter::drawText.
* QTextLayout::setFlags method, which is required to pass the above flags to QTextLayout.
The unicode override method is still used to draw strings Mac OS X because, for some reason, the direction was not really enforced in this case.
This can only be done where splitting of string is identical in row breaking and display. It will be possible to reintroduce this when row painting uses the tokenized row information.
The option --enable-qt5 allows configuring for Qt5. The default is Qt4.
Nothing special is done with respect to Qt4, apart from pulling in the
correct libraries. Indeed, other than the core and gui libraries, now
also the concurrent and widgets libraries are needed.
This variable was introduced to guard against any bad consequence of the then-new right-to-left
languages support. Let's be bold and get rid of it altogether!
Now right to left support is always enabled.
The display of partially-selected word is now done in a new Painter::text method
which displays the string twice with different clip settings. This allows to
catter for the case where Color_selectiontext is not black.
Morover, the code that uses unicode override characters to force the
direction of a string is moved to lstrings.h.
Fixes: #9116
The old implementation of Row::Element::pos2x and x2pos did not work
correctly with Arabic text, because characters can have shapes that
depend on context.
This new implementation leverages QTextLayout in a simplified way,
since only one word is added to the layout.
This allows to make Row::Element::x2pos more readable.
Fixes: #9115.
Using a static variable here was premature optimization: fileNames() is only
called from GuiRef (directly or indirectly), and since this is a dialog the
copying of a FileNameList is not noticeable at all.
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().
Thanks to maciejr we know now what the remaining problem was with bug 7954:
My unicode symbol fallback works fine, the problem was that a font named
"Symbol" is available on OS X, but it does not use the font-specific encoding
we expect: Almost all glyphs are at their unicode code point.
Therefore the bug is fixed by re-enabling the unicode workaround and blocking
the Symbol font on OS X.
Maximizing the document settings window when on the modules pane,
the horizontal space is now given to the module names and so no
scrollbar is needed. Before, even when maximized, a scrollbar was
sometimes needed because the horizontal space was given to the
buttons in the middle, which did not provide an extra benefit.
The default sizeType was "Expanding" and is now changed to "Minimum"
for the horizontal spacer above the middle buttons.
The firs tinvolves a thinko in BibTeXInfo::expandFormat. We were previously
counting passes through this routine, which means: one for every character,
more or less. So long strings would hit the "recursion limit". But what
we are worried about is an infinite loop caused by misues of macros, so that
is what we need to count.
This prevents the error we were previously getting, but it reveals a huge
slowdown when one tries to open a citation inset with a large nubmer of keys.
So we also limit the number of keys we try to process, and the length of the
string we try to display, when we are generating citation information.
I'm convinced that there is a deeper problem in how citation information is
generated (see the bug tracker for more info), but that will require major
surgery and a file format change
addPath() always adds a slash at the end, os got a double one before.
Qt and the OS are clever enough to understand that, but a single slash
looks more nice.
This has the advantage of simplifying our code and to produce the
correct output: the small capitals should have the exact same width as
the lower case letters.
The slanted fonts are also translated to oblique on Qt side, but this
does not seems to have an effect in my testing. It may be that proper
oblique fonts need to be installed.