app/widgets/gimpdockable.c moved utility function for setting attributes

2008-03-19  Sven Neumann  <sven@gimp.org>

	* app/widgets/gimpdockable.c
	* app/widgets/gimpwidgets-utils.[ch]: moved utility function for
	setting attributes on a PangoLayout out of gimpdockable.c.

	* app/display/gimpcanvas.c (gimp_canvas_draw_drop_zone): use a
	bold font and paint the layout with transparency.

svn path=/trunk/; revision=25116
This commit is contained in:
Sven Neumann 2008-03-19 09:29:30 +00:00 committed by Sven Neumann
parent ebdd875ce7
commit a355f1777b
5 changed files with 43 additions and 23 deletions

View File

@ -1,3 +1,12 @@
2008-03-19 Sven Neumann <sven@gimp.org>
* app/widgets/gimpdockable.c
* app/widgets/gimpwidgets-utils.[ch]: moved utility function for
setting attributes on a PangoLayout out of gimpdockable.c.
* app/display/gimpcanvas.c (gimp_canvas_draw_drop_zone): use a
bold font and paint the layout with transparency.
2008-03-19 Sven Neumann <sven@gimp.org>
* app/display/gimpdisplayshell.c (gimp_display_shell_update_icon):

View File

@ -838,13 +838,18 @@ gimp_canvas_draw_drop_zone (GimpCanvas *canvas,
cairo_t *cr)
{
GtkWidget *widget = GTK_WIDGET (canvas);
GdkColor *color = &widget->style->fg[widget->state];
gint width;
gint height;
gdouble factor;
if (! canvas->drop_zone_layout)
canvas->drop_zone_layout = gtk_widget_create_pango_layout (widget,
_("Drop Files"));
{
canvas->drop_zone_layout = gtk_widget_create_pango_layout (widget,
_("Drag images here"));
gimp_pango_layout_set_weight (canvas->drop_zone_layout,
PANGO_WEIGHT_BOLD);
}
pango_layout_get_pixel_size (canvas->drop_zone_layout, &width, &height);
@ -852,13 +857,16 @@ gimp_canvas_draw_drop_zone (GimpCanvas *canvas,
2.0 / 3.0 * widget->allocation.height / height);
cairo_scale (cr, factor, factor);
cairo_move_to (cr,
(widget->allocation.width / factor - width) / 2.0,
(widget->allocation.height / factor - height) / 2.0);
cairo_set_source_rgba (cr,
color->red / 65535.0,
color->green / 65535.0,
color->blue / 65535.0,
0.1);
pango_cairo_show_layout (cr, canvas->drop_zone_layout);
cairo_fill (cr);
}
/**

View File

@ -446,24 +446,6 @@ gimp_dockable_style_set (GtkWidget *widget,
}
}
static void
gimp_dockable_layout_set_weight (PangoLayout *layout,
PangoWeight weight)
{
PangoAttrList *attrs;
PangoAttribute *attr;
attrs = pango_attr_list_new ();
attr = pango_attr_weight_new (PANGO_WEIGHT_SEMIBOLD);
attr->start_index = 0;
attr->end_index = -1;
pango_attr_list_insert (attrs, attr);
pango_layout_set_attributes (layout, attrs);
pango_attr_list_unref (attrs);
}
static PangoLayout *
gimp_dockable_create_title_layout (GimpDockable *dockable,
GtkWidget *widget,
@ -480,7 +462,7 @@ gimp_dockable_create_title_layout (GimpDockable *dockable,
title ? title : dockable->blurb);
g_free (title);
gimp_dockable_layout_set_weight (layout, PANGO_WEIGHT_SEMIBOLD);
gimp_pango_layout_set_weight (layout, PANGO_WEIGHT_SEMIBOLD);
if (width > 0)
{

View File

@ -1072,3 +1072,21 @@ gimp_get_message_stock_id (GimpMessageSeverity severity)
g_return_val_if_reached (GIMP_STOCK_WARNING);
}
void
gimp_pango_layout_set_weight (PangoLayout *layout,
PangoWeight weight)
{
PangoAttrList *attrs;
PangoAttribute *attr;
attrs = pango_attr_list_new ();
attr = pango_attr_weight_new (PANGO_WEIGHT_SEMIBOLD);
attr->start_index = 0;
attr->end_index = -1;
pango_attr_list_insert (attrs, attr);
pango_layout_set_attributes (layout, attrs);
pango_attr_list_unref (attrs);
}

View File

@ -90,5 +90,8 @@ void gimp_widget_set_accel_help (GtkWidget *widget,
const gchar * gimp_get_message_stock_id (GimpMessageSeverity severity);
void gimp_pango_layout_set_weight (PangoLayout *layout,
PangoWeight weight);
#endif /* __GIMP_WIDGETS_UTILS_H__ */