Commit Graph

263 Commits

Author SHA1 Message Date
Stephan Witt
bbc2270972 #12523 check for existence of usable Python interpreter
- present appropriate alert message in case of missing Python
- add the option to quit LyX immediately
- recheck for Python interpreter on reconfigure if it was missing
2023-01-06 00:32:09 +01:00
Jean-Marc Lasgouttes
9ff27f8ce0 Produce an error on bad debug level values
Add new funciton Debug::badValue, that returns the first bad value in a debug
setting string.

Use it to parse the -dbg comand line option and to control the
execution of the debug-level-set lfun.

Use range-based loops in a few places.
2021-03-26 17:55:54 +01:00
Pavel Sanda
a222a2eab6 Hint message when .lyx dir can not be created.
Useful for scripts running without standard homedir environments,
cf https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=816173
2020-12-08 09:53:38 +01:00
Yuriy Skalko
43b16548b4 Cleanup headers 2020-11-25 02:43:16 +02:00
Yuriy Skalko
196d9caeb0 Clean includes using the output of iwyu tool 2020-10-20 11:38:55 +03:00
Yuriy Skalko
fbefdb10a5 Move Cursor.h from Clipboard.h 2020-10-16 08:02:51 +03:00
Yuriy Skalko
efc0877f8f Add override specifiers to improve code maintainability 2020-10-03 12:43:48 +02:00
Richard Kimberly Heck
3aae85edf1 Fix some warnings 2020-04-18 14:52:08 -04:00
Kornel Benko
4b052dec77 Amend ef42541d26: Missed to commit these 2020-04-13 13:39:33 +02:00
Stephan Witt
0f1f00db27 Code cleanup: avoid repeating temp_dir method calls while local variable has a result already. 2020-02-17 13:25:35 +01:00
Juergen Spitzmueller
d3ec77c633 Reorganize templates and example folders
Re-structure and rename files in a transparent way. Most template/example
names now correspond to the (verbose GUI) name of their layouts.

Note that this, most prominently, also changes [LANG/]splash.lyx to
something less insiderish, namely "Welcome.lyx".
2019-03-19 07:13:18 +01:00
Jean-Marc Lasgouttes
32f37250d5 Catch exception in replaceEnvironmentPath
This exception in the regex constructor is only theoretical (our regex
are hardcoded), but this is creating coverity noise.

Additionally, revert the following commits that are not needed anymore:
6b6fa94c: Catch exceptions to please coverity
c2ed75fd: Fixup 6b6fa94c: coverity says there are more possible exceptions.

This commit is better viewed with 'git show -b'.
2018-06-04 11:39:41 +02:00
Richard Kimberly Heck
efc9720b0d Revert "Remove test for files when using batch mode."
We are not really ready for this case.

This reverts commit e143f0b9e9.
2018-05-30 23:13:07 -04:00
Richard Kimberly Heck
e143f0b9e9 Remove test for files when using batch mode.
As Kornel pointed out, it's possible to give a command sequence, or
multiple "-x" arguments, and carry out an operation without actually
giving LyX a filename argument. This will lead to cases like:
    lyx -batch -x buffer-export
which don't do anything, but it's not catastrophic.
2018-05-29 15:48:56 -04:00
Jean-Marc Lasgouttes
c2ed75fd37 Fixup 6b6fa94c: coverity says there are more possible exceptions.
The bulk of the changes is indentation.
2018-01-29 15:06:32 +01:00
Jean-Marc Lasgouttes
6b6fa94c91 Catch exceptions to please coverity
Actually, the possible exception path is from replaceEnvironmentPath.
It would be better if coverity was able to asses that our hardcoded
regexp:s are correct.
2018-01-29 13:50:09 +01: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
Jean-Marc Lasgouttes
0d565f7b35 When cleaning up before quitting, take care of exceptions
We do not want the cleanup work to be interrupted by a buffer exception.

