]> git.lyx.org Git - lyx.git/blob - src/main.C
Dekel's patch -- I didn't fix the xforms-0.88 keysyms stuff so it still doesn't finis...
[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 #ifdef GTKGUI
18 #    include <gnome--/main.h>
19 #    include "frontends/gnome/mainapp.h"
20 GLyxAppWin * mainAppWin;
21 #endif
22
23 #include FORMS_H_LOCATION
24
25 #include "lyx_main.h"
26 #include "gettext.h"
27 #include "LString.h"
28 #include "support/filetools.h"
29
30
31 // I keep these here so that it will be processed as early in
32 // the compilation process as possible.
33 #if !defined(FL_REVISION) || FL_REVISION < 88 || FL_VERSION != 0
34 #error LyX will not compile with this version of XForms.\
35        Please get version 0.89.\
36        If you want to try to compile anyway, delete this test in src/main.C.
37 #endif
38
39 using std::cerr;
40 using std::endl;
41
42 static int const xforms_include_version = FL_INCLUDE_VERSION;
43
44 int main(int argc, char * argv[])
45 {
46         // Check the XForms version in the forms.h header against
47         // the one in the libforms. If they don't match quit the
48         // execution of LyX. Better with a clean fast exit than
49         // a strange segfault later.
50         // I realize that this check have to be moved when we
51         // support several toolkits, but IMO all the toolkits
52         // should try to have the same kind of check. This could
53         // be done by having a CheckHeaderAndLib function in
54         // all the toolkit implementations, this function is
55         // responsible for notifing the user.
56         // if (!CheckHeaderAndLib()) {
57         //         // header vs. lib version failed
58         //         return 1;
59         // }
60         int xforms_lib_version = fl_library_version(0, 0);
61         if (xforms_include_version != xforms_lib_version) {
62                 cerr << "You are either running LyX with wrong "
63                         "version of a dynamic XForms library\n"
64                         "or you have build LyX with conflicting header "
65                         "and library (different\n"
66                         "versions of XForms. Sorry but there is no point "
67                         "in continuing executing LyX!" << endl;
68                 return 1;
69         }
70
71 #ifdef KDEGUI
72         KApplication a( argc, argv );
73 #endif
74 #ifdef GTKGUI
75         Gnome::Main  a(PACKAGE,VERSION,1,argv); //argc, argv );
76         GLyxAppWin   appWin;
77         mainAppWin = &appWin;
78 #endif
79         
80         // lyx_localedir is used by gettext_init() is we have
81         //   i18n support built-in
82         string lyx_localedir = GetEnvPath("LYX_LOCALEDIR");
83         if (lyx_localedir.empty())
84                 lyx_localedir = LOCALEDIR;
85         
86         // initialize for internationalized version *EK*
87         locale_init();
88         gettext_init();
89
90 #ifdef __EMX__
91         _wildcard(&argc, &argv);
92 #endif
93
94         LyX lyx(&argc, argv);
95         return 0; // SUCCESS
96 }