Commit Graph

24030 Commits

Author SHA1 Message Date
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
Jean-Marc Lasgouttes
a700d657b3 Reimplement RowPainter::paintSelection() using row elements
The code is much simpler now and can be actually understood.

As a byproduct, fix bug #10424.
2016-10-25 10:01:37 +02:00
Enrico Forestieri
696ea82b21 Factor out common code used to underline/strike out math
Also use the exact amount of vertical space TeX adds after a
math display (instead of 1ex) for vertically shifting the box.
We have to use \belowdisplayshortskip here, instead of
\belowdisplayskip, because the math formula is typeset by alone
in a box, and thus there is no following line.
2016-10-25 00:49:26 +02:00
Jean-Marc Lasgouttes
e832d2e90f Work around issues with Qt5 and Arabic text
This fixes two particular problems

* with Qt5, it seems that QFontMetrics::width does not return the
  correct value for some Arabic text; this patch uses QTextLayout
  instead to compute a string width

* Likewise, the undocumented layout flags TextForceRightToLeft and
  TextForceLeftToRight do not work with Arabic text; this patch uses
  unicode override characters instead.

It might be that the two issues are related. In any case, they do not
happen with latin text where right-to-left direction is enforced. And
they do not happen with Qt4.

Additionally, remove some dead code in GuiFontMetrics::pos2x().

Fixes bug #10436.
2016-10-24 16:31:40 +02:00
Tommaso Cucinotta
8b5dc3c662 Fix bug in replacement of "$$s/" in converter commands, introduced in 8b66f9ce. 2016-10-24 15:08:06 +02:00
Enrico Forestieri
dea5ba16de Correctly track ulem commands with change tracking
LyX assumes that everything in \lyxdeleted is struck out by ulem
and increases the corresponding counter. However, deleted display
math material is struck out using tikz. As we also take into
account the deletion of underlined display math (in order to
properly position such material vertically), we have to take
care that the count is correct.
2016-10-23 18:23:41 +02:00
Enrico Forestieri
9ba76e6c40 On export, mark the start of the first paragraph
No newline is written after \begin{document}, such that
the afterParbreak method would return false. This misleads
the code that outputs a display math in an ulem command
to emit a newline command instead of \noindent, causing
latex errors. This occurs only if the math is at the very
start of a document, without anything before it.
2016-10-23 18:16:56 +02:00
Juergen Spitzmueller
e335c764b4 Revert "Fix Ticket #9741 misleading name for font-encoding setting "default"."
This reverts commit e37e4f537c.

The issue still needs discussion.
2016-10-23 17:20:58 +02:00
Jean-Marc Lasgouttes
6375a3cd65 Mark a signal invokation as such 2016-10-23 13:49:06 +02:00
Guillaume Munch
13eeb3b3c3 Fix compilation on cygwin & others 2016-10-23 00:25:05 +02:00
Guillaume Munch
67ddc246fd Improvement to the reverse-search algorithm 2016-10-22 23:24:01 +02:00
Guillaume Munch
68b034f51f TexRow: enable new RowEntry types 2016-10-22 23:24:01 +02:00
Guillaume Munch
148b3ae773 Move class definitions inside main class
Prepare for following commits.

This prevent's forward-declaration, but including the TexRow header should be
inexpensive.
2016-10-22 23:24:01 +02:00
Guillaume Munch
2e45bade7a Simplify and add debug message 2016-10-22 23:24:00 +02:00
Guillaume Munch
e1492a3ab1 Use the new infrastructure to select rows during error reporting 2016-10-22 23:24:00 +02:00
Guillaume Munch
dbe0c6991b Add safe line breaks to improve TexRow precision in subfloat & caption 2016-10-22 23:05:44 +02:00
Guillaume Munch
e798db5739 Safe line break to increase precision of error reporting in Listings caption 2016-10-22 22:39:33 +02:00
Uwe Stöhr
d9c52c7a3f support for Amharic, Asturian, Kannada and Khmer
- fileformat change
- I could not update the tex2lyx test files because of bug #10440
- maybe the lyx2lyx routine could be improved but since a document can also begin with another layout than "Standard" I could not use the lyx2lyx function put_cmd_in_ert
2016-10-22 15:33:59 +02:00
Juergen Spitzmueller
9235b09fd8 Fix LaTeX output of fixed-width cells with decimal separator
This follows Uwe's suggestions (and discharges my own).

