Commit Graph

24099 Commits

Author SHA1 Message Date
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
Juergen Spitzmueller
c37fde6559 Literal quotation mark chars for polyglossia 2016-12-15 10:41:10 +01:00
Juergen Spitzmueller
4725bdd00e InsetQuotes::latex: some cleanup
Also switch to docstring in preparation for unicode quotation marks
2016-12-15 10:26:42 +01:00
Juergen Spitzmueller
ef689655f4 Remove redundant blank 2016-12-15 09:18:52 +01:00
Richard Heck
6915fc7de8 Update tex2lyx references after last format change. 2016-12-13 21:51:11 -05:00
Richard Heck
b75c718d57 New format for changes to iopart.layout made at 91f980cf31. 2016-12-13 21:49:04 -05:00
Juergen Spitzmueller
d4550b7a4d Limit ligature protection to quote ligature chars
Should also go to stable.
2016-12-13 07:50:08 +01:00
Juergen Spitzmueller
89c4357bf1 Fix Hebrew quotation marks
All typographic quotation marks are supported, if the proper
LaTeX macros (as opposed to ligatures) are used.

So no need for forcing straight quotes.

This is in line with what babel-hebrew suggests.
2016-12-12 18:08:20 +01:00
Juergen Spitzmueller
ec4adcc3a5 Add FIXME 2016-12-12 18:00:28 +01:00
Juergen Spitzmueller
1f84ae63d9 Thinko 2016-12-12 17:52:59 +01:00
Juergen Spitzmueller
d739e48574 Fix command termination before line breaks. 2016-12-12 17:00:20 +01:00
Juergen Spitzmueller
526b6a4afc Correctly handle the " \\fg" case. 2016-12-12 16:57:06 +01:00
Juergen Spitzmueller
83d2c7fa37 Properly terminate quote macros by means of new textstream function
This prevents kerning destruction.
2016-12-12 15:57:42 +01:00
Juergen Spitzmueller
66f7c2930a texstream: implement way to terminate a command depending on the context
i.e.,
* space if non terminating char follows
* {} if space follows
* nothing if \, { or } follow
2016-12-12 15:55:28 +01:00
Juergen Spitzmueller
84ffa4b834 Update tex2lyx tests
Thanks Scott for the heads-up!
2016-12-12 10:27:26 +01:00
Juergen Spitzmueller
dc38b66e60 Do not use babel quotation mark macros with non-TeX fonts
These rely on [O]T1 font encoding.

Also, add some comments.
2016-12-10 17:25:04 +01:00
Juergen Spitzmueller
449a89825b Fix xhtml output of French double guillemets (spacing) 2016-12-10 16:13:02 +01:00
Juergen Spitzmueller
6e0cfe5bee Do not output quote TextCommand definitions for polyglossia
These are meant to be output for non-T1 8bit font encodings.
2016-12-10 16:07:04 +01:00
Juergen Spitzmueller
fc1fa0698b The extra space for French quotes only applies to guillemets. 2016-12-10 14:59:45 +01:00
Tommaso Cucinotta
6e22bb17c7 Remove unused lyxrc.use_converter_wrappers that inadvertently slipped through [244de5d2/lyxgit]. 2016-12-10 14:57:20 +01:00
Juergen Spitzmueller
e8c932ff84 Enable InsetQuote in verbatim and Hebrew
In this context, the inset outputs straight quotes in LaTeX.

File format change.

