]> git.lyx.org Git - lyx.git/blob - src/main.C
FILMagain changes (will need some work)
[lyx.git] / src / main.C
1 /* This file is part of
2  * ====================================================== 
3  * 
4  *           LyX, The Document Processor
5  *       
6  *          Copyright 1995 Matthias Ettrich
7  *          Copyright 1995-2000 The LyX Team.
8  *
9  * ====================================================== */
10
11 #include <config.h>
12 #include <iostream>
13
14 #ifdef KDEGUI
15 #    include <kapp.h>
16 #endif
17 #include FORMS_H_LOCATION
18
19 #include "lyx_main.h"
20 #include "gettext.h"
21 #include "LString.h"
22 #include "support/filetools.h"
23
24 // I keep these here so that it will be processed as early in
25 // the compilation process as possible.
26 #if !defined(FL_REVISION) || FL_REVISION < 88 || FL_VERSION != 0
27 #error LyX will not compile with this version of XForms.\
28        Please get version 0.89.\
29        If you want to try to compile anyway, delete this test in src/main.C.
30 #endif
31
32 using std::cerr;
33 using std::endl;
34
35 static int const xforms_include_version = FL_INCLUDE_VERSION;
36
37 int main(int argc, char * argv[])
38 {
39         // Check the XForms version in the forms.h header against
40         // the one in the libforms. If they don't match quit the
41         // execution of LyX. Better with a clean fast exit than
42         // a strange segfault later.
43         // I realize that this check have to be moved when we
44         // support several toolkits, but IMO all the toolkits
45         // should try to have the same kind of check. This could
46         // be done by having a CheckHeaderAndLib function in
47         // all the toolkit implementations, this function is
48         // responsible for notifing the user.
49         // if (!CheckHeaderAndLib()) {
50         //         // header vs. lib version failed
51         //         return 1;
52         // }
53         int xforms_lib_version = fl_library_version(0, 0);
54         if (xforms_include_version != xforms_lib_version) {
55                 cerr << "You are either running LyX with wrong "
56                         "version of a dynamic XForms library\n"
57                         "or you have build LyX with conflicting header "
58                         "and library (different\n"
59                         "versions of XForms. Sorry but there is no point "
60                         "in continuing executing LyX!" << endl;
61                 return 1;
62         }
63
64 #ifdef KDEGUI
65         KApplication a( argc, argv );
66 #endif
67
68         // lyx_localedir is used by gettext_init() is we have
69         //   i18n support built-in
70         string lyx_localedir = GetEnvPath("LYX_LOCALEDIR");
71         if (lyx_localedir.empty())
72                 lyx_localedir = LOCALEDIR;
73         
74         // initialize for internationalized version *EK*
75         locale_init();
76         gettext_init();
77
78 #ifdef __EMX__
79         _wildcard(&argc, &argv);
80 #endif
81
82         LyX lyx(&argc, argv);
83         return 0; // SUCCESS
84 }