Commit Graph

24099 Commits

Author SHA1 Message Date
Jean-Marc Lasgouttes
004fdf6aeb Clear temp cutstack before exiting LyX.
Otherwise it is done in the exit handler, which leads to crashes.
2016-11-21 17:03:50 +01:00
Guillaume Munch
34b6b474ea Amend b30f8d3c
Fix assertion. Thanks Scott for the bisect and the trace.
2016-11-21 12:09:48 +01:00
Guillaume Munch
cf45810e43 Fix display of nicefrac solidus 2016-11-21 00:08:12 +01:00
Guillaume Munch
fdd09d6f51 Let math mu skips scale with zoom 2016-11-21 00:08:12 +01:00
Guillaume Munch
a42c315e79 Amend ad7e2435cf
InsetMathKern is also used for non-mu lengths.

Generalise the fix by moving to Length::inPixels (thanks Jaan-Marc).
2016-11-21 00:08:11 +01:00
Guillaume Munch
eacac8bea2 mathedSymbolDim only needs a MathBase 2016-11-21 00:08:11 +01:00
Guillaume Munch
71ce34e821 Improve fractions bar
* The bar grows with the zoom according to MetricsBase::solidLineThickness()

* The spacing around the bar grows with the font size.
2016-11-21 00:08:11 +01:00
Guillaume Munch
ad0a0e3b3c Fix vertical alignment of fractions
Fractions and binoms are vartically aligned with -

Nicefracs are ascent-aligned with the surrounding text
2016-11-21 00:08:11 +01:00
Guillaume Munch
e449e70e38 Simplify Changers interface
In fact having an extra parameter "bool cond" is no longer useful because it can
now always be emulated with a ternary operator:
	Changers dummy = cond ? do_change() : Changer();
2016-11-21 00:08:11 +01:00
Guillaume Munch
ffb865d6e8 Clean up and fixes to fractions metrics and drawing
* Factor code for easier maintainance.

* Avoid computing metrics several times. This duplication explained the
  exponential blowup during the metrics phase for nested fractions (see
  b2b87330). This happened in particular when using lyxproofs which heavily uses
  nested \dfracs for on-screen drawing.

* Call MetricsBase::changeScript instead of MetricsBase::changeFrac for
  \nicefrac and \unitfrac.
2016-11-21 00:08:11 +01:00
Guillaume Munch
a9eb87a89d Correct computation of math font size
Move math style to FontInfo and compute the font sizes for scriptstyle and
scriptscriptstyle according to standard proportions: 0.73 and 0.55.

This is simpler and more accurate. It also fixes the font size of
${\scriptscriptstyle {\textstyle A}}A$ which exposed the limitations of the
previous approach.
2016-11-21 00:02:35 +01:00
Jean-Marc Lasgouttes
9a9a6a8c8f Skip drawing of markers in non-editable math data
There is no reason to reserve pixel space in macros replacement text,
which is not editable. This makes macros more compact and eases the
writing of lib/symbols.

* introduce new InsetMath::drawMarkers and friends that do nothing
  when nested inside a macro. This required to move macro_nesting
  inside MetricsBase, and to pass MetricsInfo & to metricsMarkers.

* keep track of nesting when drawing rows or macros.
2016-11-17 08:48:32 +01:00
Jean-Marc Lasgouttes
f3f9b083d1 Only display a blue rectangle for editable empty insets
Empty insets should use a minimal amount of space, especially when
they are part of a built-in macro in lib/symbols.

With this change, blue rectangles signal actually editable places.
Empty macros in editable data are shown as grey boxes, but they do not
appear when further nested.

This is done by adding a new type BOX of MathRow::Element object and a
MetricsInfo::macro_nesting that keeps track of macros (and is reset to
0 in editable macro arguments).
2016-11-16 18:33:02 +01:00
Jean-Marc Lasgouttes
0b5c2a8507 Add support for \mathbin and friends
All they do is change the class of the elements that they contain.
2016-11-16 15:21:53 +01:00
Jean-Marc Lasgouttes
bf56e2c8e1 Set correctly the spacing between atoms in MathData
* new MathRow class which contains the description of a MathData
  object in terms of math class and spacing

  + macros and their arguments used in the MathData object are
    linearized (replaced with their contents) so that all math insets
    are typeset as a string together. To this end, we introduce a
    method addToMathRow to InsetMath and MathData. This method allows
    to linearize recursively a MathData object.

  + It is then necessary to set manually the dimension and position of
    the macros and arguments.

  + the class class and spacing are computed using the MathClass helpers.

  The MathRow data is cached in the MathData object in a bufferview-dependent
  way (different dpi for different screens).

* delegate most of the work MathData::metrics/draw to MathRow metrics/draw.

  The case of draw is trickier, since many draw() methods rely on their
  metrics without any spacing added.
2016-11-16 15:21:52 +01:00
Jean-Marc Lasgouttes
f6df4e7985 Implement computation of spacing according to the TeXBook
This implements the relevant math typography rules described in the
Appendix G of the TeXbook. More precisely, for each atom

  + the class is computed by implementing rules 5 and 6 of Appendix G

  + the spacing is computed according to the table p. 170

