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_search_path() + system_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());
38 set_keep_above (true);
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), ui_bind (&Splash::boot_message
, this, _1
), gui_context());
65 set_keep_above (false);
71 Window::on_realize ();
72 get_window()->set_decorations (Gdk::WMDecoration(0));
73 layout
->set_font_description (get_style()->get_font());
78 Splash::on_button_release_event (GdkEventButton
*)
85 Splash::expose (GdkEventExpose
* ev
)
87 RefPtr
<Gdk::Window
> window
= darea
.get_window();
89 /* note: height & width need to be constrained to the pixbuf size
90 in case a WM provides us with a screwy allocation
93 window
->draw_pixbuf (get_style()->get_bg_gc (STATE_NORMAL
), pixbuf
,
94 ev
->area
.x
, ev
->area
.y
,
95 ev
->area
.x
, ev
->area
.y
,
96 min ((pixbuf
->get_width() - ev
->area
.x
), ev
->area
.width
),
97 min ((pixbuf
->get_height() - ev
->area
.y
), ev
->area
.height
),
98 Gdk::RGB_DITHER_NONE
, 0, 0);
100 Glib::RefPtr
<Gtk::Style
> style
= darea
.get_style();
101 Glib::RefPtr
<Gdk::GC
> white
= style
->get_white_gc();
103 window
->draw_layout (white
, 10, pixbuf
->get_height() - 30, layout
);
109 Splash::boot_message (std::string msg
)
115 Splash::message (const string
& msg
)
121 layout
->set_markup (str
);
122 Glib::RefPtr
<Gdk::Window
> win
= darea
.get_window();
125 win
->invalidate_rect (Gdk::Rectangle (0, darea
.get_height() - 30,
126 darea
.get_width(), 30), true);
127 win
->process_updates (true);