]> git.lyx.org Git - lyx.git/commitdiff
Ensure that the LyX splash screen is drawn if desired.
authorAngus Leeming <leeming@lyx.org>
Wed, 26 Feb 2003 12:49:01 +0000 (12:49 +0000)
committerAngus Leeming <leeming@lyx.org>
Wed, 26 Feb 2003 12:49:01 +0000 (12:49 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6278 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/ChangeLog
src/frontends/screen.C
src/frontends/screen.h

index 8a08a03876aee4477d80101f78d51b89a64c4c28..0d0419d0b8527ce9838daafecab951128cfce7b8 100644 (file)
@@ -1,3 +1,7 @@
+2003-02-26  Angus Leeming  <leeming@lyx.org>
+
+       * screen.[Ch]: ensure that the LyX splash screen is drawn if desired.
+
 2003-02-21  Angus Leeming  <leeming@lyx.org>
 
        * Dialogs.[Ch]: simplify the dialog interface by using a few
index 030539845a2cbec20b17c805e9f082d63e465b5e..b0b3efed918c7ec035e43bcc7b90f69c9fee6bb7 100644 (file)
@@ -54,6 +54,15 @@ public:
        string const & text() const { return text_; }
        ///
        LyXFont const & font() const { return font_; }
+       ///
+       void connect(grfx::Loader::slot_type const & slot) const {
+               loader_.connect(slot);
+       }
+       ///
+       void startLoading() const {
+               if (loader_.status() == grfx::WaitingToLoad)
+                       loader_.startLoading();
+       }
 
 private:
        /** Make the c-tor private so we can control how many objects
@@ -95,22 +104,20 @@ SplashScreen::SplashScreen()
 
        // Load up the graphics file
        loader_.reset(file);
-       // We aren't interested here in when the image is loaded.
-       // If it isn't ready when we want it, then we ignore it.
-//     loader_->statusChanged.connect(
-//                     boost::bind(&SplashScreen::statusChanged, this));
-       if (loader_.status() == grfx::WaitingToLoad)
-               loader_.startLoading();
 }
 
 } // namespace anon
 
 
 LyXScreen::LyXScreen()
-       : force_clear_(true), cursor_visible_(false)
+       : cursor_visible_(false), force_clear_(true), greyed_out_(false)
 {
        // Start loading the pixmap as soon as possible
-       SplashScreen::get();
+       if (lyxrc.show_banner) {
+               SplashScreen const & splash = SplashScreen::get();
+               splash.connect(boost::bind(&LyXScreen::greyOut, this));
+               splash.startLoading();
+       }
 }
 
 
@@ -351,12 +358,12 @@ void LyXScreen::toggleToggle(LyXText * text, BufferView * bv,
 
 void LyXScreen::redraw(LyXText * text, BufferView * bv)
 {
+       greyed_out_ = !text;
+
        workarea().getPainter().start();
 
-       if (!text) {
+       if (greyed_out_) {
                greyOut();
-               expose(0, 0, workarea().workWidth(), workarea().workHeight());
-               workarea().getPainter().end();
                return;
        }
 
@@ -374,6 +381,9 @@ void LyXScreen::redraw(LyXText * text, BufferView * bv)
 
 void LyXScreen::greyOut()
 {
+       if (!greyed_out_)
+               return;
+
        workarea().getPainter().fillRectangle(0, 0,
                workarea().workWidth(),
                workarea().workHeight(),
@@ -399,6 +409,8 @@ void LyXScreen::greyOut()
 
                workarea().getPainter().text(x, y, splash_text, splash_font);
        }
+       expose(0, 0, workarea().workWidth(), workarea().workHeight());
+       workarea().getPainter().end();
 }
 
 
index 7ae647a6c0126e9cea158332a1c9802ebb2f9cdb..d802af94a3e65e519d6316f1f77ae2a50876a3df 100644 (file)
@@ -157,14 +157,18 @@ protected:
        virtual void drawOneRow(LyXText *, BufferView *, Row * row,
                        int y_text, int y_offset = 0, int x_offset = 0);
 
+       /// is the blinking cursor currently drawn
+       bool cursor_visible_;
+
+private:
        /// grey out (no buffer)
        void greyOut();
 
        /// FIXME ?
        bool force_clear_;
 
-       /// is the blinking cursor currently drawn
-       bool cursor_visible_;
+       /// is the screen displaying text or the splash screen?
+       bool greyed_out_;
 };
 
 #endif // SCREEN_H