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