The result is not ideal, but there is currently no ideal solution.

Fixes: #9568
2016-10-22 12:13:36 +02:00
Juergen Spitzmueller
e83e64c447 Do not output bidi direction macros in passthru context
Part of #10434.
2016-10-21 10:40:19 +02:00
Juergen Spitzmueller
fb9a866a66 Implement PassThru option to arguments. 2016-10-21 10:39:55 +02:00
Günter Milde
e37e4f537c Fix Ticket #9741 misleading name for font-encoding setting "default".
It would be nice, if the tooltip showed the value of
lyxrc.fontenc, but too complicated for my simple patch.
2016-10-21 09:10:46 +02:00
Richard Heck
c19794a013 These two routines are now redundant. 2016-10-20 23:07:13 -04:00
Richard Heck
7c9e9b4c90 We can now use the cached information instead of tracing the graph. 2016-10-20 23:07:13 -04:00
Richard Heck
014bc7805e Use a typedef for vector<Format const *>, which is what gets used
for lists of exportable and importable formats.
2016-10-20 23:07:13 -04:00
Richard Heck
e7f39ed377 There is no need now to cache format information in the SendTo
dialog.
2016-10-20 23:07:13 -04:00
Richard Heck
7fd1a14c1b Since we're now caching this, we can sort it once, rather than
lots of times.
2016-10-20 23:07:13 -04:00
Richard Heck
0b67e103e9 Simple cache for information on exportable formats, since we seem
to access this information a lot.
2016-10-20 23:07:13 -04:00
Enrico Forestieri
7cf12243b8 Fix indentation 2016-10-21 01:58:45 +02:00
Enrico Forestieri
8d5899aaf3 Fortify math insets against ulem commands
It should be now possible underlining or striking out any kind
of math inset containing any math construct indigestible to ulem.
While this was already possible for inline math insets, they could
have break if an aligned environment was used, for example.
This is now possible also for diplay math. Even if this can be
nonsensical and not visually perfect, at least no latex errors
should be generated if one tries to.
2016-10-21 01:35:39 +02:00
Uwe Stöhr
5adf949abb tex2lyx/Preamble.cpp: forgot this in r[f179173e/lyxgit]
- polyglossia supports Romansh, Piedmontese and Friulian
2016-10-21 00:20:27 +02:00
Uwe Stöhr
fe542e7989 tex2lyx/Preamble.cpp: sort alphabetically to keep overview
- also comment out the unsupported languages
2016-10-21 00:14:09 +02:00
Jean-Marc Lasgouttes
b162bd6d2b When breaking an empty paragraph reduces depth, set layout too
This requires an adaptation of the Separator inset insertion code,
which has been duly provided by Enrico.
2016-10-20 14:38:12 +02:00
Jean-Marc Lasgouttes
fbba865d28 Fix compiler warning from clang 3.9 2016-10-20 09:31:01 +02:00
Enrico Forestieri
ab3e1ddc34 Introduce the InsetMathHull::outerDisplay method and use it 2016-10-20 00:06:42 +02:00
Jean-Marc Lasgouttes
4065f596ad Remove unused methods in anononymous namespace
These have been flagged by gcc 6.
2016-10-19 17:51:32 +02:00
Juergen Spitzmueller
86517b120c Restore alphabetic order 2016-10-19 14:21:24 +02:00
Jean-Marc Lasgouttes
85bcf0d93f Fix indentation
Thanks to Juergen and gcc 6.2.
2016-10-19 14:10:47 +02:00
Jean-Marc Lasgouttes
6cb05ce8bb Do some caching of window title and related UI
This should avoid performance problems related to the window update machinery.
Moreover this fixes a crash introduced by 82808fea when closing a file.

Note that GuiWorkArea::Private already had a read_only_ member, but it
was unused.

