Commit Graph

24461 Commits

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