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(); bv_->setState();
AllowInput(bv_); AllowInput(bv_);
owner_->getDialogs()->hideSplash(); /// get rid of the splash screen if it's not gone already
owner_->getDialogs()->destroySplash();
return 0; return 0;
} }

View File

@ -3,6 +3,10 @@
* lyx.C: * lyx.C:
* lyx.h: strip external form * 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> 2001-03-12 Lars Gullik Bjønnes <larsbj@trylle.birdstep.com>
* buffer.C: add using std::stringstream. * buffer.C: add using std::stringstream.

View File

@ -2,6 +2,12 @@
* Dialogs.h: add showExternal signal * 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> 2001-02-26 John Levon <moz@compsoc.man.ac.uk>
* Makefile.am * Makefile.am

View File

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

View File

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

View File

@ -9,6 +9,18 @@
* xforms/forms/makefile: * xforms/forms/makefile:
* forms/form_external.fd: add FormExternal * 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> 2001-03-12 Lars Gullik Bjønnes <larsbj@trylle.birdstep.com>
* FormToc.h: use Buffer::typedef * FormToc.h: use Buffer::typedef

View File

@ -51,6 +51,8 @@ Signal0<void> Dialogs::redrawGUI;
Dialogs::Dialogs(LyXView * lv) Dialogs::Dialogs(LyXView * lv)
{ {
splash_ = new FormSplash(lv, this);
dialogs_.push_back(new FormBibitem(lv, this)); dialogs_.push_back(new FormBibitem(lv, this));
dialogs_.push_back(new FormBibtex(lv, this)); dialogs_.push_back(new FormBibtex(lv, this));
dialogs_.push_back(new FormCharacter(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 FormPrint(lv, this));
dialogs_.push_back(new FormRef(lv, this)); dialogs_.push_back(new FormRef(lv, this));
dialogs_.push_back(new FormSearch(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 FormTabular(lv, this));
dialogs_.push_back(new FormTabularCreate(lv, this)); dialogs_.push_back(new FormTabularCreate(lv, this));
dialogs_.push_back(new FormToc(lv, this)); dialogs_.push_back(new FormToc(lv, this));
@ -90,6 +91,14 @@ Dialogs::~Dialogs()
++iter) { ++iter) {
delete *iter; delete *iter;
} }
delete splash_;
}
void Dialogs::destroySplash()
{
delete splash_;
splash_ = 0;
} }

View File