Also rename LyXVC::vcname() to LyXVC::vcstatus() since it now contains
directly the UI string to be shown.
2016-10-19 11:59:47 +02:00
Jean-Marc Lasgouttes
a4e7114d98 Typo 2016-10-19 11:21:02 +02:00
Enrico Forestieri
d48bc4e4ae Remove a now unnecessary \mbox 2016-10-19 01:32:29 +02:00
Enrico Forestieri
6ae6198818 Avoid introducing a spurious space in \lyxmathsout 2016-10-18 04:35:02 +02:00
Enrico Forestieri
129459a71b Take into account font changes when striking out display math formulas
Font changes are brought inside the \lyxdeleted macro, just before
outputting the latex code for the math inset. The inset writes a
signature before itself and this is checked by \lyxsout for recognizing
a display math. So, the font changes confuse \lyxsout, which also
swallows the first macro at the very start of \lyxdeleted. The result
is that the font changing command is not seen by latex and \sout is also
used to further strike out the formula already striked out by tikz.
This commit makes sure that the expected signature actually appears
just after the opening brace of \lyxdeleted. It also accounts for a
paragraph break occurring just before the math inset, in order to not
introduce too much vertical space, which is noticeable when using
larger font sizes.
2016-10-18 03:29:53 +02:00
Guillaume Munch
9c0281126e Change tracking cue for InsetCaption 2016-10-18 01:06:03 +02:00
Guillaume Munch
0aab06c468 Some compilers are worried that a struct is not the same as a class 2016-10-18 00:54:37 +02:00
Enrico Forestieri
c1bfaa5c76 Fix latex error when change-tracked deleted display math starts a new paragraph
LaTeX refuses to break a line when it is empty. But we have to start
a new line here, otherwise the whole displayed equation would be
typeset as it were inline with previous content. The solution is to
put a zero-length space just before the line break. Moreover, this
is the right thing to do, as it simulates the extra space that is
normally added in this circumstance.
2016-10-17 19:35:04 +02:00
Enrico Forestieri
261e7ae9ce Strike out (in the output) deleted display math with track-changes
Showing deleted display math by enabling "Show Changes in Output" was
only possible with dvi (through dvipost). Although LyX strikes out
such formulas on screen, it was impossible obtaining an output
directly using pdflatex (or other engines producing pdf) because
ulem cannot cope with display math material and gives errors.
The solution is to strike out by ourselves such deleted formulas.
I took into account several options. One of them would produce
an output similar to dvipost (which strikes out each element), but
would have required much more changes in the output routines.
Eventually, I opted for using tikz, which gives a more clean
output (as it requires to simply adding a preamble and a postamble
to the latex code of any displayed math, instead of a mark up
tailored to each particular math construct). The look of the pdf
output is similar to the way LyX strikes out the equations on screen.
2016-10-17 03:25:35 +02:00
Guillaume Munch
e0e765f6a9 Get rid of dirty BufferView pointer
Now that there is a signal to inform the controller when the buffer view has
changed, it is no longer necessary to store a perishable pointer to a buffer
view in the dialog view. (Indeed, it was only really useful for checking whether
the new buffer view pointer was different from the old one.)

TODO: other dialogs should be audited for similar hazards.
2016-10-17 00:16:59 +02:00
Guillaume Munch
de19b8fc2d Take advantage of new bufferViewChanged signal 2016-10-17 00:16:59 +02:00
Guillaume Munch
c438d794ff Factor code after buffer change 2016-10-17 00:16:59 +02:00
Guillaume Munch
f4c390712e New virtual method frontend::Dialog::on_BufferViewChanged()
This is called anytime the buffer view attached to the GuiView changes.
2016-10-17 00:16:59 +02:00
Guillaume Munch
9b4926c6e6 Fit cursor and update screen after reverse-search 2016-10-17 00:16:59 +02:00
Guillaume Munch
a95e933f51 Fixes to reverse search
* In doubt, select up to the end of the paragraph

* Correct offset after artificial new lines
2016-10-17 00:16:59 +02:00
Guillaume Munch
01d6333db2 Implement reverse-search in the source panel
Double-clicking on a line in the source panel triggers the selection of the
corresponding line in the Buffer View.
2016-10-17 00:16:59 +02:00
Guillaume Munch
67805de7de New LFUN paragraph-goto id_start pos_start id_end pos_end
This selects from start to end.

