Commit Graph

26339 Commits

Author SHA1 Message Date
Juergen Spitzmueller
f5a2d770b8 Footnote: (re-)add a fallback dummy counter 2020-03-06 18:21:18 +01:00
Juergen Spitzmueller
b8cac52759 Use real counter in deleted footnotes 2020-03-06 18:16:34 +01: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
Juergen Spitzmueller
339424ce00 Handle deleted BibTeX/Biblatex bibliographies
Since we cannot strike-out these, we output a placeholder when
show changes in output is active.

Fixes #11762
2020-03-06 13:49:10 +01:00
Juergen Spitzmueller
d94b708a0f Tell updateBuffer whether an inset is deleted.
Fixes #11747
2020-03-06 13:23:01 +01:00
Juergen Spitzmueller
e6105275af Consider change tracking in setBeginOfBody()
Fixes #11749
2020-03-06 11:49:32 +01:00
Juergen Spitzmueller
21567a260c Use range-based loop 2020-03-06 11:20:46 +01:00
Juergen Spitzmueller
228d738868 Account for changes in insets when checking changes in selection
This is not ideal, see FIXME.

Fixes #11774
2020-03-06 10:53:54 +01: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
bd0bf2125c Fix nullptr warnings 2020-03-01 15:31:58 -05:00
Kornel Benko
9c4642fbcc Cmake tests: Amend f6f51587 2020-02-29 20:37:04 +01:00
Richard Kimberly Heck
4a81983edd Avoid a copy. 2020-02-29 05:55:20 -05:00
Richard Kimberly Heck
585823704a Fix warnings and use ranges. 2020-02-29 00:21:02 -05:00
Richard Kimberly Heck
9afc001fc5 Fix warnings 2020-02-29 00:21:00 -05:00
Richard Kimberly Heck
33d663720b Fix a bunch of warnings 2020-02-29 00:06:35 -05:00
Richard Kimberly Heck
99bf96c56b Fix warnings in support/. 2020-02-29 00:06:35 -05:00
Richard Kimberly Heck
4460df3292 Fix header. 2020-02-29 00:06:35 -05:00
Richard Kimberly Heck
56a5a8280e Null pointers. 2020-02-29 00:06:35 -05:00
Richard Kimberly Heck
8d26ae57ba Use ranges, fix warning 2020-02-28 01:55:05 -05:00
Richard Kimberly Heck
5baca8171f Use ranges, fix warning 2020-02-28 01:48:10 -05:00
Richard Kimberly Heck
969a1bab7d Use range 2020-02-28 01:44:48 -05:00
Richard Kimberly Heck
12d164393e Fix nullptr warnings 2020-02-28 01:42:32 -05:00
Richard Kimberly Heck
cf37ad8c80 Use ranges, fix warnings 2020-02-28 01:40:30 -05:00
Richard Kimberly Heck
084baebbf9 Fix nullptr warnings 2020-02-28 01:28:08 -05:00
Richard Kimberly Heck
3f9aa81452 Use ranges, fix warnings 2020-02-28 01:25:30 -05:00
Richard Kimberly Heck
94f64cd304 Fix warnings 2020-02-28 01:21:02 -05:00
Richard Kimberly Heck
5728625b65 Fix warnings 2020-02-28 01:16:21 -05:00
Richard Kimberly Heck
a9e663546b Use range 2020-02-28 01:16:10 -05:00
Richard Kimberly Heck
31c511d2ce Fix warnings 2020-02-28 01:09:45 -05:00
Richard Kimberly Heck
83779e7972 Use range and rename private variable 2020-02-28 01:08:28 -05:00
Richard Kimberly Heck
5b5b6998cb Use more ranges 2020-02-28 01:06:22 -05:00
Richard Kimberly Heck
7a66c93265 Use ranges 2020-02-28 00:52:38 -05:00
Richard Kimberly Heck
81597aabdb Polish 2020-02-28 00:39:50 -05:00
Richard Kimberly Heck
62af7ee772 More requires --> required, for C++2a. 2020-02-28 00:36:55 -05:00
Richard Kimberly Heck
21b4ecca7f Apparently, "requires" is a keyword in C++2a. 2020-02-28 00:28:18 -05:00
Richard Kimberly Heck
0dc9fca86e Remove code that has not been used since 2010.
See 208acbc72.
2020-02-28 00:21:48 -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
2165855d5e Revert unintended change 2020-02-27 14:36:46 -05:00
Richard Kimberly Heck
f4d5122a10 Fix null pointer warnings. 2020-02-27 00:05:41 -05:00
Richard Kimberly Heck
79bcf68018 Fix warning (and simplify) 2020-02-26 23:37:24 -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
Richard Kimberly Heck
2e444dd657 Fix problem with validation when using InsetLayout. 2020-02-26 22:19:36 -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
Jean-Marc Lasgouttes
74540c9896 Fixup d207e85c: paint sublabel with the correct background color
The above mentionned patch did paint the background of the sublabel to
avoid "bold-like" effect. However the correct backgound color is the
row's one, not the inset's one.
2020-02-24 10:41:18 +01:00
Richard Kimberly Heck
a9d9fdc9bf Fix alignment warnings from clang. 2020-02-23 17:15:01 -05:00
Richard Kimberly Heck
34f9ea8275 Use C++11 construct. 2020-02-23 16:59:59 -05:00
Enrico Forestieri
5873a382de Fix FileName::realPath() on Windows
The realPath() implementation on Windows works only for files and
not for directories. By using an API available starting from Vista
it is possible to fix it in a simple way.

