]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/GUIRunTime.C
implement getLabelList
[lyx.git] / src / frontends / xforms / GUIRunTime.C
1 /* This file is part of
2  * ======================================================
3  * 
4  *           LyX, The Document Processor
5  *       
6  *           Copyright 2000 The LyX Team.
7  *
8  *======================================================*/
9
10 #include <config.h>
11
12 #include FORMS_H_LOCATION
13
14 #ifdef __GNUG__
15 #pragma implementation
16 #endif
17
18 #include "GUIRunTime.h"
19 #include "debug.h"
20
21 // I keep these here so that it will be processed as early in
22 // the compilation process as possible.
23 #if !defined(FL_REVISION) || FL_REVISION < 88 || FL_VERSION != 0
24 #error LyX will not compile with this version of XForms.\
25        Please get version 0.89.\
26        If you want to try to compile anyway, delete this test in src/frontends/xforms/GUIRunTime.C.
27 #endif
28
29 using std::endl;
30
31 extern bool finished;
32
33 namespace {
34
35 int const xforms_include_version = FL_INCLUDE_VERSION;
36
37 } // namespace anon
38
39
40 int GUIRunTime::initApplication(int , char **)
41 {
42         // Check the XForms version in the forms.h header against
43         // the one in the libforms. If they don't match quit the
44         // execution of LyX. Better with a clean fast exit than
45         // a strange segfault later.
46         // I realize that this check have to be moved when we
47         // support several toolkits, but IMO all the toolkits
48         // should try to have the same kind of check. This could
49         // be done by having a CheckHeaderAndLib function in
50         // all the toolkit implementations, this function is
51         // responsible for notifing the user.
52         // if (!CheckHeaderAndLib()) {
53         //         // header vs. lib version failed
54         //         return 1;
55         // }
56         int xforms_lib_version = fl_library_version(0, 0);
57         if (xforms_include_version != xforms_lib_version) {
58                 lyxerr << "You are either running LyX with wrong "
59                         "version of a dynamic XForms library\n"
60                         "or you have build LyX with conflicting header "
61                         "and library (different\n"
62                         "versions of XForms. Sorry but there is no point "
63                         "in continuing executing LyX!" << endl;
64                 return 1;
65         }
66         return 0;
67 }
68
69
70 void GUIRunTime::processEvents() 
71 {
72         XEvent ev;
73
74         if (fl_do_forms() == FL_EVENT) {
75                 lyxerr << "LyX: This shouldn't happen..." << endl;
76                 fl_XNextEvent(&ev);
77         }
78 }
79
80
81 void GUIRunTime::runTime()
82 {
83         XEvent ev;
84         while (!finished) {
85                 if (fl_check_forms() == FL_EVENT) {
86                         lyxerr << "LyX: This shouldn't happen..." << endl;
87                         fl_XNextEvent(&ev);
88                 }
89         }
90 }
91
92
93 void GUIRunTime::setDefaults()
94 {
95         FL_IOPT cntl;
96         cntl.buttonFontSize = FL_NORMAL_SIZE;
97         cntl.browserFontSize = FL_NORMAL_SIZE;
98         cntl.labelFontSize = FL_NORMAL_SIZE;
99         cntl.choiceFontSize = FL_NORMAL_SIZE;
100         cntl.inputFontSize = FL_NORMAL_SIZE;
101         cntl.menuFontSize  = FL_NORMAL_SIZE;
102         cntl.borderWidth = -1;
103         cntl.vclass = FL_DefaultVisual;
104         fl_set_defaults(FL_PDVisual
105                         | FL_PDButtonFontSize
106                         | FL_PDBrowserFontSize
107                         | FL_PDLabelFontSize
108                         | FL_PDChoiceFontSize
109                         | FL_PDInputFontSize
110                         | FL_PDMenuFontSize
111                         | FL_PDBorderWidth, &cntl);
112 }