id_end must be in the same buffer as id_start.
2016-10-17 00:16:59 +02:00
Guillaume Munch
f42379a7d6 Fix probable omission
Upon close inspection I do not think that this twist was necessary.
2016-10-17 00:16:59 +02:00
Guillaume Munch
1f6c451ee3 TexRow for InPreamble
This enables error reporting for the preamble, provided the preamble is written
using the new InPreamble layouts.

In the future, I find it preferable to deprecate the usual preamble in favour of
InPreamble layouts rather than implementing error reporting for the usual
preamble. This requires some improvements to code editing in the buffer view
first (line breaking behaviour, syntax highlighting).
2016-10-17 00:16:59 +02:00
Guillaume Munch
1b4f5970a4 Streamify a docstring
prepare ground for TexRow InPreamble
2016-10-17 00:16:59 +02:00
Guillaume Munch
1f945177b9 Docstringify getLongString in general and preamble snippets in particular
Prepare ground for TexRow InPreamble
2016-10-17 00:16:59 +02:00
Guillaume Munch
6edbc1da66 TexRow for InsetArgument 2016-10-17 00:16:59 +02:00
Guillaume Munch
676a0639c5 Use otexstringstream for the captions of InsetCaptionables
* Enable TexRow for InsetListings caption.

* Move getCaption* from InsetText to InsetCaptionable.

* Clean-up caption generation for InsetFloat.
2016-10-17 00:16:59 +02:00
Guillaume Munch
f3e099960a Gcc 4.6 compatibility :( 2016-10-17 00:16:59 +02:00
Guillaume Munch
f3256ee2cd texstring and otexstringstream
texstring is a pair of a docstring and a corresponding TexRow. The row count in
the TexRow has to match the number of lines in the docstring.

otexstringstream is an output string stream that can be used to create
texstrings (i.e. it's an odocstringstream that records the TexRow information
and let us extract a texstring from it).

texstrings can be passed around and output to otexstream and otexrowstream,
which produces an accurate TexRow information by concatenating TexRows.
2016-10-17 00:16:59 +02:00
Uwe Stöhr
f179173e42 support for the languages Bosnian, Friulian, Macedonian, Piedmontese and Romansh
- file format change
- note that I could not update the tex2lyx test files because of bug #10440
2016-10-16 15:33:23 +02:00
Juergen Spitzmueller
f089f60f4e Implement wrapping in next-change (#10388). 2016-10-15 16:34:16 +02:00
Juergen Spitzmueller
0eb651a2cf New layout tags for better counter handling
* ResumeCounter: allow to resume an (enumerate) counter
* StepMasterCounter: allow to increase a master counter
2016-10-14 20:08:12 +02:00
Jean-Marc Lasgouttes
84050268ee Remove useless #include
Including MathData.h in InsetMath.h is expensive and not required.
2016-10-14 11:08:04 +02:00
Scott Kostyshak
892593fbdc Change default working directory from ~/ to "."
Note that the lyxrc.document_path variable corresponds to what we
call the "Working directory" in the GUI preferences dialog.

Setting document_path to "." makes it so when LyX is started from a
directory, that directory is the default path for many of LyX's
operations, such as the following:

- new file, new from template
- adding a custom BibTeX file
- GUI compare dialog
- local layout button in document settings
- external material file browser
- graphics browser, include browser

The best guess for where the user wants to save or find files is the
directory the user started LyX from. Before, the default was always
the home directory. If desired, the old behavior can be restored by
changing the default path in Preferences > "Working directory".

This commit takes advantage of 9b64d7bd, which allows the use of a
relative path for path preferences.
2016-10-11 22:25:42 -04:00
Enrico Forestieri
ded8b1b3da Remove context help button hint from file dialogs
This removes the useless '?' button that appears in Windows builds
when using non-native dialogs. Complements cf26d53e.
2016-10-10 01:25:07 +02:00
Scott Kostyshak
f411040a33 Further amend 168d3557 to satisfy GCC 4.6
GCC 4.6 does not support non-static data member initializers.

As Guillaume points out, changing to static does not change the
intent.
2016-10-09 18:08:42 -04:00