Commit Graph

221 Commits

Author SHA1 Message Date
Scott Kostyshak
79507c98af Fix a comparison of arrays to compare *contents*
The previous code was mistakenly comparing addresses of the arrays.
This issue was caught by a warning when compiling with Clang in
C++20 mode, since comparing array addresses in this way is
deprecated.

This commit should prevent some unnecessary dispatches of
LFUN_SCREEN_FONT_UPDATE.

(cherry picked from commit eaebe404ae)
2023-08-17 07:25:51 -04:00
Jean-Marc Lasgouttes
1def11d296 Add lyxrc option to force the use of backing store
LyX relies on a a backing store to draw when running under macOS or
Wayland, because Qt arbitrarily overwrites parts of the workarea
before we paint (and we paint only the parts that need to be painted).
However it seems that this is also necessary on X11 when the WM theme
is translucid. Since there is no way that I know of to detect this
situation, this patch adds a LyXRC setting to manually select this
drawing strategy.

Note that using a backing store is not always a good solution, since
this disables subpixel aliasing.

At this point there is no UI for the variable.

Fixes bug #12119

(cherry picked from commit c213eb7f75)
(cherry picked from commit 1ed9257c6d)
2022-01-13 17:24:28 +01:00
Jean-Marc Lasgouttes
8e50b9569a Fix warning 2019-09-13 09:52:33 +02:00
Juergen Spitzmueller
f838b16a9b Allow to hide formats from menus
Fixes: #11657
(cherry picked from commit d76cef70a0)
2019-09-11 10:46:07 +02:00
Jean-Marc Lasgouttes
ee8a336cbc Update screen as needed when preferences are changed
This commit removes the adhoc code in GuiPrefs and moves it to LyXRC,
so that it triggers in every preference change.

The code has also been updated to trigger on more variables, e.g.
font_*_foundry.

Note that the actual function that are called have not been changed
(addPreviews and LFUN_SCREEN_FONT_UPDATE), although there are doubts
that they behave as needed (see FIXMEs).

Fixes bug #11498.

(cherry picked from commit 954531f247)
2019-02-27 12:04:09 +01:00
Enrico Forestieri
3131873a6d Replace environment variables in PATH prefix
The PATH prefix modified through the GUI was set without
replacing embedded environment variables. This might have
caused problems on Windows with external python installations.

(cherry picked from commit 472bdf5910)
2019-01-11 23:01:18 +01:00
Richard Kimberly Heck
4f0504d778 Add slightly improved error message. 2018-04-23 20:36:28 -04:00
Richard Heck
bcb002039b Merge branch '2.3.2-staging' into 2.3.x 2018-04-14 23:52:31 -04:00
Jean-Marc Lasgouttes
977a0c4037 Make it possible to select (not)native file dialogs at run time
Add a new LyXRC variable use_native_filedialog (true by default) that
allows to select the kind of FileDialog we want at runtime.

(cherry picked from commit af795b80d8)
2018-03-21 10:56:57 +01:00
Jean-Marc Lasgouttes
0ddb1435c9 Fix default spellchecker when only Enchant is available
This has been annoying me for ages.

(cherry picked from commit ae473b012a)
2018-03-19 16:51:45 +01:00
Juergen Spitzmueller
fadb93ae68 Collapsable -> Collapsible (part 5)
Preferences update and prefs2prefs routine.

This was forgotten in the process.
2017-11-02 16:51:23 +01:00
Juergen Spitzmueller
242f543e01 Add default output format for pLaTeX
Fixes: #10747
2017-09-09 08:53:08 +02:00
Juergen Spitzmueller
e96c5c8f96 Make the session zoom relative to the default zoom
Also rename lyxrc.zoom to lyxrc.defaultZoom

Fixes: #10455
2017-09-06 18:11:31 +02: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
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
Kornel Benko
b7082f2d29 Correctly interpret return value of LyXRC::read(FileName const & filename, bool check_format) 2017-08-01 13:08:07 +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
Richard Heck
75bfed5507 Fix trailing whitespace in cpp files. 2017-07-03 13:53:14 -04: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
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
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
Juergen Spitzmueller
34943a4e5f Make Japanese Biblatex-aware
Biblatex can be used with Japanese, but then, biber (not pbibtex) should
be used as processor.

