Commit Graph

24674 Commits

Author SHA1 Message Date
Jean-Marc Lasgouttes
040e9d32a6 Do not apply mathindent to inline math insets 2017-09-24 22:38:18 +02:00
Juergen Spitzmueller
b498646b2e Fix some spelling errors reported by Sven
Fixes: #10678
2017-09-22 09:29:16 +02:00
Jean-Marc Lasgouttes
275d306c73 Do not presume what the defaults for a new QPainter are 2017-09-18 11:21:18 +02:00
Jean-Marc Lasgouttes
6532e5104d Remember correctly pixel ratio used for painting
This avoids endless resize issues on HiDPI systems (e.g. Retina Mac).

Rename pixel_ratio_ to last_pixel_ratio_ to emphasize that this is a
cached value.

Inline needResize method to make the logic clearer in paintEvent.
2017-09-18 10:58:07 +02:00
Juergen Spitzmueller
a7b017fd2f Reset InsetArgument language after passthru status change
Fixes: #10664
(cherry picked from commit d8c018b8c6)
2017-09-15 16:23:50 +02:00
Juergen Spitzmueller
9302b1ae63 Allow to provide xunicode. 2017-09-15 09:39:22 +02:00
Jean-Marc Lasgouttes
a31d3dc67d Compute metrics when graphics is updated
Remove the old schedule_redraw_ mechanism that was only useful because
of our synchronous drawing code. Now that actual painting is
scheduled instead of forced, it becomes pointless.

Rename WorkArea::redraw(bool) to scheduleRedraw(bool), to show that
the drawing is not done right away.

In GuiView::updateInset, call scheduleRedraw(true), so that metrics
are correctly computed (this was the whole point of the exercise).
2017-09-14 15:50:30 +02:00
Jean-Marc Lasgouttes
bef0a9137f Remove unused private field from Painter
Clang is good at seeing those, gcc is not.
2017-09-13 15:02:17 +02:00
Stephan Witt
1460e8fe6f #10662 use drawers for bibliography dialogs
This change solves dialog stacking problems on newer Mac OS X in combination with the OS provided file open dialog.

(cherry picked from commit 97dc585138)
2017-09-12 11:14:16 +02:00
Jean-Marc Lasgouttes
3f1944a7c9 Update row width when inset is indented
Fixes bug #10758
2017-09-11 12:40:40 +02:00
Juergen Spitzmueller
4ac94fecb6 GuiBibtex: Use appropriate title when using Biblatex 2017-09-10 10:59:05 +02:00
Juergen Spitzmueller
ed1b67b7ca Use default btprint value in the UI if none is given. 2017-09-10 10:53:35 +02:00
Juergen Spitzmueller
eff50597c0 Disallow newlines in biblatex options
Fixes: #10757
2017-09-10 10:06:47 +02:00
Juergen Spitzmueller
2aaf185e7c Add default output format for pLaTeX
Fixes: #10747
2017-09-09 08:56:04 +02:00
Jean-Marc Lasgouttes
3d590d3bd7 Merge remote-tracking branch 'features/properpaint'
Now painting the workarea is done at paint events as should be.
Explicit painting after updating metrics has been replaced by a much
lighter procedure (updatePosCache) to update the insets positions cache.

Expected benefits:
- better performance
- proper use of subpixel aliasing

The LyXRC variable use_qimage is not needed anymore and is therefore removed.
2017-09-08 17:05:13 +02:00
Jean-Marc Lasgouttes
4f4383cac5 remove LyXRC::use_qimage
This is not needed anymore now that we do not need a backup pixmap.

Update LyXRC format to 23 and add conversion.
2017-09-08 16:58:21 +02:00
Jean-Marc Lasgouttes
3b404b0023 Update insets position in cache in more cases
This patch makes sure that, every time a ParagraphMetrics has its
position set, the inset positions for the insets held by this
paragraph are remembered too.

This is complementary to BufferView::updatePosCache, but I do not have
hard evidence that this is required other than to increase robustness.
It may help in some cases when scrolling the document (scrollbar,
cursor up/down, page up/down).
2017-09-08 16:57:22 +02:00
Jean-Marc Lasgouttes
b0737d2589 Rename more instances of "cursor" to "caret"
Thanks to Pavel for the hint.
2017-09-08 16:57:22 +02:00
Jean-Marc Lasgouttes
fb655725b7 Remove workaround that is not necessary anymore.
This code was necessary to handle cases where the insets positions
were not yet in cache. This cannot happen anymore thanks to the
nodraw stage.
2017-09-08 16:57:21 +02:00
Jean-Marc Lasgouttes
14320e5b9a Make input methods support great again
This unbreaks input methods by splitting the part of the code that
does the actual drawing to a separate paintPreeditText() method which
is called from paintEvent().

The proper solution would have been to introduce the preedit string in
the Row object, like is done for completion, but this is too complex
to do at this point.

The only change in behavior is that now the commit string is inserted
in one fell swoop, intead of emulating a number of key events.
2017-09-08 16:57:21 +02:00
Jean-Marc Lasgouttes
1a7e342652 Cleanup and simplify WorkArea code
Rename cursor to caret to in order to avoid ambiguity. The caret is
now the blinking thing only.

Remove unused header contents, and some not so useful methods.

No intended change of behavior.
2017-09-08 16:57:21 +02:00
Jean-Marc Lasgouttes
e7fdce0b5a Fix caret painting
The trick is to remember in BufferView what has been done at the
previous draw, so that the row that contained the caret can be
repainted if needed.