Fixes: #7309
2016-12-10 11:53:42 +01:00
Jean-Marc Lasgouttes
c139aef379 Add a way to disable the poor man's profiler
Just define DISABLE_PMPROF _before_ #including the header.
2016-12-09 15:47:19 +01:00
Guillaume Munch
c96faefdae Validate html
Qt html is based on html 4. </p> is in fact optional, but <p> is mandatory
around <tt>.
2016-12-08 17:23:09 +01:00
Guillaume Munch
a7b993143e Fix compilation with MSVC 2016-12-08 16:28:16 +01:00
Günter Milde
81f5e596b4 File format update after 418016bf79
Removing unsupported encoding "pt254" from \inputencoding values makes documents using this value invalid (J.S.).
2016-12-07 18:38:41 +01:00
Juergen Spitzmueller
e4c46abeb7 Fix mis-nomer 2016-12-07 16:50:54 +01:00
Juergen Spitzmueller
ad83520390 Fix some quote inset bugs:
* Adjoining closing Single + double quote becomes double + single quote
  (for English, Swedish and German, LaTeX export as ''').

* French double quotes are converted to << >> in the LaTeX file and to
  double inverted question/interrogation marks in the output, if the font
  encoding is set to [None] or OT1 but the global default is T1. (test
  for lyxrc.fontenc instead of the document-specific fontenc setting in
  InsetQuotes.cpp).

* Quote type ignored for LyXHTML: always "English" quotes used.

See #10451
2016-12-07 15:37:03 +01:00
Jean-Marc Lasgouttes
10c8d51b90 Accept \kern and \mkern for math kerning
Also output the right one depending on whether the unit is "mu" or
not. Indeed, the two macros are identical, except that \mkern only
accepts unit mu, and kern does not accept it.

With this patch, both macros accept all units, but on writing beck,
the right one is used.
2016-12-06 16:29:38 +01:00
Jean-Marc Lasgouttes
c8a829d273 Handle negative values gracefully.
It may happen (for example with on the fly spell checking) that
GuiFontMetrics::pos2x is called with a negative pos value. Add a
special case for this situation.

Fixes bug #10506
2016-12-06 16:16:57 +01:00
Jean-Marc Lasgouttes
7f6f56f40a Get rid of Inset::setDimCache
This helper method is used to set the inset dimension cache at metrics
time. However this is already done by the metrics code itself
(MathRow::metrics, TextMetrics::redoParagraph), so that there is no
need to do this same work again in a different place.

Also, InsetPhantom::metrics is removed, since it does not do anything
interesting.

This commit comes with a mild risk attached (it might be that some of
these calls were useful after all!), but all of this is fixable.
2016-12-06 16:15:47 +01:00
Jean-Marc Lasgouttes
02e82157ec Get rid of Inset::setPosCache
This helper method is used to set the inset position cache at drawing
time. However this is already done by the drawing code itself
(MathRow::draw, RowPainter::paintInset), so that there is no need to
do this same work again in a different place.

Note that the inset positions are still set in InsetTabular::draw for
each cell.

This commit comes with a mild risk attached (it might be that some of
these calls were useful after all!), but all of this is fixable.
2016-12-06 16:15:47 +01:00
Jean-Marc Lasgouttes
8aaec85c8c Now Inset::dimension is only an access to cache
Up to now Inset::dimension was either a helper function to access
CoordCache, or... something else. This created problems to properly
use it.

In particular, the definition of InsetText::dimension created problems
for child classes. Removing this definition (actually renaming it to
dimensionHelper) allows to streamline the code.
2016-12-06 09:52:17 +01:00
Jean-Marc Lasgouttes
fd50fb720f Introduce (Inset|InsetList|Paragraph)::resetBuffer
This avoids an ugly cast like
     setBuffer(*static_cast<Buffer *>(0));
that clang does not appreciate.
2016-12-05 14:48:32 +01:00
Guillaume Munch
588d939722 Cosmetic changes to the needauth dialogs
* Use rich text for this complicated message

* More concise

* Fix line breaking issues

* Remove "Do not show again" checkbox
2016-12-04 18:28:03 +01:00
Guillaume Munch
f9528c63c8 GuiAlert: Convert html to plain text on console output 2016-12-04 18:28:03 +01:00
Guillaume Munch
dbcbf305b2 Improve prediction of block outside covered areas 2016-12-04 18:28:02 +01:00
Guillaume Munch
b329b471d4 Remove useless return leftover from earlier code 2016-12-04 18:28:02 +01:00
Tommaso Cucinotta
9c1142c880 Remove unneeded templatization code from bformat(). 2016-12-04 17:10:10 +01:00
Tommaso Cucinotta
f0f555b5be Converters Prefs UI layout clarification. 2016-12-04 17:09:30 +01:00
Guillaume Munch
ee0e95aafb GuiSymbols: Better handling of empty blocks
* endInsertRow was incorrectly placed before endResetModel, sometimes leading to
  bad access by the view before it was informed that the model was empty. In
  fact begin/endInsertRows were redundant with begin/endResetModel.

* Empty blocks are not supposed to be shown. This happened when moving the
  cursor. A valid block is now selected intead. Due to the design/optimisation
  of the model update, this requires a first update with an empty
  model. Simplify the old code.
2016-12-03 23:35:15 +01:00
Guillaume Munch
a19be0314b GuiSymbols: fix char->block lookup 2016-12-03 23:35:15 +01:00
Guillaume Munch
c8d1d0d33c GuiSymbols: put ASCII chars first
Having À before A was weird. This only affects GuiSymbols.
2016-12-03 23:35:15 +01:00
Guillaume Munch
3a73b822a5 GuiSymbols: show all symbols when UseNonTeXFonts 2016-12-03 23:35:15 +01:00
Guillaume Munch
6f07721187 GuiSymbols: Improve the tooltip 2016-12-03 23:35:15 +01:00
Guillaume Munch
851ed60e49 Check the validity of an item before querying its tooltip
In case data() does not handle invalid items.
2016-12-03 23:35:15 +01:00
Guillaume Munch
03a0e983bc GuiSymbols: handle the case of an invalid data
The docs do not guarantee that the index must be valid
2016-12-03 23:35:14 +01:00
Jean-Marc Lasgouttes
d85cf3218a Remove unused method in ArgumentProxy
Also reorder some methods.
2016-12-02 16:19:02 +01:00
Jean-Marc Lasgouttes
2acc4fc54c Improve spacing of BOX elements
Tweak the algorithm so that a BOX math row element can have some
spacing. To this end, MathRow::before/after do not look at the type of
an element for deciding when to skip it, but rather to its math class.

In the new setting, the spacing algorithm works on all elements, but
skips the MC_UNKNOWN elements as if they were not present. As a
consequence, the two element types BEGIN and END have been replaced by
a single DUMMY (they can be recognized from their class).

To simply the code, add a new `mclass' argument to the
MathRow::Element constructor (default is MC_UNKNOWN).
2016-12-02 16:14:12 +01:00
Jean-Marc Lasgouttes
190d312e35 Factor out the code that handles default macro arguments 2016-12-02 14:56:09 +01:00
Jean-Marc Lasgouttes
0f15dcc698 Rewrite handling of macro nesting in math rows
Macro nesting is now recorded into the macro inset itself. This allows
the ArgumentProxy inset to determine whether it is editable or not by
looking at its macro.

Remove code in the metrics and draw methods of ArgumentProxy: this
code is AFAICS not active anymore, since arguments are linearized into
math rows.

Use Changer idiom to change locally the values of MecticsInfo::base.macro_nesting.
2016-12-02 11:56:49 +01:00
Jean-Marc Lasgouttes
58e479527e Reintroduce broken support for default macro arguments
This got forgotten in the math typesetting rewrite.

Fixes bug #10508.
2016-12-02 11:18:51 +01:00
Enrico Forestieri
e8f480e7c2 Fix display and output of math macros with optional arguments
This is a long standing issue, present since the new math macros
inception in version 1.6. It manifests as a display issue when a
macro with optional arguments appears in the optional argument of
another macro. In this case the display is messed up and it is
difficult, if not impossible, changing the arguments as they do not
appear on screen as related to a specific macro instance. It also
manifests as latex errors when compiling, even if the latex output
is formally correct, due to limitations of the xargs package used
to output the macros. Most probably, both aspects have the same
root cause, as simply enclosing in braces the macro and its
parameters solves both issues. However, when reloading a document,
lyx strips the outer braces enclosing a macro argument, thus
frustrating this possible workaround.

This commit solves the display issue by correctly accounting for
macros with optional arguments nested in the argument of another
macro, and circumvents the xargs package limitations causing errors
by enclosing in braces the macros with optional arguments appearing
in the argument of an outer macro when they are output. This means
that when loading an old document with such macros and saving it
again, the macro representation is updated and will have these
additional braces. However, as such braces are stripped by lyx on
loading, there is no risk that they accumulate.

See also this thread:
http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg197828.html
2016-12-01 18:02:47 +01:00
Tommaso Cucinotta
cc653feb60 Bump up RC fileformat after [244de5d2/lyxgit] for the new 'needauth' options.
Addressing #10481.
2016-11-25 23:33:08 +01:00
Tommaso Cucinotta
c636ded2b9 Better explanations to the user for [244de5d2/lyxgit] and
[830eb234/lyxgit] addressing #10481, so as to provide better clues as
to why the action is being forbidden or user authorization is needed.
2016-11-24 01:06:20 +01:00
Guillaume Munch
c3e33b765e Match the font in MathMacro::metrics with the font in MathMacro::draw
This fixes the "bad keming" of math ERT (in fact wrong metrics) which recently
was worsened by InsetMathChar substitutions and their MathClass spacing.

Also fix a small inefficiency: always prefer:

  Changer dummy = (currentMode() == TEXT_MODE)
    ? pi.base.font.changeShape(UP_SHAPE) : Changer();

over:

  Changer dummy = pi.base.font.changeShape((currentMode() == TEXT_MODE)
    ? UP_SHAPE : pi.base.font.shape());

The former only records and restores a value when the condition is satisfied,
and does not cost anything otherwise.
2016-11-23 23:18:02 +01:00
Tommaso Cucinotta
830eb234be Let LyX remember what documents 'needauth' converters have been authorized to run over by the user.
This is done by moving Converters::auth_files_ into a new SessionSection
subclass, along with the same read/write paradigm, as per Enrico's hint.
2016-11-23 22:17:13 +01:00
Tommaso Cucinotta
309209e319 Fix missing space in string from [244de5d2/lyxgit]. 2016-11-23 21:46:06 +01:00
Guillaume Munch
465260c05e Fix header 2016-11-23 19:16:18 +01:00
Jean-Marc Lasgouttes
7971dc83ef Fix some warnings after 6c9207579 2016-11-23 17:44:22 +01:00
Enrico Forestieri
6c92075799 Amend fix for #10428
- Allow using logical values for icon sizes as the standard sizes may
  differ among different icon sets
- Do not allow setting sizes smaller than smallIconSize

When the logical sizes differ and the icon set is changed, the correct
sizes are established only after a restart.
2016-11-23 17:30:49 +01:00
Tommaso Cucinotta
244de5d2c1 Add 'needauth' option to converters that need explicit user authorization.
Addressing #10481.

This patch adds the new 'needauth' option for converters launching
external programs that are capable of running arbitrary code on behalf
of the user. These converters won't be run unless the user gives explicit
authorization, which is asked on-demand when the converter is about to
be run (question is not asked if the file is cached and calling the
converter is not needed).

The user prompt has a 3rd button so that he/she's not prompted again
for (any converter over) the same document (identified through
buffer->absFileName()).

Two preference options are added:

lyxrc.use_converter_needauth_forbidden disables any converter with
the 'needauth' option, which is meant to force user to an explicit
action via the preferences pane, before being able to use advanced
converters that can potentially bring security threats;

lyxrc.use_converter_needauth enables prompting the user for 'needauth'
converters, or bypasses the check if not enabled, falling back to the
previous behavior.

So, the first option is for maximum security, the second is for
maximum usability.
2016-11-22 23:54:58 +01:00
Kornel Benko
ff0c95aba6 Cmake build: Prepare for hardening use of external programs 2016-11-22 16:51:44 +01:00
Guillaume Munch
eadc55b8b3 InsetMath: match the screen display with the EnsureMath behaviour in output 2016-11-22 11:30:26 +01:00
Guillaume Munch
b5af229208 frac: Add line thickness to height 2016-11-22 11:30:26 +01:00
Guillaume Munch
d5f139e71b Correct on-screen kerning in math for non-mu units
The current math style should have no impact on \kern1mu. This is another
benefit of a9eb87a8.

Testcase:
\begin{align*}
 & \kern1em a\\
 & {\scriptscriptstyle \kern1em a}\\
 & \kern18mu a\\
 & {\scriptscriptstyle \kern18mu a}
\end{align*}
2016-11-22 11:30:26 +01:00
Daniel Ramöller
e91572a00b Add the icon-size to the toolbar menu
- Adds LFUNs for setting the icon size
- Adds icons sizes to the Toolbars menu
- Uses the Toolbars menu as application context menu
- The context menu can now be user defined in stdcontext.inc

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

They are still not handled in LaTeX output, though.
2016-11-10 09:37:36 +01:00
Guillaume Munch
dc5d056dd5 Fix warning during runtime with qt4
Do not use "on_" as a prefix for functions unless the use of auto-connect is
intended.
2016-11-09 23:37:35 +01:00
Guillaume Munch
0220c58ef3 Add comment 2016-11-09 22:54:27 +01:00
Guillaume Munch
3233a822f3 Fix addition of new formats
Regression at cb0a4c66
2016-11-09 19:04:28 +01:00
Jean-Marc Lasgouttes
fb264663d8 Make insertInset use a temporary cut-and-paste area.
This is a long wanted feature, although it does not go all the way to
fix #6604 (private-cut/private-paste).

Additionally, it fixes a crash that can happen when using undefined
branches. This is done by making the action when pasting unknown
branches configurable.

Fixes bug #6570.
2016-11-09 15:28:11 +01:00
Guillaume Munch
50ccbd2eab Always prefer breaking at word boundaries
An overlong word containing a hyphen could be broken anywhere, instead of after
the hyphen.

Example: compare the line breaking of

   aaaaa-aaaaa-aaaaa-aaaaa

with

   aaa aaaaa-aaaaa-aaaaa-aaaaa

(with a very narrow window)

This also improves Chinese text in some situations (#10299)
2016-11-06 15:51:22 +01:00
Guillaume Munch
b30f8d3c4b On-screen justification: stretch in proportion with the em, up to a limit
1) Distinguish expanding characters from separators, to fit with Qt's notion of
expanding character which comes from the Unicode std.  CountExpanders() is moved
to FontMetrics to fix a discrepancy with the duplicate implementation from
598f7e4a.

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

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

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

See also #10466
2016-11-05 10:15:37 +01:00
Jean-Marc Lasgouttes
75fce32556 Round values properly when drawing right margin selection
This fixes a compiler warning reported by Uwe.
2016-11-04 15:58:54 +01:00
Jean-Marc Lasgouttes
b099d9ae15 Fix height of cursor inside insets
It turns out that Cursor::getFont() does not return a fully realized
font in some cases. This patch uses real_current_font instead, which
seems better anyway.

I suspect that all uses of getFont() should be removed, but this is
not code that I know well.

Fixes bug #10478.
2016-11-04 12:01:43 +01:00
Jean-Marc Lasgouttes
d207e85cfd Clear background behind sublables when necessary.
This is analogous to what has been done to address #4889 and #10359.

Fixes bug #10475.
2016-11-04 11:35:22 +01:00
Jean-Marc Lasgouttes
5d85a42bf0 QString only uses UTF-16, not UCS-4
This means that, when a string contains high-plane Unicode characters,
the length of a docstring and the corresponding QString will be
different: Qt will encode these characters using several 16bit
characters.

We have additionally to take into account QTBUG-25536, which implies
that sometimes qstring_to_ucs4(toqstr(s)) !=s. It is not clear whether
this bug can be a problem in other places.

Fixes bug #10443.
2016-11-03 14:19:50 +01:00
Daniel Ramöller
f054721410 In Color Preferences "frame of button" should be "button frame"
Fixes #10135.
2016-11-03 08:57:35 +01:00
Scott Kostyshak
ad65f609b6 Do not recenter screen on spelling-continuously
If a user is scrolling and then toggles spellcheck, LyX used to
recenter the screen around the cursor. Now LyX does not recenter.
2016-11-02 21:34:01 -04:00
Juergen Spitzmueller
3374b8548b Fix usage of multiple varieties of the same polyglossia language.
1. We must always output all (diverging) options, including
   default options; if not, default options might get overwritten.

2. Do not output options in \setotherlanguage, since we might have
   multiple "other languages" varieties from the same language (such
   as naustrian, nswissgerman). And the options are output for the
   language switches anyway.

Hence, LaTeXFeatures::getPolyglossiaLanguages() does not have to record
varieties. This was not done correctly anyway, since the map allowed
for one entry per language only.
2016-11-02 17:07:49 +01:00
Juergen Spitzmueller
eca3015f30 Whitespace 2016-10-31 18:50:28 +01:00
Juergen Spitzmueller
0c296cd26f Use Buffer::validate() when previewing single paragraph
We used to use BufferParams::validate(), which does not validate the
paragraphs.
2016-10-31 18:50:28 +01:00
Enrico Forestieri
e3c3719643 Don't print useless messages while parsing math macros
Math macros can be displayed on screen by providing a different
representation than the one used for latex output. This representation
is actually used by lyx even while it is being updated. This leads to
printing useless error messages on the terminal. For example, a macro
parameter has to be entered as \#1 and, if the macro is already used in
a math inset, lyx prints on terminal the error message "Math parse error:
missing token after \\" as soon as one hits the \ key, followed by
"MathMacroArgument::MathMacroArgument: wrong Argument id: -48" as soon as
one hits the # key. So, this is not a useful information and simply
clutters the terminal output. On the other hand, the input is sanitized
even if one stops input after hitting either \ or #, so that no further
messages are issued. Hence, those error messages are simply pointless.
2016-10-31 15:23:20 +01:00
Tommaso Cucinotta
fcaec6166b Show symbol name and description in plaintext export of nomenclature entries.
This addresses one of the issues highlighted in #10459.
See http://www.lyx.org/trac/ticket/10459
2016-10-31 10:50:33 +01:00
Uwe Stöhr
41a5833920 tex2lyx test files: update them
- update the test files after the last 3 fileformat changes
- this is now possible thanks to the patch for bug #10440
2016-10-28 00:45:33 +02:00
Uwe Stöhr
87c00f3383 add support for Urdu and Syriac
- fileformat change
- I could not update the tex2lyx testfiles because of bug #10440 (there is now a probable fix)
2016-10-28 00:21:58 +02:00
Juergen Spitzmueller
0894a17e33 Typo. 2016-10-27 19:58:01 +02:00
Juergen Spitzmueller
07c82e9f84 Issue an error message if conflicting languages are used
Some languages are only supported by Babel, some only by Polyglossia.

If these are combined, we issue an error message now.

Fixes: #10456
2016-10-27 09:59:01 +02:00
Tommaso Cucinotta
9740c36e80 Remove assert on advanced find with knitr module (#10444). 2016-10-27 09:38:35 +02:00
Jean-Marc Lasgouttes
695b0cc33b Some tweaks to selection painting
1/ simplify logic that triggers margin selection painting

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

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