13
0

OS X-based fixes for splash screen mgmt

git-svn-id: svn://localhost/ardour2/branches/3.0@13006 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2012-07-10 01:04:36 +00:00
parent 7aa66b6623
commit 2de80a5e90
3 changed files with 64 additions and 58 deletions

View File

@ -2396,20 +2396,6 @@ ARDOUR_UI::idle_load (const std::string& path)
}
}
void
ARDOUR_UI::loading_message (const std::string& msg)
{
if (ARDOUR_COMMAND_LINE::no_splash) {
return;
}
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 */
int
ARDOUR_UI::get_session_parameters (bool quit_on_cancel, bool should_be_new, string load_template)
@ -2814,7 +2800,7 @@ ARDOUR_UI::launch_manual ()
void
ARDOUR_UI::launch_reference ()
{
PBD::open_uri("http://ardour.org/refmanual");
PBD::open_uri ("http://ardour.org/refmanual");
}
void
@ -2832,6 +2818,20 @@ ARDOUR_UI::about_signal_response (int /*response*/)
hide_about();
}
void
ARDOUR_UI::loading_message (const std::string& msg)
{
if (ARDOUR_COMMAND_LINE::no_splash) {
return;
}
if (!splash) {
show_splash ();
}
splash->message (msg);
}
void
ARDOUR_UI::show_splash ()
{

View File

@ -21,6 +21,7 @@
#include "pbd/failed_constructor.h"
#include "pbd/file_utils.h"
#include "ardour/ardour.h"
#include "ardour/filesystem_paths.h"
@ -44,6 +45,7 @@ Splash::Splash ()
std::string splash_file;
if (!find_file_in_search_path (ardour_data_search_path(), "splash.png", splash_file)) {
cerr << "Cannot find splash screen image file\n";
throw failed_constructor();
}
@ -52,6 +54,7 @@ Splash::Splash ()
}
catch (...) {
cerr << "Cannot construct splash screen image\n";
throw failed_constructor();
}
@ -77,6 +80,8 @@ Splash::Splash ()
set_default_size (pixbuf->get_width(), pixbuf->get_height());
the_splash = this;
expose_done = false;
ARDOUR::BootMessage.connect (msg_connection, invalidator (*this), boost::bind (&Splash::boot_message, this, _1), gui_context());
}
@ -85,40 +90,6 @@ 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)
{
@ -141,10 +112,15 @@ Splash::on_realize ()
layout->set_font_description (get_style()->get_font());
}
bool
Splash::on_button_release_event (GdkEventButton*)
Splash::on_button_release_event (GdkEventButton* ev)
{
RefPtr<Gdk::Window> window = get_window();
if (!window || ev->window != window->gobj()) {
return false;
}
hide ();
return true;
}
@ -169,6 +145,8 @@ Splash::expose (GdkEventExpose* ev)
Glib::RefPtr<Gdk::GC> white = style->get_white_gc();
window->draw_layout (white, 10, pixbuf->get_height() - 30, layout);
Glib::signal_idle().connect (sigc::mem_fun (this, &Splash::idle_after_expose));
return true;
}
@ -179,6 +157,32 @@ Splash::boot_message (std::string msg)
message (msg);
}
bool
Splash::idle_after_expose ()
{
expose_done = true;
return false;
}
void
Splash::display ()
{
bool was_mapped = is_mapped ();
if (!was_mapped) {
expose_done = false;
}
pop_front ();
present ();
if (!was_mapped) {
while (!expose_done) {
gtk_main_iteration ();
}
}
}
void
Splash::message (const string& msg)
{
@ -190,9 +194,12 @@ Splash::message (const string& msg)
Glib::RefPtr<Gdk::Window> win = darea.get_window();
if (win) {
win->invalidate_rect (Gdk::Rectangle (0, darea.get_height() - 30,
darea.get_width(), 30), true);
win->process_updates (true);
gdk_flush ();
expose_done = false;
win->invalidate_rect (Gdk::Rectangle (0, darea.get_height() - 30, darea.get_width(), 30), true);
while (!expose_done) {
gtk_main_iteration ();
}
}
}

View File

@ -58,9 +58,8 @@ 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*);
bool expose_done;
bool idle_after_expose ();
};
#endif /* __ardour_gtk_splash_h__ */