This code is not used at this point.
2016-11-16 15:21:52 +01:00
Jean-Marc Lasgouttes
361bd53bc3 Introduce the notion of math class
This done according to the TeXbook. This class replaces the individual
isMathXXX() methods. The mathClass() method (currently unused) is
provided for the following insets:

 * InsetMathChar (with a revised list of affected characters)
 * InsetMathSymbol: the class is given by the `extra' field
   Operators defined in lib/symbols (e.g. \log) are MC_OP
 * InsetMathFrac is MC_INNER (except nicefrac and units)
 * InsetDelimiters is MC_INNER
 * InsetStackrel is MC_REL
 * The class of InsetScript is the class of the last element of its
   nucleus (yes, it is a hack, but doing it right is more work).

Remove the explicit spacing that was done in the different insets. The spacing
will be reintroduced properly in a forthcoming commit.
2016-11-16 15:21:52 +01:00
Guillaume Munch
be836909c5 Display properly math characters that behave like symbols
* set up a replacement of *, -, and : by the adequate symbols (#9893)

* fix the wrong character selection and operator spacing in \text mode

* hide some internal symbols from the auto-completion.
2016-11-13 20:06:35 +01:00
Guillaume Munch
ad7e2435cf Fix display of some math symbols
* Fix spacing in lib/symbols after recent commits about math spacing, as well as
  older spacing issues (e.g. \Join).

* InsetMathKern now uses the same em value as other math length commands.

What is nice is that the kerning amount now matches the ones found in the
packages definition (modulo 10mu that lyx currently adds between relations).

Testcase: $\CheckedBox\LEFTcircle\RIGHTcircle\photon\gluon\vcentcolon\dblcolon\Coloneqq\eqcolon\models\hookrightarrow\bowtie\hookleftarrow\Join\APLinv\neq$
2016-11-13 20:04:51 +01:00
Jean-Marc Lasgouttes
6dfbab3124 Handle properly unicode paragraph/line break
They are shown on screen by arrow or pilcrow symbol and cause a line break.

They are still not handled in LaTeX output, though.
2016-11-10 09:37:36 +01:00
Guillaume Munch
dc5d056dd5 Fix warning during runtime with qt4
Do not use "on_" as a prefix for functions unless the use of auto-connect is
intended.
2016-11-09 23:37:35 +01:00
Guillaume Munch
0220c58ef3 Add comment 2016-11-09 22:54:27 +01:00
Guillaume Munch
3233a822f3 Fix addition of new formats
Regression at cb0a4c66
2016-11-09 19:04:28 +01:00
Jean-Marc Lasgouttes
fb264663d8 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.
2016-11-09 15:28:11 +01:00
Guillaume Munch
50ccbd2eab 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)
2016-11-06 15:51:22 +01:00
Guillaume Munch
b30f8d3c4b On-screen justification: stretch in proportion with the em, up to a limit
1) Distinguish expanding characters from separators, to fit with Qt's notion of
expanding character which comes from the Unicode std.  CountExpanders() is moved
to FontMetrics to fix a discrepancy with the duplicate implementation from
598f7e4a.

2) Make these expanders stretch on-screen proportionally to the em of the font.
If a row mixes large and small text, LyX let us see which spaces are set in the
bigger font.

3) Now that the stretch is defined in ems, add a limit such that an expander
never stretches more than 1.5em to avoid weird and hard to read justified lines.

4) Add a return boolean to setSeparatorExtraWidth for future use.
2016-11-06 12:20:00 +01:00
Guillaume Munch
1c84d0ca82 Don't parse multicolumn if the grid does not support it
Fixes #10466 and visual/compilation bugs with InsetMathSplit, InsetMathDiagram,
InsetMathHull, InsetMathSubstack and InsetMathXYMatrix.
2016-11-05 18:36:39 +01:00
Juergen Spitzmueller
e7654d9aa2 Re-Fix #8471
The bug has partly been re-introduced with fb9a866a6
2016-11-05 13:12:47 +01:00
Enrico Forestieri
34ae9dc7f2 Avoid dataloss with \multicolumn
When \multicolumn{ncol}{align}{content} is parsed and the ncol
parameter is not a numeric value, this parameter is swallowed
and replaced with '1'. Hence, if the file is subsequently saved
a dataloss would occur. With this commit, \multicolumn is not
interpreted when ncol is not a numeric value and is left as is.

See also #10466
2016-11-05 10:15:37 +01:00
Jean-Marc Lasgouttes
75fce32556 Round values properly when drawing right margin selection
This fixes a compiler warning reported by Uwe.
2016-11-04 15:58:54 +01:00
Jean-Marc Lasgouttes
b099d9ae15 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.
2016-11-04 12:01:43 +01:00
Jean-Marc Lasgouttes
d207e85cfd Clear background behind sublables when necessary.
This is analogous to what has been done to address #4889 and #10359.

Fixes bug #10475.
2016-11-04 11:35:22 +01:00
Jean-Marc Lasgouttes
5d85a42bf0 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.
2016-11-03 14:19:50 +01:00
Daniel Ramöller
f054721410 In Color Preferences "frame of button" should be "button frame"
Fixes #10135.
2016-11-03 08:57:35 +01:00
Scott Kostyshak
ad65f609b6 Do not recenter screen on spelling-continuously
If a user is scrolling and then toggles spellcheck, LyX used to
recenter the screen around the cursor. Now LyX does not recenter.
2016-11-02 21:34:01 -04:00
Juergen Spitzmueller
3374b8548b 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 17:07:49 +01:00
Juergen Spitzmueller
eca3015f30 Whitespace 2016-10-31 18:50:28 +01:00
Juergen Spitzmueller
0c296cd26f Use Buffer::validate() when previewing single paragraph
We used to use BufferParams::validate(), which does not validate the
paragraphs.
2016-10-31 18:50:28 +01:00
Enrico Forestieri
e3c3719643 Don't print useless messages while parsing math macros
Math macros can be displayed on screen by providing a different
representation than the one used for latex output. This representation
is actually used by lyx even while it is being updated. This leads to
printing useless error messages on the terminal. For example, a macro
parameter has to be entered as \#1 and, if the macro is already used in
a math inset, lyx prints on terminal the error message "Math parse error:
missing token after \\" as soon as one hits the \ key, followed by
"MathMacroArgument::MathMacroArgument: wrong Argument id: -48" as soon as
one hits the # key. So, this is not a useful information and simply
clutters the terminal output. On the other hand, the input is sanitized
even if one stops input after hitting either \ or #, so that no further
messages are issued. Hence, those error messages are simply pointless.
2016-10-31 15:23:20 +01:00
Tommaso Cucinotta
fcaec6166b Show symbol name and description in plaintext export of nomenclature entries.
This addresses one of the issues highlighted in #10459.
See http://www.lyx.org/trac/ticket/10459
2016-10-31 10:50:33 +01:00
Uwe Stöhr
41a5833920 tex2lyx test files: update them
- update the test files after the last 3 fileformat changes
- this is now possible thanks to the patch for bug #10440
2016-10-28 00:45:33 +02:00
Uwe Stöhr
87c00f3383 add support for Urdu and Syriac
- fileformat change
- I could not update the tex2lyx testfiles because of bug #10440 (there is now a probable fix)
2016-10-28 00:21:58 +02:00
Juergen Spitzmueller
0894a17e33 Typo. 2016-10-27 19:58:01 +02:00
Juergen Spitzmueller
07c82e9f84 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-27 09:59:01 +02:00
Tommaso Cucinotta
9740c36e80 Remove assert on advanced find with knitr module (#10444). 2016-10-27 09:38:35 +02:00
Jean-Marc Lasgouttes
695b0cc33b Some tweaks to selection painting
1/ simplify logic that triggers margin selection painting

2/ fix logic for end of paragraph markers. They are now selected when
   there is an end row margin selection.

3/ avoid rounding problems due to int/double conversions.
2016-10-26 14:27:57 +02:00
Jean-Marc Lasgouttes
4159cf97c1 Fix compiler warnings spotted by Uwe 2016-10-26 10:52:55 +02:00
Jean-Marc Lasgouttes
2037cc5ef5 Fixup a700d657 : holes in right margin selection 2016-10-25 16:17:21 +02:00
Enrico Forestieri
3cf0cbb3c6 Show on screen font changes for text-in-math 2016-10-25 16:03:34 +02:00
Jean-Marc Lasgouttes
860accd01f When selecting special logos, set their color correctly
It is not nice when they are the only thinkg in the text that does not
change color.
2016-10-25 15:13:23 +02:00
Jean-Marc Lasgouttes
a700d657b3 Reimplement RowPainter::paintSelection() using row elements
The code is much simpler now and can be actually understood.

As a byproduct, fix bug #10424.
2016-10-25 10:01:37 +02:00
Enrico Forestieri
696ea82b21 Factor out common code used to underline/strike out math
Also use the exact amount of vertical space TeX adds after a
math display (instead of 1ex) for vertically shifting the box.
We have to use \belowdisplayshortskip here, instead of
\belowdisplayskip, because the math formula is typeset by alone
in a box, and thus there is no following line.
2016-10-25 00:49:26 +02:00
Jean-Marc Lasgouttes
e832d2e90f Work around issues with Qt5 and Arabic text
This fixes two particular problems

* with Qt5, it seems that QFontMetrics::width does not return the
  correct value for some Arabic text; this patch uses QTextLayout
  instead to compute a string width

* Likewise, the undocumented layout flags TextForceRightToLeft and
  TextForceLeftToRight do not work with Arabic text; this patch uses
  unicode override characters instead.

It might be that the two issues are related. In any case, they do not
happen with latin text where right-to-left direction is enforced. And
they do not happen with Qt4.

Additionally, remove some dead code in GuiFontMetrics::pos2x().

Fixes bug #10436.
2016-10-24 16:31:40 +02:00
Tommaso Cucinotta
8b5dc3c662 Fix bug in replacement of "$$s/" in converter commands, introduced in 8b66f9ce. 2016-10-24 15:08:06 +02:00
Enrico Forestieri
dea5ba16de Correctly track ulem commands with change tracking
LyX assumes that everything in \lyxdeleted is struck out by ulem
and increases the corresponding counter. However, deleted display
math material is struck out using tikz. As we also take into
account the deletion of underlined display math (in order to
properly position such material vertically), we have to take
care that the count is correct.
2016-10-23 18:23:41 +02:00
Enrico Forestieri
9ba76e6c40 On export, mark the start of the first paragraph
No newline is written after \begin{document}, such that
the afterParbreak method would return false. This misleads
the code that outputs a display math in an ulem command
to emit a newline command instead of \noindent, causing
latex errors. This occurs only if the math is at the very
start of a document, without anything before it.
2016-10-23 18:16:56 +02:00
Juergen Spitzmueller
e335c764b4 Revert "Fix Ticket #9741 misleading name for font-encoding setting "default"."
This reverts commit e37e4f537c.

The issue still needs discussion.
2016-10-23 17:20:58 +02:00
Jean-Marc Lasgouttes
6375a3cd65 Mark a signal invokation as such 2016-10-23 13:49:06 +02:00
Guillaume Munch
13eeb3b3c3 Fix compilation on cygwin & others 2016-10-23 00:25:05 +02:00
Guillaume Munch
67ddc246fd Improvement to the reverse-search algorithm 2016-10-22 23:24:01 +02:00
Guillaume Munch
68b034f51f TexRow: enable new RowEntry types 2016-10-22 23:24:01 +02:00
Guillaume Munch
148b3ae773 Move class definitions inside main class
Prepare for following commits.

This prevent's forward-declaration, but including the TexRow header should be
inexpensive.
2016-10-22 23:24:01 +02:00
Guillaume Munch
2e45bade7a Simplify and add debug message 2016-10-22 23:24:00 +02:00
Guillaume Munch
e1492a3ab1 Use the new infrastructure to select rows during error reporting 2016-10-22 23:24:00 +02:00
Guillaume Munch
dbe0c6991b Add safe line breaks to improve TexRow precision in subfloat & caption 2016-10-22 23:05:44 +02:00
Guillaume Munch
e798db5739 Safe line break to increase precision of error reporting in Listings caption 2016-10-22 22:39:33 +02:00
Uwe Stöhr
d9c52c7a3f support for Amharic, Asturian, Kannada and Khmer
- fileformat change
- I could not update the tex2lyx test files because of bug #10440
- maybe the lyx2lyx routine could be improved but since a document can also begin with another layout than "Standard" I could not use the lyx2lyx function put_cmd_in_ert
2016-10-22 15:33:59 +02:00
Juergen Spitzmueller
9235b09fd8 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 12:13:36 +02:00
Juergen Spitzmueller
e83e64c447 Do not output bidi direction macros in passthru context
Part of #10434.
2016-10-21 10:40:19 +02:00
Juergen Spitzmueller
fb9a866a66 Implement PassThru option to arguments. 2016-10-21 10:39:55 +02:00
Günter Milde
e37e4f537c Fix Ticket #9741 misleading name for font-encoding setting "default".
It would be nice, if the tooltip showed the value of
lyxrc.fontenc, but too complicated for my simple patch.
2016-10-21 09:10:46 +02:00
Richard Heck
c19794a013 These two routines are now redundant. 2016-10-20 23:07:13 -04:00
Richard Heck
7c9e9b4c90 We can now use the cached information instead of tracing the graph. 2016-10-20 23:07:13 -04:00
Richard Heck
014bc7805e Use a typedef for vector<Format const *>, which is what gets used
for lists of exportable and importable formats.
2016-10-20 23:07:13 -04:00
Richard Heck
e7f39ed377 There is no need now to cache format information in the SendTo
dialog.
2016-10-20 23:07:13 -04:00
Richard Heck
7fd1a14c1b Since we're now caching this, we can sort it once, rather than
lots of times.
2016-10-20 23:07:13 -04:00
Richard Heck
0b67e103e9 Simple cache for information on exportable formats, since we seem
to access this information a lot.
2016-10-20 23:07:13 -04:00
Enrico Forestieri
7cf12243b8 Fix indentation 2016-10-21 01:58:45 +02:00
Enrico Forestieri
8d5899aaf3 Fortify math insets against ulem commands
It should be now possible underlining or striking out any kind
of math inset containing any math construct indigestible to ulem.
While this was already possible for inline math insets, they could
have break if an aligned environment was used, for example.
This is now possible also for diplay math. Even if this can be
nonsensical and not visually perfect, at least no latex errors
should be generated if one tries to.
2016-10-21 01:35:39 +02:00
Uwe Stöhr
5adf949abb tex2lyx/Preamble.cpp: forgot this in r[f179173e/lyxgit]
- polyglossia supports Romansh, Piedmontese and Friulian
2016-10-21 00:20:27 +02:00
Uwe Stöhr
fe542e7989 tex2lyx/Preamble.cpp: sort alphabetically to keep overview
- also comment out the unsupported languages
2016-10-21 00:14:09 +02:00
Jean-Marc Lasgouttes
b162bd6d2b When breaking an empty paragraph reduces depth, set layout too
This requires an adaptation of the Separator inset insertion code,
which has been duly provided by Enrico.
2016-10-20 14:38:12 +02:00
Jean-Marc Lasgouttes
fbba865d28 Fix compiler warning from clang 3.9 2016-10-20 09:31:01 +02:00
Enrico Forestieri
ab3e1ddc34 Introduce the InsetMathHull::outerDisplay method and use it 2016-10-20 00:06:42 +02:00
Jean-Marc Lasgouttes
4065f596ad Remove unused methods in anononymous namespace
These have been flagged by gcc 6.
2016-10-19 17:51:32 +02:00
Juergen Spitzmueller
86517b120c Restore alphabetic order 2016-10-19 14:21:24 +02:00
Jean-Marc Lasgouttes
85bcf0d93f Fix indentation
Thanks to Juergen and gcc 6.2.
2016-10-19 14:10:47 +02:00
Jean-Marc Lasgouttes
6cb05ce8bb Do some caching of window title and related UI
This should avoid performance problems related to the window update machinery.
Moreover this fixes a crash introduced by 82808fea when closing a file.

Note that GuiWorkArea::Private already had a read_only_ member, but it
was unused.

Also rename LyXVC::vcname() to LyXVC::vcstatus() since it now contains
directly the UI string to be shown.
2016-10-19 11:59:47 +02:00
Jean-Marc Lasgouttes
a4e7114d98 Typo 2016-10-19 11:21:02 +02:00
Enrico Forestieri
d48bc4e4ae Remove a now unnecessary \mbox 2016-10-19 01:32:29 +02:00
Enrico Forestieri
6ae6198818 Avoid introducing a spurious space in \lyxmathsout 2016-10-18 04:35:02 +02:00
Enrico Forestieri
129459a71b Take into account font changes when striking out display math formulas
Font changes are brought inside the \lyxdeleted macro, just before
outputting the latex code for the math inset. The inset writes a
signature before itself and this is checked by \lyxsout for recognizing
a display math. So, the font changes confuse \lyxsout, which also
swallows the first macro at the very start of \lyxdeleted. The result
is that the font changing command is not seen by latex and \sout is also
used to further strike out the formula already striked out by tikz.
This commit makes sure that the expected signature actually appears
just after the opening brace of \lyxdeleted. It also accounts for a
paragraph break occurring just before the math inset, in order to not
introduce too much vertical space, which is noticeable when using
larger font sizes.
2016-10-18 03:29:53 +02:00
Guillaume Munch
9c0281126e Change tracking cue for InsetCaption 2016-10-18 01:06:03 +02:00
Guillaume Munch
0aab06c468 Some compilers are worried that a struct is not the same as a class 2016-10-18 00:54:37 +02:00
Enrico Forestieri
c1bfaa5c76 Fix latex error when change-tracked deleted display math starts a new paragraph
LaTeX refuses to break a line when it is empty. But we have to start
a new line here, otherwise the whole displayed equation would be
typeset as it were inline with previous content. The solution is to
put a zero-length space just before the line break. Moreover, this
is the right thing to do, as it simulates the extra space that is
normally added in this circumstance.
2016-10-17 19:35:04 +02:00
Enrico Forestieri
261e7ae9ce 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.
2016-10-17 03:25:35 +02:00
Guillaume Munch
e0e765f6a9 Get rid of dirty BufferView pointer
Now that there is a signal to inform the controller when the buffer view has
changed, it is no longer necessary to store a perishable pointer to a buffer
view in the dialog view. (Indeed, it was only really useful for checking whether
the new buffer view pointer was different from the old one.)

TODO: other dialogs should be audited for similar hazards.
2016-10-17 00:16:59 +02:00
Guillaume Munch
de19b8fc2d Take advantage of new bufferViewChanged signal 2016-10-17 00:16:59 +02:00
Guillaume Munch
c438d794ff Factor code after buffer change 2016-10-17 00:16:59 +02:00
Guillaume Munch
f4c390712e New virtual method frontend::Dialog::on_BufferViewChanged()
This is called anytime the buffer view attached to the GuiView changes.
2016-10-17 00:16:59 +02:00
Guillaume Munch
9b4926c6e6 Fit cursor and update screen after reverse-search 2016-10-17 00:16:59 +02:00
Guillaume Munch
a95e933f51 Fixes to reverse search
* In doubt, select up to the end of the paragraph

* Correct offset after artificial new lines
2016-10-17 00:16:59 +02:00
Guillaume Munch
01d6333db2 Implement reverse-search in the source panel
Double-clicking on a line in the source panel triggers the selection of the
corresponding line in the Buffer View.
2016-10-17 00:16:59 +02:00
Guillaume Munch
67805de7de New LFUN paragraph-goto id_start pos_start id_end pos_end
This selects from start to end.

id_end must be in the same buffer as id_start.
2016-10-17 00:16:59 +02:00
Guillaume Munch
f42379a7d6 Fix probable omission
Upon close inspection I do not think that this twist was necessary.
2016-10-17 00:16:59 +02:00
Guillaume Munch
1f6c451ee3 TexRow for InPreamble
This enables error reporting for the preamble, provided the preamble is written
using the new InPreamble layouts.

In the future, I find it preferable to deprecate the usual preamble in favour of
InPreamble layouts rather than implementing error reporting for the usual
preamble. This requires some improvements to code editing in the buffer view
first (line breaking behaviour, syntax highlighting).
2016-10-17 00:16:59 +02:00
Guillaume Munch
1b4f5970a4 Streamify a docstring
prepare ground for TexRow InPreamble
2016-10-17 00:16:59 +02:00
Guillaume Munch
1f945177b9 Docstringify getLongString in general and preamble snippets in particular
Prepare ground for TexRow InPreamble
2016-10-17 00:16:59 +02:00
Guillaume Munch
6edbc1da66 TexRow for InsetArgument 2016-10-17 00:16:59 +02:00
Guillaume Munch
676a0639c5 Use otexstringstream for the captions of InsetCaptionables
* Enable TexRow for InsetListings caption.

* Move getCaption* from InsetText to InsetCaptionable.

* Clean-up caption generation for InsetFloat.
2016-10-17 00:16:59 +02:00
Guillaume Munch
f3e099960a Gcc 4.6 compatibility :( 2016-10-17 00:16:59 +02:00
Guillaume Munch
f3256ee2cd texstring and otexstringstream
texstring is a pair of a docstring and a corresponding TexRow. The row count in
the TexRow has to match the number of lines in the docstring.

otexstringstream is an output string stream that can be used to create
texstrings (i.e. it's an odocstringstream that records the TexRow information
and let us extract a texstring from it).

texstrings can be passed around and output to otexstream and otexrowstream,
which produces an accurate TexRow information by concatenating TexRows.
2016-10-17 00:16:59 +02:00
Uwe Stöhr
f179173e42 support for the languages Bosnian, Friulian, Macedonian, Piedmontese and Romansh
- file format change
- note that I could not update the tex2lyx test files because of bug #10440
2016-10-16 15:33:23 +02:00
Juergen Spitzmueller
f089f60f4e Implement wrapping in next-change (#10388). 2016-10-15 16:34:16 +02:00
Juergen Spitzmueller
0eb651a2cf New layout tags for better counter handling
* ResumeCounter: allow to resume an (enumerate) counter
* StepMasterCounter: allow to increase a master counter
2016-10-14 20:08:12 +02:00
Jean-Marc Lasgouttes
84050268ee Remove useless #include
Including MathData.h in InsetMath.h is expensive and not required.
2016-10-14 11:08:04 +02:00
Scott Kostyshak
892593fbdc Change default working directory from ~/ to "."
Note that the lyxrc.document_path variable corresponds to what we
call the "Working directory" in the GUI preferences dialog.

Setting document_path to "." makes it so when LyX is started from a
directory, that directory is the default path for many of LyX's
operations, such as the following:

- new file, new from template
- adding a custom BibTeX file
- GUI compare dialog
- local layout button in document settings
- external material file browser
- graphics browser, include browser

The best guess for where the user wants to save or find files is the
directory the user started LyX from. Before, the default was always
the home directory. If desired, the old behavior can be restored by
changing the default path in Preferences > "Working directory".

This commit takes advantage of 9b64d7bd, which allows the use of a
relative path for path preferences.
2016-10-11 22:25:42 -04:00
Enrico Forestieri
ded8b1b3da Remove context help button hint from file dialogs
This removes the useless '?' button that appears in Windows builds
when using non-native dialogs. Complements cf26d53e.
2016-10-10 01:25:07 +02:00
Scott Kostyshak
f411040a33 Further amend 168d3557 to satisfy GCC 4.6
GCC 4.6 does not support non-static data member initializers.

As Guillaume points out, changing to static does not change the
intent.
2016-10-09 18:08:42 -04:00
Scott Kostyshak
5fd21db9d4 Amend 168d3557
I forgot to append an underscore for the private data member.
2016-10-09 17:22:22 -04:00
Scott Kostyshak
168d355721 Factor out magic zoom minimum to a const member
The limit of 10% is used in both getStatus() and dispatch() to set a
minimum zoom level. Having it centralized makes the code more
readable and makes changing the minimum less error-prone.
2016-10-09 17:18:07 -04:00
Scott Kostyshak
6a0e5571c5 Whitespace 2016-10-09 17:18:07 -04:00
Daniel Ramöller
cf26d53e03 Remove question marks from Windows dialogs 2016-10-09 19:50:34 +02:00
Guillaume Munch
071eed8664 Remove unused variable warning 2016-10-09 19:48:15 +02:00
Guillaume Munch
2717ef114c Add the customary 1-pixel gap before MathMacroTemplate to better see cursor 2016-10-06 01:35:29 +02:00
Guillaume Munch
5aa3164d21 Make the border of hullRegexp pixel perfect 2016-10-06 01:32:21 +02:00
Guillaume Munch
324e5571ca Fix borders of InsetMathGrid
* New virtual functions leftMargin() and rightMargin() to get rid of
  drawWithMargin()

* Factor and rewrite code for borders.

* Fix several offset calculations.

Known issues:

* Borders of multicols look too good and do not correspond to the pdf
  output. (non-regression)

* Bounding box for Hull (Regexp) not pixel-perfect.

* Bounding boxes of Diagram, XYmatrix, are too tight when there are
  borders. Also border should be disabled. (non-regression)
2016-10-06 01:11:49 +02:00
Enrico Forestieri
42a3035709 Amend ccc0e03f
Better adding the break, even if falling through would be Ok,
as LyX requires xcolor when both xcolor and color are requested.
2016-10-05 01:31:14 +02:00
Enrico Forestieri
ccc0e03fdc In mathed, require xcolor instead of color when appropriate
Fixes bug #10417.
2016-10-05 01:18:15 +02:00
Scott Kostyshak
3fefbf7917 Initialize a member variable before it is used
Valgrind spotted a conditional jump depending on an uninitialised
value.

Thanks to Pavel for the help. For more information, see:
https://www.mail-archive.com/search?l=mid&q=20160928204810.e5ylny3raa7jgmgw%40Opti1604
2016-09-30 23:27:13 -04:00
Enrico Forestieri
925f933a19 Force local language switch in IPA insets
Otherwise we get latex errors when using polyglossia.
2016-09-29 18:35:26 +02:00
Guillaume Munch
79a947c904 Work around dangling pointer
A better solution would be to entirely get rid of this borrowed pointer with
unclear lifetime, but this requires to introduce a new signal for when the
buffer view attached to the GuiView has changed.
2016-09-29 12:37:19 +02:00
Guillaume Munch
3d7ede6059 Clarify that the Dialog::lyxview_ pointer is in fact a reference 2016-09-29 12:37:19 +02:00
Guillaume Munch
c663c9ab3c Fix horizontal lines in math arrays
They must end at the end of the last column, not at the start of the last+1
column.
2016-09-29 12:37:19 +02:00
Enrico Forestieri
7e3494c293 Also track local language switches
Until now this was not done for essentially two reasons. The first
one is that local switches are used for short text insertions, so that
they are unlikely crossing environment boundaries. The second one
is that if we have to close a language at the end of an environment
we would be missing the right termination command. As this last
issue can be overcome by simply storing in the stack the current
nest level with a sign denoting the kind of switch, there is no
reason anymore not to track also local languages switches.
Also factor out some commonly used constructs in order to improve
readability.
2016-09-27 23:00:29 +02:00
Enrico Forestieri
e40fa86a97 Do not unnecessarily open the document language
If the document language is opened outside of any environement, we risk
not closing it if no other language switch occurs. Indeed, the stack is
emptied only at the end of an enviroment. We could of course also empty
it at the end of the document, but we would have an unnecessary language
switch.
2016-09-27 21:41:13 +02:00
Enrico Forestieri
f476d9c85a Shut up compiler warning 2016-09-27 21:32:40 +02:00
Enrico Forestieri
6642152e66 Do not rely on math macros being updated
Trying to spare a few cycles by avoiding computing metrics during
screen updates and export. See also 8f86ee74, 72cf7c8f, and e36a8903.
Guillaume will tell whether this also avoids crashing his documents ;)
2016-09-25 20:31:13 +02:00
Enrico Forestieri
3bc80220a7 Amend 6a3ced3c
ERT macros are also math insets, sigh...
2016-09-25 18:59:07 +02:00
Enrico Forestieri
4508a7f855 No need to clutter runparams... 2016-09-25 08:56:12 +02:00
Enrico Forestieri
8c14d9e041 Correctly track opened polyglossia languages
A language switch may also occur outside of output_latex.cpp, apparently.
2016-09-25 08:20:34 +02:00
Enrico Forestieri
6a3ced3cfb Do not confuse global commands with ERT macros 2016-09-25 02:00:55 +02:00
Enrico Forestieri
314e30d5fd Correctly classify macros
Some macros defined in the lib/symbols file are classified are texmode.
But the MathMacro class was missing a currentMode method for returning
this information.
2016-09-25 01:11:16 +02:00
Enrico Forestieri
3bc08a76c4 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}".
There may still be some cases I did not take into account.
2016-09-24 03:15:02 +02:00
Guillaume Munch
b40184ce71 Fix compilation with MSVC 2015 2016-09-24 00:50:03 +02:00
Guillaume Munch
5fbbf0f281 Reverse search: select a whole row
TexRow now returns a range {start, end} when looking up a particular row.

Reverse-search now selects the whole range instead of simply moving the cursor.
2016-09-23 23:39:48 +02:00
Guillaume Munch
c9fc5bf1c6 Fix: shift-mouse selection doesn't work well across insets
(FIXME in the code, no corresponding ticket found even though it is pretty
annoying)
2016-09-23 23:39:48 +02:00
Guillaume Munch
c36ada6b96 Helpers to set selections to arbitrary DocIterators 2016-09-23 23:39:48 +02:00
Guillaume Munch
3fd2398a28 Remove option to disable texrow
I suspect that the gain was negligible, yet it made debugging and maintainance
harder.
2016-09-23 23:39:48 +02:00
Guillaume Munch
f0959cc292 explicit operator bool 2016-09-23 23:39:48 +02:00
Guillaume Munch
f1582a2acb Fix type of pos 2016-09-23 23:39:48 +02:00
Guillaume Munch
a4c17ac937 TexRow: clean up and simplify
In particular merge the current_row_ with the rowlist_, which simplifies the
logic.

Pass by value for small PODs.
2016-09-23 23:39:48 +02:00
Jean-Marc Lasgouttes
7cbc0c16a8 Simplify the code that sets the read-only emblem in status bar
Actually QIcon is able to handle transparently the svg icons.

Patch from Enrico.
2016-09-23 11:18:28 +02:00
Günter Milde
63f41711cb 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-09-23 09:04:03 +02:00
Guillaume Munch
ca58674267 Better title for ViewSource
The title is changed to "LaTeX (pdflatex) Preview", etc. depending on the
format. The actual default format is computed.

The menu name "Source Pane" is replaced by "Code Preview Pane" to better reflect
its purpose.
2016-09-21 16:42:38 +02:00
Jean-Marc Lasgouttes
db12707655 Do not hardcode required packages for Note inset
This does not change the default behavior, but allows to customize it.
2016-09-21 16:11:53 +02:00
Jean-Marc Lasgouttes
bbe36ce6ce Do not use em dash in window title
It seems that only KDE does that. Gnome does not, Windows does not either.
I do not think that we can/want to detect a KDE environment at run-time.
2016-09-21 13:56:28 +02:00
Jean-Marc Lasgouttes
d12ebb00b9 Make *-lyxformat-* backup files use .lyx~ extension
At least now that look like real backup files
2016-09-21 13:11:20 +02:00
Juergen Spitzmueller
b941d93974 Amend 2c4673af58
Also consider xrefs in crossref'ed entries.
2016-09-20 11:34:17 +02:00
Juergen Spitzmueller
67da1431de Improve info display for biblatex databases, part III
When resolving biblatex's xdata references, consider that xdata fields
can contain a comma-separated list of keys, not just a single key like
crossref.
2016-09-19 19:09:42 +02:00
Guillaume Munch
8da87f9dbf amend 4d991120 2016-09-18 14:43:26 +01:00
Juergen Spitzmueller
1c725c913c Regex fix for endyear
As of biblatex 3.5, years and endyears can be negative (BCE).
2016-09-18 12:59:43 +02:00
Juergen Spitzmueller
2c4673af58 Improve info display for biblatex databases, part II
In addition to the classic crossref, biblatex introduces xdata
references in order to source-out common data of entries. Entries
that have "xdata = {somekey}" just inherit all fields from the
respective @xdata entry, if the field is not already defined in
the entry itself (just like crossref, with the exception that @xdata
entries themselves are _never_ output on their own). @xdata entries can
themselves inherit to other @xdata entries (ad infinitum). So you can,
for instance, setup an xdata entry for a book series with series name
that inherits an xdata entry with information of the publisher
(publisher, address). Any book of that series would just need to refer
to the series xdata and add the number.

BiblioInfo now checks, in addition to crossrefs, for such xdata
references and inherits missing fields.

Nte that biblatex also introduces an "xref" field as an alternative to
crossref. We must not care about that, since the point of xref is that
it does not inherit fields from the target (just cites that one if a
given number of refs to it exist)
2016-09-18 12:44:12 +02:00
Juergen Spitzmueller
ba17193067 Improve info display for biblatex databases
If an entry does not have a year field, check for a date field
(the common type in biblatex databases) and extract the year(s).

Candidate for branch.
2016-09-18 10:33:33 +02:00
Juergen Spitzmueller
7d4292918e Remove unnecessary directives and preset search on fly. 2016-09-18 09:10:24 +02:00
Juergen Spitzmueller
f1ae30919f Connect filter reset button and remove unnecessary directives. 2016-09-18 09:02:23 +02:00
Enrico Forestieri
ade098e289 Improve systemlyxdir handling
Do not assume that the /systemlyxdir path prefix in \origin refers
to the system directory of the running instance, but check through
some heuristics what the real system dir is. In this way, a document
in the system dir of any other LyX installation is correctly spotted
and the \origin tag properly updated. For example, one can use an
installed version of lyx to edit a document in the lib/doc dir of a
git repo and obtain the same result as when running lyx in place.
2016-09-17 22:38:27 +02:00
Juergen Spitzmueller
47ea77a8d7 Fix string 2016-09-17 13:06:41 +02:00
Juergen Spitzmueller
774becf693 Clean up the crossrefs dialog. 2016-09-17 13:03:33 +02:00
Juergen Spitzmueller
3294b16bf6 Keep citation style settings bot within and between sessions.
Fixes: #10256
2016-09-16 19:39:53 +02:00
Juergen Spitzmueller
0c1a023c70 Citation dialog: add & improve tooltips. 2016-09-16 13:47:26 +02:00
Juergen Spitzmueller
5225418d8a CitationUi: Fix small layout glitch 2016-09-16 10:35:06 +02:00
Juergen Spitzmueller
824e24ca60 Citation dialog redesign 2016-09-16 09:21:04 +02:00
Enrico Forestieri
c4aca5705b Correctly distinguish ERT macros from predefined ones such as \alpha 2016-09-16 02:15:52 +02:00
Enrico Forestieri
a26e75cd8a Correctly distinguish LyX macros from those defined in ERT
At this time the MacroData of a macro is still uninitialized,
so the macro() method always returns null.
2016-09-16 00:43:04 +02:00
Enrico Forestieri
364e8d6692 Avoid inserting spurious \text insets in mathed
This amends 5cdbaf51.
2016-09-16 00:37:04 +02:00
Enrico Forestieri
1b7dea5c2f Do not prematurely close \ensuremath or \lyxmathsym on export 2016-09-16 00:32:35 +02:00
Enrico Forestieri
e36a8903d7 Really fix the problem with not updated macros
Revert to the strategy used at 8f86ee74 but not using mathedWordList
because it may be still uninitialized at load time. Instead, use the
globalMacros method for getting the same info.
There was a thinko at 8ec91e80, because globalMacros always returns
null for user defined macros.
2016-09-15 02:39:30 +02:00
Jean-Marc Lasgouttes
9313f8565b Set window title before stting modified state
Fixes message "QWidget::setWindowModified: The window title does not
contain a '[*]' placeholder" when opening a non-existent file.
2016-09-14 22:37:06 +02:00
Juergen Spitzmueller
c0a425a319 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-09-14 10:23:39 +02:00
Enrico Forestieri
72cf7c8f1f Partly revert the bits of 8f86ee74 that are not necessary anymore after 8ec91e80 2016-09-14 02:51:56 +02:00
Enrico Forestieri
8ec91e804a Make sure not to use a pointer that may be bogus
It may happen that mathedWordList is not still updated at load time,
so we would still be using a bogus pointer. Better fetching the
necessary info from the global macro table.
2016-09-14 02:27:18 +02:00
Günter Milde
f2a263e334 tex2lyx: Remove "textglobfall" hack.
tex2lyx tests for TIPA (test-inset-*) resulted in {End} in ERT after fixing lib/unicodesymbols.
Should be fine now.
2016-09-13 22:23:53 +02:00
Enrico Forestieri
8f86ee74cd Make sure that math macros are updated at export time.
The math macros system is quite complex. Macros are updated during
metrics calculation, so a missing update is very likely to cause a
crash. This commit tries to assure that they are updated at export
time, which also happens when the table of contents is updated.
Moreover, in order to circumvent a possible missing update, when
a math macro is detected we try to avoid using the sym_ member
of the MacroData class, as it may contain bogus values.
2016-09-13 08:02:02 +02:00
Günter Milde
99eeb29e58 tex2lyx test: make box-color-*.tex sample compilable
Load required package textcomp.
Replace call to non-existent packages textcyr and textgreek with the backup definition of the commands as done by LyX export.
Do not load marvosym (clash with pifont) (LyX does not load the package either).
Remove invalid command \\ascii.
2016-09-12 11:46:30 +02:00
Kornel Benko
e78e58a7de Cmake build: Shuffle code around. 2016-09-12 11:04:14 +02:00
Enrico Forestieri
a24033ff0e Ensure consistency
On export, a macro defined in ERT (or not defined at all) is left
in the same environment it is entered. So, don't explicitly insert
it in an ensuremath environment when it is entered in a textmode one.
2016-09-12 07:55:38 +02:00
Enrico Forestieri
615c733844 Make sure a pointer is valid before using it 2016-09-12 05:15:00 +02:00
Scott Kostyshak
d3c63f97c4 Update tex2lyx test reference after 754cb3d1
From Günter [1]:

  the difference is the textcommand for ETB which changed from
  {\ascii\ETB} to

  0x21a8 "\\ETB"                    "ascii" "force=utf8" # UP DOWN
  ARROW WITH BASE

  because the former resulted in

  l.513 \ascii
              \ETB{}
  ! Undefined control sequence.

[1]
https://www.mail-archive.com/search?l=mid&q=nr48qn%242gb%241%40blaine.gmane.org
2016-09-11 17:52:02 -04:00
Kornel Benko
050d817605 Cmake build: Add qt-svg-lib to be linked with lyx if used QT4.
Probably due to commit 82808fe, there were undefined references
such as e.g. QSvgRenderer::~QSvgRenderer().
2016-09-11 15:34:58 +02:00
Enrico Forestieri
2aa930bbe8 Fix display and export of some latex macros
Fixes #9742.
2016-09-10 18:32:44 +02:00
Enrico Forestieri
cb70946960 Fix bug #9616 2016-09-10 13:36:45 +02:00
Günter Milde
99310b7e3f Fix export of Unicode characters (Unicode blocks <=72)
Fix problems revealed by hand-compiling an examining the test samples in autotests/export/Unicode-characters/:

* new definitions
* fixed definitions
* "force=utf8" when required
* some IPA symbols fail without the "extraipa" package
* fix direction of "textcommaaboveright"
2016-09-10 12:35:51 +02:00
Juergen Spitzmueller
4c27c921f0 Minor amendment to b95262f487
Just for consistency.
2016-09-10 10:32:40 +02:00
Enrico Forestieri
5cdbaf51ee Avoid duplicating mode changing commands 2016-09-10 02:39:57 +02:00
Enrico Forestieri
324651899e Ensure proper mode in mathed
A math-mode command entered in a text-mode environment is wrapped
in an ensuremath inset, as well as a text-mode command entered in a
math-mode environment is wrapped in a text inset. Who doesn't like
the extra insets can always dissolve them and rely on the wrapping
performed on export.
2016-09-10 02:07:47 +02:00
Georg Baum
a6be519a81 Fix data loss with [ in first cell of aligned
If the first character in the first cell of an aligned math environment is
'[', and the environment does not use top or bottom vertical alignment,
then LyX did write the '[' unprotected so that it got misinterpreted as
optional argument, both when reading the .lyx file in LyX and when reading
the .tex file in LaTeX => data loss!
The fix is to output an empty optional argument in this case, which is
interpreted as default alignment both by LyX and LaTeX. It would also be
possible to output \[ in the first cell instead, but this would be more
difficult to implement.
2016-09-08 22:38:33 +02:00
Georg Baum
a931e84e8b Prepare for mutlicolumn lines
The \multicolumn command allows to set vertical lines for individual rows.
These are not yet displayed, but if they are supported one day, the code in
a27ff13663 needs to be adjusted. This change hints at the adjustment.
2016-09-08 22:01:22 +02:00
Jean-Marc Lasgouttes
a27ff13663 Set vertical lines in math arrays correctly on Y axis
This is a fixup to commit 39329935. The two fixes are
* add forgotten offset `y' when drawing the line
* in order to have a continuous vertical line, draw from the offset of
  the previous row.

