Completion uses a complicated async scheme based on timers to update
itself. This is probably not necessary anymore and is fragile to
event order changes.
This is what happens with the new painting scheme. Therefore the
asyncHideXXX() methods have to be made more robust and detect whether
completion state has changed by the time they are triggered.
This is detected when an undo group is open and contains at east one
element. This means indeed that changes are in progress. Note that the
group is in general opened in GuiApplication::dispatch. The code there
is changed to ensure that the group is closed before updating the
screen.
This patch is experimental. It is expected to be replaced in master by
a more complete solution. It could in the meantime be backported to 2.3.x.
Fixes bug #11159.
As opposed to modules (from which the framework was initially borrowed),
we only allow one cite engine per document. Thus, we don't need to fiddle
with lists.
It is now possible in the float settings (doc dialog) to specify a global
(inner) alignment for floats, and in the float settings, this can be
overridden (just as with float placement)
Fixes: #8665
File format change.
This revives a ten year old idea (and patch) by Dov.
You can now mark in the character dialog text and exclude it from spell
checking.
Fixes: #1042
File format change
Remaining issue: The instant spell checking marks are not immediately
removed, but only after some editing.
This is a proposal, but I think you should try it out in order to comment
What this does, is:
1. Remove the toggle madness. This is really not something anyone
understands without knowing the code, and its very unusual UI
(fixes#4836)
2. Separate and group things that were put all into the "Misc" trashcan
combo
3. Let the dialog reflect the font settings at cursor (selection)
Now the dialog looks more like character dialogs from other applications,
and I think it is more in line with what users expect.
Comments very welcome (and of course I will revert if you want to have
the old idiosyncratic thing back).
I'm open to putting this elsewhere on the toolbar, or even on a
different toolbar. Also, we need decent icons. These ones are not
intended seriously but were just borrowed for testing purposes.
Anyone have good ideas about icons?
This commit fixes an issue where the menu option "Insert Separated
Frame Below" would show up twice, with one instance disabled. This
occurred when there was a "Standard" environment nested in a
"Frame". With this commit, the duplicate instance is removed.
Instead of "Save" (permanently) and "Apply" (temporarily), OK and Apply
now always save permanently, unless the new checkbox "Apply to current
session only" is checked.
Addresses: #10016
The problem is that popping dialogs during reload can cause paint
events for which we are not ready. If this does not work, then we
can introduce a new flag, besides 'busy', for that case. But busy
does not seem to be used very widely, so hopefully this works.
Following a request by Günter, we consider the document fonts (only rm
for now) when selecting an appropriate font encoding.
See #9741
The new default font encoding setting "auto" does
* consider the font encoding needed by the language(s), which can now
have fallback alternatives
* Consider which font encoding is provided by the document font
Thus, cm now will result in OT1 fontenc, if the language can deal with
that.
The font_enc pref is ditched: it is no longer needed.
The automatism is still very basic and is subject to extension.
File format and prefs format change.
Before, the command
buffer-forall buffer-export
only exported one buffer for me. With async disabled, the command
works as documented and successfully exports all buffers.
Also before, I received an assertion from
buffer-forall buffer-close
which caused a SIGSEGV at #9422. Now, the action works as expected.
It surprises me a bit that the code is different in this case
from the case when EXPORT_in_THREAD is not set. I should check
to see if there's a problem in the other case, too.
The idea here is to force commands to be run syncrhonously when
they are launched via "command-sequence" or "repeat". We do this
by using a new flag in FuncRequest.
The problem was that, if we killed export when some graphic was
being converted, or some external template was being handled, it
would only cancel that process, and then it would just continue.
To deal with that, we need to do a few things:
1. Modify the return values for some of the Converters routines,
and similarly the routines for external templates, so we can
tell when something has been canceled.
2. Throw an exception from InsetGraphics or InsetExternal when this
has happened during export, but ONLY when the Buffer is a clone.
We shouldn't be able to 'cancel' export when we're, say, generating
code for the preview pane, but this keeps us on the safe side..
The exception then has to be caught, obviously, back in the export
routines in Buffer.
Probably Coverity will be unhappy about something here, but I'll
deal with that problem as it arises.
This commit follows 8d2b121e and is not expected to change
functionality (e.g., I confirmed that the cases of #7330 and #11106
are still fixed). The advantages of this refactoring are the
following:
- Remove some preprocessor directives:
processingThreadFinished() is only called in the case that
EXPORT_in_THREAD is 1, so by moving some code up in the call list,
the directives are not needed.
- If errors() is called when there is no error, there will not be unexpected
behavior (e.g., as was the case before 8d2b121e).
Note that errors() is still only called by the code touched by this commit
if there is an error, but that is for efficiency and readability.
- The "from_master" argument now has a constant meaning. Before, it
could be the case that "from_master" was set to false but that the
master's error dialog was shown.
If a master document is compiled and has errors, and then a child is
compiled without error, the errors from the master compilation were
shown.
The setup of the relevant code is the following:
processingThreadFinished() calls errors(). errors() makes the
assumption that if it is called, there must have been an error
somewhere.
The logic of the setup is the following:
processingThreadFinished() knows whether there was an error on
the most recent preview/export, although it doesn't know whether
the error is from master or child (i.e. does not know whether the
user was compiling the child, or whether master-buffer-view was
called). Inside error(), if there is no error in the child, it is
assumed the error is from master.
For the above logic to work, errors() should only be called if there
was an error.
This commit fixes#11106 and preserves the fix to #7330.
There are more independent crashes occuring in this scenario and this
fix targets only one of them, in particular the one in which different
window's outliner sends outliner command to a wrong window. The fix
itself gives an option for lfun to know which window it belongs to.
https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg203619.html
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.
I am rather irritated we didn't do this already, since synchronous runs
with BUFFER_VIEW or BUFFER_UPDATE leads to all sorts of problems,
including crashes.
Fixes the crash in #8338 (but not the bug itself).
Since CheckTeX itself processes the tex file, a synchronous run with
a TeX process can lead to all sorts of conflicts, including crashes.
Fixes: #7434.
The issue here was that the element was only removed from the queue
after the func request was processed, but within that process, other
function could access the queue, so the queue could even be empty
when this function finally wanted to remove the item.
Fixes: #10406.
A brand new event compressor based on Kuba Ober's cleverly simple
solution: <https://stackoverflow.com/a/21006207>.
Fix#9362, #9461, #9933: Lyx suddenly gets keyboard keys wrong, and
deadlocks
Fix#9790: LyX should perform key event compression (for improving the
remote X connections one would also need to implement
Qt::WA_KeyCompression)
Fix#10516: slowness on repeated arrow keys with IBus and Qt5
Patch pulled from
https://github.com/gadmm/lyx-unstable/commit/bf5a1efb0db5bfc2b
Signed-off-by: Juergen Spitzmueller <spitz@lyx.org>
It is not good for a support function to depend of anything outside of
it, especially Application.
Here the boolean that indicates that export should be canceled is put
in Systemcall. This allows to remove all the dummy theApp() function
that have been added here and there for linking needs.
This gets rid of the hardcoded latin1 encoding for verbatim. Instead,
verbatim now inherits the encoding from the context, which is what is
actually wanted here.
Fixes: #9012, #9258
This had the effect that for file dialogs supposed to use two buttons,
only the second one was displayed, while file dialogs supposed to use
one button did not have a button at all.
Candidate for 2.3.x and 2.2.x.
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.
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.
- 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.
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.
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
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.
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.
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.
(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.
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.
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.
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.
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
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.