John's splash patch

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1740 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Angus Leeming 2001-03-12 12:44:56 +00:00
parent 6a6bb5a017
commit 1df761e26d
13 changed files with 122 additions and 85 deletions

View File

@ -349,7 +349,8 @@ int BufferView::Pimpl::resizeCurrentBuffer()
bv_->setState();
AllowInput(bv_);
owner_->getDialogs()->hideSplash();
/// get rid of the splash screen if it's not gone already
owner_->getDialogs()->destroySplash();
return 0;
}

View File

@ -3,6 +3,10 @@
* lyx.C:
* lyx.h: strip external form
2001-03-12 John Levon <moz@compsoc.man.ac.uk>
* BufferView_pimpl.C: add comment, destroySplash()
2001-03-12 Lars Gullik Bjønnes <larsbj@trylle.birdstep.com>
* buffer.C: add using std::stringstream.

View File

@ -2,6 +2,12 @@
* Dialogs.h: add showExternal signal
2001-03-12 John Levon <moz@compsoc.man.ac.uk>
* Dialogs.h: add pointer to splash form
* GUIRunTime.h: minor cleanup
2001-02-26 John Levon <moz@compsoc.man.ac.uk>
* Makefile.am

View File

@ -29,6 +29,8 @@ class DialogBase;
// Maybe this should be a UIFunc modelled on LyXFunc
class LyXView;
class FormSplash;
class InsetGraphics;
class InsetBibKey;
class InsetBibtex;
@ -139,8 +141,8 @@ public:
Signal0<void> showSearch;
/// pop up the splash
Signal0<void> showSplash;
/// hide the splash immediately
Signal0<void> hideSplash;
/// destroy the splash dialog
void destroySplash();
///
Signal1<void, InsetTabular *> showTabular;
///
@ -159,8 +161,10 @@ public:
Signal0<void> updateCharacter; // allow update as cursor moves
//@}
private:
///
/// the dialogs being managed
std::vector<DialogBase *> dialogs_;
/// the splash dialog
FormSplash * splash_;
};
#endif

View File

@ -15,20 +15,19 @@
#pragma interface
#endif
class LyXView;
/** The LyX GUI independent guiruntime class
The GUI interface is implemented in the corresponding
frontends GUIRunTime.C file.
*/
class GUIRunTime {
public:
/// initialise the toolkit
static
int initApplication(int argc, char * argv[]);
///
/// process pending events
static
void processEvents();
///
/// enter the permanent event loop until "finished" becomes false
static
void runTime();
/// This is run first in the LyXGUI constructor.

View File

@ -9,6 +9,18 @@
* xforms/forms/makefile:
* forms/form_external.fd: add FormExternal
2001-03-12 John Levon <moz@compsoc.man.ac.uk>
* Dialogs.C: add destroySplash()
* form_splash.h:
* form_splash.C:
* forms/form_splash.fd:
* FormSplash.h:
* FormSplash.C: make independent of FormBase, tidy
* Menubar_pimpl.C: destroy splash on interaction
2001-03-12 Lars Gullik Bjønnes <larsbj@trylle.birdstep.com>
* FormToc.h: use Buffer::typedef

View File

@ -51,6 +51,8 @@ Signal0<void> Dialogs::redrawGUI;
Dialogs::Dialogs(LyXView * lv)
{
splash_ = new FormSplash(lv, this);
dialogs_.push_back(new FormBibitem(lv, this));
dialogs_.push_back(new FormBibtex(lv, this));
dialogs_.push_back(new FormCharacter(lv, this));
@ -70,7 +72,6 @@ Dialogs::Dialogs(LyXView * lv)
dialogs_.push_back(new FormPrint(lv, this));
dialogs_.push_back(new FormRef(lv, this));
dialogs_.push_back(new FormSearch(lv, this));
dialogs_.push_back(new FormSplash(lv, this));
dialogs_.push_back(new FormTabular(lv, this));
dialogs_.push_back(new FormTabularCreate(lv, this));
dialogs_.push_back(new FormToc(lv, this));
@ -90,9 +91,17 @@ Dialogs::~Dialogs()
++iter) {
delete *iter;
}
delete splash_;
}
void Dialogs::destroySplash()
{
delete splash_;
splash_ = 0;
}
/*****************************************************************************
Q. WHY does Dialogs::Dialogs pass `this' to dialog constructors?

View File

@ -10,7 +10,7 @@
#include <config.h>
#include FORMS_H_LOCATION
#ifdef __GNUG__
#pragma implementation
#endif
@ -19,54 +19,46 @@
#include "LyXView.h"
#include "form_splash.h"
#include "FormSplash.h"
#include "xforms_helpers.h"
#include "version.h"
#include "support/filetools.h"
#include "lyxrc.h"
/* FIXME: Really, we shouldn't leave Splash hanging around, but I'm not sure
* how to make it self-destructive - jbl
*/
extern "C" void C_FormSplashTimerCB(FL_OBJECT * ob, long)
extern "C" int C_FormSplashCloseCB(FL_FORM * forms, void *)
{
FormSplash::CloseCB(ob);
Assert(forms);
FormSplash * form = static_cast<FormSplash*>(forms->u_vdata);
form->hide();
return 0;
}
extern "C" int C_FormSplashWMHideCB(FL_FORM * ob, void * d)
{
return FormBase::WMHideCB(ob, d);
}
FormSplash::FormSplash(LyXView * lv, Dialogs * d)
: FormBaseBI(lv, d, (string(_("LyX ")) + LYX_VERSION).c_str(), new IgnorantPolicy),
dialog_(0)
extern "C" void C_FormSplashCB(FL_OBJECT * ob, long)
{
d->showSplash.connect(slot(this, &FormSplash::show));
d->hideSplash.connect(slot(this, &FormSplash::hide));
FormSplash * form = static_cast<FormSplash*>(ob->form->u_vdata);
form->hide();
}
FormSplash::FormSplash(LyXView *, Dialogs * d)
: dialog_(0), d_(d)
{
c_ = d->showSplash.connect(slot(this, &FormSplash::show));
}
FormSplash::~FormSplash()
{
c_.disconnect();
delete dialog_;
}
void FormSplash::CloseCB(FL_OBJECT * ob)
{
FormSplash * pre = static_cast<FormSplash*>(ob->form->u_vdata);
pre->hide();
delete pre->dialog_;
pre->dialog_ = 0;
}
void FormSplash::show()
{
if (!dialog_) {
build();
fl_set_form_atclose(dialog_->form, C_FormSplashWMHideCB, 0);
fl_set_form_atclose(dialog_->form, C_FormSplashCloseCB, 0);
}
int const xpos = WidthOfScreen(ScreenOfDisplay(fl_get_display(), fl_screen));
@ -77,52 +69,51 @@ void FormSplash::show()
// Show the title form at most 5 secs
fl_set_timer(dialog_->splash_timer, 5);
if (form()->visible)
fl_raise_form(form());
else {
connect();
fl_show_form(dialog_->form, FL_PLACE_CENTER, FL_NOBORDER, title.c_str());
}
if (dialog_->form->visible)
fl_raise_form(dialog_->form);
else
fl_show_form(dialog_->form, FL_PLACE_CENTER, FL_NOBORDER, "");
}
FL_FORM * FormSplash::form() const
void FormSplash::hide()
{
if (dialog_)
return dialog_->form;
return 0;
d_->destroySplash();
}
void FormSplash::build()
{
if (!lyxrc.show_banner)
return;
string banner_file = LibFileSearch("images", "banner", "xpm");
if (banner_file.empty())
return;
dialog_ = build_splash();
// Workaround dumb xforms sizing bug
minw_ = form()->w;
minh_ = form()->h;
string banner_file = LibFileSearch("images", "banner", "xpm");
if (lyxrc.show_banner && !banner_file.empty()) {
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, "");
fl_set_pixmapbutton_file(obj, banner_file.c_str());
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_FormSplashTimerCB, 0);
obj = fl_add_text(FL_NORMAL_TEXT, 248, 265, 170, 16, LYX_VERSION);
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();
}
fl_set_form_minsize(dialog_->form, dialog_->form->w, dialog_->form->h);
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, "");
fl_set_pixmapbutton_file(obj, banner_file.c_str());
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);
obj = fl_add_text(FL_NORMAL_TEXT, 248, 265, 170, 16, LYX_VERSION);
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();
}

