Commit Graph

38312 Commits

Author SHA1 Message Date
Jean-Marc Lasgouttes
2e67181036 Improve documentation of inset-(begin|end)(|-select)
Make it clear that it can go at the beginning/end of the document.

(cherry picked from commit f4693ef8ab)
2018-02-23 10:22:33 +01:00
Richard Heck
797babd462 Fix bug #10817.
Respect 'literal' setting when calculating longest bibitem.

(cherry picked from commit 224e56c935)
2018-02-22 15:44:29 -05:00
Richard Heck
04e8526460 Respect "literal" setting when entering citation via LyX server.
This requires moving the bool that tracks this somewhere that it
is visible from BufferView. It seemed to make sense to put it as
a static member of InsetCitation.

(cherry picked from commit f8e8877f83)
2018-02-22 15:33:01 -05:00
Juergen Spitzmueller
721cc085a2 Implement IsTocCaption for normal layouts.
But use default "true" to maintain current behavior if not explicitly
stated otherwise.

Fixes: #11045
(cherry picked from commit 8a703573ea)
2018-02-22 19:12:30 +01:00
Jean-Marc Lasgouttes
31c7ce19fb Add Alex Dunlap to our contributors
(cherry picked from commit 4447fb349c)
(cherry picked from commit 6d582e5e50)
2018-02-21 12:10:03 +01:00
Alexander Dunlap
257f978d62 save session when we save a buffer
Implements enhancement #10712.

(cherry picked from commit cca365f26c)
2018-02-21 11:56:37 +01:00
Jean-Marc Lasgouttes
a2e1021aba Use parMetrics to access the par_metrics_ map
In cursorY, it is dangerous to access par_petrics_[0], since one does
not know whether metrics have been computed for this paragraph (which
may be off-screen).

It is safer to use parMetrics(0), that will compute the paragraph
metrics as needed.

Fixes bug #8120.

(cherry picked from commit a25b48f86c)
2018-02-20 15:02:35 +01:00
Pavel Sanda
2136af92b5 * layouttranslations reviewed by Inaki 2018-02-17 19:07:02 +01:00
Pavel Sanda
f135013b30 * eu.po - update from Inaki. 2018-02-17 19:01:53 +01:00
Juergen Spitzmueller
e1f7cc964b update status 2018-02-16 18:19:05 +01:00
Juergen Spitzmueller
a26173f171 Revove unused variable 2018-02-16 17:47:14 +01:00
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