To this end, add an argument paint_caret to BufferView, although
painting the caret is not the job of the BufferView (at this point).

BufferView::needRepaint will act as an interface with
TextMetrics::drawParagraph to know whether the painting of a given
row should be forced.

Currently everything is done at the top row level, so that, if the
caret is in a large table, the whole table will have to be repainted.
It is not clear yet that this is necessary.
2017-09-08 16:57:21 +02:00
Jean-Marc Lasgouttes
24c29908bd Do the actual drawing in the paint event
Historically, because of two-stage drawing, LyX has been painting on a
Pixmap, and this pixmap is copied to screen at paint event time.

Now that we have three-stage drawing, it is possible to delay the
painting to actual paint event and avoid the intermediate Pixmap.

Known bug: the cursor is never erased.
2017-09-08 16:55:11 +02:00
Juergen Spitzmueller
858a9a0465 Make the session zoom relative to the default zoom
Also rename lyxrc.zoom to lyxrc.defaultZoom

Fixes: #10455
2017-09-06 18:13:34 +02:00
Juergen Spitzmueller
eb51d60571 Consider insets that are chars in InsetCollapsable::getNewLabel()
This fixes the display of closed ERTs, Indexes etc. when they contain
special chars, logos or quotation marks.

(Since quotation marks in ERTs are now insets, not chars anymore,
this also fixes a bug/regression of the display of babel shortcuts
such as "= in closed ERTs; hence I consider this fix necessary for 2.3.x)
2017-09-06 10:02:51 +02:00
Juergen Spitzmueller
a3eab36364 Add special chain for Modules with OutputFormat for pLaTeX (Japanese)
Fixes: #8823
2017-09-01 10:27:12 +02:00
Jean-Marc Lasgouttes
59e2c40564 When a row is shortened, reset its flushed() attribute.
Fixes bug #10699.
2017-08-31 14:52:30 +02:00
Jean-Marc Lasgouttes
5c54557350 Honor trailing spaces in LabelString and friends
Remove the trimming operation on LabelString, LabelStringAppendix,
EndLabelString and LabelCounter. This trimming meant that quotes
strings were not preserved, which is wrong.

To preserve layouts, the Layout format has been updated to 64, so that
layout2layout can remove extra spaces on existing strings, which
ensures that behavior is unchanged for old layouts (courtesy of rgheck).

It is now possible to re-add spaces in label strings where it makes
sense.

Fixes bug #10723.
2017-08-31 13:59:37 +02:00
Jean-Marc Lasgouttes
efc7359015 three-stage drawing: add a nodraw stage
Normally the two stages of drawing are
1/ compute metrics of insets/rows/paragraphs/mathrow...
2/ draw the elements and cache their positions

Now the three stages are
1/ metrics
2/ nodraw: do not draw the elements, but cache their position
3/ draw the elements (and store again their position; it does not
   seems to hurt performance).

Revive the NullPainter: this replaces the setDrawingEnabled mechanism
with a painter that does nothing. The advantage is that updatePosCache
(renamed from setPosCache) does not need anymore to be invoked from
the frontend.

updatePosCache (the nodraw stage) is called at the end of
BufferView::updateMetrics.
2017-08-29 16:37:07 +02:00
Jean-Marc Lasgouttes
48f099d93a Fix Lexer::getLongString prefix pruning logic
This fixes 3 bugs:
1/ only spaces are considered as part of the prefix
2/ leading tabs are removed unconditionally
3/ off-by-one error in the removal

The new intended behavior is:

1/ find the prefix (sequence of spaces and tabs) before the first
   line; remove this prefix from the line
2/ on the next lines, check whether they start with the same prefix,
  and if they do, strip this prefix
2017-08-29 15:30:44 +02:00
Jean-Marc Lasgouttes
c874641e95 Fix computation of string width when using a QTextLayout
It was not a good idea to rely on QTextLine::naturalTextWidth() to
compute a string width. The correct method is horizontalAdvance().

Also round the value to the nearest pixel, since this is what
QFontMetrics::width() does.

Fixes bug #10700 (and maybe others).
2017-08-28 14:05:45 +02:00
Juergen Spitzmueller
9bbcfebb95 Amend 7e121117bb 2017-08-13 12:01:49 +02:00
Juergen Spitzmueller
7e121117bb Vietnamese no longer requires any special handling.
It is a normal babel support package.
2017-08-13 11:53:41 +02:00
Scott Kostyshak
acc1cc394f Remove a sometimes blocked call to dispatch
Dispatching LFUN_BUFFER_ZOOM inside of GuiView::restoreLayout() was
blocked in some cases because the function can be called without a
buffer (and the LFUN is marked as needing a buffer). Instead of
conditioning on a buffer, the call is removed because in testing it
does not appear why it is needed.

This commit removes the status message that is displayed if starting
LyX without opening a buffer:

    "Command not allowed without any document open"

See discussion at:

    https://www.mail-archive.com/search?l=mid&q=20170718084344.3kjmu7hzoyajt7vd%40steph

This commit amends 4183a9f4.
2017-08-12 11:46:11 -04:00
Juergen Spitzmueller
7a7c2117bf Fix compilation order
(This is the pedant in me)
2017-08-12 10:22:45 +02:00
Juergen Spitzmueller
0e711b414e Add missing break
As correctly pointed out by gcc7.
2017-08-12 09:55:06 +02:00
Juergen Spitzmueller
e9c9ad8055 Forgot this one. 2017-08-12 09:24:01 +02:00
Juergen Spitzmueller
1249e5e13e Mark some intentional fall-throughs (in a way understandable to gcc)
This silences -Wimplicit-fallthrough warnings with gcc7.

(Re-Apply without the unintended commits)
2017-08-12 09:06:29 +02:00
Juergen Spitzmueller
0120c3fc10 Revert "Mark some intentional fall-throughs (in a way understandable to gcc)"
This reverts commit 6dc1884d05.
2017-08-12 09:04:23 +02:00
Juergen Spitzmueller
b73879691f Another (IMHO false) fall-through warning silenced
With a FIXME. The case should be checked.
2017-08-12 08:59:26 +02:00
Juergen Spitzmueller
6dc1884d05 Mark some intentional fall-throughs (in a way understandable to gcc)
This silences -Wimplicit-fallthrough warnings with gcc7.
2017-08-12 08:57:02 +02:00
Juergen Spitzmueller
b2841e9570 Require textquotedbl def with second language that has internal fontenc
Since these switch locally to encodings that do not define \textquotedbl
themselves.
2017-08-10 11:47:52 +02:00
Enrico Forestieri
40e9dea551 Use the OK/Apply paradigm for all document settings
Due to its peculiarity of not being saved in the document, the
shell escape setting was applied immediately without the need
for hitting the Apply or OK buttons. However, for uniformity
sake, it is better to adhere to the established paragdim of
confirming any changes before applying them.
2017-08-10 01:32:23 +02:00
Juergen Spitzmueller
094341fa5a Fix straight quote character in non-T1 encoding
Fixes: #10584
2017-08-09 17:25:02 +02:00
Juergen Spitzmueller
9a36ffd1e3 Sort external templates locale-aware
Fixes: #10738
2017-08-09 16:09:50 +02:00
Kornel Benko
29a735463a Adapt the check for configure need to the one used in LyX::queryUserLyXDir()
We should refactor the check
2017-08-08 12:23:15 +02:00
Kornel Benko
187824da3c Amend d6285d5, copy & paste error, urrrrg 2017-08-04 16:16:08 +02:00
Kornel Benko
d6285d52e7 For cmake case try to use the newly built .gmo files first. 2017-08-04 16:06:32 +02:00
Enrico Forestieri
f11bfe1697 The shell escape patch
Allow a LaTeX backend to run external commands after user confirmation.
This is a per document and per machine setting. The authorization has
to be given through the document settings pane, but is not recorded in
the document itself. Moving the document to either another computer or
another directory on the same computer revokes the authorization.
This can also be done by right clicking the red icon that appears in
the status bar when a document is marked as one requiring shell escape.
The patch also checks whether the user has added the -shell-escape
option to a LaTeX converter and nags the user to remove the option
(which would be used for all documents) in favor of the (per document)
support offered by LyX.
2017-08-03 13:07:41 +02:00
Kornel Benko
b5a4e79736 Since boost dir may not exist anymore, use the lyx-src dir for out-of-source build detection 2017-08-02 18:44:32 +02:00
Kornel Benko
b7082f2d29 Correctly interpret return value of LyXRC::read(FileName const & filename, bool check_format) 2017-08-01 13:08:07 +02:00
Enrico Forestieri
44babaf656 Properly warn on missing pygmentize command
- Do not warn when the document properties pane is opened but only
  when minted is selected and the pygmentize command was not found.
- Warn before launching latex if minted is selected and the document
  actually uses listings insets.
2017-07-31 11:32:28 +02:00
Christian Ridderström
95e7abadc0 Add missing 'break' for four default cases in VCBackend.cpp
Replace four cases of 'default: ;' in VCBackend.cpp with
    default:
        break;

Justification: Make consistent with the rest of the LyX source code.
I found no other occurences of 'default: ;' in the source.
2017-07-30 14:23:38 +02:00
Christian Ridderström
7b652117d6 Fix editorial whitespace error
Fix a non-controversial editorial whitespace error in order to verify
that the commit has the correct e-mail address and that it appears on
the list.
2017-07-30 09:30:58 +02:00
Christian Ridderström
26acdd27c4 Fix editorial whitespace issues, e.g. extra space before semicolon
Fix some editorial whitespace errors in AspellChecker.cpp.
Changes are non-controversial and I've reviewed them manually.

The whitespace errors were distracting from the big picture while
using the file to work on candidate(s) for a clang-format
configuration.
2017-07-30 00:54:12 +02:00
Tommaso Cucinotta
770ab9a824 prefs/needauth: avoid show of warning dialog in corner cases (amending [8a4fcd3d/lyxgit]) 2017-07-27 20:00:41 +02:00
Tommaso Cucinotta
8a4fcd3d95 prefs/needauth: added warning if user tries to disable authorization for needauth converters. 2017-07-27 00:05:45 +02:00
Jean-Marc Lasgouttes
15a87dd3a8 Check whether a class is known before loading it
Fixes bug #10719.
2017-07-25 11:57:29 +02:00
Guillaume MM
764c61a08f Fix scrollbar not appearing in new documents unless reloaded (#10729)
QSignalBlocker in updateScrollbar is too strong and prevents the scroll bar from
communicating with its scroll area. The only solution to block signals between
specifically between two objects is to disconnect. This makes sense in this
case, by making updateScrollbar responsible for managing the connection in the
first place.
2017-07-25 00:33:48 +02:00
Jean-Marc Lasgouttes
9fe8190364 Make "devel mode" configurable at run time
Traditionally LyX behaves differently when the directive DEVEL_VERSION
is defined at compile time. This covers
* more detailed description of current position in status bar
* the help files are open in read/write mode
* more detailed debug output in the View Source panel

This patch introduces the new function devel-mode-toggle that allows
to use devel mode in stable releases, and vice versa.

The information is saved in the session file. The default is to
disable devel mode.

Remove all traces of DEVEL_VERSION in autoconf and cmake
2017-07-24 22:00:44 +02:00
Juergen Spitzmueller
9b128671a5 {Over,under}full [hv]box warning is a warning.
Since this is something one should be aware of, make it more prominent
in the Log dialog.
2017-07-24 09:09:48 +02:00
Juergen Spitzmueller
a40868510d Do not error on missing ZWNJ (ligature break) characters.
Since TeXLive 2016, "fontspec" maps the ligature break command
\textcompwordmark to the ZWNJ character (U+200C).
This character is missing in many fonts (including the default: Latin
Modern) which leads to "Missing character" warnings in the XeTeX/LuaTeX
log file if a document using non-TeX fonts contains a ligature break.

LyX reports missing characters as error since fixing #9610.
In case of "invisible" characters, there is no data loss, in case of the
ZWNJ the functionality is kept: ligatures are prevented also if the ZWNJ
is missing in a font.

Therefore, a missing ZWNJ is now treated similar to missing characters
in "nullfont" (see [63f41711/lyxgit], bug #10394) and does not trigger
an error.

Fixes: #10727
2017-07-23 18:41:06 +02:00
Juergen Spitzmueller
3c7b75c5bc Properly import \newtheorem*
Fixes: #10622
2017-07-23 13:20:56 +02:00
Christian Ridderström
e30f3d76d2 Bulk cleanup/fix incorrect annotation at the end of namespaces.
This commit does a bulk fix of incorrect annotations (comments) at the
end of namespaces.

The commit was generated by initially running clang-format, and then
from the diff of the result extracting the hunks corresponding to
fixes of namespace comments. The changes being applied and all the
results have been manually reviewed. The source code successfully
builds on macOS.

Further details on the steps below, in case they're of interest to
someone else in the future.

1. Checkout a fresh and up to date version of src/

    git pull && git checkout -- src && git status src

2. Ensure there's a suitable .clang-format in place, i.e. with options
   to fix the comment at the end of namespaces, including:

    FixNamespaceComments:                           true
    SpacesBeforeTrailingComments:                   1

and that clang-format is >= 5.0.0, by doing e.g.:

    clang-format -dump-config | grep Comments:
    clang-format --version

3. Apply clang-format to the source:

    clang-format -i $(find src -name "*.cpp" -or -name "*.h")

4. Create and filter out hunks related to fixing the namespace

    git diff -U0 src > tmp.patch
    grepdiff '^} // namespace' --output-matching=hunk tmp.patch  > fix_namespace.patch

5. Filter out hunks corresponding to simple fixes into to a separate patch:

    pcregrep -M -e '^diff[^\n]+\nindex[^\n]+\n--- [^\n]+\n\+\+\+ [^\n]+\n'  \
        -e '^@@ -[0-9]+ \+[0-9]+ @@[^\n]*\n-\}[^\n]*\n\+\}[^\n]*\n'         \
        fix_namespace.patch > fix_namespace_simple.patch

6. Manually review the simple patch and then apply it, after first
   restoring the source.

    git checkout -- src
    patch -p1 < fix_namespace_simple.path

7. Manually review the (simple) changes and then stage the changes

    git diff src
    git add src

8. Again apply clang-format and filter out hunks related to any
   remaining fixes to the namespace, this time filter with more
   context. There will be fewer hunks as all the simple cases have
   already been handled:

    clang-format -i $(find src -name "*.cpp" -or -name "*.h")
    git diff src > tmp.patch
    grepdiff '^} // namespace' --output-matching=hunk tmp.patch  > fix_namespace2.patch

9. Manually review/edit the resulting patch file to remove hunks for files
   which need to be dealt with manually, noting the file names and
   line numbers. Then restore files to as before applying clang-format
   and apply the patch:

    git checkout src
    patch -p1 < fix_namespace2.patch

10. Manually fix the files noted in the previous step. Stage files,
    review changes and commit.
2017-07-23 13:11:54 +02:00
Juergen Spitzmueller
d50e2aa7bf typo in comment 2017-07-23 12:11:03 +02:00
Juergen Spitzmueller
94d45d9c56 Some comments wrt log file encoding (#10728) 2017-07-23 12:06:58 +02:00
Juergen Spitzmueller
7609221ada Use appropriate conv. method
These are plain ASCII strings, no need for local8bit conversion.
2017-07-23 09:37:11 +02:00
Jean-Marc Lasgouttes
c7647eb394 Make InsetInfo active agin (aka the vengeance of the neverending saga)
This is a fixup to fc7fb6a564. The fix in there seems perfectly
correct (up to now), but for some reason, I could not refrain from
making InsetInfo not active. "What could possibly go wrong?", I heard
myself think.

Now I know: this causes an assertion error in InsetText::updateBuffer
because DocIterator::forwardPos does not enter the inset anymore.
2017-07-20 23:56:45 +02:00
Jean-Marc Lasgouttes
fc7fb6a564 Try to end the neverending fixIfBroken saga
This is a fixup to the  series of commits 522516d9, d0acc3e5, 13c3c148.

Actually the right thing to consider in all situations is isActive(),
which really means `can a cursor be in there?'.

Improve the description of isActive() and editable() in Inset.h.

Set isActive() to false for InsetInfo, since no cursor should ever go there.

Again part of #10667.
2017-07-20 11:18:20 +02:00
Christian Ridderström
5078448111 Fix minor whitespace error.
Fix the whitespace in e.g. 'QString&' to 'QString &' as this
incorrect, but primarily to simplify a comparison related to
later possibly introducing the use of .clang-format.
2017-07-17 22:23:17 +02:00
Jean-Marc Lasgouttes
a39a98f422 Fix comment 2017-07-15 18:41:56 +02:00
Jean-Marc Lasgouttes
ebb9d7b058 Avoid multiple execution of AddToPreamble and friends
When trying to read a textclass, read(Lexer, Readtype) parses and
executes the first token and only then verifies that its effect was to
set format properly. Otherwise it exits.

This is wrong, because if the first tag is "AddToPreamble", then it will
have modified the preamble by the time we notice it was not "Format" and
therefore exit.

The new code starts by requiring a correct "Format" tag.

Fixes bug #10725.
2017-07-15 16:34:48 +02:00
Jean-Marc Lasgouttes
04eef3480f Fix generation of lyx_commit_hash.h
The code in the Makefile was incorrect.
2017-07-13 18:14:03 +02:00
Jean-Marc Lasgouttes
f6e37a8ca0 TextMetrics::leftMargin does not need a max_width parameter
Additionally move it to private: section.
2017-07-12 10:29:27 +02:00
Jean-Marc Lasgouttes
0d565f7b35 When cleaning up before quitting, take care of exceptions
We do not want the cleanup work to be interrupted by a buffer exception.

Spotted by coverity. See bug #9979 for discussion.
2017-07-11 15:30:32 +02:00
Jean-Marc Lasgouttes
fc75cbd88f Remove copy-and-paste error 2017-07-11 13:43:32 +02:00
Jean-Marc Lasgouttes
cfd27dd219 Do not record undo when typing two spaces has been blocked
Move the code that forbids character insertion in its own helper function.

Call this function before doing a recordUndo. This avoids to mark the
document dirty in cases where nothing happens.

Part of bug #10721.
2017-07-11 12:15:29 +02:00
Jean-Marc Lasgouttes
0ba385800e Rewrite stripName without regex
Using a regular expression to find /src/ or \src\ in a string is overkill,
and since regexes can throw exceptions, it makes coverity nervous.

The new code is simpler anyway.
2017-07-06 15:26:32 +02:00
Jean-Marc Lasgouttes
02c9d2e67c Fix uninitialized members outfd and infd
Also move initialization of some variables to initializers list.

Only the non-win32 part has been tested, but it should be OK.

Spotted by coverity.
2017-07-06 14:52:19 +02:00
Jean-Marc Lasgouttes
449b594a72 Fix unitialized member
Spotted by coverity.
2017-07-06 14:45:21 +02:00
Jean-Marc Lasgouttes
c2d182f59a Remove test that is not needed.
We know that buf is not null at this point.

Spotted by coverity.
2017-07-06 14:14:43 +02:00
Jean-Marc Lasgouttes
64667735f4 h_use_minted is a bool, not a string
We have a mix in this file of boolean stored as such or as strings.
This translates to values written as true/false or 1/0 in .lyx files.

In this case, the value of use_minted could only be true, since the
char * pointer is non null.

Also add some else clauses.

Spotted by coverity.
2017-07-06 14:11:30 +02:00
Jean-Marc Lasgouttes
29378af4cd Rename some macro-related insets
These classes should have names that start with "Inset". Renaming done:
MathMacro => InsetMathMacro
MathMacroTemplate => InsetMathMacroTemplate
MathMacroArgument => InsetMathMacroArgument
ArgumentProxy => InsetArgumentProxy
DisplayLabelBox => InsetDisplayLabelBox
CommandInset => InsetMathCommand
2017-07-05 14:46:34 +02:00
Jean-Marc Lasgouttes
ab81c23656 Do not use toobar menu as fallback context menu
This is a consequence of e91572a0, although it is not clear why. The
contextMenuEvent code of the workarea should not delegate context
menu when it cannot honor it.

Also fix a small memory leak.

Fixes bug #10616.
2017-07-05 12:28:26 +02:00
Jean-Marc Lasgouttes
4eb9b50dc6 Use the proper buffer when recording undo
The code in InsetLabel::updateReferences code changes reference insets
in potentially several buffers. When recording undo, it is important
to use the right undo stack, otherwise crashes can ensue.

Once it is done, it is neccessary to create undo groups as needed.
This is done using UndoGroupHelper. This demonstrates a shortcoming of
UndoGroup helper: if a buffer is encountered in two seperate
occasions, two undo groups will be created for this buffer. This is
not correct.

Fixes bug #10643.
2017-07-04 16:34:34 +02:00
Richard Heck
fd5a950d7f Fix whitespace in some more files. 2017-07-03 14:46:27 -04:00
Richard Heck
00e4902ea3 Fix trailing whitespace in txt files. 2017-07-03 13:53:41 -04:00
Richard Heck
75bfed5507 Fix trailing whitespace in cpp files. 2017-07-03 13:53:14 -04:00
Richard Heck
51aebc9327 Fix whitespace at EOL. 2017-07-03 13:46:30 -04:00
Jean-Marc Lasgouttes
13c3c1485b Fixup the fixup d0acc3e570: use editable()/isActive()
While 522516d9 was too strong and broke mathed, d0acc3e570 is too
lenient and can accept insets (mathed/CommandInset, InsetInfo) that
have a positive nargs() but are not editable (because they encapsulate
something).

Therefore the best solution for now is to use editable() in text and
isActive() in mathed, until those two things are merged.

Part of #10667.
2017-06-27 16:35:39 +02:00
Bernhard M. Wiedemann
b8e3615492 sort svgz file list
(required because filesystems return listings in undeterministic order)
to generate Resources.qrc and thereby Resources.cpp and the lyx binary
in a reproducible way

Setting LC_ALL=C because sort order might vary with locales.

See https://reproducible-builds.org/ for why this matters.

Fixes #10711.
2017-06-27 16:04:33 +02:00
Enrico Forestieri
0e90aeea90 Don't enclose in braces minted languages
This is because the braces would be part of the language name.
2017-06-27 00:58:07 +02:00
Enrico Forestieri
7b5d33a707 Amend 28be7d55 to avoid an exception
This was occurring during validation when trying to enter the
language name in the advanced tab.
2017-06-27 00:09:51 +02:00
Enrico Forestieri
28be7d552f Account for old versions of Pygments
Pygments versions prior to 2.0 only accept lower case names for lexers.
This commit makes sure to always use lower case names for the language
that is written in the LaTeX file, while retaining the proper casing
for the presentation in the GUI, which is dictated by compatibility
with the listings package. Moreover, if one switches from listings
to minted in a document, the language combo is properly updated even
if the used language had attached a dialect (a concept not shared by
minted), or even when importing a LaTeX document with tex2lyx.
2017-06-26 23:23:23 +02:00
Enrico Forestieri
d87513a94d Fix bug #10705
Seemingly, std::regex does not account for newlines in the string.
2017-06-26 16:14:27 +02:00
Enrico Forestieri
80f3f219b7 Clarify the status of thread local storage on OSX
The __thread local storage is supported on OSX since 10.7 (Lion),
released in 2012. For example, see:
http://forum.dlang.org/post/mailman.3439.1452269142.22025.digitalmars-d-bugs@puremagic.com
2017-06-26 14:41:34 +02:00
Juergen Spitzmueller
0a58035f84 Catch xdvipdfmx driver error (that breaks XeTeX compilation).
This prevents an assertion due to an unrecognized error.

Fixes: #10076.
2017-06-25 10:29:19 +02:00
Jean-Marc Lasgouttes
8910a8a1cc Fixup 9c92494e1a: avoid crash in Inset::dissolve()
The code path when the inset is empty did not fixup the cursor
position correctly.

Part of bug #10667.
2017-06-23 19:44:54 +02:00
Jean-Marc Lasgouttes
d0acc3e570 Fixup 522516d9 : editable() is unusable in mathed
This is a relic from IU (Inset Unification): editable() is for text
insets and isActive() for mathed. This needs to be cleaned up.

Part of bug #10667.
2017-06-20 09:41:48 +02:00
Enrico Forestieri
4dea27c4c7 Fix bug #10546
A labeled equation is also numbered.
2017-06-20 01:14:55 +02:00
Jean-Marc Lasgouttes
4efb129ccb Avoid crash when selecting long text
In some (not yet understood) situations, the paragraph metrics cache
is empty in generateSyntheticMouseEvent(). We just avoid a crash in
this case, but there is probably an underlying problem that deserves
being fixed.

Fixes bug #10324.
2017-06-19 12:23:17 +02:00
Enrico Forestieri
d4d7cdf9a1 Prune white space after the separating comma of options
Both listings and minted allow for many complex options. So, a latex
source can be easily written as

\documentclass{article}
\usepackage{minted}
\usepackage{graphicx}
\usepackage{dingbat}
\begin{document}
\begin{minted}[breaklines=true,
               breakautoindent=false,
               breaksymbolleft=\raisebox{0.8ex}{
                   \small\reflectbox{\carriagereturn}},
               breaksymbolindentleft=0pt,
               breaksymbolsepleft=0pt,
               breaksymbolright=\small\carriagereturn,
               breaksymbolindentright=0pt,
               breaksymbolsepright=0pt]{Python}
def f(x):
    return 'Some text' + str(x) + 'some more text' + str(x) + 'even more text that goes on for a while'
\end{minted}
\end{document}

The used text editor can therefore add a mixture of tabs and spaces.
The white space after the options is not a problem and the imported
file compiles just fine, but the validator gets confused and doesn't
validate them. This would entail a difficult editing of the options
only to have them validated. So, better remove the white space.
2017-06-17 20:41:29 +02:00
Enrico Forestieri
a1e65ad458 Amend 9b2b51a4
runtests.py was being forgotten and a string transliterated.
2017-06-17 19:35:10 +02:00
Kornel Benko
9b2b51a4db Tex2lyx tests: Added minted testcase from Enrico Forestieri 2017-06-17 19:12:17 +02:00
Enrico Forestieri
f135c8d227 Don't allow raw newlines in options
This happens if the options are split over multiple lines in the
latex source. A newline here confuses the lexer when reading the
converted LyX file.
2017-06-17 19:05:02 +02:00
Enrico Forestieri
000b7f3f46 Correctly skip a bottom caption
The getArg() method stops at the first closing brace, whether it
matches the opening one or not, so properly parse the caption and
then throw it away.
2017-06-17 14:01:42 +02:00
Juergen Spitzmueller
cde5d60fcf Update parent buffer as soon as a child has been released
This prevents dangling pointers that might crash LyX.

Fixes: #9979.

Candidate for stable.
2017-06-17 09:43:01 +02:00
Enrico Forestieri
7a9bb85184 tex2lyx: import minted listings
This commit updates tex2lyx in order to also import minted listings.
For the floating version of a listing, minted uses the listing
environment, a concept that is not shared with the listings package,
towards which our listings inset is geared.
For this reason, a kludge is necessary when importing minted listings
not previously exported by LyX itself.
If the floating listing contains only a caption and a label (other
than the listing itself), everything is fine and the import is (or
aims to be) perfect. But, as in all other floating ebvironments,
one can also stick there other elements, which don't have a place
in the listings inset. So, in order to avoid a data loss, tex2lyx
sticks everything into the caption. In this way, things may be
rearranged in the GUI, if necessary. There is no other way, apart
from a complete redesign of the listings inset, of course. However,
I think that this is an acceptable compromise.
2017-06-17 02:23:00 +02:00
Jean-Marc Lasgouttes
62b06c64ed Use the same code for editable and non-editable buttons
This removes the use of rectText in RenderButton. The fact that this
gave different spacing than buttonText was a problem.

Now buttonText requires to specify
* the offset, so that INSET_TO_TEXT_OFFSET is not used anymore in
  src/frontends/, which will be useful later.
* the background and frame color, in replacement for the hover state.

Remove the methods button() and buttonFrame() from GuiPainter.

Remove some unused header files.

Fixes bug #10704.
2017-06-15 15:40:30 +02:00
Juergen Spitzmueller
530fec453f Also catch "! Incomplete \\if" 2017-06-15 15:29:40 +02:00
Juergen Spitzmueller
39f23ac66b Catch "! Incomplete \\ifx" error
Fixes: #10666
2017-06-15 15:07:03 +02:00
Jean-Marc Lasgouttes
522516d99e Make fixIfBroken() more robust
Chop slice when its inset is not editable.

Fixes bug #10667.
2017-06-15 11:53:33 +02:00
Jean-Marc Lasgouttes
9c92494e1a Avoid memory reuse problems with inset-dissolve
If
 1. the inset is deleted before pasting its contents in the outer text, and
 2. the inset contents begins with an inset, and
 3. the clone of this inner inset is allocated at the memory location just
    made free,
then bad things can happen.

To avoid this, we delete the inset only after its contents has been pasted.

Fixes bug #10667.
2017-06-15 11:53:33 +02:00
Jean-Marc Lasgouttes
939962869b Give 4 edit markers to all Frac-like insets
Part of bug #10688.
2017-06-14 15:38:47 +02:00
Jean-Marc Lasgouttes
2e84b8030e When entering an inset by cursor, reset boundary
This happesn when cursor-left/right enters an inset.

Fixes bug #10630.
2017-06-14 15:08:27 +02:00
Jean-Marc Lasgouttes
cc7917c55c Add lower corners for BOX_MARKER too
Let's see whether this helps Guillaume.

Part of bug #8883.
2017-06-13 12:18:26 +02:00
Enrico Forestieri
c86f9d81e7 Avoid a crash if an external template is not installed 2017-06-12 21:24:52 +02:00
Jean-Marc Lasgouttes
5d7dae9e38 Set cursor properly after double/triple click in mathed
Without this setCurrentFont() is not correctly called on the
BufferView cursor and the cursor could appear in L-form.

Fixes bug #10686.
2017-06-12 18:02:39 +02:00
Enrico Forestieri
ae56167718 Use a combo box instead of a check box for selecting the listings package 2017-06-12 17:24:26 +02:00
Jean-Marc Lasgouttes
95c6781112 Improvements to inset edit markers
Draw also upper markers when editing macros in MACRO_EDIT_INLINE_BOX mode.

Use MARKER2 for inline editing of macros.
2017-06-12 17:09:58 +02:00
Jean-Marc Lasgouttes
f6b0ccf99c Use proper markers for display version of the math macro template.
This avoids ghost white corners when the macro does not have a display
version.

Part of bug #8883.
2017-06-12 15:15:55 +02:00
Jean-Marc Lasgouttes
71563835c7 Avoid rounding issue when painting selection
This is the same issue that was addressed in the all_sel case at
695b0cc3. The rounding issue only happens at specific zoom and
jusification values.

Fixes part of #8883.
2017-06-12 14:39:03 +02:00
Jean-Marc Lasgouttes
c9fefd5a2c Fix bad cursor positioning when entering an inset
The test added at 359aef92 was incorrect. Actually, Inset::editXY
returns the inset when it is edited and also when it is not, which
can be confusing. So if we are unlucky and the slices positions in the
text area and in the inner inset match, the code below triggers and
many bad things can happen.

Also improve the documentation of Inset::editXY and TextMetrics::editXY.

Fixes #10691.
2017-06-12 13:51:24 +02:00
Enrico Forestieri
887445537a Switch parameters validation even before applying the changes
In the document settings allow to immediately switch from one
package to the other for parameters validation without the need
of first applying the changes.
2017-06-12 11:54:59 +02:00
Guillaume MM
5fda4e85c7 Unhide buffers that are marked dirty as a result of external modifications
Several comments in the code point to the fact that hidden buffers are assumed
to be clean.

The other solution was to adapt the closing & saving code to take into account
hidden dirty buffers. Experience shows that it is more useful to unhide the
buffers at the moment of the external modification, in the context of a git
workflow where one has to reload the modified children buffers one-by-one.

Fixes crash at #10603
2017-06-11 19:51:17 +02:00
Guillaume MM
fd6189b7e3 Remove FileMonitorBlocker which does not work reliably on all platforms 2017-06-11 19:51:17 +02:00
Guillaume MM
b30161b591 If the external modification is a deletion, do not ask for reloading.
The behavour when hitting "reload" on a deleted file was also confusing.
2017-06-11 19:51:17 +02:00
Guillaume MM
2058faaa3b Prevent false positives in external modifications
When the Buffer is notified to be externally modified, check that the
file contents have changed using the checksum.

Document the shortcoming of FileMonitorBlocker.

Fixes #10642.
2017-06-11 19:51:17 +02:00
Guillaume MM
db58111360 Properly track the lifetime of signals2::slots (#8261)
Starting at 61b2bd5e, boost::bind was progressively replaced with
std::bind. They are not interchangeable though. boost::bind implements
the tracking of boost::signals{,2}::trackable objects. Now that
std::bind has completely replaced boost::bind, tracking never occurred.

This commit replaces boost::signals2::trackable with the new preferred
boost::signals2 methods: scoped_connections or slot::track_foreign. The
support::Trackable class introduced is less safe but easier for transitioning
old code.

Fixes the crash at #8261.
2017-06-11 19:51:17 +02:00
Enrico Forestieri
3f61375bc3 Adjust minted options
- Remove "chapter" and "section" as this are to be passed as class
  options and are otherwise not recognized.

- Let onoff=false for all TRUEFALSE parameters, otherwise only the
  form option=true is accepted and option=false does not validate,
  generating a lot of confusion.
2017-06-11 17:51:24 +02:00
Enrico Forestieri
55223bdcaa Add accelerator 2017-06-11 13:58:34 +02:00
Enrico Forestieri
405d71c172 Unify translations
This entry is shared by both listings and minted, so no need to use
different strings.
2017-06-11 12:34:17 +02:00
Guillaume MM
48a73a9e05 Make a string translatable 2017-06-11 06:01:04 +02:00
Guillaume MM
40cfede2bf Clearer message when about to discard an unsaved document entirely. 2017-06-11 06:01:04 +02:00
Enrico Forestieri
6f12fe596c Quote backspace in string 2017-06-10 23:12:49 +02:00
Enrico Forestieri
c5c480bb3c Was forgetting to add the caption to the list of listings 2017-06-10 21:00:43 +02:00
Enrico Forestieri
3dfa1cb417 Allow captions also on non-floating minted listings
Minted provides for captions only with floating listings. However,
listings always allows captions, and our machinery is geared accordingly.
So, instead of discriminating the floating and non-floating cases,
always allow for captions with minted, too. When minted does not provide
for a caption, we will provide one.
In the child document case the caption will always be before the listing,
while for the inset case the caption will be before the listing if it
is entered as the first line, after the listing otherwise.
2017-06-10 18:43:23 +02:00
Juergen Spitzmueller
f34f0c1db4 Oops: currentData() is Qt 5 only. 2017-06-10 18:17:43 +02:00
Juergen Spitzmueller
5685080356 Correct restoration of citation style selection between engine switches
We stored the combo position index, but this changes on engine switch.

This also fixes a crash due to out-of-bound index at engine switch.

Fixes: #10692
2017-06-10 14:29:07 +02:00
Enrico Forestieri
ca2d972a36 Amend fd075614
Actually, only when using minted it is not possible to insert a
caption in a non-floating listing.
2017-06-09 12:37:05 +02:00
Jean-Marc Lasgouttes
183c97d8a8 Give a 2 pixels space for markers around math objects
This is necessary when markers are nested. Ideally this should only be
done when there is risk of nesting.

Fixes (part of?) bug #10688.
2017-06-09 11:58:26 +02:00
Enrico Forestieri
8fa0e539e5 Extend minted support to listings as child documents
This was slipping through the cracks, apparently...
2017-06-08 19:35:48 +02:00
Jean-Marc Lasgouttes
cb5464ea2b Revert "Fix drawing of collpsable insets"
This was definitely not meant to be pushed, especially since I
reverted it recently. Sorry folks.

This reverts commit 6fc72a1a1f.
2017-06-08 16:47:26 +02:00
Jean-Marc Lasgouttes
a33b633111 Revert "Fix bad cursor positioning when entering an inset"
This is not ready yet.

This reverts commit 7ca7873112.
2017-06-08 16:46:49 +02:00
Jean-Marc Lasgouttes
1538a8352c Revert "Give a 2 pixels space for markers around math objects"
This is not ready yet.

This reverts commit 5a3962958f.
2017-06-08 16:46:19 +02:00
Jean-Marc Lasgouttes
29fbd062cc Properly use top/bottom edit marker for grid inset
This was an oversight when marker() was introduced.

Fixes part of #10688.
2017-06-08 16:03:14 +02:00
Jean-Marc Lasgouttes
5a3962958f Give a 2 pixels space for markers around math objects 2017-06-08 15:22:03 +02:00
Jean-Marc Lasgouttes
7ca7873112 Fix bad cursor positioning when entering an inset
The test added at 359aef92 was incorrect. Actually, Inset::editXY
returns the inset when it is edited and also when it is not, which
can be confusing. So if we are unlucky and the slices positions in the
text area and in the inner inset match, the code below triggers and
many bad things can happen.

editXY() should probably have a documented way to indicate whether the
cursor has entered the inset, although the test used right now is
probably OK. The inset value is useful mainly for context menus or
tasks that need to know which inset the (x, y) coordinates
point to.

Note finally that the documentation of TextMetrics::editXY is
incorrect concerning the return value. It will return a non-null value
if the cursor is on a not editable inset.

Fixes #10691.
2017-06-08 13:48:51 +02:00
Jean-Marc Lasgouttes
6fc72a1a1f 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-08 10:11:27 +02:00
Enrico Forestieri
3cc3ff39a0 Simplify preamble code when using listings
Following an idea from Guillame.
2017-06-08 04:25:53 +02:00
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