Commit Graph

302 Commits

Author SHA1 Message Date
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
Jean-Marc Lasgouttes
2660df9b99 Move Lexer to support/ directory (and lyx::support namespace)
This requires quite a bit of trivial code shuffling.
2024-04-28 12:23:13 +02:00
Richard Kimberly Heck
59b08c8171 Fix bug #13017.
The problem is caused by removing temporary aux, etc, files while
we are in the process of exporting. As Jürgen suggested, we really
do not need to remove these files until we are preparing to export:
They are not used internally. So now we just schedule the removal
and do it then.
2024-01-11 17:23:52 -05:00
Alexander Dunlap
c609e9cbcf Display equation/theorem numbers in insert cross reference dialog.
Fixes bug #11466,
2023-07-26 13:35:42 -04:00
Jean-Marc Lasgouttes
35359a4c6f Improve branch activatiion LFUNs
* put the code that is called both from Buffer and InsetBrach in the
  two helper methods Buffer::branchActivationStatus() and
  Buffer::branchActivationDispatch().

* Cleanup the code so that _MASTER_ lfuns are disabled when there is
  no master document.

* When changing branches in the master buffer, make the buffer visible
  if it is not, and make sure that undo information is recorded.

* The code in Buffer::dispatch is used first, and it gives control to
  the branch inset code if no branch name has been specified.