I this context, bring the jbibtex UI in line with bibtex, allowing for
a selection of alternatives.
2017-01-14 12:13:33 +01:00
Juergen Spitzmueller
1eb43536da Add an "Automatic" bibliography processor pref option
This is now set as default. It selects biber for Biblatex (with
fall-back to first bibtex8, then bibtex, if the former is not
installed), and bibtex for BibTeX-based engines.

With this, users do not normally need to care for the processor when
they switch cite engines.
2017-01-13 19:18:35 +01:00
Tommaso Cucinotta
cc653feb60 Bump up RC fileformat after [244de5d2/lyxgit] for the new 'needauth' options.
Addressing #10481.
2016-11-25 23:33:08 +01:00
Tommaso Cucinotta
244de5d2c1 Add 'needauth' option to converters that need explicit user authorization.
Addressing #10481.

This patch adds the new 'needauth' option for converters launching
external programs that are capable of running arbitrary code on behalf
of the user. These converters won't be run unless the user gives explicit
authorization, which is asked on-demand when the converter is about to
be run (question is not asked if the file is cached and calling the
converter is not needed).

The user prompt has a 3rd button so that he/she's not prompted again
for (any converter over) the same document (identified through
buffer->absFileName()).

Two preference options are added:

lyxrc.use_converter_needauth_forbidden disables any converter with
the 'needauth' option, which is meant to force user to an explicit
action via the preferences pane, before being able to use advanced
converters that can potentially bring security threats;

lyxrc.use_converter_needauth enables prompting the user for 'needauth'
converters, or bypasses the check if not enabled, falling back to the
previous behavior.

So, the first option is for maximum security, the second is for
maximum usability.
2016-11-22 23:54:58 +01:00
Richard Heck
0b67e103e9 Simple cache for information on exportable formats, since we seem
to access this information a lot.
2016-10-20 23:07:13 -04:00
Guillaume Munch
cb0a4c6639 Fix Unicode use in Format's prettyname
The field prettyname can accept Unicode and therefore must be parsed into a
docstring.

Little simplification of the code on the way.

* For other fields, either a validator should be set to prevent non-ascii input
  in the preferences, or they should be transformed into docstring too.
2016-08-28 01:30:53 +01:00
Scott Kostyshak
9b64d7bd24 Rel. path in paths prefs preserved as rel. paths
Before this commit, in the paths preferences tab if you put a
relative path, LyX would convert it behind the scenes to an absolute
path by evaluating the relative path with respect to the working
directory of the LyX instance where the preference change is taking
place. This seems confusing because (1) it is done behind the scenes
(after the preferences dialog is closed) and (2) if the user chooses
to enter a relative path, the safest thing to do is to preserve it
as a relative path, instead of making the assumption that the user
intended for it to be expanded to an absolute path.

An explanation of how relative paths are handled is given at the
bottom of the paths tab. Note that the height/width of the
preferences window is not changed as a result of adding this
explanatory comment because the height of the preferences dialog is
already stretched by other tabs.

This commit improves consistency in the sense that the behavior of
LyX is now the same when a relative path is specified in the
preferences dialog as when it is manually specified in the
preferences file. Before, if the preferences file were manually
edited and a relative path were inserted, the next time the user
made a change to preferences with the GUI (even if the preference
change was a different preference, e.g. instant preview), the
relative path would be silently converted to an absolute path,
evaluated with respect to the working directory of that instance.

Beyond improving clarity and consistency (IMO), this commit allows
for a new feature to be implemented of using relative paths in the
paths preferences. For example, the user may now enter '.' as the
"Working directory" path and now whenever they start LyX from a
directory and create a new file, the default location of the file
will be the directory from which they started LyX, instead of the
user's home directory which is LyX's default and is less intuitive.

No prefs2prefs work is needed because if a relative path were
entered in the preferences dialog before this commit, it was
converted to an absolute path before being stored in preferences. If
a relative path were specified by manually editing the preferences
file, then (unless the path were already automatically converted to
an absolute path by a GUI preferences change, as described above)
the behavior will be the same (the path will be treated as a
relative path).

For related discussion, see the lyx-devel thread here:
https://www.mail-archive.com/search?l=mid&q=20160616003010.bnymtcouar7g55ti%40cotopaxi

This commit removes the last use of lyx::support::expandPath() in
LyX's sources.
2016-07-29 13:13:55 -04:00
Jean-Marc Lasgouttes
8884c4044d Add feedback in status bar when zooming
Moreover enforce better the lower limit of 10 and avoid overflow due
to unsigned int.

