Commit Graph

38301 Commits

Author SHA1 Message Date
Juergen Spitzmueller
d20de88953 Open intitle command explicitly also for passthru.
(cherry picked from commit 87960e3dd8)
2018-02-16 17:25:32 +01:00
Juergen Spitzmueller
da3dc1b61f Use TeXOnePar for the inpreamble layouts
This considers paragraph language and spacing (and simplifies the code)

(cherry picked from commit a2f886d526)
2018-02-16 17:25:06 +01:00
Juergen Spitzmueller
961b79975c Fix inpreamble styles.
(cherry picked from commit e55e9c842f)
2018-02-16 17:24:41 +01:00
Juergen Spitzmueller
bd879efaa8 Fix switch of language and line spacing in InTitle commands.
Fixes: #9332, #10849
(cherry picked from commit 49e3f8e830)
2018-02-16 17:24:00 +01:00
Juergen Spitzmueller
c0ef31d9b9 Recreate citation label after paste
Fixes: #10829
(cherry picked from commit 7e34e65943)
2018-02-16 17:14:28 +01:00
Pavel Sanda
a4a50ac358 * UserGuide - add sentence about graphic groups unification. 2018-02-15 22:41:43 +01:00
Pavel Sanda
c17f706a1c * status file 2018-02-15 21:48:47 +01:00
Pavel Sanda
25741ca5bd Oops, asInsetGrpahics is new to master. 2018-02-15 21:48:23 +01:00
Pavel Sanda
1713b53516 Cosmetics per JMarc's suggestions. 2018-02-15 20:42:54 +01:00
Pavel Sanda
e836cc0aac Unify graphics-groups inside marked block functionality.
Fixes #11026.

https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg203683.html
2018-02-15 20:42:36 +01:00
Jean-Marc Lasgouttes
c8230ab0d0 Merge remote-tracking branch 'features/properpaint' into 2.3.2-staging
This makes sure that painting actually happens at paint events, making
display more fluid.
2018-02-15 14:57:53 +01:00
Jean-Marc Lasgouttes
61c5769e39 Fix ghost caret
This fixes a regression in e64ea357, where a test has been (badly)
tightened to avoid that two consecutive rows may be redrawn to get rid
of caret ghosts. The test prohibited empty rows from being redrawn.

Moreover, improve the test of cursor boundary to avoid the case where
cursor position is already 0.

Fixes bug #10952.

(cherry picked from commit 66c677b946)
2018-02-15 12:29:25 +01:00
Jean-Marc Lasgouttes
be35ba31bf Fix compilation in monolithic mode
(cherry picked from commit 3aa10c8dba)
2018-02-15 12:29:25 +01:00
Jean-Marc Lasgouttes
c677156938 Use a backing store on macOS
Qt on macOS does not respect the Qt::WA_OpaquePaintEvent attribute and
clears the widget backing store at each update. Therefore, we use our
own backing store in this case.

This restores a simplified version of the code that was removed at 06253dfe.

(cherry picked from commit 2316435f2f)
2018-02-15 12:29:25 +01:00
Jean-Marc Lasgouttes
8af3077753 Make sure that rows are repainted when they get (un)selected
The bug is the following: when selecting several paragraphs quickly
enough, some rows do not get selected.This is a consequence of the
removal of row crc, which lead to not taking into account the
selection status of the row in the decision to repaint.

The solution chosen here is to add a Row::change() helper function to
modify row members. This will set the Row changed status whenever the
value of the member changes.

(cherry picked from commit ae60749f89)
2018-02-15 12:29:25 +01:00
Jean-Marc Lasgouttes
9c8e3df86b Fixup ac4bcb12
Cursor at end of paragraph should be treated as if boundary was on.

(cherry picked from commit d01dd54bf1)
2018-02-15 12:29:25 +01:00
Jean-Marc Lasgouttes
fa4fc6fc4d Avoid some caret ghosts
When the caret is at end of row, if may happen that it is drawn after
the end of the row. In this case caret blinking will not work
properly. This patch extends the row background on the left and right
by Inset::TEXT_TO_INSET_OFFSET. This is only a hack that will not work
if the caret has a ridiculous width like 6.

Additionally, introduce some (disabled) debug code that numbers the
rows on screen by painting order.

Finally, make the code that detects whether the caret was in a given
row more precise (take boundary into account).

Fixes (mostly, see above) bug #10797.

