Commit Graph

206 Commits

Author SHA1 Message Date
Enrico Forestieri
a9dd6ea6bc Avoid useless warning from Qt
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)
2017-01-08 18:48:55 -05:00
Richard Heck
3a1eff90b9 Escape link name for DocBook.
Thanks to Martin Brown for pointing out the bug, and the obvious
solution.

(cherry picked from commit 06e2669b35)
2017-01-08 13:51:18 -05:00
Jean-Marc Lasgouttes
d76309913f Add caching for the QTextLayout objects we use
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)
2017-01-06 22:47:32 +01:00
Juergen Spitzmueller
54fa0d51da Fix two hyperlink-insert problems
1. Do not prematurely cut selection (#10306); patch proposed by Daniel Ramöller
2. Obey lfun argument, even if there is a selection
2016-12-29 19:30:36 +01:00
Jean-Marc Lasgouttes
5962cea9d2 Fixup c49cd699: QString::toStdString is not always available
This method requires STL support in Qt. Fortunately, it is not needed
here.
2016-12-29 08:43:31 +01:00
Juergen Spitzmueller
6c4c164531 Fix some quote inset bugs:
* 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
2016-12-07 18:51:03 +01:00
Richard Heck
39e3fabffb Verbatim, etc, can be used with IOP articles.
Fixes #10505.

(cherry picked from commit 91f980cf31)
2016-12-06 17:56:46 -05:00
Enrico Forestieri
9435dd6b52 Fix display and output of math macros with optional arguments
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
2016-12-04 22:52:22 +01:00
Uwe Stöhr
e5954386d2 Arabic Tutorial.lyx: new translation by Hatim 2016-12-02 02:15:55 +01:00
Daniel Ramöller
060a9664f7 Add the icon-size to the toolbar menu
- 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)
2016-11-25 10:33:21 +01:00
Jean-Marc Lasgouttes
133c2c62ee Make insertInset use a temporary cut-and-paste area.
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)
2016-11-23 12:26:05 +01:00
Uwe Stöhr
1fbe23a028 encodings: use correct encoding "latin7" for ISO 8859-13
- fixes bug #10474
2016-11-08 00:49:01 +01:00
Uwe Stöhr
fdfcb947c7 FeynmanDiagrams.lyx: fix compilation
recent KOMA script versions don't accept \rm anymore
2016-11-07 23:45:44 +01:00
Guillaume Munch
bac0780b27 Always prefer breaking at word boundaries
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)
2016-11-07 23:28:07 +01:00
Enrico Forestieri
8a1f936ff1 Strike out (in the output) deleted display math with track-changes
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
2016-11-05 21:31:09 +01:00
Jean-Marc Lasgouttes
b9edbfee40 Clear background behind sub-labels when necessary.
This is analogous to what has been done to address #4889 and #10359.

Fixes bug #10475.
(cherry picked from commit d207e85cfd)
2016-11-04 18:01:49 +01:00
Jean-Marc Lasgouttes
a0b8ea2eee Fix height of cursor inside insets
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)
2016-11-04 17:58:32 +01:00
Jean-Marc Lasgouttes
ea3cdb1552 QString only uses UTF-16, not UCS-4
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)
2016-11-04 17:56:02 +01:00
Daniel Ramöller
3372c0cf55 In Color Preferences "frame of button" should be "button frame"
Fixes #10135.
(cherry picked from commit f054721410)
2016-11-03 16:44:48 +01:00
Juergen Spitzmueller
008c229041 Fix usage of multiple varieties of the same polyglossia language.
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.
2016-11-02 18:04:26 +01:00
Jean-Marc Lasgouttes
065cd36922 Reimplement RowPainter::paintSelection() using row elements
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)
2016-11-02 11:10:05 +01:00
Uwe Stöhr
22d30bf86e ar.po: translations by Hatim 2016-11-01 15:07:50 +01:00
Tommaso Cucinotta
f1b8635789 status update for commit 33103ebc 2016-11-01 09:57:43 +01:00
Juergen Spitzmueller
20e667e208 Use Buffer::validate() when previewing single paragraph
We used to use BufferParams::validate(), which does not validate the
paragraphs.
2016-11-01 08:29:28 +01:00
Juergen Spitzmueller
d190ae7787 Issue an error message if conflicting languages are used
Some languages are only supported by Babel, some only by Polyglossia.

If these are combined, we issue an error message now.