Fixes bug #10363.
2016-09-08 16:30:25 +02:00
Jean-Marc Lasgouttes
82808fea04 Set window title according to platform UI
The window title is built from the current file name and its
mofidication state. We use our own code instead of the automatic title
bar provided when windowFileName() is set because

1/ Qt does not keep the full path name
2/ Qt does not yield a nice application name

The "read only" and "version control" status are shown in the status bar:

* for read only we use the tab read only emblem (with the right size)
* for version control, we show the name of the backend (using a new
  vcname() method of the backend).

The iconText() of the view is not updated anymore, since this is
deprecated in Qt5.
2016-09-08 15:59:44 +02:00
Juergen Spitzmueller
b95262f487 Sanitize Ref dialog validation.
Fixes: #10376
2016-09-08 15:04:58 +02:00
Georg Baum
646d47ae93 Fix filter filter regex
Now the external material file dialog shows the file types defined in the
template again. Before this fix it did only show "All files (*)".
I don't know what the old syntax was supposed to do or whether it ever worked
with boost::regex, but with std::regex the new one is correct.
2016-09-05 22:49:59 +02:00
Jean-Marc Lasgouttes
72837fec5c Amend commit e194c9ce27
As noted in the log, this commit was a bit radical and needs some
adjustments (which was expected, actually).

