Commit Graph

157 Commits

Author SHA1 Message Date
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
a303600b54 Implement Paragraph::getLabel()
This function returns the first label (as string) if there is any
2024-07-28 15:52:19 +02:00
Juergen Spitzmueller
e08bbc89bc Fix brokenBiblio() and fixBiblio() with change tracking (#12909) 2023-09-16 08:34:43 +02:00
Juergen Spitzmueller
0b463bfe0f Add AllowedInInsets and AllowedInLayouts InsetLayout tags
This allows to restrict the use of flex insets to specific contexts.

Note that this is currently very basis. It only considers immediately
containing insets/layouts and can be surpassed via cut and paste.

The use case that made me finally implement this are macros in covington
that make sense only in specific environments (but also consider \inst
in some article classes)
2023-07-25 13:37:07 +02:00
Thibaut Cuvelier
997f0621c5 Rename LATEX debug level to OUTFILE and use it for DocBook, HTML, and XML messages. 2022-03-01 16:05:42 +01:00
Jean-Marc Lasgouttes
542445d07d When pasting text, keep line breaks when "parbreak is newline"
This is much easier for listings, ERT or Verbatim.

Fixes bug #8026.
2021-12-26 20:22:01 +01:00
Juergen Spitzmueller
633013453e Factor out Paragraph::isPartOfTextSequence
Amends 045c25cf76
2021-10-31 09:26:57 +01:00
Thibaut Cuvelier
358e4ace56 DocBook: implement prepended/appended arguments for all kinds of elements.
Previously, it was just in InsetText.
2021-02-19 17:38:38 +01:00
Enrico Forestieri
22ee249c3e Allow pasting references to mathed
A reference can be directly inserted into mathed but cannot be pasted
because the pasted material is returned in plain text format. This patch
allows getting a string from the cut stack in a suitable format allowing
the math parser to actually create an InsetRef.

Fixes #11539
2021-01-30 01:32:40 +01:00
Yuriy Skalko
196d9caeb0 Clean includes using the output of iwyu tool 2020-10-20 11:38:55 +03:00
Yuriy Skalko
2a594d3e90 Remove unused forward declarations 2020-10-13 09:57:36 +03:00
Thibaut Cuvelier
e995414917 DocBook: avoid generating fonts for "special cases" like equations. 2020-09-19 20:43:39 +02:00
Thibaut Cuvelier
654559feb8 DocBook: fix line issues around programlisting. 2020-09-19 20:43:39 +02:00
Thibaut Cuvelier
52b2d3f683 DocBook: make Paragraph::simpleDocBookOnePar return a list of paragraphs.
Before, it directly wrote to the XMLStream, but it made implementation of new lines tricky. Now, it returns the XML for each sub-paragraph (delimited by new lines) as a string, so that the caller can adopt a more precise behaviour (such as in lists).
2020-09-19 20:43:38 +02:00
Richard Kimberly Heck
219773dd55 Move META_INSET declaration to header file 2020-08-01 01:53:36 -04:00
Thibaut Cuvelier
3883b85f49 New DocBook support 2020-07-08 08:42:16 +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
a38408419c Remove obsolete comment.
We assert (or worse) if pos < 0.
2020-05-03 00:51:01 -04:00
Juergen Spitzmueller
228d738868 Account for changes in insets when checking changes in selection
This is not ideal, see FIXME.

Fixes #11774
2020-03-06 10:53:54 +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
Jean-Marc Lasgouttes
ce950f1ea5 Fixup b321bb1a: set changebar when inset contains changes
Add Paragraph::isChanged() and InetText::isCgchanged() which indicate
the presence of a change in the relevant object.

Sets Row::needsChangebar() when adding an inset that contains changes.

Related to bug #8645.
2020-01-12 20:26:35 +01:00
Juergen Spitzmueller
6964886daf Consider deleted spaces in spell checking
Addresses part of #11470
2019-12-27 13:01:35 +01:00
Juergen Spitzmueller
afb442c76c Correctly show merged paragraphs with change tracking
Fixes #3136
2019-12-26 13:47:50 +01:00
Juergen Spitzmueller
b6f0c1de3d Fix right and left layout alignment (in workarea) with RTL
Fixes: #11606
2019-07-10 14:50:08 +02:00
Juergen Spitzmueller
195f62ac93 Fix bracket output in RTL languages
This is a real mess!

Fixes: #11187
2018-07-15 14:26:29 +02:00
Scott Kostyshak
23de5e5e19 Only show Accept/Reject Change options if relevant
In the context menu for a selection, we now only show the options
"Accept Change" and "Reject Change" if there is actually a change in
the selection. Similarly, in the toolbar, the buttons are only
enabled when there is a change in the selection.

This fixes #10338.
2018-05-10 12:58:44 -04:00
Juergen Spitzmueller
768c9a552e cprotect allows to place environments in fragile contexts.
use that possibility.

Fixes parts of #5128.
2018-04-30 09:06:15 +02:00
Juergen Spitzmueller
2ba584957c Add basic support for cprotect
This allows (some) verbatim contents in macros, such as \url's with
specific chars (#, % etc.) in section headings or footnotes (#449)
or comments in captions (#9313).

The mentioned two bugs are fixed by this commit.

Note that the implementation is still rather basic and might need
extension for other cases.
2018-04-13 17:46:37 +02:00
Jean-Marc Lasgouttes
1dba36c7ce Implement buffer-anonymize more efficiently
The work is done now in Paragraph::anonymize().

Move the handling of the lfun to Buffer class.
2018-02-12 14:38:28 +01:00
Richard Heck
0bcb9732c5 Rename Paragraph::setBuffer to Paragraph::setInsetBuffers, to avoid
confusion about what this routine does.
2017-10-16 15:48:47 -04:00
Richard Heck
51aebc9327 Fix whitespace at EOL. 2017-07-03 13:46:30 -04:00
Jean-Marc Lasgouttes
000832f9d9 Use Paragraph::getAlign in TextMetrics
This avoids some duplicate code. Note that the return value of
Paragraph::getAlign had to be changed. I suspect it was set to char to
avoid reading one header file in Paragraph.h.
2017-01-24 19:33:03 +01:00
Guillaume Munch
3391fed36a Make the generation of children's tocs more robust
Let the children directly access the TocBuilders, instead of concatenating
after the fact.
2017-01-14 23:13:14 +01:00
Guillaume Munch
68109443f3 Implement AddToToc for paragraph layouts
Enables table of Theorems & Definitions
2017-01-09 18:27:25 +01:00
Jean-Marc Lasgouttes
fd50fb720f Introduce (Inset|InsetList|Paragraph)::resetBuffer
This avoids an ugly cast like
     setBuffer(*static_cast<Buffer *>(0));
that clang does not appreciate.
2016-12-05 14:48:32 +01:00
Richard Heck
31e25c8ec6 Fix problem with branch handling. The problem was that we were not
dealing properly with the paragraph separator tag.

We really need to use that tag as a kind of general marker for which
tags we're responsible for in a given paragraph and which tags we are
not. So the changes to InsetText.cpp use the tag as that kind of marker.

Note that, as of this commit, the User Guide again exports without any
kind of error. I haven't yet checked the other manuals.

This fixes bug #8022.
2016-07-09 23:58:34 -04:00
Jean-Marc Lasgouttes
ac759b4368 Rewrite setRowHeight using row information
The initial values for maxasc and maxdes (renamed from maxdesc) is obtained as a maximum of max ascents/descents of all row elements.

This allows to get rid of Paragraph::highestFontInRange and FontList::highestInRange.

Some auxilliary variables declarations are also moved to where they are needed.
2016-05-30 14:55:41 +02:00
Jean-Marc Lasgouttes
b639056981 Remove declaration of classes that do not exist
Some headers contain
  class Foo;
whereas there is no class Foo.

The list of class statements is given by
  classes=`git grep  '^\(class\|struct\) [a-zA-Z_:]*;' src | sed 's/^.* \(.*\);/\1/'|sort -u`

The ones that are useless are:
  for c in $classes ; do grep -r "\\<$c\\>" src| grep -vq '^[^:]*:\(class\|struct\) [a-zA-Z_:]*;' || echo "$c"; done
2016-05-29 17:55:45 -04:00
Guillaume Munch
6d4e6aad24 Automatically show the review toolbar if the document has tracked changes
(#8738)

For efficiency, we add a new flag to the buffer indicating when changes are
present. This flag is updated at each buffer update, and also when explicitly
requested via a dispatch result flag.
2016-05-29 17:55:42 -04:00
Guillaume Munch
e3540f33e1 Simplify class structure in TocBackend
Deriving from std::vector to provide helper functions appears a touch
excessive. Use typedef instead and move helper functions to the base class. New
header Toc.h provided to replace forward-declarations.

Remove TocIterator which is useless.
2016-05-29 17:55:42 -04:00
Georg Baum
60a648c572 Remove unused declarations 2015-11-04 21:41:00 +01:00
Guillaume Munch
bb344452c8 Consistency of ellipses across the UI
Use the function support:truncateWithEllipsis() to shorten a docstring with
... at the end. Actually we use U+2026 HORIZONTAL ELLIPSIS instead of "..." when
automatically shortening strings. This is to be consistent with Qt's own
truncation and is much nicer on the screen.

This includes the bugs #9575 and #9572 regarding broken text elision in the
outliner.

Known issues (non-regressions):

* TocBackend::updateItem() should be rewritten to update all TOCs. (#8386)

* "..." should be replaced with … everywhere else on the interface (including
  translation strings).

* We should prefer to rely on QFontMetrics::elidedText() to truncate strings
  with an ellipsis whenever possible, or an equivalent for the buffer view
  dependent on the font metrics. See the warning in src/support/lstrings.h.
2015-10-05 21:16:16 +01:00
Jean-Marc Lasgouttes
4796e6b337 Avoid breaking kerning with continuous spell checking
There is a mismatch between the way text is tokenized in Row objects
and the way it is shown on screen. When metrics are computed,
continuous spell checking has not been done yet. Yet, the row painter
explicitly breaks words at spell status boundaries. This creates
problem with a text like "PMP," (see bug #9649), where there is a
negative kerning before the comma.

This is solved by not taking in account spell status when drawing
text, and drawing spell underlines separately.

* replace Paragraph::isSameSpellRange with new method getSpellRange.

* merge RowPainter::paintChars into RowPainter::paintFromPos

* move the actual text painting code into the new paintTextAndSel.

* merge some code from paintFromPos to paintMisspelledMark

* in paintMisspelledMark, scan the string which needs to be annotated
  and add dashed line below text marked as misspelled.

Fixes bug #9649.
2015-07-15 12:13:24 +02:00
Jean-Marc
fca332bace Rename FontSpan::inside(pos) to contains(pos) 2014-07-28 20:42:01 +02:00
Jean-Marc Lasgouttes
d6337a2488 Remove obsolete code to handle Hebrew and Arabic characters
This is handled by Qt now.

Note that a small optimization (do not draw text that is to the left
of WorkArea) is removed because it cannot be guaranteed to be exact
anymore. It was probably not very useful anyway, and would become
useless once the RowPainter is rewritten to use Row information.

Update 00README_STR_METRICS_BRANCH.
2014-07-08 21:30:06 +02:00
Enrico Forestieri
c668ebf611 Fix bugs #8546 and #9055, and introduce new separator inset.
The algorithm used for breaking a paragraph in LaTeX export is changed
for avoiding spurious blank lines causing too much vertical space.
This change is tied to the introduction of a new inset (with two
different specializations) helping in either outputing LaTeX paragraph
breaks or separating environments in LyX. Both of the above goals were
previously achieved by the ---Separator--- layout and can now be
accomplished by the new inset in a more natural way. As an example,
after leaving an environment by hitting the Return key for two times,
a third return automatically inserts a parbreak inset, which is
equivalent to the old separator layout, i.e., it also introduces a
blank line in the output. If this blank line is not wanted, the
parbreak separator can be changed to a plain separator by a right
click of the mouse. Of course, an environment can still be separated
by the following one by using the Alt+P+Return shortcut (or the
corresponding menu key), but now the plain separator inset is used
instead of the old separator layout, such that no blank line occurs in
the LaTeX output.

Old documents are converted such that the LaTeX output remains unchanged.
As a result of this conversion, the old separator layout is replaced by
the new parbreak inset, which may also appear in places where the old
algorithm was introducing blank lines while the new one is not.
Note that not all blank lines were actually affecting the LaTeX output,
because a blank line is simply ignored by the TeX engine when it occurs
in the so called "vertical mode" (e.g., after an alignment environment).
The old ---Separator--- layout is now gone and old layout files using it
are also automatically converted.

Round trip conversions between old and new format should leave a document
unchanged. This means that the new behavior about paragraph breaking is
not "carried back" to the old format. Indeed, this would need introducing
special LaTeX commands in ERT that would accumulate in roundtrip
conversions, horribly cluttering the document. So, when converting a
modified document to old formats, the LaTeX output may slightly differ in
vertical spacing if the document is processed by an old version of LyX.
In other words, forward compatibility is guaranteed, but not backwards.
2014-05-10 23:25:11 +02:00
Tommaso Cucinotta
13cb7da11d Merged Paragraph::stringify into asString(). 2014-04-21 11:51:59 -04:00
Richard Heck
8b00b355ca Change forToc() to forOutliner(), to avoid confusion. The old name
is left over from when the outliner really did just display a TOC.
2014-04-21 11:51:59 -04:00
Vincent van Ravesteijn
53b60462ac Revert "Fixing #7987: deleted text in change-tracking mode is not found in Advanced F&R any more."
This reverts commit cb351665f4.
2014-03-29 22:21:40 +01:00