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 24c29908.
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.
When a buffer is in an embedded work area (adv. find&replace), it is
not found by BufferList:::exists(), and therefore the undo group
created in GuiApplication::dispatch and in the handling of
LFUN_COMMAND_SEQUENCE will not be closed.. Crashes can ensue, as
described in Ubuntu bug:
https://bugs.launchpad.net/bugs/1737429
The solution is to introduce BufferList::isInternal and act on it.
Fixes bug #10847.
- the column width must be as wide as the column header text
- also center the radiobuttons in the table
- also use alternating colors for the table rows
Instantiating a single QSettings and using it for each ui element
can significantly shorten the time required to save the various
states at exit. The speed up can be better appreciated on *nix,
where the settings are saved on disk, rather than on Windows where
they are held in memory (in the registry).
The current spelling is not strictly wrong, but flagged as unusual or
historical by some authorities. It is also found fault with many
spell checkers. Thus we decided to move to the more standard "-ible"
form once and for all.
See #10678 for discussion
This part covers the most tricky part: the internal naming.
Translations and layouts will follow.
This will all also all be backported to 2.3.x, for the sake of backwards
compatibility (cherry-picking).
* Describe the viewport/bb situation more accurate
* Use generic term "coordinates", since bb and viewport are flavor-specific
* Add some tooltips
* Increase the width of the options widget.
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.
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.
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.
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).
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)
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.
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.
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.
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.
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.
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.
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).
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.
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.