Commit Graph

9619 Commits

Author SHA1 Message Date
Jean-Marc Lasgouttes
6e6976fbc5 Handle the case where breakAt cuts after trailing space
In this case, the extra element returned should empty but valid. The
row flag BreakAfter is set to indicate that we have a break there
(this principle will be used more generally in a forthcoming commit).

To detect that we cut at the trailing space, it is necessary to rely
on the difference between QTextLine::horizontalAdvance() and
QTextLine::naturalTextWidth() when the flag
QTextOption::IncludeTrailingSpaces is used: the trailing space is
taken into account in the later, but not in the former.

Somme comments have been added to make code intent clearer.
2021-12-07 17:04:47 +01:00
Jean-Marc Lasgouttes
6bc50fea3a Workaround for Qt 4
At least with Qt 4.8.7 on Ubuntu 16.04, QTextLine::lineWidth() can
return a bogus value, at least with Courier font. One hypothesis is
that the invisible characters that we use in breakAt_helper are given
a non-null width.

Work around it, although the exact bug has not been pinpointed.
2021-12-07 17:04:47 +01:00
Jean-Marc Lasgouttes
1831f6caac Change FontMetrics::breakAt to return a position
Since we intend to break the row element in two, it is not good to
truncate the string too early.

Moreover, the row element width is now set at this point, even if no
breaking occurs.
2021-12-07 17:04:46 +01:00
Stephan Witt
ae56fb6171 Qt6 pixmaps are always HiDPI - avoid deprecate warning for setAttribute 2021-12-07 10:02:05 +01:00
Juergen Spitzmueller
31146ae8d3 Prevent Outliner crash due to emptied toc value
This might need a more profound fix in the long term, see
https://marc.info/?l=lyx-devel&m=163588729224679&w=2
2021-12-04 17:53:03 +01:00
Daniel Ramoeller
e522c5444e InsertTableWidget support for dark mode and improved resizing
Fix for bug #12438.
2021-11-26 09:51:21 +01:00
Jean-Marc Lasgouttes
2311f42f41 Make primary-selection unknown when not supported
This lfun will not appear in menus anymore in macOS and Windows.

