-#else
- fl_set_timer(form_main_->timer_autosave, lyxrc.autosave);
-#endif
-}
-
-
-// Callback for close main form from window manager
-int LyXView::atCloseMainFormCB(FL_FORM *, void *)
-{
- QuitLyX();
- return FL_IGNORE;
-}
-
-
-// Wrapper for the above
-extern "C" int C_LyXView_atCloseMainFormCB(FL_FORM * form, void * p)
-{
- return LyXView::atCloseMainFormCB(form, p);
-}
-
-
-void LyXView::setPosition(int x, int y)
-{
- fl_set_form_position(form_, x, y);
-}
-
-
-void LyXView::show(int place, int border, char const * title)
-{
- fl_show_form(form_, place, border, title);
- minibuffer->Init();
- InitLyXLookup(fl_display, form_->window);
-}
-
-
-void LyXView::create_form_form_main(int width, int height)
- /* to make this work as it should, .lyxrc should have been
- * read first; OR maybe this one should be made dynamic.
- * Hmmmm. Lgb.
- * We will probably not have lyxrc before the main form is
- * initialized, because error messages from lyxrc parsing
- * are presented (and rightly so) in GUI popups. Asger.
- */
-{
- FD_form_main * fdui = static_cast<FD_form_main *>
- (fl_calloc(1, sizeof(FD_form_main)));
-
- form_main_ = fdui;
-
- // the main form
- form_ = fdui->form_main = fl_bgn_form(FL_NO_BOX, width, height);
- fdui->form_main->u_vdata = this;
- FL_OBJECT * obj = fl_add_box(FL_FLAT_BOX, 0, 0, width, height, "");
- fl_set_object_color(obj, FL_MCOL, FL_MCOL);
-
- // Parameters for the appearance of the main form
- int const air = 2;
- int const bw = abs(fl_get_border_width());
-
- //
- // THE MENUBAR
- //
-
- menus = new Menus(this, air);
-
- //
- // TOOLBAR
- //
-
- toolbar = new Toolbar(this, air, 30 + air + bw);
-
- // Setup the toolbar
- toolbar->set(true);
-
- //
- // WORKAREA
- //
-
- int const ywork = 60 + 2 * air + bw;
- int const workheight = height - ywork - (25 + 2 * air);
-
- ::current_view = bufferview = new BufferView(this, air, ywork,
- width - 3 * air,
- workheight);
-
- //
- // MINIBUFFER
- //
-
- minibuffer = new MiniBuffer(this, air, height - (25 + air),
- width - (2 * air), 25);
-
- //
- // TIMERS
- //
-
-#if 0
- // timer_autosave
- fdui->timer_autosave = obj = fl_add_timer(FL_HIDDEN_TIMER,
- 0, 0, 0, 0, "Timer");
- obj->u_vdata = this;
- fl_set_object_callback(obj, C_LyXView_AutosaveTimerCB, 0);
-#else
- autosave_timeout.callback(C_LyXView_AutosaveTimerCB, this);
-#endif
-
-#if 0
- // timer_update
- fdui->timer_update = obj = fl_add_timer(FL_HIDDEN_TIMER,
- 0, 0, 0, 0, "Timer");
- fl_set_object_callback(obj, C_LyXView_UpdateTimerCB, 0);
- obj->u_vdata = this;
-#else
- //update_timeout.callback(LyXView::UpdateTimerCB, this);
-#endif
- //
- // Misc
- //
-
- // assign an icon to main form
- unsigned int w, h;
- Pixmap lyx_p, lyx_mask;
- lyx_p = fl_create_from_pixmapdata(fl_root,
- const_cast<char**>(lyx_xpm),
- &w,
- &h,
- &lyx_mask,
- 0,
- 0,
- 0); // this leaks
- fl_set_form_icon(fdui->form_main, lyx_p, lyx_mask);
-
- // set min size
- fl_set_form_minsize(fdui->form_main, 50, 50);
-
- fl_end_form();
-}
-
-
-extern "C" int C_LyXView_KeyPressMask_raw_callback(FL_FORM * fl, void * xev);
-
-void LyXView::init()
-{
- // Set the textclass choice
- invalidateLayoutChoice();
- updateLayoutChoice();
- UpdateDocumentClassChoice();
-
- // Start autosave timer
- if (lyxrc.autosave)
-#if 0
- fl_set_timer(form_main_->timer_autosave, lyxrc.autosave);
-#else
- autosave_timeout.setTimeout(lyxrc.autosave * 1000);
- autosave_timeout.start();
-#endif
-
- // Install the raw callback for keyboard events
- fl_register_raw_callback(form_,
- KeyPressMask,
- C_LyXView_KeyPressMask_raw_callback);
- intl->InitKeyMapper(lyxrc.use_kbmap);