Fixes bug #12588.
2023-07-23 18:57:38 +02:00
Jean-Marc Lasgouttes
89db357cd6 Code factoring: introduce BufferView::busy()
The WorkArea should not have to look at details of the undo stack.
No change intended.
2023-05-03 11:57:31 +02:00
Juergen Spitzmueller
e26a60edef Regenerate previews after zoom (#11919) 2022-11-20 18:18:59 +01:00
Jean-Marc Lasgouttes
6c2d4f9392 constify 2022-10-28 18:03:50 +02:00
Stephan Witt
f426470a54 Improved synctex support
- Add check for converter with active synctex support to check for synchronized output for activate forward search.
2022-08-13 14:20:03 +02:00
Daniel Ramöller
df59649a18 Properly show labels from broken references in Cross-references dialog
Fix for bug #12456.

The labels are transmitted from Buffer to GuiRef by reference of refs_
in the getLabelList function. Previously, only one string was
transmitted. But I needed both the formatted string, e.g. "x enu:test"
or "Missing: enu:test", as well as the plain label, e.g. "enu:test".
The former is for the list of labels to choose from in GuiRef and the
latter for the label as shown in the line edit that contains the plain
label in order to create a new reference from it. Transmitting both is
what the pair achieves.
2022-02-19 18:14:47 +01:00
Juergen Spitzmueller
8fa7e27e7e child documents: allow inheritance of bibliography file list (#4427) 2022-02-19 14:09:59 +01:00
Juergen Spitzmueller
e366dba9bf Factor out Buffer::requestSpellcheck() function 2021-11-25 17:04:17 +01:00
Jean-Marc Lasgouttes
c9146e5be0 Fixup f3a0e8ff: costly thinko
When the buffer stuff has been updated, the Buffer::needUpdate()
should be reset to false. This was forgotten in f3a0e8ff.

Fixes performance issues with MergedManuals, for example. UpdateBuffer
would be run again and again when selecting text.
2021-04-09 18:15:31 +02:00
Jean-Marc Lasgouttes
f3a0e8ff9a Run updateBuffer when adding/merging changes
Following 4a4ded22, the enabling of some change-related functions is
handled in updateBuffer. However, this method is not ran at every
document change for performance reasons.

This patch adds code to every place that modifies
Paragraph::Private::changes_ that checks whether the `changedness' of
the paragraph, err... changes.

To this end, a new helper struct is introduced that remembers
paragraph state at contruction time, and compares it to new state in
the destructor.

New forceUpdate/needUpdate methods are added to Buffer class, since
the cursor is in general not available in the places where these
changes are made.

Fixes bug #12074.
2021-01-28 11:30:05 +01:00
Jean-Marc Lasgouttes
c30b0aac4b Disable some Adv F&R widgets for read-only documents 2020-12-03 18:04:23 +01:00
Yuriy Skalko
a7018252b7 Constify 2020-10-25 09:28:34 +02:00
Yuriy Skalko
196d9caeb0 Clean includes using the output of iwyu tool 2020-10-20 11:38:55 +03:00
Yuriy Skalko
fa6ac23e1c Reduce includes in header files 2020-10-19 17:33:51 +03:00
Yuriy Skalko
2a594d3e90 Remove unused forward declarations 2020-10-13 09:57:36 +03:00
Richard Kimberly Heck
8ae0841826 Whitespace 2020-07-08 12:38:05 -04:00
Thibaut Cuvelier
3883b85f49 New DocBook support 2020-07-08 08:42:16 +02:00
Richard Kimberly Heck
9319144703 Buffer methods for dealing with recursive includes. 2020-04-25 22:17:46 -04:00
Juergen Spitzmueller
d94b708a0f Tell updateBuffer whether an inset is deleted.
Fixes #11747
2020-03-06 13:23:01 +01:00
Richard Kimberly Heck
cf37ad8c80 Use ranges, fix warnings 2020-02-28 01:40:30 -05: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
Jean-Marc Lasgouttes
e340f46476 Fixup bf7f4d71: Let changeRefsIfUnique handle undo
This allows for a much lower memory consumption than a plain
recordUnfoFullBuffer.

Related to bug 6494.
2020-01-12 22:18:36 +01:00
Jean-Marc Lasgouttes
4a4ded2297 Reimplement computation of change tracking status
This is a reimplementation of 6d4e6aad that is both simpler and more
complete.

This uses the updateBuffer mechanism to implement a fully working
version of Inset::isChanged(). Now the function returns true for an
inset that contains an inset that contains a change, for example.

Moverover Buffer::areChangesPresent() is merely a proxy for
Buffer::inset().isChanged().
2020-01-12 20:26:35 +01:00
Jean-Marc Lasgouttes
dba1e40b52 Revert "Automatically show the review toolbar if the document has tracked changes"
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.
2020-01-12 20:26:35 +01:00
Juergen Spitzmueller
dc4823e759 Add native changebars
Fixes #10750
2019-12-24 18:12:22 +01:00
Scott Kostyshak
79787c2274 Correct typo in method name getDescendants()
When used as an adjective, both variants "descendent" and
"descendant" are acceptable, but when used as a noun only
"descendant" should be used.

For a reference, see here:

https://en.wiktionary.org/wiki/descendent#Noun
2019-12-15 23:36:17 -05:00
Pavel Sanda
bf99ece736 Start reporting missing citations and broken references in LaTeX build.
Now we report these in the same way as LaTeX errors (but let the user to
see the result anyway). It remains to be shown much is this disturbing
to users. Generally, ignoring these is not a good idea, because they are
harder to manually spot in longer documents.

The details of reported error varies because log linebreaks at 90
induced by pdflatex make log harder to parse.
The committed code is more robust than previous, in which some missing
cits/refs with long keys would go unnoticed.

Tested on bibtex and natbib.

https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg208912.html
2019-06-07 16:47:04 +02:00
Enrico Forestieri
e763f90244 Revert [60ac25a4/lyxgit], [30f16463/lyxgit], and part of [e8f480e7/lyxgit]
As evidenced in #11552, at loading time there is no way to tell
whether braces were added by LyX with certainty. However, after
[503f7db2/lyxgit], LyX does not automatically removes brace insets.
So, in case one faces the problems mentioned in [e8f480e7/lyxgit],
the workaround of adding a brace inset now will not be frustrated.
In essence, after [503f7db2/lyxgit], the real fix for #11552 would
have been reverting the part in [e8f480e7/lyxgit] that was adding
the braces on output.
2019-04-26 12:34:29 +02:00
Enrico Forestieri
acba847649 Amend [54147a71/lyxgit]
If none of the optional arguments of a macro is used, there is no
following '[' after the macro name. Unfortunately, at loading time
the macro machinery is still not initialized, so the optionals()
member of InsetMathMacro is unusable. Hence, we have to track the
creation of macros with optionals as already we do for all macros.
The collected information is only used at loading time, because
the macros are dynamic and they may loose or acquire optional args.

Fixes the particular case reported at #11552.
2019-04-23 21:06:12 +02:00
Günter Milde
27ba6f282d Rename legacy input encoding settings.
Format incremented to 573
2019-04-16 20:17:32 +02:00
Juergen Spitzmueller
f75b081551 Add support for mixed-encoded biblatex files
Biblatex 3.12 allows to specifiy individual encodings per bib file
via \addbibresource[bibencoding=<encoding>].

This is now supported via GuiBibtex.
2019-03-29 15:45:55 +01:00
Juergen Spitzmueller
a550a613e8 Some minor amendments to [3ae6bff538/lyxgit] 2018-12-29 10:26:28 +01:00
Juergen Spitzmueller
3ae6bff538 Do not consider deleted labels in ambiguity check
This adds a new (boolean) parameter "active" to the label cache, where
we track whether a label is deleted in ct mode (the same could be done,
if wanted, for labels in notes and inactive branches).

Deleted (inactive) labels are neither considered in the uniqueness check
nor added to the outliner. This also means that undeleted references to
deleted labels are now (correctly) marked as BROKEN.

Fixes: #6563
2018-12-29 10:08:02 +01:00
Juergen Spitzmueller
4115d2487f Clear bibfile cache when set of bibliography files change
Part of #9158
2018-10-13 11:06:24 +02:00
Richard Kimberly Heck
6014492699 Try yet again try to fix bug #9158.
The problem with the previous attempt was that, every time through
updateBuffer, we looked up the file location using kpsewhich, which
took too long on Windows. The new solution is to cache that info, and
to look it up only when we need it.

Previously, this info would have been re-read whenever we parsed the
bibfiles. So we re-read it now whenever the bibinfo cache is invalid,
which is less often, but should be good enough. We can add more such
re-reads if need be.
2018-09-02 11:50:03 -04:00
Richard Kimberly Heck
a3e87dad80 Revert "Try yet again try to fix bug #9158."
(Unintentionally committed.)

This reverts commit 7b29d4e7aa.
2018-09-02 00:09:19 -04:00
Richard Kimberly Heck
7b29d4e7aa Try yet again try to fix bug #9158.
The problem with the previous attempt was that, every time through
updateBuffer, we looked up the file location using kpsewhich, which
took too long on Windows. The new solution is to cache that info, and
to look it up only when we need it.

Previously, this info would have been re-read whenever we parsed the
bibfiles. So we re-read it now whenever the bibinfo cache is invalid,
which is less often, but should be good enough. We can add more such
re-reads if need be.
2018-09-01 23:13:00 -04:00
Juergen Spitzmueller
e6e3777363 Add support for bib files encoding
File format change.

Fixes: #6223
2018-07-07 15:25:35 +02:00
Juergen Spitzmueller
e077255aea Do not start from a non-reveant parent in Buffer cloning. 2018-05-16 08:35:21 +02:00
Richard Heck
83fded8fea Fix some problems with background cancellation.
The problem was that, if we killed export when some graphic was
being converted, or some external template was being handled, it
would only cancel that process, and then it would just continue.
To deal with that, we need to do a few things:
1. Modify the return values for some of the Converters routines,
   and similarly the routines for external templates,  so we can
   tell when something has been canceled.
2. Throw an exception from InsetGraphics or InsetExternal when this
   has happened during export, but ONLY when the Buffer is a clone.
   We shouldn't be able to 'cancel' export when we're, say, generating
   code for the preview pane, but this keeps us on the safe side..
The exception then has to be caught, obviously, back in the export
routines in Buffer.

Probably Coverity will be unhappy about something here, but I'll
deal with that problem as it arises.
2018-04-16 14:02:20 -04:00
Juergen Spitzmueller
1c623ffe8f Use separate BibInfo for child
This is used when the file is compiled standalone

Fixes: #11083
2018-03-22 15:52:23 +01:00
Richard Heck
d3ee87eea2 Fix bug #11055.
See also https://marc.info/?l=lyx-devel&m=151709211602688&w=2.
2018-01-28 23:37:20 -05:00
Richard Heck
8b9d1b8601 Attempt to fix bug 9158 using updateBuffer.
Along the lines suggested by JMarc, we now collect the list of bibfiles
in use in the updateBuffer routines. This actually does simplify the code
quite a bit. See the discussion there for reasons to go this way.
2017-11-07 11:36:41 -05:00
Juergen Spitzmueller
88a0666d6c Do not scan BibTeX files multiple times in a collectBibKeys() procedure.
Scanning is rather slow, so this improves performance in specific
situations (multiple inclusion of larger files in master/child or
chapterbib context)
2017-10-18 09:20:31 +02:00
Richard Heck
66e1819ad1 Fix the way that the Buffer gets set on undo.
Previously, we went through the entire Buffer and set it for every
single inset. Now we just do it for the insets we pasted.
2017-10-16 15:48:47 -04:00