Commit Graph

2188 Commits

Author SHA1 Message Date
Jean-Marc Lasgouttes
61d68d05bd Add proper extension as needed in Save as and Export
Introduce the new FileName method ensureExtension, which does the following:
* if the extension is already correct (in a case-insensitive way), do nothing.
* if it is not correct, add the extension to the file name.

This is different from changeExtension that will fail in a case where
the file contains dots, but not a real extension, like newfile2.1.

Use this new method in renameBuffer() and exportBufferAs().

Fixes bug #11008.
2022-07-25 22:52:07 +02:00
Kornel Benko
5f5a43eb9e Guard 'isNumberChar()' from char outside ucs4-range 2022-05-29 14:08:36 +02:00
Kornel Benko
82af8778f1 Introduce isNumberChar(char_type) function
In FindAdv we use Qt to interpret regular expressions.
Regex uses for instance '\w', '\d' etc.
'\d' finds not just '0-9' but also e.g. '߂' (Nko Digit Two: U+07c2)
'\w' includes also such numbers.

ATM, only FindAdv uses this function.
2022-05-29 12:16:53 +02:00
Jean-Marc Lasgouttes
6dd5656a2c pmprof: fix missing output in the 100% miss case
Also update to the latest version of pmprof.
2022-05-19 11:37:51 +02:00
Juergen Spitzmueller
e6a7137a53 Mark aliases in the description 2022-04-24 16:51:42 +02:00
Juergen Spitzmueller
64ec812da5 Amend d8f540f51
Properly handle aliases
2022-04-24 16:51:16 +02:00
Kornel Benko
3b7a79f137 FindAdv: Amend d09f5ce1: Added new debug level :findverbose
Fix the GUI handling for the new value using now 'unsigned long long' instead of 'int'
2022-04-24 13:27:36 +02:00
Juergen Spitzmueller
9318f1b338 Improve string 2022-04-19 15:12:56 +02:00
Kornel Benko
d09f5ce1d0 FindAdv, Debug: Added new debug level :findverbose
With the debug-level 'find' there are now less output.
The original output can be received now with debig-level 'findverbose'

Also constructions like
 LYXERR(Debug::FIND|Debug::FINDVERBOSE, "...");
are now possible.
2022-04-19 13:41:38 +02:00
Jean-Marc Lasgouttes
7cb700bf67 Fix crash with countExpanders in Qt6
It is not a good idea to contruct a QChar from a char_type that is
really 32bits.

Use lyx::isSpace, which already catters for this case.

Since this code does not depend on qt anymore, move it to
support::countExpanders.

Get rid of Row::countSeparators, which is not used anymore.

Fixes bug #12519.
2022-04-08 12:14:41 +02:00
Enrico Forestieri
8496b7dc9a Compile fix 2022-03-05 02:19:38 +01:00
Thibaut Cuvelier
997f0621c5 Rename LATEX debug level to OUTFILE and use it for DocBook, HTML, and XML messages. 2022-03-01 16:05:42 +01:00
Thibaut Cuvelier
75be9b1200 Slightly simplify code by using for range. 2022-02-27 20:37:51 +01:00
Stephan Witt
6b0cd451fb #9287 query Standard User Defaults on mac and adjust cursor flash time accordingly 2022-02-20 13:06:54 +01:00
Enrico Forestieri
777ccce561 Fix bug #12466
Amend 109ea2be by reintroducing the command prefix that was
inadvertently removed. The prefix sets the proper environment
for latex.
2022-02-13 04:57:27 +01:00
Thibaut Cuvelier
1eb19cb8e3 Amend 109ea2be4a
The Windows code wasn't adapted when a variable was renamed (unlike the Linux one).
2022-02-06 05:35:07 +01:00
José Matos
109ea2be4a Add new placeholder $${python} to configure
This ensures that we use a consistent Python interpreter in LyX.

$${python} is replaced by the Python version found.

