diff options
author | David Robillard <d@drobilla.net> | 2008-01-19 03:49:52 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2008-01-19 03:49:52 +0000 |
commit | 4ca1fe7993adf63ea3f35958f63dd20ee546e7ae (patch) | |
tree | f773e6cf00e08a8260c2e2b28b8e16e28b39b887 /gtk2_ardour/splash.cc | |
parent | f80fad313a21228f31201279cccaf555796c7eec (diff) |
Merge with trunk R2935.
git-svn-id: svn://localhost/ardour2/branches/3.0@2943 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/splash.cc')
-rw-r--r-- | gtk2_ardour/splash.cc | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/gtk2_ardour/splash.cc b/gtk2_ardour/splash.cc new file mode 100644 index 0000000000..eee108c70b --- /dev/null +++ b/gtk2_ardour/splash.cc @@ -0,0 +1,60 @@ +#include <string> + +#include <pbd/failed_constructor.h> +#include <pbd/file_utils.h> +#include <ardour/ardour.h> +#include <ardour/filesystem_paths.h> + +#include "splash.h" + +#include "i18n.h" + +using namespace Gtk; +using namespace Glib; +using namespace std; +using namespace ARDOUR; + +Splash::Splash () +{ + sys::path splash_file; + + if (!find_file_in_search_path (ardour_search_path(), "splash.png", splash_file)) { + throw failed_constructor(); + } + + try { + pixbuf = Gdk::Pixbuf::create_from_file (splash_file.to_string()); + } + + catch (...) { + throw failed_constructor(); + } + + set_size_request (pixbuf->get_width(), pixbuf->get_height()); + set_type_hint (Gdk::WINDOW_TYPE_HINT_SPLASHSCREEN); + set_keep_above (true); + set_position (WIN_POS_CENTER); + add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK); +} + +bool +Splash::on_button_release_event (GdkEventButton* ev) +{ + hide (); +} + +bool +Splash::on_expose_event (GdkEventExpose* ev) +{ + RefPtr<Gdk::Window> window = get_window(); + + Window::on_expose_event (ev); + + window->draw_pixbuf (get_style()->get_bg_gc (STATE_NORMAL), pixbuf, + ev->area.x, ev->area.y, + ev->area.x, ev->area.y, + ev->area.width, ev->area.height, + Gdk::RGB_DITHER_NONE, 0, 0); + + return true; +} |