2001-02-12 14:09:09 +00:00
|
|
|
/**
|
|
|
|
* \file FormSplash.C
|
|
|
|
* Copyright 2001 the LyX Team
|
|
|
|
* Read the file COPYING
|
|
|
|
*
|
|
|
|
* \author Allan Rae
|
|
|
|
* \author John Levon
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
|
|
|
|
#include FORMS_H_LOCATION
|
2001-03-27 13:00:41 +00:00
|
|
|
|
2001-02-12 14:09:09 +00:00
|
|
|
#ifdef __GNUG__
|
|
|
|
#pragma implementation
|
|
|
|
#endif
|
|
|
|
|
2001-03-27 13:00:41 +00:00
|
|
|
#include "ControlSplash.h"
|
2001-02-12 14:09:09 +00:00
|
|
|
#include "FormSplash.h"
|
2001-03-27 13:00:41 +00:00
|
|
|
#include "form_splash.h"
|
|
|
|
#include "form_splash.h"
|
|
|
|
#include "support/LAssert.h"
|
2001-03-16 12:08:14 +00:00
|
|
|
|
2001-04-24 15:25:26 +00:00
|
|
|
extern "C"
|
|
|
|
int C_FormSplashCloseCB(FL_FORM * form, void *)
|
2001-02-12 14:09:09 +00:00
|
|
|
{
|
2001-04-24 15:25:26 +00:00
|
|
|
lyx::Assert(form && form->u_vdata);
|
2001-03-27 13:00:41 +00:00
|
|
|
FormSplash * pre = static_cast<FormSplash *>(form->u_vdata);
|
|
|
|
pre->Hide();
|
|
|
|
return FL_CANCEL;
|
2001-02-12 14:09:09 +00:00
|
|
|
}
|
|
|
|
|
2001-03-12 12:44:56 +00:00
|
|
|
|
2001-04-24 15:25:26 +00:00
|
|
|
extern "C"
|
|
|
|
void C_FormSplashCB(FL_OBJECT * ob, long)
|
2001-02-12 14:09:09 +00:00
|
|
|
{
|
2001-04-24 15:25:26 +00:00
|
|
|
lyx::Assert(ob && ob->form && ob->form->u_vdata);
|
2001-03-27 13:00:41 +00:00
|
|
|
FormSplash * pre = static_cast<FormSplash*>(ob->form->u_vdata);
|
|
|
|
pre->Hide();
|
2001-02-12 14:09:09 +00:00
|
|
|
}
|
2001-03-15 13:37:04 +00:00
|
|
|
|
2001-03-12 12:44:56 +00:00
|
|
|
|
2001-03-27 13:00:41 +00:00
|
|
|
FormSplash::FormSplash(ControlSplash & c)
|
|
|
|
: ViewSplash(c)
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
|
ControlSplash & FormSplash::controller() const
|
2001-02-12 14:09:09 +00:00
|
|
|
{
|
2001-03-27 13:00:41 +00:00
|
|
|
return static_cast<ControlSplash &>(controller_);
|
|
|
|
//return dynamic_cast<ControlSplash &>(controller_);
|
2001-02-12 14:09:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void FormSplash::show()
|
|
|
|
{
|
2001-03-15 13:37:04 +00:00
|
|
|
if (!dialog_.get()) {
|
2001-02-12 14:09:09 +00:00
|
|
|
build();
|
2001-03-12 12:44:56 +00:00
|
|
|
fl_set_form_atclose(dialog_->form, C_FormSplashCloseCB, 0);
|
2001-02-12 14:09:09 +00:00
|
|
|
}
|
|
|
|
|
2001-03-27 13:00:41 +00:00
|
|
|
int const xpos = WidthOfScreen(ScreenOfDisplay(fl_get_display(),
|
|
|
|
fl_screen));
|
|
|
|
int const ypos = HeightOfScreen(ScreenOfDisplay(fl_get_display(),
|
|
|
|
fl_screen));
|
2001-02-12 14:09:09 +00:00
|
|
|
|
|
|
|
fl_set_form_position(dialog_->form, xpos, ypos);
|
|
|
|
|
|
|
|
// Show the title form at most 5 secs
|
|
|
|
fl_set_timer(dialog_->splash_timer, 5);
|
|
|
|
|
2001-03-12 12:44:56 +00:00
|
|
|
if (dialog_->form->visible)
|
|
|
|
fl_raise_form(dialog_->form);
|
|
|
|
else
|
2001-03-27 13:00:41 +00:00
|
|
|
// Workaround dumb xforms sizing bug
|
|
|
|
fl_set_form_minsize(dialog_->form,
|
|
|
|
dialog_->form->w,
|
|
|
|
dialog_->form->h);
|
2001-03-12 12:44:56 +00:00
|
|
|
fl_show_form(dialog_->form, FL_PLACE_CENTER, FL_NOBORDER, "");
|
2001-02-12 14:09:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-03-12 12:44:56 +00:00
|
|
|
void FormSplash::hide()
|
2001-02-12 14:09:09 +00:00
|
|
|
{
|
2001-03-15 13:37:04 +00:00
|
|
|
if (dialog_->form && dialog_->form->visible)
|
|
|
|
fl_hide_form(dialog_->form);
|
2001-02-12 14:09:09 +00:00
|
|
|
}
|
|
|
|
|
2001-03-12 12:44:56 +00:00
|
|
|
|
2001-02-12 14:09:09 +00:00
|
|
|
void FormSplash::build()
|
|
|
|
{
|
2001-03-15 13:37:04 +00:00
|
|
|
dialog_.reset(build_splash());
|
2001-02-12 14:09:09 +00:00
|
|
|
|
2001-03-12 12:44:56 +00:00
|
|
|
fl_set_form_dblbuffer(dialog_->form, 1); // use dbl buffer
|
|
|
|
fl_addto_form(dialog_->form);
|
|
|
|
FL_OBJECT * obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON, 0, 0, 425, 290, "");
|
2001-03-27 13:00:41 +00:00
|
|
|
fl_set_pixmapbutton_file(obj, controller().bannerFile().c_str());
|
2001-03-12 12:44:56 +00:00
|
|
|
|
|
|
|
fl_set_pixmapbutton_focus_outline(obj, 3);
|
|
|
|
fl_set_button_shortcut(obj, "^M ^[", 1);
|
|
|
|
fl_set_object_boxtype(obj, FL_NO_BOX);
|
|
|
|
fl_set_object_callback(obj, C_FormSplashCB, 0);
|
|
|
|
|
2001-03-27 13:00:41 +00:00
|
|
|
obj = fl_add_text(FL_NORMAL_TEXT, 248, 265, 170, 16,
|
|
|
|
controller().LyXVersion().c_str());
|
2001-03-12 12:44:56 +00:00
|
|
|
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
|
|
|
fl_mapcolor(FL_FREE_COL2, 0x05, 0x2e, 0x4c);
|
|
|
|
fl_mapcolor(FL_FREE_COL3, 0xe1, 0xd2, 0x9b);
|
|
|
|
fl_set_object_color(obj, FL_FREE_COL2, FL_FREE_COL2);
|
|
|
|
fl_set_object_lcol(obj, FL_FREE_COL3);
|
|
|
|
fl_set_object_lalign(obj, FL_ALIGN_CENTER|FL_ALIGN_INSIDE);
|
|
|
|
fl_set_object_lstyle(obj, FL_BOLD_STYLE);
|
|
|
|
fl_end_form();
|
2001-02-12 14:09:09 +00:00
|
|
|
}
|