Commit Graph

4653 Commits

Author SHA1 Message Date
Georg Baum
699a6db9fa Add some missing member variable initializations
These were all found by cppcheck. Even in constructors that are there "only
because of std containers" the class should be initialized correctly. You can
never know whether such an object does not get used, and then a nice crash
caused by dereferencing a NULL-pointer is better than undefined behaviour.
2015-09-13 19:47:21 +02:00
Georg Baum
c09663d2cb Return reference to this in operator=()
This is the recommendede signature of assignment operators and was found by
cppcheck.
2015-09-13 19:43:44 +02:00
Jean-Marc Lasgouttes
08fe2803c6 Initialize properly two members of InsetTabular
Also rename first_visible_cell to first_visible_cell_. I wonder though whether this variable is still useful.

Coverity issue 23383
2015-09-12 22:54:35 +02:00
Jean-Marc
ab1e642ef1 Fix logic of method
The last return statement was unreachable

Coverity issue 102063.
2015-09-12 19:01:18 +02:00
Jean-Marc
7065406eca image_ready is false at this point
Coverity issue 23299.
2015-09-12 18:33:17 +02:00
Juergen Spitzmueller
9f777d4bfb Do not attempt to select an empty cell before inserting a longtable caption
Fixes: #9692
2015-07-25 12:48:13 +02:00
Georg Baum
0f4c5df9f4 Support Photos in RasterImage template
Actually photos (i.e. .jpg files) where supported previously, but for pdflatex
output an unneeded conversion to png was done. The RasterImage templates
behaves now exactly as InsetGraphics for these files: If the input format is
jpg, use that for pdflatex, else convert to png.
2015-07-20 21:14:45 +02:00
Georg Baum
dc6d201f8f Store InsetGraphics bounding box in parsed form
This is like InsetExternal does it, avoids some string parsing, reduces the
amount of code and makes it more robust.
2015-07-18 17:02:54 +02:00
Georg Baum
81e592603d Support units in external inset bbox
This brings the external inset on par with the graphics insets as far as the
clipping option is concerned. The graphicxs package supports both: A bounding
box without units (which means that bp ia assumed), and a bounding box with
units, so we can simply output the values including the units.
2015-07-16 22:06:35 +02:00
Georg Baum
0cbcc8a166 Remove InsetGraphics noUnzip parameter
Being able to compile document with zipped .eps files was a useful feature of
the graphicxs package 20 years ago, but the LyX support is no longer relevant:
- The flag is ignored if preview is on
- If pdflatex is used then uncompressing happens during the compilation anyway
- If set, the flag prevents LyX from issuing proper error messages if
something with the image is wrong
- For hard disk capacities from 20 years ago not uncompressing is a useful
feature, but for current hard disk capacities it does not matter
- The external inset does not have it, and if we want to merge both insets
one day we would need to implement it there, which is even more difficult
than in InsetGraphics
2015-07-16 20:44:47 +02:00
Jean-Marc Lasgouttes
463bd17d75 Use integer line thickness in painter
There is no need for real-valued line width in painters. Actually, this even leads to uneven dashes for continuous spell checker.

The new code is supposed to be equivalent to the old one, just more readable. From this, we can try to see whether some lines need to be made thicker on HiDPI screens.
2015-07-14 17:42:45 +02:00
Juergen Spitzmueller
406d710131 Force local font switch in caption.
It is needed with polyglossia. With babel, it does not harm (and looks
more sensible).
2015-06-18 14:17:18 +02:00
Enrico Forestieri
11c2b7792c Replacement for commits bc47054b and ad0d0f6d
The strategy adopted in bc47054b had some drawbacks related to the way
instant preview snippets are generated. See the subthread starting at
http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg187916.html
for details.

