When including files, LyX always searches the user and the system
directory, in that order. This means that when using local layout
files broken down into multiple includes, the various includes should
be specified with a path relative to the user layouts directory
(typically ~/.lyx/layouts), making this very impractical.
This commit allows including local files by specifying their path
as explicitly relative to the main layout file position, i.e., by
specifying their path with either "./" or "../". If the main layout
is not loaded from a local file, the usual search order is used,
even if the path are explicitly relative. So, for system layouts,
both "Input ./name.inc" and "Input name.inc" are equivalent.
(cherry picked from commit 17ab47b3e6)
Because latex allows to do so, and there is no easy way to achieve this.
This was apparently implemented to allow cycling between the various dash
types, but it was a bad idea bringing no benefit and causing griefs.
The current version was wrong for non-English dialogs, and even for
the English one, due to the translator commands that were not removed
for calculation (as in "Formats[[output]]").
When using Qt stuff in breakAt, it may happen that the row is broken
after an hyphen (whereas the old code would only consider spaces).
The fact that we abuse the Row::right_boundary() property to detect when
a row should be flushed broke justification when a row is cut at an
hyphen.
Fix this by introducing a new Row::flushed() property and set it as needed.
(cherry picked from commit 8e7d0c2002)
The code that tries to decide whether it is worth splitting a given
text row element had a shortcoming: it did not take into account the
left margin of the new row that would be created.
The problem is that this left margin is not the same as the left
margin of the current row, because there can be for example
indentation effects.
To fix this problem, we pass the amount of available space on the
next row as a parameter of Row::shortenIfNeeded.
Note that there is no need to care about RtL row elements at this
point, since the bidi algorithm will be applied to the row
subsequently.
(cherry picked from commit 8491962c6b)
They are shown on screen by arrow or pilcrow symbol and cause a line break.
They are still not handled in LaTeX output, though.
(cherry picked from commit 6dfbab3124)
Whenever an argument delimiter is used inside the argument, the argument
needs to be grouped, that is
\cites({text (text) text})
or
\cite[{text [text] text}]
This fixes the original case reported in #2751 which is independent
from the general issue that the pre- and postnote field take literal
code.
When cloning InsetExternal, the tempname_ member of InsetExternalParams
has yet to be initialized. So, trying to remove it causes the warning
"QFile::remove: Empty or null file name".
(cherry picked from commit 25e6b5da39)
The QTextLayout handling is terribly slow on Qt 4.8.7, but some
caching has been added in Qt5 that makes it much faster. For some
reason, it is not that slow with Qt 4.8.1.
Caches are introduced for the three following methods
* width(doctring), controlled by CACHE_METRICS_WIDTH. This cache already
existed, but the code has been cleaned up
* getTextLayout, controlled by CACHE_METRICS_QTEXTLAYOUT (disabled by
default on Qt5, which does its own caching). This is used for pos2x
and x2pos and now for drawing of text too. The previous code used a
trivial caching scheme of the last used QTextLayout, but now they
are properly kept in a QCache. Moreover, the cacheEnabled() property
is enabled for these QTextLayout object (not sure what this does).
* breakAt, controlled by CACHE_METRICS_BREAKAT. This is the only user
of QTextLayout which did not have some kind of caching already.
For some weird reasons related to Argument-dependent look-up, the
qHash(docstring) function has to be defined in std namespace, since
lyx::docstring is actually std::basic_string<wchar_t>.
(cherry picked from c5119c97fc)
* Adjoining closing Single + double quote becomes double + single quote
(for English, Swedish and German, LaTeX export as ''').
* French double quotes are converted to << >> in the LaTeX file and to
double inverted question/interrogation marks in the output, if the font
encoding is set to [None] or OT1 but the global default is T1. (test
for lyxrc.fontenc instead of the document-specific fontenc setting in
InsetQuotes.cpp).
* Quote type ignored for LyXHTML: always "English" quotes used.
See #10451
This is a long standing issue, present since the new math macros
inception in version 1.6. It manifests as a display issue when a
macro with optional arguments appears in the optional argument of
another macro. In this case the display is messed up and it is
difficult, if not impossible, changing the arguments as they do not
appear on screen as related to a specific macro instance. It also
manifests as latex errors when compiling, even if the latex output
is formally correct, due to limitations of the xargs package used
to output the macros. Most probably, both aspects have the same
root cause, as simply enclosing in braces the macro and its
parameters solves both issues. However, when reloading a document,
lyx strips the outer braces enclosing a macro argument, thus
frustrating this possible workaround.
This commit solves the display issue by correctly accounting for
macros with optional arguments nested in the argument of another
macro, and circumvents the xargs package limitations causing errors
by enclosing in braces the macros with optional arguments appearing
in the argument of an outer macro when they are output. This means
that when loading an old document with such macros and saving it
again, the macro representation is updated and will have these
additional braces. However, as such braces are stripped by lyx on
loading, there is no risk that they accumulate.
See also this thread:
http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg197828.html
- Adds LFUNs for setting the icon size
- Adds icons sizes to the Toolbars menu
- Uses the Toolbars menu as application context menu
- The context menu can now be user defined in stdcontext.inc
When the logical sizes differ and the icon set is changed, the correct
sizes are established only after a restart.
Fixes ticket #10428.
(cherry picked from commit e91572a00b)
(cherry picked from commit 6c92075799)
(cherry picked from commit 7971dc83ef)
This is a long wanted feature, although it does not go all the way to
fix#6604 (private-cut/private-paste).
Additionally, it fixes a crash that can happen when using undefined
branches. This is done by making the action when pasting unknown
branches configurable.
Fixes bug #6570.
(cherry picked from commit fb264663d8)
(cherry picked from commit 004fdf6aeb)
An overlong word containing a hyphen could be broken anywhere, instead of after
the hyphen.
Example: compare the line breaking of
aaaaa-aaaaa-aaaaa-aaaaa
with
aaa aaaaa-aaaaa-aaaaa-aaaaa
(with a very narrow window)
This also improves Chinese text in some situations (#10299)
(cherry picked from commit 50ccbd2eab)
Showing deleted display math by enabling "Show Changes in Output" was
only possible with dvi (through dvipost). Although LyX strikes out
such formulas on screen, it was impossible obtaining an output
directly using pdflatex (or other engines producing pdf) because
ulem cannot cope with display math material and gives errors.
The solution is to strike out by ourselves such deleted formulas.
I took into account several options. One of them would produce
an output similar to dvipost (which strikes out each element), but
would have required much more changes in the output routines.
Eventually, I opted for using tikz, which gives a more clean
output (as it requires to simply adding a preamble and a postamble
to the latex code of any displayed math, instead of a mark up
tailored to each particular math construct). The look of the pdf
output is similar to the way LyX strikes out the equations on screen.
Fixes#9678
It turns out that Cursor::getFont() does not return a fully realized
font in some cases. This patch uses real_current_font instead, which
seems better anyway.
I suspect that all uses of getFont() should be removed, but this is
not code that I know well.
Fixes bug #10478.
(cherry picked from commit b099d9ae15)
This means that, when a string contains high-plane Unicode characters,
the length of a docstring and the corresponding QString will be
different: Qt will encode these characters using several 16bit
characters.
We have additionally to take into account QTBUG-25536, which implies
that sometimes qstring_to_ucs4(toqstr(s)) !=s. It is not clear whether
this bug can be a problem in other places.
Fixes bug #10443.
(cherry picked from commit 5d85a42bf0)
1. We must always output all (diverging) options, including
default options; if not, default options might get overwritten.
2. Do not output options in \setotherlanguage, since we might have
multiple "other languages" varieties from the same language (such
as naustrian, nswissgerman). And the options are output for the
language switches anyway.
Hence, LaTeXFeatures::getPolyglossiaLanguages() does not have to record
varieties. This was not done correctly anyway, since the map allowed
for one entry per language only.
The code is much simpler now and can be actually understood.
As a byproduct, fix bug #10424.
(cherry picked from commit a700d657b3)
(cherry picked from commit 2037cc5ef5)
(cherry picked from commit 4159cf97c1)
(cherry picked from commit 695b0cc33b)