Part of bug #12436.
2021-11-22 10:30:43 +01:00
Juergen Spitzmueller
16ce82d4f9 Fix Bullets panel (#12429) 2021-11-12 16:40:46 +01:00
Juergen Spitzmueller
a90c5f202e Fix crash when closing LyX with open Search pane 2021-11-05 14:50:39 +01:00
Juergen Spitzmueller
1e711f902a Address Qt6 deprecation warnings 2021-11-03 17:41:41 +01:00
Juergen Spitzmueller
b60853ff0d Fix most stupid thinko of mine 2021-11-03 12:35:38 +01:00
Juergen Spitzmueller
de637cdbcb Amend 59b8c209c4
QFontMetrics::width() is no longer valid in Qt6
2021-11-02 16:28:40 +01:00
Daniel Ramoeller
59b8c209c4 Use labels for zoom slider buttons
Fix for bug #12301.

Also: fixes the width and alignment of the zoom value label.
2021-11-02 08:43:59 +01:00
Juergen Spitzmueller
bca1b63d89 Update toolbar and properly reset focus when find widget is closed (#12396) 2021-11-01 14:21:34 +01:00
Juergen Spitzmueller
455ff6fee7 More indentation correction 2021-11-01 14:15:05 +01:00
Juergen Spitzmueller
b9a9234cf6 Amend ce8b4e3a21 2021-11-01 13:08:16 +01:00
Juergen Spitzmueller
76ac4d8f8d Fix indentation 2021-11-01 13:02:05 +01:00
Juergen Spitzmueller
4888414f27 Attempt to fix #12226 for good 2021-11-01 08:30:41 +01:00
Juergen Spitzmueller
f3d5a95bb2 Redraw all work areas while zooming (#12334) 2021-10-31 13:43:27 +01:00
Juergen Spitzmueller
4c0caf9dd4 Polishing 2021-10-31 13:16:20 +01:00
Daniel Ramoeller
c50f40b522 Set Local Layout tab stop distance to 4
Fix for bug #12395.
2021-10-31 13:15:14 +01:00
Daniel Ramoeller
ce8b4e3a21 Movable minimised Quick Search Widget
Fix for bug #12207.
2021-10-31 13:06:36 +01:00
Daniel Ramoeller
528eee0a25 Adjust spacing of Quick Find Dock
Fix for bug #12209.

(amended by Jürgen Spitzmüller)
2021-10-31 12:33:08 +01:00
Daniel Ramoeller
96a4dd235e Fix for bug #11974
Support for setUnifiedTitleAndToolBarOnMac (unify toolbar and title bar).
2021-10-31 10:42:14 +01:00
Juergen Spitzmueller
f3002d1cf4 Get rid of some more fragile index reliances 2021-10-29 17:52:25 +02:00
Juergen Spitzmueller
47b394f2c5 Amend [5c055034/lyxgit]
Relying on indexes is too fragile here
2021-10-29 17:06:11 +02:00
Jean-Marc Lasgouttes
5c055034c2 Fixup b0c102cfb: make it possible to select medskip as parskip
Some new parskip possibilities had been added, but the check for
custom length index had not bee updated.

This code is very fragile.

Related to bug #10968.
2021-10-29 16:41:00 +02:00
Juergen Spitzmueller
61fb295e46 Disable language selector in LyXFiles dialog if no file is selected (#12412) 2021-10-29 13:17:50 +02:00
Jean-Marc Lasgouttes
ada713a881 Revert "Update correctly completion after undo"
This reverts commit 06acb7f806.
2021-10-18 17:35:48 +02:00
Enrico Forestieri
e8b366d4d6 Amend 771f30e9 for cmake 2021-10-17 19:17:01 +02:00
Enrico Forestieri
3048878eab Amend 47f1fec9
Also account for cmake
2021-10-17 18:32:50 +02:00
Juergen Spitzmueller
3543626182 Do not change bibliography processor to default if it is not found
Rather than that, keep it with a warning that it is not available.
Fallback procedure (which maintains security measures) is done in
the conversion step.

This prevents document properties being silently changed on sharing.
2021-10-17 17:14:14 +02:00
Enrico Forestieri
771f30e946 Enable QWindowsMimeMetafile with Qt6
The QWinMime class has been removed in Qt6 but the functionality
is still present. However, one has to allow inclusion of private
headers and register the mime handling to the QWindowsApplication
native interface.
2021-10-17 15:06:05 +02:00
Jean-Marc Lasgouttes
d99502d915 Remove variable that is not used
Spotted by clang++ 13.
2021-10-15 15:49:40 +02:00
Pavel Sanda
f7de009b17 Guard against possible referencing null.
Those checks might not be needed, but it's not self obvious from
the surrounding code. Because we already experienced crash from
similar change (cf 1c1c83eced), let's be prudent here.

If you know that these pointers can't be null from broader context
feel free to remove the guards.

Introduced by 24926b2e23, fix 104fdcc9be not backported
but now fixed by 1c1c83eced in 2.3.

https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg216414.html
2021-10-14 22:28:43 +02:00
Jean-Marc Lasgouttes
06acb7f806 Update correctly completion after undo
This is take #2 after reverting e59aee458.

Request the completer to rebuild a completion after undo/redo.

Fixes #12383.
2021-10-14 16:39:33 +02:00
Stephan Witt
b59eed3846 #12368 correct spelling of toolbars visibility check function name 2021-10-13 18:11:37 +02:00
Juergen Spitzmueller
465b58a6df Check changed status after decimal sep has been edited 2021-10-06 18:06:09 +02:00
Yuriy Skalko
6a7c9d12f9 Amend d3c335a5d5 2021-10-05 17:10:51 +03:00
Yuriy Skalko
d3c335a5d5 Remove useless casts reported by GCC with -Wuseless-cast option 2021-09-30 10:37:24 +03:00
Daniel Ramoeller
0862042b28 SVG replacement of busy.gif
Fix for bug #10384.
2021-09-29 12:49:56 +02:00
Jean-Marc Lasgouttes
42abb26054 Make paragraph-goto and friends set paragraph to the top
Add parameter 'force' to scrollToCursor(...) to avoid the case where the
cursor is not set to top because it is already visible on screen.
Change screen offset in this method so that the paragraph is really at
the top of the screen. This part may cause unforeseen issues and needs care.

gotoInset: use the new force flag and do not trigger a redraw.
Instead, return a boolean telling whether redraw is needed.
In the code that use it, set an update flag instead of the extra redraw.

In the handling of paragraph-goto, also set the update flag instead of
triggering a repaint.

Remove Bufferview::scrollToCursor(), which was equivalent to showCursor().

Fixes bug #10425.
2021-09-29 12:16:39 +02:00
Yuriy Skalko
a9119c3fa8 Remove redundant declarations reported by GCC with -Wredundant-decls option 2021-09-28 20:59:21 +03:00
Jean-Marc Lasgouttes
7067f48fa7 typo 2021-09-28 11:25:48 +02:00
Kornel Benko
84655a07d8 Fix crash
Lyx crashes on export to pdf if used with sanitizer set to 'unspecified'.
Crash found by Scott.

Given that if we export without GUI, there is some weirdness here though.
1.) Why does lyx not crash if not using '-fsanitize' compile-option
2.) Why is export to pdf dependent on the screen-resolution
2021-09-28 10:33:24 +02:00
Yuriy Skalko
325c405541 Remove redundant semicolons reported by GCC with -Wextra-semi option 2021-09-28 11:28:43 +03:00
Jean-Marc Lasgouttes
3cdfb42cce Make rectangles have pointy corners
This only makes a difference in HiDpi mode.

Adaptation of the patch proposed by Daniel.

Fix for bug #12336.
2021-09-27 17:47:41 +02:00
Jean-Marc Lasgouttes
69834f1e0d Fixup 6bbd88ac: compilation fix for Qt4 2021-09-27 13:56:04 +02:00
Jean-Marc Lasgouttes
b3890d9eab Fix warning. 2021-09-24 18:45:08 +02:00
Jean-Marc Lasgouttes
6bbd88accf Improve (modestly) the performance of font metrics caches
This fixes two performance issues and improves the performance of
TextMetrics::redoParagraph by 15% in a workload that uses the cache a
lot. The difference will be much less when the cache is not used much.

1/ repetion of the hash code computation

The code
  if (cache.contains(key))
  	result = cache[key]:
is not efficient, since qHash(key) has to be computed twice.
To fix this a new Cache::object_str() method is added, which allows
  if (auto * obj = cache.object(key))
  	result = *obj;

2/ code of has code computation

Instead of using a verbose string that is complicated to build as
key, new key structs BreakAtKey and TextLayoutKey are introduced,
along with the relevant qHash() implementation.
2021-09-24 17:12:15 +02:00