Commit Graph

2090 Commits

Author SHA1 Message Date
Jean-Marc Lasgouttes
586890f09e Make #include directories explicit 2018-01-08 11:19:15 +01:00
Jean-Marc Lasgouttes
d77b05db80 Move the inPixels(MetricsBase) help from Length to MetricsBase.
A basic class like Length should not depend on something from
frontend.

This change allows to remove several dummy implementations of
theFontMetrics().
2018-01-05 20:14:04 +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
Richard Heck
61b1a20185 Fix crash after cancellation code.
I thought we didn't use clones when exporting from the command line.
We probably shouldn't.
2017-12-25 13:07:58 -05:00
Richard Heck
56071d2fb0 Dummy theApp() method should return a pointer. 2017-12-23 14:40:18 -05:00
Kornel Benko
35eabe1ea7 Fix linking errors for check_filetools, check_trivstring, check_convert, check_lstrings
This may amend f1df7e478d
2017-12-22 07:19:13 +01:00
Richard Heck
165c9e92a4 Systemcall infrastructure for canceling background processes. 2017-12-21 18:55:39 -05:00
Uwe Stöhr
5ebff51e99 gzstream.cpp: whitespace fix 2017-12-16 13:09:39 +01:00
Richard Heck
b954f478e3 Fix #10858 compiler warnings. 2017-12-15 23:41:32 -05:00
Richard Heck
1182e303b1 Fix #10852 compiler warnings. 2017-12-15 23:28:33 -05:00
Richard Heck
27eb415d25 Probably fix #10850 compiler warnings. 2017-12-15 23:25:51 -05:00
Richard Heck
9f56f97d8e Fix bug #9847.
Spaces are, amazingly, allowed at the end of bibliography keys. So we
introduce a new parameter allowing getVectorFromString not to trim
whitespace, and then use it.
2017-10-18 16:42:47 -04:00
Juergen Spitzmueller
b498646b2e Fix some spelling errors reported by Sven
Fixes: #10678
2017-09-22 09:29:16 +02:00
Kornel Benko
187824da3c Amend d6285d5, copy & paste error, urrrrg 2017-08-04 16:16:08 +02:00
Kornel Benko
d6285d52e7 For cmake case try to use the newly built .gmo files first. 2017-08-04 16:06:32 +02:00
Kornel Benko
b5a4e79736 Since boost dir may not exist anymore, use the lyx-src dir for out-of-source build detection 2017-08-02 18:44:32 +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
Jean-Marc Lasgouttes
fc75cbd88f Remove copy-and-paste error 2017-07-11 13:43:32 +02:00
Jean-Marc Lasgouttes
0ba385800e Rewrite stripName without regex
Using a regular expression to find /src/ or \src\ in a string is overkill,
and since regexes can throw exceptions, it makes coverity nervous.

The new code is simpler anyway.
2017-07-06 15:26:32 +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
Guillaume MM
fd6189b7e3 Remove FileMonitorBlocker which does not work reliably on all platforms 2017-06-11 19:51:17 +02:00
Guillaume MM
b30161b591 If the external modification is a deletion, do not ask for reloading.
The behavour when hitting "reload" on a deleted file was also confusing.
2017-06-11 19:51:17 +02:00
Guillaume MM
2058faaa3b Prevent false positives in external modifications
When the Buffer is notified to be externally modified, check that the
file contents have changed using the checksum.

Document the shortcoming of FileMonitorBlocker.

Fixes #10642.
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
Guillaume MM
752a0a1e48 Correct debug message 2017-05-15 02:28:48 +02:00
Guillaume MM
c76cbead59 Cosmetic 2017-05-13 16:12:25 +02:00
Guillaume MM
974d33ad01 Remove spurious error "QFileSystemWatcher::removePath: path is empty" 2017-05-01 19:31:42 +02:00
Jean-Marc Lasgouttes
b250eb5a46 Autotools: use silent rule for moc in src/support. 2017-04-18 14:45:05 +02:00
Stephan Witt
b5c2859a92 Revert "update canAutoOpenFile/autoOpenFile implementation to new MacOSX API, avoid deprecated calls"
This reverts commit d568846e03.