(cherry picked from commit e64ea3576c)
2018-02-15 12:29:25 +01:00
Jean-Marc Lasgouttes
a71610b9d7 Remove row crc computation
This computation did not make sense anymore since we began to put the
contents in the Row object. The fact that it worked was a coincidence.

Instead, we set rows as changed() on creation and reset that once they
have been drawn. This will allow in the future for a finer definition
of what to redraw or not.

Also update the PAINTING_ANALYSIS document

(cherry picked from commit 9e2da4a3ea)
2018-02-15 12:29:25 +01:00
Jean-Marc Lasgouttes
d2e15bd189 Store change bar information in row element
It is wrong to compute this at paint time. In general, painting a row
should not require any access to a paragraph object, but we are far
from there now.

(cherry picked from commit 4858bb3bb6)
2018-02-15 12:29:25 +01:00
Jean-Marc Lasgouttes
4ecbff0019 Allow multiple calls to processUpdateFlags before redraw
The goal of this commit is to ensure that a processUpdateFlags call
that requires no redraw will not override a previous one that did
require a redraw.

To this end, the semantics of the flag argument is now different: its
value is now OR'ed with a private update_flags_ variable. This
variable is only reset after the buffer view has actually been
redrawn.

A new Update::ForceRedraw flag has been added. It requires a full
redraw but no metrics computation. It is not used in the main code
(yet), but avoids to compute metrics repeatedly in consecutive
processUpdateFlags calls.

The process is now as follows:
- if flags is just None, return immediately, there is nothing to do.
- the Force flag is honored (full metrics computation) and replaced
  with ForceDraw.
- the FitCursor flag is honored and removed from the flags.
- the SinglePar update is added if ForceDraw is not in flags and only
  the current par has been modified.

The remaining flags are only then added to the BufferView update
flags, and the update strategy is computed for the next paint event.

Finally the dubious call to updateMacros in updateMetrics has been
removed for performance reasons.

(cherry picked from commit 8d8988de47)
2018-02-15 12:29:25 +01:00
Jean-Marc Lasgouttes
2b1b33189d Create new method GuiWorkArea::Private:::updateCaretGeometry
This replaces a showCaret/hideCaret pair and avoids an update.

Also remove an update() call in resizeBufferView: is is not necessary
since we are already in a pintEvent handler.

(cherry picked from commit add342d088)
2018-02-15 12:29:25 +01:00
Jean-Marc Lasgouttes
6bd158dcba Improve the logic of caret repainting
For some reason the existing code only considered the bottom row that
contained the cursor. There is no need for that, and actually it
caused painting problems in nested insets.

Tweak the logic of repaint_caret_row_ a bit: there is no need for
repainting when there is currently no caret on screen.

(cherry picked from commit 764a153c69)
2018-02-15 12:29:25 +01:00
Jean-Marc Lasgouttes
f6cbc08a7d Fix bad refresh when changing zoom level
Replace the tricky code in LFUN_SCREEN_FONT_UPDATE and replace it with
proper use of DispatchResult flags.

LFUN_BUFFER_ZOOM* does not need to call LFUN_SCREEN_FONT_UPDATE, since
it already does everything that is required.

(cherry picked from commit 9df59aac63)
2018-02-15 12:29:25 +01:00
Jean-Marc Lasgouttes
7b99bf6a37 Do not presume what the defaults for a new QPainter are
(cherry picked from commit 275d306c73)
2018-02-15 12:29:25 +01:00
Jean-Marc Lasgouttes
c43b6a9ecf 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.

(cherry picked from commit 6532e5104d)
2018-02-15 12:29:25 +01:00
Jean-Marc Lasgouttes
a1579c583a 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).

(cherry picked from commit a31d3dc67d)
2018-02-15 12:29:25 +01:00
Jean-Marc Lasgouttes
9bb41f0943 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).
2018-02-15 12:29:25 +01:00
Jean-Marc Lasgouttes
94b1d04f2c Rename more instances of "cursor" to "caret"
Thanks to Pavel for the hint.
2018-02-15 12:29:25 +01:00
Jean-Marc Lasgouttes
410605385f 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.
2018-02-15 12:29:25 +01:00
Jean-Marc Lasgouttes
8bb7ce4e4a Update the painting process documentation 2018-02-15 12:29:25 +01:00
Jean-Marc Lasgouttes
9ef52806f8 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.
2018-02-15 12:29:25 +01:00
Jean-Marc Lasgouttes
418bf09879 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.
2018-02-15 12:29:25 +01:00
Jean-Marc Lasgouttes
ef1d502070 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.
2018-02-15 12:29:25 +01:00
Jean-Marc Lasgouttes
7b8b3e38a1 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.
2018-02-15 12:29:25 +01:00
Jean-Marc Lasgouttes
d222e0f48e 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.
2018-02-15 12:29:25 +01:00
Jean-Marc Lasgouttes
9a1728c70a Implement buffer-anonymize more efficiently
The work is done now in Paragraph::anonymize().

