Commit Graph

8826 Commits

Author SHA1 Message Date
Richard Heck
470d83de1e Fix bug #10880. 2018-02-22 00:15:07 -05:00
Richard Heck
1c59eb9688 Fix bug #10866. 2018-02-22 00:12:24 -05:00
Alexander Dunlap
cca365f26c save session when we save a buffer
Implements enhancement #10712.
2018-02-21 11:53:19 +01:00
Juergen Spitzmueller
ab6bd5e319 Fix list of viewable formats in view/update menu.
Also fix list in (currently unused) Export toolbar button.

Fixes: #11044
2018-02-21 10:17:10 +01:00
Juergen Spitzmueller
578cf77f6f Localize items in view/update popup icons
Fixes: #11040
2018-02-20 16:42:01 +01:00
Jean-Marc Lasgouttes
5861df7172 Another go at fixing string metrics
This time, it is the problems with \int in esint and cmex that we are
trying to work around. This code is becoming too complicated to my
taste.
2018-02-17 16:57:35 +01:00
Juergen Spitzmueller
47e85b37eb Disable unsupported ref types in mathed.
Also repair prettyref in InsetMathRef.

Part of #9798
2018-02-14 17:18:24 +01:00
Richard Heck
5ee3396459 Fix crash when citeengine is unknown. 2018-02-12 16:27:14 -05:00
Juergen Spitzmueller
1437ae3f9c Disable BUFFER_EXPORT and BUFFER_EXPORT_AS while buffer is processed
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).
2018-02-11 09:50:38 +01:00
Juergen Spitzmueller
be4d49ebd1 amend 71fea63326 2018-02-10 19:02:35 +01:00
Juergen Spitzmueller
71fea63326 Disable CheckTeX while buffer is processed
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.
2018-02-10 18:18:43 +01:00
Juergen Spitzmueller
dadec50a18 Fix race condition in processFuncRequestQueue
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.
2018-02-10 15:35:12 +01:00
Pavel Sanda
b7caaf6196 Proper naming of LFUN_SET_GRAPHICS_GROUP. 2018-02-08 21:59:41 +01:00
Juergen Spitzmueller
2f6ada6644 Consider class-provided citation engines
Do not attempt to load, nor allow to set, a different engine in this
case.

Fixes: #11022
2018-02-08 13:25:19 +01:00
Juergen Spitzmueller
6236bcb653 Add missing connection.
This activates the OK/Apply when a biblatex style file is changed
manually
2018-02-06 12:45:22 +01:00
Juergen Spitzmueller
5ce36019e5 Enable CompressorProxy for all Workareas (incl. EmbeddedWorkarea)
This fixes the Advanced F&R.
2018-02-01 14:58:49 +01:00
Juergen Spitzmueller
e2160ec960 Use proper localization chain for Box special width/height
Fixes: #11000
2018-01-27 12:26:01 +01:00
Juergen Spitzmueller
6ed7bbbf7e Make another GUI string translatable
Part of #10999.
2018-01-27 11:20:11 +01:00
Juergen Spitzmueller
26755a015e Make GUI string translatable
Part of #10999
2018-01-27 10:57:33 +01:00
Jean-Marc Lasgouttes
e63b891de5 Better debug message 2018-01-24 14:05:57 +01:00
Pavel Sanda
46826155a8 * LFUN_BUFFER_RELOAD - allow dropping of the changes.
Useful in scripts.
2018-01-13 19:19:18 +01:00
Jean-Marc Lasgouttes
2ba00ecb7b Initialize properly class member
Spotted by coverity.
2018-01-12 16:54:32 +01:00
Juergen Spitzmueller
aab58fed6b Use qt4-compatible connect() syntax.
Signed-off-by: Juergen Spitzmueller <spitz@lyx.org>
2018-01-12 15:42:04 +01:00
Guillaume MM
43e4b80734 Install a new compressor
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>
2018-01-12 11:03:07 +01:00
Jean-Marc Lasgouttes
3aa10c8dba Fix compilation in monolithic mode 2018-01-06 20:46:06 +01:00
Jean-Marc Lasgouttes
af9f3fe8bd Remove unused variables 2018-01-06 15:48:36 +01:00
Juergen Spitzmueller
f965d23633 Disable useless environment-split function at the core. 2018-01-03 13:16:07 +01:00
Juergen Spitzmueller
7d2764fb9e Use the command-alternatives sequence as defined in menus.bind
Otherwise, the shortcut is not displayed in the menu.
2018-01-03 10:58:30 +01:00
Jean-Marc Lasgouttes
39a8000589 Do not use Application for a 'cancel export' boolean
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.
2018-01-02 16:01:07 +01:00
Juergen Spitzmueller
8f86feb260 Prepend "Insert " in the context menu for environment separators. 2018-01-01 13:40:49 +01:00
Juergen Spitzmueller
c8abe0cf7b Move environment-split from Edit to Insert, as requested. 2017-12-30 17:54:09 +01:00
Juergen Spitzmueller
612536305b Don't show append function where it does not make sense. 2017-12-30 17:04:10 +01:00
Juergen Spitzmueller
87a6c75d9d Introduce environment-split before
This one prepends the new environment rather than appending it.

