]> git.lyx.org Git - lyx.git/commitdiff
John's splash patch
authorAngus Leeming <leeming@lyx.org>
Mon, 12 Mar 2001 12:44:56 +0000 (12:44 +0000)
committerAngus Leeming <leeming@lyx.org>
Mon, 12 Mar 2001 12:44:56 +0000 (12:44 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1740 a592a061-630c-0410-9148-cb99ea01b6c8

13 files changed:
src/BufferView_pimpl.C
src/ChangeLog
src/frontends/ChangeLog
src/frontends/Dialogs.h
src/frontends/GUIRunTime.h
src/frontends/xforms/ChangeLog
src/frontends/xforms/Dialogs.C
src/frontends/xforms/FormSplash.C
src/frontends/xforms/FormSplash.h
src/frontends/xforms/Menubar_pimpl.C
src/frontends/xforms/form_splash.C
src/frontends/xforms/form_splash.h
src/frontends/xforms/forms/form_splash.fd

index 6e79fd18113ed19960d358450d3cb4b25ecdca74..617abc67fb2b99ccbf1b5765158dccb17f0ee71e 100644 (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;
 }
index a91ace0bbffadc5448b1300bf4330f1996debec2..bb6990cc29345676e79d0fd0ae4e178ca77af8a1 100644 (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.
index f7420413f52ab883489d94ebfa9e34d93c227c36..8bbea3192f593c15087e7f1c60999bdad37e7e9b 100644 (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
index dec8d1e20742a7519c9e49e6dd90e44277f29b10..2ac0c02acd9e3062fd1cdf836f02cfe3d59a14fc 100644 (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
index 7b4a8e594d314aa4c766b36b7576ba569ebafebe..90a7960893b77a172cdf01f04cfd3b51c7c6113c 100644 (file)
 #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.
index c3d6c8c39d259bc651dbcaa4ee3e3d4dc02a6cab..49eb7e342f9ce44a9deab75499e938c2e976875d 100644 (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
index 7aa1eb11975219092ec79d883606b428290060bc..604c032129e3e0a174e00d9b788e1a2dbd7fcb5a 100644 (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?
index e99305a92dff250d2ed77aeb73afdf3d9c79910d..2316751d006fbe70be8439c553b8cbdc038e9fa5 100644 (file)
@@ -10,7 +10,7 @@
 #include <config.h>
 
 #include FORMS_H_LOCATION
-
 #ifdef __GNUG__
 #pragma implementation
 #endif
 #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,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();
 }
index 90acad81391670473c5444e0a8c7aad268efb23e..ab868f90f118a90cf4f19f2362624f1fa034f14d 100644 (file)
 #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
index f1a66d1d35ddd237683ccdf70aaa5edf93494f60..ef5c8fae783ff0a853652c019cdc0a29e44424f5 100644 (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);
index c4d0e61f667bfea31a2e9bf4c2302fea844747b8..d2e3418f11715782399c3494c1467740d190e147 100644 (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;
index 68b6df568ab9989e9d1ac73217bde83c9af7c812..af25924e7d93d981045ca415a390ee09d59e09d2 100644 (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 ****/
index d746fbda4d94aaa1c71607db464e86d0f5ee1a5d..b6f02a9378b28118a003205553137cf81f81e5e6 100644 (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
 
 ==============================