Commit Graph

24390 Commits

Author SHA1 Message Date
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