Fixes: #10456
2016-10-31 10:26:35 +01:00
Juergen Spitzmueller
9e2d101d5c Handle | verbatim in index insets. 2016-10-31 10:22:43 +01:00
Enrico Forestieri
0dd7505ec6 Sort the language nesting mess with polyglossia
When using polyglossia, lyx was making a real mess when changing
language inside nested insets. The \begin{language} and
\end{language} commands were not well paired such that they could
easily occur just before and after the start or end of an
environment. Of course this was causing latex errors such that
"\begin{otherlanguage} ended by \end{environment}".

Fixes #9633
2016-10-30 00:16:50 +02:00
Enrico Forestieri
3508c7bc8a Quote filenames used for forward-search with SumatraPDF
Single quotes are special to our parser and must be either escaped or
quoted if they are part of a filename, otherwise they are stripped out.

Fixes #10342.
2016-10-27 04:16:04 +02:00
Enrico Forestieri
f8d3a8860b In mathed, require xcolor instead of color when appropriate
Fixes bug #10417.
2016-10-27 03:18:29 +02:00
Guillaume Munch
14745174ec status.22x 2016-10-26 18:38:24 +02:00
Jean-Marc Lasgouttes
ca2379d98a Forgot this. 2016-10-26 16:20:02 +02:00
Jean-Marc Lasgouttes
10b8421ed6 Remove unused methods in anononymous namespace
These have been flagged by gcc 6.
(cherry picked from commit 4065f596ad)
2016-10-26 15:15:54 +02:00
Jean-Marc Lasgouttes
d03a07b93a Fix compiler warning from clang 3.9
(cherry picked from commit fbba865d28)
2016-10-26 15:14:38 +02:00
Jean-Marc Lasgouttes
1d4d07b66e When selecting special logos, set their color correctly
Adapted from 860accd01f.
2016-10-26 11:19:49 +02:00
Jean-Marc Lasgouttes
3f8289e7b5 Forgot this. 2016-10-26 10:58:52 +02:00
Uwe Stöhr
cc214a0e16 Arabic Shortcuts.lyx: new translation by Hatim 2016-10-25 23:35:14 +02:00
Enrico Forestieri
4ad8be330e Show on screen font changes for text-in-math 2016-10-25 20:24:26 +02:00
Günter Milde
ded70f24f6 Fix #10394 Do not error on missing characters in "nullfont".
Add an exception to the conversion of "missing character" warnings into errors.

The PGF package deliberately uses the dummy font "nullfont" to suppress output.
Therefore, warnings about missing characters in "nullfont" are really only warnings.

Also updated the comment: "Missing character" warnigns are especially widespread
in XeTeX/LuaTeX but can also happen with "classical" 8-bit TeX.

Feel free to port this to branch.
2016-10-23 17:16:26 +02:00
Juergen Spitzmueller
2dfc12b254 Improve bibliography info (general)
Consider all thesis types.
2016-10-23 08:15:04 +02:00
Guillaume Munch
190e88e148 status.22x 2016-10-22 20:07:42 +02:00
Guillaume Munch
fe960404fc amend b1ffe77535 2016-10-22 20:07:42 +02:00
Guillaume Munch
8d335f813f status.22x 2016-10-22 20:07:42 +02:00
Richard Heck
60bef140b5 Whitespace
(was: "Status and configure for 2.2.3." form 2.2.3-staging

It became empty after rebasing 2.2.3-staging onto 2.2.3.)
2016-10-22 20:06:35 +02:00
Juergen Spitzmueller
37d30288af Fix LaTeX output of fixed-width cells with decimal separator
This follows Uwe's suggestions (and discharges my own).

The result is not ideal, but there is currently no ideal solution.

Fixes: #9568
2016-10-22 19:27:53 +02:00
Juergen Spitzmueller
0be77e2eb2 Implement wrapping in next-change (#10388). 2016-10-22 19:25:07 +02:00
Juergen Spitzmueller
5c4fa40849 Move wrap check for simple search/replace to lyxfind
This gets rid of some dirty dispatch tricks and fixes wrap-around
on replace and in the spellchecker

Fixes: #10378
2016-10-22 19:20:26 +02:00
Jean-Marc Lasgouttes
447254eb59 Update boost to version 1.62. 2016-10-22 16:28:52 +02:00
Juergen Spitzmueller
f23924e824 Refs dialog redesign. 2016-10-21 22:05:54 +02:00
Juergen Spitzmueller
54248a6e98 Citation dialog redesign 2016-10-21 22:03:19 +02:00
Juergen Spitzmueller
98eeaceb5e Fix label display in linguistic examples 2016-10-21 19:20:23 +02:00