Users can apply this in preferences and use the same version defined by
LyX.
2022-01-04 00:21:34 +00:00
Stephan Witt
df990b1027 Guard new code for builds with OS X 10.11 SDK and lesser (part 2). 2022-01-01 18:47:57 +01:00
Stephan Witt
718b735dfe Guard new code for builds with OS X 10.11 SDK and lesser. 2022-01-01 18:46:32 +01:00
Scott Kostyshak
4bdb1ca4c2 Add comment regarding fsanitize + Clang issue
We could not figure out the root issue, or at least not to the point
where we felt changing this code considering we could not trigger
any bug from a user perspective.

For now, we just add a comment in the code.

For more information, see our ML discussion here:

  https://www.mail-archive.com/search?l=mid&q=20211227113249.53bf5a63%40admin1-desktop
2021-12-30 11:39:04 -05:00
Thibaut Cuvelier
0b5e940723 Refactor file-name sanitisation.
For now, this is only used in FileName, because it does not change the semantics of DocFileName::mangledFileName.
2021-10-19 09:15:44 +02:00
Thibaut Cuvelier
789a537182 Refactor computing hashes.
For now, this is only used in FileName, because it does not change the semantics of DocFileName::mangledFileName.
2021-10-19 09:15:44 +02:00
Yuriy Skalko
a9119c3fa8 Remove redundant declarations reported by GCC with -Wredundant-decls option 2021-09-28 20:59:21 +03:00
Yuriy Skalko
325c405541 Remove redundant semicolons reported by GCC with -Wextra-semi option 2021-09-28 11:28:43 +03:00
Jean-Marc Lasgouttes
6bbd88accf Improve (modestly) the performance of font metrics caches
This fixes two performance issues and improves the performance of
TextMetrics::redoParagraph by 15% in a workload that uses the cache a
lot. The difference will be much less when the cache is not used much.

1/ repetion of the hash code computation

The code
  if (cache.contains(key))
  	result = cache[key]:
is not efficient, since qHash(key) has to be computed twice.
To fix this a new Cache::object_str() method is added, which allows
  if (auto * obj = cache.object(key))
  	result = *obj;

2/ code of has code computation

Instead of using a verbose string that is complicated to build as
key, new key structs BreakAtKey and TextLayoutKey are introduced,
along with the relevant qHash() implementation.
2021-09-24 17:12:15 +02:00
Pavel Sanda
5dd96345ab Reformat mangled filenames for (xhtml) export to have them sorted. 2021-07-09 14:35:01 +02:00
Eugene Chornyi
e9d5fc0190 prevent Qt6 from defining UNICODE (Qt6.1.1 and upwards) 2021-06-19 10:48:49 +02:00
Jean-Marc Lasgouttes
67c85f54c4 Fixup 9f92fc92: improve FIXME in SystemcallPrivate::startProcess
I wanted to remove the test  Qt >= 5.15, but now I see that it is
not possible because of QProcess::splitCommand.

Neverthless, the best would be to change parsecmd.
2021-05-20 13:20:20 +02:00
Juergen Spitzmueller
511ba894ff Fix toqstr(chart_type) with Qt6 (#12252) 2021-04-17 15:10:26 +02: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
Kornel Benko
a9b0f5faae Cmake build with qt6 on MAC
Patch from P. De Visschere
Citing:
I also must exclude the QMacPasteboardMimeGraphics class in
GuiApplication.cpp since QMacPasteboard is not available anymore with qt6.

and add an #include <QStandardPaths> in support/Package.cpp (I suppose
this will pose no problem for qt5 but have not checked it, it's only
needed with USE_MACOSX_PACKAGING)
2021-03-26 13:11:44 +01:00
Kornel Benko
92a50fa273 Cmake build Qt6: Remove some redundant statements. 2021-03-24 11:42:39 +01:00
Kornel Benko
02a3705496 Amend 635a7d77: Allow compiling with Qt6 with cmake
Thanks Scott for checking.
TODO: Check compilation on Windows and Mac.
2021-03-22 16:19:10 +01:00
Enrico Forestieri
6fa973b377 Fix Qt6 deprecation warning about QString::fromUcs4 2021-03-21 17:15:08 +01:00
Juergen Spitzmueller
4a5ae39e8b Revert "Fix Qt6 deprecation warning (QString::fromUcs4(uint))"
This reverts commit 52dff70641.
2021-03-21 16:59:25 +01:00
Juergen Spitzmueller
52dff70641 Fix Qt6 deprecation warning (QString::fromUcs4(uint)) 2021-03-21 12:38:47 +01:00
Eugene Chornyi
4421b721e4 Make all a synonym of any in cmd debug mode 2021-03-21 09:59:23 +01:00
Enrico Forestieri
635a7d77dd Allow compiling with Qt6
This commit allows compiling LyX with Qt6 when using autotools.
For a successful compilation the following 2 conditions must be met.

