Commit Graph

46669 Commits

Author SHA1 Message Date
Juergen Spitzmueller
9464f0526e Fixup LFUN_REFERENCE_TO_PARAGRAPH for captions in other buffers
The movement to the caption is now done in the LFUN function itself,
as we need the DocIterator in the caption

This greatly simplifies the code in the TocWidget and shifts all the
complexity to the LFUN itself
2024-07-30 12:36:20 +02:00
Juergen Spitzmueller
4ed822925f fixup REFERENCE_TO_PARAGRAPH:
* par id actually can be 0
* properly move on in the buffer list if paragraph is not found
  in the current buffer
* use dit to get label (as this might be in a different buffer)
2024-07-30 09:49:34 +02:00
Juergen Spitzmueller
2c4536c709 typo 2024-07-29 09:11:42 +02:00
Juergen Spitzmueller
7d46ddaa95 rename Paragraph::getLabel()
getLabel() usually refers to a paragraph label (e.g. \item) in this
context, not \label as in the case here.
2024-07-29 09:08:13 +02:00
Juergen Spitzmueller
2fdeee4bf7 fixup definition of LFUN_REFERENCE_TO_PARAGRAPH 2024-07-29 08:46:43 +02:00
Juergen Spitzmueller
143e534d1e Implement reference-to-paragraph in outliner (#1624)
This allows to insert a cross-reference to headings, figures or tables
by right-clicking on the outliner item.

If the item in question does not have a label yet, it is inserted.
2024-07-28 15:59:06 +02:00
Juergen Spitzmueller
3fe99bf6f5 Implement LFUN_REFERENCE_TO_PARAGRAPH
This function checks whether a paragraph (specified by ID) has a label.
If so, it simply inserts a reference to this at cursor position, if
not it inserts a label to that paragraph (pos 0) and then inserts
a reference at cursor position.

Needed to implement #1624 (insert cross references to items that do not
have yet a label)
2024-07-28 15:54:55 +02:00
Juergen Spitzmueller
e3b36208ed Allow DocIterator::paragraphGotoArgument() to return id() without pos()
We need this for the forthcoming reference-to-paragraph function
2024-07-28 15:53:05 +02:00
Juergen Spitzmueller
a303600b54 Implement Paragraph::getLabel()
This function returns the first label (as string) if there is any
2024-07-28 15:52:19 +02:00
José Matos
52295693d6 Clean python code (lyx2lyx)
Please linter where it makes sense:

* Avoid bare exceptions;
* Use formatted strings instead of string interpolation
2024-07-28 09:56:29 +01:00
Juergen Spitzmueller
181c8ce7c1 re-implement LFUN_REFERENCE_INSERT
this is in preparation of another feature
2024-07-28 10:37:30 +02:00
Juergen Spitzmueller
5c3b788999 amend d4f58c96b5
avoid having to validate the whole buffer just for this information
2024-07-27 13:34:38 +02:00
Juergen Spitzmueller
ca4fc01847 Load geometry after graphics
Newer graphics driver overwrite some (output) page settings otherwise
See https://tex.stackexchange.com/a/384952/19291

Re-fixes #10970
2024-07-27 12:46:12 +02:00
Juergen Spitzmueller
b6d3066ad2 GuiLog: show also log files of additional indices 2024-07-26 18:48:31 +02:00
Juergen Spitzmueller
d4f58c96b5 Add support for multiple indexes in Memoir
As with almost everything, this class bakes its own cake also with
multiple indexes. So we need to account for this to produce
compilable output.

Not very nice, but there you go!
2024-07-26 12:48:12 +02:00
Jean-Marc Lasgouttes
fe1a3b57df Fixup 999fb37e: always run updateMacros when in batch mode
The optimization is useful in GUI mode only, and it turns out that it
creates weird crashes otherwise.

Thanks to Juergen Spitzmuller for the idea.
2024-07-25 18:37:50 +02:00
Juergen Spitzmueller
003bbd3483 Avoid loop in math parsing function 2024-07-25 09:18:01 +02:00
Jean-Marc Lasgouttes
0d50a8417f Do not update statisitics if buffer has not changed
Rely on the newly-introduced Buffer::id() to skip statistics
computation if the id is the same as last time. This will reduce the
annoyance of updates triggering at random times.

Take this occasion to clean code up:

- add 'skip' parameter (true by default) to Statistics::update to indicate
  that the insets that do not produce output should be skipped.

- use a trailing underscrore for private members
2024-07-24 22:38:39 +02:00
Juergen Spitzmueller
823d290036 amend 9291fc465b
XHTML wants LaTeX math, nothing converted to unicode
2024-07-24 21:44:02 +02:00
Jean-Marc Lasgouttes
a042d6a9d2 fix warning 2024-07-24 21:10:22 +02:00
Pavel Sanda
307d59cdb9 Squash gcc warning. 2024-07-24 19:55:05 +02:00
Jean-Marc Lasgouttes
393f65c737 Fixup 6e81f317: cut and paste error 2024-07-24 18:51:35 +02:00
Jean-Marc Lasgouttes
999fb37ebb Do not run updateMacros if the buffer has not changed
Each buffer now has an id which is increased when it is marked dirty
(or when one of its relatives is marked dirty).

