Commit Graph

9619 Commits

Author SHA1 Message Date
Richard Kimberly Heck
ed2d3e199f Fix bug #4241: Addition to Intro 2021-01-09 22:17:52 -05:00
Richard Kimberly Heck
9446aa3640 Fix bug #11030.
Factor out the code that connects to a newly created dialog and then
use that also in GuiGraphics.

There must be many other dialogs that need this same treatment....
2021-01-09 20:33:23 -05:00
Juergen Spitzmueller
73df32bec4 Disambiguate homographic inflections
These are not homographic in other languages
(e.g. German "Öffnen" vs. "Geöffnet")
2021-01-09 09:44:38 +01:00
Juergen Spitzmueller
e947cdab3e Properly disable Apply/OK in InsetParamsDialog (#11440) 2021-01-07 13:28:10 +01:00
Juergen Spitzmueller
7a992bb699 GuiParagraph: apply pending changes when setting "immediate apply" (#11592) 2021-01-07 13:06:15 +01:00
Jean-Marc Lasgouttes
99e636ae7b Display bookmarks in the workarea.
The bookmarks are added as virtual elements in display Rows. Bookmarks
are shown with circled numbers. A new color "bookmarks" has been
added. Currently bookmark 0 (the return position) is not displayed
because it is very disturbing in practice.

To make this work, a new method BookmarksSection::bookmarksInPar
retuns the list of bookmarks in a paragraph along with their position.

Force redraw when using bookmark-save and bookmark-clear.

Fixes bug #2496.
2021-01-06 20:20:03 +01:00
Jean-Marc Lasgouttes
b64b1aa85e Fix use of BookmarkSection::size()
The value was 9 instead of 10, which forced its users to use unusual code.
2021-01-06 19:33:20 +01:00
Richard Kimberly Heck
40603a7552 Fix bug #3964.
As suggested there, we attach ourselves to the newly created inset,
if we in fact just created an inset. (This will only matter if Apply
was clicked, so the dialog is still open, but I did the calcuation
anyway, as it seems cheap enough.)  This allows the user to modify
that inset (e.g., change the format) and also prevents another click
on Apply, or OK, from creating another dialog.

I've also removed the override of disconnectOnApply(). It does not
work, anyway, I think because it only works with GuiDialog, not with
DialogView-based dialogs.
2021-01-06 03:50:47 -05:00
Richard Kimberly Heck
cf07d4825f Fix bug #11104. Activate refstyle support for InsetMathRef.
At the moment, there is no support for plurals and capitalization.
A long comment explains why. Support could be added for that without
a format change.
2021-01-05 18:17:53 -05:00
Richard Kimberly Heck
14c2f5d954 Fix comment 2021-01-05 17:45:50 -05:00
Richard Kimberly Heck
bbffbf92ac Remove elipses from "Open" buttons in About LyX dialog. Fixes #12019. 2021-01-04 14:53:41 -05:00
Yuriy Skalko
a0b65e9bf8 Define keyboard codes for Cyrillic letters, enable shortcuts using them 2021-01-04 12:00:50 +02:00
Richard Kimberly Heck
d4757eace0 Fix bug #11568.
We can't rely on allow_async to tell us whether to put_in_tmpdir.
2021-01-03 22:56:05 -05:00
Richard Kimberly Heck
4cee3478f7 nullptr 2021-01-03 22:36:04 -05:00
Richard Kimberly Heck
e31eadfd37 We don't need to reload a dirty file. Fixes #11788. 2021-01-03 19:58:19 -05:00
Yuriy Skalko
d3ca28b468 Amend 3971b1b35e, also fix warnings for older compilers 2020-12-29 16:30:16 +02:00
Yuriy Skalko
3971b1b35e Fix C++20 warning on implicit capture of this via [=] 2020-12-28 23:26:14 +02:00
Juergen Spitzmueller
2af8e661a3 Re-enable input of non-LyX files (e.g., tex, pgf) (#12056)
This amends [a385b7dc2b58/lyxgit]
2020-12-28 09:58:30 +01:00
Juergen Spitzmueller
f661469734 Implement sane UI for switching tristate toolbars (#6364)
Also fix toolbar toggling with AllowAuto which was broken since
a long time.
2020-12-17 10:15:18 +01:00
Juergen Spitzmueller
7e11cb2b37 Whitespace 2020-12-17 10:10:56 +01:00
Jean-Marc Lasgouttes
209a3ce618 Dialog.h and DialogFactory.h are not moc-able 2020-12-15 11:53:06 +01:00
Juergen Spitzmueller
9bf3a5a778 Add some documentation 2020-12-15 09:52:52 +01:00
Juergen Spitzmueller
1a0b842e66 Do not close spellchecker after "Replace All" (#11310)
Wrong use of wrapAround here
2020-12-15 09:46:32 +01:00
Juergen Spitzmueller
34c166f45f One more nullptr 2020-12-15 08:53:41 +01:00
Juergen Spitzmueller
47de618de8 Fix nullptr warning 2020-12-15 08:36:17 +01:00
Juergen Spitzmueller
2d553ec5b9 Amend 24b71d30d5 (#12048) 2020-12-14 14:19:08 +01:00
Yuriy Skalko
bda4570400 Use new signal library nod instead of boost::signals2
Thanks Enrico for updating autotools files.
2020-12-13 23:11:19 +02:00
Juergen Spitzmueller
148748b0c2 Make InsetInfo math/IPA icons visible in dark mode
This does not show the real colors, but the icons are at least readable.
2020-12-13 09:51:32 +01:00
Juergen Spitzmueller
33fb7ed258 Ditch deprecation warning 2020-12-12 14:16:34 +01:00
Juergen Spitzmueller
882f06121b Use semantic latex and math colors for dark theme icon overlay 2020-12-12 10:56:51 +01:00
Juergen Spitzmueller
704331fdcd Add dark theme colors to semantic colors (#8325) 2020-12-12 10:56:05 +01:00
Stephan Witt
7b41faabae amend 99b1488f0e - on Mac the include is needed 2020-12-11 18:42:04 +01:00
Juergen Spitzmueller
a06cdfa073 Adapt math and IPA panels to dark theme (#5636) 2020-12-11 09:08:41 +01:00
Juergen Spitzmueller
b2ab394832 Remove unused function 2020-12-11 09:08:10 +01:00
Juergen Spitzmueller
f9b817676a Search ipa image dir befor top dir
Else the unknown icon is found before the proper icon.

This unbreaks IPA panel top icons
2020-12-10 07:08:04 +01:00
Jean-Marc Lasgouttes
1dcb08104c Make spellchecker work in read-only document
Mistakes are visible but word replacement is disabled. Disable relevant
widgets depending on the situation.

Move updateView code to SpellcheckerWidget::Private.
2020-12-07 18:33:45 +01:00
Yuriy Skalko
ccbfd22f56 Move implementation details to constructors. Amend 78f457796c 2020-12-06 20:51:11 +02:00
Yuriy Skalko
e292dd70bf More enums & includes refactoring 2020-12-06 18:26:41 +02:00
Juergen Spitzmueller
b57b4a3e12 Clarify documentation if "Keep change markup on paste" pref 2020-12-06 17:04:17 +01:00
Yuriy Skalko
78f457796c Implement proper Dialog factory instead of implicit link-time dependencies 2020-12-06 17:37:39 +02:00
Richard Kimberly Heck
41216228c0 Change name in source files 2020-12-05 17:17:02 -05:00
Jean-Marc Lasgouttes
4f8cfca117 Update handling of read-only for Thesaurus
Remove dummy calls to ButtonController::addReadOnly().

Properly disable stuff for read-only documents.

Streamline code.
2020-12-05 20:27:46 +01:00
Jean-Marc Lasgouttes
f02311241a Make Merge Changes dialog work in read only.
Make LFUN_CHANGES_MERGE active in read-only documents.

Remove dummy call to ButtonController::addReadonly and replace with
proper code.
2020-12-05 19:53:30 +01:00
Jean-Marc Lasgouttes
c30b0aac4b Disable some Adv F&R widgets for read-only documents 2020-12-03 18:04:23 +01:00
Jean-Marc Lasgouttes
24b71d30d5 Fix disabling of widgets for (simple) Search dialog
This allows to remove the calls to ButtonController::addReadonly,
which are placebo since 78ade7e6.
2020-12-03 15:44:55 +01:00
Yuriy Skalko
e0f553b941 Fix warnings and use range-based loop 2020-12-03 00:38:05 +02:00
Juergen Spitzmueller
560d2df70c Capitalization fixes 2020-12-02 14:52:51 +01:00
Jean-Marc Lasgouttes
26135330bc Simplify GuiWorkarea::Private constructor
Also use the newly introduced platformName() for Qt4.
2020-12-01 11:26:01 +01:00
Yuriy Skalko
c0a5987181 Better naming for enums 2020-12-01 00:46:21 +02:00
Yuriy Skalko
890ca6df7b Refactor KernelDocType enum 2020-12-01 00:46:16 +02:00
Yuriy Skalko
6354ad60b4 Refactor InsetQuotes.h enums 2020-12-01 00:46:09 +02:00
Yuriy Skalko
ec5c7b905b Move Inset.h include from .h to .cpp 2020-11-30 13:05:08 +02:00
Yuriy Skalko
ecf62a8f21 Refactor OutputParams
Now all Inset hierarchy uses OutputParams.h included in Inset.h.
Forward declare some enums to reduce header dependencies.
2020-11-30 13:05:03 +02:00
Yuriy Skalko
99b1488f0e Cleanup included headers 2020-11-30 13:04:54 +02:00
Kornel Benko
a171c651a6 Revert "Amend 3093789e for cmake build"
This reverts commit b3d43404f4.
2020-11-30 10:19:22 +01:00
Yuriy Skalko
89d05890bf Simplify KeyModifier 2020-11-30 10:44:28 +02:00
Yuriy Skalko
7779316e6c Include standard <regex> 2020-11-29 15:27:28 +02:00
Kornel Benko
b3d43404f4 Amend 3093789e for cmake build 2020-11-29 10:04:54 +01:00
Yuriy Skalko
9b0cd3c970 Fix buffer over-read on last Unicode code points 2020-11-29 00:25:24 +02:00
Yuriy Skalko
813eb0f9f7 Cleanup included headers 2020-11-29 00:25:14 +02:00
Jean-Marc Lasgouttes
3093789e8d remove most traces of boost::regex
1/ remove boost regex code from 3rdparty/boost. Only the cmake stuff remains.

2/ remove traces of BOOST_LIB since there is no need anymore to
   compile boost stuff.

3/ remove traces of boost regexp in config/lyxinclude.m4 and INSTALL

4/ require gcc 4.9 as minimal version in autoconf.

Unfortunately, the net gain is only 10% of included boost size (now 21M).
2020-11-28 19:59:17 +01:00
Yuriy Skalko
f3ec89cfa1 Always use std::regex
Since now minimum supported GCC is 4.9.
2020-11-27 12:39:59 +02:00
Yuriy Skalko
6a21ec854b Move several common types to support/types.h 2020-11-27 12:16:22 +02:00
Jean-Marc Lasgouttes
4b15d64f51 Remove deprecated enum value with Qt5 2020-11-27 10:23:49 +01:00
Jean-Marc Lasgouttes
c68be9a9be Improve some debug messages
The current code did not give much information.

I am not sure why the <<FontInfo operator is not defined in
FontInfo.h, but I figured that it was not necessary to understand that
now.
2020-11-26 11:09:17 +01:00
Yuriy Skalko
0a8d3c9887 Fix loop variable, amend d8e8a93a58 2020-11-25 23:16:51 +02:00
Yuriy Skalko
b3be47765b Fix memory leak 2020-11-25 02:43:26 +02:00
Yuriy Skalko
43b16548b4 Cleanup headers 2020-11-25 02:43:16 +02:00
Jean-Marc Lasgouttes
8673c5ac28 Forgot this. 2020-11-24 21:20:25 +01:00
Jean-Marc Lasgouttes
1b3ffa6627 Rewrite (again!) the code for caret drawing
The caret geometry is now computed in BufferView as a list of shapes
(caret, horizontal l-shape if needed, completion triangle if needed)
kept in a variable of type CaretGeometry.

The code in WorkArea.cpp only has to draw these shapes. The
CaretWidget (which never was a widget) in GuiWorkArea.cpp is gone
now.

As a consequence, the bounding box for the cursor is known precisely
and therefore rows should be repainted correctly now. This avoids
caret droppings.

Fixes bug #12024.
2020-11-24 20:12:42 +01:00
Jean-Marc Lasgouttes
ba8ca0e384 Correct caret position from the start 2020-11-21 19:39:48 +01:00
Yuriy Skalko
cbad214cdd Refactor checksum calculation 2020-11-21 20:32:43 +02:00
Yuriy Skalko
0b1e0b8610 Remove unused headers 2020-11-21 20:32:30 +02:00
Yuriy Skalko
7ca2f2b58d Use range-based loops 2020-11-21 20:32:16 +02:00
Pavel Sanda
4eb791ff18 Erase white frame in fullscreen mode.
Since Qt 5.9.4 one can't set negative margins unless explicitely
allowed by a new flag. This brought back the white frame in
fullscreen mode.

https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg214002.html
2020-11-21 16:02:54 +01:00
Yuriy Skalko
2941bc0198 Add more override specifiers 2020-11-21 00:32:40 +02:00
Kornel Benko
5474c3fb4b Missing '{' 2020-11-20 16:32:51 +01:00
Jean-Marc Lasgouttes
d8e8a93a58 Use range-based loops in GuiView 2020-11-20 15:14:21 +01:00
Sam Crawley
f457a32a13 Fix issue in running compare from the command line
Because Compare uses threads, we need to make sure it is finished when a
compare is executed from the command line. This was a problem for command
sequences, because the next command would start running before the compare
was done, and the buffer with differences was available.

So this commit adds the "run-blocking" parameter when using
LFUN_DIALOG_SHOW to run a Compare. When calling Compare with run-sync, the
LFUN will wait for the compare worker thread to finish before returning and
possibly running the next command.
2020-11-15 10:35:28 +01:00
Jean-Marc Lasgouttes
222a317dd2 Store correctly the window position with Wayland
To do this, hard-coded test for xcb had to be replaced with a call to
platformName(). Since this method does not exist in Qt4, we emulate
it.

Note that Qt5 uses xcb bindings for X11 system, while Qt4 relies on
older X11 bindings. We return platorm == "qt4x11" in this case.

Fixes bug #11746.
2020-11-14 17:55:59 +01:00
Richard Kimberly Heck
cfd19d86be whitespace and style 2020-11-02 11:45:09 -05:00
Yuriy Skalko
d38eddb397 Match header/source function argument naming 2020-11-01 22:23:44 +02:00
Yuriy Skalko
5061db891c Use const references 2020-11-01 22:23:26 +02:00
Yuriy Skalko
dbe35af542 Simplify with std::map::insert 2020-11-01 22:22:27 +02:00
Richard Kimberly Heck
ca3077b40b Change the logic of the indentation setting.
The option here is to NOT indent the paragraph, so make that clear.
As it was, we would set "Indent" to false in the case of paragraphs
that do not permit indentation and then write that, uselessly, to the
LyX file if we wrote any other option (and then keep writing it, even
if other options were removed). Now, we will write it only if it's been
explicitly set.
2020-10-30 13:34:36 -04:00
Richard Kimberly Heck
cc1d3b78c9 Const 2020-10-29 18:25:33 -04:00
Yuriy Skalko
f1926251c0 Move Windows-specific stuff into os_win32.h 2020-10-25 19:59:03 +02:00
Yuriy Skalko
10272e4747 Move include of own header to the top. Fix dependencies 2020-10-25 19:58:57 +02:00
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
Richard Kimberly Heck
5606e934ac Accelerators 2020-09-02 10:22:26 -04:00
Enrico Forestieri
8039b34802 Adjust debug output for fonts
This restores the debug output as it was intended before the
introduction of the LYXERR macro that was unconditionally outputing
an end of line. This is how this output was appearing until lyx 1.5:

Looking for font family cmr10 ... got: cmr10
 got it normal!

instead of as it was since lyx 1.6 and until now:

Looking for font family cmr10 ...
got: cmr10
 got it
normal!
2020-09-01 12:12:55 +02:00
Richard Kimberly Heck
1ba785f2c6 Localization 2020-09-01 01:41:10 -04:00
Richard Kimberly Heck
3c25899eab Improved fix for edit button 2020-08-31 11:20:49 -04:00
Richard Kimberly Heck
cf7e32ee8f Fix problem with edit button.
The previous implementation relied upon the cursor being immediately
in front of the inset. A bad idea.
2020-08-31 10:50:59 -04:00
Richard Kimberly Heck
a385b7dc2b Fix bug 4475.
Add ability to create child from the include dialog.
2020-08-31 10:20:52 -04:00
Stephan Witt
292799a4bd #11756 cleanup the view menu on Mac
Using US english desktop language LyX's Mac OS adds some items to the view menu:
1. Show/Hide Tab Bar and
2. Enter Full Screen
These items won't work properly and it's better to hide them.
2020-08-30 15:35:02 +02:00
Stephan Witt
1c5a2fc0ec #11756 hide additional menu items in edit menu on Mac
Mac OS adds two extra menu entries to the edit menu.
These menu items are:
1. Start Dictation...
2. Emoji & Symbols
Both menu items don't work with LyX.
Therefore they shouldn't be present and the new code hides them.
2020-08-30 11:24:59 +02:00
Enrico Forestieri
80f94a9398 Use correct width for \fint
Both QTextLine::naturalTextWidth() and QTextLine::horizontalAdvance()
return the same value for \fint. However, examining esint10.ttf with
fontforge does not reveal any issue with the metrics. The fact that
\fint seems to be the only affected symbol might be due to its code
point, which corresponds to a space, so that maybe Qt makes some
assumptions on the metrics.

As QTextLine::naturalTextWidth() returns the width of the line that is
occupied by text, in the case of a single symbol we can obtain the
same value by using the width of the rectangle bounding the symbol.
2020-08-29 20:10:26 +02:00
Juergen Spitzmueller
6f476b960e Localize format prettyName in some more places (#11954) 2020-08-29 11:50:43 +02:00
Yuriy Skalko
3bd358a2f6 Prevent permanent disabling of comboboxes in Vertical/Horizontal space dialogs 2020-08-28 07:07:44 +02:00
Juergen Spitzmueller
4fdcf0e929 address deprecation warning 2020-08-27 14:43:23 +02:00
Pavel Sanda
28dd0e1f21 Fix Qt4 compilation. 2020-08-27 14:05:22 +02:00
Juergen Spitzmueller
bc76026da5 Disable citationSearchLE with citationSearchCB 2020-08-27 12:53:41 +02:00
Juergen Spitzmueller
d44929ff81 Properly report back if showDirectory() doesn't succeed 2020-08-27 11:58:37 +02:00
Juergen Spitzmueller
ff14d0bd00 Report back if citation target could not be opened 2020-08-27 11:52:52 +02:00
Juergen Spitzmueller
8365eabd6f Make paper search function accessible and customizable 2020-08-27 08:48:55 +02:00
Juergen Spitzmueller
d436a51024 About: Fix cutting of icon (#11946) 2020-08-26 10:01:53 +02:00
Jean-Marc Lasgouttes
ee3a711316 Forgotten break in switch found by coverity scan. 2020-08-24 17:21:04 +02:00
Pavel Sanda
44ede7ef4b Do not hardcode launching of lyxpaperview script. 2020-08-24 15:11:53 +02:00
Yuriy Skalko
c160e21c48 Split some UI strings for translations 2020-08-24 07:23:40 +02:00
Scott Kostyshak
4c0073cd03 Whitespace 2020-08-20 21:51:29 -04:00
Juergen Spitzmueller
c71551fd9d GuiAbout: some more polishment 2020-08-20 16:08:10 +02:00
Juergen Spitzmueller
1f92214d78 GuiAbout: use unformatted version info via Copy button 2020-08-20 15:50:31 +02:00
Pavel Sanda
e648202e7e Allow LyX to find pdfs and urls of citation references and follow them from context menu.
Currently tested:
- url & doi fields for bibtex.
- all documented eprinttypes of biblatex
- absolute paths of first entry of 'file' field for jabref and kbibtex
- external script searching for author + year pdf

Additional polishing will follow.

https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg212505.html
2020-08-20 09:12:54 +02:00
Yuriy Skalko
679c418b03 Fix UI string 2020-08-19 10:15:45 +02:00
Juergen Spitzmueller
d9f1f7e348 Remove now redundant string 2020-08-16 11:31:56 +02:00
Juergen Spitzmueller
5490e7545b Polish About dialog
(this might need adaptation with HiDPI)
2020-08-15 16:07:12 +02:00
Juergen Spitzmueller
cba24bb642 Fix deprecation warning 2020-08-15 16:06:56 +02:00
Juergen Spitzmueller
6fd566fbec Flag placeholder string nontranslatable
This is just wasted efforts for the translators, as this string never
appears in the GUI.
2020-08-15 13:18:19 +02:00
Yuriy Skalko
1cf86348dd Enable search in "LaTeX Log" dialog by pressing Enter 2020-08-15 07:52:55 +02:00
Yuriy Skalko
4c3139314b Correct Right Arrow key processing in Modules list 2020-08-14 10:12:13 +02:00
Yuriy Skalko
e1dd91e10e Disable editing of math package names in Document Settings 2020-08-14 10:05:11 +02:00
Daniel Ramoeller
c9bf179016 #10346 Amend change 01b2893f8b switch directory buttons 2020-08-13 21:43:23 +02:00
Stephan Witt
63fcb7b8e1 #10346 Amend change 01b2893f8b to make Qt4 compilable - again 2020-08-13 10:26:44 +02:00
Stephan Witt
4ddff8fe28 #10346 Amend change 01b2893f8b to make Qt4 compilable 2020-08-13 08:12:56 +02:00
Daniel Ramoeller
01b2893f8b Fix bug #10346.
Allow to open user and library directories from About LyX.
2020-08-12 14:25:36 -04:00
Juergen Spitzmueller
075d220d6e GuiLyXFiles: Fix crash and disabling with header selection
Fixes #11929
2020-08-11 19:26:23 +02:00
Juergen Spitzmueller
b57166f656 Nothing to translate here. 2020-08-10 10:03:42 +02:00
Richard Kimberly Heck
c9bb699457 Fix #10328.
Change title of LyX's windows to conform to the usual pattern.
2020-08-09 13:00:41 -04:00
Daniel Ramoeller
d3a04c089b Fix for bug #11926
Change comobox signal to user interaction only to avoid problems with "Apply changes immediately" aka "Immediate Apply". (See https://doc.qt.io/qt-5/qcombobox.html#currentIndexChanged and https://doc.qt.io/qt-5/qcombobox.html#activated.)
2020-08-09 12:51:45 +02:00
Yuriy Skalko
af7ffc7dfa Correct UI strings 2020-08-08 16:12:50 +02:00
Stephan Witt
d0ca7a383d Amend commit 3af8ff39fc - make it work with Qt 4.x - don't activate it there 2020-08-07 12:27:27 +02:00
Stephan Witt
3af8ff39fc Force a uniform style for group boxes, on Mac non-flat works better, on Linux flat is standard 2020-08-07 10:54:12 +02:00
Stephan Witt
0fa4b7e736 #9376 prepare use of Length in lyxrc - move the class Length to support 2020-08-07 09:24:31 +02:00
Enrico Forestieri
582296d79a Correctly compute metrics for single-char non-math fonts
As evidenced by the comment, this corrects a thinko.
2020-08-06 15:34:54 +02:00
Stephan Witt
6dcd4ca4f1 #10571 improved handling of WM's signal when switching from or to full-screen window 2020-08-04 15:24:09 +02:00
Juergen Spitzmueller
8415041b1f Use hexnames only for x11 colors
This prevents wrong color allocation with ambiguous names.

Fixes #11828

Patch by D. Ramöller with extensions by me.
2020-08-03 14:10:46 +02:00
Thibaut Cuvelier
d75ff9931d Revert "Support the mathbbm font."
This reverts commit e709a6626e.
2020-07-28 18:01:38 +02:00
Thibaut Cuvelier
e709a6626e Support the mathbbm font.
Should just be able to read formulae, not add it from the GUI, as it's mostly redundant with mathds and mathbb.
2020-07-27 03:15:00 +02:00
Enrico Forestieri
0b3e69167c Fix placement of limits with integral signs
Since be836909c5 the positioning of super- and subscripts
for symbol fonts has been broken because the metrics of the
font of the environment (rather than those of the symbol itself)
were used.
2020-07-24 12:32:24 +02:00
Thibaut Cuvelier
e302757476 Add support for CALS tables in DocBook. 2020-07-16 00:40:16 +02:00
Juergen Spitzmueller
097383f657 Fix comment 2020-07-14 15:52:20 +02:00
Juergen Spitzmueller
b8969d2e9c Reset CategorizedCombo filter when switching between non-TeX and TeX fonts 2020-07-14 15:49:15 +02:00
Jean-Marc Lasgouttes
32f06d01ec Revert "Improve handling of top and bottom margin"
It turns out this is not ready at all.

This reverts commit ff7cdf1b74.
2020-07-13 00:00:36 +02:00
Jean-Marc Lasgouttes
ff7cdf1b74 Improve handling of top and bottom margin
The 20px space on top and bottom of document have traditionally been
obtained by adding the to the ascent/descent of the first/last row.
This reads to annoyances like selections that are drawn in these
margins and issues with the nesting marker.

The change is to add the values to a separate member of the Row
object, and to add new Row::total(Ascent|Descent) methods that add the
effect of this padding.

Moreover, some methods are added to TextMetrics to simplify the
BufferView code.

Fixes bug #9545.
2020-07-12 20:32:04 +02:00
Jean-Marc Lasgouttes
77036f5434 Fix and simplify computation of painter monochrome mode
The old code in GuiPainter::filterColor did not work. Tricks with
colors should take place in HSV space, not RGB IMO.

Replace the code with a simpler one which maps the grayscale value
of the original color on the blend color. It works nin the case where
original color is red, but might not work as well when blend color is
not black. Time will tell.

Fixes bug #11904.
2020-07-12 00:01:46 +02:00
Jean-Marc Lasgouttes
2a80b0ac01 Set desktop name for Wayland
Fixes bug 11847.
2020-07-11 20:40:30 +02:00
Jean-Marc Lasgouttes
aaec8459bf Cleanup: remove trailing underscores
These ToobarItem members are public, not private.
2020-07-09 16:27:00 +02:00
Eugene Chornyi
06969f9dd4 Workaround Qtbug where QAbstractScrollArea::mouseMoveEvent(...) is called falsely when quickly double tapping on a touchpad of a notebook running Windows 2020-07-09 09:36:12 +02:00
Thibaut Cuvelier
25bb51c865 Remove DOCBOOK enum values, no more used. 2020-07-08 13:15:05 +02:00
Thibaut Cuvelier
fd6e14414f Remove GuiRef::nameAllowed, as the DocBook support no more uses it 2020-07-08 09:55:59 +02:00
Thibaut Cuvelier
3a24550765 Remove GuiRef::typeAllowed, as it is now always allowed. 2020-07-08 09:41:45 +02:00
Pavel Sanda
28968b1f0d Add required elements in the layouts to support DocBook.
Slightly modified patch from Thibaut Cuvelier.
2020-07-07 09:49:48 +02:00
Juergen Spitzmueller
e121bd04bb Support halfline and fullline also in vspace. 2020-06-28 18:27:59 +02:00
Juergen Spitzmueller
b0c102cfb4 use package parskip to separate paragraphs with vertical space (#4796)
File format change
2020-06-28 17:20:18 +02:00
Juergen Spitzmueller
a68b0389bc Add support for medspace and thickspace (in text) (#11893)
File format change.
2020-06-26 11:12:35 +02:00
Jean-Marc Lasgouttes
8ceb4f6b58 Run codespell on src/frontends
Command was:
codespell -w -i 3  -S Makefile.in -L mathed,afe,tthe,ue,fro,uint,larg,alph,te,thes,alle,Claus,pres,pass-thru  src/frontends/
2020-06-26 00:21:47 +02:00
Richard Kimberly Heck
ef65414d25 Focus keyword filed in Thesaurus dialog 2020-06-18 10:51:21 -04:00
Enrico Forestieri
5a80f7bb6a Add support for the doublestroke package
This commit adds the mathed command \mathds that selects a
font more appropriate than \mathbb for typesetting the
mathematical symbols for the natural (N), whole numbers (Z),
rational numbers (Q), real numbers (R), complex numbers (C),
and some others.

As in the \mathbb case, only capital letters are supported,
but in addition one can also typeset a symbol often used for
representing the indicator function (\mathds{1}) and the
letters a, h, k.

Fixes bug #11887.
2020-06-11 16:42:31 +02:00
Juergen Spitzmueller
64edb7a196 UI improvement to math matrix dialog, suggested by magistere (#11888) 2020-06-11 11:29:11 +02:00
Kornel Benko
ed665a0333 Amend 2d48072e: Get rid of Qt resources
Remove the cmake handling too
2020-06-07 12:07:58 +02:00
Jean-Marc Lasgouttes
2d48072e66 Get rid of Qt resources
It turns out that the resources were mostly not used anyway. Removing
them shrinks LyX binary by ~6MB.

Only autotools have been adapted. cmake will require the same
simplification.
2020-06-07 01:15:28 +02:00
Jean-Marc Lasgouttes
6b221751c1 Move BulletsModule to frontend namespace 2020-06-07 01:15:28 +02:00
Jean-Marc Lasgouttes
12a9753fb5 Allow to provide explicit icons for things like command-alternative
The automatic icons for "command-alternative", "math-insert",
"math-(big)delim" and "command" can be overriden by an explicit icon
name.

Besides that, the iconName function is refactored, and now returns an
additional bool that indicates whether the icon should be flipped.

The code that uses resources is still useless. This will be the
subject of further work.
2020-06-06 01:21:02 +02:00
Richard Kimberly Heck
ca417d2c87 Fix warnings 2020-05-18 01:15:50 -04:00
Richard Kimberly Heck
d7dde0c723 Fix warnings. 2020-05-18 00:46:58 -04:00
Richard Kimberly Heck
2de99c5dd9 Fix bug #11456.
Add cancel button and take no action if we're canceled.
2020-05-18 00:28:36 -04:00
Richard Kimberly Heck
b2517d60b8 Fix bug #11405.
We don't actually prevent hidden buffers from being dirty, so we need
to save them if they are.
2020-05-18 00:07:56 -04:00
Richard Kimberly Heck
e1615f4107 Const-ness, and a missing Class declaration. I do not understand
why this ever worked.
2020-05-17 20:52:58 -04:00
Enrico Forestieri
49098aa318 Fix bug #11854
The code was checking only for particular vertical alignment requests
in order to decide to nest a standard array into a 1x1 ams matrix.
However, also vertical lines are not possible in ams matrices.
2020-05-17 18:15:00 +02:00
Juergen Spitzmueller
f2243a3bc7 Disable bookmarksopenlevel SL when bookmarksopen is false
Fixes #11289
2020-05-16 10:31:48 +02:00
Richard Kimberly Heck
c506f304bc Fix a number of issues that were stopping compilation with MSVC 19.
Patch from Thibaut Cuvelier, modified slightly by me (mostly for style).
2020-05-04 19:45:58 -04:00
Scott Kostyshak
23abb5aaa3 Fix commented out code
Since the if condition changed at af4ee1a4, the "else" in the
comment needed correction.
2020-05-04 09:27:35 -04:00
Scott Kostyshak
af4ee1a487 Only set dummy X11 selection if we do not own it
Before, we would continually set the selection to the empty string,
to maintain ownership. This causes problems with clipboard managers
GPaste and CopyQ. Further, in theory this should have better
performance since checking ownership should be faster than setting.

A disadvantage of this change is that the timestamp of the selection
will be old at this point in the code. However, when the selection
is requested, we put the selection contents at that point so the
selection timestamp should be accurate then. Further, the selection
contents are not accurate at this point in the code (they are just
the empty string), so it is not clear whether having an accurate
timestamp is beneficial.

Fixes #11715.
2020-05-04 08:58:56 -04:00
Juergen Spitzmueller
5171b7ea6c Keep sort order of counter actions 2020-05-04 09:22:35 +02:00
Juergen Spitzmueller
fba67710d8 Make counter items translatable and sort properly 2020-05-03 09:44:55 +02:00
Juergen Spitzmueller
cd2c0dcc81 Re-fix layout
Also improve some strings, and fix capitalization
2020-05-03 09:13:13 +02:00
Richard Kimberly Heck
666f90cdbb Use GuiNames for counters. 2020-05-02 23:17:16 -04:00
Richard Kimberly Heck
c37500050d More polishing of counter dialog. Thanks to Jürgen for help.
Also, remove the 'display value' option. We will move this to InsetInfo
at some point.
2020-05-02 20:33:03 -04:00
Richard Kimberly Heck
bc4ca12ab5 Polish the counter UI a bit and add some to the documentation. 2020-05-01 19:03:54 -04:00
Juergen Spitzmueller
4d3a08bf86 Fix build with qt4 2020-05-01 10:17:04 +02:00
Juergen Spitzmueller
a05b3228bc Fix Ui layouts. 2020-05-01 10:10:27 +02:00
Richard Kimberly Heck
de40b09474 Fix thinkos for counter value type 2020-04-30 23:46:18 -04:00
Richard Kimberly Heck
9a147255df GUI for new counter inset. 2020-04-30 23:11:59 -04:00
Jean-Marc Lasgouttes
7035e230ca Avoid some more copies in range-based for loops
This triggers warnings with clang++ 10.
2020-04-28 15:28:51 +02:00
Juergen Spitzmueller
3e1702b1bd Hint at (new) filter function in tooltip. 2020-04-23 14:24:32 +02:00
Juergen Spitzmueller
532e3b8952 Use CategorizedCombo for font selection
We do not have categories, but this gives as a nice filter functionality
for long (non-TeX) font lists for free.

See #11849
2020-04-23 12:43:38 +02:00
Juergen Spitzmueller
631d6b9b2e Categorized Combo: Do not draw category line if the combo has zero categories 2020-04-23 08:31:50 +02:00
Enrico Forestieri
a73c2c2b93 Raise the window in single-instance mode
Other than issuing a warning on the console, now the LyX window is
raised when in single-instance mode and no files to load are specified.
In this way, the user is aware that something happened after double
clicking the program icon. To support this functionality the new lfun
window-raise has been introduced.
2020-04-21 21:55:20 +02:00
Jean-Marc Lasgouttes
bb0117d182 Simplify code for bidi icons
Most of the RtL icons that we provide are simply mirrors of the LtR ones.
Therefore let the code do that by default if no +rtl icon is found.

The only RtL icon left for now is for "layout Enumerate" (notice the
numbers in it).

Also remove useless getPixmap wrapper and several old bidi_xxx icons
that were forgotten in previous patch.
2020-04-16 20:54:53 +02:00
Jean-Marc Lasgouttes
43eda5ad73 Reimplement properly bidi icons
When the cursor in RTL text, icons for "depth-increment" or
"layout-toggle Enumerate" look wrong.

Instead of relying on the clumsy "bidi" lfun of 2898c335, this new
version relies on a new Toobar tag BidiItem that inserts an action
which can have two icons, depending on the direction of the paragraph
containing the caret (or of the direction of the UI when no file is
open).

The alternative icon has the same name as the original one, with a
"+rtl" string appended to the lfun string. The alternative icon is
only active if the file is found. The icon themes `default', `oxygen'
and `classic' have been updated accordingly.

Fixes bug #4451.
2020-04-14 22:47:56 +02:00
Jean-Marc Lasgouttes
ce0538e372 Revert "Add mechanism to change icons in RTL mode"
This is really too clumsy. Revert in preparation for a better
mechanism.

This reverts commit 2898c335be.
2020-04-14 22:47:50 +02:00
Jean-Marc Lasgouttes
5202d44ef5 Do not compute caret geometry when we are not ready to do so.
This avoid crashes with invalid cache.

Fixes bug #11763.
2020-04-04 18:11:07 +02:00
Juergen Spitzmueller
fe09ddf1b9 Implement buffer-write force 2020-03-31 08:01:17 +02:00
Richard Kimberly Heck
104fdcc9be Fix crash after 24926b2e23.
The matched element may not have a parent. I guess the old version of
setExpanded too care of that. Now we have to do so.
2020-03-28 15:23:13 -04:00
Richard Kimberly Heck
c5c1683024 Remove newlines from shortcut LFUNs. 2020-03-28 15:15:36 -04:00
Juergen Spitzmueller
5db8b65e46 Fix typo. 2020-03-26 16:32:13 +01:00
Scott Kostyshak
0d2773ff5e Restore XLFD code for Qt 4
There is a chance that this code is still useful for Qt 4. We keep
it around just in case.

For the case of Qt 4, this commit restores the code changed in
f8e40f8a, d255339a, and d4ff3a29.
2020-03-20 20:51:44 -04:00
Scott Kostyshak
35bb9cb4a6 Change a couple instances of QFontMetrics::width()
Use QFontMetrics::boundingRect() instead. QFontMetrics::width() does
not actually calculate the width of the bounding box and is mostly
useful for knowing where to draw text after a string, taking into
account bearings. Indeed, it has been renamed to
QFontMetrics::horizontalAdvance().

For the code touched in this commit, we want to center a string.
Either method would likely be fine, but it is more easy to
understand exactly what QFontMetrics::boundingRect() does.

This commit does change functionality, although it should not be
noticeable.
2020-03-20 10:53:30 -04:00
Scott Kostyshak
f8e40f8ab8 Remove redundant font loader code
Setting the family to "family" is already attempted above. A
different case was adapted to be this duplicate case at d4ff3a29,
but it should have just been removed.

Spotted by Enrico.
2020-03-20 09:18:09 -04:00
Scott Kostyshak
d255339a4c Remove remnants regarding old XLFD font handling
These fonts are no longer supported by Qt 5 and our code no longer
uses the "xlfd" member of the struct modified in this commit. See
d4ff3a2959.
2020-03-19 12:39:16 -04:00
Scott Kostyshak
d4ff3a2959 Fix Qt dep warn and remove XLFD font workaround
This commit fixes a few warnings from Qt 5.14 regarding
QFont::setRawName() and QFont::rawName() like the following one:

  error: ‘void QFont::setRawName(const QString&)’ is deprecated [-Werror=deprecated-declarations]

These methods were deprecated in Qt 5.3. [1]

This commit removes code from 2002 (539ce478) that worked around a
problem in Qt's handling of XLFD fonts that no longer seems relevant
since XLFD is no longer supported in Qt 5 [2]. Even if the problem
were relevant, setRawName() would not fix anything since it is now
an empty method. [3]

I tested that compilation with Qt 4.8.7 works without error.

[1] https://code.qt.io/cgit/qt/qtbase.git/tree/dist/changes-5.3.0/?h=v5.14.0
[2] https://code.qt.io/cgit/qt/qtbase.git/commit/?id=3a8d7b0b9a4db91415b7bda2582a59a76b3754dc
[3] https://codereview.qt-project.org/c/qt/qtbase/+/100292/
2020-03-19 12:30:27 -04:00
Scott Kostyshak
8583410617 Fix Qt deprecation warns for setTextColor()
This commit fixes the following warning from Qt 5.14:

  error: ‘void QTreeWidgetItem::setTextColor(int, const QColor&)’ is deprecated: Use QTreeWidgetItem::setForeground() instead [-Werror=deprecated-declarations]

setForeground was introduced in Qt 4.2 [1].

We have a couple of commented out uses of a setTextColor() method in
GuiDocument.cpp, but the QTextEdit::setTextColor() is not deprecated so no
change is needed.

[1] https://doc.qt.io/archives/qt-4.8/qtreewidgetitem.html#setForeground
2020-03-19 10:16:47 -04:00
Scott Kostyshak
1d015ee9f3 Fix commented out code 2020-03-19 10:16:47 -04:00
Scott Kostyshak
27ba830b8e Fix Qt deprecation warns for setAutoCompletion()
This commit fixes a few warnings from Qt 5.14 like the following
one:

  error: ‘void QComboBox::setAutoCompletion(bool)’ is deprecated: Use setCompleter() instead. [-Werror=deprecated-declarations]

We only generated setAutoCompletion() from setting the property in
the .ui files. There does not seem to be a .ui file property that
generates setCompleter(). However, the default in both Qt5 [1] and
Qt4 [2] is to enable case-insensitive autocompletion, which seems to
be the same type of autocompletion as when we were relying on
setAutoCompletion(true). Thus, we can remove the properties that set
autocomplete to true. There is only one file, SearchUi.ui, where we
were turning off the autocompletion; we now do so using
setCompleter(0) in GuiSearch::GuiSearch().

[1] https://doc.qt.io/qt-5/qcombobox.html#setCompleter
[2] https://doc.qt.io/archives/qt-4.8/qcombobox.html#setCompleter
2020-03-18 23:17:44 -04:00
Juergen Spitzmueller
4d7f4762a1 Outliner: Add filter combo for non-output items
Addresses #11442, #10786
2020-03-15 10:46:35 +01:00
Juergen Spitzmueller
59e3ff27ff Fixup tooltips 2020-03-13 16:24:51 +01:00
Jean-Marc Lasgouttes
7d54d78691 Revert "Do not display caret when we're not ready"
I did not mean to push this.

This reverts commit 9bc255dc89.
2020-03-13 16:23:01 +01:00
Jean-Marc Lasgouttes
9bc255dc89 Do not display caret when we're not ready
Using a dialog may trigger a redraw at times where the metrics caches
have not been updated yet. To fix this, do as in paintEvent() and
abort caret blinking if there is an open undo group.

Move the decision to skip the caret painting to showCaret(), closer to
where real work happens. hideCaret () is now an alias for
showCaret(false), which allows some code refactoring.

See also commit c7496a11b2.

Fixes bug #11763 (although it does not trigger on master).
2020-03-13 16:02:36 +01:00
Juergen Spitzmueller
f4af191403 Introduce maintain unincluded children "mostly"
This is a mode for includeonly handling that is effective and still outputs
at least mostly correct counters and references. This is intended for non-
final editing work.

File format change.
2020-03-13 15:46:35 +01:00
Juergen Spitzmueller
b568a49593 Fix UI quirk in IncludeOnly settings
Fixes #11564
2020-03-12 10:37:56 +01:00
Scott Kostyshak
2cfcd706ab Fix Qt deprecation warns for setting tab
Fix warnings coming from deprecations of QTextEdit::tabStopWidth()
and QFontMetrics::width(). Regarding tabStopWidth(), the ChangeLog
states the following [1]:

  Introduced tabStopDistance property in QTextOption, QTextEdit and
  QPlainTextEdit as replacement for the inconsistently named tabStop and
  tabStopWidth properties. QTextOption::tabStop, QTextEdit::tabStopWidth and
  QPlainTextEdit::tabStopWidth are now deprecated.

Note that QFontMetrics::horizontalAdvance() is what we want here, as
opposed to QFontMetrics::boundingRect(), because we want to know
where to draw the next character after the tab.

[1] https://code.qt.io/cgit/qt/qtbase.git/tree/dist/changes-5.10.0/?h=v5.10.0
2020-03-08 11:48:54 -04:00
Scott Kostyshak
2ee5d3c3d5 Revert "Do not display caret when we're not ready"
This reverts commit e99436b529.

Kornel discovered a regression due to this commit. See:

  https://www.mail-archive.com/search?l=mid&q=20200307121525.56be047b%40admin1-desktop
2020-03-07 16:50:59 -05:00
Richard Kimberly Heck
c32e37b702 Revert b7509419.
There are double updates of dialogs in some cases, but this isn't why.
2020-03-07 16:04:01 -05:00
Scott Kostyshak
c6f4682b75 Fix Qt deprecation warn for QPixmapCache::find()
Fix the following warning from Qt 5.14.1:

  error: ‘static bool QPixmapCache::find(const QString&, QPixmap&)’ is deprecated: Use bool find(const QString &, QPixmap*) instead [-Werror=deprecated-declarations]
2020-03-06 22:46:18 -05:00
Scott Kostyshak
690c671b1d Fix Qt deprecation warn for QList::fromSet()
Fix the following warning from Qt 5.14.1:

  error: ‘static QList<T> QList<T>::fromSet(const QSet<T>&) [with T = QString]’ is deprecated: Use QList<T>(set.begin(), set.end()) instead. [-Werror=deprecated-declarations]

Regarding QList::fromSet(), the documentation now states the
following [1]:

  Since Qt 5.14, range constructors are available for Qt's generic
  container classes and should be used in place of this method.

[1] https://doc.qt.io/qt-5/qlist.html
2020-03-06 22:36:12 -05:00
Scott Kostyshak
1045020e05 Fix Qt deprecation warn for setConfirmOverwrite()
Fix the following warning:

  error: ‘void QFileDialog::setConfirmOverwrite(bool)’ is deprecated: Use setOption(DontConfirmOverwrite, !enabled) instead [-Werror=deprecated-declarations]

Note in the change that "false" changes to "true" because the option
is *Dont*ConfirmOverwrite.

QFileDialog::setConfirmOverwrite() is obsolete at least since 4.8
and QFileDialog::setOption() is available since 4.5 [1].

[1] https://doc.qt.io/archives/qt-4.8/qfiledialog-obsolete.html
[2] https://doc.qt.io/qt-5/qfiledialog.html#setOption
2020-03-06 09:56:01 -05:00
Scott Kostyshak
1c78b563ff Fix Qt deprecation warn for getContentsMargins()
Fixes the following warning:

  error: ‘void QWidget::getContentsMargins(int*, int*, int*, int*) const’ is deprecated: use contentsMargins() [-Werror=deprecated-declarations]

The new code also has advantages in that 'l' can be set to const and
it is more readable because it is clear that only 'l' is used.

QWidget::getContentsMargins() was deprecated in 5.14.0 [1]. and
QWidget::contentsMargins() is available since 4.6 [2].

[1] https://code.qt.io/cgit/qt/qtbase.git/tree/dist/changes-5.14.0/?h=v5.14.0
[2] https://doc.qt.io/archives/qt-4.8/qlayout.html#contentsMargins
2020-03-06 09:37:43 -05:00
Scott Kostyshak
b38a452efb Fix Qt deprecation warning for isItemSelected()
These methods are related to the deprecated setItemSelected() and
setItemHidden() methods that were converted at 24926b2e.
2020-03-05 20:38:31 -05:00
Scott Kostyshak
273af8803d Fix Qt deprecation warning for setItemHidden()
Consistent with commit 24926b2e.
2020-03-05 20:38:31 -05:00
Scott Kostyshak
27ca2bd950 Rename a var "sort" to not mask std::sort()
This allows us to use sort() without the "std" prefix.
2020-03-05 12:46:48 -05:00
Scott Kostyshak
14f369b47f Fix deprecation warnings from use of qSort()
This commit replaces qSort with std::sort to fix warnings from compiling with
Qt 5.14.1. Below is one of the warnings:

  error: ‘void qSort(RandomAccessIterator, RandomAccessIterator, LessThan) [with RandomAccessIterator = QList<lyx::ColorCode>::iterator; LessT$
  an = bool (*)(lyx::ColorCode, lyx::ColorCode)]’ is deprecated: Use std::sort [-Werror=deprecated-declarations]

qSort() has been deprecated since Qt 5.2. Quoting from the ChangeLog [1]:

  With STL no longer being optional for building and using Qt, a number of
  parts of QtAlgorithms no longer make sense, and have therefore been
  deprecated. Replacements are available in the STL, and generally have
  much better performance

There are some cases that require more than just a trivial substitution, but
our code does not appear to use any of those cases.

For some discussion on the differences in speed of std::sort() and
qSort(), see the following:

  https://phabricator.kde.org/D10857

These are just warnings now, but will likely be errors with Qt 6:

  https://bugreports.qt.io/browse/QTBUG-73048

I tested that LyX can still be built against Qt 4.8.7 with this commit.

This commit follows 24926b2e, which also fixes some deprecation warnings.

[1]
https://code.qt.io/cgit/qt/qtbase.git/tree/dist/changes-5.2.0/?h=v5.2.0
2020-03-05 12:44:39 -05:00
Scott Kostyshak
24926b2e23 Fix a few deprecation warnings in Qt 5.14.1
These changes fix a few instances of the following type of warning:

  error: ‘void QListWidget::setItemSelected(const QListWidgetItem*, bool)’ is deprecated: Use QListWidgetItem::setSelected() instead [-Werror=deprecated-declarations]

as well as similar warnings for setItemHidden() and
setItemExpanded(). These are just warnings now, but it is planned to
remove the methods for Qt 6:

  https://bugreports.qt.io/browse/QTBUG-73048

I tested that LyX can still be built against Qt 4.8.7 with this
commit. Indeed, these methods have been deprecated for a while (it
is just that QT_DEPRECATED_WARNINGS was only turned on by default
starting with 5.13.0). See, e.g.,

  https://doc.qt.io/archives/qt-4.7/qlistwidget-obsolete.html
2020-03-05 11:12:31 -05:00
Richard Kimberly Heck
e5b6be0712 Fix bug #10316.
By sending the request through the usual dispatch machinery, we
make sure the cursor is valid when we're done.
2020-03-03 23:17:09 -05:00
Richard Kimberly Heck
15659fed53 Andr'e points out this is wrong. Of course it is, since that is not a pointer. 2020-03-03 14:27:03 -05:00
Jean-Marc Lasgouttes
e99436b529 Do not display caret when we're not ready
Using a dialog may trigger a redraw at times where the metrics caches
have not been updated yet. To fix this, do as in paintEvent() and
abort caret blinking if there is an open undo group.

Move the decision to skip the caret painting to showCaret(), closer to
where real work happens. hideCaret () is now an alias for
showCaret(false), which allows some code refactoring.

See also commit c7496a11b2.

Fixes bug #11763 (although it does not trigger on master).
2020-03-03 12:30:27 +01:00
Richard Kimberly Heck
84e91772eb Fix nullptr warning 2020-03-03 00:08:46 -05:00
Richard Kimberly Heck
37c5cae58b Send a DispatchResult object with dispatch requests to the TOC.
This allows us to request a buffer update.
2020-03-03 00:08:06 -05:00
Richard Kimberly Heck
62af7ee772 More requires --> required, for C++2a. 2020-02-28 00:36:55 -05:00
Richard Kimberly Heck
b750941910 Stop dialogs from updating twice all the time.
I've long wondered why dialogs seem to update twice when it seems
they just need to update once. It seems it was this code. But it
was only put there to deal with a problem with code in the button
controllers that was disabled in 2007! So I'm going to try removing
it. If we start seeing weird behavior with dialogs in master, then
this will be why.
2020-02-28 00:11:45 -05:00
Richard Kimberly Heck
f53243f81b Fix warnings 2020-02-28 00:10:23 -05:00
Richard Kimberly Heck
78ade7e6ec Remove code that has not been used for 13 years. 2020-02-28 00:08:30 -05:00
Richard Kimberly Heck
1948391a94 Fix warnings. 2020-02-28 00:07:53 -05:00
Richard Kimberly Heck
c483565522 Fix a bunch of warnings. 2020-02-27 23:58:01 -05:00
Richard Kimberly Heck
f4d5122a10 Fix null pointer warnings. 2020-02-27 00:05:41 -05:00
Richard Kimberly Heck
64f7da961a Fix bug #11748.
Track the last chosen citation style when we clear the entries.
2020-02-26 23:00:09 -05:00
Richard Kimberly Heck
ca40d1f92a Fix a bunch of warnings 2020-02-26 22:29:40 -05:00
Enrico Forestieri
f28334ac8b Cleaner fix to ensure 32-bit XCB events
This fix still satisfies Valgrind and is cleaner than the approach
at 19c41bd0: instead of using calloc we now use the C++11 specifier
alignas. For more info, see the following ML thread:
https://www.mail-archive.com/search?l=mid&q=20200219024908.5n4x4osni55gylo3%40tallinn
2020-02-25 12:37:51 +01:00
Enrico Forestieri
8977296078 Revert "Fix write to uninitialized bytes for XCB event"
This reverts commit 19c41bd095.

A more efficient fix is on the way.
2020-02-25 12:32:10 +01:00
Richard Kimberly Heck
86f95062bd Fix some clang warnings.
The first one, a comma instead of a semi-colon, is a weird one.
2020-02-23 15:52:15 -05:00
Stephan Witt
f2f861f017 Use real path names for buffer lookup by name of temporary external files.
In case of path names for external files containing symbolic links the real path
and the logical path name may be different for the same file or directory.
LyX is using QDir::tempPath() to create the path name of the temporary directory.
The Qt implementation is free to return the logical or the real path name here and
it happens to be different for various platforms and versions.
The most stable and clean solution is to use the real path name consistently.
2020-02-22 12:11:42 +01:00
Stephan Witt
aec491f686 Avoid potential leak of memory pointed to by QTreeWidgetItem subcatItem 2020-02-21 07:57:09 +01:00
Stephan Witt
2bf7756196 Avoid potential leak of memory pointed to by QTreeWidgetItem catItem 2020-02-20 08:12:08 +01:00
Scott Kostyshak
19c41bd095 Fix write to uninitialized bytes for XCB event
As the xcb_send_event man page [1] states,

  In order to properly initialize these bytes, we allocate 32 bytes
  even though we only need less for an xcb_configure_notify_event_t

This commit fixes the following Valgrind error, which could be
triggered by selecting a letter in LyX:

  ==12698== Syscall param writev(vector[...]) points to uninitialised byte(s)
  ==12698==    at 0x61F578D: __writev (writev.c:26)
  ==12698==    by 0x61F578D: writev (writev.c:24)
  ==12698==    by 0x4A83BFC: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
  ==12698==    by 0x4A83FD0: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
  ==12698==    by 0x4A84246: ??? (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
  ==12698==    by 0x4A84ACB: xcb_flush (in /usr/lib/x86_64-linux-gnu/libxcb.so.1.1.0)
  ==12698==    by 0x17C8F06: lyx::frontend::GuiApplication::nativeEventFilter(QByteArray const&, void*, long*) (GuiApplication.cpp:3366)
  ==12698==    by 0x5AA4EEE: QAbstractEventDispatcher::filterNativeEvent(QByteArray const&, void*, long*) (qabstracteventdispatcher.cpp:484)

[1] https://www.x.org/releases/current/doc/man/man3/xcb_send_event.3.xhtml
2020-02-19 09:48:54 -05:00
Pavel Sanda
b7af21ad7c Fix memory leak.
Spotted by Scott.
https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg210447.html
2020-02-18 10:03:42 +01:00
Richard Kimberly Heck
731feb9f18 Silence some clang warnings. 2020-02-17 12:31:38 -05:00
Richard Kimberly Heck
fb03f2a5ec Fix a strange warning in QtCreator:
/cvs/lyx/lyx-devel/src/frontends/qt/TocModel.cpp:356: warning: loop variable 'toc' has type 'const pair<std::string, shared_ptr<lyx::Toc> > &' (aka 'const pair<basic_string<char>, shared_ptr<vector<lyx::TocItem> > > &') but is initialized with type 'const std::pair<const std::__cxx11::basic_string<char>, std::shared_ptr<std::vector<lyx::TocItem, std::allocator<lyx::TocItem> > > >' resulting in a copy

/cvs/lyx/lyx-devel/src/frontends/qt/TocModel.cpp:356: use non-reference type 'pair<std::string, shared_ptr<lyx::Toc> >' (aka 'pair<basic_string<char>, shared_ptr<vector<lyx::TocItem> > >') to keep the copy or type 'const std::pair<const std::__cxx11::basic_string<char>, std::shared_ptr<std::vector<lyx::TocItem, std::allocator<lyx::TocItem> > > > &' to prevent copying

Easier just to use 'auto'.
2020-02-17 12:31:38 -05:00
Stephan Witt
f12c4dbcd9 Remove unnecessary assertion after explicit buffer pointer check. 2020-02-17 14:35:03 +01:00
Stephan Witt
a1d68511ac Avoid potential crashes with missing document buffer in dispatch of buffer based LFUNs.
Use LASSERT with appropriate action instead of LATTEST assertions.
Debug build is unchanged and asserts, release build skips the action gracefully.
2020-02-17 13:36:37 +01:00
Pavel Sanda
2db6a81156 Unify handling in dispatchVC.
All these check could be actually dropped, because unless dispatchVC
is called directly, getstatus would already handle it.
2020-02-15 20:55:14 +01:00
Stephan Witt
6dab8739eb Avoid uninitialized position variables in case of current inset not doing the assignment 2020-02-14 12:11:10 +01:00