3 * Copyright 2001 the LyX Team
4 * Read the file COPYING
12 #include FORMS_H_LOCATION
15 #pragma implementation
18 #include "ControlSplash.h"
19 #include "FormSplash.h"
20 #include "form_splash.h"
21 #include "form_splash.h"
22 #include "support/LAssert.h"
27 int C_FormSplashCloseCB(FL_FORM * form, void *)
29 lyx::Assert(form && form->u_vdata);
30 FormSplash * pre = static_cast<FormSplash *>(form->u_vdata);
35 void C_FormSplashCB(FL_OBJECT * ob, long)
37 lyx::Assert(ob && ob->form && ob->form->u_vdata);
38 FormSplash * pre = static_cast<FormSplash*>(ob->form->u_vdata);
45 FormSplash::FormSplash(ControlSplash & c)
50 ControlSplash & FormSplash::controller() const
52 return static_cast<ControlSplash &>(controller_);
53 //return dynamic_cast<ControlSplash &>(controller_);
57 void FormSplash::show()
61 fl_set_form_atclose(dialog_->form, C_FormSplashCloseCB, 0);
64 int const xpos = WidthOfScreen(ScreenOfDisplay(fl_get_display(),
66 int const ypos = HeightOfScreen(ScreenOfDisplay(fl_get_display(),
69 fl_set_form_position(dialog_->form, xpos, ypos);
71 // Show the title form at most 5 secs
72 fl_set_timer(dialog_->splash_timer, 5);
74 if (dialog_->form->visible)
75 fl_raise_form(dialog_->form);
77 // Workaround dumb xforms sizing bug
78 fl_set_form_minsize(dialog_->form,
81 fl_show_form(dialog_->form, FL_PLACE_CENTER, FL_NOBORDER, "");
85 void FormSplash::hide()
87 if (dialog_->form && dialog_->form->visible)
88 fl_hide_form(dialog_->form);
92 void FormSplash::build()
94 dialog_.reset(build_splash());
96 fl_set_form_dblbuffer(dialog_->form, 1); // use dbl buffer
97 fl_addto_form(dialog_->form);
98 FL_OBJECT * obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON, 0, 0, 425, 290, "");
99 fl_set_pixmapbutton_file(obj, controller().bannerFile().c_str());
101 fl_set_pixmapbutton_focus_outline(obj, 3);
102 fl_set_button_shortcut(obj, "^M ^[", 1);
103 fl_set_object_boxtype(obj, FL_NO_BOX);
104 fl_set_object_callback(obj, C_FormSplashCB, 0);
106 obj = fl_add_text(FL_NORMAL_TEXT, 248, 265, 170, 16,
107 controller().LyXVersion().c_str());
108 fl_set_object_lsize(obj, FL_NORMAL_SIZE);
109 fl_mapcolor(FL_FREE_COL2, 0x05, 0x2e, 0x4c);
110 fl_mapcolor(FL_FREE_COL3, 0xe1, 0xd2, 0x9b);
111 fl_set_object_color(obj, FL_FREE_COL2, FL_FREE_COL2);
112 fl_set_object_lcol(obj, FL_FREE_COL3);
113 fl_set_object_lalign(obj, FL_ALIGN_CENTER|FL_ALIGN_INSIDE);
114 fl_set_object_lstyle(obj, FL_BOLD_STYLE);