Commit Graph

48 Commits

Author SHA1 Message Date
Enrico Forestieri
82faa66192 Set the default locale at startup.
On startup, the default locale is "C", meaning that all system
functions assume an ascii codeset. The environment's locale
settings should be selected by calling setlocale(LC_ALL,"").
This is done by Qt during the QCoreApplication initialization
but this inizialization is never performed for batch processing
and, as a result, LyX is not able to process files whose names
contain non-ascii characters. This is not an issue on Windows,
where the file names are always stored as UTF-16, so the call is
only performed for unix-like platforms (this also includes cygwin,
due to its own filenames management that allows using characters
which are forbidden to native programs).
2014-06-11 18:23:44 +02:00
Richard Heck
1b1f8dd235 Audit all the LASSERT calls, and try to do something sensible at
each failure.

There are several places I was not sure what to do. These are marked
by comments beginning "LASSERT:" so they can be found easily. At the
moment, they are at:

Author.cpp:105: // LASSERT: What should we do here?
Author.cpp:121: // LASSERT: What should we do here?
Buffer.cpp:4525:        // LASSERT: Is it safe to continue here, or should we just return?
Cursor.cpp:345:         // LASSERT: Is it safe to continue here, or should we return?
Cursor.cpp:403:         // LASSERT: Is it safe to continue here, or should we return?
Cursor.cpp:1143:                // LASSERT: There have been several bugs around this code, that seem
CursorSlice.cpp:83:     // LASSERT: This should only ever be called from an InsetMath.
CursorSlice.cpp:92:     // LASSERT: This should only ever be called from an InsetMath.
LayoutFile.cpp:303:                     // LASSERT: Why would this fail?
Text.cpp:995:           // LASSERT: Is it safe to continue here?
2013-04-25 17:27:10 -04:00
Peter Kümmel
c2ff9de084 timeout_min is platform independent
#7928

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@40402 a592a061-630c-0410-9148-cb99ea01b6c8
2011-12-06 20:52:19 +00:00
Enrico Forestieri
1717ef203c Introduce the possibility of setting a prefix for the TEXINPUTS environment
variable. This is done in the preferences, much like as the PATH prefix.
A single '.' in the paths will get replaced with the current document dir
and also non-absolute paths will be prefixed with that dir.

The default semantics of TEXINPUTS apply, such that, for example, if a
path is terminated with a double slash, all subdirectories will be also
searched by both the TeX engine and ancillary programs such as dvi
previewers or dvips. As an example, if the prefix is set to ".:figs", the
TEXINPUTS variable will be set as ".:<docdir>:<docdir>/figs:$ORIGTEXINPUTS",
where <docdir> is the document directory.

The initial '.' is necessary to address the actual current dir (this will
be the temp dir at preview time), while if TEXINPUTS was initially unset,
such that $ORIGTEXINPUTS is empty, a colon (or semicolon on Windows) will
end the path list. This is very important, because we don't want to replace
the system directories but to complement them and, in order to do that, an
empty element has to be present in the list. Indeed, according to the
TEXINPUTS semantics, an empty element means the standard search path.
This works whether TEXINPUTS is originally set or not, because if the
original TEXINPUTS starts with a colon (meaning that the standard search
path is wanted there) we will have an empty element at that point,
otherwise the final colon will simply serve as a path separator.

