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