3 #include "pbd/failed_constructor.h"
4 #include "pbd/file_utils.h"
5 #include "ardour/ardour.h"
6 #include "ardour/filesystem_paths.h"
8 #include "gui_thread.h"
17 using namespace ARDOUR;
19 Splash* Splash::the_splash = 0;
23 sys::path splash_file;
25 if (!find_file_in_search_path (ardour_data_search_path(), "splash.png", splash_file)) {
26 throw failed_constructor();
30 pixbuf = Gdk::Pixbuf::create_from_file (splash_file.to_string());
34 throw failed_constructor();
37 darea.set_size_request (pixbuf->get_width(), pixbuf->get_height());
39 set_position (WIN_POS_CENTER);
40 darea.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK);
41 darea.set_double_buffered (false);
43 layout = create_pango_layout ("");
45 string i18n = string_compose (_("%1 loading ..."), PROGRAM_NAME);
49 layout->set_markup (str);
52 darea.signal_expose_event().connect (sigc::mem_fun (*this, &Splash::expose));
56 set_default_size (pixbuf->get_width(), pixbuf->get_height());
59 ARDOUR::BootMessage.connect (msg_connection, invalidator (*this), boost::bind (&Splash::boot_message, this, _1), gui_context());
63 Splash::pop_back_for (Gtk::Window& win)
65 set_keep_above (false);
66 get_window()->restack (win.get_window(), false);
67 win.signal_hide().connect (sigc::mem_fun (*this, &Splash::pop_front));
73 set_keep_above (true);
79 Window::on_realize ();
80 get_window()->set_decorations (Gdk::WMDecoration(0));
81 layout->set_font_description (get_style()->get_font());
86 Splash::on_button_release_event (GdkEventButton*)
93 Splash::expose (GdkEventExpose* ev)
95 RefPtr<Gdk::Window> window = darea.get_window();
97 /* note: height & width need to be constrained to the pixbuf size
98 in case a WM provides us with a screwy allocation
101 window->draw_pixbuf (get_style()->get_bg_gc (STATE_NORMAL), pixbuf,
102 ev->area.x, ev->area.y,
103 ev->area.x, ev->area.y,
104 min ((pixbuf->get_width() - ev->area.x), ev->area.width),
105 min ((pixbuf->get_height() - ev->area.y), ev->area.height),
106 Gdk::RGB_DITHER_NONE, 0, 0);
108 Glib::RefPtr<Gtk::Style> style = darea.get_style();
109 Glib::RefPtr<Gdk::GC> white = style->get_white_gc();
111 window->draw_layout (white, 10, pixbuf->get_height() - 30, layout);
117 Splash::boot_message (std::string msg)
123 Splash::message (const string& msg)
129 layout->set_markup (str);
130 Glib::RefPtr<Gdk::Window> win = darea.get_window();
133 win->invalidate_rect (Gdk::Rectangle (0, darea.get_height() - 30,
134 darea.get_width(), 30), true);
135 win->process_updates (true);