Of course, on Windows a ';' has to be used as a path separator. LyX will
take care of transforming the platform path list into one understandable
by the TeX engine. For example, this will be the case for a Cygwin version
of LyX using a native Windows TeX engine or viceversa. I tested all of
this and it works for me.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38681 a592a061-630c-0410-9148-cb99ea01b6c8
2011-05-09 23:25:51 +00:00
Enrico Forestieri
3efc6385d7 See r37176. Let's keep this a Windows only "feature".
Something went wrong with a script while previewing a document and now
I have to wait for 30 minutes for quitting LyX without killing it.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@38578 a592a061-630c-0410-9148-cb99ea01b6c8
2011-05-04 00:17:07 +00:00
Enrico Forestieri
952a31a43e Fix output to terminal when LyX is launched from a GUI on *nix
aka
Surrender to Windowsisms
aka
Resistance is futile, you will be assimilated


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34918 a592a061-630c-0410-9148-cb99ea01b6c8
2010-07-16 14:30:46 +00:00
Pavel Sanda
62ca7f3ae5 Proper camel case for FileName.absFilename
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@34234 a592a061-630c-0410-9148-cb99ea01b6c8
2010-04-21 01:19:09 +00:00
Enrico Forestieri
0f8929d5d1 Fix command line parsing and allow unicode arguments for tex2lyx on Windows.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33723 a592a061-630c-0410-9148-cb99ea01b6c8
2010-03-12 01:18:39 +00:00
Enrico Forestieri
3fce202517 On Windows, allow loading documents with non-ascii chars in their path
also from command line and from explorer windows.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33561 a592a061-630c-0410-9148-cb99ea01b6c8
2010-02-25 00:20:31 +00:00
Enrico Forestieri
10f1370464 On windows, allow saving a document whose pathname contains unicode chars.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33539 a592a061-630c-0410-9148-cb99ea01b6c8
2010-02-22 19:34:25 +00:00
Enrico Forestieri
37974532f6 Fix bug #5238: LyX 1.6 fails with non-ascii chars in path (on Windows)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33524 a592a061-630c-0410-9148-cb99ea01b6c8
2010-02-21 04:51:27 +00:00
Enrico Forestieri
4c92ec8383 Operator new[] should always be matched by operator delete[],
even when allocating POD types.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33488 a592a061-630c-0410-9148-cb99ea01b6c8
2010-02-17 19:33:52 +00:00
Enrico Forestieri
51d70699ef Fix bug #5525: Windows XP doesn't shut down with LyX open
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33077 a592a061-630c-0410-9148-cb99ea01b6c8
2010-01-17 23:01:48 +00:00
Enrico Forestieri
92f491b3f8 Add support for the forthcoming Cygwin 1.7.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@32616 a592a061-630c-0410-9148-cb99ea01b6c8
2009-12-22 23:21:02 +00:00
Enrico Forestieri
0695afbc55 Don't rely on the signal delivered by raise(), as this may cause a bogus
assertion when Qt is compiled in debug mode, and simply directly perform
an emergency cleanup when a shutdown event occurs on Windows.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31029 a592a061-630c-0410-9148-cb99ea01b6c8
2009-08-14 13:19:02 +00:00
Enrico Forestieri
50fa5f24d3 Move OS specific code to proper place. Also make sure that no other
handler functions are called after processing shutdown events.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@31027 a592a061-630c-0410-9148-cb99ea01b6c8
2009-08-14 00:42:45 +00:00
Enrico Forestieri
5fb0ed491c Account for the weird case where p2 is longer than p1, such as p1 == "path"
and p2 == "Path/". This would be really weird, but one never knows...


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29855 a592a061-630c-0410-9148-cb99ea01b6c8
2009-05-26 18:27:29 +00:00
Enrico Forestieri
70351330a0 Another tweak to account for when both paths end with '/'.
The problem here is making sure that path_prefix_is() behaves exactly
as would a case insensitive prefixIs(). Anyway, this is still better
than trying to fix the semantics of common_path().


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29846 a592a061-630c-0410-9148-cb99ea01b6c8
2009-05-25 18:37:03 +00:00
Enrico Forestieri
2fb21c28b5 Simpler things are almost always better.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29843 a592a061-630c-0410-9148-cb99ea01b6c8
2009-05-25 17:30:02 +00:00
Enrico Forestieri
eb9151060d Account for the corner case p2.length() == 1.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29838 a592a061-630c-0410-9148-cb99ea01b6c8
2009-05-25 00:23:44 +00:00
Enrico Forestieri
e2c763d9f6 Avoid a string copy and a small tweak.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29837 a592a061-630c-0410-9148-cb99ea01b6c8
2009-05-24 21:09:41 +00:00
Enrico Forestieri
7ae4f6ac6f Avoid calling prefixIs() if not needed.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29824 a592a061-630c-0410-9148-cb99ea01b6c8
2009-05-23 13:16:13 +00:00
Enrico Forestieri
6d1d27eb90 Take into account file system case sensitivity when checking whether
a path starts with a given prefix.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29793 a592a061-630c-0410-9148-cb99ea01b6c8
2009-05-22 22:34:43 +00:00
Enrico Forestieri
8fe984090f Allow immediate output of spawned processes for all platforms.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29668 a592a061-630c-0410-9148-cb99ea01b6c8
2009-05-14 15:13:58 +00:00
Enrico Forestieri
0ed38ed1f4 Allow to separately redirect stdout and stderr.
Now "lyx > stdout.log" should produce the same output as before
the switch to QProcess.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29655 a592a061-630c-0410-9148-cb99ea01b6c8
2009-05-13 12:55:01 +00:00
Enrico Forestieri
97303baac2 Avoid #ifdef's and use OS specific code.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29652 a592a061-630c-0410-9148-cb99ea01b6c8
2009-05-13 09:48:11 +00:00
Enrico Forestieri
ccc77c73da Speed up FileName operator== (Georg's solution).
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29498 a592a061-630c-0410-9148-cb99ea01b6c8
2009-05-02 17:12:31 +00:00
Enrico Forestieri
e0941bdb4b Revert r29444 (to be soon replaced by Georg's solution).
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29497 a592a061-630c-0410-9148-cb99ea01b6c8
2009-05-02 16:39:14 +00:00
Enrico Forestieri
b0936fac4c When performing a reverse DVI search and the tmpdir is a symlink, the
DVI viewer passes back the resolved path, such that the search fails,
as internally LyX uses the unresolved path.
This patch fixes this bug by using the new method FileName::realPath
which resolves a path by getting rid of any '.', '..', or symlink
path components.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29476 a592a061-630c-0410-9148-cb99ea01b6c8
2009-05-01 15:18:11 +00:00
Enrico Forestieri
4053db1858 Speed up FileName operator==, such that working with child documents on
Windows and Solaris is again possible.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29444 a592a061-630c-0410-9148-cb99ea01b6c8
2009-04-29 22:42:26 +00:00
Jürgen Spitzmüller
5be56b517a Fix bug 5827 (validate date-insert argument):
* src/support/os*.{cpp,h}:
	- new function is_valid_strftime that validates strftime arguments, 
	  OS dependant (win32 differs here)

* src/Text3.cpp:
	- use is_valid_strftime in LFUN_DATE_INSERT status check.

* src/frontends/qt4/GuiPrefs.{cpp, h}:
	- new GUI validator for strftime.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@28932 a592a061-630c-0410-9148-cb99ea01b6c8
2009-03-27 11:22:54 +00:00
Enrico Forestieri
12d1cb2076 Fixes for gcc4 on cygwin.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@28842 a592a061-630c-0410-9148-cb99ea01b6c8
2009-03-17 22:35:55 +00:00
Peter Kümmel
30260f0a4d underlying filesystem is case insensitive
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26756 a592a061-630c-0410-9148-cb99ea01b6c8
2008-10-05 19:37:56 +00:00
Peter Kümmel
cab745d661 Fix bug 2235: jpeg capital letters (.JPG) does not work with pdflatex
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26744 a592a061-630c-0410-9148-cb99ea01b6c8
2008-10-05 11:51:18 +00:00
Enrico Forestieri
1cd01f0db4 On Vista, if a file type is not registered, AssocQueryString() returns
information about the "Unknown" application instead of admitting that
nothing is registered. The solution is to add ASSOCF_INIT_IGNOREUNKNOWN
to the flags parameter. Also update dead URLs.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@26488 a592a061-630c-0410-9148-cb99ea01b6c8
2008-09-22 00:07:48 +00:00
Abdelrazak Younes
9439b6e6e0 * get rid of support::absolutePath()
* remove FileName.h inclusion from filetools.h


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22188 a592a061-630c-0410-9148-cb99ea01b6c8
2007-12-17 16:04:46 +00:00
Abdelrazak Younes
96ee270933 transfer os::is_absolute_path() to FileName::isAbsolute().
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22187 a592a061-630c-0410-9148-cb99ea01b6c8
2007-12-17 15:15:37 +00:00
Abdelrazak Younes
9383f4c3c6 'using namespace std' instead of 'using std::xxx'
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22097 a592a061-630c-0410-9148-cb99ea01b6c8
2007-12-12 10:16:00 +00:00
André Pönitz
9d0ea8aeff Move debug.{cpp,h}, Messages.{cpp,h} and gettext.{cpp,h} to support/.
Now support/* should have no dependencies on src/* anymore.



git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21851 a592a061-630c-0410-9148-cb99ea01b6c8
2007-11-29 07:04:28 +00:00
Enrico Forestieri
acc3bb88b8 needless declaration
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21850 a592a061-630c-0410-9148-cb99ea01b6c8
2007-11-28 23:55:55 +00:00
André Pönitz
e1ce2f92db reduce line noise
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21631 a592a061-630c-0410-9148-cb99ea01b6c8
2007-11-15 20:04:51 +00:00
André Pönitz
8d06b3049b cosmetics
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21544 a592a061-630c-0410-9148-cb99ea01b6c8
2007-11-10 13:44:50 +00:00
Enrico Forestieri
92065820e5 Register math fonts with Qt 4.2 or higher. Using Qt 4.1, the old
xft-fonts package is still required. However, on *nix there seem
to be no way to tell fontconfig to prefer our fonts instead of
others matching the requirements, so, in case of conflict, the
fontconfig files should be manually adjusted, or some existing
font package used (note that the quality of the bakoma fonts is
better than that of the xft ones). There is no such problem on
Windows where our private fonts are always preferred over the
installed ones (and I hope the same holds true for Mac).

	* src/LyX.cpp
	(LyX::exec): don't call addFontResources() and restoreFontResources()
	anymore, as the frontend code will do the job.

	* src/frontends/qt4/GuiFontLoader.{cpp,h}
	(GuiFontLoader::GuiFontLoader): register math fonts with Qt.
	(GuiFontLoader::~GuiFontLoader): unregister math fonts.

	* src/support/os.h
	* src/support/os_unix.cpp
	* src/support/os_win32.cpp
	* src/support/os_cygwin.cpp:
	remove code dealing with fonts.

	* configure.ac: don't check for fontconfig headers anymore.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20128 a592a061-630c-0410-9148-cb99ea01b6c8
2007-09-07 16:22:05 +00:00
Enrico Forestieri
f6504c4fff No need to check whether the TEMP var is already set, it suffices
using false as the third parameter to setenv for not having it
replaced when already set.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19335 a592a061-630c-0410-9148-cb99ea01b6c8
2007-08-06 14:17:43 +00:00
Enrico Forestieri
19b5ae4830 Use the internal function of the cygwin dll for syncing the
Windows environment.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19333 a592a061-630c-0410-9148-cb99ea01b6c8
2007-08-06 13:51:22 +00:00
Enrico Forestieri
76799eb493 Fix bug 3962 (by me, Peter, and Joost)
* src/support/os_cygwin.cpp
	* src/support/os_win32.cpp
	(addFontResources): use AddFontResourceEx on Windows version
	supporting this API in order to mark our fonts as private.
	(restoreFontResources): ditto with RemoveFontResourceEx.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@19038 a592a061-630c-0410-9148-cb99ea01b6c8
2007-07-11 11:57:58 +00:00
Lars Gullik Bjønnes
897436efbb Whitespace cleanup
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18550 a592a061-630c-0410-9148-cb99ea01b6c8
2007-05-28 22:27:45 +00:00
Bo Peng
f212b48335 Rename .C ==> .cpp for files in src/support, part two
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18025 a592a061-630c-0410-9148-cb99ea01b6c8
2007-04-26 05:13:44 +00:00