mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-10 20:04:46 +00:00
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:
parent
6a6bb5a017
commit
1df761e26d
@ -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;
|
||||
}
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
|
@ -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,6 +91,14 @@ Dialogs::~Dialogs()
|
||||
++iter) {
|
||||
delete *iter;
|
||||
}
|
||||
delete splash_;
|
||||
}
|
||||
|
||||
|
||||
void Dialogs::destroySplash()
|
||||
{
|
||||
delete splash_;
|
||||
splash_ = 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -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)
|
||||
|
||||
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),
|
||||
dialog_(0)
|
||||
|
||||
FormSplash::FormSplash(LyXView *, Dialogs * d)
|
||||
: dialog_(0), d_(d)
|
||||
{
|
||||
d->showSplash.connect(slot(this, &FormSplash::show));
|
||||
d->hideSplash.connect(slot(this, &FormSplash::hide));
|
||||
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,34 +69,34 @@ 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()
|
||||
{
|
||||
dialog_ = build_splash();
|
||||
|
||||
// Workaround dumb xforms sizing bug
|
||||
minw_ = form()->w;
|
||||
minh_ = form()->h;
|
||||
if (!lyxrc.show_banner)
|
||||
return;
|
||||
|
||||
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_addto_form(dialog_->form);
|
||||
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_button_shortcut(obj, "^M ^[", 1);
|
||||
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);
|
||||
fl_set_object_lsize(obj, FL_NORMAL_SIZE);
|
||||
@ -125,4 +117,3 @@ void FormSplash::build()
|
||||
fl_set_object_lstyle(obj, FL_BOLD_STYLE);
|
||||
fl_end_form();
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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 ****/
|
||||
|
@ -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
|
||||
|
||||
==============================
|
||||
|
Loading…
Reference in New Issue
Block a user