Commit Graph

4837 Commits

Author SHA1 Message Date
Stephan Witt
ce57594afd Remove Qt4 artifacts in comments 2014-10-01 10:06:17 +02:00
Kornel Benko
6c7b5b12c7 Add cmake files to autoconf's dist 2014-08-31 15:21:20 +02:00
Stephan Witt
3aa428fdea #9245 replace Q_WS_MACX with Q_OS_MAC - the Q_OS_MAC macro is usable with Qt4 and Qt5. 2014-08-25 20:08:59 +02:00
Enrico Forestieri
4521fc757b Replace Q_WS_WIN with appropriate guards to account for Qt5.
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.
2014-08-25 19:27:45 +02:00
Enrico Forestieri
565260126e Fix the -geometry command line argument for Windows.
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.
2014-08-25 18:35:15 +02:00
Stephan Witt
5af8238700 Reintroduce some class definitions. 2014-08-24 21:40:40 +02:00
Stephan Witt
3218d32ace Remove superfluous class definitions. 2014-08-24 20:32:01 +02:00
Stephan Witt
f73091228c Remove special GlobalMenuBar class. As Patrick De Visschere pointed out it is not needed. The shortcut handling of Qt does it internally now what GlobalMenuBar was made for. 2014-08-24 20:29:52 +02:00
Stephan Witt
6cbaad9398 Correct the method signature of MenuTranslator::translate for Qt5 2014-08-23 16:01:03 +02:00
Stephan Witt
d1bfad86e5 Use QProxyStyle instead of QMacStyle. QMacStyle is not available anymore with At5 and QProxyStyle is present since Qt4.6 as an alternative 2014-08-22 11:17:34 +02:00
Richard Heck
c2fdbbe01a Fix bug #9236: After we recreate the DocumentClass, we have to apply
it to the document.
2014-08-07 15:13:31 -04:00
Scott Kostyshak
453ce61191 Revert "Clear empty selections in GuiView after dispatch"
This reverts commit fb05011ad0,
which lead to various menu-related crashes, such as when
going to Help > About.
2014-08-03 19:20:56 -04:00
Scott Kostyshak
4843618655 Disable branches insert menu if read only 2014-07-28 12:59:35 -04:00
Scott Kostyshak
0bf61a48c0 Disable custom insets insert menu if read only
Before, if a document was read only and had no custom insets
defined, the submenu would be enabled.
2014-07-28 12:59:34 -04:00
Scott Kostyshak
d449e7e64e Submenus now expand even if all items are disabled
As stated in the Apple HIG[1] (via JMarc):

  Ensure that a submenu’s title is undimmed even when all its commands
  are unavailable. As with menu titles, it’s important for users to be
  able to view a submenu’s contents, even if none of them are
  available in the current context.

[1]
https://developer.apple.com/library/mac/documentation/UserExperience/Conceptual/AppleHIGuidelines/Menus/Menus.html#//apple_ref/doc/uid/TP30000356-TP6
2014-07-28 12:59:34 -04:00
Scott Kostyshak
fb05011ad0 Clear empty selections in GuiView after dispatch
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
2014-07-28 10:37:08 -04:00
Jean-Marc Lasgouttes
f9caebd29f Fix compilation warnings on windows. 2014-07-28 09:46:13 +02:00
Kornel Benko
5acc6b3791 Make it compilable under cmake again after the merge from str-metrics 2014-07-25 22:03:59 +02:00
Jean-Marc
41740ea915 Merge remote-tracking branch 'features/str-metrics'
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.
2014-07-25 20:10:55 +02:00
Jean-Marc
f4fc035cf6 Better algorithm for forcing bidi drawing
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.
2014-07-25 19:56:51 +02:00
Kornel Benko
63976066ad avoid qt4 variable names in cmake build 2014-07-21 08:49:05 +02:00
Jean-Marc Lasgouttes
bbe6e9f593 Revert optimization where several words are drawn at the same time
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.
2014-07-20 18:54:31 +02:00
Enrico Forestieri
4bdeae2733 Update autotools for building with Qt5.
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.
2014-07-19 03:34:28 +02:00
Enrico Forestieri
294d08b1bf Add forward search command for qpdfview.
Also update docs explaining how to activate reverse search in qpdfview.
2014-07-13 20:08:43 +02:00
Jean-Marc Lasgouttes
45eb314a86 Get rid of rtl_support preference
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.
2014-07-09 21:11:08 +02:00
Jean-Marc Lasgouttes
ec42b2e4c9 Do not split words at selection boundary
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
2014-07-08 21:30:06 +02:00
Jean-Marc Lasgouttes
2ff639a0e6 Fix positionning of cursor
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.
2014-07-08 21:30:05 +02:00
Jean-Marc Lasgouttes
4176795e72 Remove support for LyXRC::force_paint_single_char
This workaround is not necessary anymore, and it complicates the code.

