3 #include <pbd/failed_constructor.h>
4 #include <ardour/ardour.h>
6 #include "gui_thread.h"
14 using namespace ARDOUR;
16 Splash* Splash::the_splash = 0;
20 string path = find_data_file ("splash.png");
23 throw failed_constructor();
27 pixbuf = Gdk::Pixbuf::create_from_file (path);
31 throw failed_constructor();
34 darea.set_size_request (pixbuf->get_width(), pixbuf->get_height());
35 set_keep_above (true);
36 set_position (WIN_POS_CENTER);
37 darea.add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK);
38 darea.set_double_buffered (false);
40 layout = create_pango_layout ("");
42 string i18n = _("Ardour loading ...");
46 layout->set_markup (str);
49 darea.signal_expose_event().connect (mem_fun (*this, &Splash::expose));
53 set_default_size (pixbuf->get_width(), pixbuf->get_height());
56 ARDOUR::BootMessage.connect (mem_fun (*this, &Splash::boot_message));
62 set_keep_above (false);
68 Window::on_realize ();
69 get_window()->set_decorations (Gdk::WMDecoration(0));
70 layout->set_font_description (get_style()->get_font());
75 Splash::on_button_release_event (GdkEventButton* ev)
82 Splash::expose (GdkEventExpose* ev)
84 RefPtr<Gdk::Window> window = darea.get_window();
86 /* note: height & width need to be constrained to the pixbuf size
87 in case a WM provides us with a screwy allocation
90 window->draw_pixbuf (get_style()->get_bg_gc (STATE_NORMAL), pixbuf,
91 ev->area.x, ev->area.y,
92 ev->area.x, ev->area.y,
93 min ((pixbuf->get_width() - ev->area.x), ev->area.width),
94 min ((pixbuf->get_height() - ev->area.y), ev->area.height),
95 Gdk::RGB_DITHER_NONE, 0, 0);
97 Glib::RefPtr<Gtk::Style> style = darea.get_style();
98 Glib::RefPtr<Gdk::GC> white = style->get_white_gc();
100 window->draw_layout (white, 10, pixbuf->get_height() - 30, layout);
106 Splash::boot_message (std::string msg)
112 Splash::message (const string& msg)
118 layout->set_markup (str);
119 Glib::RefPtr<Gdk::Window> win = darea.get_window();
122 win->invalidate_rect (Gdk::Rectangle (0, darea.get_height() - 30,
123 darea.get_width(), 30), true);
124 win->process_updates (true);