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
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).
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.
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
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]
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
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
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
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
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
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).
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.
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.
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
/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'.
There are two techniques that I know of for forcing the direction of a
string, regardlessly of whether its contents is naturally LtR, RtL or
undecided.
1/ The unicode LTR/LTR override characters. This is supposed to be the
clean way, however, it does not seem to work with Qt 5.14 (see
#11691).
2/ The undocumented QTextLayout::setFlags method. This is used
internally and allows to pass the (undocumented) flags
Qt::TextForceRightToLeft and Qt::TextForceLeftToRight. This was
used until we had issues with Qt 5.11 (see #11284).
In order to get the best of both worlds, this patch allows to enable
those two methods separately, and actually enables both at the same
time by default!
(hopefully) Fixes bug #11691.
We will replace this with a better solution
For now, only keep
- Changes::isChanged()
- Buffer::areChangesPresent(), replaced by a dummy function
Next step will be to provide a working areChangesPresent() and to
compute Inset::isChanged in updateBuffer.
This reverts commit 6d4e6aad24.
This requires to add a assertion_failed_msg handler. Take this
occasion to cleanup and uniformize the various boost.cpp files that we
have.
This adds 50k line of whatever to the source code.
Small helper lfun that makes LyX remove the aux file before doing the
next export. A bit more convenient than removing the files manually
or restarting LyX.
We tend to have insets which buffer() member is invalid. To help
debugging, this commit paints their background in red when devel-mode
is on.
To this end, a new method develMode() is added to the Painter class.
With this commit, it is easy to see that macro template do not have a
proper buffer set!
Horizontal scrolling used to be taken into account when updating caret
geometry. This is wrong since it may have changed when time comes to
draw the caret. This leads to a situation where the first apparition
of the caret is at a wrong place.
Now the extra horizontal offset is used at drawing time.
Fixes bug #11603.
The reader of CREDITS (GuiAbout.cpp) now ignores lines that start
with the number sign (#). This commit also introduces a commented
out header in CREDITS reminding any potential editor that all
changes will be overwritten by generate_contributions.py.
The provided working directory was not properly set when the underlying
process starts.
It is not clear, why only this one call to one.startscript()
needs fixing. OTOH, the other calls do not use 'Systemcall::DontWait'
as the first parameter.
When the cursor in RTL text, icons for "depth-increment" or
"layout-toggle Enumerate" look wrong.
To fix this, the lfun "bidi" is introduced. "bidi ltr func" behaves
like "func" in LTR text, but is unknown in RTL text. "bidi rtl" does
the opposite. This allows to add two icons, but only have one icon
available. When no document is available, only LTR is assumed.
To make this work, the handling of unknown functions in toolbar has
been changed so this these functions can change dynamically their
existence.
The icon themes `default', `oxygen' and `classic' have been updated
accordingly.
Fixes bug #4451.
In particular, the directory frontends/qt4 is renamed to frontends/qt.
Many configurations file have to be updated. All mentions of qt4 in
the source have been audited, and changed to qt if necessary.
The only part that has not been updated is the CMake build system.
By default, the behavior is the same as before, except that the
language of new document is not unconditionally en_US anymore.
The new checkbox "Respect OS keyboard language" (off by default)
governs this behavior.
Update prefs format to 30.
Instead of setting language from context when moving the cursor, set
it to the OS input language. This behavior will probably need to be
controlled by a preference, since not everybody changes keyboard
mapping when changing language.
This required to move BufferView::setCursorLanguage to
Cursor::setLanguageFromInput().
This bug provides two features:
1/ when a new document is created the language is set to the current
keyboard language.
2/ when keyboard is switched at OS level, the input language of
current window is changed. The language is set preferably to one of
those of the document. Ex. if the keyboard changes to en_GB but one
is typing a document in US English and Hebrew, then US English will
be selected rather that adding UK English to the list.
The implementation depends a lot on Qt. The platform status is :
* working on Windows 10
* not working with Linux (although 1/ works with Qt4); it seems that
Qt5 supports switching through ibus, but I do not know what this
means.
* not yet tested on macOS.
This addresses bugs #6450, #6247 and somehow #10514.
It is not a good idea to call caretPosAndHeight when the caret is in a
paragraph that is not in cached metrics. This can happen when not
using "cursor follows scrollbar".
This commit refactor things a bit so that testing is done in
BufferView.
This bug is not in 2.3.x.
Like with macOS, the Wayland compositor seems to require a
backingstore when doing partial updates like we do.
This extends the mechanism that has been introduced for macOS. This
has to be done at run time, not compile time.
This revives a patch by Uwe and extends it. Additional options to font
packages/fontspec can now be entered in Document Settings.
This is principally also true for TeX fonts, if the new TeXFont tag
MoreOptions is set. For the time being, I have only done this for
MinionPro, as a model and prove of concept.
Note that adding more TeXFonts requires a file format change,
respectively, and changes to tex2lyx (in the same way as I've done for
MinionPro).
This addresses #8226
With non-TeX fonts, the \inputencoding setting is overridden
by "utf8-plain" (pass-through). Keeping the old value allows
switching back to TeX fonts without the need to (re)set
the input encoding.
Also change back the GUI name of the "auto-legacy" setting
(cf. #11115).
The culprit here is the constructor QString(QByteArray const &): in
Qt4, it would interpret the byte array as latin1, and in Qt5 as utf8.
Therefore it is safer to use explicitly QString::fromUtf8 instead of
this constructor.
Several places where additionally simplified, in order to avoid some
extra conversions.
Ensure the default encoding "utf8" comes always first,
followed by other common variants.
The encodings were sorted based on the GUI name which leads to
the default setting moving from the top position in some localizations.
Prepare for languages that use CJK with TeX fonts and Polyglossia
with non-TeX fonts.
Korean is already supported by Polyglossia,
LyX support will follow (file version change).
Previously, we only included branches from the master document. This
includes those from the parent, grandparent, etc, and does so in a way
that won't crash on recursive includes.
The basic problem here is that rather than using an abstract syntax,
backend-specific param strings are produced in the listings dialog,
depending on whether listings or minted is used.
Of course this breaks if a user switches backends inbetween (s/he would
have to open and re-apply each and every listings inset!)
Do at least the most basic translations in InsetListings::latex().
A sane solution would imply the use of only one param syntax with
respective interpretation for each backend. But this would be a file
format change.
The category tag was rarely used and thus not very useful. This adds
categorization to most modules (the rest will follow) and uses the
\DeclareCategory tag we use in layouts rather than the extra syntax
we used in modules. Categories are now added to the po files and
translated.
Note that this is work in progress: the current categories are still
subject to change.
The ultimate goal of this is to sort the modules in the GUI by category
as we do with layouts, examples and templates (and add a filter to search
for specific modules)
As it is now (with the many modules we accumulated), the module selector
is not really usable anymore. If you don't happen to know how exactly a
module is named, selecting a module is really a PITA.
The idea is simple: we insert a pre-formatted table (with a given border
style currently, but other attributes are possible as well) via file-insert
and scale it then to the requested size.
We need three sizes (1x1, 1x2 and 1x3) to generate all sizes properly (due
to border specifications).
Currently, these styles can only be accessed via lfun tabular-style-insert
and the Tabular Create dialog.
My plan is to add a buffer param to set a default style (#9901) which then
also is respected by the toolbar button and probably a layout tag to let
classes specify a default style (#8360).
Attempt to save the template in the appropriate language subfolder of
the user template directory (and propose to create it if it doesn't exist
yet).
That way, user-generated templates (1.) get the correct language attribution
in the lyxfiles dialog and (2.) users can easily generate different
language versions of a template.
Now only the languages available for the selected file are displayed.
By default, LyX pre-selects the GUI language (and falls back to English
if this is not available). Once another language has been selected by
the user, this one is preferred before the GUI language (and the English
fallback).
This seems to be necessary on windows, where math editing can get very
slow. Note that other methods like rbearing already use a cache.
In the future all these caches for single characters shall be unified.
This lists all respective files from user, build and system directory
in a structured way and thus allows for easier access to them.
Fixes: #2396, #6861
Fixes: #11508
Now there is the opposite case which needs to be addressed:
If no translation is available for a shortcut in a non-latin-scripted
document, we need to switch the language to English.
This commit removes the adhoc code in GuiPrefs and moves it to LyXRC,
so that it triggers in every preference change.
The code has also been updated to trigger on more variables, e.g.
font_*_foundry.
Note that the actual function that are called have not been changed
(addPreviews and LFUN_SCREEN_FONT_UPDATE), although there are doubts
that they behave as needed (see FIXMEs).
Fixes bug #11498.
Currently, our computation of row height is not completely standard:
* we ignore completely the QFontMetrics::leading() parameter
* we add arbitrarily 2 hardcoded pixels to the height.
This patch reverses these two choices, which leads to
* slightly larger spacing for MinionPro (which has a big leading).
* an additional spacing of 20% font height that depends on dpi and zoom.
Visual inspection with LibreOffice seems to imply that it disregards
the font leading but uses a interline which is 20% larger than the
font height.
Looks like an accidental commit.
> git log GuiGraphicsUi.h
commit a1cec91afa
Author: André Pönitz <poenitz@gmx.net>
Date: Fri Aug 31 05:53:55 2007 +0000
move our stuff off the Q* namespace
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19935 a592a061-630c-0410-9148-cb99ea01b6c8
That's all a rename, basically. The original file, QGraphicsUi.h, was commited at 12e5a52b92, and it was empty then, too.
For some reason, adding a LTR/RTL Override unicode character before a
MinionPro string increases the ascent of the line.
This creates vertical offset issues when painting if the ascent used
as reference is the one of the font. Use the QTextLine ascent instead
for better results.
This is a followup to 1bed76e2a.
Fixes (reopened) ticket #11284.
Eventually, all overridden virtual methods should be marked properly.
Currently, clang only warns about those in classes that already use
override in at least one place (which was the case dor GuiApplication).
When blinking the caret, it looks like a cool idea to only update the
small rectangle containing the caret. Actually it is an awful idea, since
the paint event will paint some rows, and these rows will not be
properly painted outside of the small rectangle. Unfortunately, the
painter will skip those "painted" rows on next paint events.
This leads to painting errors that depend on the ordering of "real"
and "caret" paint events. This is the reason why they only appeared
with split screens.
Quote of the day: ``The real problem is that programmers have spent far
too much time worrying about efficiency in the wrong places and at the
wrong times; premature optimization is the root of all evil (or at
least most of it) in programming.''
-- Donald Knuth, The Art of Computer Programming.
Fixes bug #11354.
We need to load the master document before applying the params, since
otherwise the TOC reset (and other things) happen before the master
has been loaded (and set as parent).
The last 20 applications are saved now and accessible both via the lfun
(textstyle-apply n) and the toolbar (via button menu)
Fixes: #7133
This also changes the default icon and toolbar position of the action,
as requested in #11427
We fill up edited insets into cache when editing inset is triggered, but
this cache is never cleared up for dialogs unassociated with some inset
- thus when e.g. graphics dialog is open for completely new image the
old cache is (wrongly) used.
https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg207192.html
With Qt 5.11 at least, RtL text will be drawn RtL even when the
(undocumented) flag Qt::TextForceLeftToRight is applied to the
QTextLayout object. This creates selection issues for Hebrew text
marked as English.
The solution is to do the same as in breakAt_helper, that is prepend
the string with a direction override unicode character.
Doing this requires to introduce a TEXTLAYOUT_OFFSET constant that has
to be used wisely to account for this extra character.
Fixes bug #11284.
We used to need a hack to set the size of the layout combo, but
the code was changed in Qt 4.5 or so. Hence the appearance of this
bug in 2009. We can now just remove this hack, and all seems to
work correctly.
The filters for the layout combo and document class combo share a
problem: If you type "beam", e.g, in the latter case, then we will
show any document class that contains those letters, in that order,
but not necessarily consecutively. This is extremely confusing and,
as José put it, just weird. So let's fix it.
I'd call this a bug so would be happy to see this in stable, too.
This code has issues and there is no evidence that it improves performance.
Remove LyXRC variable \use_pixmap_cache and update rc format to 29.
Now the global pixmap cache is only used by GuiCompleter. Therefore
there is no need to reset it when fonts change.
If we were not ready to paint the screen, this does not mean that we
should give up on repainting, just potpone it.
I thought that it was bad to call update() in the paint event, but I
cannot find reference to this anymore and everything seems to work as
intended.
We do not know what to do with horizontal scrolling events, so we ignore them.
Note that the code has to be different between Qt4 and Qt5.
Fixes bug #11257.
This returns a localized version of a string (in the GUI language)
if available, removing trailing colons and accelerator marks.
This can be used to refer to dialog items in the docs in a portable way.
When searching for and item in the menu, also try to consider those that
require a BufferView (such as View/Update formats).
Also, be explicit for the default format in order to find it.
Fixes: #9851
With this commit, info insets leave the dark backstage room of an opaque
and quite hidden dev-only feature and come frontstage.
In the UI, they present themselves as "Fields" since this is what people
know from word processors. Other user-related fields that could be
implemented next: time, user name (I plan to do that for 2.4).
Since this supersedes date-insert, I removed Insert > Date from
the menu and propose to ditch date-insert and the corresponding rc.
The lyx2lyx reversion routine has lots of room for improvement and
attractive tasks for pythons (file timestamp, switch of localization).
Please feel invited!
This is a file format change.
A new UNDECIDED state is used if multiple cells with differing border
settings are selected.
This prevents additional borders to be set without being asked.
Fixes: #10010
It is a general problem when doing graphics to know where a line
begins and where it ends pixel-wise. At the instigation of Scott, and
with the use of the kmag magnifier, this commit corrects 3 areas:
* foreign marks were larger than the row element they were supposed to
mark. This could lead to moving lines, depending on paint ordering.
* visible spaces were drawn outside of their box (select a single
space to see this).
* the `L' blinking caret would leave a cursor dropping because the
horizontal part was too wide.
Minted does not have a language option but it is possible to enter
this option in the LyX interface for compatibility with the listings
package, and also for letting to enter a language not present in the
gui. So, this option is only used for properly specifying a language
in a listing, unless it is entered in the document settings dialog.
This case was not foreseen and thus the option was being passed to
the package as is, causing havoc. With this commit the option is
still available but is used to set a default language for a new
listing in place of the default "tex" language used so far.
This reuses code intended only for mac manus and generalizes it. The
list of strings to add to po files is found in
GuiTranslator::translate.
This is useful now that LyX relies on QDialogButtonBox class for its
dialogs. Indeed many languages are not covered natively by Qt.
It is possible to enable the "locace" debug channel to see what
strings are not covered and should be added to our own translation
tables.
In order to make things easier, a new method getIfFound() has been
added to the Messages class, which returns an empty string when no
translation has been found, as Qt's translate() does.