This can be a big win since updateMacros is very expensive.
2024-07-24 18:29:43 +02:00
Jean-Marc Lasgouttes
6e81f31722 Rewrite statistics code
The statistics code is known to be very slow, because it relies on
DocIterator to go through the buffer.

This commit introduces a new Statistics class that encapsulates the
main code, along a virtual method Inset::updateStatistics() that
allows to fine-tune how counting is done inset by inset.

This is a faithful bug-for-bug reimplementation.

The new code appears to be 3x faster than the old one.

See bug #12929 for a discussion about statistics update woes.
2024-07-24 18:07:04 +02:00
Scott Kostyshak
8c3d378217 Amend previous commit (4b33e603)
Jürgen confirmed that the layout change to the last file is indeed
expected [1].

[1] https://www.mail-archive.com/search?l=mid&q=e00fb2e29dfd77b992761aaa1f822fc979059728.camel%40lyx.org
2024-07-24 11:00:51 -04:00
Scott Kostyshak
4b33e60346 Update layouts
I do not commit the update to the following file since it has a
non-trivial change:

  lib/layouts/jlreq-common.inc

I'll ask for confirmation on the list before updating that file.
2024-07-24 10:19:31 -04:00
Jean-Marc Lasgouttes
1186d90edf Do not export the content of InsetMathBoxed as text in MathML
\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.
2024-07-23 23:44:58 +02:00
Jean-Marc Lasgouttes
1385f0fddd Fixup 216a6fb348: close <mtext> when quitting text mode
This fixes malformed documents on UserGuide export.

Related to bug #13069.
2024-07-23 22:02:50 +02:00
Jean-Marc Lasgouttes
a268fe096a Fixup 216a6fb3: fix broken xml syntax
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.
2024-07-23 19:52:12 +02:00
Richard Kimberly Heck
fb919e653d Typo 2024-07-22 16:21:37 -04:00
Jean-Marc Lasgouttes
1cc1f0ba27 Make scrolling-by-selection smoother
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.
2024-07-22 22:02:04 +02:00
Jean-Marc Lasgouttes
216a6fb348 Fix crash when generating MathML with InsetMathBox
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.
2024-07-22 20:53:29 +02:00
Jean-Marc Lasgouttes
fbd4b0a13f Cleanup MathMLStream
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.
2024-07-22 20:53:29 +02:00
Jean-Marc Lasgouttes
d7ba7bceb3 Revert "Fix bug #13069."
This reverts commit fafe3ea5d7.
2024-07-22 20:53:29 +02:00
Jean-Marc Lasgouttes
cd4d54f76a Revert "Cmake build: Add Qt?Xml modules to build."
This reverts commit 0116048697.
2024-07-22 20:53:29 +02:00
Jean-Marc Lasgouttes
095bb18331 Remove alpha component of system colors
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.
2024-07-22 20:36:20 +02:00
jpc
8664e2fa4d Update fr.po 2024-07-22 17:40:48 +02:00
Kornel Benko
d655213bcf Update sk.po 2024-07-22 13:59:27 +02:00
Juergen Spitzmueller
9f31d562bf UserGuide: fix two nomencl entries 2024-07-22 10:42:54 +02:00
Juergen Spitzmueller
5bc4c11fd6 tex2lyx: Fix two bugs in nomencl import
* The comment character % is made active to serve as an escape char
* quotation marks need to be escaped
2024-07-22 09:51:54 +02:00
Jean-Marc Lasgouttes
23379bb1d5 Store spellchecker_esc_chars as a docstring
This is a minor optimization to avoid calling from_utf8() repeatedly
on a hot path.
2024-07-21 21:35:14 +02:00
Juergen Spitzmueller
2f7d759108 de.po 2024-07-21 18:10:33 +02:00
Juergen Spitzmueller
f1ba6559f2 update tex2lyx tests 2024-07-21 18:06:58 +02:00
Juergen Spitzmueller
ae1e1cb069 Add possibility to manually specify longest label in nomenclature
File format change
2024-07-21 17:59:34 +02:00
Juergen Spitzmueller
eb1ac06a9a Consider masked modifiers (~S etc.) when writing to bind file
Fixes #12973
2024-07-21 10:18:58 +02:00
Jean-Marc Lasgouttes
3040eb0fa2 Use background to make math comments more visible 2024-07-20 23:37:24 +02:00
Juergen Spitzmueller
c4001c7022 update comment 2024-07-20 17:47:47 +02:00
Juergen Spitzmueller
d62f1723a5 Improve calculation of longest nomencl string
This tries o convert LaTeX macros before estimating the length
2024-07-20 17:39:58 +02:00
Juergen Spitzmueller
9291fc465b mode convertLaTeXCommands from BiblioInfo to Encodings
So it can also be used in other contexts.

This includes also an improvement of math parsing
2024-07-20 17:39:58 +02:00
Jean-Marc Lasgouttes
485f5afc21 Fixup 2bdd691130: remove two more Update::SinglePar instances
They do not do what the author(s) of these lines thought it would do,
and can create crashes.
2024-07-20 17:13:40 +02:00