Commit Graph

1200 Commits

Author SHA1 Message Date
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
Juergen Spitzmueller
6775d7c3a2 Prevent more local colors from leaking (#6626) 2021-01-22 10:34:41 +01:00
Juergen Spitzmueller
514cd87970 Prevent branch background color from leaking out of the document
This is assured by a unique branchlist ID that is now part of the branch
color name
2021-01-21 08:09:41 +01:00
Juergen Spitzmueller
ee475b62fa Do not rely on hardcoded color when determining boxbgcolor 2021-01-20 14:15:48 +01:00
Juergen Spitzmueller
024980cf43 Do not rely on hardcoded color when determining notefontcolor 2021-01-20 13:58:24 +01:00
Juergen Spitzmueller
81c19502c1 Consider darkmode when inserting new branch 2021-01-19 13:28:21 +01:00
Juergen Spitzmueller
057753dc75 Allow semantic colors in branches and use semantic background color by default
Addresses most crucial part of #12075

File format change
2021-01-18 09:56:53 +01:00
Kornel Benko
ea5e16d075 Replace calls from make_unique to lyx::make_unique
After advice from Yuriy Skalko to satisfy compilation with clang8
2021-01-15 11:36:14 +01:00
Richard Kimberly Heck
1582a2afe1 Fix bug #12068 2021-01-14 01:15:19 -05:00
Richard Kimberly Heck
12bb380941 Fix bug #5972: Count words in citations (approximately). 2021-01-10 01:43:34 -05:00
Thibaut Cuvelier
3fdd05a7fa When previewing a document, use the right kind of comment.
This avoids generating % for HTML or DocBook: % indicates a comment in TeX, but not in XML, it's just a character. The snippet that is shown is therefore not valid.
2021-01-06 14:08:00 +01:00
Richard Kimberly Heck
fc80eba370 https
Fixes the last of #10945.
2021-01-03 23:22:31 -05:00
Yuriy Skalko
cafa1d4ae4 Fix C++20 compilation on systems where char_type is wchar_t 2020-12-30 09:42:50 +02:00
Richard Kimberly Heck
ad887798c9 Renaming 2020-12-05 20:30:45 -05:00
Richard Kimberly Heck
742348262e Fix bug #12033.
Silly mistake: Only considered the parent, not grandparents, etc.
2020-12-05 20:30:45 -05: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
9cb98136ce Cleanup headers 2020-12-03 00:38:27 +02:00
Yuriy Skalko
c0a5987181 Better naming for enums 2020-12-01 00:46:21 +02:00
Yuriy Skalko
ecf62a8f21 Refactor OutputParams
Now all Inset hierarchy uses OutputParams.h included in Inset.h.
Forward declare some enums to reduce header dependencies.
2020-11-30 13:05:03 +02:00
Yuriy Skalko
ad7c5568cd Make InsetIterator compatible with range-based loops 2020-11-29 00:25:19 +02:00
Yuriy Skalko
6a21ec854b Move several common types to support/types.h 2020-11-27 12:16:22 +02:00
Richard Kimberly Heck
fdd0a6f849 Revert "Improve structure of updateMacros"
The problem here is that the check against TEXT_CODE only
catches InsetText, and not its subclasses. Same for the check
against MATH_HULL_CODE. So there is reason not to check codes
here.

This reverts commit 5a54ccfa87.
2020-11-11 11:26:11 -05:00
Yuriy Skalko
01e673635b MacroData refactoring 2020-11-06 21:33:56 +02:00
Yuriy Skalko
5a54ccfa87 Improve structure of updateMacros 2020-11-06 21:33:41 +02:00
Richard Kimberly Heck
97ecf71016 Remove dead comment 2020-11-06 11:30:07 -05:00
Richard Kimberly Heck
060c3de2f0 StepMasterCounter --> StepParentCounter 2020-11-02 17:36:58 -05:00
Richard Kimberly Heck
39f997048e Remove 'slave' terminology from Counters.cpp.
And with it, 'master'. That is less problematic by itself (so I'm not
worried about 'master document'), but here it doesn't make a lot of
sense without 'slave'.
2020-11-02 17:09:59 -05:00
Yuriy Skalko
d38eddb397 Match header/source function argument naming 2020-11-01 22:23:44 +02:00
Yuriy Skalko
5061db891c Use const references 2020-11-01 22:23:26 +02:00
Yuriy Skalko
dbe35af542 Simplify with std::map::insert 2020-11-01 22:22:27 +02: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
Thibaut Cuvelier
d1b9af3b1d DocBook: fix file inclusion.
Previously, nothing was output. Special care was needed for when new paragraphs should be open (this work is probably not finished yet).
2020-10-20 02:34:02 +02:00
Yuriy Skalko
7d38a4d126 Loop refactoring 2020-10-09 09:04:20 +03:00
Yuriy Skalko
fe85162a29 Refactoring 2020-10-05 14:55:00 +02:00
Yuriy Skalko
715b8cda54 Refactoring based on cppcheck suggestions 2020-10-03 13:39:51 +02:00
Kornel Benko
a43d8501a2 Do not use runparams.nice == true while exporting to docbook5
The setting implies that the variable external_in_tmpdir is set to false.
If a lyx-file includes external material for spreadsheet,
the conversion results are in tmpdir.
The routine doSubstitution() (insets/ExternalSupport.cpp:188) therefore
does nothing for the entry $$Contents because it uses wrong path.
2020-10-03 13:28:26 +02:00
Thibaut Cuvelier
da67bde61a Revert "XHTML: remove DOCTYPE, as the document is then understood as HTML4/XHTML1, and not XHTML5."
This reverts commit c8e2c17a: this makes some browsers unable to understand basic HTML entities.
2020-09-20 01:35:14 +02:00
Thibaut Cuvelier
c8e2c17a58 XHTML: remove DOCTYPE, as the document is then understood as HTML4/XHTML1, and not XHTML5. 2020-09-19 20:43:41 +02:00
Thibaut Cuvelier
25f72d392c DocBook: fine tuning of new lines. 2020-09-19 20:43:37 +02:00
Yuriy Skalko
fb7b7e5223 Refactor runCommand 2020-09-11 16:13:23 +02:00
Juergen Spitzmueller
6f476b960e Localize format prettyName in some more places (#11954) 2020-08-29 11:50:43 +02:00
Stephan Witt
2dae4ab4f3 Improved character count statistics for letter based insets (e.g. the LyX logo). 2020-08-16 17:07:04 +02:00
Juergen Spitzmueller
7250aad280 Revert [9370135c3e/lyxgit] and fix #8499 properly
Fixes #11920
2020-08-04 16:52:58 +02:00
Thibaut Cuvelier
0c0613327c Get rid of xmlize, bringing no advantage over escapeString. 2020-08-01 03:20:28 +02: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
Pavel Sanda
28968b1f0d Add required elements in the layouts to support DocBook.
Slightly modified patch from Thibaut Cuvelier.
2020-07-07 09:49:48 +02:00
Thibaut Cuvelier
a6b07608d8 Rename XHTMLStream to XMLStream, move it to another file, and prepare for DocBook adoption.
xml.cpp/h also merges functionalities from sgml.cpp/h.
2020-06-15 13:01:56 +02:00
Richard Kimberly Heck
97bbcf2b9b Remove include no longer needed 2020-05-13 14:54:16 -04:00
Richard Kimberly Heck
1e904625b2 Remove functors in PreviewLoader.cpp.
Also fix some warnings.
2020-05-13 13:33:27 -04:00
Richard Kimberly Heck
7d36b9e4fa Remove method that is now unneeded. 2020-04-25 22:27:09 -04:00
Richard Kimberly Heck
e4da314522 Try to fix bug #6505.
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.
2020-04-25 22:22:58 -04:00
Richard Kimberly Heck
9319144703 Buffer methods for dealing with recursive includes. 2020-04-25 22:17:46 -04:00
Juergen Spitzmueller
f9999039ac Strip polyglossia options from pdf string
Fixes #11813
2020-04-05 15:23:22 +02:00
Richard Kimberly Heck
f044d3a359 Fix bug #11780.
The preamble snippets are for LaTeX and do not need to be output
with HTML.
2020-03-14 18:31:25 -04:00
Juergen Spitzmueller
f4af191403 Introduce maintain unincluded children "mostly"
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.
2020-03-13 15:46:35 +01:00
Juergen Spitzmueller
6c889209a7 Improve performance of includeonly with "maintain counters and references"
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.
2020-03-13 11:49:07 +01: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
81597aabdb Polish 2020-02-28 00:39:50 -05:00
Richard Kimberly Heck
0dc9fca86e Remove code that has not been used since 2010.
See 208acbc72.
2020-02-28 00:21:48 -05:00
Richard Kimberly Heck
a9d9fdc9bf Fix alignment warnings from clang. 2020-02-23 17:15:01 -05:00
Richard Kimberly Heck
34f9ea8275 Use C++11 construct. 2020-02-23 16:59:59 -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
Richard Kimberly Heck
72c581ebdb Revert "Fix memory leak reported by Scott."
It leads to a double delete error.

This reverts commit 11397a2e82.
2020-02-23 16:29:58 -05:00
Richard Kimberly Heck
11397a2e82 Fix memory leak reported by Scott. 2020-02-23 15:54:13 -05:00
Richard Kimberly Heck
d11a27a611 Fix nullptr warnings 2020-02-23 15:52:15 -05:00
Richard Kimberly Heck
608b927daf Fix "no extern declaration" warning. 2020-02-23 15:52:15 -05:00
Jean-Marc Lasgouttes
1baa8cdc93 When iterator is in a table cell, set Changed indicator for the right inset. 2020-01-13 15:08:50 +01:00
Juergen Spitzmueller
c6ef96ea36 Prevent NULL pointer 2020-01-13 13:03:52 +01:00
Juergen Spitzmueller
a450797b2a Rest in peace, dvipost! 2020-01-13 08:59:26 +01: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
Juergen Spitzmueller
a426b33067 Fix issues with tilde in inputpath
Fixes #11699
2019-11-20 11:57:32 +01:00
Juergen Spitzmueller
e75fa6f3ac Re-fix #11146 with recent LaTeX 2019-11-20 11:48:18 +01:00
Jean-Marc Lasgouttes
714113655a Follow some of the performance advice from cppcheck
Most of that is changing string to string const &.
2019-09-13 16:23:49 +02:00
Richard Kimberly Heck
fb79552ae0 Minor renaming for clarity. 2019-09-11 20:54:51 -04:00
Juergen Spitzmueller
ce447e1760 Deactivate active - in tables with \cline or \cmidrule
This introduces a new languages tag ActiveChar which also can be used
for similar cases.
2019-08-14 13:10:42 +02:00
Juergen Spitzmueller
85d5e9e747 Fix nullpointer issue 2019-07-21 13:14:20 +02:00
Jean-Marc Lasgouttes
049aed8e08 Respect OS-level keyboard language
This bug provides two features:

1/ when a new document is created the language is set to the current
  keyboard language.

2/ when keyboard is switched at OS level, the input language of
   current window is changed. The language is set preferably to one of
   those of the document. Ex. if the keyboard changes to en_GB but one
   is typing a document in US English and Hebrew, then US English will
   be selected rather that adding UK English to the list.

The implementation depends a lot on Qt. The platform status is :

* working on Windows 10

* not working with Linux (although 1/ works with Qt4); it seems that
  Qt5 supports switching through ibus, but I do not know what this
  means.

* not yet tested on macOS.

This addresses bugs #6450, #6247 and somehow #10514.
2019-07-17 23:23:13 +02:00
Günter Milde
130c744069 Drop support for XeTeX + TeX fonts + inputenc utf8.
LyX follows LaTeX in dropping support for this combination
(it only worked by tricking "inputenc.sty").
There is no known case where this combination is required or helpfull.

For power users with special needs, XeTeX + TeX fonts is still
available after setting the input encoding to "ascii" or "utf8-plain".

See also #10600.
2019-07-12 12:56:20 +02:00
Juergen Spitzmueller
c3c2815092 Implement support for font options
This revives a patch by Uwe and extends it. Additional options to font
packages/fontspec can now be entered in Document Settings.
This is principally also true for TeX fonts, if the new TeXFont tag
MoreOptions is set. For the time being, I have only done this for
MinionPro, as a model and prove of concept.

Note that adding more TeXFonts requires a file format change,
respectively, and changes to tex2lyx (in the same way as I've done for
MinionPro).

This addresses #8226
2019-07-11 20:28:34 +02:00
Juergen Spitzmueller
d876319e85 \detokenize paths containing ~ 2019-07-07 10:32:06 +02: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
Juergen Spitzmueller
18ebcab403 Properly reset lineno_opts 2019-06-03 14:33:08 +02:00
Richard Kimberly Heck
91383e1fec Forgot this part 2019-05-30 20:39:43 -04:00
Richard Kimberly Heck
2e433654c7 Fix bug #11588.
Check for the local file before calling kpsewhich.
2019-05-30 20:32:35 -04:00
Richard Kimberly Heck
c4658f046f Fix crash reported by Kornel.
See https://marc.info/?l=lyx-devel&m=155879185229073&w=2.

The problem is that, after saving the document and reloading, the
TOC is corrupted, more or less, when we run through updateBuffer.
So we reset it first.
2019-05-27 22:35:02 -04:00
Richard Kimberly Heck
714241c313 Inform user of the new name of the emergency file. 2019-05-20 21:23:40 -04:00
Juergen Spitzmueller
79feeb0c03 Micro-typographic fix 2019-05-11 12:17:09 +02:00
Günter Milde
40240ef6a0 Improve error message and ctests for input encoding cp858.
Encoding cp858 supported by only some iconv variants.
Most users will want to change their "encoding" setting instead
of installing/recompiling "iconv" to support this legacy encoding.

ctests are likely will fail with either "vanilla" or "enhanced"
iconv and test a situation that is unlikely to change generally,
so we ignore this test now by default.
2019-05-09 09:28:37 +02:00
Juergen Spitzmueller
9370135c3e reset bibitem counter in the second updateBuffer() routine as well
Fixes: #8499
2019-04-20 19:42:29 +02:00
Juergen Spitzmueller
324bfe90df Improve error message
* Take preceding line break out of the l10n range. This is bound to get
  lost in translation
* Display encoding names that people actually find in the GUI
2019-04-03 17:58:20 +02:00
Juergen Spitzmueller
4d513ca49e de.po 2019-04-03 17:57:38 +02:00
Günter Milde
6def81f30f Fix #10600: XeTeX with 8-bit TeX fonts requires input encodings "utf8" or "ascii".
* New: support also utf8 (working around false positive test in "inputenc.sty").

* Do not force the change of input encoding to "ascii".

  Deny compilation with XeTeX if a document uses TeX fonts and a non-supported input encoding.
2019-04-03 15:32:44 +02:00
Jean-Marc Lasgouttes
5e2b24c2a9 Document itemize bullets
Make the unicode value explicit as we do elsewhere.

Also change the value used for labeliv, since the current one may be
square with some fonts.
2019-04-03 12:03:24 +02:00