1) The Qt6 qmake has to come first in PATH, so that the command
   "qmake -v | grep -o 'Qt version .'" returns "Qt version 6".
2) The --enable-qt6 switch has to be passed to the configure command.

If --enable-qt6 is used but Qt6 is not found, Qt5 is tried as a fallback.
If also Qt5 is not found, configuring for Qt4 is attempted.
If --enable-qt6 is not used, then things go as usual. This means that Qt5
is tried first and then Qt4, unless --disable-qt5 is used, in which case
Qt4 is directly attempted. This means that existing scripts should
continue working unmodified.

LyX should compile with Qt6 on windows and linux, and possibly also on
mac, but I could not test that. However, it is not guaranteed that it
works as it should. In particular I am not sure that I got right the
conversion from QRegExp to QRegularExpression. For sure, the syntax
highlighting seems to not work right. Someone in the know should take
a look at that. I am able to load documents and compile them but some
thourough testing is needed. However, when compiling for Qt5 or Qt4,
I tried to make sure that the functionality is preserved.
2021-03-15 17:09:09 +01:00
Juergen Spitzmueller
9f92fc92bd Yet another deprecation fix (this is the last one I am aware of) 2021-03-12 12:14:42 +01:00
Juergen Spitzmueller
10f4f2113a Fix deprecation warning (from|toTime_t) 2021-03-12 10:32:03 +01:00
Juergen Spitzmueller
26459a2cf5 Address another deprecation warning.
One left to go.
2021-03-12 10:10:33 +01:00
Thibaut Cuvelier
d8c6bc7c1f Stop using a GCC extension for an unprintable character in regex. 2021-02-13 18:23:20 +01:00
Enrico Forestieri
04c0cce43e Fix make check
We have to explicitly link zlib after [197ea636/lyxgit].
2021-01-31 15:21:23 +01:00
Juergen Spitzmueller
76eae4572e Introduce InputGlobal (#12087)
This is a variant of Input for layout files that only searches build
and system directories and thus allows "InputGlobal name.inc" in a user
file name.inc that attempts to modify its global counterpart.
2021-01-26 08:42:39 +01:00
Kornel Benko
ea5e16d075 Replace calls from make_unique to lyx::make_unique
After advice from Yuriy Skalko to satisfy compilation with clang8
2021-01-15 11:36:14 +01:00
Richard Kimberly Heck
fcea6c471c Revert "Add move constructor and move assignment operator for FileName class"
For now, since it's causing problems on OSX particularly.

This reverts commit 854c9de8fa.
2021-01-14 03:08:12 -05:00
Richard Kimberly Heck
3f3d769107 Count words in hyperlink 2021-01-10 01:54:40 -05:00
Yuriy Skalko
854c9de8fa Add move constructor and move assignment operator for FileName class 2021-01-09 11:23:33 +02:00
Richard Kimberly Heck
cf07d4825f Fix bug #11104. Activate refstyle support for InsetMathRef.
At the moment, there is no support for plurals and capitalization.
A long comment explains why. Support could be added for that without
a format change.
2021-01-05 18:17:53 -05:00
Enrico Forestieri
2099dca5d3 Do not replace nonexistent environment variables
References to environment variables embedded in a filename are expanded
and replaced by their value. However, if a variable does not exist, its
reference is simply erased from the filename, causing havoc (see #7801).

This has been like that since ever and cannot be changed, both for
backward compatibility and because this feature is currently used in
the Windows installer.

A possible backward compatible strategy is leaving as is the reference
to the environment variable (introduced by a $ sign) in the filename
if it does not exist. This is done in this patch, which also assumes
that an escape character is never used in a filename (inserting a $ in
the filename is easy, but I don't think one is able to easily insert
an escape character).
2021-01-04 23:00:42 +01:00