The strategy adopted in this commit is that of adding macro definitions
only for the macros actually used in a preview snippet, independently
of whether some macro was already used in a previous snippet. In this way
the snippets don't need to be changed according to whether they are
compiled as a whole or separately from each other. This fact was causing
the regeneration of a preview snippet whenever the cursor entered the
corresponding inset, even if the generated image would have not changed.
The problem of defining or redefining a macro is taken care by the
python scripts.
2015-06-14 18:10:29 +02:00
Enrico Forestieri
bdec44d614 Revert bc47054b and the related commit ad0d0f6d
As discussed on the devel list. See the subthread starting at
http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg187916.html
Soon to be replaced with the same strategy adopted in the stable branch.
2015-06-14 18:05:39 +02:00
Enrico Forestieri
3924030e82 Fix some preview issues reported on the devel list.
* Provide for vector fonts only if needed.
* Make sure microtype doesn't throw a trantum in dvi mode.
* Use correct macro definition in preview insets.
2015-06-03 00:24:54 +02:00
Juergen Spitzmueller
5d41a22ee4 Fix preview of included files in child documents (bug #9583) 2015-06-02 17:23:52 +02:00
Enrico Forestieri
ad0d0f6d69 Really fix bug #9354 2015-05-31 00:53:38 +02:00
Richard Heck
babe9eaeab The way this was done here is inconsistent with how it is done
in other places.
2015-05-28 18:03:27 -04:00
Scott Kostyshak
7399d99c98 Allow SVGs in HTML output (#7441)
This is only a specific part of #7441.

Patch from Julien Rioux.
2015-05-27 11:25:06 -04:00
Juergen Spitzmueller
c60827146f Fix logic in tabular dialog with decimal alignment
Fixes: #9570

Partially reverts [9d05ac5c912/lyxgit].
2015-05-25 15:55:11 +02:00
Juergen Spitzmueller
be6a6d76af InsetFloat: fix typo 2015-05-23 10:38:31 +02:00
Juergen Spitzmueller
47dd9189eb Add more Float tags to allow to disable wide and sideways feature
Fixes: #9557, #9558

This is amended to yesterday's layout format change.
2015-05-22 18:59:17 +02:00
Juergen Spitzmueller
7dc123b790 Add Float tag to determine allowed positioning options (#7752) 2015-05-22 10:37:14 +02:00
Enrico Forestieri
93e131f54f Code simplification. 2015-05-21 18:13:42 +02:00
Juergen Spitzmueller
977bbd9bc3 Add InsertCotext tag also to InsetLayout argument (part of #4745) 2015-05-21 08:53:56 +02:00
Enrico Forestieri
7b0ecf1f38 Also find external material files when the document is moved and origin is known 2015-05-20 16:04:18 +02:00
Enrico Forestieri
a93ac27450 Avoid compiler warning about overloaded virtual function. 2015-05-20 15:49:15 +02:00
Juergen Spitzmueller
4005a4d470 Use trimmed string in [Inset]Layout Requires.
Fixes: #9518
2015-05-19 10:17:34 +02:00
Uwe Stöhr
52a158b6d7 InsetBox.cpp: add visual feedback for frame color
- the idea is to color the box inset frame according to the fame color of the box (if there is any). To keep the WYSIWYM principle the frame thickness and box separation are not taken into account. However this should be possible if anybody would like that.

- besides this, use the correct conversion command for the background color
2015-05-17 23:20:43 +02:00
Uwe Stöhr
95af488798 InsetBox.cpp: fix a bug I introduced in [88593e0e/lyxgit] 2015-05-17 17:36:46 +02:00
Georg Baum
84cca2dd94 Fix indentation 2015-05-17 17:27:27 +02:00
Uwe Stöhr
46671b5836 InsetBox.cpp: code simplification
thanks Pavel for the hint
2015-05-17 03:21:02 +02:00
Enrico Forestieri
62d36bf04d Correctly load documents moved elsewhere after save.
It is now possible opening documents that where manually moved to a
different location after they were saved and still produce an output.
Indeed, (hopefully) all needed included files are now still found.
When the moved document is saved again, all paths are accordingly updated.
Of course, for this to work, a document has to be saved in Format 490,
at least.

As an example, after converting the user guide to the last format, it can
be copied anywhere and opened without the need of adapting the paths of
included files or moving them to a proper place.

There is one glitch I am aware of. When moving a child document (but not
the master) the path to the master is correctly updated but it won't be
recognized as such. This is because LyX checks that the parent actually
includes this document but, of course, being the parent document not
touched, it appears not including this child. Anyway, it will also occur
when saving the child to a different location and the user is warned
on the terminal about this fact when the moved child is loaded.
However, there is no problem when it is the master that has been moved.
2015-05-16 19:52:39 +02:00
Uwe Stöhr
88593e0ec6 support for colored boxes
adds support to set colors for some box types (support for the LaTeX commands \fcolorbox and \colorbox)

fileformat change
2015-05-16 03:22:37 +02:00
Uwe Stöhr
7bb691b8ad InsetBox.cpp: code simplification 2015-05-15 03:59:04 +02:00
Pavel Sanda
915b7c521e Unduplicate box strings. 2015-05-13 00:15:37 -07:00
Richard Heck
fb4c70650c Use const ref instead of passing by value.
Thinko caught by coverity.
2015-05-12 12:52:36 -04:00
Richard Heck
7a0f7b7046 Pass XHTMLStream by reference. Problem found by coverity.
The previous code worked because we are writing to the stream, and
the actual odocstream is a member by reference of XHTMLStream.
2015-05-12 10:13:04 -04:00
Uwe Stöhr
34da634451 BoxUi.ui: update tooltips and tab order
- InsetBox.cpp: constify
2015-05-12 00:28:29 +02:00
Uwe Stöhr
8010b90cb4 add ability to change box line thickness and separation
fileformat change
2015-05-11 21:30:32 +02:00
Juergen Spitzmueller
4ed8caaf1c Split different indices in the outliner
Fixes: #7012.
2015-05-09 15:30:10 +02:00
Juergen Spitzmueller
760b7cf2b6 Add option to Argument to let it be inserted with a copy of the co-text.
This is useful for classic "Short Titles", where one might want to start
with the full title in the inset.

Addresses: #4745
2015-05-09 12:17:24 +02:00
Juergen Spitzmueller
5b03ae11a0 Implement PassThruChars to Argument
Closes: #9535.
2015-05-08 09:32:31 +02:00
Enrico Forestieri
d0146c8e82 Don't update paths of non-existing files 2015-05-05 22:30:10 +02:00
Enrico Forestieri
8c351e32be Update paths of included files when saving to a different folder.
Fixes #9528 and #5115.
2015-05-03 23:55:19 +02:00
Juergen Spitzmueller
bc47054be8 Properly fix #6369
Avoid that \newcommand[x] definitions of math macros are pushed multiple
times to the preview loader.

Redefinitions (via \renewcommand[x]) are properly handled.
2015-04-30 16:48:55 +02:00
Juergen Spitzmueller
42ba33a53f Use namespace. 2015-04-26 16:49:16 +02:00
Scott Kostyshak
72838f24b9 Whitespace 2015-04-25 20:01:39 -04:00
Juergen Spitzmueller
897b2e73a1 New (Inset)Layout tag PassThruChars 2015-04-20 18:13:49 +02:00
Juergen Spitzmueller
8c1a484cd2 Use local babel language switch in fixed width cells in order to prevent unwanted whitespace
Fixes: #9455
2015-04-04 11:59:01 +02:00
Jean-Marc Lasgouttes
11ca140667 Clean-up the undo API
* Remove the UndoKind parameter in the general interface
* move recordUndoInset to Cursor
* remove one variant of Undo::recordUndo.
* get rid of Text::recUndo.
2015-04-01 14:18:23 +02:00
Jean-Marc Lasgouttes
4dcc73ebf0 Get rid of autoBreakRow, which is obsoleted by allowMultiPar()
The only real user was Text::insertStringAsLine, but this got changed
in commit 2c7152ab.

While not other place did read the value, there is a side effect of
setAutobreakRow that merges exiting paragraphs. However, this is used
in two situations

* some constructors, where the inset is empty;

* InsetTabular::toggleFixedWidth, which actually contains itself some
  code to merge paragraphs.

Therefore the member and all associated code can be removed safely.
2015-03-31 17:02:00 +02:00
Enrico Forestieri
0bbfadb23f Typo 2015-03-31 16:03:16 +02:00
Jean-Marc Lasgouttes
67ff68bd02 Improve the check for multiple paragraphs in Text::insertStringAsLine.
Rely only on InsetText::allowMultipar() to get this information.

Implement this method for InsetTabular and InsetBox.

Also rely on this method for disabling LFUN_PARAGRAPH_BREAK.
2015-03-31 14:07:45 +02:00
Enrico Forestieri
f516629285 Add comment 2015-03-31 01:26:48 +02:00
Kornel Benko
fd7e4f2dbb No need to compute size of an icon if not using GUI.
This also avoids crash while calling Qimage() without GUI.
2015-03-28 21:05:41 +01:00
Enrico Forestieri
0f0750a65a Allow using icon names in InsetInfo
Currently, only lfun names are accepeted but there are cases in which
the lfun name does not map directly to an icon. Fore example, in the
outliner, the icon named "promote" is used for the lfun outline-out.
As a result, a graphics inset is used in the documentation for describing
the corresponding icon. Now one can also use an icon name. The argument
of "info-isert icon" is firstly lookep up as an lfun. If no corresponding
icon is found, the argument is taken as the name of the icon. If no such
icon exists, the "unknown" icon is used.
2015-03-28 12:45:20 +01:00
Jean-Marc Lasgouttes
66fa801e74 Improve support for on screen length calculation
The computation of length on screen depend in particular of the computation of the size of an em. Many places of the code used to rely on the width of the M character, which is not really correct:
http://en.wikipedia.org/wiki/Em_%28typography%29

In digital typography, the best value to use is the point size of the font.

* Implement FontMetrics::em(), which returns the value in pixels of the EM unit.
 Convert code to use it.

* Introduce Length::inPixel(MetricsBase const &), which takes the textwidth and em information from the MetricsBase object. Convert code to use it.

* Fix several places where Length::inPixel is used without a proper em value.

* add mathed_font_em() helper function. It should eventually be removed like some other functions in MathSupport.

* Add dummy implementation of FontMetrics to tex2lyx for linking purposes.
2015-03-26 17:10:15 +01:00
Enrico Forestieri
6d3019c7de Fix compilation with cmake 2015-03-26 02:27:11 +01:00
Enrico Forestieri
a3d5f27038 Remove the iconScaleFactor() method from src/support.
I am moving the corresponding code directly to InsetInfo.cpp.
Moreover, the size of the image displayed by the info inset is
now dynamically set according to the text size.
2015-03-25 21:26:32 +01:00
Jean-Marc Lasgouttes
1780cb4896 Fix consecutive merging of tabular cells
This is a bug reported and fixed by Edwin Leuven.

Here is how Edwin described it in his inimitable minimalist style:
  first i merge the top-left two cells in a small, say 3x3, table

  if i then merge this multicolumn cell with the remaining cell in the first row
  my table ends up all bonkers
2015-03-24 10:50:51 +01:00
Richard Heck
eb79a98e01 Whitespace. 2015-03-23 21:58:45 -04:00
Georg Baum
49ac79100b Make InsetSpecialChar names more consistent
This is the rersult of a discussion on the list. Now all special characters
have meaningful names, and it is clear that the LyX file syntax is not LaTeX.
2015-03-23 21:28:04 +01:00
Jean-Marc Lasgouttes
6010f38e01 Use integer arithmetic for drawing logos; fix LaTeX output
Using fraction of points is a reasonable way to avoid warnings with fussy compilers.

Moreover, this fixes the output of PHRASE_LATEX2E to use the proper form \LaTeXe.

The file format still uses the questionnable form \\LaTeX2e.
2015-03-18 11:32:49 +01:00
Juergen Spitzmueller
d2ab8e1b65 Add missing breaks (and time for a break :-() 2015-03-16 14:49:58 +01:00
Juergen Spitzmueller
fd5d47d182 More switches and whitespace fixes 2015-03-16 14:47:38 +01:00
Juergen Spitzmueller
245c2b3c45 InsetPhantom::latex(): use a switch 2015-03-16 14:22:03 +01:00
Juergen Spitzmueller
e30db1e444 Whitespace
Time to properly set up QtCreator...
2015-03-16 14:15:05 +01:00
Juergen Spitzmueller
d044d6afa7 Phantom is fragile (#9456) 2015-03-16 14:11:45 +01:00
Jean-Marc
1f36fa6d56 Document the drawing of logos
Also fix a couple of spacings.
2015-03-15 18:21:01 +01:00
Jean-Marc Lasgouttes
322da78299 Improve display of the logos.
This look now more like the real logos. Moreover, we use not the normal font color because Color_special is a bit too flashy.
2015-03-14 17:01:49 +01:00
Enrico Forestieri
d00dcc2ca7 Use the nominal theme's icon size for displaying the icon in an info inset. 2015-03-13 00:38:05 +01:00
Georg Baum
361967e613 whitespace 2015-03-11 22:03:29 +01:00
Juergen Spitzmueller
9d824a04d1 Properly define MultiPar status of caption in the layout definition.
Also remove hardcoded paragraph break disabling.

Candidate for branch.
2015-03-10 18:31:55 +01:00
Jean-Marc Lasgouttes
9448e89879 Remove unused variable BufferParams::quotes_times
This was pointed out inadvertently by coverity issue 23484: the
variable was not properly initialized.
2015-03-04 18:21:58 +01:00
Georg Baum
3e9e6e344a Replace automatic logofication with insets
Previously, LyX did replace some words with typeset logos, and there was no
way to prvent this except putting them, in ERT (bug #4752). Now we have
special insets for these words, and standard text is left alone.
2015-03-01 11:16:57 +01:00
Jean-Marc Lasgouttes
b627b8701b Some performance stuff reported by cppcheck 2015-02-24 18:38:20 +01:00
Jean-Marc Lasgouttes
eb4f963eef Main argument of a subfloat is not a moving argument
Fixes bug: #9421
2015-02-20 11:51:40 +01:00
Georg Baum
e4ec11e8a1 Output -- and --- in XHTML like in LaTeX
For exports based on LaTeX, consecutive hyphens are only converted to endash
and emdash if the current font family is not typewriter, and if none of the
parent insets is an IPA inset. Now this is done for XHTML export as well.
2015-02-15 20:17:21 +01:00
Georg Baum
864f44ddc2 Fix unused parameter warning 2015-02-14 11:32:39 +01:00
Richard Heck
5a78a112b6 Fix bug #9383. Writing directly to the output stream bypassed the
machinery that clears the tag stack.
2015-02-09 17:26:47 -05:00
Georg Baum
e6354e1a17 Oops 2015-02-01 12:49:41 +01:00
Georg Baum
8c3829e6f1 Improve InsetSpace docbook export
The removed link does not exist anymore. The character entities were taken
from http://www.sagehill.net/docbookxsl/SpecialChars.html.
2015-02-01 12:39:53 +01:00
Jean-Marc Lasgouttes
7021f4c342 Implement new recordUndoBufferParams method.
Rename recordUndoFullDocument to recordUndoFullBuffer.

Separate the notion of recording changes to paragraphs and recording changes in buffer parameters.

Audit every user of recordUndoFullDocument and replace it with either recordUndoBufferParams or recordUndoFullBuffer. Add comments to identify remaining work.
2015-01-22 15:15:21 +01:00
Georg Baum
eb121f9993 Replace hardcoded hack with InsetLayout tag 2015-01-11 20:01:19 +01:00
Georg Baum
5d6351d476 Fix wrong listings preamble encoding (bug #9382)
The listings package employs some dirty tricks internally, therefore it does
not work with utf8 encoding, but requires fixed width encodings. This version
of the fix uses ugly hardcoding instead of a layout file format change, so it
could be backported if needed.
2015-01-11 19:17:51 +01:00
Jean-Marc Lasgouttes
1e18ab586e Fixes to InsetCaption \protect-ion
* \caption does not need to be protected in general
* the contents of \caption arguments need to be protected, though.

All styles related to caoption inset have been audited and updated.

The special casing of captions in longtables has been removed, since there is no special case.

Fixes bug: #9177
2015-01-10 19:48:56 +01:00
Jean-Marc Lasgouttes
9c55af4a22 Merge remote-tracking branch 'features/scroll-reloaded'
This implement horizontal scrolling of rows to allow editing insets
(math, tabular...) that are larger then the screen. The scrolling happens
as the cursor moves, in order to make sure that the cursor is always visible.
This effectively closes an 11 years old bug.

This feature is the result of the work of Hashini Senaratne as part of
Google Summer of Code 2013. The code has been cleaned-up for inclusion
and remaining bugs have been fixed.

Fixes bug: #1083.
2015-01-10 18:39:09 +01:00
Georg Baum
8f2828197c Move otexstream out of support
This resolves a dependency of src/support/docstream.cpp on src/TexRow.cpp,
which is the wrong way round. This fixes the linking
src/tests/check_ExternalTransforms with MSVC where the linker is not clever
enough to detect that the whole otexstream class is unused.
2015-01-09 21:07:59 +01:00
Jean-Marc Lasgouttes
fcaf5b5fc8 Remove the special horizontal scrolling support in InsetTabular
It is not necessary anymore now that there is a global mechanism.

Also, fix the clearing of rows in SingleParUpdate mode.
2015-01-07 22:55:11 +01:00
Vincent van Ravesteijn
ad6c03fe26 InsetTabular.cpp: Remove commented code without a comment
This was a leftover of [b2246c4e/lyxgit].
2015-01-06 22:02:20 +01:00
Georg Baum
dae8555234 Get rid of regex_constants::match_partial
As shown by the unit test this is not needed at all, even not for really
awkward input.
2014-12-28 17:46:33 +01:00
Georg Baum
cb7ace9143 whitespace 2014-12-27 15:17:10 +01:00
Scott Kostyshak
625cea1528 Whitespace 2014-12-21 19:01:52 -05:00
Juergen Spitzmueller
41c35476e5 Fix initialization order 2014-12-21 10:13:56 +01:00
Scott Kostyshak
15ae3eb85c Initialize recently added forceownlines_ bool
This adds on to the fix for #8875 (a25569eb).
2014-12-20 15:05:20 -05:00
Scott Kostyshak
6da7ee1be1 Whitespace 2014-12-20 15:03:40 -05:00
Georg Baum
d553938c92 Improve and unify error messages
Now the errors given for an unknown layout in copystyle and obsoletedby provide
the same information.
2014-12-09 21:20:56 +01:00
Jean-Marc Lasgouttes
0bdfca2c6e \\subfloat captions are moving arguments
Therefore insets should be protected in these captions.

Fixes bug: #9346.
2014-12-08 09:43:49 +01:00
Juergen Spitzmueller
cfeddb9293 Add ObsoletedBy tag to InsetLayout
Fixes: #9000.
2014-12-08 09:08:45 +01:00