* The image scale param is shared by XHTML and DocBook
* It does not only apply to math
* Get rid of redundant group headers (#12902)
(cherry picked from commit 1429552063)
It turns out that Qt font selection via style name is broken on
Windows (QTBUG-101436). As we use our own style name for discriminating
our math fonts and applying proper kerning, we need a fallback method.
With this commit we check for the family name when the style name does
not match. In computing the kerning we also consider the right bearing
reported by the font instead of the width of the enclosing bounding box,
as this produces better results (see bug 13087).
Fixes#13087.
(cherry picked from commit d632753dea)
Previously, the tooltip was assigned during updateBuffer. But then
we could not determine the value for forward references.
(cherry picked from commit b494286a9c)
There are several reasons to do it this way, among which is odd
behavior of the TOC filter if we put anything else there. This also
allows for filtering of the references themsevles in a natural way.
The change, I think, was really an unintended consequence of other
changes connected to showing formatted references in the work area.
(cherry picked from commit 1de4645286)
This trivial patch makes scrolling-by-selection smoother by dividing
the step size and the time between steps by 8 when generating
synthetic events in work area.
The scrolling speed is unchanged, but the result is visually better.
(cherry picked from commit 1cc1f0ba27)
\boxed{} is the only box in LaTeX that contains math. It is amusing
that the example file that we had for ticket #13609 should not have
been a problem since there is no reason to force <mtext> there.
(cherry picked from commit 1186d90edf)
This commit addresses two issues:
1/ the embarassing one: the member SetMode::old_text_level_ was
declared as bool instead of int. This means that is was definitely
not a proper backup variable!
2/ a robustness issue: replace two consecutive test for isTest() by a
boolean veriable that is used twice. This makes sure that <mrow>
cannot be output without the corresponding </mrow>.
Part of bug #13069.
(cherry picked from commit a268fe096a)
Instead of generating code and parsing it to add <mtext>...</mtext> at
the right spots, this commit honors the text mode setting that was
already present in the codebase to generate it automatically.
This is the work of two helper methods in MathMLStream:
* beforeText() notices when the stream is in text mode and that a
<mtext> has not yet been generated. In this case it inserts it, so
that raw text can be emitted afterwards.
* beforeTag() checks whether a <mtext> needs to be closed at this
point, and does it if needed.
To make this work, the code now tracks the nesting level in the
stream, and compares it the what the level was when text mode has been
enabled using the SetMode helper function.
In order to avoid later bugs, member os() that allows to access the
underlying stream of MathMLStream is removed. This required many <<
operators to become friends of MathMLStream.
In InsetMathBox, rename splitAndWrapInMText() to mathmlizeHelper(),
which is not just a method that sets text mode inside a <mrow>
element.
In InsetMathFont and InsetMathHull, the explicit generation of nesting
in <mtext>...</mtext> can be removed now.
Fixes bug #13069.
(cherry picked from commit 216a6fb348)
This is preparatory work for fixing ticket #13069.
Remove direct accesses to the underlying stream of MathMLStream in
InsetMathChar, InsetMathSpecialChar, and in all << operators other
than MathMLStream << docstring. This will allow to add a hook later in
this operator.
Move default values of MathMLStream private members to their definition.
Get rid of line_ member, which is not used.
(cherry picked from commit fbd4b0a13f)
When using system colors it may happen (on windows 11 in particular)
that the background color is actually translucid. This is not
something we are prepared to handle and it creates ghosts on screen.
The fix is easy: the alpha channel of the colors is set to 255.
Fixes bug #13084.
(cherry picked from commit 095bb18331)
The recordUndo() call is very wrong, since we may be inserting over a
selection covering several paragraphs (undo itself works at paragraph
granularity).
recordUndoSelection() is the right operation in this case. It is
equivalent to recordUndo() when there is no selection.
(cherry picked from commit 82f387dabc)
In some cases, it might happen that this method is called with no
metrics or position known for the current paragraph.
Take care of these cases to avoid assertions.
Remove setting of inset positions in the method, but make sure that
updateMetrics(false) is always called to get everything right.
In the new code, updateMetrics(bool) is the method that sets
everything right with minimal effort.
(cherry picked from commit 89ab9eb569)
Using SinglePar does not majke sense here since the paragraph is not
modified and it might even not have a position yet.
This fixes a crash in BufferView::singleParUpdate, which is not
prepared (yet) to such situations.
(cherry picked from commit 2bdd691130)
Sometimes quick selection-scrolling could cause a crash because the
position of some paragraphs is not computed. To fix that, in
BufferView::showCursor, make sure that the metrics are always kept
clean using updateMetrics(false), which is lighweight.
As a consequence, the 'update' parameter of showCursor and
scrollDocView is not needed anymore. Its removal is mechanical and
accounts for most of this commit.
The only other significant change is that, when creating synthetic
mouse events and relying on scroll() for small moves, the full metrics
recomputation is replaced by the lighter version.
More work is still to come on this code, but this should be going in
the right direction.
(cherry picked from commit 6e0ea4269a)
The code is not ready for situations where some paragraphs that are
not visible have metrics available.
In PararagraphMetrics, some methods are added to be able to handle the
fact that paragraphs have or do not have a position.
In TextMetrics, a new method returns the first visible paragraph.
Finally, in BufferView::updateMetrics, the paragraphs' positions are
reset (in the case where everything is not cleared) and some care is
taken to skip the ones that are not relevant.
The assumption outside of this method is that all the paragraphs that
are in the TextMetrics are visible (we are talking about top-level
TextMetrics here). This could be changed (in order to avoid
recomputing paragraph metrics), but the cost is high in terms of
complexity and it is not clear that the gain in terms of performance
would be important.
NOTE: contrary to the code in master which returns npos = -10000, this
code still returns -1 when the position of a paragraph is unknown.
(cherry picked from commit 145af7c2ac)
(cherry picked from commit 05bb851adf)
(cherry picked from commit 8bc3799b35)
Using translateIfPossible with null language does not make sense (and
gives an error on console).
Using translateIfPossible there actually does not make sense at all: it
is only for string from layout files that may already be translated.
We use the GUI language when no language has been specified (this is
different and probably safer than what is done in master).
A consequence of the commit is that "elsewhere" will be in the po
files and now really translatable ;)
(cherry picked from commit 6f6d9b631d)
The regex is expensive which is especially noticeable with very long
author lists.
This introduces a case-insensitive subst() variant which is much faster.
(cherry picked from commit 8ba74fe958)
Make sure that math insets have a proper buffer. To this end, make the
Buffer* parameter of InsetMath mandatory and fix the compilation
errors that ensue.
(cherry picked from commit c013799887)
In order to ensure that MathData objects have a valid buffer, the
default MathData() constructor is deleted. This means that a buffer
shall be specified for each MathData object created.
This is fairly mechanical, actually. In particular, in most
InsetMathXxx cases, in MathData and in MathParser, the available
buffer_ member is used.
More specific cases:
- lyxfind.cpp takes the buffer from the Cursor
- calls to vector<MathData>::resize take an additional
MathData(buffer_) parameter. There are cases where resize actually
remove cells, and in this case clear() or even erase() have been
used.
- in InsetMathMacroTemplate, the optional parameters of the
constructors cannot be allowed anymore (a default value cannot
depend on another parameter). Therefore there a now two constructors
instead.
- in MathAutoCorrect.cpp, the MathData objects are not bound to a
buffer, so that std::nullptr is used instead.
- in MathExtern, use a buffer when one is specified, std::nulptr
instead.
(cherry picked from commit 57d7130655)
tabBarClicked() should really only reset focus if a click in a different
TabBarGroup happened. And no need to issue workAreaChanged() again.
This has lead to extra and erroneous focus changes (see #12954)
(cherry picked from commit 026c4bd726)
This is one of the places where a dialog is shown (indicating that
some bibtems have been renamed) while the metrics are not up to date.
Then a draw operation can be triggered too early and a crash can ensue.
Use ad-hoc solution for this case and use Buffer::setBusy(). The
Alert::warning helper cannot really do that since it doe snot know the
current buffer.
(cherry picked from commit c84c59eaec)
\cprotect'ed insets do not need forced local font switch; in fact files
with this break in compilation. E.g. a caption with an URL containing
the char '#' and caption text set to a secondary language.
(cherry picked from commit 8659924abd)