@ -19,54 +19,46 @@
#include "LyXView.h" #include "LyXView.h"
#include "form_splash.h" #include "form_splash.h"
#include "FormSplash.h" #include "FormSplash.h"
#include "xforms_helpers.h"
#include "version.h" #include "version.h"
#include "support/filetools.h" #include "support/filetools.h"
#include "lyxrc.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)
extern "C" void C_FormSplashCB(FL_OBJECT * ob, long)
{ {
return FormBase::WMHideCB(ob, d); FormSplash * form = static_cast<FormSplash*>(ob->form->u_vdata);
form->hide();
} }
FormSplash::FormSplash(LyXView * lv, Dialogs * d)
: FormBaseBI(lv, d, (string(_("LyX ")) + LYX_VERSION).c_str(), new IgnorantPolicy), FormSplash::FormSplash(LyXView *, Dialogs * d)
dialog_(0) : dialog_(0), d_(d)
{ {
d->showSplash.connect(slot(this, &FormSplash::show)); c_ = d->showSplash.connect(slot(this, &FormSplash::show));
d->hideSplash.connect(slot(this, &FormSplash::hide));
} }
FormSplash::~FormSplash() FormSplash::~FormSplash()
{ {
c_.disconnect();
delete dialog_; 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() void FormSplash::show()
{ {
if (!dialog_) { if (!dialog_) {
build(); 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)); int const xpos = WidthOfScreen(ScreenOfDisplay(fl_get_display(), fl_screen));
@ -77,34 +69,34 @@ void FormSplash::show()
// Show the title form at most 5 secs // Show the title form at most 5 secs
fl_set_timer(dialog_->splash_timer, 5); fl_set_timer(dialog_->splash_timer, 5);
if (form()->visible) if (dialog_->form->visible)
fl_raise_form(form()); fl_raise_form(dialog_->form);
else { else
connect(); fl_show_form(dialog_->form, FL_PLACE_CENTER, FL_NOBORDER, "");
fl_show_form(dialog_->form, FL_PLACE_CENTER, FL_NOBORDER, title.c_str());
}
} }
FL_FORM * FormSplash::form() const void FormSplash::hide()
{ {
if (dialog_) d_->destroySplash();
return dialog_->form;
return 0;
} }
void FormSplash::build() void FormSplash::build()
{ {
dialog_ = build_splash(); if (!lyxrc.show_banner)
return;
// Workaround dumb xforms sizing bug
minw_ = form()->w;
minh_ = form()->h;
string banner_file = LibFileSearch("images", "banner", "xpm"); string banner_file = LibFileSearch("images", "banner", "xpm");
if (lyxrc.show_banner && !banner_file.empty()) { if (banner_file.empty())
return;
dialog_ = build_splash();
// Workaround dumb xforms sizing bug
fl_set_form_minsize(dialog_->form, dialog_->form->w, dialog_->form->h);
fl_set_form_dblbuffer(dialog_->form, 1); // use dbl buffer fl_set_form_dblbuffer(dialog_->form, 1); // use dbl buffer
fl_addto_form(dialog_->form); fl_addto_form(dialog_->form);
FL_OBJECT * obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON, 0, 0, 425, 290, ""); FL_OBJECT * obj = fl_add_pixmapbutton(FL_NORMAL_BUTTON, 0, 0, 425, 290, "");
@ -113,7 +105,7 @@ void FormSplash::build()
fl_set_pixmapbutton_focus_outline(obj, 3); fl_set_pixmapbutton_focus_outline(obj, 3);
fl_set_button_shortcut(obj, "^M ^[", 1); fl_set_button_shortcut(obj, "^M ^[", 1);
fl_set_object_boxtype(obj, FL_NO_BOX); fl_set_object_boxtype(obj, FL_NO_BOX);
fl_set_object_callback(obj, C_FormSplashTimerCB, 0); fl_set_object_callback(obj, C_FormSplashCB, 0);
obj = fl_add_text(FL_NORMAL_TEXT, 248, 265, 170, 16, LYX_VERSION); obj = fl_add_text(FL_NORMAL_TEXT, 248, 265, 170, 16, LYX_VERSION);
fl_set_object_lsize(obj, FL_NORMAL_SIZE); fl_set_object_lsize(obj, FL_NORMAL_SIZE);
@ -125,4 +117,3 @@ void FormSplash::build()
fl_set_object_lstyle(obj, FL_BOLD_STYLE); fl_set_object_lstyle(obj, FL_BOLD_STYLE);
fl_end_form(); fl_end_form();
} }
}

View File

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

View File

@ -21,6 +21,7 @@
#include "lyxfunc.h" #include "lyxfunc.h"
#include "kbmap.h" #include "kbmap.h"
#include "buffer.h" #include "buffer.h"
#include "Dialogs.h"
#include "LyXView.h" #include "LyXView.h"
#include "MenuBackend.h" #include "MenuBackend.h"
#include "Menubar_pimpl.h" #include "Menubar_pimpl.h"
@ -577,6 +578,12 @@ void Menubar::Pimpl::MenuCallback(FL_OBJECT * ob, long button)
LyXView * view = iteminfo->pimpl_->owner_; LyXView * view = iteminfo->pimpl_->owner_;
MenuItem const * item = iteminfo->item_.get(); 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) { if (button == 1) {
// set the pseudo menu-button // set the pseudo menu-button
fl_set_object_boxtype(ob, FL_DOWN_BOX); 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, ""); obj = fl_add_box(FL_UP_BOX, 0, 0, 420, 290, "");
fl_set_object_color(obj, FL_BLACK, FL_TOP_BCOL); fl_set_object_color(obj, FL_BLACK, FL_TOP_BCOL);
fdui->splash_timer = obj = fl_add_timer(FL_HIDDEN_TIMER, 110, 170, 190, 60, ""); 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(); fl_end_form();
fdui->form->fdui = fdui; fdui->form->fdui = fdui;

View File

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

View File

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