Commit Graph

9281 Commits

Author SHA1 Message Date
Yuriy Skalko
4ece87c324 Fix obsoleted Qt values
All new values exist in Qt 4.8.7.
2020-10-25 09:28:46 +02:00
Yuriy Skalko
a7018252b7 Constify 2020-10-25 09:28:34 +02:00
Jean-Marc Lasgouttes
21422dd652 Replace QFontMetrics::width() by horizontalAdvance() in Qt>=5.11
The method horizontalAdvance() replaces width() starting with Qt 5.11.
To handle this, all direct calls to QFontMetrics::width() are replaced
by calls to GuiFontMetrics::width(), and the code for
GuiFontMetrics::width(QChar) uses horizontalAdvance on newer Qt
versions.
2020-10-24 19:52:18 +02:00
Pavel Sanda
8af747c9d9 Revert da8b5de97 because of MSVC 2017.
In GCC `min` is defined via including <vector>.
2020-10-24 12:06:54 +02:00
Yuriy Skalko
c928714b0b Unify naming of menu items 2020-10-23 10:23:01 +03:00
Yuriy Skalko
af29f02dd8 Reduce includes in header files (2) 2020-10-19 18:01:17 +03:00
Yuriy Skalko
d25c10ed81 Remove duplicate and unused header includes in .cpp files 2020-10-19 18:01:11 +03:00
Yuriy Skalko
65c88f0a0a Remove redundant const & for primitive types 2020-10-19 12:50:07 +03:00
Yuriy Skalko
ce0e192689 Move Cursor.h from TocWidget.h 2020-10-16 08:02:51 +03:00
Yuriy Skalko
fbefdb10a5 Move Cursor.h from Clipboard.h 2020-10-16 08:02:51 +03:00
Pavel Sanda
2b02b73f4a Move <QTimer> from TocWidget.h 2020-10-14 14:48:41 +02:00
Pavel Sanda
bd33601512 Move <QTimer> from GuiViewSource.h 2020-10-14 14:37:38 +02:00
Pavel Sanda
85eec10e4b Move <QKeyEvent> from DockView.h 2020-10-14 14:35:29 +02:00
Pavel Sanda
61824e057e Move GuiView.h from DockView.h 2020-10-14 14:28:47 +02:00
Pavel Sanda
57703d51c6 <QCloseEvent> DialogView.h -> DialogView.cpp 2020-10-14 13:57:30 +02:00
Pavel Sanda
f1b147cc97 include "GuiView.h": DialogView.h -> DialogView.cpp 2020-10-14 13:53:40 +02:00
Pavel Sanda
da8b5de973 Move <algorithm> from DocIterator.h 2020-10-14 13:01:30 +02:00
Jean-Marc Lasgouttes
310c94c48c Fix display of caret completion indicator
The zooming algorithm based on caret width was deeply flawed. It is
not replaced with a formula based on caret height.

Fixes bug #12000.
2020-10-13 17:09:33 +02:00
Yuriy Skalko
2a594d3e90 Remove unused forward declarations 2020-10-13 09:57:36 +03:00
Thibaut Cuvelier
92b9c82dea Fix compilation on Visual C++.
Without this patch, there would be errors like these (warnings turned into errors):

D:\LyX\lyx-unstable\src\frontends\qt\GuiView.cpp(2413): error C4101: 'e': unreferenced local variable
D:\LyX\lyx-unstable\src\frontends\qt\GuiView.cpp(4879): error C4101: 'ex': unreferenced local variable
2020-10-12 19:21:58 +02:00
Yuriy Skalko
238fd9ac50 Right exception rethrowing 2020-10-12 15:14:55 +02:00
Yuriy Skalko
919a06718a Constify 2020-10-12 15:06:16 +02:00
Richard Kimberly Heck
2dc4277452 Const 2020-10-10 17:12:50 -04:00
Yuriy Skalko
7d38a4d126 Loop refactoring 2020-10-09 09:04:20 +03:00
Pavel Sanda
ffbcac3dde Add few examples for lineno options.
It's actually pretty hard to get that from the manual.
2020-10-06 15:05:11 +02:00
Jean-Marc Lasgouttes
c46f3b8f31 remove unused variable 2020-10-05 15:11:51 +02:00
Yuriy Skalko
c5ae08f0b8 Amend efc0877f
Add the last `override`s.
2020-10-05 15:03:13 +02:00
Yuriy Skalko
fe85162a29 Refactoring 2020-10-05 14:55:00 +02:00
Yuriy Skalko
d82adc625b Amend efc0877f
Add more `override` specifiers. Replace `throw()` to `noexcept`.
2020-10-05 09:37:15 +02:00
Yuriy Skalko
14b0da28c2 Amend efc0877f 2020-10-03 21:17:17 +02:00
Yuriy Skalko
715b8cda54 Refactoring based on cppcheck suggestions 2020-10-03 13:39:51 +02:00
Yuriy Skalko
efc0877f8f Add override specifiers to improve code maintainability 2020-10-03 12:43:48 +02:00
Jean-Marc Lasgouttes
7f1b1729b4 Cleanup the caret geometry code
Intended changes:

* code is shorter and cleaner

* caret scales better with zoom when cursor_width=0: completion
  indicator, l-shaped cursor...

Details:

* Rename BufferView::getPosAndHeight to getPosAndDim because ascent is
  needed too and width could in the future be set depending on font.

