1 /* This file is part of
2 * ======================================================
4 * LyX, The Document Processor
6 * Copyright 2000 The LyX Team.
8 *======================================================*/
13 #pragma implementation
16 #include FORMS_H_LOCATION
18 #include "GUIRunTime.h"
21 #include <gnome--/main.h>
23 #include <glade/glade.h>
27 // I keep these here so that it will be processed as early in
28 // the compilation process as possible.
29 #if !defined(FL_REVISION) || FL_REVISION < 88 || FL_VERSION != 0
30 #error LyX will not compile with this version of XForms.\
31 Please get version 0.89.\
32 If you want to try to compile anyway, delete this test in src/frontends/gnome/GUIRunTime.C.
39 int const xforms_include_version = FL_INCLUDE_VERSION;
43 GLyxAppWin * mainAppWin;
45 int GUIRunTime::initApplication(int, char * argv[])
47 // Check the XForms version in the forms.h header against
48 // the one in the libforms. If they don't match quit the
49 // execution of LyX. Better with a clean fast exit than
50 // a strange segfault later.
51 // I realize that this check have to be moved when we
52 // support several toolkits, but IMO all the toolkits
53 // should try to have the same kind of check. This could
54 // be done by having a CheckHeaderAndLib function in
55 // all the toolkit implementations, this function is
56 // responsible for notifing the user.
57 // if (!CheckHeaderAndLib()) {
58 // // header vs. lib version failed
61 int xforms_lib_version = fl_library_version(0, 0);
62 if (xforms_include_version != xforms_lib_version) {
63 cerr << "You are either running LyX with wrong "
64 "version of a dynamic XForms library\n"
65 "or you have build LyX with conflicting header "
66 "and library (different\n"
67 "versions of XForms. Sorry but there is no point "
68 "in continuing executing LyX!" << endl;
72 // I belive that this should be done at a later stage, in
73 // lyx_gui, the same place as xforms does the same. (Lgb)
74 string app_id(PACKAGE);
75 string app_version(VERSION);
76 static Gnome::Main a(app_id, app_version, 1, argv);
77 glade_gnome_init(); // Initialize the glade library.
78 static GLyxAppWin appWin;
84 void GUIRunTime::processEvents()
86 while(Gnome::Main::instance()->events_pending())
87 Gnome::Main::instance()->iteration(FALSE);
91 void GUIRunTime::runTime()
96 if (fl_check_forms() == FL_EVENT) {
97 lyxerr << "LyX: This shouldn't happen..." << endl;
104 void GUIRunTime::setDefaults()
107 cntl.buttonFontSize = FL_NORMAL_SIZE;
108 cntl.browserFontSize = FL_NORMAL_SIZE;
109 cntl.labelFontSize = FL_NORMAL_SIZE;
110 cntl.choiceFontSize = FL_NORMAL_SIZE;
111 cntl.inputFontSize = FL_NORMAL_SIZE;
112 cntl.menuFontSize = FL_NORMAL_SIZE;
113 cntl.borderWidth = -1;
114 cntl.vclass = FL_DefaultVisual;
115 fl_set_defaults(FL_PDVisual
116 | FL_PDButtonFontSize
117 | FL_PDBrowserFontSize
119 | FL_PDChoiceFontSize
122 | FL_PDBorderWidth, &cntl);