The variable itself will be removed after the landing of the branch on
master.
2014-07-08 21:30:05 +02:00
Jean-Marc Lasgouttes
b0543270a9 Remove debug code from TextMetrics
After this, it is possible to remove one parameter to getPosNearX.
2014-07-08 21:29:52 +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
93a43742a5 Fix a bunch of small performance issues spotted by cppcheck
Most of these are about passing const strings parameters as references.
2014-07-05 19:13:10 +02:00
Georg Baum
922d48da27 Make BufferList::fileNames() threadsafe
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.
2014-07-05 12:51:40 +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
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
Peter Kümmel
2f17858115 On Linux show in crash message box the backtrace 2014-06-14 11:25:25 +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
c1ac09e11f Fix bug #7954 (now really)
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.
2014-06-07 10:54:17 +02:00
Peter Kümmel
080fca85a8 build with mingw on Windows and Linux 2014-06-07 08:06:13 +02:00
Scott Kostyshak
de091e6ceb Expand module names instead of buttons in settings
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.
2014-06-07 00:43:07 -04:00
Enrico Forestieri
ba603db942 Fix bug #9153 (Using mathpanel to insert matrix creates extra space on top)
The code was setting the current index before filling the
combo box items.
2014-06-06 16:14:24 +02:00
Juergen Spitzmueller
20bcaec061 Add layout tag that determines if/when a paragraph can be indented.
Fixes: #7327, #7458, #8670
2014-05-29 14:10:32 +02:00
Richard Heck
b992968a15 Fix bug #9131 for development branch. There are two parts to the fix.
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
2014-05-23 11:26:45 -04:00
Georg Baum
85db1005b6 Fix another crash similar to #9030
This one occured after the fix for bug #9030 if the cursor is in a math inset
and the edit menu is opened.
2014-05-22 22:02:46 +02:00
Georg Baum
2acd00fc17 Remove unneeded slash
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.
2014-05-19 22:09:12 +02:00
Juergen Spitzmueller
c5753af50d Fix crash when right-clicking into an inset with more paragraphs than the main text.
Fixes: #9123.
2014-05-18 18:03:06 +02:00
Jean-Marc Lasgouttes
015333d987 Rely on Qt to handle small caps text
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.
2014-05-07 12:13:27 +02:00
Kornel Benko
fdd5a1bd5f make build: Versioning of lyx.svg (missed in previous commit) 2014-05-06 17:24:00 +02:00
Juergen Spitzmueller
2730f9e2b5 Fix View Source size
Fixes: #9084.
2014-05-01 18:00:37 +02:00
Vincent van Ravesteijn
2552c737be GuiLog: Use GuiClipboard to put the log on the clipboard
All direct interaction with the Qt clipboard is now done in either GuiClipboard or GuiSelection.
2014-04-29 15:38:35 +02:00
Vincent van Ravesteijn
847d1fb2f5 Use the cached value GuiSelection::selection_supported_
That's where it is for.
2014-04-29 15:17:15 +02:00