Commit Graph

4889 Commits

Author SHA1 Message Date
Jean-Marc Lasgouttes
a48581f48c Linearize macros in box edit mode too.
The special mode used by macros where the macro name is displayed as
grey text in a box is now one of the possible marker types for any
inset. The new code puts the macro name below the text, which means
that only the text below the current line will be moved. This makes
edition much more comfortable. The grey border around the contents has
been removed too.

The marker_type enum has been moved from Inset to InsetMath. A
markerMargin() function returns the horizontal margin required on each
side for the marker. Only the corner-type markers MARKER and MARKER2
need some.

A new BOX_MARKER enum value has been added and is taken care of in
afterMetricsMarkers (renamed from metricsMarkerVertical) and
drawMarkers.

The InsetMath::marker() macro now takes a BufferView pointer as
argument, so that the marker type can depend on editing state.

MathRow::metrics now makes changes to the MathRow object when needed.

The specific metrics/draw code in MathMacro has been removed and
replaced by assertions. Code in addToMathRow and marker is adapted to
reflect the cases where linearization is possible.
2017-03-23 10:17:07 +01:00
Guillaume Munch
ac6d3ffb6a Regularly check if preview is modified when visible on screen
In case one cannot rely on QFileSystemWatcher.
2017-03-19 14:41:54 +01:00
Guillaume Munch
ad16347b08 Regularly check if graphics is modified when visible on screen (#10596)
In case one cannot rely on QFileSystemWatcher.

see https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg199112.html
2017-03-19 14:41:54 +01:00
Jean-Marc Lasgouttes
c6213b1b20 Another forgotten unreachable `return' that is not needed
The compilers we use now do not care, but coverity complains.
2017-03-14 14:46:02 +01:00
Jean-Marc Lasgouttes
7d4b8b7606 Only accept non-negative lyxscale parameters
Since lyxscale is unsigned, a negative value would lead to a very
large positive value.

Spotted by coverity.
2017-03-14 14:25:08 +01:00
Richard Heck
50060053e3 Move the global formats and system_formats variables into the
LyX singleton.

Mostly, this is very boring, but it might be good if someone would
check what I did about the dummy implementation in tex2lyx.
2017-03-13 23:40:29 -04:00
Scott Kostyshak
72c3dbd02c Change a warning to an error if missing include
If an included file is not found, it seems impossible that the final
output would be correct. Before this commit, when exporting on the
command line, LyX would create the PDF and exit with a zero error
code so unless the user was monitoring the terminal output, they
would not know there is a problem.

This change is consistent with 1a374a93.
2017-03-11 02:51:49 -05:00
Guillaume Munch
a4fae021f2 Replace FileMonitor with FileMonitor2 in RenderPreview 2017-03-11 00:50:57 +01:00
Guillaume Munch
387ac78088 Add option to ignore a parameter in InsetCommandParams
It will not be saved to the file and will always be equal to a given default
value.
2017-03-11 00:50:57 +01:00
Jean-Marc Lasgouttes
4b8e5a9d53 Another unreachable `return' that is not needed
The compilers we use now do not care, but coverity complains.
2017-03-09 15:12:03 +01:00
Guillaume Munch
354897f6d9 Tabular::editXY should not touch the selection 2017-03-05 08:45:52 +01:00
Enrico Forestieri
5940dc53aa Fix bug #10579
The \lyxdeleted macro cannot cope with empty lines.
2017-03-03 13:00:32 +01:00
Jean-Marc Lasgouttes
91d8a3982d Initialize properly several InsetQuote members
Spotted by coverity
2017-03-01 17:02:20 +01:00
Jean-Marc Lasgouttes
dc385a8b97 Fix coverity false positive
The fall through was intended at db889bc6.
2017-03-01 16:42:28 +01:00
Jean-Marc Lasgouttes
e8b744ad2e Fix broken logic
Spotted by coverity.
2017-03-01 16:36:46 +01:00
Juergen Spitzmueller
73ccee113e rename BufferParams::font_encoding() to ::main_font_encoding()
Because that's what's actually returned.
2017-02-25 12:49:49 +01:00
Juergen Spitzmueller
e68afbe671 Plain quote fixes
\textquote... commands are only available in t1.
2017-02-23 10:39:50 +01:00
Juergen Spitzmueller
cf82bcadfb Use proper font encoding in InsetQuotes 2017-02-23 10:39:31 +01:00
Jean-Marc Lasgouttes
fc02744119 Revert "Linearize macros in box edit mode too."
Guillaume tells me that there are problems. We'll return to it later.

This reverts commit 0140348118.
2017-02-21 05:43:38 +01:00
Guillaume Munch
bac8a95871 Improve mouse selection over InsetCollapsable button. 2017-02-18 23:03:54 +01:00
Guillaume Munch
71623b88b2 Generalise the deletion protection mechanism from math to text (#9540)
Now backspace and delete in text will select non-empty math and text insets
before deleting them. This is consistent with what happens in math already.

This is implemented for InsetText as well but can be disabled in case of
negative feedback.

This can be set for any sort of inset with the new virtual method
Inset::confirmDeletion.

New option "force" for the LFUN_*_DELETE_* commands, that bypasses the
confirmDeletion check.
2017-02-18 23:03:23 +01:00
Jean-Marc Lasgouttes
0140348118 Linearize macros in box edit mode too.
The special mode used by macros where the macro name is displayed as
grey text in a box is now one of the possible marker types for any
inset. The new code puts the macro name below the text, which means
that only the text below the current line will be moved. This makes
edition much more comfortable.

The marker_type enum has been moved from Inset to InsetMath.

A new BOX_MARKER enum value has been added and is taken care of in
afterMetricsMarkers (renamed from metricsMarkerVertical) and
drawMarkers.

The InsetMath::marker() macro now takes a BufferView pointer as
argument, so that the marker type can depend on editing state.

MathRow::metrics now makes changes to the MathRow object when needed.

The specific metrics/draw code in MathMacro has been removed and
replaced by assertions. Code in addToMathRow and marker is adapted to
reflect the cases where linearization is possible.
2017-02-14 01:02:00 +01:00
Juergen Spitzmueller
ff0d96c371 InsetHyperlink: Fix replacement of empty name with target 2017-02-08 09:17:14 +01:00
Juergen Spitzmueller
bedebfc45a Support for multiple bibliographies setting "per child"
This adds support for the chapterbib package, but also adds ways to
produce this sort of multibib with biblatex and bibtopic (which are
both incompatible with chapterbib).

File format change.
2017-02-04 19:23:45 +01:00
Juergen Spitzmueller
7ca20b292c Support for multiple bibliographies
Using refsection=unit in biblatex, or bibtopic's btUnit environments
in BibTeX.

File format change.
2017-02-04 12:02:00 +01:00
Juergen Spitzmueller
caf72c07cd Check if literal param exists before querying value.
Otherwise LyX asserts.
2017-01-30 08:27:53 +01:00
Juergen Spitzmueller
e15a8f3551 Extend LATEXIFY command param handling and add literal param.
File format change.

This allows for the relevant InsetCommand-based dialogs (such as
citation text before/after, Bibitem label, hyperlink name etc.)
to provide both the input of verbatim code or text that is transformed
to proper LaTeX code.

Some dialogs (Nomencl, Href) already had some methods (although they
could not be toggled), which are now centralized and streamlined.

The initial work of this patch has been done by Georg Baum (see
http://www.lyx.org/trac/attachment/ticket/2751/x.diff)

Fixes: #2751, #8227.
2017-01-30 07:44:55 +01:00
Juergen Spitzmueller
c59375d679 Move protectArgument function to lstrings
This will be useful to other insets as well.
2017-01-29 12:08:29 +01:00
Juergen Spitzmueller
83074c431c Whitespace 2017-01-28 13:00:33 +01:00
Guillaume Munch
15f64f8413 Fix wrong DocIterator argument
Regression at 3391fed3.

The child's InsetText is the root, so we start with an empty DocIterator.

Thanks Scott for the report.
2017-01-27 00:42:37 +01:00
Juergen Spitzmueller
fd8b4aebb0 Generalize the protection of brackets in citation arguments
Whenever an argument delimiter is used inside the argument, the argument
needs to be grouped, that is

\cites({text (text) text})

or

\cite[{text [text] text}]

This fixes the original case reported in #2751 which is independent
from the general issue that the pre- and postnote field take literal
code.
2017-01-22 10:27:06 +01:00
Juergen Spitzmueller
68ab4023cc Support for "qualified citation lists"
These are biblatex-specific multicite commands that allow for multiple
pre- and postnotes, as in:

\cites(pre)(post)[pre1][post1]{key1}[pre2][post2]{key2}...

with an optional general pre- and postnote, which applies to the whole
list (like [][] in normal cite commands) and an optional pre- and
postnotes for each item, so that pagination can actually be specified in
multi-cite references, as in:
(cf. Miller 2015, 2; furthermore Smith 2013, 23-23; Jenkins 2012, 103,
also refer to chapter 6 in this book)

See the biblatex manual, sec. 3.8.3., for details.

File format change.
2017-01-21 14:25:17 +01:00
Juergen Spitzmueller
4859a1f6bb Don't load bibtopic with Biblatex 2017-01-15 15:40:20 +01:00
Guillaume Munch
3391fed36a Make the generation of children's tocs more robust
Let the children directly access the TocBuilders, instead of concatenating
after the fact.
2017-01-14 23:13:14 +01:00
Guillaume Munch
461fda9ca9 Collect the outliner names for the children's tocs
Fixes missing outliner names in various situations. Now if the warning "Missing
outliner name" appears in the console, this correctly hints at an actual issue
with the layout.
2017-01-14 23:13:14 +01:00
Juergen Spitzmueller
33fa147fca Minor string fixes 2017-01-14 17:48:37 +01:00
Juergen Spitzmueller
ed7d3a33ab Some master/child biblio fixes. 2017-01-14 14:44:18 +01:00
Juergen Spitzmueller
327602d01d Implement "key only" citation style
File format change.
2017-01-13 11:53:22 +01:00
Juergen Spitzmueller
9b13217f7b Use master buffer params when appropriate 2017-01-12 12:19:14 +01:00
Juergen Spitzmueller
ce8929e9b2 Merge branch 'master' into biblatex2 2017-01-12 09:05:28 +01:00
Jean-Marc Lasgouttes
89662a6852 Re-implement math markers logic.
The goal of this patch is to be able to properly remove the space
needed for markers in the case of insets that are inside macros and do
not need these markers. This was attempted at 9a9a6a8, but did not
work reliably.

To this end, the following simplifications are made:

* instead of drawing its own markers, each inset has a virtual method
  marker() which prescribes either NO_MARKER, MARKER (normal bottom
  marker) or MARKER2 (top and bottom marker). All explicit calls to
  (draw|metrics)Markers(|2) are removed.

* the space necessary for the markers is now counted in the
  before/above margins in the row structure. Therefore painting will
  not happen at (x + 1, y), but just (x,y).

* the methods drawDecoration are removed.

* the helper methods InsetMath::(draw|metrics)Markers(|2) are removed
  and replaced by a new function drawMarkers in MathRow.cpp.

Now the marker type is kept in the MathRow::Element object (and set to
NO_MARKER in not editable context) and the marker is accounted for in
MathRow::(metrics|draw).

Moreover, the extra pixel for the marker is taken on the before/After
space if possible. The marker will only require extra space when
before/after is 0.

See comment 168 of #8883 to understand what issues are fixed.
2017-01-11 17:35:34 +01:00
Juergen Spitzmueller
425c190d62 merge recent changes from master 2017-01-09 20:04:32 +01:00
Guillaume Munch
5fdc577bad Improve the list of equations
Also convert other Tocs to TocBuilder when trivial, to make them customisable
2017-01-09 18:27:26 +01:00
Guillaume Munch
e11a3cb895 Remove some hardcoded addToToc: note, footnote, marginalnote, branch
Define their Toc from the layout instead.
2017-01-09 18:27:26 +01:00
Guillaume Munch
68109443f3 Implement AddToToc for paragraph layouts
Enables table of Theorems & Definitions
2017-01-09 18:27:25 +01:00
Guillaume Munch
5e20713769 Implement IsTocCaption for InsetArgument
Shows the title of Sweave, Knitr chunks in the Navigate menu.
2017-01-09 18:22:22 +01:00
Guillaume Munch
28dfc48fb2 Implement AddToToc layout command for Flex insets
Enables TOC for FiXme, ToDo, Knitr, Sweave (#7790)
2017-01-09 18:22:22 +01:00
Juergen Spitzmueller
322808281f Merge branch 'master' into biblatex2 2017-01-09 09:53:20 +01:00
Enrico Forestieri
25e6b5da39 Avoid useless warning from Qt
When cloning InsetExternal, the tempname_ member of InsetExternalParams
has yet to be initialized. So, trying to remove it causes the warning
"QFile::remove: Empty or null file name".
2017-01-08 23:11:04 +01:00
Richard Heck
06e2669b35 Escape link name for DocBook.
Thanks to Martin Brown for pointing out the bug, and the obvious
solution.
2017-01-08 13:38:48 -05:00