From df9798bec7b8d37bfcc1b254deda48a5e4e1c968 Mon Sep 17 00:00:00 2001 From: Angus Leeming Date: Wed, 26 Feb 2003 12:49:01 +0000 Subject: [PATCH] Ensure that the LyX splash screen is drawn if desired. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6278 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/frontends/ChangeLog | 4 ++++ src/frontends/screen.C | 34 +++++++++++++++++++++++----------- src/frontends/screen.h | 8 ++++++-- 3 files changed, 33 insertions(+), 13 deletions(-) diff --git a/src/frontends/ChangeLog b/src/frontends/ChangeLog index 8a08a03876..0d0419d0b8 100644 --- a/src/frontends/ChangeLog +++ b/src/frontends/ChangeLog @@ -1,3 +1,7 @@ +2003-02-26 Angus Leeming + + * screen.[Ch]: ensure that the LyX splash screen is drawn if desired. + 2003-02-21 Angus Leeming * Dialogs.[Ch]: simplify the dialog interface by using a few diff --git a/src/frontends/screen.C b/src/frontends/screen.C index 030539845a..b0b3efed91 100644 --- a/src/frontends/screen.C +++ b/src/frontends/screen.C @@ -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(); } diff --git a/src/frontends/screen.h b/src/frontends/screen.h index 7ae647a6c0..d802af94a3 100644 --- a/src/frontends/screen.h +++ b/src/frontends/screen.h @@ -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 -- 2.39.5