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