Commit Graph

24674 Commits

Author SHA1 Message Date
Enrico Forestieri
fd0756141c Don't allow captions in non-floating listings
It was possible to insert a caption in a listing not marked as
floating. This didn't cause errors but the caption simply was
disappearing in the output.
2017-06-07 18:15:59 +02:00
Jean-Marc Lasgouttes
48144c474b Revert "Fix drawing of collpsable insets"
This patch cuses unintended issues (see #10587).

This reverts commit 18fb9cd7f9.
2017-06-07 16:01:58 +02:00
Enrico Forestieri
aae04d25b9 Fix a small glitch
When choosing a code language that has dialects in the languages
combo box, the dialects combo gets activated also when minted is
in use. However, minted does not support the concept of dialects
and the combo should not be enabled. This is harmless because the
dialects are simply ignored and the dialects status is restored
after apply, but it may fool the user in thinking that a dialect
can be actually selected. So, always disable it with minted.
2017-06-07 15:31:13 +02:00
Jean-Marc Lasgouttes
18fb9cd7f9 Fix drawing of collpsable insets
This is a follow-up to e194c9ce. There was actually no reason to let
InsetCollapsable and InsetText draw their own background. It is more
correct to remove the existing code and let the generic
Inset::drawBackground take command.

This allows to revert d207e85c.

Fixes bug #10587.
2017-06-07 12:20:33 +02:00
Jean-Marc Lasgouttes
a98df58537 Fix warning about signed/unsigned 2017-06-07 11:05:29 +02:00
Jean-Marc Lasgouttes
83cd3f4293 Output default mathindent value as "default"
This is like parindent now. The old code would avoid outputing the
value when it was empty (default indentation).

Fixes bug #10657.
2017-06-07 10:53:37 +02:00
Enrico Forestieri
8dab1cfe7e Fix bug #9101
Update the listings inset to optionally use the minted package
(instead of the listings one) for typesetting code listings.
Only one of the two packages can be used in a document, but it
is possible to switch packages without issues if the used options
are the same. If a switch is made and the options differ, one needs
to manually adjust them if they were entered in the advanced options
tab, or apply again the gui settings.
Note that minted requires the -shell-escape option for the latex
backend and the installation of additional software (python pygments).
2017-06-07 00:55:23 +02:00
Richard Heck
f9835d054d Fix bug #10295.
As it was, the comparison buffer was sharing a DocumentClass with
the buffer from which the document settings are taken.
2017-06-04 18:30:55 -04:00
Scott Kostyshak
b1ddae0514 Fix border when inserting column (#10538, #9306)
When inserting a column in tabular, the border of the new column
should be copied from the border of the (previously) right-most
column.

Also remove a redundant line. The line

    setRightLine(i, true);

was only reached if rightLine(i) was true.

Patch from Daniel Ramöller.
2017-06-04 15:24:10 -04:00
Enrico Forestieri
8ae652eb16 Fix up 0cf394dd 2017-06-04 03:28:49 +02:00
Enrico Forestieri
71f532db4b Do not output a \par inside a local language switch command 2017-06-04 03:14:14 +02:00
Enrico Forestieri
55bbd67cde Fix bugs #10650 and #9598 2017-06-03 17:26:05 +02:00
Enrico Forestieri
2a5bb7ab67 Fix bug #10685
Make sure to properly nest \begin{lang} and \end{lang} tags even
when no language package is selected. In this case, LyX assumes
that babel is being used, so the language names might be wrong
if the user arranged for using polyglossia in the preamble.
Nevertheless, we assure that the produced output is syntactically
correct, so that by adding proper preamble code a correct output
is still possible.
2017-05-30 17:57:37 +02:00
Richard Heck
60bd141f1b Keep track of the last manually set state of the literal
checkbox in the citation dialog. Use that information to
set it appropriately for new citations.
2017-05-29 22:53:11 -04:00
Enrico Forestieri
90c423a646 Revert a gratuitous change
This commit reverts a change made at 3bc08a76 that was causing
changed output. See:
http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg200509.html
2017-05-29 23:22:14 +02:00
Enrico Forestieri
2dde90a8fe Revert 3ceb5034
This does not work when the footnote contains multiple paragraphs
and the font properties are changed outside the inset.
2017-05-25 19:09:50 +02:00
Guillaume MM
6d6a4d7e75 Fix coverity warning 2017-05-25 16:41:10 +02:00
Jean-Marc Lasgouttes
91f3b21e42 Take in account end of paragraph marker for inset width
When an inset wants to use the whole available width, it is necessary
to take into account that some of this width may already be taken by
the end-of-paragraph (pilcrow) marker.

Fixes bug #10537.
2017-05-24 14:05:06 +02:00
Jean-Marc Lasgouttes
b58dcff836 Let command inset honor inheritFont() on screen
The RenderButton object now has a inherit_font_ property. It is set
depending on the value of Inset::inheritFont().

This is a better fix than 55533804, which caused bugs #10682 and #10677.

Fixes bug #10258
2017-05-24 11:33:52 +02:00
Jean-Marc Lasgouttes
3f34ebbaf9 Revert "Add possibility for command inset to inherit enclosing font"
The new method was badly named, it was not supposed to override the
existing inheritFont.

Fixes bug #10682.

This reverts commit 555338048d.
2017-05-24 11:25:14 +02:00
Jean-Marc Lasgouttes
0516af0c99 Revert "InsetHyperlink: inherit font (#10677)"
This will be replaced with a better fix (see #10682).

This reverts commit c643da99d7.
2017-05-24 11:25:14 +02:00
Enrico Forestieri
3ceb503490 Fix bug #10263 2017-05-24 00:24:54 +02:00
Scott Kostyshak
c643da99d7 InsetHyperlink: inherit font (#10677)
This commit amends 55533804.
2017-05-19 05:23:28 -04:00
Enrico Forestieri
922d1ddc8c Fix bug #10469 2017-05-17 22:31:27 +02:00
Enrico Forestieri
ead148510b Amend bfe0d52e
Was forgetting to account for babel.
2017-05-16 22:02:42 +02:00
Enrico Forestieri
bfe0d52e97 Fix bug #10636
The code was not accounting for partial preview of the source code
and was trying to pop a language that was never pushed.
2017-05-16 20:20:32 +02:00
Guillaume MM
f365a65068 Fix the computation of broken InsetRef status between sibling documents 2017-05-16 12:15:27 +02:00
Guillaume MM
d7bcab5e27 Structure the broken InsetRef status 2017-05-16 12:15:27 +02:00
Guillaume MM
161f7b7f62 Improve wording (#10670) 2017-05-16 00:28:43 +02:00
Jean-Marc Lasgouttes
676ce147da Fix compilation failure 2017-05-15 10:29:09 +02:00
Jean-Marc Lasgouttes
5354c64b27 Cache QTextLayout objects with Qt/Mac
It seems that the internal Qt5 caching does not work well here,
especially in the case of Herbrew documents.
2017-05-15 10:14:42 +02:00
Guillaume MM
700225c26f Fix colours of buttons in notification frame 2017-05-15 02:28:48 +02:00
Guillaume MM
752a0a1e48 Correct debug message 2017-05-15 02:28:48 +02:00
Uwe Stöhr
0dd3311dd4 rename buffer parameter math_number_before to math_numbering_side
this is a fileformat change

also try to fix an UI issue that JMarc gets
2017-05-13 20:39:45 +02:00
Guillaume MM
1fb0a5f436 Fix computation of InsetLayout arguments for InsetText
Do not take the optional arguments from the first paragraph, but from the
paragraphs whose layout have no arguments, consistently with the code in
InsetArgument::updateBuffer (i.e. what was shown on screen).
2017-05-13 16:12:25 +02:00
Guillaume MM
ef19e114bd Clean-up before following bugfix
Add helper function and factor code
2017-05-13 16:12:25 +02:00
Guillaume MM
1ac48c7cba Simplify before clean-up before following bugfix 2017-05-13 16:12:25 +02:00
Guillaume MM
c76cbead59 Cosmetic 2017-05-13 16:12:25 +02:00
Jean-Marc Lasgouttes
f1dd80f464 Proper GUI feedback for leqno option
With these changes, equation numbers are shown properly on screen.
When setting is default, we guess the side using these two rules

* ams(art|book) and siamltex classes are leqno by default. This is
  signalled because the classes provide "leqno" (in amsdefs.inc). If
  there are other classes that do this in output, the relevant classes
  should be updated.

* the language arabic_arabi also sets leqno by default. This is
  currently hardcoded for lack of a better idea.

Besides, a few bugs are fixed:
* use mathrm instead of mathbf for numbers metrics
* set spacing between maths and labels in inches
2017-05-12 15:32:14 +02:00
Jean-Marc Lasgouttes
d4685f2806 Never, never use a string for something that has 3 values
This commit replaces the string math_number_before by a proper math_number enum.

Note that the _before naming was misleading. It was chosen at a time
when we were not sure whether leqno was always left or could be right
in RtL documents.

Note that the token in LyX document is still \math_number_before and
this should be changed.

Fixup for 19cc4a1f.
2017-05-12 12:00:43 +02:00
Uwe Stöhr
19cc4a1fcb GuiDocument: support also the class option reqno
as discussed our support for the formula numbering side should be complete. There are document classes that uses left numbering as default and with the class option "reqno" this can be changed to right numbering. reqno requires the loading of amsamth.
2017-05-12 01:06:05 +02:00
Günter Milde
ff6369d35e Fix fa0f142e (plain quotes fix).
Forgot the "break", sorry.
2017-05-11 21:41:12 +02:00
Günter Milde
fa0f142eee Fix #10583 - plain quote inset latex export in different font encodings.
Since [e68afbe671394a/lyxgit], plain quotes came out wrong if the document
contains text parts in languages setting a different font encoding.
2017-05-11 18:08:46 +02:00
Guillaume MM
5452c53e9b algorithm2e.module: Add Algorithm style to typeset algorithms
Do not output \begin and \end if there is not environment name. We only need the
nesting feature.
2017-05-10 00:03:04 +02:00
Guillaume MM
98bd27c0bf InTitle: ignore InPreamble styles for outputting \maketitle. 2017-05-09 23:38:55 +02:00
Guillaume MM
f3594cb3eb Smarter Ctrl+{Left,Right} in math.
Consider mathbin, mathrel and mathpunct as word separators. This makes
Ctrl+{Left,Right} more intuitive, quicker, and more different from {Left,Right}.

This takes into account all the feedback from the discussion on the general
list. Further feedback welcome.
2017-05-09 23:28:32 +02:00
Uwe Stöhr
f109206c05 GuiDocument: rename a function to follow the naming guideline 2017-05-09 21:02:03 +02:00
Jean-Marc Lasgouttes
4bbcc4c563 Change ordering of function codes
Fixup e575e7ee so that func code numbers are still correct.
2017-05-09 16:28:40 +02:00
Scott Kostyshak
638020ab10 Revert "Change default working directory from ~/ to ".""
Setting the default working directory to '.' is an invasive change
on Mac and Windows, where the current working directory of LyX when
LyX is started from the GUI is not a reasonable choice for the
default directory in e.g. the "save as" file dialog or the "open"
dialog. A similar situation could happen on Linux distributions (I'm
not aware of any, e.g., POSIX standard that defines that the working
directory of a binary started from GUI should be the home
directory). Thus, it is not clear this default is good on any
platform.

If the user wishes to have the behavior of '.', the description in
the "paths" preferences pane provides the information for making the
change.

For more information, see the discussion at:

  https://www.mail-archive.com/search?l=mid&q=635298DE-5028-4BB1-8D8F-A634BA68C420%40gmx.net

This reverts commit 892593fbdc.
2017-05-09 07:50:45 -04:00
Uwe Stöhr
902b5f368b GuiDocument: fix bug #10653
- also rename a function because we have the same function name in BufferParams
2017-05-09 01:00:36 +02:00
Uwe Stöhr
74f56e261a Color.cpp: fix bug #10656 2017-05-09 00:09:10 +02:00
Guillaume MM
1acb42911a Cosmetic 2017-05-07 14:18:17 +02:00
Daniel Ramöller
e2f864efe4 Lock toolbars (#10283)
- LFUNs to (un)lock toolbars positions (both individually and all at once)

- corresponding menu entry to "Lock Toolbars" menu.
2017-05-07 14:17:54 +02:00
Daniel Ramöller
4183a9f4dc Preferences shows current zoom instead of preference's default zoom (#10455)
- Adds a currentZoom variable which holds the current zoom level.

- The zoom stored in preferences is used as default zoom level (default binding:
  M+0).

- The currentZoom is saved and restored via QSettings.

- Adds LFUN buffer-zoom for (re)setting zoom.
2017-05-07 14:17:54 +02:00
Daniel Ramöller
9bf8ac4432 Color Preferences: Disable colors rather than hide them (#10483) 2017-05-07 14:17:54 +02:00
Guillaume MM
dd7555af0e Fix crash with full view source (#10560 and #10617) 2017-05-07 00:07:24 +02:00
Guillaume MM
6b64d462ef Cosmetic 2017-05-07 00:07:24 +02:00
Tommaso Cucinotta
1f241dc849 Revert "Tolerate formats that are not supported by lyx2lyx."
This reverts commit 2f5396c871.
2017-05-06 09:21:58 +02:00
Tommaso Cucinotta
0fc8bd0c5f Revert "Create new graphics from within LyX choosing a sample file to copy from."
This reverts commit 7b6e26ad91.
2017-05-06 09:21:50 +02:00
Tommaso Cucinotta
7b6e26ad91 Create new graphics from within LyX choosing a sample file to copy from. 2017-05-06 00:26:00 +02:00
Tommaso Cucinotta
2f5396c871 Tolerate formats that are not supported by lyx2lyx. 2017-05-05 08:31:24 +02:00
Tommaso Cucinotta
0cf394dd79 skip graphics conversion when runparams.dryrun is true 2017-05-05 08:25:13 +02:00
Tommaso Cucinotta
cf6bbe2147 findadv: amend [8c101829/lyxgit] check that opt.find_buf_name is found in theBuffers(). 2017-05-03 17:32:31 +02:00
Tommaso Cucinotta
100a7ee22f Revert "findadv: hide word-findadv verb from the mini-buffer"
This reverts commit 8c10182962.
2017-05-03 16:37:11 +02:00
Jean-Marc Lasgouttes
a2cf919f18 Fix compiler warning (gcc 7) 2017-05-03 14:51:03 +02:00
Jean-Marc Lasgouttes
fa2dcd37a2 Show properly on screen "indented" maths.
This is done by two things:
1/ the equation returns LefAlign as display() value

2/ Inset::indent() return a value (in general 0) that should be added
   on the left (or right in rtl) of the inset when it is flushed.

The code that uses these values is in TextMetrics::computeRowMetrics.
2017-05-03 14:46:05 +02:00
Jean-Marc Lasgouttes
fa146a0ffe Compilation fix 2017-05-03 09:39:30 +02:00
Tommaso Cucinotta
8c10182962 findadv: hide word-findadv verb from the mini-buffer
The current set of options to provide include names of
the find and replace internal buffers, something out of
reach for the user. Furthermore, options are provided
using a multi-line syntax, which cannot be entered
using the mini-buffer AFAIK.
2017-05-03 01:31:57 +02:00
Tommaso Cucinotta
3610cdf669 findadv: fix crash on wrong syntax/usage of word-findadv LFUN from mini-command. 2017-05-03 01:31:57 +02:00
Uwe Stöhr
1b016f5f67 GuiDocument.cpp: correct a name
No math numbering placement option means default. The default could be already the left side for special document classes.
2017-05-02 23:09:36 +02:00
Uwe Stöhr
8f9a08a4cb TextLayoutUi.ui: remove trace of a moved feature
fixes bug #10647
2017-05-02 23:05:30 +02:00
Scott Kostyshak
08a840b139 Warn re mixed layouts only for export (#10645)
Do not warn about mixing title layouts while editing with the code
preview pane open.

This commit amends 0b1cf133.
2017-05-01 20:08:12 -04:00
Guillaume MM
974d33ad01 Remove spurious error "QFileSystemWatcher::removePath: path is empty" 2017-05-01 19:31:42 +02:00
Juergen Spitzmueller
74c10e06aa Do not add symbols twice to Encoding::symbolsList()
Also sort the list properly.

Fixes #10644
2017-05-01 17:34:25 +02:00
Jean-Marc Lasgouttes
de990f72e1 Define new inPixels helper in BufferView
Length::inPixels(MetricsBase const &) and VSpace::inPixels(BufferView
const &) should be moved respectuvely to MetricsBase and BufferView:
core file are not supposed to use GUI files.
2017-04-28 15:06:30 +02:00
Kornel Benko
c7a0ffc8c8 Update tex2lyx files to new format 2017-04-26 14:21:54 +02:00
Kornel Benko
8f00d7a95a To check if directory paths are identical we have to use realpath() 2017-04-26 14:20:32 +02:00
Uwe Stöhr
0ff8ec57e2 GuiDocument.cpp: change naming of formula numbering option 2017-04-26 00:32:13 +02:00
Jean-Marc Lasgouttes
91507284cb Amend b3fbe4edfd
It is better to enumerate all possibilities. Now we have a list of
special characters that do not have a tooltip.
2017-04-25 19:03:20 +02:00
Günter Milde
b3fbe4edfd Silence coverity warning. 2017-04-25 18:42:55 +02:00
Uwe Stöhr
da8b732443 Move mathindent from text layout to math settings as discussed 2017-04-25 03:01:39 +02:00
Uwe Stöhr
3f8c15a7c6 support for the document class option leqno
- fileformat change
2017-04-25 02:28:10 +02:00
Guillaume MM
62c9d0f640 Mover.h: let move be defined
We cannot use default for ~Mover() because gcc 4.6 cannot cope with it.
2017-04-24 10:53:39 +02:00
Scott Kostyshak
ee7d78d1dc Revert "Mover.h: let move be defined"
This reverts commit d4ea07705a.

d4ea0770 lead to a compile error with gcc 4.6. The error is likely
due to that version's weak C++11 support.

This commit reverts d4ea0770 in order to preserve compilation with
gcc 4.6 for alpha1.
2017-04-21 22:41:03 -04:00
Günter Milde
69e3e00603 Fix tex2lyx roundtrip ctests.
The last commit accidentially changed the encoding
of a sample file.
2017-04-21 14:03:37 +02:00
Stephan Witt
a91402dc64 use examples folder setting from preferences 2017-04-21 11:27:11 +02:00
Guillaume MM
4fc8c7fedd MathAtom: prefer composition over inheritance 2017-04-20 23:49:02 +02:00
Guillaume MM
d4ea07705a Mover.h: let move be defined 2017-04-20 23:49:02 +02:00
Tommaso Cucinotta
31adae1f23 Fix for crash/segfault introduced with [244de5d2/lyxgit], thanks Guillame. 2017-04-20 23:41:10 +02:00
Günter Milde
f5ac0580ff special character "allowbreak" (ZWSP), fileformat change
New special character to mark an optional line break
without inserting a hyphen (ZWSP). See #10585.

Corresponds to the Unicode character U+200B ZERO WIDTH SPACE

 This isn't a “space”. It is an invisible character that can be used
 to provide line break opportunities.
 ​http://unicode.org/notes/tn27/

While the literal Unicode character can be used in the LyX
file, it is invisible in the GUI.

For visible feedback, the patch adds a new special character "allowbreak".

The small mark is inspired by LibereOffice.
A tooltip is added.
2017-04-20 23:28:48 +02:00
Uwe Stöhr
6cabf4948f GuiDocument: re-introduce allowMathIndent()
was accidentally reverted by [d86954eb/lyxgit]
2017-04-20 23:21:11 +02:00
Jean-Marc Lasgouttes
b2e759d8b2 Make top/bottom margin value DPI-dependent
One less hardcoded pixel value.

Use thisoccasion to set the left/right margin in inches too, since it
is easier to compute.
2017-04-20 18:07:50 +02:00
Jean-Marc Lasgouttes
df6b2f4470 Rewrite mathindent without HSpace class
Use Length instead of HSpace for math_indentation and rename it to mathindent.
Get rid of the string version.

Rename (g|s)etMathIndentation() to (g|s)etMathIndent().

Remove the HSpace class altogether.

Some cleanups to parindent support to look like mathindent.
2017-04-19 17:55:56 +02:00
Jean-Marc Lasgouttes
d86954eb81 Revert "BufferParams: get rid of the HSpace class for mathindent as requested by JMarc"
This reverts commit d9a2a40268.

This is not the right way of getting rid of HSpace. We need a proper
Length, not a string.
2017-04-19 16:19:18 +02:00
Jean-Marc Lasgouttes
e7c3354a87 Fixes to ParIndent support
- remove quotes around length
- use "default" for default parindent, instead of an empty string
- Fix the constructor Length(string const &) so that an empty string
  corresponds to an empty length (coherent with Length::asString()).
2017-04-18 18:06:35 +02:00
Jean-Marc Lasgouttes
b250eb5a46 Autotools: use silent rule for moc in src/support. 2017-04-18 14:45:05 +02:00
Uwe Stöhr
17a53bbcf9 GuiDocument.cpp: add missing validation code 2017-04-17 20:58:09 +02:00
Uwe Stöhr
d9a2a40268 BufferParams: get rid of the HSpace class for mathindent as requested by JMarc 2017-04-17 20:32:31 +02:00
Jean-Marc Lasgouttes
fc4ca36403 Cleanup parindent support
Rename (g|s)etter to (get|set)ParIndent(), and rename member variables
accordingly.

Do not rely on HSpace anymore, since Length does have all we need.
2017-04-17 18:30:33 +02:00
Stephan Witt
b5c2859a92 Revert "update canAutoOpenFile/autoOpenFile implementation to new MacOSX API, avoid deprecated calls"
This reverts commit d568846e03.

Unfortunately the used alternative API LSCopyDefaultApplicationURLForContentType
is available with 10.10 and later only and cannot be used therefore. So there
is no alternative to deprecated calls ATM. LyX 2.3 should run on 10.7 at least.
2017-04-17 01:42:38 +02:00
Tommaso Cucinotta
4f75026176 lyxfind: cleanup regex_replace() and back to a sane amount of logging during findadv operations. 2017-04-17 00:41:29 +02:00
Tommaso Cucinotta
6d05a96546 findadv: match \textbackslash and \textasciicircum also without trailing {} (fixes autotest findadv-re-02-in.txt). 2017-04-17 00:38:31 +02:00
Tommaso Cucinotta
664798128a findadv: almost all test cases, including \regex[{}, back to working with std::regex. 2017-04-17 00:15:26 +02:00
Scott Kostyshak
742b39f49d Do not open or close branches after doc settings
When applying or saving Document Settings, LyX no longer opens or
closes branch insets. The intent of the previous code was to open
branch insets of a branch that is activated, and close branch insets
of a branch that is deactivated.

After some discussion [1], it was decided that the behavior intended
by the previous code was inconsistent with activating/deactivating a
branch in the context-menu of a branch inset, and the previous code
assumed a workflow of the user, rather than letting the user
separate opening/closing branch insets from activating/deactivating
them.

This commit modifies fd6cd728.

[1] https://www.mail-archive.com/search?l=mid&q=20161030220813.3zlp3zgqgomhx35y%40steph
2017-04-16 16:54:29 -04:00
Kornel Benko
28c320e1a0 findadv: fix compilation issue from [lyxgit/ecc36be6], when using boost instead of std regex. 2017-04-16 19:43:54 +02:00
Tommaso Cucinotta
ecc36be60b findadv: avoid crash when regexp-based search fails (mitigates #10625). 2017-04-16 11:27:34 +02:00
Uwe Stöhr
3677c20be9 BufferParams.cpp: correct output for \mathindent after [fc1c5c6f/lyxgit]
- also adapt the lyx2lyx logic to the changed implementation
2017-04-15 17:32:58 +02:00
Uwe Stöhr
5c91be293d tex2lyx: update fileformat 2017-04-15 17:03:13 +02:00
Stephan Witt
28fd15307b Care for a tilde in front of a path name. A path name with tilde sign at start is interpreted as relative to the current users home directory. 2017-04-15 13:30:35 +02:00
Uwe Stöhr
58e6c6c876 InsetFloat: allow float placement for rotated floats
- fixes bug #10270
- fileformat change
- fixes also a bug that unwanted placement was output to LaTeX on certain cases
2017-04-15 06:57:52 +02:00
Kornel Benko
70b0f8d953 Cmake roundtrip tests: Amend fc1c5c6, rename formula_indent to math_indent 2017-04-13 15:48:07 +02:00
Kornel Benko
fab6ee2f4d Check_layout tests: Check also stderr
1.) The command check_layout exits with "0", even if the module contains errors.
  The new module check_layout.cmake tries to compensate.
2.) Added default style to the test layouts when checking single modules.
2017-04-13 11:18:05 +02:00
Juergen Spitzmueller
953876a46c Tiny clean up 2017-04-13 09:59:06 +02:00
Enrico Forestieri
ee0cc3cec1 Fix tests after 031748d9 2017-04-13 09:38:46 +02:00
Uwe Stöhr
fc1c5c6f28 BufferParams: rename formula_indent to math_indent etc. as requested
- also add flyx2lyx feature to import existing document class option as requested by JMarc
- also don't use a real default indentation length
2017-04-13 02:31:26 +02:00
Enrico Forestieri
031748d9c8 Avoid an assertion when compiling in debug mode with MSVC 2015
Seemingly, when removing an argument from argv, and thus inserting
a null pointer to shorten the array, causes an assertion because
the null pointer is not a valid heap pointer (sic!)

Fixes bug #10440
2017-04-12 21:19:42 +02:00
Juergen Spitzmueller
06fb58a2da FontUi: Fix layout
The old layout resulted in a too wide dialog
(especially in some localizations)
2017-04-12 12:50:44 +02:00
Juergen Spitzmueller
cbde0e16e2 TextLayout.ui: small layout fixes. 2017-04-12 12:10:58 +02:00
Juergen Spitzmueller
9068d1902e No need to translate number 2017-04-12 11:57:43 +02:00
Uwe Stöhr
eb15b26801 InsetFloat.cpp: fix bug #10618
the label code missed to check all options (rotated, span columns)
2017-04-12 00:22:23 +02:00
Uwe Stöhr
818373ce4f tex2lyx: support rotated algorithm floats
LyX knows algorithm floats since ages. tex2lyx's support for rotated algorithm floats has simply been forgotten.
2017-04-11 00:36:00 +02:00
Uwe Stöhr
d2ac0d2cf4 TextLayoutUi.ui: correct a tooltip 2017-04-10 23:34:20 +02:00
Jean-Marc Lasgouttes
20696ecb7e Try to preserve small details from eb4a2a19
Part of ticket #10569
2017-04-10 11:21:29 +02:00
Jean-Marc Lasgouttes
94114fd121 Better implementation for corssOutLines
When trying to do implement a LaTeX feature on screen, it is always
good to see how LaTeX does it, just in case it is easy to implement on
our side.

Then we have a correct output at all DPI sizes.
2017-04-10 10:27:08 +02:00
Kornel Benko
560ebc1d50 Make output of check_Length.cpp more human readable. 2017-04-10 09:57:40 +02:00
Stephan Witt
d568846e03 update canAutoOpenFile/autoOpenFile implementation to new MacOSX API, avoid deprecated calls 2017-04-08 21:01:17 +02:00
Uwe Stöhr
1c2d056cfc tex2lyx: fix the preamble output
- LyX has new preamble tags. Although that they are not relevant for LaTeX they must be created by tex2lyx nevertheless
- also fix an issue that the formula indentation was always output
- update the tex2lyx tests accordingly
2017-04-08 04:55:22 +02:00
Uwe Stöhr
fae697a65c update tex2lyx tests to latest file format 2017-04-08 04:13:05 +02:00
Uwe Stöhr
b3b7675f54 Length.cpp: add new unit representing \baselineskip
- fileformat change
2017-04-08 03:30:21 +02:00
Uwe Stöhr
b3b1cf7e98 InsetTabular.cpp: handle crossed-out text 2017-04-08 02:55:00 +02:00
Uwe Stöhr
e5c313fc3b GuiDocument.cpp: commit missing part
This should have been committed with the previous commit but failed for an unknown reason.
2017-04-08 02:16:05 +02:00
Uwe Stöhr
c9dde702f0 MathsUi.ui. move formula indentation to text layout as requested by Jmarc 2017-04-08 02:12:35 +02:00
Uwe Stöhr
f37fa674f8 MathsUi.ui: next attempt to make it look correct also under Linux 2017-04-08 01:39:08 +02:00
Guillaume MM
b382b246b6 MathAtom is a unique_ptr
Fix coverity suggestion of defining a move constructor
2017-04-07 23:31:34 +02:00
Kornel Benko
723f0e14d9 Make runtests.py python3 ready
Tex2lyx tests with ctest depend on it
2017-04-07 18:51:35 +02:00
Jean-Marc Lasgouttes
61cafeb4d2 Avoid using buffer() which might throw an exception
Actually buffer_ is always valid on this codepath, but coverity is not
able to see that.
2017-04-07 12:05:21 +02:00
Jean-Marc Lasgouttes
b925728591 Avoid using theServer() for no reason
All it brings us is threatening to throw an exception to scare coverity off.
2017-04-07 11:04:57 +02:00
Uwe Stöhr
74bcd5d26c MathsUi.ui: adjust dimensions as requested 2017-04-07 02:14:34 +02:00
Uwe Stöhr
ad86f59639 BufferParams.cpp; initialize formula_indentation with default value
- Buffer.cpp: formula_indentation will not always be output/written -> erase it
2017-04-07 01:52:48 +02:00
Jean-Marc Lasgouttes
8769c0fb75 Row::Element::x2pos: go to nearest point also over insets
getPosNearX, which is the only user of x2pos, should always return the
nearest position.

In editXY, there is a need to return the position where the inset
stands, but it is done using checkInsetHit.

This is a simplification of commit eb4a2a19, which has been reverted
at 01f0ab64a.

Fixes part of bug #10569.
2017-04-06 15:18:15 +02:00
Jean-Marc Lasgouttes
01f0ab64a7 Revert "When selecting text with the mouse, inset selection happens in the middle"
This reverts commit eb4a2a190f.
2017-04-06 15:17:00 +02:00
Jean-Marc Lasgouttes
6a0c1c6573 editXY: make cursor positionning correct over non editable inset
Instead of using complicated (and wrong) code, it is better to use
getPosNearX here.

Also simplify the code by removing temporary variables.

Fixes part of #10569.
2017-04-06 15:16:59 +02:00
Jean-Marc Lasgouttes
e3d252cd62 Set boundary correctly in getPosNearX
The code that looks whether neighbor block has a different direction
should look to the left or to the right depending on the direction of
the current block.

Fixes part of bug #10569
2017-04-06 15:16:59 +02:00
Jean-Marc Lasgouttes
86ae7dad3f Require automake 1.14 and autoconf 2.65
This allows to fix distclean properly, since we know that
subdir-objects is used. When it is the case, it is not a good idea for
a Makefile to use a source file which is under the control of another
one. This could not be made to work work with old automake versions
(<1.14).

Therefore we refer directly to object files in Makefile.am instead of
source files. The actually leads to less compilation in tex2lyx.

Update the code here and there to remove compatibility hacks. Update
documentation.

Re-enable the layout test and fix the Length test, which was ovewriting
memory in test_inPixels() because lyxrc did not had a correct layout.
2017-04-06 14:56:30 +02:00
Jean-Marc Lasgouttes
3bd49d1f75 Make it clear that current_view_ is available when needed
In particular the LATTEST in createView tells coverity that creating a
view sets it as current_view_.
2017-04-06 13:03:05 +02:00
Scott Kostyshak
22c4a24a36 Document new behavior of "delete" LFUNs
- Describe the change in RELEASE-NOTES.
- Update the example for inset-forall.

This commit follows 71623b88.
2017-04-06 00:37:29 -04:00
Scott Kostyshak
57e93c47d5 Remove "Bummer" from the "Save failed!" message
There is a small chance that the user could get offended by this
nonchalant word in a data loss situation.

For discussion, see

  https://www.mail-archive.com/search?l=mid&q=20170401043945.7bpmrdugtqo6dw3j%40steph
2017-04-05 22:08:10 -04:00
Uwe Stöhr
2b0969c31c MathsUi.ui: adjust the size to fit better 2017-04-06 03:07:58 +02:00
Uwe Stöhr
808339790c support to indent formulas
- adds support for the general document class option fleqn
- adds support to specify the formula indentation
- fileformat change
2017-04-05 22:22:47 +02:00
Jean-Marc Lasgouttes
60810e0ae2 Use assertions to declare things we know for sure
Doing it that way makes coverity happy.
2017-04-05 11:53:17 +02:00
Jean-Marc Lasgouttes
7b0e732eeb Check both lower and upper bound for tainted loop limit
In these cases, the lower bound is not that important, but coverity insists on it.
2017-04-05 11:36:40 +02:00
Jean-Marc Lasgouttes
abc0aaec12 Replace coverity annotation by an assertion
And reorganize the code a bit.
2017-04-05 11:29:51 +02:00
Uwe Stöhr
d2a8be38b2 FuncCode.h: correct a date 2017-04-05 00:06:37 +02:00
Uwe Stöhr
e575e7eebd Add support to cross out characters
- adds support for the command \xout of the LateX package ulem
- fileformat change
2017-04-05 00:01:19 +02:00
Uwe Stöhr
7aaa85915f latexfonts: support for the Noto fonts
- fileformat change
- the support to scale the sf and the tt fonts can be added later, see enhancement #10611
2017-04-04 23:02:47 +02:00
Jean-Marc Lasgouttes
aa62b1ad49 Try another way of convincing coverity that everything is fine
We have a false positive here, but annotating with coverity[] comments
is not very convenient. Let's try to use good old assertions instead.
2017-04-04 09:38:43 +02:00
Uwe Stöhr
86cd1a9c97 tex2lyx: support for the cochineal fonts 2017-04-04 00:19:14 +02:00
Jean-Marc Lasgouttes
91b58cc633 Revert "Possible fix for bug #10295."
This reverts commit 9b0b45dc81.

(committed by mistake)
2017-04-03 12:29:09 +02:00
Jean-Marc Lasgouttes
0005876d17 When converting, indicate clearly when buffer should exist
This makes coverity happy, and makes out code a tiny tiny bit better
commented.
2017-04-03 12:25:17 +02:00
Richard Heck
9b0b45dc81 Possible fix for bug #10295.
As it was, the comparison buffer was sharing a DocumentClass with
one of the compared buffers. I don't fully understand why this was
causing a problem, since we use a shared_ptr. But this patch creates
a new DocumentClass for the new buffer.
2017-04-03 11:03:18 +02:00
Enrico Forestieri
66aa52ff20 Fix bug #10581
Tell the math parser that we are parsing a macro definition, so that
it doesn't try to return a verbatim copy in case of failure.
2017-04-03 00:26:49 +02:00
Enrico Forestieri
e36c661c61 Fix bug #10554
The \lyxdeleted macro cannot cope with \newpage & co.
2017-04-02 23:56:25 +02:00
Tommaso Cucinotta
621ccc5e4e Restrict file cache expiry time to positive values. 2017-04-02 14:55:33 +02:00
Uwe Stöhr
ccfbfdaf2b VSpace.cpp: fix 2 compiler warnings
A division can always lead to a non integer.
2017-04-01 19:54:33 +02:00
Jean-Marc Lasgouttes
758de9577d Improve drawing of math roots (\sqrt and \root)
This is preliminary work to make roots look more like in TeX output:

* correct font size for root order

* set minimum size of the root from the max ascent descent of the
  font. This is what TeX does.

* fix drawing, and in particular horizontal size.

More needs to be done, in particular:

* handle zooming and dpi correctly by removing hardcoded pixel values.

* factor the code for the two types of roots in one.
2017-03-31 18:55:08 +02:00
Jean-Marc Lasgouttes
da590925cd Work around bug in QTextLine::xToCursor
With RtL text, the method can be non-monotonic wrt x value (which is a
Qt bug). To work around this, we check whether positions adjacent to
those returned by xToCursor look better. Depending on whether the new
x position is too small or too large, we look backward or forward for
a better solution.

The performance is probably not great, but this is only needed for
user interactions, so the performance penalty should not be a problem.

Fixes #10569.
2017-03-31 16:56:06 +02:00
Jean-Marc Lasgouttes
ad20dac17f Catch another exception
Spotted by coverity.
2017-03-31 14:00:46 +02:00
Jean-Marc Lasgouttes
ba39d2de04 Play again with coverity annotation
The documentation is scarce and it is difficult to see what notation
is right.
2017-03-31 13:59:29 +02:00
Jean-Marc Lasgouttes
f14ce3f2ef Handle exception thrown by Buffer::emergencyWrite
Spotted by coverity
2017-03-31 13:39:27 +02:00
Jean-Marc Lasgouttes
6b2444a7df Replace coverity annotation by assertions 2017-03-31 11:47:47 +02:00
Jean-Marc Lasgouttes
cb888293d4 A better way to tell coverity that we do not care about result 2017-03-31 11:38:30 +02:00
Jean-Marc Lasgouttes
d54578a951 When scanning CVS skip unreadable lines
Spotted by coverity.
2017-03-31 11:33:34 +02:00
Jean-Marc Lasgouttes
08561eba3f Followup to e10db6c7: handle InsetCitation too. 2017-03-31 11:23:28 +02:00
Jean-Marc Lasgouttes
5890e9b831 When destructing a workarea, ignore buffer exceptions
Spotted by coverity, but probably harmless.
2017-03-31 11:17:00 +02:00
Jean-Marc Lasgouttes
e10db6c7dd Annotate destructors to please coverity
Coverity flags this code as not handling exception that may happen in buffer().

My own analysis is that this can never happen because isBufferValid()
does check whether buffer_ is null.

Any insght appreciated. The commit should be expeanded to more cases, actually.
2017-03-31 10:58:43 +02:00
Kornel Benko
0d6c64a4eb Cmake build: Project names *should* be uniq 2017-03-30 14:01:56 +02:00
Jean-Marc Lasgouttes
f043541ebd Missing initialization in 555338048
Thanks to coverity.
2017-03-29 12:04:42 +02:00
Jean-Marc Lasgouttes
555338048d Add possibility for command inset to inherit enclosing font
The RenderButton object now has this property. It is set depending on
the value of inheritFont() method that is currently only set for
InsetRef, InsetBibtex and InsetCitation.

Fixes bug #10258
2017-03-28 13:57:34 +02:00
Enrico Forestieri
a5377ead20 Account for unicode chars in tempdir path on Windows 2017-03-28 12:05:52 +02:00
Jean-Marc Lasgouttes
31cd421bcd Limit multirow to 100 columns in mathed
Spotted by coverity, this avoids a blocking loop when parsing.
2017-03-28 11:43:12 +02:00
Jean-Marc Lasgouttes
4488c45d09 Make LFUN_REPEAT more robust by limiting to 10000 iterations 2017-03-28 11:30:18 +02:00
Jean-Marc Lasgouttes
bc7704a78e Limit the amount of derivatives in external CAS
The (arbitrary) limit is 1000.

Pointed out by coverity. A bad value could lock LyX.
2017-03-28 11:17:35 +02:00
Jean-Marc Lasgouttes
5c03cb340c Use convert instead of a stream to read LFUN_REPEAT count
At least coverity should find it safer.
2017-03-28 11:04:39 +02:00
Jean-Marc Lasgouttes
f58d7dfe7b Try a simpler way to tell coverity that we do not care about the result 2017-03-28 10:53:45 +02:00
Enrico Forestieri
d996ec8992 On windows, use the unicode version of ShellExecute 2017-03-28 01:32:59 +02:00
Jean-Marc Lasgouttes
f7768c994d When running latex one needs to have a proper buffer
Calms down coverity
2017-03-27 17:43:18 +02:00
Jean-Marc Lasgouttes
522f3517e1 Handle properly exception that can be thrown by to_local8bit
Remove the use of this function in GuiAlert.

This was spotted by coverity
2017-03-27 16:13:26 +02:00
Enrico Forestieri
91ca310d1d Amend 16d5c49b
Remove redundant action when toggling the dashes check box.
2017-03-27 15:08:30 +02:00
Enrico Forestieri
b6f8a84a35 Fix #9732: Inconsistent font properties for the preview and superscript insets 2017-03-27 15:00:43 +02:00
Juergen Spitzmueller
f9b8cc9aa9 Translate file filters for external material 2017-03-26 18:10:30 +02:00
Juergen Spitzmueller
8f6491f073 GuiExternal: use proper model/view separation and sort the templates 2017-03-26 17:56:47 +02:00
Juergen Spitzmueller
52019917f4 Split external_templates to individual *.xtemplate files
This makes it easier to add new templates or change existing ones
in the user directory.

Fixes: #3983

The CMake changes should be double-checked.
2017-03-26 15:32:01 +02:00
Jean-Marc Lasgouttes
2a0e4c199c Fix coverity issues about exceptions
There a some exceptions related to the fact that BOOST_ASSERT throws
an unhandled exception, which is fait enough. This is handled by
uploading a modeling file to coverity.

The second batch of issues are related to the use of lexical_cast in
convert.cpp. We use now a wrapper around boost::lexical_cast that does
not throw but return empty strings instead. I am not sure actually of
when lexical_cast could fail.
2017-03-24 16:47:35 +01:00
Jean-Marc Lasgouttes
d7dfa27574 Try alternative syntax for signaling false positive 2017-03-24 15:54:16 +01:00
Jean-Marc Lasgouttes
b4fad55fd7 Check return value of regex_match instead of looking at first match
Spotted by coverity.
2017-03-24 15:51:26 +01:00
Jean-Marc Lasgouttes
4ea0fd6af4 Two places where coverity urges us to limit string length
These two issues make sense, but there are probably others.
2017-03-24 15:27:22 +01:00
Jean-Marc Lasgouttes
72af7f340c Pass big parameters by address
Spotted by coverity.
2017-03-24 15:11:21 +01:00
Jean-Marc Lasgouttes
f5fe3c17be Reduce horizontal spacing for simple inline equations 2017-03-24 10:22:32 +01:00
Jean-Marc Lasgouttes
a48581f48c Linearize macros in box edit mode too.
The special mode used by macros where the macro name is displayed as
grey text in a box is now one of the possible marker types for any
inset. The new code puts the macro name below the text, which means
that only the text below the current line will be moved. This makes
edition much more comfortable. The grey border around the contents has
been removed too.

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

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

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

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

The specific metrics/draw code in MathMacro has been removed and
replaced by assertions. Code in addToMathRow and marker is adapted to
reflect the cases where linearization is possible.
2017-03-23 10:17:07 +01:00
Enrico Forestieri
16d5c49b38 Further amendment to 72a488d7
Rephrase positively the check box for the output of en- and em-dashes
and disable it when using non-TeX fonts. The state of the check box
is remembered, so that toggling the non-TeX fonts check box does not
cause information loss.
2017-03-21 00:04:08 +01:00
Jean-Marc Lasgouttes
167eea3990 Fix compilation warning in DepTable.cpp 2017-03-20 15:38:08 +01:00
Enrico Forestieri
72a488d7e6 Fix output of en- and em-dashes with TeX fonts
This commit fixes the regression introduced in 2.2 about the
output of en- and em-dashes. In 2.2 en- and em-dashes are output as
the \textendash and \textemdash macros when using TeX fonts, causing
changed output in old documents and also bugs (for example, #10490).

Now documents produced with older versions work again as intended,
while documents produced with 2.2 can be made to produce the exact
same output by simply checking "Don't use ligatures for en-and
em-dashes" in Document->Settings->Fonts.

When exporting documents using TeX fonts to earlier versions, in order
to avoid changed output, a zero-width space character is inserted after
each en/em-dash if dash ligatures are allowed. These characters are
removed when reloading  documents with 2.3, so that they don't accumulate.
2017-03-19 20:50:34 +01:00
Juergen Spitzmueller
1a8fd56333 Consider text-mode accents of the form {\v a} in BiblioInfo
Fixes #9340.
2017-03-19 16:15:03 +01:00
Guillaume Munch
4f3c3a794e repair Cursor::x_target mechanism (#10168) 2017-03-19 14:41:54 +01:00
Guillaume Munch
ac6d3ffb6a Regularly check if preview is modified when visible on screen
In case one cannot rely on QFileSystemWatcher.
2017-03-19 14:41:54 +01:00
Guillaume Munch
ad16347b08 Regularly check if graphics is modified when visible on screen (#10596)
In case one cannot rely on QFileSystemWatcher.

see https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg199112.html
2017-03-19 14:41:54 +01:00
Guillaume Munch
c779e9806e Cosmetic 2017-03-19 14:41:17 +01:00
Guillaume Munch
9926927fb1 Ressurect old FileMonitor à la Frankenstein
ActiveFileMonitor combines QFileSystemWatcher with the previous checksum
approach.
2017-03-19 14:41:17 +01:00
Guillaume Munch
6c4b9c97cb Blocking signals also blocks the notification of file creation (#10595) 2017-03-19 14:41:17 +01:00
Guillaume Munch
fa9ab74ffa Correct ownership
One can now delete a file monitor if a blocker is active.
2017-03-19 14:41:17 +01:00
Juergen Spitzmueller
1eba2c92da Improve BibTeX name parsing #4
Handle name prefix (aka "von" part) as a separate entity, just like
BibTeX and Biblatex do. This allows to omit or reposition it in
accordance to the current style ("Goethe, Johann Wolfgang" or
"von Goethe, Johann Wolfgang" or "Goethe, Johann Wolfgang von" are all
valid and used).

LyX's name parser should now be on par with BibTeX's.
2017-03-19 14:03:48 +01:00
Juergen Spitzmueller
7489cab6c9 Replace "junior" with the more generic term "suffix". 2017-03-19 13:33:56 +01:00
Juergen Spitzmueller
5fdcca4c06 Improve BibTeX name parsing #3
Correctly handle name suffix ("Jr.-part")
2017-03-19 12:42:18 +01:00
Juergen Spitzmueller
9f4df64f23 Allow for simple conditions in name scheme.
I.e., only output a comma between last and first name if there is
a first name.
2017-03-19 11:45:42 +01:00
Juergen Spitzmueller
08500c1a7c Improve BibTeX name parsing #2
Also consider grouping when looking for name separators.

Cases such as {{Barnes and Noble, Inc.}} are now handled correctly.
2017-03-19 11:44:22 +01:00
Juergen Spitzmueller
ee26e7fadf Improve BibTeX name parsing #1
Consider groupings of name parts via {...}
2017-03-19 11:41:33 +01:00
Scott Kostyshak
82705a0e8a Fix typo in comment 2017-03-18 11:36:00 -04:00
Guillaume Munch
340d747fff Clean up
Only keep one dynamic-cast. This fixes coverity warnings.
2017-03-18 15:09:07 +01:00
Jean-Marc Lasgouttes
5d29527916 Output debug message when creating bad length
Coverity is right to say that we should check the return value.
2017-03-14 15:20:09 +01:00
Jean-Marc Lasgouttes
c6213b1b20 Another forgotten unreachable `return' that is not needed
The compilers we use now do not care, but coverity complains.
2017-03-14 14:46:02 +01:00
Jean-Marc Lasgouttes
7a124ab861 Fixup commit 50060053
Fix two instances where theFormats() was used instead of a local parameter.

Fix layout test.
2017-03-14 14:26:26 +01:00
Jean-Marc Lasgouttes
7d4b8b7606 Only accept non-negative lyxscale parameters
Since lyxscale is unsigned, a negative value would lead to a very
large positive value.

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

Mostly, this is very boring, but it might be good if someone would
check what I did about the dummy implementation in tex2lyx.
2017-03-13 23:40:29 -04:00
Jean-Marc Lasgouttes
591f5780e4 Use FileName::lastModified() intead of stat() in DepTable
This patch removes explicit calls to stat() in the DepTable code. The
original motivation was to get read of a stat() invokation where the
error condition was not checked (spotted by coverity).
2017-03-13 17:06:42 +01:00
Jean-Marc Lasgouttes
b8c0891427 Remove optimization that avoids drawing some math inset cells.
It is not clear that the optimization is a gain, but it is clear that
it has a cost: some elements of formulas will not be present in the
position cache.

Fixes bug #10520.
2017-03-13 11:44:48 +01:00
Jean-Marc Lasgouttes
a69bae0c99 Make InsetMathNest::editXY more robust
If no reasonable cell has been found to put the cursor in (maybe
because the cell exist but is not in the cache), exit gracefully.

Fixes bug #10520
2017-03-13 11:44:22 +01:00
Jean-Marc Lasgouttes
a2bfe0042d Do not use the global variable `formats' in Formats class
Using this global variable in the class is clearly a bug. If we wanted
to avoid doing it by mistake, the variable should be moved to the LyX
singleton.

Also add an underscore to the private variable formatlist_.
2017-03-13 11:39:26 +01:00
Richard Heck
322331c53a Fix problem noted at bug #10582.
When we have a name with more than two parts, but no "von",
it was coming out as, e.g.:
	Obama, Barack Hussain Obama
i.e., with the last name appearing twice.

Also adds a check for names without spaces, which would have given:
	Pele, Pele

This was not the original issue at #10582, so that bug is still
open (though I cannot reproduce it).
2017-03-12 16:43:15 -04:00
Richard Heck
8414c38e4b Whitespace and const'ing. 2017-03-12 16:27:36 -04:00
Guillaume Munch
797bb2df14 Fix compilation with 5 <= qt < 5.4 2017-03-11 22:22:27 +01:00
Jean-Marc Lasgouttes
5d8918f68f Compilation fix
It is actually better to compile code before pushing changes...
2017-03-11 20:51:39 +01:00
Jean-Marc Lasgouttes
d6d412c49e Limit the size of strings we read from RCS
This calms down Coverity which fears than an evil RCS repository would break LyX.
2017-03-11 20:46:32 +01:00
Scott Kostyshak
3db74fa92d When catching exception, give error on STDERR
The error is reported in the GUI, but for the terminal we must write
explicitly to STDERR.

For a specific example of this type of exception, see the previous
commit, 72c3dbd.
2017-03-11 02:56:31 -05:00
Scott Kostyshak
72c3dbd02c Change a warning to an error if missing include
If an included file is not found, it seems impossible that the final
output would be correct. Before this commit, when exporting on the
command line, LyX would create the PDF and exit with a zero error
code so unless the user was monitoring the terminal output, they
would not know there is a problem.

This change is consistent with 1a374a93.
2017-03-11 02:51:49 -05:00
Guillaume Munch
24f68aff8d Nonsense for whoever insists on using gcc4.6 & qt4.8 in 2017 2017-03-11 00:50:57 +01:00
Guillaume Munch
f96d7a8b2c Remove legacy FileMonitor 2017-03-11 00:50:57 +01:00
Guillaume Munch
a4fae021f2 Replace FileMonitor with FileMonitor2 in RenderPreview 2017-03-11 00:50:57 +01:00
Guillaume Munch
e3a1396813 Replace FileMonitor with FileMonitor2 in GraphicsCacheItem
Remove dead code
2017-03-11 00:50:57 +01:00
Guillaume Munch
22ce6636ef Clarify dialog 2017-03-11 00:50:57 +01:00
Guillaume Munch
0cb85e9206 Disable edition when external modifications are detected
Introduce a distinction between being read-only and having the read-only flag. A
buffer is read-only if either it has been externally modified or if it has the
read-only flag.
2017-03-11 00:50:57 +01:00
Guillaume Munch
b6b56d8518 Notification of external modification inspired by gedit 2017-03-11 00:50:57 +01:00
Guillaume Munch
299242bb16 New LFUN buffer-external-modification-clear 2017-03-11 00:50:57 +01:00
Guillaume Munch
656bc46892 Clean-up 2017-03-11 00:50:57 +01:00
Guillaume Munch
1e57fd12b1 Display externally modified status 2017-03-11 00:50:57 +01:00
Guillaume Munch
7c123507a4 Whitespace 2017-03-11 00:50:57 +01:00
Guillaume Munch
cf3c035266 Implement real-time detection of external modifications 2017-03-11 00:50:57 +01:00
Guillaume Munch
caa54e80ee Implement FileMonitor as a wrapper for QFileSystemWatcher
The new file monitor supports both boost and qt signals. It is implemented in a
ressource-safe way.
2017-03-11 00:50:57 +01:00
Guillaume Munch
22edb3df96 Preventive fix inspired from ~ 2017-03-11 00:50:57 +01:00
Guillaume Munch
b034389e6d Amend 63be456c8
Fix crash when clicking on math previews
2017-03-11 00:50:57 +01:00
Guillaume Munch
387ac78088 Add option to ignore a parameter in InsetCommandParams
It will not be saved to the file and will always be equal to a given default
value.
2017-03-11 00:50:57 +01:00
Guillaume Munch
3dec5826da buffer-export default 2017-03-11 00:50:57 +01:00
Jean-Marc Lasgouttes
9a013637bb Experiment: limit size of strings read from lib/symbols
Coverity complains that we might read strings that are arbitrary
large, and that this can be a security issue. This is a problem in
particular, when we feed these strings to from_utf8(), which coverity
flags as dangerous for some reason.

The best solution would be IMO to model from_utf8() properly, but I do
not know how to do that. Here I try a different solution, where I
cannot read a string larger than 64k from the file.

Let's see whether this removes part of coverity warnings.
2017-03-10 16:29:09 +01:00
Jean-Marc Lasgouttes
0f220503ff Small cleanup to LayoutBox and CategorizedCombo
Coverity does not find it obvious that p is never negative. Normally
it is the case (because the items have been filtered), but it is
better to play safe.
2017-03-10 15:57:31 +01:00
Jean-Marc Lasgouttes
e2f2915f8e Be careful about unparsable bibtex years
Handle gracefully the case where the regex that parses a year fails.

This is a fixup to ba171930 (spotted by coverity).
2017-03-10 10:35:03 +01:00
Jean-Marc Lasgouttes
4b8e5a9d53 Another unreachable `return' that is not needed
The compilers we use now do not care, but coverity complains.
2017-03-09 15:12:03 +01:00
Jean-Marc Lasgouttes
ce0c11ba4e Remove unreachable return statements
They were needed long ago to avoid gcc warnings, but now all they do
is create coverity warnings.
2017-03-09 15:05:33 +01:00
Jean-Marc Lasgouttes
5a62e37add Handle the case where doc_bv is null
It might only happens in specific cases where no file is open and for
some reason the new file cannot be opened.
2017-03-09 14:41:27 +01:00
Jean-Marc Lasgouttes
f7ab893def Avoid dereferencing an iterator at the end
Found by coverity, could lead to a crash with badly formed kmap file.
2017-03-09 14:26:17 +01:00
Richard Heck
4569010b66 Add a comment. 2017-03-08 17:34:07 -05:00
Jean-Marc Lasgouttes
dee0ea0c21 Make a test clearer
This should hopefully please coverity now. For some reason, the
annotation did not work. Should it be in lower case?
2017-03-08 17:03:48 +01:00
Jean-Marc Lasgouttes
000dcb8672 Make a false positive explicit
Pleases coverity
2017-03-08 16:50:03 +01:00
Jean-Marc Lasgouttes
2d86b2debb Fix missing initialization
This was already fixed after coverity report at bad511f3fe,
but this part was missing.
2017-03-08 16:41:42 +01:00
Jean-Marc Lasgouttes
f0ab93c4b8 Initialize members spotted by coverity 2017-03-08 16:37:53 +01:00
Jean-Marc Lasgouttes
ed15c31bf8 Make a dummier LyXRC for tex2lyx
The old version made coverity complain about uninitialized members.
The new one is the same as in support/tests/dummy_impl.cpp.
2017-03-08 16:37:53 +01:00
Scott Kostyshak
37290fdb61 Describe the use of '*' in -e/-E CL options
The use of '*' in buffer-export was implemented at 494ce664.
2017-03-08 00:36:28 -05:00
Scott Kostyshak
24ad64c406 Implement '*' in "buffer-export <FORMAT> <DEST>"
For the variant of buffer-export that allows a format and a
filename, the substitution must be done after the argument is split.

Related to 494ce664.
2017-03-08 00:36:28 -05:00
Kornel Benko
5d3d26b024 Cmake build: Adapt handling of mytheslib to automek behaviour
The added cmake-parameter is:
  -DLYX_EXTERNAL_MYTHES=<value>
where <value> is one of
  AUTO	(Default) Search first on system for mythes (lib and include)
  ON	Use installed only (errors if not installed)
  OFF	Compile the provided source in 3rdparty
2017-03-07 14:27:08 +01:00
Jean-Marc Lasgouttes
dc126bad04 Fix typo found by coverity
We were not testing for the right end(), although it is not sure that
an actual bug could be triggered because of that.
2017-03-07 12:02:54 +01:00
Jean-Marc Lasgouttes
25d64bf43a Fix test to make coverity happy
It is not obvious that cur is not null iff thisSlice is not -1, but
this is what happens in the caller.
2017-03-07 11:56:59 +01:00
Jean-Marc Lasgouttes
55957c4576 Fix test to make coverity happy
It is not obvious that cur is not null iff thisSlice is not -1, but
this is what happens in the caller.
2017-03-07 11:48:32 +01:00
Kornel Benko
15babdc0f1 Amend 0e50ad8 'move mythes sources to 3rdparty' for cmake build. 2017-03-06 19:31:23 +01:00
Jean-Marc Lasgouttes
0e50ad8b16 Update bundled mythes to version 1.2.5
Move it to 3rdparty/ directory alongside the other ones.
2017-03-06 17:08:38 +01:00
Guillaume Munch
3d2d02510a Amend 841825aa56
sort alphabetically
2017-03-06 01:01:11 +01:00
Guillaume Munch
841825aa56 Add default export to the menu 2017-03-05 08:45:52 +01:00
Guillaume Munch
76f3f6eb01 Fix warning 2017-03-05 08:45:52 +01:00
Guillaume Munch
a0ce37147c Allow Ctrl+Enter in GuiCitation even if the citation is already there 2017-03-05 08:45:52 +01:00
Guillaume Munch
354897f6d9 Tabular::editXY should not touch the selection 2017-03-05 08:45:52 +01:00
Guillaume Munch
494ce6647a buffer-export * synonymous to buffer-export 2017-03-05 08:45:52 +01:00
Enrico Forestieri
5940dc53aa Fix bug #10579
The \lyxdeleted macro cannot cope with empty lines.
2017-03-03 13:00:32 +01:00
Jean-Marc Lasgouttes
1de8ab6ed5 Try to see if coverity annotations should be in lower case
The current one did not work.
2017-03-02 15:24:12 +01:00
Jean-Marc Lasgouttes
f4f84ef9a3 Initialisize properly member variables
Instead of using a coverity annotation (that does not work) it is
better to really iinitialize the members of the object, just in case
somebody decides to actually use the DisplayPath() constructor.
2017-03-02 15:20:46 +01:00
Jean-Marc Lasgouttes
5ad8815a51 Please coverity properly 2017-03-02 14:47:31 +01:00
Jean-Marc Lasgouttes
ae6e6b3e47 Try another way to signal a false positive to coverity 2017-03-01 17:44:02 +01:00
Jean-Marc Lasgouttes
5453e00cfa Do not return a reference to a temporary variable
Coverity correctly spotted that the existing code creates a temporary
map and returns a value from it. It is not possible to make the map
const& directly because operator[] may change the map.

Therefore, we use map::find instead.
2017-03-01 17:37:41 +01:00
Jean-Marc Lasgouttes
1f10969bb5 Add missing initialization
Spotted by coverity
2017-03-01 17:25:03 +01:00
Jean-Marc Lasgouttes
a2425c7121 Initialize properly TextEntry variable
Not sure it fixes a bug, but it should calm down coverity.
2017-03-01 17:18:19 +01:00
Jean-Marc Lasgouttes
91d8a3982d Initialize properly several InsetQuote members
Spotted by coverity
2017-03-01 17:02:20 +01:00
Jean-Marc Lasgouttes
dc385a8b97 Fix coverity false positive
The fall through was intended at db889bc6.
2017-03-01 16:42:28 +01:00
Jean-Marc Lasgouttes
e8b744ad2e Fix broken logic
Spotted by coverity.
2017-03-01 16:36:46 +01:00
Jean-Marc Lasgouttes
f52325f051 Initialize pointer class member
Found by coverity.
2017-03-01 16:34:01 +01:00
Jean-Marc Lasgouttes
9251a360a9 Initialize class member to please coverity 2017-03-01 16:31:00 +01:00
Jean-Marc Lasgouttes
af45bfaee1 Initialize class members to please coverity 2017-03-01 16:28:30 +01:00
Jean-Marc Lasgouttes
ea8f0d2076 Initialize properly a class member
This was forgotten at 0552563c99, and it only meant to keep coverity happy.
2017-03-01 16:21:45 +01:00
Enrico Forestieri
17ab47b3e6 Allow Input of local includes from local layout files
When including files, LyX always searches the user and the system
directory, in that order. This means that when using local layout
files broken down into multiple includes, the various includes should
be specified with a path relative to the user layouts directory
(typically ~/.lyx/layouts), making this very impractical.
This commit allows including local files by specifying their path
as explicitly relative to the main layout file position, i.e., by
specifying their path with either "./" or "../". If the main layout
is not loaded from a local file, the usual search order is used,
even if the path are explicitly relative. So, for system layouts,
both "Input ./name.inc" and "Input name.inc" are equivalent.
2017-03-01 09:19:18 +01:00
Guillaume Munch
a1faa41c83 buffer-export without argument exports the default format
buffer-export is proposed as a default binding in the preferences so now it does
what a user expects when binding it to a key.
2017-02-28 00:46:33 +01:00
Guillaume Munch
887722dbfa Remove LyXToolBox
It extended QToolBox with size calculation to fix UI issues with the previous
design of GuiCitation. Since it always needed some kind of hack and since
QToolBoxes do not appear so popular, it probably won't be used anymore.
2017-02-26 22:16:10 +01:00
Guillaume Munch
06416763ac Give focus to the filter in GuiRef
This is now consistent with GuiCitation. Compared to the previous behaviour
there is only one down key press difference.
2017-02-26 22:16:10 +01:00
Guillaume Munch
750c48eda3 Fix focus events in GuiCitation 2017-02-26 22:16:10 +01:00
Guillaume Munch
d50b66fc88 Whitespace and remove obsolete #ifdef. 2017-02-26 22:16:10 +01:00
Guillaume Munch
eab83ec678 Implement down key press in FancyLineEdit 2017-02-26 22:16:10 +01:00
Guillaume Munch
e6180e9914 Implement left-right navigation in GuiCitation 2017-02-26 22:16:10 +01:00
Guillaume Munch
26b2cc89d3 Fix 18 memory leaks
Also whitespace.
2017-02-26 22:16:10 +01:00
Enrico Forestieri
3c329db0a5 Allow inserting consecutive dashes
Because latex allows to do so, and there is no easy way to achieve this.
This was apparently implemented to allow cycling between the various dash
types, but it was a bad idea bringing no benefit and causing griefs.
2017-02-25 14:13:02 +01:00
Juergen Spitzmueller
73ccee113e rename BufferParams::font_encoding() to ::main_font_encoding()
Because that's what's actually returned.
2017-02-25 12:49:49 +01:00
Jean-Marc Lasgouttes
83cf59cf94 Remove unreachable return statement
ALso re-indent a bit.

Fixes coverity issue 134137
2017-02-25 00:32:58 +01:00
Jean-Marc Lasgouttes
8a9ea4d264 Initialize properly pointer
Fixes coverity issue 23411
2017-02-25 00:20:51 +01:00
Juergen Spitzmueller
e68afbe671 Plain quote fixes
\textquote... commands are only available in t1.
2017-02-23 10:39:50 +01:00
Juergen Spitzmueller
cf82bcadfb Use proper font encoding in InsetQuotes 2017-02-23 10:39:31 +01:00
Juergen Spitzmueller
7d54edbf94 \textquotedbl and \textquotesingle are now covered by TU encoding
Generally, TU is on par with T1 now. Thus introduce a new latexSpecialTU
method that currently just links to latexSpecialT1.
2017-02-23 10:17:52 +01:00
Guillaume Munch
0a7ba185a3 GuiCitation: set instant search as the default
It was already supposed to be the default after 7d429291, but one has to set the
default value at the level of the QSettings.
2017-02-22 16:58:38 +01:00
Guillaume Munch
8353a53cc3 Clarify comment 2017-02-22 16:57:13 +01:00
Juergen Spitzmueller
b6a7530ba2 xunicode (only) needs to be loaded for tipa emulation.
Previous fontspec loaded xunicode internally, for recent version, this
is no longer desired. However, we still need it for tipa emulation.
We use fontspec's trick to bypass XeTeX test with LuaTeX.
2017-02-22 11:27:51 +01:00
Jean-Marc Lasgouttes
d2ad9ae6e2 Rewrite selection code in mathed
Now the selection is not done by the inset, but by the MathData
itself. This allows for some code simplification and avoids an
extra redraw.

Additionally, this fixes the selection inside macros, which was broken
by the new MathRow code.
2017-02-22 11:00:30 +01:00
Jean-Marc Lasgouttes
1c1b3519f9 Use a plain font in macro edit box
Without this, the font would be mathcal in a mathcal environment.
Additionally, set the font size to tiny when computing metrics too.
2017-02-21 11:49:12 +01:00
Jean-Marc Lasgouttes
b9d45e5ef6 Set the cursor a bit on the left in empty cells 2017-02-21 09:53:52 +01:00
Jean-Marc Lasgouttes
5211ca52ca Move comment
It is slightly more useful here.
2017-02-21 06:52:34 +01:00
Jean-Marc Lasgouttes
e04079aa52 Fixup to 33b696c8: fix compilation with gcc 4.6 2017-02-21 06:21:49 +01:00
Jean-Marc Lasgouttes
fc02744119 Revert "Linearize macros in box edit mode too."
Guillaume tells me that there are problems. We'll return to it later.

This reverts commit 0140348118.
2017-02-21 05:43:38 +01:00
Guillaume Munch
33b696c8ac Introduce support/Cache.h
Useful to cache copies of objects, including shared_ptrs. No risks of dangling
pointer, and avoid naked pointers in the source.

Fix memory leak when compiling with Qt5.
2017-02-21 00:06:07 +01:00
Jean-Marc Lasgouttes
9a54376aef Better handling for negative position in pos2x
This code is already in stable actually. The old one does not work
well in RtL text.
2017-02-20 15:39:28 +01:00
Guillaume Munch
591b311984 Amend 71623b88
Fix loop of word-delete-backward at the start of a paragraph.
2017-02-19 14:54:44 +01:00
Guillaume Munch
7337c968b3 Fix InsetMathRef mouse behaviour (#10568)
Fix mouse-selection behaviour.

Don't open dialog when releasing if it was not a real click.
2017-02-18 23:03:54 +01:00
Guillaume Munch
63be456c8d When pressing math with the mouse, move to the closest edge (#9748)
Unless it has some dialog that we want to activate.
2017-02-18 23:03:54 +01:00
Guillaume Munch
bac8a95871 Improve mouse selection over InsetCollapsable button. 2017-02-18 23:03:54 +01:00
Guillaume Munch
faeb199793 When selecting math with the mouse, selection happens in the middle (#9748) 2017-02-18 23:03:54 +01:00
Guillaume Munch
eb4a2a190f When selecting text with the mouse, inset selection happens in the middle 2017-02-18 23:03:53 +01:00
Guillaume Munch
86d9abeea7 Move cursor in front of InsetMathSpace before opening the dialog (#7749) 2017-02-18 23:03:53 +01:00
Guillaume Munch
71623b88b2 Generalise the deletion protection mechanism from math to text (#9540)
Now backspace and delete in text will select non-empty math and text insets
before deleting them. This is consistent with what happens in math already.

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

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

New option "force" for the LFUN_*_DELETE_* commands, that bypasses the
confirmDeletion check.
2017-02-18 23:03:23 +01:00
Juergen Spitzmueller
ffacdd8b46 Output Preamble code of InPreamble styles before the styles themselves.
This assures that macros are defined.

Fixes: #10215
2017-02-18 10:40:42 +01:00
Juergen Spitzmueller
e688b9876e Use ASCII number in \char definition
The backtick version breaks in some cases (footnotes in sections)
2017-02-18 10:18:36 +01:00
Juergen Spitzmueller
46e3885d19 \\textquotedbl and \\textquotesingl are unknown in TU encoding.
Use \\char` instead.
2017-02-15 08:37:02 +01:00
Juergen Spitzmueller
7ea6377066 Don't assume T1 font encoding for XeTeX/LuaTeX
They used OT1 internally, and the new TU encoding, which does not (yet?)
contain all macros of T1, as of the Jan 17 LaTeX release.
2017-02-15 08:35:46 +01:00
Jean-Marc Lasgouttes
0140348118 Linearize macros in box edit mode too.
The special mode used by macros where the macro name is displayed as
grey text in a box is now one of the possible marker types for any
inset. The new code puts the macro name below the text, which means
that only the text below the current line will be moved. This makes
edition much more comfortable.

The marker_type enum has been moved from Inset to InsetMath.

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

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

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

The specific metrics/draw code in MathMacro has been removed and
replaced by assertions. Code in addToMathRow and marker is adapted to
reflect the cases where linearization is possible.
2017-02-14 01:02:00 +01:00
Juergen Spitzmueller
00417a1c80 Make openbtUnit raunparam mutable instead of using a copy of runparams
in latexParagraphs()

The latter results in output stream encoding errors.
2017-02-12 18:12:38 +01:00
Guillaume Munch
527cc8ca9c Disable InsetMathKern with invalid lengths (#10539)
From now on \kern and \mkern remain as ERT as long as the length is invalid.

Fixes #10539 (regression at 10c8d51b).

The only way to produce an InsetMathKern now is via parsing (i.e. file opening
or copy-paste). This is because there has never been any sensible way to input a
valid InsetMathKern, but this is another issue.
2017-02-11 21:52:09 +01:00
Juergen Spitzmueller
ff0d96c371 InsetHyperlink: Fix replacement of empty name with target 2017-02-08 09:17:14 +01:00
Jean-Marc Lasgouttes
ace5dc157c Compilation fix: missing header for std::max 2017-02-07 11:43:06 +01:00
Enrico Forestieri
5665209caa Ensure that QT_VERSION is defined
Otherwise checks such as "#if QT_VERSION >= 0x050600" will fail silently.
2017-02-07 11:16:05 +01:00
Jean-Marc Lasgouttes
6763301c05 Better fix for cursor in "blue box"
Since in InsetMathNest::cursorPos we do not know what is the value of
the row element before value of a given BOX, it does not make sense to
set the cursor at a given offset from the start of the MathData
object.

Therefore here we set the cursor in the middle of the MathData object,
which unfortunately may or may not be visually centered wrt the BOX.

The best solution would be to use the MathRow data here, but
unfortunately this is not completely trivial.

This patch replaces 7917ebcc4.
2017-02-06 17:23:00 +01:00
Jean-Marc Lasgouttes
e12b27e16b Some clean-up to markers handling code.
Horizontal space is now added for linearized macros too.

Vertical space handling is done in a separate method.

This is in preparation for handling of 'box' macro editing mode in
MathRow.
2017-02-06 17:17:56 +01:00
Juergen Spitzmueller
450344a9b7 Mention style-dependency of of features in the tooltips, part 2
Some amendments to c7126dc4f9.
2017-02-06 13:17:38 +01:00
Juergen Spitzmueller
c7126dc4f9 Mention style-dependency of some features in the tooltips. 2017-02-06 12:21:53 +01:00
Jean-Marc Lasgouttes
7917ebcc40 Fix cursor positionning in empty math arrays (blue box) 2017-02-06 11:59:39 +01:00
Jean-Marc Lasgouttes
ba8da35afd Fix monolithic build
I gave up understanding why operator==(docstring,char cont *) does not
work in this case.
2017-02-06 11:39:16 +01:00
Juergen Spitzmueller
95eecc8e4a Use localized item when calculating the panel stack's tree widget width.
The current version was wrong for non-English dialogs, and even for
the English one, due to the translator commands that were not removed
for calculation (as in "Formats[[output]]").

Candidate for stable.
2017-02-05 18:02:34 +01:00
Juergen Spitzmueller
517ca4f1cc Disable literal cb if there is nothing to latexify. 2017-02-05 15:43:01 +01:00
Juergen Spitzmueller
06af852293 Correctly enable/disable citation dialog widgets on initialization.
Thanks Guillaume for pointing this out.

(candidate for stable)
2017-02-05 15:42:03 +01:00
Juergen Spitzmueller
2902028a38 update tex2lyx tests 2017-02-04 19:28:18 +01:00
Juergen Spitzmueller
bedebfc45a Support for multiple bibliographies setting "per child"
This adds support for the chapterbib package, but also adds ways to
produce this sort of multibib with biblatex and bibtopic (which are
both incompatible with chapterbib).

File format change.
2017-02-04 19:23:45 +01:00
Juergen Spitzmueller
401961d087 Only close btUnit at the end of the master. 2017-02-04 16:07:58 +01:00
Juergen Spitzmueller
199c3f8e22 update tex2lyx tests 2017-02-04 13:45:16 +01:00
Juergen Spitzmueller
7ca20b292c Support for multiple bibliographies
Using refsection=unit in biblatex, or bibtopic's btUnit environments
in BibTeX.

File format change.
2017-02-04 12:02:00 +01:00
Jean-Marc Lasgouttes
ad79ac406f Fixup 89662a68: remove markers that should not be there
InsetMathDelim does not need markers because the delimiters are
visually enough.

CommandInset (like InsetMathRef) does have cells, but they are hidden
(only for storage). Therefore the default InsetMath::markers() method
mistakenly added markers. In practice, the markers were never active
(since the cursor cannot go into the inset), but some space was
reserved for them.
2017-02-03 10:52:53 +01:00
Jean-Marc Lasgouttes
0060227f27 Simplify TextMetrics::checkInsetHit
The main point is to use CoordCacheBase::covers to see whether a point
is inside a given isnet.
2017-02-02 16:14:23 +01:00
Jean-Marc Lasgouttes
1fca708c7f Move TextMetrics::findRowElement to Row class 2017-02-02 15:35:03 +01:00
Jean-Marc Lasgouttes
57c3a94730 Add RtL information to Row
This allows to somewhat simplify the text and avoid some uses of
Paragraph (in the long term, RowPainter should not have to access
these things).

At the same time do a small cleanup to RowPainter: rename
text_metrics_ to tm_, remove pm_ and width_.
2017-02-02 14:53:01 +01:00
Jean-Marc Lasgouttes
e0024231d3 Fix drawing of rectangle in old-style macro editing mode
The width was a bit to short.
2017-02-02 14:33:38 +01:00
Jean-Marc Lasgouttes
ec676a1dec Make MathRow tokens completely generic
The enum values BEG_MACRO/END_MACRO and BEG_AR/END_AR are replaced by a
single BEGIN/END pair.

The MathRow code now only knows about insets and math arrays.
2017-02-01 17:46:53 +01:00
Jean-Marc Lasgouttes
6c13af3f29 Introduce hooks to encapsulate macro code of MathRow
New hooks (before|after)(Metrics|Draw) are run by the MathRow code
as needed. They are actually also used internally by the MathMacro
code.

The gain is that most traces of explicit macro handling (and
the MathRow::Element::macro member) have been removed from MathRw.cpp.

The next step will be to extend the tokenizing process to allow for
linearizing insets other than macros.
2017-02-01 15:20:06 +01:00
Jean-Marc Lasgouttes
f86dacc292 Linearize macros also when editing them
In the case of inline editing, this avoids unpleasant jumping issues.

This may requires to enter monochrome mode before painting the macro
elements.
2017-02-01 12:21:15 +01:00
Jean-Marc Lasgouttes
344f7f2e7d Make sanitize more robust to dangling pointers.
It is necessary to sanitize the new_word iterator too.
2017-02-01 10:11:55 +01:00
Jean-Marc Lasgouttes
2ea4b1dcdf Revert "Fix crash"
A better fix is forthcoming.

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

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

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

* Implement subscript positioning in the case of rule 17 using negative italic
  correction (kerning_).
2017-01-31 22:55:00 +01:00
Juergen Spitzmueller
580efe45ab Nomencl.ui: minor layout improvement. 2017-01-30 09:14:21 +01:00
Juergen Spitzmueller
48af150896 Update tex2lyx tests 2017-01-30 08:29:16 +01:00
Juergen Spitzmueller
caf72c07cd Check if literal param exists before querying value.
Otherwise LyX asserts.
2017-01-30 08:27:53 +01:00
Juergen Spitzmueller
e15a8f3551 Extend LATEXIFY command param handling and add literal param.
File format change.

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

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

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

Fixes: #2751, #8227.
2017-01-30 07:44:55 +01:00
Juergen Spitzmueller
c59375d679 Move protectArgument function to lstrings
This will be useful to other insets as well.
2017-01-29 12:08:29 +01:00
Juergen Spitzmueller
83074c431c Whitespace 2017-01-28 13:00:33 +01:00
Jean-Marc Lasgouttes
8e7d0c2002 Fix flushing of row that was cut after an hyphen
When using Qt stuff in breakAt, it may happen that the row is broken
after an hyphen (whereas the old code would only consider spaces).

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

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

Candidate for stable
2017-01-27 09:15:47 +01:00
Guillaume Munch
15f64f8413 Fix wrong DocIterator argument
Regression at 3391fed3.

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

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

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

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

Note that there is no need to care about RtL row elements at this
point, since the bidi algorithm will be applied to the row
subsequently.
2017-01-26 14:16:24 +01:00
Enrico Forestieri
ebd96fadd5 Ignore QT_SCALE_FACTOR for Qt < 5.6
This environment variable was introduced in Qt 5.6.0
2017-01-25 20:00:54 +01:00
Tommaso Cucinotta
eaa3ddaf45 turned message about disabled converters from prefs from warning to error 2017-01-25 03:10:56 +01:00
Jean-Marc Lasgouttes
000832f9d9 Use Paragraph::getAlign in TextMetrics
This avoids some duplicate code. Note that the return value of
Paragraph::getAlign had to be changed. I suspect it was set to char to
avoid reading one header file in Paragraph.h.
2017-01-24 19:33:03 +01:00
Jean-Marc Lasgouttes
1f352b390c Avoid markers for macros without arguments
An example was the \neq macro, which exhibited white markers when selecting.
2017-01-23 10:14:20 +01:00
Juergen Spitzmueller
fd8b4aebb0 Generalize the protection of brackets in citation arguments
Whenever an argument delimiter is used inside the argument, the argument
needs to be grouped, that is

\cites({text (text) text})

or

\cite[{text [text] text}]

This fixes the original case reported in #2751 which is independent
from the general issue that the pre- and postnote field take literal
code.
2017-01-22 10:27:06 +01:00
Enrico Forestieri
9e6cf6e05a Allow to properly scale the GUI with Qt5
Starting with Qt 5.6, setting the environment variable QT_SCALE_FACTOR
makes everything accordingly bigger. So, if QT_SCALE_FACTOR=1.2, all
text and GUI elements are rendered 20% bigger. However, if an application
does not account for this, everything will also look "blocky".
With this commit, all text and images will be scaled remaining sharp.
This works whether a HiDpi screen is used or not, but is mostly useful
with a HiDpi screen, as all GUI elements are more spaced apart and one
can use the mouse for selecting things without requiring a high precision.
2017-01-22 01:06:00 +01:00
Juergen Spitzmueller
9cad99c2b5 update tex2lyx tests 2017-01-21 14:46:43 +01:00
Juergen Spitzmueller
68ab4023cc Support for "qualified citation lists"
These are biblatex-specific multicite commands that allow for multiple
pre- and postnotes, as in:

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

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

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

File format change.
2017-01-21 14:25:17 +01:00
Enrico Forestieri
633ad2032e Add clarifying comment 2017-01-20 20:30:06 +01:00
Jean-Marc Lasgouttes
4a935ed768 Fix metrics of math characters with 0 width
It seems that QTextLayout does not handle properly a single character
with 0 width. This breaks drawing of things like \not.

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

When a box is invisible, its width should be null (but keep the weight
to avoid drawing problems (think empty sqrt in a macro).
2017-01-19 17:07:21 +01:00
Jean-Marc Lasgouttes
5982d2abd7 Revert "BOX tweak"
This reverts commit 596c9065e6.
2017-01-17 16:31:34 +01:00
Jean-Marc Lasgouttes
f73bb3f16e Fix glitch in drawing fractions
This is a fixup to 89662a68.
2017-01-17 16:28:48 +01:00
Jean-Marc Lasgouttes
596c9065e6 BOX tweak 2017-01-16 15:35:45 +01:00
Juergen Spitzmueller
4859a1f6bb Don't load bibtopic with Biblatex 2017-01-15 15:40:20 +01:00
Guillaume Munch
fdf805956b Fix font of macro template name 2017-01-14 23:13:14 +01:00
Guillaume Munch
3391fed36a Make the generation of children's tocs more robust
Let the children directly access the TocBuilders, instead of concatenating
after the fact.
2017-01-14 23:13:14 +01:00
Guillaume Munch
461fda9ca9 Collect the outliner names for the children's tocs
Fixes missing outliner names in various situations. Now if the warning "Missing
outliner name" appears in the console, this correctly hints at an actual issue
with the layout.
2017-01-14 23:13:14 +01:00
Guillaume Munch
54f5100e74 Simplify
The main point is the flag which is much simpler now.
2017-01-14 23:13:14 +01:00
Guillaume Munch
bd1ce03b40 Two separators collapse into one
It seems guaranteed by the Qt docs that two menu separators collapse into
one. This allows this little simplification.
2017-01-14 23:13:14 +01:00
Juergen Spitzmueller
33fa147fca Minor string fixes 2017-01-14 17:48:37 +01:00
Juergen Spitzmueller
ed7d3a33ab Some master/child biblio fixes. 2017-01-14 14:44:18 +01:00
Juergen Spitzmueller
b3cc07e3a6 Trim biblio options and biblatex styles 2017-01-14 14:28:35 +01:00