3 * Copyright 2001 the LyX Team
4 * Read the file COPYING
12 #include FORMS_H_LOCATION
15 #pragma implementation
20 #include "form_splash.h"
21 #include "FormSplash.h"
22 #include "xform_helpers.h"
24 #include "support/filetools.h"
27 /* FIXME: Really, we shouldn't leave Splash hanging around, but I'm not sure
28 * how to make it self-destructive - jbl
31 extern "C" void C_FormSplashTimerCB(FL_OBJECT * ob, long)
33 FormSplash::CloseCB(ob);
36 extern "C" int C_FormSplashWMHideCB(FL_FORM * ob, void * d)
38 return FormBase::WMHideCB(ob, d);
41 FormSplash::FormSplash(LyXView * lv, Dialogs * d)
42 : FormBaseBI(lv, d, (string(_("LyX ")) + LYX_VERSION).c_str(), new IgnorantPolicy),
45 d->showSplash.connect(slot(this, &FormSplash::show));
46 d->hideSplash.connect(slot(this, &FormSplash::hide));
50 FormSplash::~FormSplash()
56 void FormSplash::CloseCB(FL_OBJECT * ob)
58 FormSplash * pre = static_cast<FormSplash*>(ob->form->u_vdata);
65 void FormSplash::show()
69 fl_set_form_atclose(dialog_->form, C_FormSplashWMHideCB, 0);
72 int const xpos = WidthOfScreen(ScreenOfDisplay(fl_get_display(), fl_screen));
73 int const ypos = HeightOfScreen(ScreenOfDisplay(fl_get_display(), fl_screen));
75 fl_set_form_position(dialog_->form, xpos, ypos);
77 // Show the title form at most 5 secs
78 fl_set_timer(dialog_->splash_timer, 5);
81 fl_raise_form(form());
84 fl_show_form(dialog_->form, FL_PLACE_CENTER, FL_NOBORDER, title.c_str());
89 FL_FORM * FormSplash::form() const
97 void FormSplash::build()
99 dialog_ = build_splash();
101 // Workaround dumb xforms sizing bug
105 string banner_file = LibFileSearch("images", "banner", "xpm");
107 if (lyxrc.show_banner && !banner_file.empty()) {
108 fl_set_form_dblbuffer(dialog_->form, 1); // use dbl buffer
109 fl_addto_form(dialog_->form);
110 FL_OBJECT * obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON, 0, 0, 425, 290, "");
111 fl_set_pixmapbutton_file(obj, banner_file.c_str());
113 fl_set_pixmapbutton_focus_outline(obj, 3);
114 fl_set_button_shortcut(obj, "^M ^[", 1);
115 fl_set_object_boxtype(obj, FL_NO_BOX);
116 fl_set_object_callback(obj, C_FormSplashTimerCB, 0);
118 obj = fl_add_text(FL_NORMAL_TEXT, 248, 265, 170, 16, LYX_VERSION);
119 fl_set_object_lsize(obj, FL_NORMAL_SIZE);
120 fl_mapcolor(FL_FREE_COL2, 0x05, 0x2e, 0x4c);
121 fl_mapcolor(FL_FREE_COL3, 0xe1, 0xd2, 0x9b);
122 fl_set_object_color(obj, FL_FREE_COL2, FL_FREE_COL2);
123 fl_set_object_lcol(obj, FL_FREE_COL3);
124 fl_set_object_lalign(obj, FL_ALIGN_CENTER|FL_ALIGN_INSIDE);
125 fl_set_object_lstyle(obj, FL_BOLD_STYLE);