View File

@ -10,37 +10,41 @@
#ifndef FORMSPLASH_H
#define FORMSPLASH_H
#include "FormBase.h"
#ifdef __GNUG__
#pragma interface
#endif
#include "DialogBase.h"
struct FD_form_splash;
class Dialogs;
class LyXView;
/** The startup splash screen
*/
class FormSplash : public FormBaseBI {
class FormSplash : public DialogBase {
public:
FormSplash(LyXView *, Dialogs *);
~FormSplash();
/// close the dialog
static void CloseCB(FL_OBJECT *);
/// hide (and destroy) the dialog
void hide();
private:
/// show the dialog
virtual void show();
void show();
/// Build the dialog
virtual void build();
/// Pointer to the actual instantiation of the xforms form
virtual FL_FORM * form() const;
void build();
/// Fdesign generated method
FD_form_splash * build_splash();
/// Real GUI implementation.
FD_form_splash * dialog_;
/// our container
Dialogs * d_;
/// the show connection
Connection c_;
};
#endif // FORMSPLASH_H

View File

@ -21,6 +21,7 @@
#include "lyxfunc.h"
#include "kbmap.h"
#include "buffer.h"
#include "Dialogs.h"
#include "LyXView.h"
#include "MenuBackend.h"
#include "Menubar_pimpl.h"
@ -577,6 +578,12 @@ void Menubar::Pimpl::MenuCallback(FL_OBJECT * ob, long button)
LyXView * view = iteminfo->pimpl_->owner_;
MenuItem const * item = iteminfo->item_.get();
/* get the splash out of the way. It would be nicer
* to only have this code at the start, but xforms
* makes it too ugly to do
*/
view->getDialogs()->destroySplash();
if (button == 1) {
// set the pseudo menu-button
fl_set_object_boxtype(ob, FL_DOWN_BOX);

View File

@ -27,7 +27,7 @@ FD_form_splash * FormSplash::build_splash()
obj = fl_add_box(FL_UP_BOX, 0, 0, 420, 290, "");
fl_set_object_color(obj, FL_BLACK, FL_TOP_BCOL);
fdui->splash_timer = obj = fl_add_timer(FL_HIDDEN_TIMER, 110, 170, 190, 60, "");
fl_set_object_callback(obj, C_FormSplashTimerCB, 0);
fl_set_object_callback(obj, C_FormSplashCB, 0);
fl_end_form();
fdui->form->fdui = fdui;

View File

@ -5,7 +5,7 @@
#define FD_form_splash_h_
/** Callbacks, globals and object handlers **/
extern "C" void C_FormSplashTimerCB(FL_OBJECT *, long);
extern "C" void C_FormSplashCB(FL_OBJECT *, long);
/**** Forms and Objects ****/

View File

@ -45,7 +45,7 @@ shortcut:
resize: FL_RESIZE_ALL
gravity: FL_NoGravity FL_NoGravity
name: splash_timer
callback: C_FormSplashTimerCB
callback: C_FormSplashCB
argument: 0
==============================