Fixes bug #10212.
2016-07-18 17:03:54 +02:00
Guillaume Munch
77714e6db7 Raise the maxlastfiles cap
This only changes the maximum value that the user can choose in the UI, not the
default value.
2016-05-28 17:42:31 -04:00
Enrico Forestieri
f8bfc8405e Fix bug #7657: Detect inkscape from the configure script
On Windows, if inkscape is not found in the PATH, search for it
in the registry and store its full path in lyxrc.defaults.
2015-11-02 23:46:14 +01:00
Georg Baum
699a6db9fa Add some missing member variable initializations
These were all found by cppcheck. Even in constructors that are there "only
because of std containers" the class should be initialized correctly. You can
never know whether such an object does not get used, and then a nice crash
caused by dereferencing a NULL-pointer is better than undefined behaviour.
2015-09-13 19:47:21 +02:00
Jean-Marc Lasgouttes
aac019ad29 Annotate missing breaks in switch for coverity
Coverity issues 23341, 23359, 32064 and 102056
2015-09-12 22:14:04 +02:00
Jean-Marc
c671740d83 Remove unreachable code
Fixes coverity issue 23295.
2015-09-12 18:22:31 +02:00
Richard Heck
3c2b3e6907 Remove printing support from LyX.
This was bug #6747.
2015-05-27 18:13:08 -04:00
Enrico Forestieri
c2a18fc142 Bump RC format for commit 260a98d2 2015-05-23 18:24:26 +02:00
Enrico Forestieri
260a98d295 Save the document directory path only if explicitly allowed.
A new preference is introduced for allowing the record of the document
directory path in the saved file. Without explicit consent, it is not saved.
If the origin tag contains an invalid/wrong path or garbage, LyX behaves
exactly as before, i.e., included files are simply not found.
2015-05-23 17:49:33 +02:00
Georg Baum
84cca2dd94 Fix indentation 2015-05-17 17:27:27 +02:00
Juergen Spitzmueller
066d6a9cfb Grr... 2015-03-16 14:30:02 +01:00
Juergen Spitzmueller
bc85f0fdf7 Properly escape backslash in string 2015-03-16 14:28:16 +01:00
Jean-Marc Lasgouttes
24737eeceb Reset stream properties after changing them
Fixes coverity issue 23468.
2015-03-05 12:46:40 +01:00
Juergen Spitzmueller
d48e5330be Add pref option to disable middle-mouse-button paste
Fixes: #9399
2015-02-08 17:41:28 +01:00
Georg Baum
c86f299a50 Encapsulate Converter class
Now members are not directly accessible anymore.
2014-12-07 18:35:28 +01:00
Jean-Marc Lasgouttes
45eb314a86 Get rid of rtl_support preference
This variable was introduced to guard against any bad consequence of the then-new right-to-left
languages support. Let's be bold and get rid of it altogether!

Now right to left support is always enabled.
2014-07-09 21:11:08 +02:00
Jean-Marc Lasgouttes
9d5c947110 Remove LyXRC option force_paint_single_char
It was not honored anymore.
2014-07-08 23:12:09 +02:00
Jean-Marc Lasgouttes
01c9bcb432 Get rid of ugly font metrics workarounds.
Now we have proper ligatures and kerning on screen...
2014-06-25 17:55:16 +02:00
Georg Baum
f09a9fe2e6 Remove unsafe method FileName::tempName()
FileName::tempName() created a new temp file name by using qt to create a
temporary file with a unique name, and then deleting that file and returning
the name. This was unsafe, since other processes or even other threads of the
running LyX could create files with the same name between deletion and then
using the temp name.
This is fixed by using the TempFile class instead. As a side effect, a few
cases where the temp files were not deleted after usage were fixed as well.
The only place that is still unsafe is createTmpDir().
2014-06-09 13:05:50 +02:00
Juergen Spitzmueller
79a59fce1d Do not write an empty default_otf_view_format.
Fixes: #9100.
2014-04-28 14:59:03 +02:00
Benjamin Piwowarski
ac8b77fc03 Fix problem with python and change of PATH
- waits that lyxrc has been read before finding python
- when the PATH changes, resets the value
2014-03-29 22:19:03 +01:00