}
string
-fit_to_pixels (string str, int pixel_width, string font)
+fit_to_pixels (ARDOUR::stringcr_t str, int pixel_width, ARDOUR::stringcr_t font)
{
Label foo;
int width;
Pango::FontDescription
get_font_for_style (string widgetname)
{
+ Gtk::Window window (WINDOW_TOPLEVEL);
Gtk::Label foobar;
Glib::RefPtr<Style> style;
+ window.add (foobar);
foobar.set_name (widgetname);
foobar.ensure_style();
uint32_t
rgba_from_style (string style, uint32_t r, uint32_t g, uint32_t b, uint32_t a)
{
+ /* In GTK+2, styles aren't set up correctly if the widget is not
+ attached to a toplevel window that has a screen pointer.
+ */
+
+ static Gtk::Window* window = 0;
+
+ if (window == 0) {
+ window = new Window (WINDOW_TOPLEVEL);
+ }
+
Gtk::Label foo;
+ window->add (foo);
+
foo.set_name (style);
foo.ensure_style ();
} else {
warning << string_compose (_("missing RGBA style for \"%1\""), style) << endl;
}
+
+ window->remove ();
return (uint32_t) RGBA_TO_UINT(r,g,b,a);
}