]> git.lyx.org Git - lyx.git/blob - src/frontends/xforms/FormSplash.C
implement getLabelList
[lyx.git] / src / frontends / xforms / FormSplash.C
1 /**
2  * \file FormSplash.C
3  * Copyright 2001 the LyX Team
4  * Read the file COPYING
5  *
6  * \author Allan Rae
7  * \author John Levon
8  */
9
10 #include <config.h>
11
12 #include FORMS_H_LOCATION
13
14 #ifdef __GNUG__
15 #pragma implementation
16 #endif
17
18 #include "ControlSplash.h"
19 #include "FormSplash.h"
20 #include "form_splash.h"
21 #include "form_splash.h"
22 #include "support/LAssert.h"
23
24 extern "C" int C_FormSplashCloseCB(FL_FORM * form, void *)
25 {
26         Assert(form && form->u_vdata);
27         FormSplash * pre = static_cast<FormSplash *>(form->u_vdata);
28         pre->Hide();
29         return FL_CANCEL;
30 }
31
32
33 extern "C" void C_FormSplashCB(FL_OBJECT * ob, long)
34 {
35         Assert(ob && ob->form && ob->form->u_vdata);
36         FormSplash * pre = static_cast<FormSplash*>(ob->form->u_vdata);
37         pre->Hide();
38 }
39
40  
41 FormSplash::FormSplash(ControlSplash & c)
42         : ViewSplash(c)
43 {}
44
45
46 ControlSplash & FormSplash::controller() const
47 {
48         return static_cast<ControlSplash &>(controller_);
49         //return dynamic_cast<ControlSplash &>(controller_);
50 }
51
52
53 void FormSplash::show()
54 {
55         if (!dialog_.get()) {
56                 build();
57                 fl_set_form_atclose(dialog_->form, C_FormSplashCloseCB, 0);
58         }
59
60         int const xpos = WidthOfScreen(ScreenOfDisplay(fl_get_display(),
61                                                        fl_screen));
62         int const ypos = HeightOfScreen(ScreenOfDisplay(fl_get_display(),
63                                                         fl_screen));
64
65         fl_set_form_position(dialog_->form, xpos, ypos);
66
67         // Show the title form at most 5 secs
68         fl_set_timer(dialog_->splash_timer, 5);
69
70         if (dialog_->form->visible)
71                 fl_raise_form(dialog_->form);
72         else
73                 // Workaround dumb xforms sizing bug
74                 fl_set_form_minsize(dialog_->form,
75                                     dialog_->form->w,
76                                     dialog_->form->h);
77                 fl_show_form(dialog_->form, FL_PLACE_CENTER, FL_NOBORDER, "");
78 }
79
80
81 void FormSplash::hide()
82 {
83         if (dialog_->form && dialog_->form->visible)
84                 fl_hide_form(dialog_->form);
85 }
86
87  
88 void FormSplash::build()
89 {
90         dialog_.reset(build_splash());
91
92         fl_set_form_dblbuffer(dialog_->form, 1); // use dbl buffer
93         fl_addto_form(dialog_->form);
94         FL_OBJECT * obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON, 0, 0, 425, 290, "");
95         fl_set_pixmapbutton_file(obj, controller().bannerFile().c_str());
96         
97         fl_set_pixmapbutton_focus_outline(obj, 3);
98         fl_set_button_shortcut(obj, "^M ^[", 1);
99         fl_set_object_boxtype(obj, FL_NO_BOX);
100         fl_set_object_callback(obj, C_FormSplashCB, 0);
101         
102         obj = fl_add_text(FL_NORMAL_TEXT, 248, 265, 170, 16,
103                           controller().LyXVersion().c_str());
104         fl_set_object_lsize(obj, FL_NORMAL_SIZE);
105         fl_mapcolor(FL_FREE_COL2, 0x05, 0x2e, 0x4c);
106         fl_mapcolor(FL_FREE_COL3, 0xe1, 0xd2, 0x9b);
107         fl_set_object_color(obj, FL_FREE_COL2, FL_FREE_COL2);
108         fl_set_object_lcol(obj, FL_FREE_COL3);
109         fl_set_object_lalign(obj, FL_ALIGN_CENTER|FL_ALIGN_INSIDE);
110         fl_set_object_lstyle(obj, FL_BOLD_STYLE);
111         fl_end_form();
112 }