I also took into account using the Qt QFileInfo::canonicalFilePath(),
but it turns out to not work when a path component is a junction
(tested with Qt 5.14.1).

Due to this, it is not possible compiling or using LyX on Windows
versions earlier than Vista.
2020-02-23 22:59:03 +01:00
Richard Kimberly Heck
0daceae649 Try again to fix memory leak reported by Scott.
This time, use a shared_ptr.
2020-02-23 16:56:43 -05:00
Richard Kimberly Heck
72c581ebdb Revert "Fix memory leak reported by Scott."
It leads to a double delete error.

This reverts commit 11397a2e82.
2020-02-23 16:29:58 -05:00
Richard Kimberly Heck
11397a2e82 Fix memory leak reported by Scott. 2020-02-23 15:54:13 -05: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
Richard Kimberly Heck
d11a27a611 Fix nullptr warnings 2020-02-23 15:52:15 -05:00
Richard Kimberly Heck
608b927daf Fix "no extern declaration" warning. 2020-02-23 15:52:15 -05:00
Jean-Marc Lasgouttes
57b400cdff Make sure that spelling marks do not spill ouside of row
This avoids annoying remnants of dotted red lines.

Fixes bug #11755.
2020-02-22 18:02:13 +01: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
Pavel Sanda
4e4bba441d gcc 4.7 leftover 2020-02-20 09:25:00 +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
Stephan Witt
fc790bc1f5 Add missing check for nullptr on check of language encoding of next paragraph. 2020-02-18 09:03:20 +01:00
Stephan Witt
f904fb2d61 Add missing initialization for local variable.
The autoargs variable is random for empty macro argument lists otherwise.
2020-02-18 08:59:20 +01:00
Stephan Witt
fe02f151f9 Remove useless assignments to a local variables never read later. 2020-02-18 08:55:45 +01:00
Stephan Witt
225de7830e Remove useless assignment to a local variables never read later. 2020-02-18 08:55:00 +01:00
Stephan Witt
febbc3537a Avoid crashes in case of missing document buffer for buffer based conversions. 2020-02-18 08:43:22 +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
Stephan Witt
0f1f00db27 Code cleanup: avoid repeating temp_dir method calls while local variable has a result already. 2020-02-17 13:25:35 +01:00
Juergen Spitzmueller
4debbdd6b6 Restore custom tmp directory
Fixes #1174
2020-02-17 09:00:08 +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
Juergen Spitzmueller
e31364fdcb whitespace 2020-02-15 09:26:43 +01:00
Juergen Spitzmueller
195393f401 Fix Python detection on windows
Patch by Eugene Chornyi
2020-02-15 09:26:08 +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
Stephan Witt
aca95619b8 Avoid potential leak of memory pointed to by QStandardItem catItem 2020-02-13 16:39:14 +01:00
Richard Kimberly Heck
b175f5a315 Fix bug #11737.
We need to use the FileName methods when moving or removing a file,
so that refresh() gets called.

(cherry picked from commit d930913898)
2020-02-13 00:11:23 -05:00
Juergen Spitzmueller
40b1a6f9b1 Revert "Fix bug #11712."
This breaks on Linux

This reverts commit fdf81a9bab.
2020-02-12 16:11:01 +01:00
Richard Kimberly Heck
fdf81a9bab Fix bug #11712.
Fixes some escaping issues on Windows especially

Patch from Eugene.
2020-02-12 09:25:13 -05:00
Stephan Witt
e900b61d46 Make cell index of tabular local for column loop. 2020-02-12 12:32:31 +01:00
Stephan Witt
3ee1bcad04 Remove another unnecessary assignment 2020-02-12 12:28:18 +01:00
Enrico Forestieri
926c846abb Remove unnecessary assignments 2020-02-10 21:59:52 +01:00
Enrico Forestieri
536d476d38 Make sure to not dereference a null pointer. 2020-02-10 21:54:07 +01:00
Juergen Spitzmueller
b8546139c8 Properly resize columns of child document table widget 2020-02-07 17:23:14 +01:00