Commit Graph

24114 Commits

Author SHA1 Message Date
Jean-Marc Lasgouttes
344f7f2e7d Make sanitize more robust to dangling pointers.
It is necessary to sanitize the new_word iterator too.
2017-02-01 10:11:55 +01:00
Jean-Marc Lasgouttes
2ea4b1dcdf Revert "Fix crash"
A better fix is forthcoming.

This reverts commit 177ad3d4a4.
2017-02-01 10:11:20 +01:00
Guillaume Munch
177ad3d4a4 Fix crash
Thanks Kornel for the report:
https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg198630.html

Apparently sanitize can crash. Use the safer fixIfBroken even though it
truncates the cursor.
2017-01-31 22:55:00 +01:00
Guillaume Munch
03a4b8c932 Implement rule 17
* Convert the kerning into a proper right margin for mathnormal, mathscr and
  mathcal (fonts with \fontdimen2 == 0 as per rule 17 from TeXBook).

* Simulate the fact that characters in mathnormal fonts have a 0-width left
  bearing.

* Implement subscript positioning in the case of rule 17 using negative italic
  correction (kerning_).
2017-01-31 22:55:00 +01:00
Juergen Spitzmueller
580efe45ab Nomencl.ui: minor layout improvement. 2017-01-30 09:14:21 +01:00
Juergen Spitzmueller
48af150896 Update tex2lyx tests 2017-01-30 08:29:16 +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
Jean-Marc Lasgouttes
8e7d0c2002 Fix flushing of row that was cut after an hyphen
When using Qt stuff in breakAt, it may happen that the row is broken
after an hyphen (whereas the old code would only consider spaces).

The fact that we abuse the Row::right_boundary() property to detect when
a row should be flushed broke justification when a row is cut at an
hyphen.

Fix this by introducing a new Row::flushed() property and set it as needed.
2017-01-27 16:09:03 +01:00
Juergen Spitzmueller
ef387c81af Handle backslash in escape function.
Fixes: #4595.

Candidate for stable
2017-01-27 09:15:47 +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
Guillaume Munch
5b2674c1db Update child's TocBackend as well
Before 3391fed3, this was done in InsetInclude::addToToc
2017-01-27 00:42:37 +01:00
Jean-Marc Lasgouttes
8491962c6b Fix wrong splitting of text row
The code that tries to decide whether it is worth splitting a given
text row element had a shortcoming: it did not take into account the
left margin of the new row that would be created.

The problem is that this left margin is not the same as the left
margin of the current row, because there can be for example
indentation effects.

To fix this problem, we pass the amount of available space on the
next row as a parameter of Row::shortenIfNeeded.

Note that there is no need to care about RtL row elements at this
point, since the bidi algorithm will be applied to the row
subsequently.
2017-01-26 14:16:24 +01:00
Enrico Forestieri
ebd96fadd5 Ignore QT_SCALE_FACTOR for Qt < 5.6
This environment variable was introduced in Qt 5.6.0
2017-01-25 20:00:54 +01:00
Tommaso Cucinotta
eaa3ddaf45 turned message about disabled converters from prefs from warning to error 2017-01-25 03:10:56 +01:00
Jean-Marc Lasgouttes
000832f9d9 Use Paragraph::getAlign in TextMetrics
This avoids some duplicate code. Note that the return value of
Paragraph::getAlign had to be changed. I suspect it was set to char to
avoid reading one header file in Paragraph.h.
2017-01-24 19:33:03 +01:00
Jean-Marc Lasgouttes
1f352b390c Avoid markers for macros without arguments
An example was the \neq macro, which exhibited white markers when selecting.
2017-01-23 10:14:20 +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
Enrico Forestieri
9e6cf6e05a Allow to properly scale the GUI with Qt5
Starting with Qt 5.6, setting the environment variable QT_SCALE_FACTOR
makes everything accordingly bigger. So, if QT_SCALE_FACTOR=1.2, all
text and GUI elements are rendered 20% bigger. However, if an application
does not account for this, everything will also look "blocky".
With this commit, all text and images will be scaled remaining sharp.
This works whether a HiDpi screen is used or not, but is mostly useful
with a HiDpi screen, as all GUI elements are more spaced apart and one
can use the mouse for selecting things without requiring a high precision.
2017-01-22 01:06:00 +01:00
Juergen Spitzmueller
9cad99c2b5 update tex2lyx tests 2017-01-21 14:46:43 +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
Enrico Forestieri
633ad2032e Add clarifying comment 2017-01-20 20:30:06 +01:00
Jean-Marc Lasgouttes
4a935ed768 Fix metrics of math characters with 0 width
It seems that QTextLayout does not handle properly a single character
with 0 width. This breaks drawing of things like \not.