Spotted by coverity. See bug #9979 for discussion.
2017-07-11 15:30:32 +02:00
Richard Heck
75bfed5507 Fix trailing whitespace in cpp files. 2017-07-03 13:53:14 -04:00
Scott Kostyshak
638020ab10 Revert "Change default working directory from ~/ to ".""
Setting the default working directory to '.' is an invasive change
on Mac and Windows, where the current working directory of LyX when
LyX is started from the GUI is not a reasonable choice for the
default directory in e.g. the "save as" file dialog or the "open"
dialog. A similar situation could happen on Linux distributions (I'm
not aware of any, e.g., POSIX standard that defines that the working
directory of a binary started from GUI should be the home
directory). Thus, it is not clear this default is good on any
platform.

If the user wishes to have the behavior of '.', the description in
the "paths" preferences pane provides the information for making the
change.

For more information, see the discussion at:

  https://www.mail-archive.com/search?l=mid&q=635298DE-5028-4BB1-8D8F-A634BA68C420%40gmx.net

This reverts commit 892593fbdc.
2017-05-09 07:50:45 -04:00
Jean-Marc Lasgouttes
b925728591 Avoid using theServer() for no reason
All it brings us is threatening to throw an exception to scare coverity off.
2017-04-07 11:04:57 +02:00
Juergen Spitzmueller
52019917f4 Split external_templates to individual *.xtemplate files
This makes it easier to add new templates or change existing ones
in the user directory.

Fixes: #3983

The CMake changes should be double-checked.
2017-03-26 15:32:01 +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
Guillaume Munch
3dec5826da buffer-export default 2017-03-11 00:50:57 +01:00
Scott Kostyshak
37290fdb61 Describe the use of '*' in -e/-E CL options
The use of '*' in buffer-export was implemented at 494ce664.
2017-03-08 00:36:28 -05:00
Enrico Forestieri
5665209caa Ensure that QT_VERSION is defined
Otherwise checks such as "#if QT_VERSION >= 0x050600" will fail silently.
2017-02-07 11:16:05 +01:00
Enrico Forestieri
ebd96fadd5 Ignore QT_SCALE_FACTOR for Qt < 5.6
This environment variable was introduced in Qt 5.6.0
2017-01-25 20:00:54 +01:00
Enrico Forestieri
9e6cf6e05a Allow to properly scale the GUI with Qt5
Starting with Qt 5.6, setting the environment variable QT_SCALE_FACTOR
makes everything accordingly bigger. So, if QT_SCALE_FACTOR=1.2, all
text and GUI elements are rendered 20% bigger. However, if an application
does not account for this, everything will also look "blocky".
With this commit, all text and images will be scaled remaining sharp.
This works whether a HiDpi screen is used or not, but is mostly useful
with a HiDpi screen, as all GUI elements are more spaced apart and one
can use the mouse for selecting things without requiring a high precision.
2017-01-22 01:06:00 +01:00
Juergen Spitzmueller
74f774d6cf Merge branch 'master' into biblatex2 2017-01-11 10:45:48 +01:00
Juergen Spitzmueller
96ffb70cd5 Command line option to ignore error msgs
Needed by the test framework
2017-01-11 09:21:13 +01:00
Juergen Spitzmueller
97aea7e5b1 Disentangle CiteEngines and Modules
These two are different beasts and thus should be handled differently.
2017-01-01 07:56:24 +01:00
Guillaume Munch
9a9288d67d Fix memory leak with WordLists
https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg198230.html
2016-12-31 15:29:43 +01:00
Scott Kostyshak
892593fbdc Change default working directory from ~/ to "."
Note that the lyxrc.document_path variable corresponds to what we
call the "Working directory" in the GUI preferences dialog.

Setting document_path to "." makes it so when LyX is started from a
directory, that directory is the default path for many of LyX's
operations, such as the following:

- new file, new from template
- adding a custom BibTeX file
- GUI compare dialog
- local layout button in document settings
- external material file browser
- graphics browser, include browser

The best guess for where the user wants to save or find files is the
directory the user started LyX from. Before, the default was always
the home directory. If desired, the old behavior can be restored by
changing the default path in Preferences > "Working directory".

