Commit Graph

295 Commits

Author SHA1 Message Date
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
Christian Ridderström
e30f3d76d2 Bulk cleanup/fix incorrect annotation at the end of namespaces.
This commit does a bulk fix of incorrect annotations (comments) at the
end of namespaces.

The commit was generated by initially running clang-format, and then
from the diff of the result extracting the hunks corresponding to
fixes of namespace comments. The changes being applied and all the
results have been manually reviewed. The source code successfully
builds on macOS.

Further details on the steps below, in case they're of interest to
someone else in the future.

1. Checkout a fresh and up to date version of src/

    git pull && git checkout -- src && git status src

2. Ensure there's a suitable .clang-format in place, i.e. with options
   to fix the comment at the end of namespaces, including:

    FixNamespaceComments:                           true
    SpacesBeforeTrailingComments:                   1

and that clang-format is >= 5.0.0, by doing e.g.:

    clang-format -dump-config | grep Comments:
    clang-format --version

3. Apply clang-format to the source:

    clang-format -i $(find src -name "*.cpp" -or -name "*.h")

4. Create and filter out hunks related to fixing the namespace

    git diff -U0 src > tmp.patch
    grepdiff '^} // namespace' --output-matching=hunk tmp.patch  > fix_namespace.patch

5. Filter out hunks corresponding to simple fixes into to a separate patch:

    pcregrep -M -e '^diff[^\n]+\nindex[^\n]+\n--- [^\n]+\n\+\+\+ [^\n]+\n'  \
        -e '^@@ -[0-9]+ \+[0-9]+ @@[^\n]*\n-\}[^\n]*\n\+\}[^\n]*\n'         \
        fix_namespace.patch > fix_namespace_simple.patch

6. Manually review the simple patch and then apply it, after first
   restoring the source.

    git checkout -- src
    patch -p1 < fix_namespace_simple.path

7. Manually review the (simple) changes and then stage the changes

    git diff src
    git add src

8. Again apply clang-format and filter out hunks related to any
   remaining fixes to the namespace, this time filter with more
   context. There will be fewer hunks as all the simple cases have
   already been handled:

    clang-format -i $(find src -name "*.cpp" -or -name "*.h")
    git diff src > tmp.patch
    grepdiff '^} // namespace' --output-matching=hunk tmp.patch  > fix_namespace2.patch

9. Manually review/edit the resulting patch file to remove hunks for files
   which need to be dealt with manually, noting the file names and
   line numbers. Then restore files to as before applying clang-format
   and apply the patch:

    git checkout src
    patch -p1 < fix_namespace2.patch

10. Manually fix the files noted in the previous step. Stage files,
    review changes and commit.
2017-07-23 13:11:54 +02:00
Guillaume Munch
0cb85e9206 Disable edition when external modifications are detected
Introduce a distinction between being read-only and having the read-only flag. A
buffer is read-only if either it has been externally modified or if it has the
read-only flag.
2017-03-11 00:50:57 +01:00
Guillaume Munch
656bc46892 Clean-up 2017-03-11 00:50:57 +01:00
Guillaume Munch
cf3c035266 Implement real-time detection of external modifications 2017-03-11 00:50:57 +01:00
Juergen Spitzmueller
8319b3e9d6 Biblatex support
File format change
2017-01-08 09:39:46 +01:00
Juergen Spitzmueller
867cdb0662 Extend the Bibfiles cache
For biblatex, we need the file name as it was entered in the inset
(abs path, rel path, only file name) in order to resolve it properly
for the export (as in the BibTeX inset intself).

Therefore, we now store a pair<docstring, FileName>.

A FileNamePairList has been added to FileNameList for this purpose.
2017-01-02 13:00:14 +01:00
Tommaso Cucinotta
244de5d2c1 Add 'needauth' option to converters that need explicit user authorization.
Addressing #10481.

This patch adds the new 'needauth' option for converters launching
external programs that are capable of running arbitrary code on behalf
of the user. These converters won't be run unless the user gives explicit
authorization, which is asked on-demand when the converter is about to
be run (question is not asked if the file is cached and calling the
converter is not needed).

The user prompt has a 3rd button so that he/she's not prompted again
for (any converter over) the same document (identified through
buffer->absFileName()).

Two preference options are added:

lyxrc.use_converter_needauth_forbidden disables any converter with
the 'needauth' option, which is meant to force user to an explicit
action via the preferences pane, before being able to use advanced
converters that can potentially bring security threats;

lyxrc.use_converter_needauth enables prompting the user for 'needauth'
converters, or bypasses the check if not enabled, falling back to the
previous behavior.

So, the first option is for maximum security, the second is for
maximum usability.
2016-11-22 23:54:58 +01:00