Actually the problem had been worked around already in lib/symbol. The
work around can therefore by removed now.
[additionally, remove extra spacing from \mapsto, \Mapsto]
2017-01-20 10:53:06 +01:00
Pavel Sanda
c9c2179c1f Fix make check. 2017-01-19 17:00:18 -08:00
Richard Heck
0d77a7e325 Allow LyX to open empty files (created, e.g., via "touch").
Patch from new contributor Jan Niklas Hasse.
2017-01-19 15:34:45 -05:00
Jean-Marc Lasgouttes
d712c67be9 BOX tweak
Add a pixel gap around boxes.

When a box is invisible, its width should be null (but keep the weight
to avoid drawing problems (think empty sqrt in a macro).
2017-01-19 17:07:21 +01:00
Jean-Marc Lasgouttes
5982d2abd7 Revert "BOX tweak"
This reverts commit 596c9065e6.
2017-01-17 16:31:34 +01:00
Jean-Marc Lasgouttes
f73bb3f16e Fix glitch in drawing fractions
This is a fixup to 89662a68.
2017-01-17 16:28:48 +01:00
Jean-Marc Lasgouttes
596c9065e6 BOX tweak 2017-01-16 15:35:45 +01:00
Juergen Spitzmueller
4859a1f6bb Don't load bibtopic with Biblatex 2017-01-15 15:40:20 +01:00
Guillaume Munch
fdf805956b Fix font of macro template name 2017-01-14 23:13:14 +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
Guillaume Munch
54f5100e74 Simplify
The main point is the flag which is much simpler now.
2017-01-14 23:13:14 +01:00
Guillaume Munch
bd1ce03b40 Two separators collapse into one
It seems guaranteed by the Qt docs that two menu separators collapse into
one. This allows this little simplification.
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
b3cc07e3a6 Trim biblio options and biblatex styles 2017-01-14 14:28:35 +01:00
Juergen Spitzmueller
16701fa39e Address FIXME 2017-01-14 14:25:49 +01:00
Juergen Spitzmueller
34943a4e5f Make Japanese Biblatex-aware
Biblatex can be used with Japanese, but then, biber (not pbibtex) should
be used as processor.

I this context, bring the jbibtex UI in line with bibtex, allowing for
a selection of alternatives.
2017-01-14 12:13:33 +01:00
Juergen Spitzmueller
5b0de8c373 Allow new buffer params to be reset to empty 2017-01-14 09:59:33 +01:00
Juergen Spitzmueller
1eb43536da Add an "Automatic" bibliography processor pref option
This is now set as default. It selects biber for Biblatex (with
fall-back to first bibtex8, then bibtex, if the former is not
installed), and bibtex for BibTeX-based engines.

With this, users do not normally need to care for the processor when
they switch cite engines.
2017-01-13 19:18:35 +01:00
Juergen Spitzmueller
384723b63f update tex2lyx tests 2017-01-13 18:27:38 +01:00
Juergen Spitzmueller
fc546b7dcc Basic support for natbib & jurabib options
This re-uses the options line edit introduced for biblatex.
2017-01-13 18:23:42 +01:00
Kornel Benko
cf3f4814d9 Adapt the cmake-build-system to the reworked biblatex handling 2017-01-13 13:17:12 +01:00
Juergen Spitzmueller
493f6c6cd3 update tex2lyx tests once more 2017-01-13 11:57:39 +01:00
Juergen Spitzmueller
327602d01d Implement "key only" citation style
File format change.
2017-01-13 11:53:22 +01:00
Juergen Spitzmueller
d401a46267 Clear styles widgets only if needed. 2017-01-13 10:57:53 +01:00
Juergen Spitzmueller
013515e450 Update tex2lyx tests 2017-01-13 10:13:47 +01:00
Juergen Spitzmueller
7f97ace83b Merge branch 'master' into biblatex2 2017-01-13 09:11:04 +01:00
Juergen Spitzmueller
6b214804f6 Assure long tooltip is correctly formatted.
Amendment to ffb195b5e9
2017-01-13 09:07:44 +01:00
Juergen Spitzmueller
239b9919ff Merge branch 'master' into biblatex2 2017-01-12 14:29:55 +01:00
Juergen Spitzmueller
9b13217f7b Use master buffer params when appropriate 2017-01-12 12:19:14 +01:00
Jean-Marc Lasgouttes
cdc847fd30 Fix drawing of empty boxes
They were actually bigger than their metrics.
2017-01-12 12:15:17 +01:00
Jean-Marc Lasgouttes
8361fb603e Rename InsetMathNest::metrics to cellsMetrics
Re-using the name of a virtual method with different semantics is not
a good idea anyway.
2017-01-12 11:22:51 +01:00
Jean-Marc Lasgouttes
4cea47d1eb Implement mathClass() for \big and friends
The information here is obtained by reading LaTeX sources.
2017-01-12 10:28:52 +01:00
Juergen Spitzmueller
ce8929e9b2 Merge branch 'master' into biblatex2 2017-01-12 09:05:28 +01:00
Richard Heck
a7aef29600 Update tex2lyx tests. 2017-01-11 14:16:28 -05: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
Jean-Marc Lasgouttes
605438f26d Fix issues with macro_nesting handling
The rewrite of macro_nesting done at 0f15dcc6 was faulty, in
particular since the information should be available also at draw
time. To this end, we revert the patch of the said commit that removes
macro nesting information from MathRow::Element. In the next commit,
we will change the marker code so that MathRow::draw does not need the
nesting information.

Actually the code is now cleaner since the macro nesting stack of
MathRow::metrics can be removed.
2017-01-11 17:33:43 +01:00
Juergen Spitzmueller
74f774d6cf Merge branch 'master' into biblatex2 2017-01-11 10:45:48 +01:00
Juergen Spitzmueller
96ffb70cd5 Command line option to ignore error msgs
Needed by the test framework
2017-01-11 09:21:13 +01:00
Jean-Marc Lasgouttes
d221d1734a Fix display of empty box in nested macros
The rewrite of nesting handling at 0f15dcc6 was incomplete: the
macro nesting has to be reset to 0 when inside a macro argument at
level 1.
2017-01-10 14:14:57 +01:00
Juergen Spitzmueller
b9aabe6d89 Merge branch 'master' into biblatex2 2017-01-10 08:20:49 +01:00
Guillaume Munch
8914ddeaee Reorganise and simplify 2017-01-09 23:15:16 +01:00
Guillaume Munch
597de9bb8d Remove comments about enumification of toc types
This is no longer likely to happen.
2017-01-09 23:15:16 +01:00
Juergen Spitzmueller
425c190d62 merge recent changes from master 2017-01-09 20:04:32 +01:00
Juergen Spitzmueller
ffb195b5e9 Clarify layout and add some tooltips
Addresses: #9795
2017-01-09 18:54:49 +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
Guillaume Munch
089b80fc7d Menus: Factor Toc code 2017-01-09 18:22:22 +01:00
Guillaume Munch
ab98adf925 Move Tocs to the "Other lists" submenu based on a blacklist
This causes user-defined Tocs to appear in the main list
2017-01-09 18:22:22 +01:00
Juergen Spitzmueller
a751c5b846 Extend and improve name list handling
This allows to generate different name lists depending on the need and
context.

Also addresses #8489.
2017-01-09 17:54:56 +01:00
Juergen Spitzmueller
322808281f Merge branch 'master' into biblatex2 2017-01-09 09:53:20 +01:00
Juergen Spitzmueller
a04a2f9a8a Remove Requires and Excludes from CiteEngines
These are exclusive anyway.
2017-01-09 09:04:37 +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
Richard Heck
b730419470 Fix DocBook DTD identifier for XML output.
Thanks to Martin Brown for the correct one.
2017-01-08 13:37:00 -05:00
Juergen Spitzmueller
b81b439dec No punctuation in labels! 2017-01-08 15:24:39 +01:00
Juergen Spitzmueller
8319b3e9d6 Biblatex support
File format change
2017-01-08 09:39:46 +01:00
Juergen Spitzmueller
ecbd047cff Merge branch 'master' into biblatex2 2017-01-08 09:06:26 +01:00
Richard Heck
21259b66b5 Allow use of noprefix option even if we're not using refstyle.
I'm not sure why that would be useful, but there's no reason not
to allow it.
2017-01-07 17:26:06 -05:00
Richard Heck
2fbd9f6405 Alphabetize the list of LFUNs in LyXAction.cpp.
No one seems to  have been adding them `thematically', and it's too
hard to know how to do that, anyway. This at least makes it easier
to scan through the list.

I have verified, by re-generating LFUNs.lyx, that no significant
changes have been made here.
2017-01-07 16:00:37 -05:00
Richard Heck
ff3690a5fd Add a "noprefix" option to the "labelonly" version of the reference
inset.

If the reference is "sec:mysec", then this will output just "mysec".
This is what is needed, e.g., to use refstyle's range commands, e.g.,
    \secrangeref{mysec1}{mysec2}
You *cannot* use:
    \secrangeref{sec:mysec1}{sec:mysec2}
even if those are the actual labels.

Eventually, I'd like to add native support for this, but I'm a bit
frightened of trying to make the reference dialog support multiple
selections.
2017-01-07 15:07:44 -05:00
Juergen Spitzmueller
6974e1ceb2 Correctly set quote styles combo 2017-01-07 20:07:45 +01:00
Juergen Spitzmueller
dbbefcd321 Dynamically set final punctuation of bib entries
Fullcite does not need the punct.
2017-01-07 17:55:38 +01:00
Juergen Spitzmueller
53654b430e Make max_key_size limit adjustable
This _must_ be increased for xhtml output of fullcite, else we get
fragmentary html code.

I am aware of the reason for this size limit (#8944) and have carefully
checked that this is not affected.
2017-01-07 17:46:18 +01:00
Juergen Spitzmueller
2ff40fba72 Add a couple more BiblioInfo conditionals
* ifentrytype:<type> whether we are a specific entry type (e.g. "book")

* export: export context (as opposed to dialog or workarea)

* second: whether we are in the second item of a list (useful when you
  need to separate by " and " or ", and "
2017-01-07 17:45:51 +01:00
Juergen Spitzmueller
378a2c8257 Outsource jurabib specials to the style file. 2017-01-07 17:40:23 +01:00
Juergen Spitzmueller
fa2cbb730c Limit InsetCitation tooltip to sensible length 2017-01-07 17:38:25 +01:00
Juergen Spitzmueller
db889bc6a7 Add items to toggle "Force uppercase" and "Full author list" to the context menu 2017-01-07 17:37:35 +01:00
Juergen Spitzmueller
eba2f0479e Implement display of starred cite commands
This entails a change of getAbbrAuthor to getAuthorList (the default is
still abbreviated with respect to MaxCiteItems, but the list can be, at
explicit request, shortened or full notwithstanding MaxCiteItems.
2017-01-07 17:32:45 +01:00
Juergen Spitzmueller
6933051747 Implement display of forceUpperCase 2017-01-07 17:21:41 +01:00
Juergen Spitzmueller
3a0d1d1049 Implement CiteItem in the chain
This allows us to get rid of many idiosyncratic arguments and gives us
a cleaner chain (plus easier extensibility).
2017-01-07 17:17:02 +01:00
Juergen Spitzmueller
2f1d1a60ac Add CiteItem class
This will be used to transfer any single-cite related information from
anywhere to BiblioInfo (instead of the many strings and bools we use
until now).

This is a prerequisite for some forthcoming fixes and enhancements.
2017-01-07 16:46:00 +01:00
Juergen Spitzmueller
979294d5ec New tag MaxCiteNames
This determines the number of authors before "et al.". We had it
hardcoded to 2, but actually the nuumber differs.
2017-01-07 16:44:27 +01:00
Guillaume Munch
ca6bc682e4 Lost in refactoring 2017-01-07 14:38:00 +01:00
Juergen Spitzmueller
23c231c761 Merge branch 'master' into biblatex2 2017-01-05 14:30:26 +01:00
Juergen Spitzmueller
4590f1016b Tweaks to the quotes GUI
This follows some suggestions put forward yesterday.
2017-01-05 14:25:36 +01:00
Guillaume Munch
d9018f14a6 Fine tune the math class of InsetMathScript after a4676712 2017-01-05 12:04:35 +01:00
Richard Heck
fe0d73dead Not sure why "notr = 'true'" got in there. 2017-01-04 16:01:32 -05:00
Richard Heck
e2ef07207e Some tooltips. 2017-01-04 12:50:51 -05:00
Juergen Spitzmueller
78eb821038 Fix default biblio style detection 2017-01-04 17:11:25 +01:00
Juergen Spitzmueller
7fe596b459 Consider possibility of empty tooltip 2017-01-04 13:29:57 +01:00
Juergen Spitzmueller
f6d4bce123 Merge branch 'master' into biblatex2 2017-01-03 21:49:56 +01:00
Guillaume Munch
a467671283 Define mathClass of MathMacro
Enables intelligent splitting for math macros.

Crucially improves the detection of math words for the new Ctrl-Arrow movement.
2017-01-03 20:35:41 +01:00
Guillaume Munch
eb2d373e4b Fix wrong parse of macro parameter and crash
Copy-pasting $#\n$ from text to LyX gives the error message:

    MathMacroArgument::MathMacroArgument: wrong Argument id

and it is not hard to get a crash soon after.

There are legitimate uses of # not followed by 1..9 in LaTeX and it is good to
parse them correctly when importing from LaTeX.
2017-01-03 20:35:41 +01:00
Guillaume Munch
981f065bde New word-movement behaviour in Math
Following discussion on the list:
https://www.mail-archive.com/lyx-users@lists.lyx.org/msg103012.html

This defines a new behaviour for Ctrl[+Shift]+Arrow in math:

* Left/Right does not enter insets

* Left/Right jump groups of insets that have the same math class ("words")

* Enable Up/Down for consistency.
2017-01-03 20:35:41 +01:00
Guillaume Munch
087f72202e Use math class information from lib/symbols for intelligent splitting
This was missing for macros defined in lib/symbols. This only affects the
equation splitting since global macros are always linearized. This fixes #10107.
2017-01-03 20:35:41 +01:00
Guillaume Munch
3e79e0f5f0 Fix wrong mode on output for macros that shadow global macros
Testcase: Define a math macro \AA, overriding the definition of \AA from
lib/symbols, then insert it in math mode.

* Before this commit: \text{\AA}, and \lyxmathsym{\AA} after deleting \text, but
  displayed like \AA.

* After this commit: \text{\AA} is inserted, but one gets \AA after deleting
  \text. The output is now consistent with the display and the meaning.

* Expected: only \AA is inserted. This is unfortuately not what one gets; for
  this to work, the scope of the macros would need to be resolved upon creating
  the inset.
2017-01-03 20:35:20 +01:00
Guillaume Munch
e35fda62a7 Some code factoring for changing mode.
About removing the changeEnsureMath in MathMacro::{metrics,draw} : as it is only
called in edition mode, it only happened for user macros for which no ensureMath
is needed anyway. ChangeEnsureMath should indeed be applied for global macros,
but since they are linearized there is no obvious place to call it.
2017-01-03 20:18:48 +01:00
Guillaume Munch
2de30c62f8 Remove hardcoded values 2017-01-03 20:18:48 +01:00
Juergen Spitzmueller
18d6701a40 No need to hardcode the possible cite commands
We fall back to a sensible default anyway.
2017-01-03 17:27:51 +01:00
Juergen Spitzmueller
e6666bd62a Generalize starred cite commands
Not all of them expand the author list. Thus rename the parameter to
hasStarredVersion and provide a means to adjust the GUI accordingly.
2017-01-03 17:25:41 +01:00
Juergen Spitzmueller
c88259453c Fix the alias detection 2017-01-03 15:05:55 +01:00
Juergen Spitzmueller
958f6193ed Differentiate InsetCite
Next to the cmd name, introduce optional latex names (that might differ
from the cmd name) and aliases (that are "obsoleted by" the cmd).

This enhances portability between the engines.
2017-01-03 13:11:11 +01:00
Juergen Spitzmueller
0b4d9d8d4a Generalize uppercase test
Biblatex has \Textcite and friends.
2017-01-03 13:01:41 +01:00
Richard Heck
c13fa33d87 Update tex2lyx tests to new format. 2017-01-02 22:32:45 -05:00
Richard Heck
00b8f04988 Adapt tex2lyx to the new file format. 2017-01-02 22:32:45 -05:00
Richard Heck
73f59e87bd Add ability to use refstyle's plural and capitalization features. 2017-01-02 22:32:36 -05:00
Richard Heck
78a76cc8d4 Update tex2lyx tests. 2017-01-02 18:14:41 -05:00
Richard Heck
c513c26e62 Label only command for reference dialog. 2017-01-02 18:08:30 -05:00
Juergen Spitzmueller
867cdb0662 Extend the Bibfiles cache
For biblatex, we need the file name as it was entered in the inset
(abs path, rel path, only file name) in order to resolve it properly
for the export (as in the BibTeX inset intself).

Therefore, we now store a pair<docstring, FileName>.

A FileNamePairList has been added to FileNameList for this purpose.
2017-01-02 13:00:14 +01:00
Juergen Spitzmueller
ee653e1968 Amend 8add88ee49: Show Biblatex files in the TeXInfo dialog
UI file was forgotten.
2017-01-02 12:05:14 +01:00
Juergen Spitzmueller
8cadee45e9 GuiLog: Detect Biber for the GUI. 2017-01-02 12:00:10 +01:00
Juergen Spitzmueller
63be00c8bc Use real command in runparams.bibtex_command 2017-01-01 12:43:23 +01:00
Juergen Spitzmueller
8add88ee49 Show Biblatex files in the TeXInfo dialog 2017-01-01 11:34:35 +01:00
Juergen Spitzmueller
8239e66c94 Add BufferParams::bibtexCommand()
This function returns the real command (either per lyxrc or bufferparam)
2017-01-01 10:49:22 +01:00
Juergen Spitzmueller
5d58bfadbc Make biblio_style private
This should never ever be accessed directly
2017-01-01 08:37:56 +01:00
Juergen Spitzmueller
dc9efe3d47 Add a CiteFramework tag
This is to distinguish the biblatex and bibtex paradigms
2017-01-01 08:07:04 +01:00
Juergen Spitzmueller
c72ecbcd1b Improve style.
Thanks, José!
2017-01-01 08:07:04 +01:00
Juergen Spitzmueller
4cbd28e3fe Fix isDefaultBiblio() test 2017-01-01 08:07:03 +01:00
Juergen Spitzmueller
ff93aea509 Rework default bibliography style UI
* Use a combo with all available styles
* Correctly reset default on engine change
* Consider that EngineTypes might have different defaults
2017-01-01 08:07:03 +01:00
Juergen Spitzmueller
59a4f263a4 Properly support the cite engines in the GUI
Instead of hardcoding 3 engines, we now support all engines which are
defined in the *.citeengines files.
2017-01-01 07:56:24 +01:00
Juergen Spitzmueller
97aea7e5b1 Disentangle CiteEngines and Modules
These two are different beasts and thus should be handled differently.
2017-01-01 07:56:24 +01:00
Guillaume Munch
9a9288d67d Fix memory leak with WordLists
https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg198230.html
2016-12-31 15:29:43 +01:00
Guillaume Munch
0eb0b8531a Convert a pointer to a reference
The validity of the reference is guaranteed by QThreadLocalStorage
2016-12-31 15:28:43 +01:00
Guillaume Munch
832b99a394 Remove a redundant deletion of a QObject 2016-12-31 15:16:15 +01:00
Guillaume Munch
cde3f6b84c TocWidget: Remove possibly dangling BufferView pointer 2016-12-31 15:16:15 +01:00
Guillaume Munch
3d6a7a1200 Fix dangling inset pointers after buffer reload
https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg198191.html

The root of the issue is in Buffer::reload() called during "Save As".  After
loadLyXFile() there, all the insets have been deleted, and therefore the Inset
pointer GuiView::documentBufferView()->cursor().inset() is dangling. Immediately
after loadLyXFile(), reload() calls updateBuffer() which causes a segfault.

While debugging I got other segfaults caused by the same dangling Inset pointer
in Cursor, notably: 1) a trace identical to the second one from
<http://www.lyx.org/trac/ticket/10520>, and 2) a similar segfault in the
critical path after emergency saving (call to inMathed()).

Having to "refresh" by hand the inset pointer cache in CursorSlice is very
unsatisfactory, but there does not appears to be a consistent strategy for
managing these Inset pointers in CursorSlice.
2016-12-31 15:16:15 +01:00
Guillaume Munch
550567d8f2 Remove outdated comment
UpdateToolbars is no longer slow
2016-12-31 15:01:12 +01:00
Richard Heck
ed0e4064d2 Don't need the else, since all codepaths return. 2016-12-30 11:05:01 -05:00
Richard Heck
410b0fa581 Invert logic. 2016-12-30 11:05:01 -05:00
Richard Heck
ee251c626c Re-organize, whitespace. 2016-12-30 11:05:01 -05:00
Richard Heck
b8216513d6 Remove useless for loop. 2016-12-30 11:05:01 -05:00
Juergen Spitzmueller
ec2520677c More precise format description 2016-12-29 17:36:55 +01:00
Juergen Spitzmueller
01c2433070 The usual tex2lyx tests update after file format change 2016-12-29 16:48:22 +01:00
Juergen Spitzmueller
f8a85f35be Add support for the Crimson font
We use the more comprehensive cochineal package if available and fall
back to the crimson package, if not.

Math support is provided by means of newtxmath

Fixes: #9974, #9976
2016-12-29 16:45:19 +01:00
Scott Kostyshak
b613be1dd8 Warn if child has diff non-Tex font settings
It is easy to come across problems when the settings are not the
same.

This is consistent with our current warning about different document
classes.

For discussion and a motivating MWE, see:
https://www.mail-archive.com/search?l=mid&q=20161121024539.kn6rsqotaw4n2efk%40klay
2016-12-29 06:12:02 -05:00
Juergen Spitzmueller
3522782c44 Fix two hyperlink-insert problems
1. Do not prematurely cut selection (#10306); patch proposed by Daniel Ramöller
2. Obey lfun argument, even if there is a selection
2016-12-29 09:17:53 +01:00
Jean-Marc Lasgouttes
eeb6e8333c Fixup c49cd699: QString::toStdString is not always available
This method requires STL support in Qt. Fortunately, it is not needed
here.
2016-12-28 22:44:40 +01:00
Juergen Spitzmueller
c49cd69998 From c7899a30a0b5975bf599a69ecd11ab25e1cdf1a4 Mon Sep 17 00:00:00 2001
From: "Joel A. Kulesza" <jkulesza@gmail.com>
Date: Mon, 24 Oct 2016 17:37:58 -0600
Subject: [PATCH] Add "Swap & Reverse" to math delimiter dialog

When "Keep matched" is unchecked, a button becomes enabled to "Swap &
Reverse" the left and right delimiters.  This is expected to be of use
with line-wrapped equations featuring one or more set of delimiters that
break across the lines.  When "Keep matched" is checked, the button is
visible but disabled.

The most common use case is expected to be the user entering a pair of
unmatched delimiters on the first line of an equation (e.g., "(" and
"(None)"), entering the inner text, going to the next line, and
inserting the opposite set of delimiters (e.g., "(None)" and ")").
This button will negate the need to find the correct corresponding
combination.  However, it relies on the dialog's memory of the previous
unmatched set.

This change addresses Ticket #10457

-----------

Modifications by spitz to the original patch:

* Only enable the button if an unmatched pair is selected
* Consider l7n when locating the string "(None)"
* Add an accelerator and a tooltip to the dialog
* Simplify the code a bit
2016-12-28 16:34:44 +01:00
Guillaume Munch
750cbde62e Status bar information for InsetMathKern
\mkern is invisible in mathed as a consequence of 10c8d51b. Add information in
the status bar when it is there.
2016-12-27 19:25:46 +01:00
Juergen Spitzmueller
2f03e156ce Add some line breaks 2016-12-27 16:03:41 +01:00
Juergen Spitzmueller
c0000cc405 Improve quotation mark opening/closing guess
Fixes: #8831

This introduces
* a new inset member isPartOfTextSequence() that returns
whether the inset produces something visible at the current position
in the text flow
* an isOpenPunctuation() test that returns whether a character is in the
'Punctuation, Open' unicode class. This is used instead of just checking
for two (Western, ASCII) opening brackets

It also fixes the isChar() and isLetter() value of InsetSpecialChar,
since some types have not been assigned correctly.
2016-12-27 12:06:54 +01:00
Juergen Spitzmueller
421853d1bf Handle the case of TeX fonts LuaTeX 2016-12-26 14:41:14 +01:00
Juergen Spitzmueller
e21733037f update tex2lyx tests 2016-12-26 14:04:52 +01:00
Juergen Spitzmueller
89ce0c9069 Support for CJK quotation marks
File format change

Fixes: #2712
2016-12-26 14:03:48 +01:00
Juergen Spitzmueller
229f3863f9 Do not attempt to add dynamic quotes to the style combo 2016-12-26 11:25:34 +01:00
Juergen Spitzmueller
e4b84371ac add missing bit 2016-12-26 10:47:28 +01:00
Juergen Spitzmueller
7533e7a0a1 Use master buffer params for quote style
+ some formatting polishment
2016-12-25 17:23:07 +01:00
Juergen Spitzmueller
2ebd535e99 Update tex2lyx tests 2016-12-25 12:20:06 +01:00
Juergen Spitzmueller
36a679344a Implement dynamic quotation marks
File format change.
2016-12-25 12:19:02 +01:00
Juergen Spitzmueller
6abe8dc6ae Update tex2lyx tests 2016-12-24 14:31:59 +01:00
Juergen Spitzmueller
237193f8a8 Some new quote styles
* b    `british'    (``inner quotation'')
* w    >>swedishg>> ('inner quotation')   ["g" = Guillemets]
* f    <<french>>   (``inner quotation'')
* i    <<frenchin>> (<<inner quotation>>) ["in" = Imprimerie Nationale]
* r    <<russian>>  (,,inner quotation``)

Rename "french" to "swiss"

Also rename "single/double" to "secondary/primary" ("inner/outer" in
the UI) and "left/right" to "opening/closing". Note that the inset
identifier string is left as is ("s/d" and "l/r")
2016-12-24 14:27:00 +01:00
Juergen Spitzmueller
45df1e87a9 Fix glitch introduced in 2e255b1c4f
set correct combo values.
2016-12-24 13:32:49 +01:00
Juergen Spitzmueller
2e255b1c4f Restructure InsetQuotes for better extensibilty
The current char-based implementation gets increasingly unreadable,
especially if styles are added that do not follow the strict
single-double paradigm.
2016-12-24 10:13:51 +01:00
Juergen Spitzmueller
1ed70d10fd Add "Plain" quotation mark style
File format change
2016-12-21 15:17:30 +01:00
Juergen Spitzmueller
9aec8fd5e8 Handle fontenc in InsetQuotes::updateBuffer 2016-12-21 12:29:32 +01:00
Juergen Spitzmueller
59b8253bac Update tex2lyx tests for format 519. 2016-12-20 18:57:34 +01:00
Juergen Spitzmueller
857506e992 Rename \\quotes_language to\\quotes_style
File format change.
2016-12-20 18:54:07 +01:00
Juergen Spitzmueller
cce4639b55 Rename some quote-related params
Quote Language -> Quote Style
Quote Times-> Quote Level

No change in functionality.
2016-12-20 17:55:43 +01:00
Jean-Marc Lasgouttes
a3b877eccc Update description of cursor classes 2016-12-20 12:14:21 +01:00
Guillaume Munch
e6fec70c48 Thickness of \cancel 2016-12-20 00:15:59 +01:00
Guillaume Munch
4a85a28ea5 Fix missing \bigg variants for \llbracket 2016-12-20 00:15:59 +01:00
Guillaume Munch
a44e7aa915 Factor code for math axis height 2016-12-20 00:15:59 +01:00
Guillaume Munch
e02f287f8b Add InsetMathClass to the list of math completions 2016-12-20 00:15:59 +01:00
Guillaume Munch
ea7704a354 Do not rely on toolTip() to generate LaTeX code 2016-12-20 00:15:59 +01:00
Guillaume Munch
6d375ddeac Fix compilation with Qt5.8dev 2016-12-20 00:15:58 +01:00
Guillaume Munch
9d94b055e2 MathClass of xrightarrow & co 2016-12-20 00:15:58 +01:00
Jean-Marc Lasgouttes
c5119c97fc Add caching for the QTextLayout objects we use
The QTextLayout handling is terribly slow on Qt 4.8.7, but some
caching has been added in Qt5 that makes it much faster. For some
reason, it is not that slow with Qt 4.8.1.

Caches are introduced for the three following methods

* width(doctring), controlled by CACHE_METRICS_WIDTH. This cache already
  existed, but the code has been cleaned up

* getTextLayout, controlled by CACHE_METRICS_QTEXTLAYOUT (disabled by
  default on Qt5, which does its own caching). This is used for pos2x
  and x2pos and now for drawing of text too. The previous code used a
  trivial caching scheme of the last used QTextLayout, but now they
  are properly kept in a QCache. Moreover, the cacheEnabled() property
  is enabled for these QTextLayout object (not sure what this does).

* breakAt, controlled by CACHE_METRICS_BREAKAT. This is the only user
  of QTextLayout which did not have some kind of caching already.

For some weird reasons related to Argument-dependent look-up, the
qHash(docstring) function has to be defined in std namespace, since
lyx::docstring is actually std::basic_string<wchar_t>.

[NOTE: this version has profiling hooks, enabled by commenting out the line
  #define DISABLE_PMPROF
that should eventually be removed.]
2016-12-19 18:47:18 +01:00
Tommaso Cucinotta
a95385ab29 Fix segfault on null buffer in Converters::checkAuth(), introduced in [244de5d2/lyxgit]. 2016-12-19 18:16:50 +01:00
Juergen Spitzmueller
0d92eaeb11 Further improve quote-inserts documentation 2016-12-19 11:39:56 +01:00
Günter Milde
7b5de36a75 Use xfrac package for "fraction characters".
The xfrac package is the "state of the art" for "split-level" (nice) fractions.
Character replacements look consistent, scale properly and fit in the line.

Fixes #5220.
2016-12-18 23:42:15 +01:00
Juergen Spitzmueller
57eaf5dc4b Update inset-modify description 2016-12-18 14:00:08 +01:00
Juergen Spitzmueller
092bbcede5 Some documentation of quote's inset-modify 2016-12-18 13:38:41 +01:00
Juergen Spitzmueller
5583186393 Thinko
This needs to be a char_type, not char.
2016-12-18 13:13:19 +01:00
Juergen Spitzmueller
a3bb0db658 Allow wildcards in inset-modify for quotes
A dot in the <lang><side><times> string means: keep current value.

This expert feature allows to change arbitrary quote features in one step.

E.g.,

inset-forall Quotes inset-modify changetype f..

=> change all quote insets to French style, maintaining current side
   and times setting

inset-forall Quotes inset-modify changetype ..s

=> change all quote insets to single quotes, keeping style and times

inset-forall Quotes inset-modify changetype g.s

=> change all quote insets to German single quotes, keeping left/right
   setting

Any idea where to document this?
2016-12-18 10:29:35 +01:00
Juergen Spitzmueller
e4ca4a564d whitespace. 2016-12-18 09:54:37 +01:00
Juergen Spitzmueller
5c1fb98885 Whitespace 2016-12-17 12:59:03 +01:00
Juergen Spitzmueller
197c193e21 Context menu for quote insets
Allows to switch quote type.
2016-12-17 12:58:33 +01:00
Juergen Spitzmueller
7bf6d2b9ce Extend quote-insert
Two more optional arguments to specify side and quote style.
GUI support follows.
2016-12-16 11:23:22 +01:00
Juergen Spitzmueller
14dbaa7608 context-sensitive command termination at some more places. 2016-12-16 10:20:25 +01:00
Juergen Spitzmueller
5dfd1d0f4b remove archaic comments.
lyx3 was a vision of the last century.
2016-12-16 09:27:10 +01:00
Juergen Spitzmueller
d8df5397ca Use context-sensitive command termination
This fixes some kerning issues.
2016-12-16 09:26:01 +01:00