Easy way to add a new beamer frame before the current one.
2017-12-28 14:17:40 +01:00
Juergen Spitzmueller
2907160fff Introduce environment-split previous
This one checks for an environment in the previous paragraph (outside
the nesting scope).
2017-12-28 12:28:01 +01:00
Juergen Spitzmueller
931f87f508 Introduce "inherit" encoding for latex_language
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
2017-12-24 17:10:42 +01:00
Richard Heck
76214e6012 LFUN and basic code to enable cancellation of background
processes.
2017-12-21 18:55:39 -05:00
Juergen Spitzmueller
74607702a5 Fix typo.
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.
2017-12-20 12:17:04 +01:00
Juergen Spitzmueller
25a17d72e1 Get rid of idiosyncratic accelerator syntax 2017-12-20 11:37:13 +01:00
Juergen Spitzmueller
1371dbb240 Amend d56a5447f3
LaTeX only breaks after dashes (even though unicode suggests optional
line breaks also before em dashes).
2017-12-17 09:19:26 +01:00
Juergen Spitzmueller
d56a5447f3 Consistent output of breakable/non-breakable dashes on all TeX engines.
Fixes: #10839
2017-12-16 16:12:26 +01:00
Richard Heck
4c093a50c2 Fix #10871 compiler warnings. 2017-12-16 09:58:52 -05:00
Richard Heck
e869ec4bc9 Fix #10869 compiler warnings. 2017-12-16 09:55:25 -05:00
Richard Heck
fb93733fee Fix #10867 compiler warnings. 2017-12-16 09:45:38 -05:00
Richard Heck
37f8efe9f7 Fix #10891 compiler warnings. 2017-12-16 00:55:45 -05:00
Richard Heck
05c876568a Fix #10887 compiler warnings. 2017-12-16 00:50:35 -05:00
Richard Heck
8a1377f6ff Fix #10884 compiler warnings. 2017-12-16 00:48:34 -05:00
Richard Heck
e0672b36f3 Fix #10874 compiler warnings. 2017-12-16 00:46:16 -05:00
Richard Heck
69d46542ed Fix #10872 compiler warnings. 2017-12-16 00:03:36 -05:00
Richard Heck
63d96191b1 Fix #10868 compiler warnings. 2017-12-15 23:59:19 -05:00
Jean-Marc Lasgouttes
2316435f2f 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 24c29908.
2017-12-15 17:30:20 +01:00
Jean-Marc Lasgouttes
cd9e42dc35 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.
2017-12-13 11:10:49 +01:00
Jean-Marc Lasgouttes
8b107f0490 Handle properly undo groups in embedded work areas
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.
2017-12-13 10:46:54 +01:00
Uwe Stöhr
4d0c1c030c GuiApplication.cpp: remove unused includes 2017-12-13 02:59:05 +01:00
Jean-Marc Lasgouttes
f3656600f9 Use UndoGroupHelper to track undo group lifetime 2017-11-29 14:55:56 +01:00
Richard Heck
5f9f3e49da Fix #10819: Set title for print nomencl dialog. 2017-11-26 22:00:14 -05:00
Kornel Benko
3b9705da19 Cmake build: Add option to use native file dialog also for linux 2017-11-26 18:50:53 +01:00
Juergen Spitzmueller
84f7dafe89 Disable non-functional table rotation for longtables
In the long run, proper longtable rotation via [pdf]lscape should
be implemented.

