diff options
author | Doug McLain <doug@nostar.net> | 2006-03-14 07:46:59 +0000 |
---|---|---|
committer | Doug McLain <doug@nostar.net> | 2006-03-14 07:46:59 +0000 |
commit | 84a2923794c76525856909c0b73d46c27106ccfc (patch) | |
tree | e546c61bb5f39c9402447d2024c6e5c14e6223ae /libs | |
parent | 191f3239576f085befc2e1834de3ff6141023ffb (diff) |
created get_bogus_drawable() when I realized it was needed by FastMeter as well as Pix. All pixmaps are files now, located in gtk2_ardour/pixmaps and loaded by default from ~/.ardour/pixmaps at runtime
git-svn-id: svn://localhost/trunk/ardour2@390 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs')
-rw-r--r-- | libs/gtkmm2ext/fastmeter.cc | 9 | ||||
-rw-r--r-- | libs/gtkmm2ext/gtkmm2ext/fastmeter.h | 4 | ||||
-rw-r--r-- | libs/gtkmm2ext/gtkmm2ext/utils.h | 1 | ||||
-rw-r--r-- | libs/gtkmm2ext/pix.cc | 16 | ||||
-rw-r--r-- | libs/gtkmm2ext/utils.cc | 14 |
5 files changed, 26 insertions, 18 deletions
diff --git a/libs/gtkmm2ext/fastmeter.cc b/libs/gtkmm2ext/fastmeter.cc index e1b3361f57..82a04b5521 100644 --- a/libs/gtkmm2ext/fastmeter.cc +++ b/libs/gtkmm2ext/fastmeter.cc @@ -23,6 +23,7 @@ #include <algorithm> #include <gdkmm/rectangle.h> #include <gtkmm2ext/fastmeter.h> +#include <gtkmm2ext/utils.h> #include <gtkmm/style.h> using namespace Gtk; @@ -72,12 +73,12 @@ FastMeter::~FastMeter () } void -FastMeter::set_vertical_xpm (const char **xpm) +FastMeter::set_vertical_xpm (const std::string& xpm_file) { if (v_pixmap == 0) { gint w, h; - v_pixmap = Pixmap::create_from_xpm(Colormap::get_system(), v_mask, xpm); + v_pixmap = Pixmap::create_from_xpm(get_bogus_drawable(), Colormap::get_system(), v_mask, Gdk::Color(), xpm_file); v_pixmap->get_size(w, h); v_pixheight = h; @@ -86,12 +87,12 @@ FastMeter::set_vertical_xpm (const char **xpm) } void -FastMeter::set_horizontal_xpm (const char **xpm) +FastMeter::set_horizontal_xpm (const std::string& xpm_file) { if (h_pixmap == 0) { gint w, h; - h_pixmap = Pixmap::create_from_xpm(Colormap::get_system(), h_mask, xpm); + h_pixmap = Pixmap::create_from_xpm(get_bogus_drawable(), Colormap::get_system(), h_mask, Gdk::Color(), xpm_file); h_pixmap->get_size(w, h); h_pixheight = h; diff --git a/libs/gtkmm2ext/gtkmm2ext/fastmeter.h b/libs/gtkmm2ext/gtkmm2ext/fastmeter.h index 53d0666e1f..5defcfae8f 100644 --- a/libs/gtkmm2ext/gtkmm2ext/fastmeter.h +++ b/libs/gtkmm2ext/gtkmm2ext/fastmeter.h @@ -46,8 +46,8 @@ class FastMeter : public Gtk::DrawingArea { long hold_count() { return hold_cnt; } void set_hold_count (long); - static void set_horizontal_xpm (const char **xpm); - static void set_vertical_xpm (const char **xpm); + static void set_horizontal_xpm (const std::string&); + static void set_vertical_xpm (const std::string&); protected: bool on_expose_event (GdkEventExpose*); diff --git a/libs/gtkmm2ext/gtkmm2ext/utils.h b/libs/gtkmm2ext/gtkmm2ext/utils.h index 639d2203dc..6f34866ce9 100644 --- a/libs/gtkmm2ext/gtkmm2ext/utils.h +++ b/libs/gtkmm2ext/gtkmm2ext/utils.h @@ -51,6 +51,7 @@ namespace Gtkmm2ext { GdkWindow* get_paned_handle (Gtk::Paned& paned); void set_decoration (Gtk::Window* win, Gdk::WMDecoration decor); void set_treeview_header_as_default_label(Gtk::TreeViewColumn *c); + Glib::RefPtr<Gdk::Drawable> get_bogus_drawable(); }; #endif /* __gtkmm2ext_utils_h__ */ diff --git a/libs/gtkmm2ext/pix.cc b/libs/gtkmm2ext/pix.cc index ee7503b1c7..ba10715861 100644 --- a/libs/gtkmm2ext/pix.cc +++ b/libs/gtkmm2ext/pix.cc @@ -19,8 +19,7 @@ */ #include <algorithm> -#include <iostream> -#include <gtkmm/window.h> + #include <gdkmm.h> #include <gdkmm/pixmap.h> @@ -35,6 +34,7 @@ */ #include <gtkmm2ext/pix.h> +#include <gtkmm2ext/utils.h> namespace std { @@ -141,16 +141,8 @@ Pix::generate () for (int i = 0; i < pixmap_count; i++) { if (from_files) { - static Gtk::Button* button = 0; - static const Gdk::Color color; - - if (button == 0) { - button = new Gtk::Button ("blah"); //bogus button to extract a Gdk::Drawable from - } - const Glib::RefPtr<const Gdk::Drawable> drawable = button->get_window(); - - pixmaps[i] = Gdk::Pixmap::create_from_xpm (drawable, Gdk::Colormap::get_system(), - bitmaps[i], color, *(*files)[i]); + pixmaps[i] = Gdk::Pixmap::create_from_xpm (get_bogus_drawable(), Gdk::Colormap::get_system(), + bitmaps[i], Gdk::Color(), *(*files)[i]); } else { gchar **xpm; xpm = const_cast<gchar **> (data[i]); diff --git a/libs/gtkmm2ext/utils.cc b/libs/gtkmm2ext/utils.cc index 63cbde1ac2..79b84aa26d 100644 --- a/libs/gtkmm2ext/utils.cc +++ b/libs/gtkmm2ext/utils.cc @@ -23,6 +23,7 @@ #include <gtkmm2ext/utils.h> #include <gtkmm/widget.h> +#include <gtkmm/button.h> #include <gtkmm/window.h> #include <gtkmm/paned.h> #include <gtkmm/comboboxtext.h> @@ -81,3 +82,16 @@ void Gtkmm2ext::set_treeview_header_as_default_label(Gtk::TreeViewColumn* c) { gtk_tree_view_column_set_widget( c->gobj(), GTK_WIDGET(0) ); } + +Glib::RefPtr<Gdk::Drawable> +Gtkmm2ext::get_bogus_drawable() +{ + static Gtk::Button* button = 0; + + if (button == 0) { + button = new Gtk::Button ("blah"); //bogus button to extract a Gdk::Drawable from + } + static Glib::RefPtr<Gdk::Drawable> drawable = button->get_window(); + return drawable; +} + |