This commit takes advantage of 9b64d7bd, which allows the use of a
relative path for path preferences.
2016-10-11 22:25:42 -04:00
Enrico Forestieri
2a371bb4b3 Add verbose option
Using the option -v (--verbose) all spawned commands are print
on the terminal. Note that this was done by default on previous
versions.
2016-08-17 22:32:14 +02:00
Guillaume Munch
489dca71cd Simplifications, mainly removal of boost::function and useless std::bind 2016-07-03 01:39:32 +02:00
Richard Heck
a48adfa6d6 Fix coverity issue #127197.
We may fail to get a buffer when we request one.
2016-06-12 00:26:38 -04:00
Guillaume Munch
ca8709aaf5 Replace boost::scoped_ptr with unique_ptr 2016-06-09 15:21:39 +01:00
Richard Heck
a8f57334e2 Fix bug #9096: Load all the files specified on the command line, and then dispatch whatever commands we are given to those Buffers.
Original patch due to Benjamin Piwowarski. Updated for 2.2 by Richard Heck.
2015-11-29 11:25:21 -05:00
Guillaume Munch
a8c1161d7b Move tmpdir error message to stderr
http://thread.gmane.org/gmane.editors.lyx.general/85638/focus=157802
2015-11-10 08:04:19 +00:00
Stephan Witt
bdc9977264 Improved symlink creation for Mac OS for first LyX start 2015-07-22 06:27:21 +02:00
Jean-Marc Lasgouttes
7ac700920f Auto feature for minibuffer toolbar
Now the minibuffer toolbar is "auto" by default. It is opened by
command-execute (M-x) and closed when the command is executed without error.

* make lyx::dispatch return a DispatchResult struct

* there is a new MINIBUFFER type of toolbar, that can be used for this use.

* remove special handling of M-x in minnibuffer; Escape can be used instead. Fix focus in this case.

* when minibuffer toolbar is "auto", make the toolbar close itself after
  - a command has been executed without error
  - an empty command has been executed
  - the Escape key has been used

[this is actually commit fdcff02a, which was later reverted at dd61d8cf]
2015-07-15 17:41:09 +02:00
Jean-Marc Lasgouttes
dd61d8cf3f Revert "Auto feature for minibuffer toolbar"
This reverts commit fdcff02a31.

This was pushed too early, we are not ready yet.
2015-06-30 11:09:48 +02:00
Jean-Marc Lasgouttes
fdcff02a31 Auto feature for minibuffer toolbar
Now the minibuffer toolbar is "auto" by default. It is opened by
command-execute (M-x) and closed when the command is executed without error.

* make lyx::dispatch return a DispatchResult struct

* there is a new MINIBUFFER type of toolbar, that can be used for this use.

* remove special handling of M-x in minnibuffer; Escape can be used instead. Fix focus in this case.

* when minibuffer toolbar is "auto", make the toolbar close itself after
  - a command has been executed without error
  - an empty command has been executed
  - the Escape key has been used
2015-06-29 09:21:15 +02:00
Stephan Witt
e4fada8c57 #7896: LyX templates folder is empty - create a symlink to system templates in user template directory at run time 2015-06-23 08:41:43 +02:00
Jessica Hamilton
dcfb918f15 Add packaging support for Haiku
See bug #7568 for details.
2015-06-08 17:18:14 +02:00
Georg Baum
84cca2dd94 Fix indentation 2015-05-17 17:27:27 +02:00
Jean-Marc Lasgouttes
e4fe294bdc Make builds reproducible
We do not really need to use __TIME__ and __DATE__, which prevent from making LyX builds reproducible.

Fixes bug #9415.
2015-03-26 18:14:45 +01:00
Jean-Marc Lasgouttes
a0fd54b2e7 Remove variable properly now
This is a follow-up to db1979f398.
2015-03-05 12:48:01 +01:00
Jean-Marc Lasgouttes
db1979f398 Remove unused member.
Fixes coverity issue 23413.
2015-03-05 12:30:12 +01:00
Richard Heck
fc9e6326b9 Micro-optimization. 2015-02-24 13:43:33 -05:00