Let InsetText do their own background drawing.

Fixes bug #10359.
2016-09-05 11:06:01 +02:00
Juergen Spitzmueller
b5c0694856 Amend 97b9e81cee
\@ifundefined is an If-Then-ELSE construct.
2016-09-04 17:44:47 +02:00
Scott Kostyshak
1a374a931b Exit with error if child exits with error (#10188)
Before, it could have been the case that

  lyx -e pdf2 file.lyx

had exit code 0 even though file.lyx includes a file that exits with
error. If compiled in the GUI a warning was given, but from the
command line exit code it would seem there was no problem. The exit
code for this case is now non-zero and the word "Warning" is now
removed from the message because it should be treated as an error.

An exception is thrown from InsetInclude and is caught in
Buffer::makeLaTeXFile() and added to the error list.

The (similar) use case at #8840 is also fixed by this commit.
2016-09-02 18:24:14 -04:00
Jean-Marc Lasgouttes
da30e38400 Remove unused 'glue' parameter
It was probably useful at some time, but not now.
2016-08-30 17:21:18 +02:00
Jean-Marc Lasgouttes
78ae499355 Remove unused struct members
Interestingly, cppcheck detected that they were not initialized (see
8a047a41), but not that they were unused.
2016-08-30 17:08:49 +02:00
Scott Kostyshak
03684ae05e Improve status check of LFUN_BUFFER_ZOOM_{OUT,IN}
buffer-zoom-out can actually zoom in (by giving a positive number as
the argument), so it should only be disabled at the minimum zoom
level if it is indeed zooming out.

Similarly, buffer-zoom-in can zoom out, so it should be disabled if
the user is at the minimum zoom and it is called to zoom out.

This commit amends 8884c404.
2016-08-30 10:25:45 -04:00
Jean-Marc Lasgouttes
68d825fed8 Amend b583fb26e8
It failed in the case where a selection already existed (the anchor would be wrongly reset).
2016-08-29 12:03:33 +02:00
Guillaume Munch
4d99112056 Action.cpp: replace a reference with a shared_ptr
Replace the member reference to FuncRequest in Action.cpp with a
shared_ptr. Compared to copying the FuncRequest, the shared_ptr has two
advantages:

* Recreating the menu each time creates a lot of new actions, so we avoid a lot
  of copies.

* FuncRequest can remain forward-declared in Action.h.
2016-08-28 22:49:21 +01:00
Guillaume Munch
0779b3c36c Change "Format" into "Formats"
The plural form seems more appropriate and the tag [[output]] is added for
disambiguation (e.g. for the French translation).
2016-08-28 18:26:58 +01:00
Richard Heck
5018e1077b producesOutput() should not be redeclared as producesOutput(bool). 2016-08-28 00:04:02 -04:00
Guillaume Munch
76d0c6759f Trivial clean-up 2016-08-28 02:34:54 +01:00
Guillaume Munch
cb0a4c6639 Fix Unicode use in Format's prettyname
The field prettyname can accept Unicode and therefore must be parsed into a
docstring.

Little simplification of the code on the way.

* For other fields, either a validator should be set to prevent non-ascii input
  in the preferences, or they should be transformed into docstring too.
2016-08-28 01:30:53 +01:00
Guillaume Munch
efbec20320 Fix the compare_locale function by relying on Qt's (#9030) 2016-08-28 01:30:53 +01:00
Juergen Spitzmueller
40d9c6ec48 Implement proper dialog titles in InsetParamsDialogs
Fixes: #10329
2016-08-26 11:35:12 +02:00
Jean-Marc Lasgouttes
2ad52918da Do not set layout for no-op paragraph break
When breaking paragraph in an empty top-level paragraph, nothing
happens on screen but yet there is an undo step because the layout is
reset to what it already was.

Avoid this case.

Fixes bug #10089.
2016-08-24 15:29:17 +02:00
Jean-Marc Lasgouttes
07c7dae367 Move correctly the end of proof marker when row is large
This was a regression from 2.1.x in LtR mode, and it never worked correctly in RtL mode.

Fixes bug #10344.
2016-08-23 17:45:21 +02:00
Jean-Marc Lasgouttes
b583fb26e8 Reset anchor before selecting with S-button1 2016-08-23 12:22:35 +02:00
Jean-Marc Lasgouttes
65b0e84b54 Let M-x give focus to minibuffer when it is already open 2016-08-22 18:20:09 +02:00
Guillaume Munch
193cda6e48 Remove unused variable warning and remove preprocessor switch. 2016-08-22 00:04:30 +01:00
Enrico Forestieri
6adf079796 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.

See #10342.
2016-08-21 23:33:01 +02:00
Enrico Forestieri
589f49ff36 Use only one file for dummy implementations 2016-08-20 00:41:04 +02:00
Jean-Marc Lasgouttes
4ddad2f6cd Remove horizontal spacing around previews
This concerns the preview version of InsetPreview and InsetIPA.

Fixes bug #10304.
2016-08-19 15:01:18 +02:00
Jean-Marc Lasgouttes
e7a33cacf1 Simplify menus when there is only one caption type
This removes the submenu indirection in Insert and the type changer in
contextual menu. Interestingly, the code was there, but it did not
work at all.
2016-08-19 14:07:08 +02:00
Kornel Benko
3c9d5d3cda Cmake build: Add verbose variable to some dummy_functions.cpp 2016-08-19 11:15:10 +02:00
Scott Kostyshak
0b1cf1330d Warn in GUI when mixing Title and InTitle layouts
Since we process layouts sequentially, we export LaTeX code for the
title once we arrive to a layout that has InTitle false. If the
document then later has a layout with InTitle true, we do not
(currently) go back to add it to the title and just output it
in-place. We previously warned with LYXERR0, but since this can
cause missing or unexpected output we now warn in the GUI.

For more information, see the following lyx-devel thread:
https://www.mail-archive.com/search?l=mid&q=a65ae226-d3bd-8fc5-a93b-7bb23f1cda82%40lyx.org
2016-08-18 18:06:04 -04:00
Enrico Forestieri
fb46b3a1ee Fix exit code from runCommand on Windows
On Windows, runCommand has never returned the exit code of the
spawned process but the result of correctly closing the input handle.

Fixes #10327
2016-08-17 22:58:13 +02:00
Enrico Forestieri
2a371bb4b3 Add verbose option
Using the option -v (--verbose) all spawned commands are print
on the terminal. Note that this was done by default on previous
versions.
2016-08-17 22:32:14 +02:00
Jean-Marc Lasgouttes
6e88c0062c Use proper QPalette::NoRole enum value instead of our own 2016-08-17 12:10:25 +02:00
Jean-Marc Lasgouttes
e194c9ce27 A more radical approach to inset background painting
Now by default all insets paint their own background when needed. This
means that 63cf3297 and part of 9940acc5 can be reverted.

To avoid extra painting, background drawing is disabled for
InsetCommand and InsetCollapsable. These insets draw background as
part of their normal drawing activity.

This will avoid drawing artifacts with InsetNewpage, InsetVSpace and
probably some others.
2016-08-17 12:05:00 +02:00
Jean-Marc Lasgouttes
6f82f51cbe A PainterInfo variable should be named `pi'. 2016-08-16 14:31:20 +02:00
Guillaume Munch
5ded0d002d Assertions when doing Export As... (#10321)
Fix assertion with gcc 6: The comparison function must be a strict weak
orderings and not give x < x.

Fix assertion when a custom exportable document format is given a non-ASCII
name. Use qt_ to be consistent with the rest of the code.

Use Qt's locale-aware comparison for appropriate sorting.
2016-08-15 13:23:29 +01:00
Enrico Forestieri
f323a64fc3 Adapt code to comment 2016-08-15 03:22:01 +02:00
Enrico Forestieri
7113fb669d Correct comment
According to C++11 rules, static locals are thread safe for
the first-time initialization.

See also:
http://stackoverflow.com/questions/12302057/c11-safe-double-checked-locking-for-lazy-initialization-possible
2016-08-13 17:43:03 +02:00
Scott Kostyshak
c949268da7 Improve a layout LYXERR0 message
The name of the layout is now included in an error message about
layouts. This will help with finding the root issue of several
documents we have.
2016-08-08 23:44:27 -04:00
Richard Heck
20328c4a44 Update tex2lyx tests. 2016-08-08 16:47:33 -04:00
Enrico Forestieri
41e409f8f7 Use std::call_once only if it is actually available 2016-08-07 04:58:41 +02:00
Richard Heck
3be23d18b6 Fix XHTML export of German Additional Features manual.
There was an oddity in the manual that exposed a problem with the
test for the "special case" of an inset all by itself in a pargraph.
If a font change is applied to that inset, we still need to open the
paragraph.
2016-08-04 22:43:17 -04:00
Richard Heck
0c1dd609f3 Debugging code. 2016-08-04 22:00:24 -04:00
Richard Heck
0a603c5d0e We don't need to crash here, but can try to continue in release
mode.
2016-08-04 22:00:18 -04:00
Richard Heck
f15c4159aa Special characters should be output to the TOC. 2016-08-04 21:09:32 -04:00
Richard Heck
8d65a6d277 Fix bug #10320.
Layout::write needs to allow for the possility that the name of the
style may contain a space. It seems sufficient just always to quote it.
2016-08-04 17:45:40 -04:00
Jean-Marc Lasgouttes
63cf3297f8 Let InsetSpecialChar draw its background when necessary
This is the same fix as in 9940acc5 for auote inset and math macro template.
2016-08-04 23:21:33 +02:00
Guillaume Munch
0e672fed21 Partially revert "Replace static with thread_local when used for caching"
As noticed by Stephan, clang on Mac is nowhere near to support thread_local for
some reason:
http://stackoverflow.com/questions/28094794/why-does-apple-clang-disallow-c11-thread-local-when-official-clang-supports

It does not look realistic to me to provide a configure-based alternative. The
solution is to not use thread_local until it is reasonably supported on
Mac. According to sources, this means requiring Xcode >= 8.

This reverts commit 82d4f1a446 partially.
2016-08-04 13:39:27 +01:00
Juergen Spitzmueller
90f6eb01a4 Include all [scr]article styles in beamer article layouts.
File format change. On format reversion, we need to put some extra code
in the local layout that emulates the 2.3 behavior.
Simply Input'ing the respective layouts is unfortunately not enough,
due to the insertion order.

See #9977
2016-08-04 11:42:06 +02:00
Juergen Spitzmueller
b9b9ad3f9e Correct backends() allocation with japanese encoding
Fixes error introduced by ad9887da9c.
2016-08-04 10:01:06 +02:00
Scott Kostyshak
52ae8fb22b Activate LyX window after reverse search (#10196)
"lyxclient -g" now calls the just implemented lyx-activate (see
previous commit) after server-goto-file-row. This allows the PDF
viewer to switch to LyX after executing a reverse search.
2016-08-04 01:46:15 -04:00
Scott Kostyshak
60515b996b New LFUN lyx-activate to focus LyX window
On Linux and Mac OS, this action brings the LyX window into focus.
Such behavior is not allowed by Windows OS so instead the color of
the taskbar entry is changed to indicate that the window has changed
in some way.

The action is hidden in the shortcuts menu because it would make
sense to assign a shortcut to it. The only way to execute shortcut
would be if the LyX window is already activated.

lyx-activate will be used (see next commit) to allow the PDF viewer
to switch to LyX after executing a reverse search.
2016-08-04 01:46:13 -04:00
Guillaume Munch
096afc733b Fix embarrassing logic mistake
Thanks Richard for pointing at it.
2016-08-03 22:17:26 +01:00
Richard Heck
16d39b1f83 Fix problem noticed by Scott. 2016-08-02 18:54:31 -04:00
Richard Heck
f1b748e42b No need to display contents of the branch when it is open.
Thanks to Vincent for noticing.
2016-08-02 16:33:18 -04:00
Guillaume Munch
82d4f1a446 Replace static with thread_local when used for caching
thread_local is a per-thread static variable, so it is thread-safe and can be
used for caching purpose.

Remove the cache for parameter lists as discussed on the list
http://mid.gmane.org/6e871431-0e87-ed2a-3e31-b63356c2391e@lyx.org.

(requires gcc >= 4.8)
2016-08-01 23:44:16 +01:00
Guillaume Munch
0090af19d3 Fix aliasing logic for polylines 2016-08-01 20:50:46 +01:00
Guillaume Munch
a584c8176d Enable to specify the target format for converting the local layout
* New constant LYXFILE_LAYOUT_FORMAT in src/TextClass.cpp. This determines the
  layout format corresponding to the current lyx file format.

* The Local Layout pane is changed so that the "Convert" button does not convert
  to the internal layout format but to the current lyx file format, to make sure
  that the file does not become unreadable with a specified earlier version of
  LyX.

* If LYXFILE_LAYOUT_FORMAT == LAYOUT_FORMAT then LyX behaves as before. This is
  the value defined in master.
2016-07-31 18:34:33 +01:00
Guillaume Munch
0a8b7f6a57 Perf comments: getFormatFromFile slows LyX startup considerably
It is currently called on hundreds of files: settings, layouts, icons, cached
graphics files (incl. graphics from files that are not opened on startup).

According to callgrind, fixing the FIXME comments could speed up startup by more
than 30%.
2016-07-31 18:34:33 +01:00
Guillaume Munch
22d7ba6424 Use call_once to ensure something is only called once
This is thread-safe.
2016-07-31 18:34:33 +01:00
Guillaume Munch
46d8dfc6c2 Make static counters atomic
This ensures thread-safety

(requires: gcc >= 4.6, MSVC >= 2015)
2016-07-31 18:34:33 +01:00
Guillaume Munch
2fd2e65745 C++11 supports thread-safe initialization of statics
A static local variable is guaranteed to be initialized only once, and in time.

Lambda expressions can be used to perform complex initialization of those static
variables on the spot.

(starting from: gcc >= 4.8, msvc >= 2015)
2016-07-31 18:34:33 +01:00
Guillaume Munch
4d7b912ca1 Fix "scroll here" feature of scrollbar (#10311)
Prevent setRange() from causing a recursive call to scrollTo(). Reduces three
calls of scrollTo() to one call for all scrolling functions of the scroll bar
(e.g. clicking on the arrow, dragging, or clicking somewhere on the scrollbar).
2016-07-31 18:34:33 +01:00
Guillaume Munch
bc8eb059db Basic implementation of QSignalBlocker for qt4 2016-07-31 18:34:33 +01:00
Richard Heck
98feadd61e Fix output of floats, etc, inside environments.
Fixes bug #9094.
2016-07-31 03:18:32 -04:00
Richard Heck
9e5a42edbf Rename, for a little clarity. 2016-07-31 03:03:26 -04:00
Richard Heck
07dcb1c525 Add 'dir="auto"' to the body tag for XHTML export. This should take
care of much of what we need to do for RTL languages. It does not
take care of inline language changes, probably.
2016-07-31 02:52:30 -04:00
Richard Heck
6fe499509a Alignment 2016-07-31 02:49:38 -04:00
Richard Heck
ab3a49973f Fix display of code listings in XHTML.
Fixes bug #8362.
2016-07-31 01:47:30 -04:00
Richard Heck
daf7cd4c05 Activate export of external material for XHTML.
As of this commit, this is ineffective, since no changes have been
made to external_templates.
2016-07-31 01:26:15 -04:00
Richard Heck
6b97f2c075 Fix substitution for $$Contents.
The second argument here is the length of the string to replace,
not the position of the final character.
2016-07-31 00:15:48 -04:00
Richard Heck
93a612220e Fix preview of external material with plaintext and DocBook. 2016-07-30 23:48:27 -04:00
Richard Heck
47c52db13e Use scaling factor in XHTML output. 2016-07-30 21:57:52 -04:00
Richard Heck
e1f597e3da If we cannot find the input format for a graphic, we cannot convert it.
Also includes some minor code cleanup.
2016-07-30 21:51:25 -04:00
Richard Heck
e2fa3cb6ef Fix output of table borders for XHTML. Fixes bug #10154. 2016-07-30 20:15:12 -04:00
Richard Heck
eeb6b5b153 Revert most of dd7863b6.
I did not mean to commit the caption-related stuff.
2016-07-30 01:42:08 -04:00
Richard Heck
aad0802b53 Whitespace. 2016-07-30 01:35:22 -04:00
Richard Heck
dd7863b6ac Fix thinko from earlier commit.
We need to output the deferred material AFTER the paragraph is closed.
2016-07-30 01:29:06 -04:00
Richard Heck
60ce2b7570 Fix HTML display of math matrices. 2016-07-30 00:25:09 -04:00
Richard Heck
752c89ae13 Fix CSS for math cases.
Fixes bug #8755.
2016-07-30 00:15:47 -04:00
Richard Heck
50c1391950 Simplify CSS classes for floats.
Fixes bug #8605 and probably parts of #8755 and #9328.
2016-07-30 00:03:35 -04:00
Richard Heck
f1cd24243f Be more careful with braces, due to comments. 2016-07-29 23:59:24 -04:00
Richard Heck
76e6c77825 Simplify and unify code for special handling in argument insets. 2016-07-29 23:38:51 -04:00
Richard Heck
96a8156557 Fix display of colors in labels of arguments.
We need to handle this specially, just as we do the main font.
2016-07-29 23:36:48 -04:00
Richard Heck
cbbae06c9b Fix display of branch buttons and tooltips. 2016-07-29 22:58:03 -04:00
Scott Kostyshak
c659fd4f74 Remove the now unused lyx::support::expandPath()
The function is no longer used in LyX's sources (as of the previous
comit, 9b64d7bd) and is thus removed with this commit. Perhaps the
advantage this function had over other path functions we have has
disappeared over time (see e.g. 1a7b7f65).
2016-07-29 13:17:09 -04:00
Scott Kostyshak
9b64d7bd24 Rel. path in paths prefs preserved as rel. paths
Before this commit, in the paths preferences tab if you put a
relative path, LyX would convert it behind the scenes to an absolute
path by evaluating the relative path with respect to the working
directory of the LyX instance where the preference change is taking
place. This seems confusing because (1) it is done behind the scenes
(after the preferences dialog is closed) and (2) if the user chooses
to enter a relative path, the safest thing to do is to preserve it
as a relative path, instead of making the assumption that the user
intended for it to be expanded to an absolute path.

An explanation of how relative paths are handled is given at the
bottom of the paths tab. Note that the height/width of the
preferences window is not changed as a result of adding this
explanatory comment because the height of the preferences dialog is
already stretched by other tabs.

This commit improves consistency in the sense that the behavior of
LyX is now the same when a relative path is specified in the
preferences dialog as when it is manually specified in the
preferences file. Before, if the preferences file were manually
edited and a relative path were inserted, the next time the user
made a change to preferences with the GUI (even if the preference
change was a different preference, e.g. instant preview), the
relative path would be silently converted to an absolute path,
evaluated with respect to the working directory of that instance.

Beyond improving clarity and consistency (IMO), this commit allows
for a new feature to be implemented of using relative paths in the
paths preferences. For example, the user may now enter '.' as the
"Working directory" path and now whenever they start LyX from a
directory and create a new file, the default location of the file
will be the directory from which they started LyX, instead of the
user's home directory which is LyX's default and is less intuitive.

No prefs2prefs work is needed because if a relative path were
entered in the preferences dialog before this commit, it was
converted to an absolute path before being stored in preferences. If
a relative path were specified by manually editing the preferences
file, then (unless the path were already automatically converted to
an absolute path by a GUI preferences change, as described above)
the behavior will be the same (the path will be treated as a
relative path).

For related discussion, see the lyx-devel thread here:
https://www.mail-archive.com/search?l=mid&q=20160616003010.bnymtcouar7g55ti%40cotopaxi

This commit removes the last use of lyx::support::expandPath() in
LyX's sources.
2016-07-29 13:13:55 -04:00
Scott Kostyshak
60e8921349 Const a function parameter 2016-07-29 13:09:54 -04:00
Scott Kostyshak
badb0bb96c Improve implementation of TabWorkArea::posIsTab()
The Qt documentation states that tabAt() returns -1 if the position
is not over a tab. This behavior has been consistent since Qt 4.3
[1]. This commit's improvement likely makes the code faster in two
ways:

(1) we do not need to loop through potentially all tabs
(2) we only need to look up the tab index corresponding with one
position

posIsTab() is not currently used intensively so no practical gain in
speed is achieved, but it protects against future use.

[1] https://doc.qt.io/archives/4.3/qtabbar.html#tabAt
2016-07-29 13:09:48 -04:00
Scott Kostyshak
4803c7697b Close a tab on middle-click (#10288)
This is the default behavior of Chromium and Firefox. The main
appeal is that instead of having to precisely click on the 'x' to
close a tab, one can more easily middle-click anywhere in the tab.

The tab is closed if the middle button is pressed on a tab and is
relased on the same tab. After pressing, the user may move the mouse
over other tabs but as long as they move it back to the tab where
they initiated the press before they release, the close will
execute. This is how the feature works in Chromium and Firefox.

Nothing is done if the user middle-clicks on the blank part of the
tab bar. This is consistent with Chromium. Firefox, on the other
hand, opens a new tab. In LyX one can already double-click the blank
part to open a new tab, and in feedback from lyx-users [1] most
expected and desired that nothing be done in this case.

[1] https://www.mail-archive.com/search?l=mid&q=20160720063306.6fyarf3kywexbxvd%40steph
2016-07-21 22:31:29 -04:00
Scott Kostyshak
b236450e61 Factor out useful code into a function
This code will be shared by TabWorkArea::mouseReleaseEvent,
which will be implemented shortly.
2016-07-21 22:31:29 -04:00
Scott Kostyshak
07be240ebe Add comment that a code chunk is unnecessary
A chunk of code in an event handler seems to be unnecessary to me
because the event that the situation handles never makes it this far
in the event handling hierarchy. I'm not sure why this is, and thus
I'm not sure if this is true in all cases (e.g. Qt version) and if
it will be true in the future so I leave this code for now.
2016-07-21 22:31:29 -04:00
Jean-Marc Lasgouttes
71374b38c2 Recompute Paragraph::beginOfBody() earlier
In redoParagraph, this should be done before coping with the insets,
other wise some graphic gliches may occur. This is a better fix for

Fixes bug #10163.
2016-07-21 10:21:45 +02:00
Jean-Marc Lasgouttes
b9c7594167 Revert "Reset beginOfBody() when changing paragraph layout"
This reverts commit ef8e499821.
2016-07-21 10:15:39 +02:00
Jean-Marc Lasgouttes
ef8e499821 Reset beginOfBody() when changing paragraph layout
This looks like a trivial thing to do, and it avoids some drawing problems.

Fixes bug #10163.
2016-07-21 01:56:22 +02:00
Jean-Marc Lasgouttes
c73923c519 When painting only insets, paint also change and language marks
Fixes bug #8133.
2016-07-20 23:25:17 +02:00
Kornel Benko
64b2989020 Cmake build with Qt4: Link lyx executable also to X11 library
With the commit cb0c881 we reference XSendEvent in X11-lib
if qt uses X11.
For QT5, this library is pulled by Qt5X11Extras, but
for QT4 we have to add it too.

Spotted by Scott Kostyshak.
2016-07-20 02:10:23 +02:00
Jean-Marc Lasgouttes
9940acc506 Try to fix #4889 in the right way
For reference, the bug was that quote insets grew bolder because, when
painted over themselves, anti-aliasing made them darker.

It turned out that the fix there created others than were
painstakingly fixed: #7164, #7165, #7174, #7193... More recently, it
created other problems:
http://article.gmane.org/gmane.editors.lyx.devel/163471

We use the right fix here:
* draw background of quote inset when not doing full repaint
* draw background of math macro template when not doing full repaint
* remove hack that grew from #4889 fix.
2016-07-20 00:24:24 +02:00
Jean-Marc Lasgouttes
e35110eab7 Realize inset argument label font before using it 2016-07-19 22:29:57 +02:00
Scott Kostyshak
3826ff6434 Improve documentation of LFUN_BUFFER_ZOOM_{IN,OUT}
The default for ZOOM_OUT is -20 from a user perspective. That is,
the following are equivalent:

  buffer-zoom-out -20
  buffer-zoom-out

The reason for this is that the argument to ZOOM_OUT is treated the
exact same way as ZOOM_IN. The only way they differ is how the
default case is handled.

This commit also clarifies that (1) the argument may be positive or
negative and that (2) the argument is interpreted as percentage
points, not percent.
2016-07-19 02:11:27 -04:00
Richard Heck
b0963b1b60 Fix cut and paste error in last commit.
Also, we can just realize the font ourselves here.
2016-07-18 13:53:40 -04:00
Richard Heck
3203fb1c5f Do not crash is release mode if we stumble across an unrealized font. 2016-07-18 13:01:42 -04:00
Richard Heck
7575ad159b Revert "Do not crash is release mode if we stumble across an unrealized font."
This reverts commit c560e6b3a6.

I did not mean to comit the changes to the gmo files.
2016-07-18 12:59:32 -04:00
Richard Heck
c560e6b3a6 Do not crash is release mode if we stumble across an unrealized font. 2016-07-18 12:56:20 -04:00
Jean-Marc Lasgouttes
8884c4044d Add feedback in status bar when zooming
Moreover enforce better the lower limit of 10 and avoid overflow due
to unsigned int.

Fixes bug #10212.
2016-07-18 17:03:54 +02:00
Juergen Spitzmueller
858f6b6c7b Whitespace. 2016-07-18 16:28:12 +02:00
Jean-Marc Lasgouttes
d654c4782a Typo 2016-07-18 16:24:06 +02:00
Jean-Marc Lasgouttes
7e997c193e Remove obviously wrong documentation in Painter.h 2016-07-18 16:17:38 +02:00
Jean-Marc Lasgouttes
2306fca659 Some things did not need to be mutable after all 2016-07-18 14:34:08 +02:00
Jean-Marc Lasgouttes
097ab41c49 Remove mutable variable InsetTabular::offset_valign_
Introduce instead a function Tabular::offsetVAlignment() that does the
same thing.
2016-07-18 12:37:14 +02:00
Jean-Marc Lasgouttes
31120694d9 Get rid of InsetTabular::first_visible_cell_
The code that uses it has been commented out since 2004. It is time to
delete it.
2016-07-18 12:26:06 +02:00
Jean-Marc Lasgouttes
61188464b4 Simplify display of InsetQuote
The code that specializes for double elements in the display string
does not trigger anymore: displayString() returns a single unicode
value, plus some space for french guillemets.

Use a thin space for these french quotes instead of a plain space and
remove special case in metrics().
2016-07-18 12:17:01 +02:00
Richard Heck
fb84ccd9fb The way this was previously, it had to fail if the GUI language
was not English: We return the the abbreviated author "One and Two",
but translated to the GUI language; then we search that for " and "
in order to pull the authors apart again.

I've just replaced the distinct routines with a single one that handles
both cases, depending upon whether a Buffer is provided as one argument.
2016-07-17 22:50:17 -04:00
Richard Heck
d5633f17e5 Fix thinko that led 2-authors citations to be displayed with "et al." 2016-07-17 22:31:54 -04:00
Guillaume Munch
10f6eb2e7e LaTeX highlighter: make at a letter in the user preamble
Syntax highlighting now provides the appropriate cue that the user preamble is
inside \makeatletter…\makeatother.
2016-07-15 17:51:18 +01:00
Guillaume Munch
1f2d7f4db9 Better error message when try to bind a Hidden LFUN 2016-07-14 20:53:12 +01:00
Guillaume Munch
eb8c5905f6 Prioritize the shortcuts from the work areas
* Fix bug #10261 : KDE smartly adds conflicting accelerators.

* Prevent bugs like #9495 in the future.

Issues (non-regression):

* It does not appear possible to prevent Ubuntu's Unity from grabbing the
  accelerators for the menus. For instance Alt+A still opens _Affichage in the
  French localization.
2016-07-14 20:50:10 +01:00
Richard Heck
c4ef96c030 Citation commands do not absolutely have to start with "c". 2016-07-13 14:25:46 -04:00
José Matos
b41300d819 Fix typo 2016-07-13 16:46:52 +01:00
Guillaume Munch
3099248115 Branch-invert: Fix discrepancy with the outliner and document statistics 2016-07-12 14:28:12 +01:00
Guillaume Munch
0fba5c4e8b Branch-invert: Record undo and update Toc 2016-07-12 14:27:40 +01:00
Guillaume Munch
6f97684d56 Branch-invert: Add a check mark to the switch in the contextual menu. 2016-07-12 14:27:08 +01:00
Guillaume Munch
5d292fce2d UI for save_transient_properties
Add a new checkbox "Save transient properties" to the "Output" panel in the
document properties dialog (now renamed as "Format").

This provides the front-end for the change at 5c2d04999.
2016-07-12 11:27:11 +01:00
Richard Heck
e1ca7733c3 LFUN to toggle branch inversion status, now available from the
context menu.
2016-07-12 00:19:40 -04:00
Richard Heck
5df323a0dd Introduce "inverted" branch insets: These are branches whose content
is output when a branch is NOT activated. Fixes bug #7698.

At the moment, inversion is controlled through the branch settings
dialog. There is no provision for inserting inverted insets directly,
or for changing them from the context menu. Both of these could be
done, of course. The latter would need LFUN_BRANCH_TOGGLE_INVERTED.
2016-07-11 23:56:32 -04:00
Kornel Benko
59ac7ce660 Cmake build: Add needed libraries if using QT5_Extras
Commit cb0c881 does this already for automake.
2016-07-11 19:08:11 +02:00
Juergen Spitzmueller
ad9887da9c Simplify BufferParams::bufferFormat()
The differentiation of "xetex" and "platex" is not needed here,
is ambiguous and confusing (see #10013). The code that relies on
it can/should get its information otherwise.

Furthermore, polyglossia-exclusive languages now also work with
LuaTeX, since we support LuaTeX + polyglossia.
2016-07-11 11:18:55 +02:00
Enrico Forestieri
cb0c881b02 Fix paste of selection to (unfocused) external applications
With both Qt4 and Qt5, when using a click-to-focus policy, the first
attempt to paste a selection by middle mouse in an external application
which has no focus may fail. It is not clear why this succeeds for some
applications and fails for others, but refreshing the timestamp of the
selection request cures the issue. The cmake part is by Kornel.

See also this thread:
http://thread.gmane.org/gmane.editors.lyx.devel/162491
2016-07-10 19:31:32 +02:00
Juergen Spitzmueller
65173b26d5 Generate a proper error dialog title for XeTeX/LuaTeX
(see bug #10013)

Candidate for stable
2016-07-10 11:14:03 +02:00
Juergen Spitzmueller
6bcbd907a4 Clarify some comments wrt XeTeX/LuaTeX (see bug #10013) 2016-07-10 11:13:13 +02:00
Richard Heck
74809e53a7 Delete obsolete comment: We no longer support Qt < 4.4. 2016-07-10 01:43:56 -04:00
Richard Heck
2104d41f71 Simplify logic a bit. (This was meant to be part of a previous
commit.)
2016-07-10 01:43:19 -04:00
Richard Heck
d8aab4af9e Fix thinko in Buffer::preview. It is possible for this routine to
be called when we do not have a cloned Buffer, namely, if we do not
have EXPORT_in_THREAD defined.
2016-07-10 01:12:42 -04:00
Richard Heck
b3ab0190c1 Rename some variables and routines. 2016-07-10 00:00:03 -04: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
Richard Heck
2b87026bf9 Update XHTML debugging code a bit. 2016-07-09 23:54:44 -04:00
Richard Heck
db954caf8b Write magic paragraph label to main paragraph tag. 2016-07-09 23:54:44 -04:00
Juergen Spitzmueller
97b9e81cee Fix for recent luatex versions. 2016-07-09 16:45:27 +02:00
Guillaume Munch
3e6df97963 Accessibility of document class combo box (#10035)
* Access it with tab

* Access it with the accelerator from the title of the group
2016-07-08 13:27:06 +02:00
Jean-Marc Lasgouttes
5a3401c66e Revert "Skip all drawing with NoScreenUpdate strategy"
This reverts commit b874bdfd40.

It was commited by mistake and actually does not seem to improve
performance.
2016-07-07 14:22:08 +02:00
Jean-Marc Lasgouttes
b874bdfd40 Skip all drawing with NoScreenUpdate strategy
It seems that it was needed in 0b0c27ef, but nowadays the metrics are
not touched when we set this strategy.
2016-07-06 11:32:54 +02:00
Jean-Marc Lasgouttes
86c33c96a0 Record undo when deleting end of paragraph in change tracking mode
Fixes bug #10253.
2016-07-05 16:26:11 +02:00
Jean-Marc Lasgouttes
be1c3f5fe3 Poor man's profiler: add support for cache hit/miss
This is still very basic profiling, but it seems to get the work done.
2016-07-05 15:31:17 +02:00
Guillaume Munch
f6bd79745e Revert c6ce76c2 and fix 670efa8f
Thanks Stephan
2016-07-05 12:07:36 +02:00
Enrico Forestieri
697580006e Bring window to front only for single-instance mode
A window manager could be configured such that to maintain a certain
stack order for the windows. It would be annoying that opening a new
file through menu brings up the window, so do this only if we are
loading a file through the lyx-server.
2016-07-05 01:01:02 +02:00
Pavel Sanda
d13048c7f5 fix make check. 2016-07-04 14:10:30 -07:00
Stephan Witt
c6ce76c2fb Fix missing TexRow.h include after change 670efa8f64 2016-07-04 20:37:06 +02:00
Stephan Witt
6c4f30b193 Add missing include for abs(int) 2016-07-04 20:36:16 +02:00
Stephan Witt
ac4cca6ed4 Fix missing includes after change 670efa8f64 2016-07-04 12:11:24 +02:00
Stephan Witt
d246aa7af5 Fix missing include for endl after header cleanup in change 670efa8f64 2016-07-04 11:04:53 +02:00
Stephan Witt
df73cade2b Fix missing include for file i/o prototypes after header cleanup in change 489dca71cd 2016-07-04 10:30:19 +02:00
Stephan Witt
b035528c1c Fix missing include for malloc prototype after header cleanup in change 489dca71cd 2016-07-04 08:33:03 +02:00
Guillaume Munch
e90e80a2f6 Amend 670efa8f
Lost in rebasing.
2016-07-04 04:43:22 +02:00
Guillaume Munch
670efa8f64 Rationalise includes
Modifying TexRow.h or texstream.h no longer triggers the recompilation of the
complete source tree.
2016-07-04 02:42:17 +02:00
Guillaume Munch
a5ba0b9d30 Match code with comment
The line felt too thin.

Note: I am still sceptical with the principle of an increase at the rate of
1/200% instead of 1/100%.

Also, I am sceptical with changing painting dimensions to int when Qt supports
doubles for everything (see e.g. 463bd17d). If the goal is to force
integer-width solid lines then one could try to disable antialiasing on Qt's
side.

I think the painter should move in the other direction, towards more doubles and
fewer ints. For instance, for Hi-DPI, Qt could probably take advantage of the
increased precision even without AA. (Then one would have to fix the problem
regarding uneven lines, mentioned in the above commit, in another fashion.)
2016-07-04 01:26:13 +02:00
Guillaume Munch
f151b932c2 Change tracking cue: InsetText and InsetCollapsible
* Underline or strike through the label as if it was text (it is).

* Strike through deleted InsetText, but let RowPainter handle the case of
  non-MultiPar text insets.

* Change the colour of the frame as a cue, unless its colour is customised (not
  Color_foreground). (Essentially do the border of CharStyles like Tabular does
  it already.)

* The change info needs to be reset when entering InsetText. Otherwise labels
  are painted with the change of their n+1-th parent.
2016-07-03 23:38:37 +02:00
Enrico Forestieri
16ec606ab4 Bring window to front after loading a document
Fixes #7875.
2016-07-03 22:58:25 +02:00
Georg Baum
0f2dc7d0a7 Fix regression of 6dfc25508
We need to remove the temp file now manually.
2016-07-03 19:41:04 +02:00
Guillaume Munch
325fbab463 Change tracking cue: for Graphics
Strike through deleted graphics.
2016-07-03 17:28:47 +02:00
Guillaume Munch
8e1a869c45 Change tracking cue: for instant preview
Strike through deleted previews (expect for inline math where it is already taken care of by RowPainter).
2016-07-03 17:28:47 +02:00
Guillaume Munch
de786bfcdf Change tracking cue: for display() math insets
Strike through deleted display math insets.
2016-07-03 17:28:46 +02:00
Guillaume Munch
28f6c312a9 Painter: Add a line style to disable antialiasing
It is not possible to use opacity effects (such as drawing an antialiased line
to strike diagonally through an inset), until the painter is fixed so that it
does not redraw repeatedly over the same spot (otherwise, the usual aritfacs
appear).

For now, pixellated lines are OK.
2016-07-03 17:28:46 +02:00
Guillaume Munch
4089ff1ec3 Beautify ToolTips in work area
* Justification and nicer line breaks.

* Much nicer tooltip for lists of bibliographical references.

* Removed unnecessary iterated copies of the string buffer in
  InsetText::ToolTipText() which looked bad. This function used to be costly
  (cf64064), maybe it is quicker now.
2016-07-03 17:28:46 +02:00
Guillaume Munch
d1dddde6d8 Remove tooltips from the data of Toc Items
After the previous commit, tooltip in the outliner are formatted automatically,
along with the other tooltips. A previous commit had already removed the
expensive call to tooltipText() that, although it gave a better rendering, was
very expensive (cf64064). This patch finishes to remove the custom tooltip
from the model data in the outliner.

(It would be nice to reintroduce a tooltip based on tooltipText(), but there
seemed to be a consensus that in that case one would prefer a less expensive
approach that computes the tooltip on the fly.)
2016-07-03 17:28:46 +02:00
Guillaume Munch
8cf138e173 GuiDocument: some polishing of the list of modules.
* The tooltips in the list of modules now include the names of the modules.

* The tooltips of modules more consistent across the widgets.

* Sort the list of modules according to the locale (i.e. "É" comes before "F").

* Replace a hand-made sentence boundary finder by Qt's.
2016-07-03 17:28:46 +02:00
Guillaume Munch
ee72e9520a Remove manual line breaks.
Line breaks in tooltips are now done automatically, there is no more need to
break the strings explicitly.
2016-07-03 17:28:46 +02:00
Guillaume Munch
059ca0f691 Line breaks in tooltips
* New function formatToolTip(QString):

Format text for display as a ToolTip, breaking at lines of a certain
width. Note: this function is expensive. Better call it in a delayed manner,
i.e. not to fill in a model (see for instance the function
ToolTipFormatter::eventFilter).

* Install a global event filter that formats tooltips on-the-fly

Inspired from
3793fa09ff
but much improved.

When is formatToolTip called automatically? Whenever the tooltip is not already
rich text beginning with <html>, and is defined by the following functions:
 * QWidget::setToolTip(),
 * QAbstractItemModel::setData(..., Qt::ToolTipRole),
 * Inset::toolTip() (added in one of the subsequent patches)

In other words, tooltips can use Qt html and the tooltip will still be correctly
broken. Moreover, it is possible to specify an entirely custom tooltip (not
subject to automatic formatting) by giving it in its entirety, i.e. starting
with <html>.
2016-07-03 17:28:45 +02:00
Guillaume Munch
489dca71cd Simplifications, mainly removal of boost::function and useless std::bind 2016-07-03 01:39:32 +02:00
Richard Heck
bc1672f6a0 Squash some warnings. 2016-07-02 14:12:49 -04:00
Georg Baum
6dfc255088 Fix CAS input on windows (bug 10262)
This is the well known file locking problem: The TempFile class keeps the
created file locked for the own process, and this prevents the CAS to read it.
2016-07-02 18:58:30 +02:00
Stephan Witt
1440b6a2fc Compile fix after change 4b64aaf, replace missing constructor for C-string with docstring variant 2016-07-02 08:30:34 +02:00
Stephan Witt
994844cb34 Correct indentation 2016-07-02 08:30:34 +02:00
Richard Heck
45e3a8f827 Squash warning. 2016-06-30 23:01:13 -04:00
Richard Heck
ddda136924 The previous commit was actually a fix for bug #9158.
This adjusts the comment a bit.
2016-06-30 15:02:09 -04:00
Richard Heck
02847641a8 Fix bug #8782.
We need to invalidate the BibTeX cache when undoing or redoing. I do
not like having to do it for every undo or redo. We should only have
to do it if we restored or deleted an InsetBibTeX. But there is no
way, so far as I can see, to do it that way. I tried.
2016-06-30 14:57:08 -04:00
Richard Heck
08bf9781ee ABOVE and CENTERED labels need special treatment.
Fixes bug #8843.
2016-06-29 23:55:11 -04:00
Richard Heck
a8aa7feb89 Make sure we center displayed equations. 2016-06-29 23:18:57 -04:00
Richard Heck
277ac31278 Use convertDelimToXMLEscape with matrix delimiters, too. 2016-06-29 22:52:27 -04:00
Richard Heck
e3625b5b80 Add class attribute for \mathbb in XHTML output.
Patch from Josh.
2016-06-29 22:47:21 -04:00
Richard Heck
04b8f5cdc4 Use symbols file to lookup entities for delimiters. Fixes bug #8280.
Based upon work by Josh Hieronymus.
2016-06-29 22:39:42 -04:00
Richard Heck
8ea3d1f130 Don't be so cute with VSpace: We just output it inline now for
XHTML.

Fixes bug #8154.
2016-06-29 21:57:35 -04:00
Richard Heck
ddc28f0374 Output column width info for XHTML. 2016-06-29 21:47:51 -04:00
Richard Heck
f49556b3ed Fix bug #8782: We need to query the cell, not just the inset. 2016-06-29 21:23:39 -04:00
Richard Heck
6ecb05e6ea Add missing buffer update after pasting unformatted text.
Fixes bug #8735.
2016-06-29 13:32:30 -04:00
Richard Heck
499fc04c9a Use const &. 2016-06-29 12:51:55 -04:00
Richard Heck
fd4645c912 Whitespace only. 2016-06-27 18:54:14 -04:00
Richard Heck
4b64aaf4ce This patch does two closely related things.
The main thing it does is integrate mouse-modifiers into the
FuncRequest machinery. Previously, these had to be passed
separately, which led to some ugly function signatures.

There was also an unnecessary form of the constructor, which
can now be removed.

No change of behavior is intended.
2016-06-27 18:16:35 -04:00
Richard Heck
f46a52d97f Let "provides [fontspec|listings|subfig] 1" work. 2016-06-27 17:18:19 -04:00
Guillaume Munch
7d456a93e4 Use move when passed by value
Also unduplicate code.
2016-06-26 19:38:16 +01:00
Georg Baum
14fa2c7162 Remove using directives from headers
The only exceptions are:

- The purpose of the header is to drag in the used symbol, e.g. unique_ptr.h
- The used symbol is inside a class or a namespace other than lyx

The reason for this is that global 'using' statements effectively forbid to
use the used symbols in any other namespace in the whole program, since simply
adding or removing an #include of the corresponding header subtly changes the
name lookup. The namespace lyx is sort of global, so it should not have these
statements either.
2016-06-26 18:22:59 +02:00
Enrico Forestieri
458d2015dc Make command buffer icons same size as QLineEdit height
Part of bug #10125
2016-06-26 16:58:18 +02:00
Enrico Forestieri
f56ee1875c Make oultliner icons same size as the toolbar icons
Part of bug #10125
2016-06-26 16:53:00 +02:00
Juergen Spitzmueller
57b69a5efd Merge branch 'master' of git.lyx.org:lyx 2016-06-26 14:27:30 +02:00
Juergen Spitzmueller
ecc90a9a79 Fix indentation 2016-06-26 14:26:35 +02:00
Enrico Forestieri
3c6f2427c3 Tweak output from maxima
Maxima uses \it as a markup for multiletter variables. However,
it has been reported that since texlive 2016 using \it in math
mode produces an error, even though I was not able to reproduce.
Anyway, this can be avoided by replacing the old-style construct
"{\it ...}" with the new-style one "\mathit{...}".
The problem has also been reported upstream:
https://sourceforge.net/p/maxima/bugs/3181/
but this workaround will hold whatever the resolution.
2016-06-26 13:22:44 +02:00
Georg Baum
deaaf9bfe2 remove unused declaration 2016-06-25 20:32:07 +02:00
Richard Heck
dafb1c5bb6 Fix for previous commit: We come right back through here from
exportBufferAs, so we need to make sure we haven't been given
an export location.
2016-06-25 00:38:27 -04:00
Scott Kostyshak
459a9d1a8f Whitespace 2016-06-24 22:27:29 -04:00
Richard Heck
b6d182b81a Fix bug #8814: Ask for place to export a file if it has not
yet been saved.
2016-06-25 03:05:42 +01:00
Richard Heck
152817576a By default, charstyles should not permit layout changes internally.
Fixes #10237.
2016-06-21 15:40:35 -04:00
Georg Baum
c4ab621088 more const correctness
The const_cast shows the place where const correctness is violated, this is
no longer hidden by lying member functions.
2016-06-21 21:10:52 +02:00
Richard Heck
539258273d Remove "only", which is not really necessary. 2016-06-21 14:43:52 -04:00
Richard Heck
3573b7270c Fix bug #10213 as discussed there: We now display the same button
whether the branch is open or closed.
2016-06-21 14:43:52 -04:00
Georg Baum
a4b8094aac const correctness
It is dangerous to hand out non-const pointers to members from a const method.
2016-06-20 22:00:05 +02:00
Richard Heck
35d449c5da Fix bug #10153: There's a mechanism in XHTML output that defers the
output of tags until we know they're needed. In the case of HTML
tables, empty cells should of course be output, so we need to force
the tags to be output.
2016-06-20 10:22:50 -04:00
Georg Baum
d66d6f7805 Remove external date inset
The external date inset was implemented as a demonstrator for external insets
in general. It was never intended for production code. Now that we have several
external insets defined we do not need the demonstrator anymore. This fixes
bugs #4398 and #9948.
2016-06-19 21:23:25 +02:00
Stephan Witt
4bc2877e8a Always present Qt version info in LyX About dialog - not for developer version only 2016-06-19 11:53:20 +02:00
Richard Heck
066cc0c9c0 Fix typo, and also check if string is null. 2016-06-18 18:33:45 -04:00
Richard Heck
68b60ec529 Be a bit more careful about setting and restoring the last reference
when we go to and return from labels.
2016-06-18 18:27:51 -04:00
Georg Baum
bf49ea32c2 Do not distribute built sources
Implementation stolen from ff17b366a0
2016-06-16 21:34:38 +02:00
Georg Baum
1a79538725 Remove obsolete comments 2016-06-16 21:05:27 +02:00
Georg Baum
c737f1cddf Remove InsetMathXYArrow
This was dead code that did never work, and most of it was boilerplate that
you can steel in 15 minutes from any existing math inset. Apart from that it
did contain a pointer to InsetXYMatrix which would create the same problems
we saw with the macros.
2016-06-16 20:39:32 +02:00
Georg Baum
8e9321dec2 Amend 10b4a47185 2016-06-16 20:25:43 +02:00
Georg Baum
10b4a47185 Expose python 3 support to some testing
LyX will now always use the default python interpreter. This will hopefully
help us sto see if one of them fails in some cases.
2016-06-16 20:22:40 +02:00
Guillaume Munch
c76e0f1153 Make latex highlighter colors compatible with dark theme
Partial fix for #8325
2016-06-15 19:42:06 +01:00
Guillaume Munch
52dd5dc84f Fix compilation with gcc 4.6 part II 2016-06-15 14:42:34 +01:00
Richard Heck
ff4005de68 Whitespace. 2016-06-15 00:23:53 +01:00
Richard Heck
0fa905ceab Replace coverity comment with assertion. 2016-06-14 18:26:08 +01:00
Guillaume Munch
b148629d56 Fix compilation with gcc 4.6 2016-06-14 16:44:40 +01:00
Guillaume Munch
947c34364c Fix bug #10195
The computation of the index of the main text entry of a row did not take into
account the fact that the entry could be optimised away.
2016-06-14 16:44:40 +01:00
Guillaume Munch
b7abd752fa amend 6144bbfb 2016-06-14 01:34:16 +01:00
Guillaume Munch
aef8746712 amend e2bc7ffa 2016-06-14 00:21:26 +01:00
Guillaume Munch
b2b8733096 Remove a conversion to_utf8() inside FontSetChanger
This requires to change many docstrings into std::strings. The logic behind that
is that they represent a fixed set of math fonts, and therefore “string” means
here “poor man's enum” rather than text (this is consistent with MetricsBase).

Profiling of scrolling inside a document over macro-instensive areas:

Before the patch:
  44,1% BufferView::updateMetrics()
   -> 34,8% InsetMathHull::metrics()
     -> 9,8% FontSetChanger::FontSetChanger()
  28,4% BufferView::draw()

After the patch:
  35,3% BufferView::updateMetrics()
   -> 27,2% InsetMathHull::metrics
     -> 0,4% FontSetChanger::FontSetChanger()
  47,5% BufferView::draw()

FontSetChanger::FontSetChanger() is made 41x less expensive (with reference
BV::draw()) just by removing this conversion. The remaining 0,4% could be
squished by replacing the strings with a proper enum, but this is premature. Of
course, this only treats the symptoms: there is no good reason that this
function is called 45500 times over the time of 40 repaints.
2016-06-13 08:46:15 +01:00
Guillaume Munch
325c476bcb ScrollbarParameters: clean-up and document
Position is always 0.
2016-06-13 08:46:15 +01:00
Guillaume Munch
0e3c8ba627 Fix computation of scroll value 2016-06-13 08:46:15 +01:00
Guillaume Munch
d2d243d77f Simplify the TexRow information for mathed output
Replace the manual manipulation of a stack of RowEntries with a Changer
function. When I introduced the stack of RowEntries, I did not know about the
Changer mechanism.
2016-06-13 08:46:15 +01:00
Guillaume Munch
348e0241af Do not include MetricsInfo.h in MathStream.h
Fixes the FIXME in MathStream.h
2016-06-13 08:46:15 +01:00
Guillaume Munch
760bca8265 Change tracking cue: paint over labels in text and prepare for further work
* Inset::canTrackChange() had two meanings: can it deal with change tracking?
  Will it paint its own CT status? The latter information is now given by
  Inset::canPaintChange().

* Line thickness computation is moved from RowPainter to MetricsBase.

* Painting function for Changes moved to lyx::Change. (One new, that strikes
  diagonally.)
2016-06-13 08:46:15 +01:00
Guillaume Munch
e2bc7ffae3 RefChanger
RefChanger temporarily assigns a value to a non-const reference of any
kind. RefChanger provides a flexible and uniform generalisation of the various
scope guards previously derived from the old Changer class in MetricsInfo.h.

As before, a temporary assignment lasts as long as the Changer object lives. But
the new Changer is movable. In particular, contorsions are no longer needed to
change a private field. Special code can be moved into the appropriate classes,
and it is no longer necessary to create a new class for each specific use.

Syntax change:

   FontSetChanger dummy(mi.base, value);
-> Changer dummy = mi.base.changeFontSet(value);

New function for generating arbitrary Changers:

  Changer dummy = make_change(ref, val, condition);

Bugfix:

* Fix the display of \displaystyle{\substack{\frac{xyz}{}}} (missing style
  change).
2016-06-13 08:46:15 +01:00
Guillaume Munch
0be52d3710 ShortcutOverride again
Re: fix for #9218 (not #10119)

Now it matches the example given in the docs. This time tested on qt4.
2016-06-13 08:46:15 +01:00
Guillaume Munch
881b7ec673 Remove that pesky broken window that pops up with Qt5 when saving preferences
It turns out this show event is not necessary (tested with Qt4.8 and Qt5)
2016-06-12 19:17:33 +01:00
Guillaume Munch
89175ee0f1 Add perf comment 2016-06-12 19:17:33 +01:00
Guillaume Munch
aedc6720c7 Toc: clean-up 2016-06-12 19:17:33 +01:00
Guillaume Munch
6144bbfbf8 Replace foreach with for
C++11 allows foreach-style iterations with the following syntax:

for (auto & element : container) {
 ...
}
2016-06-12 19:17:33 +01:00
Guillaume Munch
32ff5f0f30 climits
It's as you prefer, Jean-Marc.
2016-06-12 19:17:33 +01:00
Stephan Witt
a80e0cacb9 Use iostream instead of sstream and move it from header to cpp-source of LyX-Server 2016-06-12 13:03:06 +02:00
Richard Heck
fa190691a8 When we use InPremable styles, we want to write as many versions
to the premable as the user enters.
2016-06-12 00:58:33 -04:00
Richard Heck
e622f82521 Add comments to fix coverity #23505 and 23507. 2016-06-12 00:35:49 -04:00
Richard Heck
4152c68c66 Add comment to fix coverity #111935. 2016-06-12 00:31:33 -04:00
Richard Heck
a48adfa6d6 Fix coverity issue #127197.
We may fail to get a buffer when we request one.
2016-06-12 00:26:38 -04:00
Richard Heck
f19d650752 Add comment about coverity #102061. 2016-06-12 00:22:09 -04:00
Richard Heck
7b15ea393f Add a check to please coverity.
Fixes #23496.
2016-06-12 00:12:03 -04:00
Richard Heck
6675601147 Fix a number of other uninitialized members.
Fixes coverity #23392, 23394, 23397, 23403, 23414, 23424,
23448, 23477.
2016-06-11 23:59:55 -04:00
Richard Heck
ae676958d9 Add comment to fix coverity #23438. 2016-06-11 23:57:15 -04:00
Richard Heck
d29732e138 Initialize a bunch of uninitialized members. It does not seem to
matter what they are initialized to. Fixes coverity #23391.
2016-06-11 23:39:43 -04:00
Richard Heck
1bd5ef9a75 Add some comments to fix coverity #23386. 2016-06-11 23:26:02 -04:00
Richard Heck
3703a0235c False positive on coverity #23366. 2016-06-11 23:13:01 -04:00
Richard Heck
7aa6f972da Add a LATTEST, just in case this ever causes a problem.
Fixes coverity #23363.
2016-06-11 23:09:30 -04:00
Richard Heck
df022f91b4 Check to make sure we have a preview loader.
Fixes coverity #23353.
2016-06-11 23:09:30 -04:00
Richard Heck
a637efca6e Add comment fixing coverity #23351. 2016-06-11 23:09:30 -04:00
Richard Heck
9d49f09bcf Add comment about coverity #23335. 2016-06-11 23:09:30 -04:00
Richard Heck
fd42194c7e Add comment to fix coverity #23308 2016-06-11 23:09:30 -04:00
Richard Heck
2cb6ed9376 Make sure we have a buffer in VC_COMPARE.
Fixes coverity #23304.
2016-06-11 23:09:30 -04:00