See #9194
2017-11-19 14:34:19 +01:00
Juergen Spitzmueller
dd45c67468 Whitespace 2017-11-10 14:57:19 +01:00
Uwe Stöhr
56670d7322 GuiDocument.cpp: change back alignment for column with package names
- as discussed in bug #10777 the first column should be left-aligned
2017-11-05 13:39:09 +01:00
Uwe Stöhr
a69f1a9e16 GuiDocument.cpp: fix bug 10777
- 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
2017-11-02 22:25:26 +01:00
Juergen Spitzmueller
b851a349b6 Enable OK/Apply buttons when resetting to class defaults. 2017-11-01 12:03:54 +01:00
Jean-Marc Lasgouttes
785c6d4e05 Fix comment 2017-10-25 12:16:16 +02:00
Enrico Forestieri
3b43fbfbb1 Speed up exit time
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).
2017-10-18 13:12:20 +02:00
Juergen Spitzmueller
c466baaa5b Collapsable -> Collapsible (part 2)
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).
2017-10-16 10:12:21 +02:00
Juergen Spitzmueller
c462fadff5 Some improvements to the graphics dialog
* 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.
2017-10-13 11:25:55 +02:00
Jean-Marc Lasgouttes
e7122d7926 Some improvements related to Debug::PAINTING
Avoid blinking the cursor when these debug messages are active.
This avoids a lot of debug information.
2017-10-11 17:39:02 +02:00
Richard Heck
af381a2fb2 Reset cursor before beginning reload sequence. 2017-10-08 23:06:32 -04:00
Jean-Marc Lasgouttes
add342d088 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.
2017-10-02 17:14:55 +02:00
Jean-Marc Lasgouttes
9df59aac63 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.
2017-09-27 18:08:20 +02:00
Juergen Spitzmueller
b498646b2e Fix some spelling errors reported by Sven
Fixes: #10678
2017-09-22 09:29:16 +02:00
Jean-Marc Lasgouttes
275d306c73 Do not presume what the defaults for a new QPainter are 2017-09-18 11:21:18 +02:00
Jean-Marc Lasgouttes
6532e5104d 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.
2017-09-18 10:58:07 +02:00
Jean-Marc Lasgouttes
a31d3dc67d 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).
2017-09-14 15:50:30 +02:00
Jean-Marc Lasgouttes
bef0a9137f Remove unused private field from Painter
Clang is good at seeing those, gcc is not.
2017-09-13 15:02:17 +02:00
Stephan Witt
1460e8fe6f #10662 use drawers for bibliography dialogs
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)
2017-09-12 11:14:16 +02:00
Juergen Spitzmueller
4ac94fecb6 GuiBibtex: Use appropriate title when using Biblatex 2017-09-10 10:59:05 +02:00
Juergen Spitzmueller
ed1b67b7ca Use default btprint value in the UI if none is given. 2017-09-10 10:53:35 +02:00
Juergen Spitzmueller
eff50597c0 Disallow newlines in biblatex options
Fixes: #10757
2017-09-10 10:06:47 +02:00
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
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
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
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
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
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
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
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
9a36ffd1e3 Sort external templates locale-aware
Fixes: #10738
2017-08-09 16:09:50 +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
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
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
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
Christian Ridderström
e30f3d76d2 Bulk cleanup/fix incorrect annotation at the end of namespaces.
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.
2017-07-23 13:11:54 +02:00
Juergen Spitzmueller
94d45d9c56 Some comments wrt log file encoding (#10728) 2017-07-23 12:06:58 +02:00
Christian Ridderström
5078448111 Fix minor whitespace error.
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.
2017-07-17 22:23:17 +02:00
Jean-Marc Lasgouttes
449b594a72 Fix unitialized member
Spotted by coverity.
2017-07-06 14:45:21 +02:00
Jean-Marc Lasgouttes
ab81c23656 Do not use toobar menu as fallback context menu
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.
2017-07-05 12:28:26 +02:00
Richard Heck
fd5a950d7f Fix whitespace in some more files. 2017-07-03 14:46:27 -04:00
Richard Heck
00e4902ea3 Fix trailing whitespace in txt files. 2017-07-03 13:53:41 -04:00
Richard Heck
75bfed5507 Fix trailing whitespace in cpp files. 2017-07-03 13:53:14 -04:00
Richard Heck
51aebc9327 Fix whitespace at EOL. 2017-07-03 13:46:30 -04:00
Bernhard M. Wiedemann
b8e3615492 sort svgz file list
(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.
2017-06-27 16:04:33 +02:00
Jean-Marc Lasgouttes
4efb129ccb Avoid crash when selecting long text
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.
2017-06-19 12:23:17 +02:00
Jean-Marc Lasgouttes
62b06c64ed Use the same code for editable and non-editable buttons
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.
2017-06-15 15:40:30 +02:00
Enrico Forestieri
c86f9d81e7 Avoid a crash if an external template is not installed 2017-06-12 21:24:52 +02:00
Enrico Forestieri
ae56167718 Use a combo box instead of a check box for selecting the listings package 2017-06-12 17:24:26 +02:00
Enrico Forestieri
887445537a Switch parameters validation even before applying the changes
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.
2017-06-12 11:54:59 +02:00
Guillaume MM
5fda4e85c7 Unhide buffers that are marked dirty as a result of external modifications
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
2017-06-11 19:51:17 +02:00
Guillaume MM
db58111360 Properly track the lifetime of signals2::slots (#8261)
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.
2017-06-11 19:51:17 +02:00
Enrico Forestieri
55223bdcaa Add accelerator 2017-06-11 13:58:34 +02:00
Guillaume MM
48a73a9e05 Make a string translatable 2017-06-11 06:01:04 +02:00
Guillaume MM
40cfede2bf Clearer message when about to discard an unsaved document entirely. 2017-06-11 06:01:04 +02:00
Juergen Spitzmueller
f34f0c1db4 Oops: currentData() is Qt 5 only. 2017-06-10 18:17:43 +02:00
Juergen Spitzmueller
5685080356 Correct restoration of citation style selection between engine switches
We stored the combo position index, but this changes on engine switch.

This also fixes a crash due to out-of-bound index at engine switch.

Fixes: #10692
2017-06-10 14:29:07 +02:00
Enrico Forestieri
8fa0e539e5 Extend minted support to listings as child documents
This was slipping through the cracks, apparently...
2017-06-08 19:35:48 +02:00
Enrico Forestieri
aae04d25b9 Fix a small glitch
When choosing a code language that has dialects in the languages
combo box, the dialects combo gets activated also when minted is
in use. However, minted does not support the concept of dialects
and the combo should not be enabled. This is harmless because the
dialects are simply ignored and the dialects status is restored
after apply, but it may fool the user in thinking that a dialect
can be actually selected. So, always disable it with minted.
2017-06-07 15:31:13 +02:00
Enrico Forestieri
8dab1cfe7e Fix bug #9101
Update the listings inset to optionally use the minted package
(instead of the listings one) for typesetting code listings.
Only one of the two packages can be used in a document, but it
is possible to switch packages without issues if the used options
are the same. If a switch is made and the options differ, one needs
to manually adjust them if they were entered in the advanced options
tab, or apply again the gui settings.
Note that minted requires the -shell-escape option for the latex
backend and the installation of additional software (python pygments).
2017-06-07 00:55:23 +02:00
Richard Heck
60bd141f1b Keep track of the last manually set state of the literal
checkbox in the citation dialog. Use that information to
set it appropriately for new citations.
2017-05-29 22:53:11 -04:00
Enrico Forestieri
922d1ddc8c Fix bug #10469 2017-05-17 22:31:27 +02:00
Guillaume MM
161f7b7f62 Improve wording (#10670) 2017-05-16 00:28:43 +02:00
Jean-Marc Lasgouttes
676ce147da Fix compilation failure 2017-05-15 10:29:09 +02:00
Jean-Marc Lasgouttes
5354c64b27 Cache QTextLayout objects with Qt/Mac
It seems that the internal Qt5 caching does not work well here,
especially in the case of Herbrew documents.
2017-05-15 10:14:42 +02:00
Guillaume MM
700225c26f Fix colours of buttons in notification frame 2017-05-15 02:28:48 +02:00
Uwe Stöhr
0dd3311dd4 rename buffer parameter math_number_before to math_numbering_side
this is a fileformat change

also try to fix an UI issue that JMarc gets
2017-05-13 20:39:45 +02:00
Jean-Marc Lasgouttes
d4685f2806 Never, never use a string for something that has 3 values
This commit replaces the string math_number_before by a proper math_number enum.

Note that the _before naming was misleading. It was chosen at a time
when we were not sure whether leqno was always left or could be right
in RtL documents.

Note that the token in LyX document is still \math_number_before and
this should be changed.

Fixup for 19cc4a1f.
2017-05-12 12:00:43 +02:00
Uwe Stöhr
19cc4a1fcb GuiDocument: support also the class option reqno
as discussed our support for the formula numbering side should be complete. There are document classes that uses left numbering as default and with the class option "reqno" this can be changed to right numbering. reqno requires the loading of amsamth.
2017-05-12 01:06:05 +02:00
Uwe Stöhr
f109206c05 GuiDocument: rename a function to follow the naming guideline 2017-05-09 21:02:03 +02:00
Uwe Stöhr
902b5f368b GuiDocument: fix bug #10653
- also rename a function because we have the same function name in BufferParams
2017-05-09 01:00:36 +02:00
Guillaume MM
1acb42911a Cosmetic 2017-05-07 14:18:17 +02:00
Daniel Ramöller
e2f864efe4 Lock toolbars (#10283)
- LFUNs to (un)lock toolbars positions (both individually and all at once)

- corresponding menu entry to "Lock Toolbars" menu.
2017-05-07 14:17:54 +02:00
Daniel Ramöller
4183a9f4dc Preferences shows current zoom instead of preference's default zoom (#10455)
- Adds a currentZoom variable which holds the current zoom level.

- The zoom stored in preferences is used as default zoom level (default binding:
  M+0).

- The currentZoom is saved and restored via QSettings.

- Adds LFUN buffer-zoom for (re)setting zoom.
2017-05-07 14:17:54 +02:00
Daniel Ramöller
9bf8ac4432 Color Preferences: Disable colors rather than hide them (#10483) 2017-05-07 14:17:54 +02:00
Guillaume MM
6b64d462ef Cosmetic 2017-05-07 00:07:24 +02:00
Tommaso Cucinotta
0fc8bd0c5f Revert "Create new graphics from within LyX choosing a sample file to copy from."
This reverts commit 7b6e26ad91.
2017-05-06 09:21:50 +02:00
Tommaso Cucinotta
7b6e26ad91 Create new graphics from within LyX choosing a sample file to copy from. 2017-05-06 00:26:00 +02:00
Uwe Stöhr
1b016f5f67 GuiDocument.cpp: correct a name
No math numbering placement option means default. The default could be already the left side for special document classes.
2017-05-02 23:09:36 +02:00
Uwe Stöhr
8f9a08a4cb TextLayoutUi.ui: remove trace of a moved feature
fixes bug #10647
2017-05-02 23:05:30 +02:00
Uwe Stöhr
0ff8ec57e2 GuiDocument.cpp: change naming of formula numbering option 2017-04-26 00:32:13 +02:00
Uwe Stöhr
da8b732443 Move mathindent from text layout to math settings as discussed 2017-04-25 03:01:39 +02:00
Uwe Stöhr
3f8c15a7c6 support for the document class option leqno
- fileformat change
2017-04-25 02:28:10 +02:00
Stephan Witt
a91402dc64 use examples folder setting from preferences 2017-04-21 11:27:11 +02:00
Uwe Stöhr
6cabf4948f GuiDocument: re-introduce allowMathIndent()
was accidentally reverted by [d86954eb/lyxgit]
2017-04-20 23:21:11 +02:00
Jean-Marc Lasgouttes
df6b2f4470 Rewrite mathindent without HSpace class
Use Length instead of HSpace for math_indentation and rename it to mathindent.
Get rid of the string version.

Rename (g|s)etMathIndentation() to (g|s)etMathIndent().

Remove the HSpace class altogether.

Some cleanups to parindent support to look like mathindent.
2017-04-19 17:55:56 +02:00
Jean-Marc Lasgouttes
d86954eb81 Revert "BufferParams: get rid of the HSpace class for mathindent as requested by JMarc"
This reverts commit d9a2a40268.

This is not the right way of getting rid of HSpace. We need a proper
Length, not a string.
2017-04-19 16:19:18 +02:00
Uwe Stöhr
17a53bbcf9 GuiDocument.cpp: add missing validation code 2017-04-17 20:58:09 +02:00
Uwe Stöhr
d9a2a40268 BufferParams: get rid of the HSpace class for mathindent as requested by JMarc 2017-04-17 20:32:31 +02:00
Jean-Marc Lasgouttes
fc4ca36403 Cleanup parindent support
Rename (g|s)etter to (get|set)ParIndent(), and rename member variables
accordingly.

Do not rely on HSpace anymore, since Length does have all we need.
2017-04-17 18:30:33 +02:00
Scott Kostyshak
742b39f49d Do not open or close branches after doc settings
When applying or saving Document Settings, LyX no longer opens or
closes branch insets. The intent of the previous code was to open
branch insets of a branch that is activated, and close branch insets
of a branch that is deactivated.

After some discussion [1], it was decided that the behavior intended
by the previous code was inconsistent with activating/deactivating a
branch in the context-menu of a branch inset, and the previous code
assumed a workflow of the user, rather than letting the user
separate opening/closing branch insets from activating/deactivating
them.

This commit modifies fd6cd728.

[1] https://www.mail-archive.com/search?l=mid&q=20161030220813.3zlp3zgqgomhx35y%40steph
2017-04-16 16:54:29 -04:00
Uwe Stöhr
58e6c6c876 InsetFloat: allow float placement for rotated floats
- fixes bug #10270
- fileformat change
- fixes also a bug that unwanted placement was output to LaTeX on certain cases
2017-04-15 06:57:52 +02:00
Juergen Spitzmueller
953876a46c Tiny clean up 2017-04-13 09:59:06 +02:00
Uwe Stöhr
fc1c5c6f28 BufferParams: rename formula_indent to math_indent etc. as requested
- also add flyx2lyx feature to import existing document class option as requested by JMarc
- also don't use a real default indentation length
2017-04-13 02:31:26 +02:00
Juergen Spitzmueller
06fb58a2da FontUi: Fix layout
The old layout resulted in a too wide dialog
(especially in some localizations)
2017-04-12 12:50:44 +02:00
Juergen Spitzmueller
cbde0e16e2 TextLayout.ui: small layout fixes. 2017-04-12 12:10:58 +02:00
Juergen Spitzmueller
9068d1902e No need to translate number 2017-04-12 11:57:43 +02:00
Uwe Stöhr
d2ac0d2cf4 TextLayoutUi.ui: correct a tooltip 2017-04-10 23:34:20 +02:00
Jean-Marc Lasgouttes
94114fd121 Better implementation for corssOutLines
When trying to do implement a LaTeX feature on screen, it is always
good to see how LaTeX does it, just in case it is easy to implement on
our side.

Then we have a correct output at all DPI sizes.
2017-04-10 10:27:08 +02:00
Uwe Stöhr
e5c313fc3b GuiDocument.cpp: commit missing part
This should have been committed with the previous commit but failed for an unknown reason.
2017-04-08 02:16:05 +02:00
Uwe Stöhr
c9dde702f0 MathsUi.ui. move formula indentation to text layout as requested by Jmarc 2017-04-08 02:12:35 +02:00
Uwe Stöhr
f37fa674f8 MathsUi.ui: next attempt to make it look correct also under Linux 2017-04-08 01:39:08 +02:00
Uwe Stöhr
74bcd5d26c MathsUi.ui: adjust dimensions as requested 2017-04-07 02:14:34 +02:00
Jean-Marc Lasgouttes
3bd49d1f75 Make it clear that current_view_ is available when needed
In particular the LATTEST in createView tells coverity that creating a
view sets it as current_view_.
2017-04-06 13:03:05 +02:00
Uwe Stöhr
2b0969c31c MathsUi.ui: adjust the size to fit better 2017-04-06 03:07:58 +02:00
Uwe Stöhr
808339790c support to indent formulas
- adds support for the general document class option fleqn
- adds support to specify the formula indentation
- fileformat change
2017-04-05 22:22:47 +02:00
Jean-Marc Lasgouttes
60810e0ae2 Use assertions to declare things we know for sure
Doing it that way makes coverity happy.
2017-04-05 11:53:17 +02:00
Jean-Marc Lasgouttes
abc0aaec12 Replace coverity annotation by an assertion
And reorganize the code a bit.
2017-04-05 11:29:51 +02:00
Uwe Stöhr
e575e7eebd Add support to cross out characters
- adds support for the command \xout of the LateX package ulem
- fileformat change
2017-04-05 00:01:19 +02:00
Tommaso Cucinotta
621ccc5e4e Restrict file cache expiry time to positive values. 2017-04-02 14:55:33 +02:00
Jean-Marc Lasgouttes
da590925cd Work around bug in QTextLine::xToCursor
With RtL text, the method can be non-monotonic wrt x value (which is a
Qt bug). To work around this, we check whether positions adjacent to
those returned by xToCursor look better. Depending on whether the new
x position is too small or too large, we look backward or forward for
a better solution.

The performance is probably not great, but this is only needed for
user interactions, so the performance penalty should not be a problem.

Fixes #10569.
2017-03-31 16:56:06 +02:00
Jean-Marc Lasgouttes
6b2444a7df Replace coverity annotation by assertions 2017-03-31 11:47:47 +02:00
Jean-Marc Lasgouttes
5890e9b831 When destructing a workarea, ignore buffer exceptions
Spotted by coverity, but probably harmless.
2017-03-31 11:17:00 +02:00
Kornel Benko
0d6c64a4eb Cmake build: Project names *should* be uniq 2017-03-30 14:01:56 +02:00
Jean-Marc Lasgouttes
4488c45d09 Make LFUN_REPEAT more robust by limiting to 10000 iterations 2017-03-28 11:30:18 +02:00
Jean-Marc Lasgouttes
5c03cb340c Use convert instead of a stream to read LFUN_REPEAT count
At least coverity should find it safer.
2017-03-28 11:04:39 +02:00
Jean-Marc Lasgouttes
522f3517e1 Handle properly exception that can be thrown by to_local8bit
Remove the use of this function in GuiAlert.

This was spotted by coverity
2017-03-27 16:13:26 +02:00
Enrico Forestieri
91ca310d1d Amend 16d5c49b
Remove redundant action when toggling the dashes check box.
2017-03-27 15:08:30 +02:00
Juergen Spitzmueller
f9b8cc9aa9 Translate file filters for external material 2017-03-26 18:10:30 +02:00
Juergen Spitzmueller
8f6491f073 GuiExternal: use proper model/view separation and sort the templates 2017-03-26 17:56:47 +02:00
Jean-Marc Lasgouttes
72af7f340c Pass big parameters by address
Spotted by coverity.
2017-03-24 15:11:21 +01:00
Enrico Forestieri
16d5c49b38 Further amendment to 72a488d7
Rephrase positively the check box for the output of en- and em-dashes
and disable it when using non-TeX fonts. The state of the check box
is remembered, so that toggling the non-TeX fonts check box does not
cause information loss.
2017-03-21 00:04:08 +01:00
Enrico Forestieri
72a488d7e6 Fix output of en- and em-dashes with TeX fonts
This commit fixes the regression introduced in 2.2 about the
output of en- and em-dashes. In 2.2 en- and em-dashes are output as
the \textendash and \textemdash macros when using TeX fonts, causing
changed output in old documents and also bugs (for example, #10490).

Now documents produced with older versions work again as intended,
while documents produced with 2.2 can be made to produce the exact
same output by simply checking "Don't use ligatures for en-and
em-dashes" in Document->Settings->Fonts.

When exporting documents using TeX fonts to earlier versions, in order
to avoid changed output, a zero-width space character is inserted after
each en/em-dash if dash ligatures are allowed. These characters are
removed when reloading  documents with 2.3, so that they don't accumulate.
2017-03-19 20:50:34 +01:00
Guillaume Munch
340d747fff Clean up
Only keep one dynamic-cast. This fixes coverity warnings.
2017-03-18 15:09:07 +01:00
Richard Heck
50060053e3 Move the global formats and system_formats variables into the
LyX singleton.

Mostly, this is very boring, but it might be good if someone would
check what I did about the dummy implementation in tex2lyx.
2017-03-13 23:40:29 -04:00
Guillaume Munch
22ce6636ef Clarify dialog 2017-03-11 00:50:57 +01:00
Guillaume Munch
0cb85e9206 Disable edition when external modifications are detected
Introduce a distinction between being read-only and having the read-only flag. A
buffer is read-only if either it has been externally modified or if it has the
read-only flag.
2017-03-11 00:50:57 +01:00
Guillaume Munch
b6b56d8518 Notification of external modification inspired by gedit 2017-03-11 00:50:57 +01:00
Guillaume Munch
299242bb16 New LFUN buffer-external-modification-clear 2017-03-11 00:50:57 +01:00
Guillaume Munch
1e57fd12b1 Display externally modified status 2017-03-11 00:50:57 +01:00
Guillaume Munch
cf3c035266 Implement real-time detection of external modifications 2017-03-11 00:50:57 +01:00
Guillaume Munch
3dec5826da buffer-export default 2017-03-11 00:50:57 +01:00
Jean-Marc Lasgouttes
0f220503ff Small cleanup to LayoutBox and CategorizedCombo
Coverity does not find it obvious that p is never negative. Normally
it is the case (because the items have been filtered), but it is
better to play safe.
2017-03-10 15:57:31 +01:00