Commit Graph

4823 Commits

Author SHA1 Message Date
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
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
fb9a866a66 Implement PassThru option to arguments. 2016-10-21 10:39:55 +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
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
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
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
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
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
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
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
Richard Heck
5018e1077b producesOutput() should not be redeclared as producesOutput(bool). 2016-08-28 00:04:02 -04: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
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
Richard Heck
f15c4159aa Special characters should be output to the TOC. 2016-08-04 21:09:32 -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
096afc733b Fix embarrassing logic mistake
Thanks Richard for pointing at it.
2016-08-03 22:17:26 +01: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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
Richard Heck
45e3a8f827 Squash warning. 2016-06-30 23:01:13 -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
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
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
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
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
aedc6720c7 Toc: clean-up 2016-06-12 19:17:33 +01:00
Richard Heck
e622f82521 Add comments to fix coverity #23505 and 23507. 2016-06-12 00:35:49 -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
3703a0235c False positive on coverity #23366. 2016-06-11 23:13:01 -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
355395174b Mark a number of coverity false positives.
Fixes coverity #23284, 23285, 23286, 23287, 23289.
2016-06-11 23:09:30 -04:00
Georg Baum
2047ea5eb4 Replace Boost.Signals with Boost.Signals2
Boost.Signals is deprecated. This fixes bug #9943.
The only thing left to do is to rewrite (or get rid of) the boost -mt test
in config/lyxinclude.m4 not to use signals anymore.
2016-06-09 22:25:34 +02:00
Guillaume Munch
8d640dc776 Remove non-copyable idioms
Two better ways of making a class non-copyable in C++11:

* Store the p. impl. in a unique_ptr (for the cases of classes with p. impl.),
  or:

* Define publicly the copy constructor and assignment as deleted

Lots of other classes could be cleaned up in this way.
2016-06-09 19:16:44 +01:00
Jean-Marc Lasgouttes
ab40fe6f05 Initialize properly InsetTabular members in constructor
Found by Coverity
2016-06-09 17:23:27 +02:00
Jean-Marc Lasgouttes
102e6340e5 Initialize InsetExteralParams::preview_mode in constructor
The value PREVIEW_OFF is the same default as for external::Template.

Found by Coverity
2016-06-09 16:51:07 +02:00
Jean-Marc Lasgouttes
a0c2328fd6 Always initialize InsetQuote language in constructor
Found by Coverity
2016-06-09 16:42:24 +02:00
Guillaume Munch
b95b77c631 Replace boost::tuple with std::tuple 2016-06-09 15:21:39 +01:00
Guillaume Munch
b032e2dfaf Replace support/shared_ptr.h and boost::shared_ptr with std::shared_ptr
shared_ptrs now only require the <memory> header.
2016-06-09 15:21:39 +01:00
Guillaume Munch
ca8709aaf5 Replace boost::scoped_ptr with unique_ptr 2016-06-09 15:21:39 +01:00
Guillaume Munch
557975a8de Replace auto_ptr with unique_ptr
This is a mechanical replacement. For now it seems that unique_ptrs are
essentially used for exception-safety. More could certainly be done to clarify
pointer ownership in general.
2016-06-09 15:21:39 +01:00
Georg Baum
0f5554a8f2 Remove zombie noncopyable.hpp dependency
The header was still included, but not used.
2016-06-07 20:49:27 +02:00
Richard Heck
6f88e11da3 Fix bug #10194: Space missing in UI. 2016-06-06 20:41:07 -04:00
Georg Baum
03395b7871 Rethrow excepction instead of a copy
This fixes the cppcheck warning "(style) Throwing a copy of the caught
exception instead of rethrowing the original exception."
2016-06-06 21:52:52 +02:00
Georg Baum
42362cfb87 Remove duplicated if clause
This was a thinko in 760b7cf2 (found by cppcheck), it was added in 977bbd9b as
well.
2016-06-06 20:33:31 +02:00
Jean-Marc Lasgouttes
51b1cfab72 Do not use the return value of Painter::text for logos
This will allow to get rid of this return value (and avoid computing it).
2016-05-30 14:55:41 +02:00
Jean-Marc Lasgouttes
68149e380d Remove extra spacing around InsetCommand buttons
There is already a spacing of 2 pixels on each side of a button (e.g. collapsed inset). There is no need to add one extra pixel for command insets.

Fixes part of bug #10149.
2016-05-29 17:55:46 -04:00
Jean-Marc Lasgouttes
ccc8ad4744 Cleanup handling of LFUN_LAYOUT_PARAGRAPH in getStatus
The way it works is:
* the inset defines allowParagraphCustomization() correctly
* Text::getStatus acts on it.

Note that, in Text::getStatus, testing for cur.inset().allowParagraphCustomization() does not make much sense, since one should pass the cursor idx as parameter. Actually, for some reason the safest bet is to use the owner of the Text object as inset.
2016-05-29 17:55:46 -04:00
Jean-Marc Lasgouttes
0d21dca360 Cleanup handling of LFUN_LAYOUT in getStatus
The way it works is:
* the inset defines forcePlainLayout() correctly
* Text::getStatus acts on it.

Note that, in Text::getStatus, testing for cur.inset().forcePlainLayout() does not make much sense, since one should pass the cursor idx as parameter.

There are many other lfuns that do not have to be handled directly by insets. InsetScript in particular has tests for way too many lfuns.
2016-05-29 17:55:46 -04:00
Jean-Marc Lasgouttes
019fceda3f Remove variables set but not used
This was found by cppcheck.
2016-05-29 17:55:46 -04:00