Unfortunately the used alternative API LSCopyDefaultApplicationURLForContentType
is available with 10.10 and later only and cannot be used therefore. So there
is no alternative to deprecated calls ATM. LyX 2.3 should run on 10.7 at least.
2017-04-17 01:42:38 +02:00
Tommaso Cucinotta
664798128a findadv: almost all test cases, including \regex[{}, back to working with std::regex. 2017-04-17 00:15:26 +02:00
Stephan Witt
28fd15307b Care for a tilde in front of a path name. A path name with tilde sign at start is interpreted as relative to the current users home directory. 2017-04-15 13:30:35 +02:00
Enrico Forestieri
031748d9c8 Avoid an assertion when compiling in debug mode with MSVC 2015
Seemingly, when removing an argument from argv, and thus inserting
a null pointer to shorten the array, causes an assertion because
the null pointer is not a valid heap pointer (sic!)

Fixes bug #10440
2017-04-12 21:19:42 +02:00
Stephan Witt
d568846e03 update canAutoOpenFile/autoOpenFile implementation to new MacOSX API, avoid deprecated calls 2017-04-08 21:01:17 +02:00
Enrico Forestieri
d996ec8992 On windows, use the unicode version of ShellExecute 2017-03-28 01:32:59 +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
Jean-Marc Lasgouttes
2a0e4c199c Fix coverity issues about exceptions
There a some exceptions related to the fact that BOOST_ASSERT throws
an unhandled exception, which is fait enough. This is handled by
uploading a modeling file to coverity.

The second batch of issues are related to the use of lexical_cast in
convert.cpp. We use now a wrapper around boost::lexical_cast that does
not throw but return empty strings instead. I am not sure actually of
when lexical_cast could fail.
2017-03-24 16:47:35 +01:00
Guillaume Munch
c779e9806e Cosmetic 2017-03-19 14:41:17 +01:00
Guillaume Munch
9926927fb1 Ressurect old FileMonitor à la Frankenstein
ActiveFileMonitor combines QFileSystemWatcher with the previous checksum
approach.
2017-03-19 14:41:17 +01:00
Guillaume Munch
6c4b9c97cb Blocking signals also blocks the notification of file creation (#10595) 2017-03-19 14:41:17 +01:00
Guillaume Munch
fa9ab74ffa Correct ownership
One can now delete a file monitor if a blocker is active.
2017-03-19 14:41:17 +01:00
Jean-Marc Lasgouttes
7a124ab861 Fixup commit 50060053
Fix two instances where theFormats() was used instead of a local parameter.

Fix layout test.
2017-03-14 14:26:26 +01:00
Guillaume Munch
797bb2df14 Fix compilation with 5 <= qt < 5.4 2017-03-11 22:22:27 +01:00
Guillaume Munch
24f68aff8d Nonsense for whoever insists on using gcc4.6 & qt4.8 in 2017 2017-03-11 00:50:57 +01:00
Guillaume Munch
f96d7a8b2c Remove legacy FileMonitor 2017-03-11 00:50:57 +01:00
Guillaume Munch
caa54e80ee Implement FileMonitor as a wrapper for QFileSystemWatcher
The new file monitor supports both boost and qt signals. It is implemented in a
ressource-safe way.
2017-03-11 00:50:57 +01:00
Jean-Marc Lasgouttes
ce0c11ba4e Remove unreachable return statements
They were needed long ago to avoid gcc warnings, but now all they do
is create coverity warnings.
2017-03-09 15:05:33 +01:00
Kornel Benko
5d3d26b024 Cmake build: Adapt handling of mytheslib to automek behaviour
The added cmake-parameter is:
  -DLYX_EXTERNAL_MYTHES=<value>
where <value> is one of
  AUTO	(Default) Search first on system for mythes (lib and include)
  ON	Use installed only (errors if not installed)
  OFF	Compile the provided source in 3rdparty
2017-03-07 14:27:08 +01:00
Kornel Benko
15babdc0f1 Amend 0e50ad8 'move mythes sources to 3rdparty' for cmake build. 2017-03-06 19:31:23 +01:00
Jean-Marc Lasgouttes
0e50ad8b16 Update bundled mythes to version 1.2.5
Move it to 3rdparty/ directory alongside the other ones.
2017-03-06 17:08:38 +01:00
Jean-Marc Lasgouttes
8a9ea4d264 Initialize properly pointer
Fixes coverity issue 23411
2017-02-25 00:20:51 +01:00
Guillaume Munch
8353a53cc3 Clarify comment 2017-02-22 16:57:13 +01:00
Jean-Marc Lasgouttes
e04079aa52 Fixup to 33b696c8: fix compilation with gcc 4.6 2017-02-21 06:21:49 +01:00
Guillaume Munch
33b696c8ac Introduce support/Cache.h
Useful to cache copies of objects, including shared_ptrs. No risks of dangling
pointer, and avoid naked pointers in the source.

Fix memory leak when compiling with Qt5.
2017-02-21 00:06:07 +01:00
Juergen Spitzmueller
c59375d679 Move protectArgument function to lstrings
This will be useful to other insets as well.
2017-01-29 12:08:29 +01:00
Juergen Spitzmueller
ef387c81af Handle backslash in escape function.
Fixes: #4595.

Candidate for stable
2017-01-27 09:15:47 +01:00
Juergen Spitzmueller
867cdb0662 Extend the Bibfiles cache
For biblatex, we need the file name as it was entered in the inset
(abs path, rel path, only file name) in order to resolve it properly
for the export (as in the BibTeX inset intself).

Therefore, we now store a pair<docstring, FileName>.

A FileNamePairList has been added to FileNameList for this purpose.
2017-01-02 13:00:14 +01:00
Juergen Spitzmueller
c0000cc405 Improve quotation mark opening/closing guess
Fixes: #8831

This introduces
* a new inset member isPartOfTextSequence() that returns
whether the inset produces something visible at the current position
in the text flow
* an isOpenPunctuation() test that returns whether a character is in the
'Punctuation, Open' unicode class. This is used instead of just checking
for two (Western, ASCII) opening brackets

It also fixes the isChar() and isLetter() value of InsetSpecialChar,
since some types have not been assigned correctly.
2016-12-27 12:06:54 +01:00
Jean-Marc Lasgouttes
c5119c97fc Add caching for the QTextLayout objects we use
The QTextLayout handling is terribly slow on Qt 4.8.7, but some
caching has been added in Qt5 that makes it much faster. For some
reason, it is not that slow with Qt 4.8.1.

Caches are introduced for the three following methods

* width(doctring), controlled by CACHE_METRICS_WIDTH. This cache already
  existed, but the code has been cleaned up

* getTextLayout, controlled by CACHE_METRICS_QTEXTLAYOUT (disabled by
  default on Qt5, which does its own caching). This is used for pos2x
  and x2pos and now for drawing of text too. The previous code used a
  trivial caching scheme of the last used QTextLayout, but now they
  are properly kept in a QCache. Moreover, the cacheEnabled() property
  is enabled for these QTextLayout object (not sure what this does).

* breakAt, controlled by CACHE_METRICS_BREAKAT. This is the only user
  of QTextLayout which did not have some kind of caching already.

For some weird reasons related to Argument-dependent look-up, the
qHash(docstring) function has to be defined in std namespace, since
lyx::docstring is actually std::basic_string<wchar_t>.

[NOTE: this version has profiling hooks, enabled by commenting out the line
  #define DISABLE_PMPROF
that should eventually be removed.]
2016-12-19 18:47:18 +01:00
Jean-Marc Lasgouttes
c139aef379 Add a way to disable the poor man's profiler
Just define DISABLE_PMPROF _before_ #including the header.
2016-12-09 15:47:19 +01:00
Tommaso Cucinotta
9c1142c880 Remove unneeded templatization code from bformat(). 2016-12-04 17:10:10 +01:00
Guillaume Munch
e449e70e38 Simplify Changers interface
In fact having an extra parameter "bool cond" is no longer useful because it can
now always be emulated with a ternary operator:
	Changers dummy = cond ? do_change() : Changer();
2016-11-21 00:08:11 +01:00
Guillaume Munch
1f945177b9 Docstringify getLongString in general and preamble snippets in particular
Prepare ground for TexRow InPreamble
2016-10-17 00:16:59 +02:00
Guillaume Munch
efbec20320 Fix the compare_locale function by relying on Qt's (#9030) 2016-08-28 01:30:53 +01:00
Enrico Forestieri
589f49ff36 Use only one file for dummy implementations 2016-08-20 00:41:04 +02:00
Kornel Benko
3c9d5d3cda Cmake build: Add verbose variable to some dummy_functions.cpp 2016-08-19 11:15:10 +02:00
Enrico Forestieri
fb46b3a1ee Fix exit code from runCommand on Windows
On Windows, runCommand has never returned the exit code of the
spawned process but the result of correctly closing the input handle.

Fixes #10327
2016-08-17 22:58:13 +02: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
2fd2e65745 C++11 supports thread-safe initialization of statics
A static local variable is guaranteed to be initialized only once, and in time.

Lambda expressions can be used to perform complex initialization of those static
variables on the spot.

(starting from: gcc >= 4.8, msvc >= 2015)
2016-07-31 18:34:33 +01:00
Scott Kostyshak
c659fd4f74 Remove the now unused lyx::support::expandPath()
The function is no longer used in LyX's sources (as of the previous
comit, 9b64d7bd) and is thus removed with this commit. Perhaps the
advantage this function had over other path functions we have has
disappeared over time (see e.g. 1a7b7f65).
2016-07-29 13:17:09 -04:00
Jean-Marc Lasgouttes
be1c3f5fe3 Poor man's profiler: add support for cache hit/miss
This is still very basic profiling, but it seems to get the work done.
2016-07-05 15:31:17 +02:00
Stephan Witt
b035528c1c Fix missing include for malloc prototype after header cleanup in change 489dca71cd 2016-07-04 08:33:03 +02:00
Guillaume Munch
489dca71cd Simplifications, mainly removal of boost::function and useless std::bind 2016-07-03 01:39:32 +02:00
Stephan Witt
1440b6a2fc Compile fix after change 4b64aaf, replace missing constructor for C-string with docstring variant 2016-07-02 08:30:34 +02:00
Stephan Witt
994844cb34 Correct indentation 2016-07-02 08:30:34 +02:00
Guillaume Munch
7d456a93e4 Use move when passed by value
Also unduplicate code.
2016-06-26 19:38:16 +01:00
Georg Baum
14fa2c7162 Remove using directives from headers
The only exceptions are:

- The purpose of the header is to drag in the used symbol, e.g. unique_ptr.h
- The used symbol is inside a class or a namespace other than lyx

The reason for this is that global 'using' statements effectively forbid to
use the used symbols in any other namespace in the whole program, since simply
adding or removing an #include of the corresponding header subtly changes the
name lookup. The namespace lyx is sort of global, so it should not have these
statements either.
2016-06-26 18:22:59 +02:00
Georg Baum
8e9321dec2 Amend 10b4a47185 2016-06-16 20:25:43 +02:00
Georg Baum
10b4a47185 Expose python 3 support to some testing
LyX will now always use the default python interpreter. This will hopefully
help us sto see if one of them fails in some cases.
2016-06-16 20:22:40 +02:00
Guillaume Munch
52dd5dc84f Fix compilation with gcc 4.6 part II 2016-06-15 14:42:34 +01:00
Guillaume Munch
b148629d56 Fix compilation with gcc 4.6 2016-06-14 16:44:40 +01:00
Guillaume Munch
b7abd752fa amend 6144bbfb 2016-06-14 01:34:16 +01:00
Guillaume Munch
aef8746712 amend e2bc7ffa 2016-06-14 00:21:26 +01:00
Guillaume Munch
e2bc7ffae3 RefChanger
RefChanger temporarily assigns a value to a non-const reference of any
kind. RefChanger provides a flexible and uniform generalisation of the various
scope guards previously derived from the old Changer class in MetricsInfo.h.

As before, a temporary assignment lasts as long as the Changer object lives. But
the new Changer is movable. In particular, contorsions are no longer needed to
change a private field. Special code can be moved into the appropriate classes,
and it is no longer necessary to create a new class for each specific use.

Syntax change:

   FontSetChanger dummy(mi.base, value);
-> Changer dummy = mi.base.changeFontSet(value);

New function for generating arbitrary Changers:

  Changer dummy = make_change(ref, val, condition);

Bugfix:

* Fix the display of \displaystyle{\substack{\frac{xyz}{}}} (missing style
  change).
2016-06-13 08:46:15 +01:00
Guillaume Munch
6144bbfbf8 Replace foreach with for
C++11 allows foreach-style iterations with the following syntax:

for (auto & element : container) {
 ...
}
2016-06-12 19:17:33 +01:00
Guillaume Munch
32ff5f0f30 climits
It's as you prefer, Jean-Marc.
2016-06-12 19:17:33 +01:00
Guillaume Munch
8e4648f38c Add missing header
Spotted by jkulesza
2016-06-11 05:08:23 +01:00
Georg Baum
2047ea5eb4 Replace Boost.Signals with Boost.Signals2
Boost.Signals is deprecated. This fixes bug #9943.
The only thing left to do is to rewrite (or get rid of) the boost -mt test
in config/lyxinclude.m4 not to use signals anymore.
2016-06-09 22:25:34 +02:00
Guillaume Munch
e87febd0de Exercise: simplify the definition of IconvProcessor
It is no longer needed to create fake copy constructors and assignment and to
deal with deletion by hand, thanks to unique_ptr, the inference of move
constructor and assignment operator, and the compatibility of standard
containers with movable objects.
2016-06-09 19:16:44 +01:00
Guillaume Munch
8d640dc776 Remove non-copyable idioms
Two better ways of making a class non-copyable in C++11:

* Store the p. impl. in a unique_ptr (for the cases of classes with p. impl.),
  or:

* Define publicly the copy constructor and assignment as deleted

Lots of other classes could be cleaned up in this way.
2016-06-09 19:16:44 +01:00
Jean-Marc Lasgouttes
664fca5566 Initialize correctly SystemcallPrivate in constructor
It seems that Error is the best possibility when nothing has been done yet.

Found by Coverity
2016-06-09 17:34:14 +02:00
Jean-Marc Lasgouttes
7800c05788 Initialize bool member of Package in default constructor
Found by Coverity
2016-06-09 17:26:55 +02:00
Guillaume Munch
b032e2dfaf Replace support/shared_ptr.h and boost::shared_ptr with std::shared_ptr
shared_ptrs now only require the <memory> header.
2016-06-09 15:21:39 +01:00
Guillaume Munch
af5f69cea7 unique_ptr and make_unique 2016-06-09 15:21:39 +01:00
Georg Baum
273c67d8aa Require a C++11 compiler
As discussed on the list. If no C++11 compiler is found configuration stops
with an error. There are now unneeded parts of boost, the will be removed in
a second commit.
2016-06-07 20:34:52 +02:00
Jean-Marc Lasgouttes
d0a318c742 We do not use <boost/scoped_array.hpp> anymore
The code using it  was removed at 81959251.
2016-05-29 17:55:45 -04:00
Jean-Marc Lasgouttes
5ee778af75 Remove support/metahash.h
It turns out that it did not take off since introduced in 2011. It is better to remove it and the associated boost headers (extract.sh was run against boost 1.60 to do the update).

Since we will move away from several boost classes when transitioning to C++11, it is good to start by removing lesser used ones.
2016-05-29 17:55:45 -04:00
Jean-Marc Lasgouttes
68a1f9a44e Do not use of boost::tokenizer
It is easier to use instead getVectorFromString for the use we have of this tokenizer. The two places are environment.cpp (path stuff) and qt_helpers (file fileters). The new code is much shorter.

This allow to remove boost/tokenizer.hpp and friends from our boost tree.
2016-05-29 17:55:45 -04:00
Georg Baum
d2e3a201b9 Do not redefine WINVER
Compiling different parts of the sources with different WINVER may lead to
subtle and hard to detect problems. Better use the same value everywhere.
The existing error message suggests that this was wanted anyway, and it
fixes a compiler warning when cross-compiling for mingw on linux. Our code
does not require a specific value, only a minimum value of 0x5000, which
means the resulting executable will require at least Windows 2000.
2016-05-29 17:55:44 -04:00
Georg Baum
08afc52c4c Configure included iconv with autotools
The included iconv should not be used on Linux or OS X, but (depending on
local configuration) it might be needed for crosscompiling a mingw target
from Linux. Now the user can choose whether to use the included iconv or not.
cmake does already support that.

eilseq.m4 was taken from the original libiconv 1.14 package.
2016-05-29 17:55:43 -04:00
Georg Baum
637fbb7ac9 Use c-style cast as in original
static_cast does not work
2016-05-29 17:55:43 -04:00
Georg Baum
127e5b1955 Add forgotten zlib includes
I forgot this in 9b822b25ae5. Also remove a comment that is no longer true.
2016-05-29 17:55:43 -04:00
Georg Baum
d5f2bad461 Mingw-w64 build fixes for long long
On mingw-w64, long long (64bit wide) is larger than long (32bit wide).
Therefore we need some more specializations for string, docstring,
otextstream and << overloaded ostream functions. The configuration code
is by me, the source code changes by Shankar Giri Venkita Giri (bug 10053).
2016-05-29 17:55:43 -04:00
Shankar Giri Venkita Giri
88b68ee004 Fix return types for mingw-w64
This is needed for warning-free compilation with mingw-w64, and does not hurt
for other build configurations. Patch by Shankar Giri Venkita Giri (bug 10053).
2016-05-29 17:55:43 -04:00
Guillaume Munch
4154e088b0 GuiChanges: provide feedback when there are no more changes
Remove FIXMEs: date and time localisation
2016-05-29 17:55:42 -04:00
Peter Kümmel
a0a472c16e msvc2015: always incude strfwd.h first, to prevent crashes of our
typedefed streams.
2016-04-02 11:03:17 +02:00
Peter Kümmel
44c57bb9d8 msvc2015: _wgetmainargs is not available ony more 2016-04-02 11:00:42 +02:00
Georg Baum
c0ce79452f Introduce proper integer rounding function
This fixes a failing unit test with 32bit gcc 4.9.3 and -O2 optimization:
It computed 9953 instead of 9954 for Length::inPixels() of value 2342.
The reason for this is probably different rounding behaviour caused by storing
the unrounded value in a processor register (uses 80bit accuracy) vs. writing
it back to memory (uses 64bit accuracy). The unrounded value is very close to
9953.5 (which is not representable as an exact IEEE floating point value).

Apart from that, having a proper function for rounding makes the code more
readable, and has the nice side effect to make Length::inPB() work for
negative lengths as well.
2016-02-17 21:42:37 +01:00
Georg Baum
de3e5280f6 Open tex2lyx input files with correct encoding
We open the input file now twice: The first time in latin1 encoding to read
the document encoding from the preamble. This does always work, since
traditional TeX does not allow non-ASCII contents without an encoding changing
command (except for comments, but we do not need them, and using latin1 rather
than utf8 ensures that they do not produce an iconv exception, but are simply
recored with wrong characters), and we do detect the utf8 based TeX engines
XeTeX and LuaTeX as well. The second time we open the file directly with the
document encoding.

This fixes a few tex2lyx tests on OS X, since changing the encoding of an
open file steam does not work with clang on OS X. Files using more than one
encoding are still broken, but all single-encoding files are fixed now.
2016-01-31 12:54:59 +01:00
Georg Baum
92d0835e14 Avoid encoding changes of open streams if possible
Changing the codecvt_facet of a file stream after the file has been opened
does not work with clang on OS X. Therefore we avoid it if possible (i. e. the
new encoding is the same as the old one).
2016-01-31 12:49:17 +01:00
Georg Baum
8171272d1f Fix file locking problem on windows (bug 9925)
External processes cannot access files which are open in LyX. Therefore the
temp files created by the external inset need to be closed right after
creation. The symptom was that the date inset did not produce any outout on
windows (bug 9925). This change reverts a small part of f09a9fe2.
Although the date inset is unimportant and will probably be removed, this
change is important for all external insets that make use of temp files.
2016-01-26 21:49:08 +01:00
Scott Kostyshak
20addbbf36 Qt 5.6 renames signal QProcesss::error()
QProcesss::error() was renamed to QProcesss::errorOccurred().

The renaming was done to avoid confusion from overloading (see the
documentation for the signal before the renaming [1]).

For more details, see this Qt bug report [2].

[1] http://doc.qt.io/qt-5/qprocess.html#error-1
[2] https://codereview.qt-project.org/#/c/114451/
2016-01-24 12:07:52 -05:00
Stephan Witt
3d00aef3ac use QStandardPaths::GenericDataLocation instead of QStandardPaths::DataLocation to get common user_support_dir path for all LyX binaries (LyX, tex2lyx and lyxclient) 2016-01-24 15:19:54 +01:00
Pavel Sanda
555b08c325 Comment only. 2016-01-18 14:29:37 -08:00
Peter Kümmel
e1c893127f boost dir is used for out-of-source build detection 2015-12-20 14:00:04 +01:00
Guillaume Munch
400703aff1 Convert remaining C++ files to UTF-8 2015-12-05 19:33:24 +00:00
Georg Baum
e8211fb931 Fix C++11 std::regex incompatibility
boost::regex supports escape sequences starting with a backslash in format
strings of regex_replace, but std::regex does not. Therefore format strings
involving literal backslashes have to be written differently for both flavours.

The special MSVC handling in regex.h is removed, since it is not needed
anymore, and using grep syntax would definitely be wrong.
2015-11-24 20:31:14 +01:00
Georg Baum
08317ecc0b Fix some thinkos in MSVC regex hack
The changed code is not used, but I tried to use a similar approach for
boost::regex, and found some problems:
- regex_replace and regex_search are implemented in the replacement, so they
  must not be used directly
- an smatch object must be given by reference (as in the called methods),
  otherwise an exception would be thrown at runtime
- the commented out regex_replace version is actually needed

This code is supposed to be deleted, but nevertheless I wanted to record here
how it had to be modified if it was actually needed.
2015-11-22 13:02:39 +01:00
Kornel Benko
c9f6ed309f Cmake monolithic build: Some corrections.
In the src/support directory do not use src/support/AppleScriptProxy.cpp if not APPLE.
In the src/client directory remove inclusion of src/TexRow.cpp
2015-11-17 21:21:00 +01:00
Juergen Spitzmueller
2a223b0933 Rename function that was ambiguous from a monolithic perspective.
Cures one monolithic build issue with CMake.
2015-11-16 08:20:54 +01:00
Enrico Forestieri
76dfde36d4 Fix bugs #2645 (export BIBINPUTS) and #6634 (Better support for external files in ERT)
Other than BIBINPUTS, also BSTINPUTS and TEXFONTS are exported.
They do not replicate the setting for TEXINPUTS but are set such
that the current dir (i.e., the temp dir) and the document dir
are also searched for bibtex and fonts related files.
2015-11-03 23:28:36 +01:00
Guillaume Munch
671c7e12e5 Amend bb344452
Repair the senseless truncation on long file names
2015-10-21 15:02:12 +01:00
Guillaume Munch
7a60c96dfa msvc: Proper fix for compilation of TexRow
This bug in MSVC 10 was fixed at e948caf6, but the workaround belongs to
strfwd.h.

Thanks Vincent and Georg.
2015-10-20 21:29:19 +02:00
Vincent van Ravesteijn
990446c0e1 msvc: Move implementation of numpunct<> functions to cpp file
These functions use lyx::from_ascii which means they need to include
docstring.h, but that results in a circular include.
2015-10-20 21:28:40 +02:00
Jean-Marc Lasgouttes
b14c0530eb Assorted cppcheck fixes
Remove member disp_ that is defined both in Cursor and CursorData classes

Pass parameter of convert<T>(docstring const) templates as const reference for performance.
2015-10-20 09:58:46 +02:00
Georg Baum
79f11f4e7d Fix std::string docstream output error
This was made visible by aab1b145a5, since xhtml export for
lib/doc/Additional.lyx caused an exception. However, the cause for this was
already present earlier: All attempts to output a std::string to an
odocstream resulted in trying to change the encoding of the stream instead,
since there is no operator<<(odocstream &, std::string) defined, and an
implicit conversion to SetEnc happened instead.
This is fixed by making the SetEnc constructor explicit and adjusting all
code parts that did not compile anymore after that. The parts of the code
that did use the wrong output operator were the std::string version of
htmlize() from output_xhtml.cpp and all changed parts in the other .cpp files.
I also removed the std::string versions of html::htmlize() and
html::cleanAttr(), since it was difficult to see which encodings were used
with these. Now we are always explcit when using html::cleanAttr() and
html::htmlize().
2015-10-15 20:52:28 +02:00
Georg Baum
8a047a4112 Add missing intializations
These were found by cppcheck:
Member variable 'x' is not initialized in the constructor.
The crash #9788 would not have happened if this had been done earlier.
2015-10-10 21:04:28 +02:00
Stephan Witt
989c72530e Avoid the use of a static NSAutoreleasePool.
This seems to cause crashes on exit from time to time.
2015-10-09 08:16:24 +02:00
Guillaume Munch
bb344452c8 Consistency of ellipses across the UI
Use the function support:truncateWithEllipsis() to shorten a docstring with
... at the end. Actually we use U+2026 HORIZONTAL ELLIPSIS instead of "..." when
automatically shortening strings. This is to be consistent with Qt's own
truncation and is much nicer on the screen.

This includes the bugs #9575 and #9572 regarding broken text elision in the
outliner.

Known issues (non-regressions):

* TocBackend::updateItem() should be rewritten to update all TOCs. (#8386)

* "..." should be replaced with … everywhere else on the interface (including
  translation strings).

* We should prefer to rely on QFontMetrics::elidedText() to truncate strings
  with an ellipsis whenever possible, or an equivalent for the buffer view
  dependent on the font metrics. See the warning in src/support/lstrings.h.
2015-10-05 21:16:16 +01:00
Jean-Marc Lasgouttes
b7909e7e6c Remove support for precompiled headers for autotools
This was turned off by default for a long time, and it does not seem
to have any use these days.
2015-09-25 12:05:40 +02:00
Georg Baum
b6aed54c45 Fix cppcheck variable scope warnings
These were all flagged by "(style) The scope of the variable 'x' can be reduced."
Narowing the scope improves readability, and if it is in a loop then the
compiler will be clever enough to produce efficient code, we do not need
manual optimization for POD types.
2015-09-20 10:42:35 +02:00
Guillaume Munch
12de677fcc Support for (std|boost)::make_shared 2015-09-15 15:25:32 +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
1e4adc512e In fileLock, take in account the case where the file cannot be opened
overity issue 23352
2015-09-12 23:53:19 +02:00
Jean-Marc
28e997781d Restore lyxerr number format to decimal
Coverity issue 23427
2015-09-12 19:38:38 +02:00
Jean-Marc
41cb3bbc0e Mark dead code as dead
Coverity issue 23511.
2015-09-12 18:49:22 +02:00
Jean-Marc
eba0bbe503 Fix unreachable code
Coverity issues 23292 and 23297.
2015-09-12 18:05:08 +02:00
Stephan Witt
9f972ba90c Use the safer addName helper function to add the configure lock name to user support directory path name 2015-07-22 06:02:46 +02:00
Jean-Marc Lasgouttes
f41e423b30 Small clean-up to debug support 2015-07-08 11:03:42 +02:00
Georg Baum
8a27143e72 Test negative numbers as well 2015-06-28 11:27:17 +02:00
Georg Baum
b8eb4fffee Make it explicit that we need floating point abs
The 'using namespace std' at the top of the file makes it quite difficult to
understand which abs is used: double std::abs<double>(double) or
int ::abs(int)? Now it is explicit, and the code does not change in subtle
ways if somebody removes the using statement.
2015-06-28 11:27:17 +02:00
Enrico Forestieri
9b0e5215d9 Was forgetting this 2015-06-26 22:54:23 +02:00
Enrico Forestieri
67c52ae773 Amend c9d9309c
It suffices taking the log of the absolute value.
2015-06-26 22:49:17 +02:00
Juergen Spitzmueller
c9d9309c1e Fix formatFPnumber with negative doubles. 2015-06-26 15:49:44 +02:00
Stephan Witt
bfc7c4d379 #7896 add support for symlink creation by the LyX binary itself 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
Jean-Marc Lasgouttes
329eae5605 Use explicit macro to declare that we want to use C++11
This replaces tests for __cplusplus >= 201103L, which are wrong with gcc 4.6 and earlier. Indeed these versions of gcc define __cplusplus = 1.

Reference:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=1773
2015-05-20 10:19:19 +02:00
Georg Baum
84cca2dd94 Fix indentation 2015-05-17 17:27:27 +02:00