]> git.lyx.org Git - lyx.git/blob - src/lyx_gui.C
Marko's GNOME patch and Baruch's insetgraphic patch + some fixes to make all
[lyx.git] / src / lyx_gui.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 <cstdlib>
13
14 #ifdef __GNUG__
15 #pragma implementation
16 #endif
17
18 #ifdef KDEGUI
19 #    include <kapp.h>
20 #endif
21
22 #ifdef GTKGUI
23 #    include <gnome--/main.h>
24 #endif
25
26 #include <fcntl.h>
27 #include "lyx_gui.h"
28 #include FORMS_H_LOCATION
29 #include "support/filetools.h"
30 #include "combox.h"
31 #include "lyx.h"
32 #include "form1.h"
33 #include "layout_forms.h"
34 #include "print_form.h"
35 #include "tex-strings.h"
36 #include "lyx_main.h"
37 #include "log_form.h"
38 #include "debug.h"
39 #include "version.h"
40 #include "LyXView.h"
41 #include "buffer.h"
42 #include "lyxserver.h"
43 #include "lyxrc.h"
44 #include "gettext.h"
45 #include "lyx_gui_misc.h"
46 #include "lyxlookup.h"
47 #include "bufferlist.h"
48 #include "language.h"
49 #include "ColorHandler.h"
50
51 using std::endl;
52
53 FD_form_title * fd_form_title;
54 FD_form_paragraph * fd_form_paragraph;
55 FD_form_paragraph_extra * fd_form_paragraph_extra;
56 FD_form_character * fd_form_character;
57 FD_form_document * fd_form_document;
58 FD_form_paper * fd_form_paper;
59 FD_form_table_options * fd_form_table_options;
60 FD_form_table_extra * fd_form_table_extra;
61 FD_form_quotes * fd_form_quotes;
62 FD_form_preamble * fd_form_preamble;
63 FD_form_table * fd_form_table;
64 FD_form_sendto * fd_form_sendto;
65 FD_form_figure * fd_form_figure;
66 FD_LaTeXLog * fd_latex_log; // from log_form.h
67 Combox * combo_language;
68 Combox * combo_language2;
69
70 extern LyXServer * lyxserver;
71 extern bool finished;   // flag, that we are quitting the program
72 extern BufferList bufferlist;
73
74 FL_CMD_OPT cmdopt[] =
75 {
76         {"-geometry", "*.geometry", XrmoptionSepArg, "690x510"}
77 };
78
79 static int width  = 690;
80 static int height = 510;
81 static int xpos   = -1;
82 static int ypos   = -1;
83 static char geometry[40];
84 bool       cursor_follows_scrollbar;
85
86
87 FL_resource res[] =
88 {
89         {"geometry", "geometryClass", FL_STRING, geometry, "", 40}
90 };
91
92
93 extern "C" int LyX_XErrHandler(Display * display, XErrorEvent * xeev)
94 {
95 //#warning Please see if you can trigger this!
96         // emergency save
97         if (!bufferlist.empty())
98                 bufferlist.emergencyWriteAll();
99
100         // Get the reason for the crash.
101         char etxt[513];
102         XGetErrorText(display, xeev->error_code, etxt, 512);
103         lyxerr << etxt << endl;
104         // By doing an abort we get a nice backtrace. (hopefully)
105         lyx::abort();
106         return 0; // Solaris CC wants us to return something
107 }
108
109
110 LyXGUI::LyXGUI(LyX * owner, int * argc, char * argv[], bool GUI)
111   : _owner(owner), lyxViews(0)
112 {
113         gui = GUI;
114         if (!gui)
115                 return;
116
117         setDefaults();
118         
119         static const int num_res = sizeof(res)/sizeof(FL_resource);
120         fl_initialize(argc, argv, "LyX", cmdopt, num_res);
121         fl_get_app_resources(res, num_res);
122
123         static const int geometryBitmask = XParseGeometry( geometry,
124                                                            &xpos,
125                                                            &ypos,
126                                                            (unsigned int *) &width,
127                                                            (unsigned int *) &height
128                                                          );
129
130         Display * display = fl_get_display();
131         if (!display) {
132                 lyxerr << "LyX: unable to access X display, exiting" << endl;
133                 exit(1);
134         }
135         fcntl(ConnectionNumber(display), F_SETFD, FD_CLOEXEC);
136         // X Error handler install goes here
137         XSetErrorHandler(LyX_XErrHandler);
138
139         // A width less than 590 pops up an awkward main window
140         // The minimal values of width/height (590/400) are defined in
141         // src/lyx.C  
142         if (width < 590) width = 590;
143         if (height < 400) height = 400;
144         
145         // If width is not set by geometry, check it against monitor width
146         if ( !(geometryBitmask & 4) ) {
147                 Screen * scr = DefaultScreenOfDisplay(fl_get_display());
148                 if (WidthOfScreen(scr) - 8 < width)
149                         width = WidthOfScreen(scr) - 8;
150         }
151
152         // If height is not set by geometry, check it against monitor height
153         if ( !(geometryBitmask & 8) ) {
154                 Screen * scr = DefaultScreenOfDisplay(fl_get_display());
155                 if (HeightOfScreen(scr) - 24 < height)
156                         height = HeightOfScreen(scr) - 24;
157         }
158
159         // Recalculate xpos if it's negative
160         if (geometryBitmask & 16)
161                 xpos += WidthOfScreen(DefaultScreenOfDisplay(fl_get_display())) - width;
162
163         // Recalculate ypos if it's negative
164         if (geometryBitmask & 32)
165                 ypos += HeightOfScreen(DefaultScreenOfDisplay(fl_get_display())) - height;
166
167         // Initialize the LyXColorHandler
168         lyxColorHandler = new LyXColorHandler;
169 }
170
171
172 // A destructor is always necessary  (asierra-970604)
173 LyXGUI::~LyXGUI()
174 {
175         // Lyxserver was created in this class so should be destroyed
176         // here.  asierra-970604
177         delete lyxserver;
178         lyxserver = 0;
179         delete lyxViews;
180         lyxViews = 0;
181
182         CloseLyXLookup();
183 }
184
185
186 void LyXGUI::setDefaults()
187 {
188         FL_IOPT cntl;
189         cntl.buttonFontSize = FL_NORMAL_SIZE;
190         cntl.browserFontSize = FL_NORMAL_SIZE;
191         cntl.labelFontSize = FL_NORMAL_SIZE;
192         cntl.choiceFontSize = FL_NORMAL_SIZE;
193         cntl.inputFontSize = FL_NORMAL_SIZE;
194         cntl.menuFontSize  = FL_NORMAL_SIZE;
195         cntl.borderWidth = -1;
196         cntl.vclass = FL_DefaultVisual;
197         fl_set_defaults(FL_PDVisual
198                         | FL_PDButtonFontSize
199                         | FL_PDBrowserFontSize
200                         | FL_PDLabelFontSize
201                         | FL_PDChoiceFontSize
202                         | FL_PDInputFontSize
203                         | FL_PDMenuFontSize
204                         | FL_PDBorderWidth, &cntl);
205 }
206
207
208 // This is called after we have parsed lyxrc
209 void LyXGUI::init()
210 {
211         if (!gui)
212                 return;
213
214         create_forms();
215
216         if (lyxrc.font_norm_menu.empty())
217                 lyxrc.font_norm_menu = lyxrc.font_norm;
218         // Set the font name for popups and menus
219         string menufontname = lyxrc.menu_font_name 
220                                + "-*-*-*-?-*-*-*-*-"  
221                                + lyxrc.font_norm_menu;
222                 // "?" means "scale that font"
223         string popupfontname = lyxrc.popup_font_name 
224                                + "-*-*-*-?-*-*-*-*-"  
225                                + lyxrc.font_norm_menu;
226
227         int bold = fl_set_font_name(FL_BOLD_STYLE, menufontname.c_str());
228         int normal = fl_set_font_name(FL_NORMAL_STYLE, popupfontname.c_str());
229         if (bold < 0)
230                 lyxerr << "Could not set menu font to "
231                        << menufontname << endl;
232
233         if (normal < 0)
234                 lyxerr << "Could not set popup font to "
235                        << popupfontname << endl;
236
237         if (bold < 0 && normal < 0) {
238                 lyxerr << "Using 'helvetica' font for menus" << endl;
239                 bold = fl_set_font_name(FL_BOLD_STYLE,
240                                         "-*-helvetica-bold-r-*-*-*-?-*-*-*-*-iso8859-1");
241                 normal = fl_set_font_name(FL_NORMAL_STYLE,
242                                           "-*-helvetica-medium-r-*-*-*-?-*-*-*-*-iso8859-1");
243                 if (bold < 0 && normal < 0) {
244                         lyxerr << "Could not find helvetica font. Using 'fixed'." << endl;
245                         normal = fl_set_font_name(FL_NORMAL_STYLE, "fixed");
246                 }
247         }
248
249         // put here (after fl_initialize) to avoid segfault. Cannot be done
250         // in setDefaults() (Matthias 140496)
251         // Moved from ::LyXGUI to ::init to allow popup font customization 
252         // (petr 120997).
253         fl_setpup_fontstyle(FL_NORMAL_STYLE);
254         fl_setpup_fontsize(FL_NORMAL_SIZE);
255         fl_setpup_color(FL_MCOL, FL_BLACK);
256         fl_set_goodies_font(FL_NORMAL_STYLE, FL_NORMAL_SIZE);
257
258         // all lyxrc settings has to be done here as lyxrc has not yet
259         // been read when the GUI is created (Jug)
260
261         // the sendto form
262         if (!lyxrc.custom_export_command.empty())
263                 fl_set_input(fd_form_sendto->input_cmd,
264                              lyxrc.custom_export_command.c_str());
265         if (lyxrc.custom_export_format == "lyx")
266                 fl_set_button(fd_form_sendto->radio_ftype_lyx, 1);
267         else if (lyxrc.custom_export_format == "tex")
268                 fl_set_button(fd_form_sendto->radio_ftype_latex, 1);
269         else if (lyxrc.custom_export_format == "dvi")
270                 fl_set_button(fd_form_sendto->radio_ftype_dvi, 1);
271         else if (lyxrc.custom_export_format == "ps")
272                 fl_set_button(fd_form_sendto->radio_ftype_ps, 1);
273         else if (lyxrc.custom_export_format == "ascii")
274                 fl_set_button(fd_form_sendto->radio_ftype_ascii, 1);
275
276         // Update parameters.
277         lyxViews->redraw();
278
279         // Initialize the views.
280         lyxViews->init();
281
282         // in 0.12 the initialisation of the LyXServer must be done here
283         // 0.13 it should be moved again...
284         lyxserver = new LyXServer(lyxViews->getLyXFunc(), lyxrc.lyxpipes);
285 }
286
287
288 void LyXGUI::create_forms()
289 {
290         lyxerr[Debug::INIT] << "Initializing LyXView..." << endl;
291         lyxViews = new LyXView(width, height);
292         lyxerr[Debug::INIT] << "Initializing LyXView...done" << endl;
293
294         // From here down should be done by somebody else. (Lgb)
295
296         //
297         // Create forms
298         //
299
300         // the title form
301         string banner_file = LibFileSearch("images", "banner", "xpm");
302         if (lyxrc.show_banner && !banner_file.empty()) {
303                 fd_form_title = create_form_form_title();
304                 fl_set_form_dblbuffer(fd_form_title->form_title, 1); // use dbl buffer
305                 fl_set_form_atclose(fd_form_title->form_title, CancelCloseBoxCB, 0);
306                 fl_addto_form(fd_form_title->form_title);
307                 FL_OBJECT *obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON, 0, 0, 425, 290, "");
308                 fl_set_pixmapbutton_file(obj, banner_file.c_str());
309                 
310                 fl_set_pixmapbutton_focus_outline(obj, 3);
311                 fl_set_button_shortcut(obj, "^M ^[", 1);
312                 fl_set_object_boxtype(obj, FL_NO_BOX);
313                 fl_set_object_callback(obj, TimerCB, 0);
314                 
315                 obj = fl_add_text(FL_NORMAL_TEXT, 248, 265, 170, 16, LYX_VERSION);
316                 fl_set_object_lsize(obj, FL_NORMAL_SIZE);
317                 fl_mapcolor(FL_FREE_COL2, 0x05, 0x2e, 0x4c);
318                 fl_mapcolor(FL_FREE_COL3, 0xe1, 0xd2, 0x9b);
319                 fl_set_object_color(obj, FL_FREE_COL2, FL_FREE_COL2);
320                 fl_set_object_lcol(obj, FL_FREE_COL3);
321                 fl_set_object_lalign(obj, FL_ALIGN_CENTER|FL_ALIGN_INSIDE);
322                 fl_set_object_lstyle(obj, FL_BOLD_STYLE);
323                 fl_end_form();
324         }
325         
326         // the paragraph form
327         fd_form_paragraph = create_form_form_paragraph();
328         fl_set_form_atclose(fd_form_paragraph->form_paragraph,
329                             CancelCloseBoxCB, 0);
330         fl_addto_choice(fd_form_paragraph->choice_space_above,
331                         _(" None | Defskip | Smallskip "
332                         "| Medskip | Bigskip | VFill | Length "));
333         fl_addto_choice(fd_form_paragraph->choice_space_below,
334                         _(" None | Defskip | Smallskip "
335                         "| Medskip | Bigskip | VFill | Length ")); 
336         fl_set_input_return(fd_form_paragraph->input_space_above,
337                             FL_RETURN_ALWAYS);
338         fl_set_input_return(fd_form_paragraph->input_space_below,
339                             FL_RETURN_ALWAYS);
340
341         // the paragraph extra form
342         fd_form_paragraph_extra = create_form_form_paragraph_extra();
343         fl_set_form_atclose(fd_form_paragraph_extra->form_paragraph_extra,
344                             CancelCloseBoxCB, 0);
345         fl_set_input_return(fd_form_paragraph_extra->input_pextra_width,
346                             FL_RETURN_ALWAYS);
347         fl_set_input_return(fd_form_paragraph_extra->input_pextra_widthp,
348                             FL_RETURN_ALWAYS);
349         lyxerr[Debug::INIT] << "Initializing form_paragraph...done" << endl;
350
351         // the character form
352         fd_form_character = create_form_form_character();
353         fl_set_form_atclose(fd_form_character->form_character,
354                             CancelCloseBoxCB, 0);
355         fl_addto_choice(fd_form_character->choice_family, 
356                         _(" No change %l| Roman | Sans Serif | Typewriter %l| Reset "));
357         fl_addto_choice(fd_form_character->choice_series, 
358                         _(" No change %l| Medium | Bold %l| Reset "));
359         fl_addto_choice(fd_form_character->choice_shape,
360                         _(" No change %l| Upright | Italic | Slanted | Small Caps "
361                         "%l| Reset "));
362         fl_addto_choice(fd_form_character->choice_size, 
363                         _(" No change %l| Tiny | Smallest | Smaller | Small "
364                         "| Normal | Large | Larger | Largest | Huge | Huger "
365                         "%l| Increase | Decrease | Reset "));
366         fl_addto_choice(fd_form_character->choice_bar, 
367                         _(" No change %l| Emph | Underbar | Noun | LaTeX mode %l| Reset "));
368         fl_addto_choice(fd_form_character->choice_color, 
369                         _(" No change %l| No color | Black | White | Red | Green "
370                         "| Blue | Cyan | Magenta | Yellow %l| Reset "));
371         fl_set_form_minsize(fd_form_character->form_character,
372                             fd_form_character->form_character->w,
373                             fd_form_character->form_character->h);
374         lyxerr[Debug::INIT] << "Initializing form_character::combox..." << endl;
375         fl_addto_form(fd_form_character->form_character);
376         combo_language2 = new Combox(FL_COMBOX_DROPLIST);
377         FL_OBJECT * ob = fd_form_character->choice_language;
378         combo_language2->add(ob->x, ob->y, ob->w, ob->h, 250);
379         combo_language2->shortcut("#L", 1);
380         fl_end_form();
381         lyxerr[Debug::INIT] << "Initializing form_character...done" << endl;
382
383         // the document form
384         fd_form_document = create_form_form_document();
385         fl_set_form_atclose(fd_form_document->form_document,
386                             CancelCloseBoxCB, 0);
387         fl_addto_choice(fd_form_document->choice_spacing,
388                         _(" Single | OneHalf | Double | Other "));
389
390         fl_set_counter_bounds(fd_form_document->slider_secnumdepth,-2, 5);
391         fl_set_counter_bounds(fd_form_document->slider_tocdepth,-1, 5);
392         fl_set_counter_step(fd_form_document->slider_secnumdepth, 1, 1);
393         fl_set_counter_step(fd_form_document->slider_tocdepth, 1, 1);
394         fl_set_counter_precision(fd_form_document->slider_secnumdepth, 0);
395         fl_set_counter_precision(fd_form_document->slider_tocdepth, 0);
396         fl_addto_form(fd_form_document->form_document);
397         combo_language = new Combox(FL_COMBOX_DROPLIST);
398         ob = fd_form_document->choice_language;
399         combo_language->add(ob->x, ob->y, ob->w, ob->h, 250);
400         combo_language->shortcut("#G", 1);
401         fl_end_form();
402
403         // "default" is not part of the languages array any more.
404         combo_language->addto("default");
405         combo_language2->addto(_("No change"));
406         combo_language2->addto(_("Reset"));
407         for(Languages::const_iterator cit = languages.begin();
408             cit != languages.end(); ++cit) {
409                 combo_language->addto((*cit).second.lang().c_str());
410                 combo_language2->addto((*cit).second.lang().c_str());
411         }
412         combo_language2->select_text("No change");
413
414         // not really necessary, but we can do it anyway.
415         fl_addto_choice(fd_form_document->choice_fontsize, "default|10|11|12");
416         int n;
417         for (n = 0; tex_fonts[n][0]; ++n) {
418             fl_addto_choice(fd_form_document->choice_fonts, tex_fonts[n]);
419         }
420
421         fl_addto_choice(fd_form_document->choice_inputenc,
422                         "default|auto|latin1|latin2|latin5"
423                         "|koi8-r|koi8-u|cp866|cp1251|iso88595");
424
425         for (n = 0; tex_graphics[n][0]; ++n) {
426             fl_addto_choice(fd_form_document->choice_postscript_driver,
427                                         tex_graphics[n]);
428         }
429         // not really necessary, but we can do it anyway.
430         fl_addto_choice(fd_form_document->choice_pagestyle,
431                         "default|empty|plain|headings|fancy");
432         fl_addto_choice(fd_form_document->choice_default_skip,
433                         _(" Smallskip | Medskip | Bigskip | Length "));
434         fl_set_input_return(fd_form_document->input_default_skip,
435                             FL_RETURN_ALWAYS);
436         fl_set_form_minsize(fd_form_document->form_document,
437                             fd_form_document->form_document->w,
438                             fd_form_document->form_document->h);
439         lyxerr[Debug::INIT] << "Initializing form_document...done" << endl;
440
441         // the paper form
442         fd_form_paper = create_form_form_paper();
443         fl_set_form_atclose(fd_form_paper->form_paper,
444                             CancelCloseBoxCB, 0);
445         fl_addto_choice(fd_form_paper->choice_papersize2,
446                         _(" Default | Custom | USletter | USlegal "
447                         "| USexecutive | A3 | A4 | A5 | B3 | B4 | B5 "));
448         fl_addto_choice(fd_form_paper->choice_paperpackage,
449                         _(" None "
450                         "| A4 small Margins (only portrait) "
451                         "| A4 very small Margins (only portrait) "
452                         "| A4 very wide margins (only portrait) "));
453         fl_set_input_return(fd_form_paper->input_custom_width,
454                             FL_RETURN_ALWAYS);
455         fl_set_input_return(fd_form_paper->input_custom_height,
456                             FL_RETURN_ALWAYS);
457         fl_set_input_return(fd_form_paper->input_top_margin,
458                             FL_RETURN_ALWAYS);
459         fl_set_input_return(fd_form_paper->input_bottom_margin,
460                             FL_RETURN_ALWAYS);
461         fl_set_input_return(fd_form_paper->input_left_margin,
462                             FL_RETURN_ALWAYS);
463         fl_set_input_return(fd_form_paper->input_right_margin,
464                             FL_RETURN_ALWAYS);
465         fl_set_input_return(fd_form_paper->input_head_height,
466                             FL_RETURN_ALWAYS);
467         fl_set_input_return(fd_form_paper->input_head_sep,
468                             FL_RETURN_ALWAYS);
469         fl_set_input_return(fd_form_paper->input_foot_skip,
470                             FL_RETURN_ALWAYS);
471         lyxerr[Debug::INIT] << "Initializing form_paper...done" << endl;
472
473         // the table_options form
474         fd_form_table_options = create_form_form_table_options();
475         fl_set_form_atclose(fd_form_table_options->form_table_options,
476                             CancelCloseBoxCB, 0);
477         fl_set_input_return(fd_form_table_options->input_column_width,
478                             FL_RETURN_ALWAYS);
479
480         // the table_extra form
481         fd_form_table_extra = create_form_form_table_extra();
482         fl_set_form_atclose(fd_form_table_extra->form_table_extra,
483                             CancelCloseBoxCB, 0);
484         fl_set_input_return(fd_form_table_extra->input_special_alignment,
485                             FL_RETURN_ALWAYS);
486         fl_set_input_return(fd_form_table_extra->input_special_multialign,
487                             FL_RETURN_ALWAYS);
488         lyxerr[Debug::INIT] << "Initializing form_table_extra...done" << endl;
489
490         // the quotes form
491         fd_form_quotes = create_form_form_quotes();
492         fl_set_form_atclose(fd_form_quotes->form_quotes,
493                             CancelCloseBoxCB, 0);
494         // Is it wrong of me to use « » instead of << >> ? (Lgb)
495         // Maybe if people use a font other than latin1... (JMarc)
496         fl_addto_choice(fd_form_quotes->choice_quotes_language,
497                         _(" ``text'' | ''text'' | ,,text`` | ,,text'' | «text» | »text« "));
498
499         // the preamble form
500         fd_form_preamble = create_form_form_preamble();
501         fl_set_form_atclose(fd_form_preamble->form_preamble,
502                             CancelCloseBoxCB, 0);
503
504 #ifndef NEW_TABULAR
505         // the table form
506         fd_form_table = create_form_form_table();
507         fl_set_form_atclose(fd_form_table->form_table, CancelCloseBoxCB, 0);
508         fl_set_slider_bounds(fd_form_table->slider_rows, 1, 50);
509         fl_set_slider_bounds(fd_form_table->slider_columns, 1, 50);
510         fl_set_slider_value(fd_form_table->slider_rows, 5);
511         fl_set_slider_value(fd_form_table->slider_columns, 5);
512         fl_set_slider_precision(fd_form_table->slider_rows, 0);
513         fl_set_slider_precision(fd_form_table->slider_columns, 0);
514         lyxerr[Debug::INIT] << "Initializing form_table...done" << endl;
515 #endif
516
517         // the sendto form
518         fd_form_sendto = create_form_form_sendto();
519         fl_set_form_atclose(fd_form_sendto->form_sendto, CancelCloseBoxCB, 0);
520
521         // the figure form
522         fd_form_figure = create_form_form_figure();
523         fl_set_form_atclose(fd_form_figure->form_figure,
524                             CancelCloseBoxCB, 0);
525         fl_set_button(fd_form_figure->radio_postscript, 1);
526
527         // the latex log form
528         fd_latex_log = create_form_LaTeXLog();
529         fl_set_form_atclose(fd_latex_log->LaTeXLog,
530                             CancelCloseBoxCB, 0);
531
532         // Show the main & title form
533         int main_placement = FL_PLACE_CENTER | FL_FREE_SIZE;
534         int title_placement = FL_PLACE_CENTER;
535         // Did we get a valid position?
536         if (xpos>= 0 && ypos>= 0) {
537                 lyxViews->setPosition(xpos, ypos);
538                 if (lyxrc.show_banner) {
539                         // show the title form in the middle of the main form
540                         fl_set_form_position(fd_form_title->form_title,
541                                              abs(xpos + (width/2) - (370 / 2)),
542                                              abs(ypos + (height/2) - (290 / 2)));
543                         title_placement = FL_PLACE_GEOMETRY;
544                         // The use of abs() above is a trick to ensure
545                         // valid positions
546                 }
547                         main_placement = FL_PLACE_POSITION;
548         }
549         lyxViews->show(main_placement, FL_FULLBORDER, "LyX");
550         if (lyxrc.show_banner) {
551                 fl_show_form(fd_form_title->form_title, 
552                              title_placement, FL_NOBORDER, 
553                              _("LyX Banner"));
554                 fl_redraw_form(fd_form_title->form_title);
555                 fl_raise_form(fd_form_title->form_title);
556
557                 // Show the title form at most 7 secs (lowered from 10 secs)
558                 fl_set_timer(fd_form_title->timer_title, 7);
559         }
560 }
561
562
563 void LyXGUI::runTime()
564         /* This will usually be toolkit (GUI) specific. This is
565          * also usually the XEvent dispatcher of the GUI. */
566 {
567         if (!gui)
568                 return;
569
570         // XForms specific
571         XEvent ev;
572
573         while (!finished) {
574 #ifdef KDEGUI
575                 kapp->processEvents();
576 #endif
577 #ifdef GTKGUI
578                 while(Gnome::Main::instance()->events_pending()) Gnome::Main::instance()->iteration(FALSE);
579 #endif
580                 
581                 if (fl_check_forms() == FL_EVENT) {
582                         lyxerr << "LyX: This shouldn't happen..." << endl;
583                         fl_XNextEvent(&ev);
584                 }
585         }
586 }
587
588
589 void LyXGUI::regBuf(Buffer * b)
590 {
591         lyxViews->view()->buffer(b);
592 }
593
594 LyXView * LyXGUI::getLyXView() const
595 {
596         return lyxViews;
597 }