1 /* This file is part of
2 * ======================================================
4 * LyX, The Document Processor
6 * Copyright 2000-2001 The LyX Team.
8 *======================================================*/
12 #include FORMS_H_LOCATION
15 #pragma implementation
18 #include "GUIRunTime.h"
19 #include "XFormsView.h"
22 // I keep these here so that it will be processed as early in
23 // the compilation process as possible.
24 #if !defined(FL_REVISION) || FL_REVISION < 88 || FL_VERSION != 0
25 #error LyX will not compile with this version of XForms.\
26 Please get version 0.89.\
27 If you want to try to compile anyway, delete this test in src/frontends/xforms/GUIRunTime.C.
36 int const xforms_include_version = FL_INCLUDE_VERSION;
41 int GUIRunTime::initApplication(int , char **)
43 // Check the XForms version in the forms.h header against
44 // the one in the libforms. If they don't match quit the
45 // execution of LyX. Better with a clean fast exit than
46 // a strange segfault later.
47 // I realize that this check have to be moved when we
48 // support several toolkits, but IMO all the toolkits
49 // should try to have the same kind of check. This could
50 // be done by having a CheckHeaderAndLib function in
51 // all the toolkit implementations, this function is
52 // responsible for notifing the user.
53 // if (!CheckHeaderAndLib()) {
54 // // header vs. lib version failed
57 int xforms_lib_version = fl_library_version(0, 0);
58 if (xforms_include_version != xforms_lib_version) {
59 lyxerr << "You are either running LyX with wrong "
60 "version of a dynamic XForms library\n"
61 "or you have build LyX with conflicting header "
62 "and library (different\n"
63 "versions of XForms. Sorry but there is no point "
64 "in continuing executing LyX!" << endl;
71 void GUIRunTime::processEvents()
75 if (fl_do_forms() == FL_EVENT) {
76 lyxerr << "LyX: This shouldn't happen..." << endl;
82 void GUIRunTime::runTime()
86 if (fl_check_forms() == FL_EVENT) {
87 lyxerr << "LyX: This shouldn't happen..." << endl;
94 void GUIRunTime::setDefaults()
97 cntl.buttonFontSize = FL_NORMAL_SIZE;
98 cntl.browserFontSize = FL_NORMAL_SIZE;
99 cntl.labelFontSize = FL_NORMAL_SIZE;
100 cntl.choiceFontSize = FL_NORMAL_SIZE;
101 cntl.inputFontSize = FL_NORMAL_SIZE;
102 cntl.menuFontSize = FL_NORMAL_SIZE;
103 cntl.borderWidth = -1;
104 cntl.vclass = FL_DefaultVisual;
105 fl_set_defaults(FL_PDVisual
106 | FL_PDButtonFontSize
107 | FL_PDBrowserFontSize
109 | FL_PDChoiceFontSize
112 | FL_PDBorderWidth, &cntl);
116 LyXView * GUIRunTime::createMainView(int w, int h)
118 return new XFormsView(w, h);
122 Display * GUIRunTime::x11Display()
124 return fl_get_display();
128 int GUIRunTime::x11Screen()
134 Colormap GUIRunTime::x11Colormap()
136 return fl_state[fl_get_vclass()].colormap;
140 int GUIRunTime::x11VisualDepth()
142 return fl_get_visual_depth();