cleaner version of splash display changes

git-svn-id: svn://localhost/ardour2/branches/3.0@13004 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2012-07-09 21:54:21 +00:00
parent c300fa98af
commit 3dcbdc0fe6
4 changed files with 46 additions and 52 deletions

View file

@ -794,6 +794,8 @@ If you still wish to quit, please use the\n\n\
*/
save_ardour_state ();
loading_message (_("Please wait while Ardour cleans up..."));
if (_session) {
// _session->set_deletion_in_progress ();
_session->set_clean ();
@ -2401,11 +2403,11 @@ ARDOUR_UI::loading_message (const std::string& msg)
return;
}
show_splash ();
if (splash) {
splash->message (msg);
flush_pending ();
if (!splash) {
show_splash ();
}
splash->message (msg);
}
/** @param quit_on_cancel true if exit() should be called if the user clicks `cancel' in the new session dialog */
@ -2830,34 +2832,9 @@ ARDOUR_UI::about_signal_response (int /*response*/)
hide_about();
}
bool
ARDOUR_UI::wakeup_from_splash_sleep (void* arg)
{
cerr << "idle after splash\n";
((ARDOUR_UI*)arg)->_wakeup_from_splash_sleep ();
return false;
}
void
ARDOUR_UI::_wakeup_from_splash_sleep ()
{
splash_done_visible = true;
cerr << "Set sdv to " << splash_done_visible << endl;
}
bool
ARDOUR_UI::splash_visible (GdkEventAny*)
{
cerr << "Splash now mapped\n";
g_idle_add ((gboolean (*)(void*))ARDOUR_UI::wakeup_from_splash_sleep, this);
return false;
}
void
ARDOUR_UI::show_splash ()
{
cerr << "Show splash!\n";
if (splash == 0) {
try {
splash = new Splash;
@ -2866,24 +2843,7 @@ ARDOUR_UI::show_splash ()
}
}
bool was_mapped = splash->is_mapped ();
if (!was_mapped) {
splash_expose = splash->signal_map_event().connect (sigc::mem_fun (this, &ARDOUR_UI::splash_visible), false);
splash_done_visible = false;
}
splash->pop_front ();
splash->present ();
if (!was_mapped) {
while (!splash_done_visible) {
cerr << "nested iteration. sdv = " << splash_done_visible << endl;
gtk_main_iteration ();
}
}
cerr << "show splash done\n";
splash->display ();
}
void

View file

@ -611,11 +611,6 @@ class ARDOUR_UI : public Gtkmm2ext::UI, public ARDOUR::SessionHandlePtr
About* about;
Splash* splash;
bool splash_done_visible;
static bool wakeup_from_splash_sleep (void *);
void _wakeup_from_splash_sleep ();
bool splash_visible (GdkEventAny*);
sigc::connection splash_expose;
void pop_back_splash (Gtk::Window&);

View file

@ -85,6 +85,40 @@ Splash::~Splash ()
the_splash = 0;
}
bool
Splash::wakeup_from_splash_sleep ()
{
splash_done_visible = true;
return false;
}
bool
Splash::splash_mapped (GdkEventAny*)
{
Glib::signal_idle().connect (sigc::mem_fun (this, &Splash::wakeup_from_splash_sleep));
return false;
}
void
Splash::display ()
{
bool was_mapped = is_mapped ();
if (!was_mapped) {
signal_map_event().connect (sigc::mem_fun (this, &Splash::splash_mapped), false);
splash_done_visible = false;
}
pop_front ();
present ();
if (!was_mapped) {
while (!splash_done_visible) {
gtk_main_iteration ();
}
}
}
void
Splash::pop_back_for (Gtk::Window& win)
{

View file

@ -38,6 +38,7 @@ class Splash : public Gtk::Window
static Splash* instance() { return the_splash; }
void display ();
void pop_back_for (Gtk::Window&);
void pop_front ();
@ -56,6 +57,10 @@ class Splash : public Gtk::Window
void boot_message (std::string);
PBD::ScopedConnection msg_connection;
bool splash_done_visible;
bool wakeup_from_splash_sleep ();
bool splash_mapped (GdkEventAny*);
};
#endif /* __ardour_gtk_splash_h__ */