Move the handling of the lfun to Buffer class.

Document the new feature in release notes.

(cherry picked from commit 1dba36c7ce)
2018-02-15 12:07:33 +01:00
Pavel Sanda
abdadcceb9 * status.23x 2018-02-15 11:56:49 +01:00
Pavel Sanda
9966f098ea forgotten glitch 2018-02-15 11:55:51 +01:00
Pavel Sanda
624a6ed91d LFUN_DOC_ANONYMIZE -> LFUN_BUFFER_ANONYMIZE per JMarc's suggestion. 2018-02-15 11:49:21 +01:00
Pavel Sanda
08f6354bc9 Add LFUN_DOC_ANONYMIZE, quick fix for #7259.
Backport from master.
2018-02-15 11:47:10 +01:00
Jean-Marc Lasgouttes
2e1863b704 Implement display of roots more faithfully
This is a follow-up to 758de957.

- unify the metrics and drawing of \sqrt and \root using helper
  functions mathed_root_metrics and mathed_draw_root.

- compute the vertical spacing above the nucleus of the root following
  rule 11 of the TeXbook. In particular, it is different in inline and
  display style.

- draw the root glyph without hard-coded pixel values. Make the line
  width depend on the zoom.

more work is needed to implement properly rule 11:

- Ideally, we should use sqrt glyphs from the math fonts. Note that
  then we would get rule thickness from there.

- The positioning of the root MathData is arbitrary. It should
  follow the definition of \root...\of... in The Texbook in
  Apprendix B page 360.

Fixes bug #10814.

(cherry picked from commit 16af6e7c50)
(cherry picked from commit 6cb6f78ae9)
2018-02-15 11:34:00 +01:00
Jean-Marc Lasgouttes
1dc134fb60 Improve UndoGroupHelper and use it more
Now the helper class contains logic that checks whether buffer are
known before closing them. This avoids potential crashes.

Use it in different places to siplify code. It is not clear at this
point whether it should be used everywhere.

Followup to bug #10847.

(cherry picked from commit cd9e42dc35)
2018-02-15 10:36:17 +01:00
Jean-Marc Lasgouttes
51e80361b2 Better handling of multiple buffers in UndoGroupHelper
It may happen that the buffers are visited in order buffer1,
buffer2, buffer1. In this case, we want to have only one undo group
in buffer1. The solution is to replace buffer_ with a set<Buffer*>.

A use case among others is InsetLabel::updateReferences.

(cherry picked from commit cc7364dfc5)
2018-02-15 10:33:17 +01:00
Jean-Marc Lasgouttes
5f6c681b76 Handle properly top/bottom of inset with mac-like cursor movement
The correct behavior is to go to position 0 going up from first row,
and to end of row when going down on last row.

The targetx value of the cursor is not updated, which makes cursor
movement more natural.

Fixes bug #10701.

(cherry picked from commit 34285cc683)
2018-02-14 17:06:03 +01:00
Uwe Stöhr
8be744b827 RELEASE-NOTES: correct sorting 2018-02-14 14:51:57 +01:00
Uwe Stöhr
14e80adffc UserGuide.lyx: document the removal of the pixmap cache for all languages 2018-02-14 14:50:08 +01:00
Uwe Stöhr
181b24e7dc RELEASE-NOTES: Greek is not dropped 2018-02-14 14:48:22 +01:00
Pavel Sanda
a6fc4a02ff * RELEASE-NOTES 2018-02-14 11:11:28 +01:00
Jean-Marc Lasgouttes
e11c8ba81b Disable and hide the pixmap cache feature 2018-02-14 10:12:11 +01:00
Juergen Spitzmueller
370ad4d704 Updated Basque localization by Iñaki Larrañaga Murgoitio 2018-02-13 18:34:41 +01:00