* Get rid of rect_ in CaretWidget and record a Dimension (and y value) instead.
  Remove also caret_width_ and slant_, replace rtl_ with dir.

* Make CaretWidget members public and lose the trailing _.

* change CaretWidget::update to read its parameters from current bufferview.
2020-10-01 13:17:01 +02:00
Pavel Sanda
ad475adfd3 amend 6d6fc761be 2020-09-28 16:44:12 +02:00
Pavel Sanda
6d6fc761be Qt4 compilable again 2020-09-28 16:34:42 +02:00
Yuriy Skalko
e47092044b Use real italic slope for slanted caret 2020-09-28 14:30:05 +02:00
Jean-Marc Lasgouttes
967f4d661e Remove default parameter of UndoGroupHelper constructor
This can lead to mistakes. If no buffer is required at the beginning,
it is better to pass 'nullptr' explicitly.

Fix a case of missing parameter in GuiCompleter (introduced at
f3656600). This avoids some spurious "There is no group open (creating
one)" messages.
2020-09-23 17:33:17 +02:00
Daniel Ramoeller
9a1f732664 Show slanted caret (cursor) when text style emphasis/italics/slanted.
Fixes for bug #11428. Emphasis is used regularly and it is helpful to
see whether the next text will be written emphasized directly from the
cursor.

This is also implemented in MS Word and Google docs but not in
LibreWriter.

Also fixes the caret for RTL languages whose width was previously
extended into the wrong direction.
2020-09-18 13:27:06 +02:00
Jean-Marc Lasgouttes
b96b876403 Revert "Show toolbar context menu only when clicking on the toolbar"
Something is wrong.

This reverts commit f25253f89a.
2020-09-16 16:54:33 +02:00
Daniel Ramoeller
f25253f89a Show toolbar context menu only when clicking on the toolbar
Previsouly it was on the whole application window, except on disabled toolbar
buttons.

Fix for bug #11949
2020-09-16 11:18:57 +02:00
Jean-Marc Lasgouttes
ae37caacdd Add method FontMetrics::italic()
This can be useful for ticket #11428.
2020-09-14 16:26:19 +02:00
Jean-Marc Lasgouttes
c1f8c6c26d Fixup 5202d44e: make caret geometry update lazy
Instead of working around crashes in update of caret geometry, only
request it as needed. The actual computation will take place just
before painting the caret.

It might be that this is overkill and that caret geometry should be
updated unconditionally. One would have to to some timing while idle to
ascertain that.

Fixes bug #11912.
2020-09-11 11:48:12 +02:00
Eugene Chornyi
46da0d9d4d Workaround Qtbug regarding the QAbstractScrollArea::mouseMoveEvent(...) (06969f9d) is only needed until Qt 5.15.1 as it was fixed there. 2020-09-10 20:40:48 +02:00
Enrico Forestieri
0762b52334 Try to use the right width for math symbols
The rules for typesetting math differ from the rules for typesetting
text. For example, two italic 'f' chars have to be typeset more closely
than two 'o' chars in text mode, but not in math mode. Qt provides a
method that returns the distance appropriate for drawing a subsequent
character in text mode, but nothing for math mode. Typically, the
distance appropriate for drawing the next character in math mode is
the actual width span by the character, corrected by the rules of
an appendix in the TeXbook. Recently, those rules are followed more
closely in LyX but not exactly, and we have to find a way to adapt to them.
Some symbols may need more spacing around them than the width they span.
So, we use the distance suggested by Qt, unless it is less than the
width of the rectangle bounding the symbol. Before Qt 5.11 the used method
was QFontMetrics::width(), but since then it has been declared obsolete
in favor of QFontMetrics::horizontalAdvance(), whose name conveys better
its meaning.
2020-09-08 22:30:02 +02:00
Jean-Marc Lasgouttes
b744c3e28a Revert "Fixup 5202d44e: make caret geometry update lazy"
Something is wrong with the cursor.

This reverts commit dc35f1ddf4.
2020-09-07 16:02:50 +02:00
Jean-Marc Lasgouttes
dc35f1ddf4 Fixup 5202d44e: make caret geometry update lazy
Instead of working around crashes in update of caret geometry, only
request it as needed. The actual computaiton will take place just
before painting the caret.

It might be that this is overkill and that caret geometry should be
updated unconditionally. One would have to to some timing while idle to
ascertain that.

Fixes bug #11912.
2020-09-07 15:52:43 +02:00
Enrico Forestieri
062d94c5da Fix on-screen display of special math fonts
Make sure that the on-screen representation of the special math fonts
mathbb, mathds, mathfrak, mathcal, and mathscr matches the latex output.
2020-09-06 18:16:04 +02:00
Juergen Spitzmueller
61739e5aef Add some hspacers 2020-09-05 08:23:56 +02:00
Enrico Forestieri
a9afdbb73c Personalize fonts
When the fonts distributed with texlive with same family name
as ours are also managed by fontconfig, Qt is not able to
discriminate ours by the style only. In order to be sure Qt
will load our fonts, we change the foundry name from 'PfEd'
to 'LyEd' and augment the font family name with this foundry
name. This only works on *nix, because adding a foundry name
seemingly breaks things on Windows. However, this is a *nix
only problem, seemingly.
2020-09-03 17:46:30 +02:00
Juergen Spitzmueller
5c83c5c410 Foward-port tooltip addition from stable (3a7560dcb0) 2020-09-03 08:55:46 +02:00