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.
The is a fixup to commit 611df441. It seems that the wrong unicode
property was selected. It could be that both classes should be used.
Fixes bug #11900.
Add new RowFlags value CanBreakAfter, which says that the row can be
broken after the inset if needed. There is no CanBreakBefore yet,
because I do not know of an inset that needs it.
This makes screen closer to the actual behavior of insets.
Currently, only unprotected spaces and some special characters are
concerned. There may be more that need this handling.
Fixes bug #11621.
The enum DisplayType is replaced with the flags RowFlags that can be
combined. Here is the correspondence between the old DisplayType and
the new Inset::RowFlags:
DisplayType RowFLags Meaning
Inline Inline plain inline inset
-- BreakBefore row ends before this inset
-- BreakAfter the row ends after this inset
AlignCenter Display the inset is centered on its own row
AlignLeft Display | AlignLeft the inset is left-aligned on its row
AlignRight Display | AlignRight the inset is right-aligned on its row
-- RowAfter an extra row is needed after this inset
Display is just a shortcut for BreakBefore | BreakAfter.
The flags for the newline inset will be BreakAfter | RowAfter,
while the separator inset will just use BreakAfter.
This groundwork does not introduce any new feature at this point. It
aims to remve the numerous isNewLine and isSeparator all over the
code, and to eventually optional break after some insets like spaces
(see #11621).
Most display() methods are renamed to rowFlags(). Some are removed
because they returned Inline.
Now display() is only a helper function for hull insets.
Fix paragraph id in xHTML output to the pre-refactoring status.
Tested on math manual (plus minus nonessential newlines).
Slightly modified patch from Thibaut Cuvelier.
Return early when format is unknown. I am not sure whether this is
supposed to happen and whether we should assert on this condition.
Spotted by coverity.
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.
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.
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.
74540c98 was a fixup of d207e85c, which avoided using inset background
as inset label background.
d207e85c introduced a background under inset labels to avoid fake bold
effect.
Hopefully, this last variation will be the right one !
This is a modern alternative for makeindex that is fully unicode-aware
and written in lua.
As opposed to xindy, it is more lightweight and actively maintained.
The program is still in a rather early stage of development, so we do
not propose this as default.
This relies on xindex 0.22 (about to be released) to function properly.
Due to a hint from Scott:
> I don't think it should be printed to LYXERR0. That goes to the terminal
> for the user. Even our lyx2lyx tests fail if they detect any information
> printed to the terminal (although we escape some warnings). If "find" is
> not a good debug level for it, maybe we can put it in "info" (the first
> debug level)?
It seems that the use of zoom in determining the size of the minimal
value was a bad idea.
It still think that the situation is not very satisfying, we need a new idea.
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.
These uses are inefficient (a loop really) and require that pit_type
is ptrdiff_t.
Instead, RandomAccesslist::constIterator is renamed to iterator_at and
a version adding a non-const iterator is added. Additionally, the
method retirns end() when position is equal to the size of the
container (see #11861).
lyx::next and lyx::prev are removed, and std::prev is used in the few
places where the code requires it (for no good reason IMO).
These uses are inefficient (a loop really) and require that pit_type
is ptrdiff_t.
Instead, RandomAccesslist::constIterator is renamed to iterator_at and
a version adding a non-const iterator is added.
lyx::next and lyx::prev are removed, and std::prev is used in the few
places where the code requires it (for no good reason IMO).
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.
This inset allows counters to be set, reset, saved, restored, etc,
both in the LyX GUI and in the output; optionally, the effect can be
limited to the GUI. Of course, LaTeX provides means for doing all of
these things, so they could previously be done with ERT, as far as
the output is concerned. But there was no mechanism for manipulating
counters in the GUI and none for other output formats.
Keep track of nested includes and just refuse to re-enter a file
we're already in the process of handling.
There's a question whether we should do this in updateBuffer and
validate, or whether we should do it separately. For now, this seems
to work.
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.
Actually the change is affecting only builds if
1.) Using cmake build
2.) on unix
To use it on
cygwin: one has to patch development/cygwin/lyxrc.dist.in
MacOSX: -//- development/MacOSX/lyxrc.dist.in
We need also a Windows-version
Also the compilation with automake lacks the handling of development/unix/lyxrc.dist.in
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.
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.
This should work on Windows, but needs test.
The changes (namely the installation directory for the dtl executables)
for automake are not yet done. (JMarc?)
It may fix bug #11325 if cmake configured with '-DLYX_EXTERNAL_DTL=OFF'
After commit 6a936d63, the helpful debug message tries to display
non-existing elements and crashes the program :(
Fix by radical simplification of the message.
Part of bug #11777.
The ^ is interpretted as bitwise XOR, so 2^(20) evaluated to 22.
Thanks to Riki for the << trick. This way, we do not have to use
pow() and include the <cmath> header for this one expression.
As a consequence of fix e64ea357 to ticket #10797, we draw a bit too
much of the inset background outside of the inset (visible for insets
with colored background). #10797 is a ticket that triggers when the
cursor has a width larger than 1.
This patch limits the problems in two respects
* nothing is done on the left, since the cursor width only expands on
the right.
* on the right, the extra width is limited to cursor width.
Fixes bug #11786.
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.
This reverts commit 438f15da21.
Revert "Track whether we have warned about mixing layouts across e.g. branches."
This reverts commit 861c6167ca.
Revert "Track whether title has been issued via OutputParams."
This reverts commit b536759c07.
There are massive complications here, and I don't have time to fix them all
right now.
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.
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.
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
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
When branches are used in the title, we may need to track whether
we've issued the title across branch insets. So we put the relevant
variables into OutputParams.
This commit fixes a couple of warnings from Qt 5.14 like the
following one:
error: ‘int QTime::restart()’ is deprecated: Use QElapsedTimer instead [-Werror=deprecated-declarations]
This commit changes two uses of QTime to QElapsedTimer, one used
only when the "files" debug flag is set, and the other for timing
whether a script (e.g., knitr) takes longer than a certain amount of
time to run.
QElapsedTimer is superior for these two use cases in that it uses a
monotonic clock if possible, and is thus more robust to certain
changes (e.g., daylight savings changes) [1]. Similarly, the commit
in Qt Base that makes this deprecation [2] mentions the following in
the commit message:
QElapsedTimer does the job better and without the DST kludges.
Note that QElapsedTimer class was introduced in Qt 4.7, so no
conditioning on Qt version is necessary.
Not all methods of QTime are deprecated and we still use some of
the non-deprecated methods in our code (e.g., to get the current
wall clock time in GuiProgress::currentTime()).
[1] https://doc.qt.io/qt-5/qelapsedtimer.html
[2] https://code.qt.io/cgit/qt/qtbase.git/commit/?id=ed99a591a83a399458f12341d0a1c0b3152f247a
Thus a document can be viewed if it contains references to
its master, children or siblings that are being excluded via includeonly,
or viewed standalone if it contains references to its master or siblings.
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.
GuiInclude::initialiseParams() calls InsetCommand::string2params()
which calls InsetCommandParams::clear(), however this last function
did not reset the special "preview_" parameter. Now this parameter
is reset to false as part of clear().
The ParamData class documents (see InsetCommandParams.h) the
following:
// No parameter may be named "preview", because that is a required
// flag for all commands.
Thus, we must handle preview_ separately from the other parameters.
This commit fixes#11779.
First, we do not need to run bibtex/biber on the maintenance run, as
the necessary references will be generated on the includeonly run.
Second, exclude the master from DepTable in maintenance run, as the
master is re-checked in any case in the includeonly run, and as it will
always be detected as changed due to the \includeonly statement, which
will trigger a complete build.
More improvements to follow.
There is no need to change the cursor's position to the beginning of
the line.
This change does not affect the behavior of using the buttons in the
Outliner pane, but is useful for using the keyboard shortcuts.
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.