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"
16 using namespace ARDOUR;
18 Splash* Splash::the_splash = 0;
22 sys::path splash_file;
24 if (!find_file_in_search_path (ardour_search_path() + system_data_search_path(), "splash.png", splash_file)) {
25 throw failed_constructor();
29 pixbuf = Gdk::Pixbuf::create_from_file (splash_file.to_string());
33 throw failed_constructor();
36 darea.set_size_request (pixbuf->get_width(), pixbuf->get_height());
37 set_keep_above (true);
38 set_position (WIN_POS_CENTER);
39 darea.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK);
40 darea.set_double_buffered (false);
42 layout = create_pango_layout ("");
44 string i18n = _("Ardour loading ...");
48 layout->set_markup (str);
51 darea.signal_expose_event().connect (mem_fun (*this, &Splash::expose));
55 set_default_size (pixbuf->get_width(), pixbuf->get_height());
58 ARDOUR::BootMessage.connect (mem_fun (*this, &Splash::boot_message));
64 set_keep_above (false);
70 Window::on_realize ();
71 get_window()->set_decorations (Gdk::WMDecoration(0));
72 layout->set_font_description (get_style()->get_font());
77 Splash::on_button_release_event (GdkEventButton* ev)
84 Splash::expose (GdkEventExpose* ev)
86 RefPtr<Gdk::Window> window = darea.get_window();
88 /* note: height & width need to be constrained to the pixbuf size
89 in case a WM provides us with a screwy allocation
92 window->draw_pixbuf (get_style()->get_bg_gc (STATE_NORMAL), pixbuf,
93 ev->area.x, ev->area.y,
94 ev->area.x, ev->area.y,
95 min ((pixbuf->get_width() - ev->area.x), ev->area.width),
96 min ((pixbuf->get_height() - ev->area.y), ev->area.height),
97 Gdk::RGB_DITHER_NONE, 0, 0);
99 Glib::RefPtr<Gtk::Style> style = darea.get_style();
100 Glib::RefPtr<Gdk::GC> white = style->get_white_gc();
102 window->draw_layout (white, 10, pixbuf->get_height() - 30, layout);
108 Splash::boot_message (std::string msg)
114 Splash::message (const string& msg)
120 layout->set_markup (str);
121 Glib::RefPtr<Gdk::Window> win = darea.get_window();
124 win->invalidate_rect (Gdk::Rectangle (0, darea.get_height() - 30,
125 darea.get_width(), 30), true);
126 win->process_updates (true);