mirror of https://github.com/GNOME/gimp.git
libgimp/gimpgradientselectbutton.c libgimp/gimpmenu.c
2008-06-28 Michael Natterer <mitch@gimp.org> * libgimp/gimpgradientselectbutton.c * libgimp/gimpmenu.c * libgimpwidgets/gimpbrowser.c * libgimpwidgets/gimpcellrenderercolor.c * libgimpwidgets/gimpcellrenderertoggle.c * libgimpwidgets/gimpchainbutton.c * libgimpwidgets/gimpcolorarea.c * libgimpwidgets/gimpcolorscale.c * libgimpwidgets/gimpcolorscales.c * libgimpwidgets/gimpcolorselect.c * libgimpwidgets/gimpenumwidgets.c * libgimpwidgets/gimpframe.c * libgimpwidgets/gimphelpui.c * libgimpwidgets/gimpoffsetarea.c * libgimpwidgets/gimppreviewarea.c * libgimpwidgets/gimppropwidgets.c * libgimpwidgets/gimpscrolledpreview.c: use accessors instead of accessing members of GTK+ widgets directly. svn path=/trunk/; revision=26005
This commit is contained in:
parent
29754a4cff
commit
58cfcd4f57
21
ChangeLog
21
ChangeLog
|
@ -1,3 +1,24 @@
|
||||||
|
2008-06-28 Michael Natterer <mitch@gimp.org>
|
||||||
|
|
||||||
|
* libgimp/gimpgradientselectbutton.c
|
||||||
|
* libgimp/gimpmenu.c
|
||||||
|
* libgimpwidgets/gimpbrowser.c
|
||||||
|
* libgimpwidgets/gimpcellrenderercolor.c
|
||||||
|
* libgimpwidgets/gimpcellrenderertoggle.c
|
||||||
|
* libgimpwidgets/gimpchainbutton.c
|
||||||
|
* libgimpwidgets/gimpcolorarea.c
|
||||||
|
* libgimpwidgets/gimpcolorscale.c
|
||||||
|
* libgimpwidgets/gimpcolorscales.c
|
||||||
|
* libgimpwidgets/gimpcolorselect.c
|
||||||
|
* libgimpwidgets/gimpenumwidgets.c
|
||||||
|
* libgimpwidgets/gimpframe.c
|
||||||
|
* libgimpwidgets/gimphelpui.c
|
||||||
|
* libgimpwidgets/gimpoffsetarea.c
|
||||||
|
* libgimpwidgets/gimppreviewarea.c
|
||||||
|
* libgimpwidgets/gimppropwidgets.c
|
||||||
|
* libgimpwidgets/gimpscrolledpreview.c: use accessors instead of
|
||||||
|
accessing members of GTK+ widgets directly.
|
||||||
|
|
||||||
2008-06-28 Michael Natterer <mitch@gimp.org>
|
2008-06-28 Michael Natterer <mitch@gimp.org>
|
||||||
|
|
||||||
* app/widgets/gimplanguagestore-parser.c: include
|
* app/widgets/gimplanguagestore-parser.c: include
|
||||||
|
|
|
@ -528,10 +528,11 @@ gimp_gradient_select_preview_expose (GtkWidget *widget,
|
||||||
|
|
||||||
for (y = event->area.y; y < event->area.y + event->area.height; y++)
|
for (y = event->area.y; y < event->area.y + event->area.height; y++)
|
||||||
{
|
{
|
||||||
guchar *buf = ((y / GIMP_CHECK_SIZE_SM) & 1) ? odd : even;
|
GtkStyle *style = gtk_widget_get_style (widget);
|
||||||
|
guchar *buf = ((y / GIMP_CHECK_SIZE_SM) & 1) ? odd : even;
|
||||||
|
|
||||||
gdk_draw_rgb_image_dithalign (widget->window,
|
gdk_draw_rgb_image_dithalign (widget->window,
|
||||||
widget->style->fg_gc[widget->state],
|
style->fg_gc[widget->state],
|
||||||
event->area.x, y,
|
event->area.x, y,
|
||||||
event->area.width, 1,
|
event->area.width, 1,
|
||||||
GDK_RGB_DITHER_MAX,
|
GDK_RGB_DITHER_MAX,
|
||||||
|
|
|
@ -484,12 +484,13 @@ static void
|
||||||
gimp_menu_callback (GtkWidget *widget,
|
gimp_menu_callback (GtkWidget *widget,
|
||||||
gpointer any_ID)
|
gpointer any_ID)
|
||||||
{
|
{
|
||||||
GimpMenuCallback callback;
|
GtkWidget *parent = gtk_widget_get_parent (widget);
|
||||||
gpointer callback_data;
|
GimpMenuCallback callback;
|
||||||
|
gpointer callback_data;
|
||||||
|
|
||||||
callback = (GimpMenuCallback) g_object_get_data (G_OBJECT (widget->parent),
|
callback = (GimpMenuCallback) g_object_get_data (G_OBJECT (parent),
|
||||||
"gimp-menu-callback");
|
"gimp-menu-callback");
|
||||||
callback_data = g_object_get_data (G_OBJECT (widget->parent),
|
callback_data = g_object_get_data (G_OBJECT (parent),
|
||||||
"gimp-menu-callback-data");
|
"gimp-menu-callback-data");
|
||||||
|
|
||||||
(* callback) (GPOINTER_TO_INT (any_ID), callback_data);
|
(* callback) (GPOINTER_TO_INT (any_ID), callback_data);
|
||||||
|
|
|
@ -207,8 +207,8 @@ gimp_browser_add_search_types (GimpBrowser *browser,
|
||||||
browser->search_type_combo = combo;
|
browser->search_type_combo = combo;
|
||||||
browser->search_type = first_type_id;
|
browser->search_type = first_type_id;
|
||||||
|
|
||||||
gtk_box_pack_end (GTK_BOX (browser->search_entry->parent), combo,
|
gtk_box_pack_end (GTK_BOX (gtk_widget_get_parent (browser->search_entry)),
|
||||||
FALSE, FALSE, 0);
|
combo, FALSE, FALSE, 0);
|
||||||
gtk_widget_show (combo);
|
gtk_widget_show (combo);
|
||||||
|
|
||||||
gimp_int_combo_box_connect (GIMP_INT_COMBO_BOX (combo),
|
gimp_int_combo_box_connect (GIMP_INT_COMBO_BOX (combo),
|
||||||
|
|
|
@ -237,7 +237,8 @@ gimp_cell_renderer_color_render (GtkCellRenderer *cell,
|
||||||
|
|
||||||
if (rect.width > 2 && rect.height > 2)
|
if (rect.width > 2 && rect.height > 2)
|
||||||
{
|
{
|
||||||
cairo_t *cr = gdk_cairo_create (window);
|
cairo_t *cr = gdk_cairo_create (window);
|
||||||
|
GtkStyle *style = gtk_widget_get_style (widget);
|
||||||
GtkStateType state;
|
GtkStateType state;
|
||||||
|
|
||||||
cairo_rectangle (cr,
|
cairo_rectangle (cr,
|
||||||
|
@ -285,13 +286,13 @@ gimp_cell_renderer_color_render (GtkCellRenderer *cell,
|
||||||
}
|
}
|
||||||
|
|
||||||
cairo_set_line_width (cr, 1);
|
cairo_set_line_width (cr, 1);
|
||||||
gdk_cairo_set_source_color (cr, &widget->style->fg[state]);
|
gdk_cairo_set_source_color (cr, &style->fg[state]);
|
||||||
cairo_stroke_preserve (cr);
|
cairo_stroke_preserve (cr);
|
||||||
|
|
||||||
if (state == GTK_STATE_SELECTED &&
|
if (state == GTK_STATE_SELECTED &&
|
||||||
gimp_cairo_set_focus_line_pattern (cr, widget))
|
gimp_cairo_set_focus_line_pattern (cr, widget))
|
||||||
{
|
{
|
||||||
gdk_cairo_set_source_color (cr, &widget->style->fg[GTK_STATE_NORMAL]);
|
gdk_cairo_set_source_color (cr, &style->fg[GTK_STATE_NORMAL]);
|
||||||
cairo_stroke (cr);
|
cairo_stroke (cr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -220,6 +220,7 @@ gimp_cell_renderer_toggle_get_size (GtkCellRenderer *cell,
|
||||||
gint *height)
|
gint *height)
|
||||||
{
|
{
|
||||||
GimpCellRendererToggle *toggle = GIMP_CELL_RENDERER_TOGGLE (cell);
|
GimpCellRendererToggle *toggle = GIMP_CELL_RENDERER_TOGGLE (cell);
|
||||||
|
GtkStyle *style = gtk_widget_get_style (widget);
|
||||||
gint calc_width;
|
gint calc_width;
|
||||||
gint calc_height;
|
gint calc_height;
|
||||||
gint pixbuf_width;
|
gint pixbuf_width;
|
||||||
|
@ -242,9 +243,9 @@ gimp_cell_renderer_toggle_get_size (GtkCellRenderer *cell,
|
||||||
pixbuf_height = gdk_pixbuf_get_height (toggle->pixbuf);
|
pixbuf_height = gdk_pixbuf_get_height (toggle->pixbuf);
|
||||||
|
|
||||||
calc_width = (pixbuf_width +
|
calc_width = (pixbuf_width +
|
||||||
(gint) cell->xpad * 2 + widget->style->xthickness * 2);
|
(gint) cell->xpad * 2 + style->xthickness * 2);
|
||||||
calc_height = (pixbuf_height +
|
calc_height = (pixbuf_height +
|
||||||
(gint) cell->ypad * 2 + widget->style->ythickness * 2);
|
(gint) cell->ypad * 2 + style->ythickness * 2);
|
||||||
|
|
||||||
if (width)
|
if (width)
|
||||||
*width = calc_width;
|
*width = calc_width;
|
||||||
|
@ -280,6 +281,7 @@ gimp_cell_renderer_toggle_render (GtkCellRenderer *cell,
|
||||||
GtkCellRendererState flags)
|
GtkCellRendererState flags)
|
||||||
{
|
{
|
||||||
GimpCellRendererToggle *toggle = GIMP_CELL_RENDERER_TOGGLE (cell);
|
GimpCellRendererToggle *toggle = GIMP_CELL_RENDERER_TOGGLE (cell);
|
||||||
|
GtkStyle *style = gtk_widget_get_style (widget);
|
||||||
GdkRectangle toggle_rect;
|
GdkRectangle toggle_rect;
|
||||||
GdkRectangle draw_rect;
|
GdkRectangle draw_rect;
|
||||||
GtkStateType state;
|
GtkStateType state;
|
||||||
|
@ -328,7 +330,7 @@ gimp_cell_renderer_toggle_render (GtkCellRenderer *cell,
|
||||||
|
|
||||||
if (gdk_rectangle_intersect (expose_area, cell_area, &draw_rect) &&
|
if (gdk_rectangle_intersect (expose_area, cell_area, &draw_rect) &&
|
||||||
(flags & GTK_CELL_RENDERER_PRELIT))
|
(flags & GTK_CELL_RENDERER_PRELIT))
|
||||||
gtk_paint_shadow (widget->style,
|
gtk_paint_shadow (style,
|
||||||
window,
|
window,
|
||||||
state,
|
state,
|
||||||
active ? GTK_SHADOW_IN : GTK_SHADOW_OUT,
|
active ? GTK_SHADOW_IN : GTK_SHADOW_OUT,
|
||||||
|
@ -339,14 +341,14 @@ gimp_cell_renderer_toggle_render (GtkCellRenderer *cell,
|
||||||
|
|
||||||
if (active)
|
if (active)
|
||||||
{
|
{
|
||||||
toggle_rect.x += widget->style->xthickness;
|
toggle_rect.x += style->xthickness;
|
||||||
toggle_rect.y += widget->style->ythickness;
|
toggle_rect.y += style->ythickness;
|
||||||
toggle_rect.width -= widget->style->xthickness * 2;
|
toggle_rect.width -= style->xthickness * 2;
|
||||||
toggle_rect.height -= widget->style->ythickness * 2;
|
toggle_rect.height -= style->ythickness * 2;
|
||||||
|
|
||||||
if (gdk_rectangle_intersect (&draw_rect, &toggle_rect, &draw_rect))
|
if (gdk_rectangle_intersect (&draw_rect, &toggle_rect, &draw_rect))
|
||||||
gdk_draw_pixbuf (window,
|
gdk_draw_pixbuf (window,
|
||||||
widget->style->black_gc,
|
style->black_gc,
|
||||||
toggle->pixbuf,
|
toggle->pixbuf,
|
||||||
/* pixbuf 0, 0 is at toggle_rect.x, toggle_rect.y */
|
/* pixbuf 0, 0 is at toggle_rect.x, toggle_rect.y */
|
||||||
draw_rect.x - toggle_rect.x,
|
draw_rect.x - toggle_rect.x,
|
||||||
|
|
|
@ -443,7 +443,8 @@ gimp_chain_line_expose_event (GtkWidget *widget,
|
||||||
points[2] = buf;
|
points[2] = buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_paint_polygon (widget->style, widget->window, GTK_STATE_NORMAL,
|
gtk_paint_polygon (gtk_widget_get_style (widget),
|
||||||
|
widget->window, GTK_STATE_NORMAL,
|
||||||
shadow,
|
shadow,
|
||||||
&event->area,
|
&event->area,
|
||||||
widget,
|
widget,
|
||||||
|
|
|
@ -323,7 +323,8 @@ static gboolean
|
||||||
gimp_color_area_expose (GtkWidget *widget,
|
gimp_color_area_expose (GtkWidget *widget,
|
||||||
GdkEventExpose *event)
|
GdkEventExpose *event)
|
||||||
{
|
{
|
||||||
GimpColorArea *area = GIMP_COLOR_AREA (widget);
|
GimpColorArea *area = GIMP_COLOR_AREA (widget);
|
||||||
|
GtkStyle *style = gtk_widget_get_style (widget);
|
||||||
guchar *buf;
|
guchar *buf;
|
||||||
|
|
||||||
if (! area->buf || ! GTK_WIDGET_DRAWABLE (widget))
|
if (! area->buf || ! GTK_WIDGET_DRAWABLE (widget))
|
||||||
|
@ -335,7 +336,7 @@ gimp_color_area_expose (GtkWidget *widget,
|
||||||
buf = area->buf + event->area.y * area->rowstride + event->area.x * 3;
|
buf = area->buf + event->area.y * area->rowstride + event->area.x * 3;
|
||||||
|
|
||||||
gdk_draw_rgb_image_dithalign (widget->window,
|
gdk_draw_rgb_image_dithalign (widget->window,
|
||||||
widget->style->black_gc,
|
style->black_gc,
|
||||||
event->area.x,
|
event->area.x,
|
||||||
event->area.y,
|
event->area.y,
|
||||||
event->area.width,
|
event->area.width,
|
||||||
|
@ -348,7 +349,7 @@ gimp_color_area_expose (GtkWidget *widget,
|
||||||
|
|
||||||
if (area->draw_border)
|
if (area->draw_border)
|
||||||
gdk_draw_rectangle (widget->window,
|
gdk_draw_rectangle (widget->window,
|
||||||
widget->style->fg_gc[widget->state],
|
style->fg_gc[widget->state],
|
||||||
FALSE,
|
FALSE,
|
||||||
0, 0,
|
0, 0,
|
||||||
area->width - 1, area->height - 1);
|
area->width - 1, area->height - 1);
|
||||||
|
@ -505,19 +506,22 @@ _gimp_color_area_render_buf (GtkWidget *widget,
|
||||||
guint rowstride,
|
guint rowstride,
|
||||||
GimpRGB *color)
|
GimpRGB *color)
|
||||||
{
|
{
|
||||||
guint x, y;
|
GtkStyle *style;
|
||||||
guint check_size = 0;
|
guint x, y;
|
||||||
guchar light[3];
|
guint check_size = 0;
|
||||||
guchar dark[3];
|
guchar light[3];
|
||||||
guchar opaque[3];
|
guchar dark[3];
|
||||||
guchar insens[3];
|
guchar opaque[3];
|
||||||
guchar *p;
|
guchar insens[3];
|
||||||
gdouble frac;
|
guchar *p;
|
||||||
|
gdouble frac;
|
||||||
|
|
||||||
g_return_if_fail (GTK_IS_WIDGET (widget));
|
g_return_if_fail (GTK_IS_WIDGET (widget));
|
||||||
g_return_if_fail (buf != NULL);
|
g_return_if_fail (buf != NULL);
|
||||||
g_return_if_fail (color != NULL);
|
g_return_if_fail (color != NULL);
|
||||||
|
|
||||||
|
style = gtk_widget_get_style (widget);
|
||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case GIMP_COLOR_AREA_FLAT:
|
case GIMP_COLOR_AREA_FLAT:
|
||||||
|
@ -535,9 +539,9 @@ _gimp_color_area_render_buf (GtkWidget *widget,
|
||||||
|
|
||||||
gimp_rgb_get_uchar (color, opaque, opaque + 1, opaque + 2);
|
gimp_rgb_get_uchar (color, opaque, opaque + 1, opaque + 2);
|
||||||
|
|
||||||
insens[0] = widget->style->bg[GTK_STATE_INSENSITIVE].red >> 8;
|
insens[0] = style->bg[GTK_STATE_INSENSITIVE].red >> 8;
|
||||||
insens[1] = widget->style->bg[GTK_STATE_INSENSITIVE].green >> 8;
|
insens[1] = style->bg[GTK_STATE_INSENSITIVE].green >> 8;
|
||||||
insens[2] = widget->style->bg[GTK_STATE_INSENSITIVE].blue >> 8;
|
insens[2] = style->bg[GTK_STATE_INSENSITIVE].blue >> 8;
|
||||||
|
|
||||||
if (insensitive || check_size == 0 || color->a == 1.0)
|
if (insensitive || check_size == 0 || color->a == 1.0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -235,7 +235,8 @@ gimp_color_scale_expose (GtkWidget *widget,
|
||||||
GdkEventExpose *event)
|
GdkEventExpose *event)
|
||||||
{
|
{
|
||||||
GimpColorScale *scale = GIMP_COLOR_SCALE (widget);
|
GimpColorScale *scale = GIMP_COLOR_SCALE (widget);
|
||||||
GtkRange *range;
|
GtkRange *range = GTK_RANGE (widget);
|
||||||
|
GtkStyle *style = gtk_widget_get_style (widget);
|
||||||
GdkRectangle expose_area; /* Relative to widget->allocation */
|
GdkRectangle expose_area; /* Relative to widget->allocation */
|
||||||
GdkRectangle area;
|
GdkRectangle area;
|
||||||
gint focus = 0;
|
gint focus = 0;
|
||||||
|
@ -247,8 +248,6 @@ gimp_color_scale_expose (GtkWidget *widget,
|
||||||
if (! scale->buf || ! GTK_WIDGET_DRAWABLE (widget))
|
if (! scale->buf || ! GTK_WIDGET_DRAWABLE (widget))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
range = GTK_RANGE (scale);
|
|
||||||
|
|
||||||
/* This is ugly as it relies heavily on GTK+ internals, but I see no
|
/* This is ugly as it relies heavily on GTK+ internals, but I see no
|
||||||
* other way to force the range to recalculate its layout. Might
|
* other way to force the range to recalculate its layout. Might
|
||||||
* break if GtkRange internals change.
|
* break if GtkRange internals change.
|
||||||
|
@ -304,19 +303,19 @@ gimp_color_scale_expose (GtkWidget *widget,
|
||||||
area.x += widget->allocation.x;
|
area.x += widget->allocation.x;
|
||||||
area.y += widget->allocation.y;
|
area.y += widget->allocation.y;
|
||||||
|
|
||||||
gtk_paint_box (widget->style, widget->window,
|
gtk_paint_box (style, widget->window,
|
||||||
sensitive ? GTK_STATE_ACTIVE : GTK_STATE_INSENSITIVE,
|
sensitive ? GTK_STATE_ACTIVE : GTK_STATE_INSENSITIVE,
|
||||||
GTK_SHADOW_IN,
|
GTK_SHADOW_IN,
|
||||||
&area, widget, "trough",
|
&area, widget, "trough",
|
||||||
x, y, w, h);
|
x, y, w, h);
|
||||||
|
|
||||||
gdk_gc_set_clip_rectangle (widget->style->black_gc, &area);
|
gdk_gc_set_clip_rectangle (style->black_gc, &area);
|
||||||
|
|
||||||
switch (range->orientation)
|
switch (range->orientation)
|
||||||
{
|
{
|
||||||
case GTK_ORIENTATION_HORIZONTAL:
|
case GTK_ORIENTATION_HORIZONTAL:
|
||||||
gdk_draw_rgb_image_dithalign (widget->window,
|
gdk_draw_rgb_image_dithalign (widget->window,
|
||||||
widget->style->black_gc,
|
style->black_gc,
|
||||||
x + trough_border + slider_size,
|
x + trough_border + slider_size,
|
||||||
y + trough_border + 1,
|
y + trough_border + 1,
|
||||||
scale->width,
|
scale->width,
|
||||||
|
@ -329,7 +328,7 @@ gimp_color_scale_expose (GtkWidget *widget,
|
||||||
|
|
||||||
case GTK_ORIENTATION_VERTICAL:
|
case GTK_ORIENTATION_VERTICAL:
|
||||||
gdk_draw_rgb_image_dithalign (widget->window,
|
gdk_draw_rgb_image_dithalign (widget->window,
|
||||||
widget->style->black_gc,
|
style->black_gc,
|
||||||
x + trough_border + 1,
|
x + trough_border + 1,
|
||||||
y + trough_border + slider_size,
|
y + trough_border + slider_size,
|
||||||
scale->width,
|
scale->width,
|
||||||
|
@ -341,11 +340,11 @@ gimp_color_scale_expose (GtkWidget *widget,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
gdk_gc_set_clip_rectangle (widget->style->black_gc, NULL);
|
gdk_gc_set_clip_rectangle (style->black_gc, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GTK_WIDGET_IS_SENSITIVE (widget) && GTK_WIDGET_HAS_FOCUS (range))
|
if (GTK_WIDGET_IS_SENSITIVE (widget) && GTK_WIDGET_HAS_FOCUS (range))
|
||||||
gtk_paint_focus (widget->style, widget->window, GTK_WIDGET_STATE (widget),
|
gtk_paint_focus (style, widget->window, GTK_WIDGET_STATE (widget),
|
||||||
&area, widget, "trough",
|
&area, widget, "trough",
|
||||||
widget->allocation.x + range->range_rect.x,
|
widget->allocation.x + range->range_rect.x,
|
||||||
widget->allocation.y + range->range_rect.y,
|
widget->allocation.y + range->range_rect.y,
|
||||||
|
@ -374,8 +373,8 @@ gimp_color_scale_expose (GtkWidget *widget,
|
||||||
GdkGC *gc;
|
GdkGC *gc;
|
||||||
|
|
||||||
gc = (GTK_WIDGET_IS_SENSITIVE (widget) ?
|
gc = (GTK_WIDGET_IS_SENSITIVE (widget) ?
|
||||||
widget->style->black_gc :
|
style->black_gc :
|
||||||
widget->style->dark_gc[GTK_STATE_INSENSITIVE]);
|
style->dark_gc[GTK_STATE_INSENSITIVE]);
|
||||||
|
|
||||||
gdk_gc_set_clip_rectangle (gc, &expose_area);
|
gdk_gc_set_clip_rectangle (gc, &expose_area);
|
||||||
switch (range->orientation)
|
switch (range->orientation)
|
||||||
|
@ -394,8 +393,8 @@ gimp_color_scale_expose (GtkWidget *widget,
|
||||||
gdk_gc_set_clip_rectangle (gc, NULL);
|
gdk_gc_set_clip_rectangle (gc, NULL);
|
||||||
|
|
||||||
gc = (GTK_WIDGET_IS_SENSITIVE (widget) ?
|
gc = (GTK_WIDGET_IS_SENSITIVE (widget) ?
|
||||||
widget->style->white_gc :
|
style->white_gc :
|
||||||
widget->style->light_gc[GTK_STATE_INSENSITIVE]);
|
style->light_gc[GTK_STATE_INSENSITIVE]);
|
||||||
|
|
||||||
gdk_gc_set_clip_rectangle (gc, &expose_area);
|
gdk_gc_set_clip_rectangle (gc, &expose_area);
|
||||||
switch (range->orientation)
|
switch (range->orientation)
|
||||||
|
@ -739,6 +738,7 @@ static void
|
||||||
gimp_color_scale_render_stipple (GimpColorScale *scale)
|
gimp_color_scale_render_stipple (GimpColorScale *scale)
|
||||||
{
|
{
|
||||||
GtkWidget *widget = GTK_WIDGET (scale);
|
GtkWidget *widget = GTK_WIDGET (scale);
|
||||||
|
GtkStyle *style = gtk_widget_get_style (widget);
|
||||||
guchar *buf;
|
guchar *buf;
|
||||||
guchar insensitive[3];
|
guchar insensitive[3];
|
||||||
guint x, y;
|
guint x, y;
|
||||||
|
@ -746,9 +746,9 @@ gimp_color_scale_render_stipple (GimpColorScale *scale)
|
||||||
if ((buf = scale->buf) == NULL)
|
if ((buf = scale->buf) == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
insensitive[0] = widget->style->bg[GTK_STATE_INSENSITIVE].red >> 8;
|
insensitive[0] = style->bg[GTK_STATE_INSENSITIVE].red >> 8;
|
||||||
insensitive[1] = widget->style->bg[GTK_STATE_INSENSITIVE].green >> 8;
|
insensitive[1] = style->bg[GTK_STATE_INSENSITIVE].green >> 8;
|
||||||
insensitive[2] = widget->style->bg[GTK_STATE_INSENSITIVE].blue >> 8;
|
insensitive[2] = style->bg[GTK_STATE_INSENSITIVE].blue >> 8;
|
||||||
|
|
||||||
for (y = 0; y < scale->height; y++, buf += scale->rowstride)
|
for (y = 0; y < scale->height; y++, buf += scale->rowstride)
|
||||||
{
|
{
|
||||||
|
|
|
@ -325,7 +325,7 @@ gimp_color_scales_toggle_update (GtkWidget *widget,
|
||||||
{
|
{
|
||||||
GimpColorSelector *selector = GIMP_COLOR_SELECTOR (scales);
|
GimpColorSelector *selector = GIMP_COLOR_SELECTOR (scales);
|
||||||
|
|
||||||
if (GTK_TOGGLE_BUTTON (widget)->active)
|
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
|
||||||
{
|
{
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
|
|
|
@ -440,7 +440,7 @@ static void
|
||||||
gimp_color_select_channel_toggled (GtkWidget *widget,
|
gimp_color_select_channel_toggled (GtkWidget *widget,
|
||||||
GimpColorSelect *select)
|
GimpColorSelect *select)
|
||||||
{
|
{
|
||||||
if (GTK_TOGGLE_BUTTON (widget)->active)
|
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
|
||||||
{
|
{
|
||||||
GimpColorSelector *selector = GIMP_COLOR_SELECTOR (select);
|
GimpColorSelector *selector = GIMP_COLOR_SELECTOR (select);
|
||||||
GimpColorSelectorChannel channel;
|
GimpColorSelectorChannel channel;
|
||||||
|
|
|
@ -419,10 +419,14 @@ gimp_enum_stock_box_set_child_padding (GtkWidget *stock_box,
|
||||||
if (GTK_IS_MISC (child))
|
if (GTK_IS_MISC (child))
|
||||||
{
|
{
|
||||||
GtkMisc *misc = GTK_MISC (child);
|
GtkMisc *misc = GTK_MISC (child);
|
||||||
|
gint misc_xpad;
|
||||||
|
gint misc_ypad;
|
||||||
|
|
||||||
|
gtk_misc_get_padding (misc, &misc_xpad, &misc_ypad);
|
||||||
|
|
||||||
gtk_misc_set_padding (misc,
|
gtk_misc_set_padding (misc,
|
||||||
xpad < 0 ? misc->xpad : xpad,
|
xpad < 0 ? misc_xpad : xpad,
|
||||||
ypad < 0 ? misc->ypad : ypad);
|
ypad < 0 ? misc_ypad : ypad);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -98,13 +98,15 @@ static void
|
||||||
gimp_frame_size_request (GtkWidget *widget,
|
gimp_frame_size_request (GtkWidget *widget,
|
||||||
GtkRequisition *requisition)
|
GtkRequisition *requisition)
|
||||||
{
|
{
|
||||||
GtkFrame *frame = GTK_FRAME (widget);
|
GtkFrame *frame = GTK_FRAME (widget);
|
||||||
GtkWidget *child = gtk_bin_get_child (GTK_BIN (widget));
|
GtkWidget *label_widget = gtk_frame_get_label_widget (frame);
|
||||||
|
GtkWidget *child = gtk_bin_get_child (GTK_BIN (widget));
|
||||||
GtkRequisition child_requisition;
|
GtkRequisition child_requisition;
|
||||||
|
gint border_width;
|
||||||
|
|
||||||
if (frame->label_widget && GTK_WIDGET_VISIBLE (frame->label_widget))
|
if (label_widget && GTK_WIDGET_VISIBLE (label_widget))
|
||||||
{
|
{
|
||||||
gtk_widget_size_request (frame->label_widget, requisition);
|
gtk_widget_size_request (label_widget, requisition);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -125,16 +127,19 @@ gimp_frame_size_request (GtkWidget *widget,
|
||||||
requisition->height += child_requisition.height;
|
requisition->height += child_requisition.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
requisition->width += 2 * GTK_CONTAINER (widget)->border_width;
|
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
||||||
requisition->height += 2 * GTK_CONTAINER (widget)->border_width;
|
|
||||||
|
requisition->width += 2 * border_width;
|
||||||
|
requisition->height += 2 * border_width;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gimp_frame_size_allocate (GtkWidget *widget,
|
gimp_frame_size_allocate (GtkWidget *widget,
|
||||||
GtkAllocation *allocation)
|
GtkAllocation *allocation)
|
||||||
{
|
{
|
||||||
GtkFrame *frame = GTK_FRAME (widget);
|
GtkFrame *frame = GTK_FRAME (widget);
|
||||||
GtkWidget *child = gtk_bin_get_child (GTK_BIN (widget));
|
GtkWidget *label_widget = gtk_frame_get_label_widget (frame);
|
||||||
|
GtkWidget *child = gtk_bin_get_child (GTK_BIN (widget));
|
||||||
|
|
||||||
widget->allocation = *allocation;
|
widget->allocation = *allocation;
|
||||||
|
|
||||||
|
@ -143,22 +148,23 @@ gimp_frame_size_allocate (GtkWidget *widget,
|
||||||
if (child && GTK_WIDGET_VISIBLE (child))
|
if (child && GTK_WIDGET_VISIBLE (child))
|
||||||
gtk_widget_size_allocate (child, &frame->child_allocation);
|
gtk_widget_size_allocate (child, &frame->child_allocation);
|
||||||
|
|
||||||
if (frame->label_widget && GTK_WIDGET_VISIBLE (frame->label_widget))
|
if (label_widget && GTK_WIDGET_VISIBLE (label_widget))
|
||||||
{
|
{
|
||||||
GtkAllocation label_allocation;
|
GtkAllocation label_allocation;
|
||||||
GtkRequisition label_requisition;
|
GtkRequisition label_requisition;
|
||||||
gint border = GTK_CONTAINER (widget)->border_width;
|
gint border_width;
|
||||||
|
|
||||||
gtk_widget_get_child_requisition (frame->label_widget,
|
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
|
||||||
&label_requisition);
|
|
||||||
|
|
||||||
label_allocation.x = allocation->x + border;
|
gtk_widget_get_child_requisition (label_widget, &label_requisition);
|
||||||
label_allocation.y = allocation->y + border;
|
|
||||||
|
label_allocation.x = allocation->x + border_width;
|
||||||
|
label_allocation.y = allocation->y + border_width;
|
||||||
label_allocation.width = MAX (label_requisition.width,
|
label_allocation.width = MAX (label_requisition.width,
|
||||||
allocation->width - 2 * border);
|
allocation->width - 2 * border_width);
|
||||||
label_allocation.height = label_requisition.height;
|
label_allocation.height = label_requisition.height;
|
||||||
|
|
||||||
gtk_widget_size_allocate (frame->label_widget, &label_allocation);
|
gtk_widget_size_allocate (label_widget, &label_allocation);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,34 +172,36 @@ static void
|
||||||
gimp_frame_child_allocate (GtkFrame *frame,
|
gimp_frame_child_allocate (GtkFrame *frame,
|
||||||
GtkAllocation *child_allocation)
|
GtkAllocation *child_allocation)
|
||||||
{
|
{
|
||||||
GtkWidget *widget = GTK_WIDGET (frame);
|
GtkWidget *widget = GTK_WIDGET (frame);
|
||||||
GtkAllocation *allocation = &widget->allocation;
|
GtkWidget *label_widget = gtk_frame_get_label_widget (frame);
|
||||||
gint border = GTK_CONTAINER (frame)->border_width;
|
GtkAllocation *allocation = &widget->allocation;
|
||||||
gint spacing = 0;
|
gint border_width;
|
||||||
gint indent = gimp_frame_get_indent (widget);
|
gint spacing = 0;
|
||||||
|
gint indent = gimp_frame_get_indent (widget);
|
||||||
|
|
||||||
if (frame->label_widget && GTK_WIDGET_VISIBLE (frame->label_widget))
|
border_width = gtk_container_get_border_width (GTK_CONTAINER (frame));
|
||||||
|
|
||||||
|
if (label_widget && GTK_WIDGET_VISIBLE (label_widget))
|
||||||
{
|
{
|
||||||
GtkRequisition child_requisition;
|
GtkRequisition child_requisition;
|
||||||
|
|
||||||
gtk_widget_get_child_requisition (frame->label_widget,
|
gtk_widget_get_child_requisition (label_widget, &child_requisition);
|
||||||
&child_requisition);
|
|
||||||
spacing += child_requisition.height;
|
spacing += child_requisition.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
spacing += gimp_frame_get_label_spacing (frame);
|
spacing += gimp_frame_get_label_spacing (frame);
|
||||||
|
|
||||||
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
|
if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_LTR)
|
||||||
child_allocation->x = border + indent;
|
child_allocation->x = border_width + indent;
|
||||||
else
|
else
|
||||||
child_allocation->x = border;
|
child_allocation->x = border_width;
|
||||||
|
|
||||||
child_allocation->y = border + spacing;
|
child_allocation->y = border_width + spacing;
|
||||||
child_allocation->width = MAX (1,
|
child_allocation->width = MAX (1,
|
||||||
allocation->width - 2 * border - indent);
|
allocation->width - 2 * border_width - indent);
|
||||||
child_allocation->height = MAX (1,
|
child_allocation->height = MAX (1,
|
||||||
allocation->height -
|
allocation->height -
|
||||||
child_allocation->y - border);
|
child_allocation->y - border_width);
|
||||||
|
|
||||||
child_allocation->x += allocation->x;
|
child_allocation->x += allocation->x;
|
||||||
child_allocation->y += allocation->y;
|
child_allocation->y += allocation->y;
|
||||||
|
@ -227,20 +235,24 @@ gimp_frame_expose_event (GtkWidget *widget,
|
||||||
static void
|
static void
|
||||||
gimp_frame_label_widget_notify (GtkFrame *frame)
|
gimp_frame_label_widget_notify (GtkFrame *frame)
|
||||||
{
|
{
|
||||||
if (frame->label_widget)
|
GtkWidget *label_widget = gtk_frame_get_label_widget (frame);
|
||||||
|
|
||||||
|
if (label_widget)
|
||||||
{
|
{
|
||||||
GtkLabel *label = NULL;
|
GtkLabel *label = NULL;
|
||||||
|
|
||||||
if (GTK_IS_LABEL (frame->label_widget))
|
if (GTK_IS_LABEL (label_widget))
|
||||||
{
|
{
|
||||||
label = GTK_LABEL (frame->label_widget);
|
gfloat xalign, yalign;
|
||||||
|
|
||||||
gtk_misc_set_alignment (GTK_MISC (label),
|
label = GTK_LABEL (label_widget);
|
||||||
frame->label_xalign, frame->label_yalign);
|
|
||||||
|
gtk_frame_get_label_align (frame, &xalign, &yalign);
|
||||||
|
gtk_misc_set_alignment (GTK_MISC (label), xalign, yalign);
|
||||||
}
|
}
|
||||||
else if (GTK_IS_BIN (frame->label_widget))
|
else if (GTK_IS_BIN (label_widget))
|
||||||
{
|
{
|
||||||
GtkWidget *child = gtk_bin_get_child (GTK_BIN (frame->label_widget));
|
GtkWidget *child = gtk_bin_get_child (GTK_BIN (label_widget));
|
||||||
|
|
||||||
if (GTK_IS_LABEL (child))
|
if (GTK_IS_LABEL (child))
|
||||||
label = GTK_LABEL (child);
|
label = GTK_LABEL (child);
|
||||||
|
@ -293,9 +305,10 @@ gimp_frame_get_indent (GtkWidget *widget)
|
||||||
static gint
|
static gint
|
||||||
gimp_frame_get_label_spacing (GtkFrame *frame)
|
gimp_frame_get_label_spacing (GtkFrame *frame)
|
||||||
{
|
{
|
||||||
gint spacing = 0;
|
GtkWidget *label_widget = gtk_frame_get_label_widget (frame);
|
||||||
|
gint spacing = 0;
|
||||||
|
|
||||||
if ((frame->label_widget && GTK_WIDGET_VISIBLE (frame->label_widget)) ||
|
if ((label_widget && GTK_WIDGET_VISIBLE (label_widget)) ||
|
||||||
(g_object_get_data (G_OBJECT (frame), GIMP_FRAME_IN_EXPANDER_KEY)))
|
(g_object_get_data (G_OBJECT (frame), GIMP_FRAME_IN_EXPANDER_KEY)))
|
||||||
{
|
{
|
||||||
gtk_widget_style_get (GTK_WIDGET (frame),
|
gtk_widget_style_get (GTK_WIDGET (frame),
|
||||||
|
|
|
@ -306,7 +306,7 @@ gimp_help_get_help_data (GtkWidget *widget,
|
||||||
const gchar *help_id = NULL;
|
const gchar *help_id = NULL;
|
||||||
gpointer help_data = NULL;
|
gpointer help_data = NULL;
|
||||||
|
|
||||||
for (; widget; widget = widget->parent)
|
for (; widget; widget = gtk_widget_get_parent (widget))
|
||||||
{
|
{
|
||||||
help_id = g_object_get_qdata (G_OBJECT (widget), GIMP_HELP_ID);
|
help_id = g_object_get_qdata (G_OBJECT (widget), GIMP_HELP_ID);
|
||||||
help_data = g_object_get_data (G_OBJECT (widget), "gimp-help-data");
|
help_data = g_object_get_data (G_OBJECT (widget), "gimp-help-data");
|
||||||
|
|
|
@ -389,7 +389,8 @@ static gboolean
|
||||||
gimp_offset_area_expose_event (GtkWidget *widget,
|
gimp_offset_area_expose_event (GtkWidget *widget,
|
||||||
GdkEventExpose *eevent)
|
GdkEventExpose *eevent)
|
||||||
{
|
{
|
||||||
GimpOffsetArea *area = GIMP_OFFSET_AREA (widget);
|
GimpOffsetArea *area = GIMP_OFFSET_AREA (widget);
|
||||||
|
GtkStyle *style = gtk_widget_get_style (widget);
|
||||||
GdkPixbuf *pixbuf;
|
GdkPixbuf *pixbuf;
|
||||||
gint w, h;
|
gint w, h;
|
||||||
gint x, y;
|
gint x, y;
|
||||||
|
@ -414,14 +415,14 @@ gimp_offset_area_expose_event (GtkWidget *widget,
|
||||||
|
|
||||||
if (pixbuf)
|
if (pixbuf)
|
||||||
{
|
{
|
||||||
gdk_draw_pixbuf (widget->window, widget->style->black_gc,
|
gdk_draw_pixbuf (widget->window, style->black_gc,
|
||||||
pixbuf, 0, 0, x, y, w, h, GDK_RGB_DITHER_NORMAL, 0, 0);
|
pixbuf, 0, 0, x, y, w, h, GDK_RGB_DITHER_NORMAL, 0, 0);
|
||||||
gdk_draw_rectangle (widget->window, widget->style->black_gc, FALSE,
|
gdk_draw_rectangle (widget->window, style->black_gc, FALSE,
|
||||||
x, y, w - 1, h - 1);
|
x, y, w - 1, h - 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gtk_paint_shadow (widget->style, widget->window, GTK_STATE_NORMAL,
|
gtk_paint_shadow (style, widget->window, GTK_STATE_NORMAL,
|
||||||
GTK_SHADOW_OUT,
|
GTK_SHADOW_OUT,
|
||||||
NULL, widget, NULL,
|
NULL, widget, NULL,
|
||||||
x, y, w, h);
|
x, y, w, h);
|
||||||
|
@ -474,7 +475,7 @@ gimp_offset_area_expose_event (GtkWidget *widget,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gdk_draw_rectangle (widget->window, widget->style->black_gc, FALSE,
|
gdk_draw_rectangle (widget->window, style->black_gc, FALSE,
|
||||||
x, y, w, h);
|
x, y, w, h);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -238,12 +238,13 @@ gimp_preview_area_expose (GtkWidget *widget,
|
||||||
|
|
||||||
if (gdk_rectangle_intersect (&rect, &event->area, &render))
|
if (gdk_rectangle_intersect (&rect, &event->area, &render))
|
||||||
{
|
{
|
||||||
gint x = render.x - rect.x;
|
GtkStyle *style = gtk_widget_get_style (widget);
|
||||||
gint y = render.y - rect.y;
|
gint x = render.x - rect.x;
|
||||||
guchar *buf = area->buf + x * 3 + y * area->rowstride;
|
gint y = render.y - rect.y;
|
||||||
|
guchar *buf = area->buf + x * 3 + y * area->rowstride;
|
||||||
|
|
||||||
gdk_draw_rgb_image_dithalign (widget->window,
|
gdk_draw_rgb_image_dithalign (widget->window,
|
||||||
widget->style->fg_gc[widget->state],
|
style->fg_gc[widget->state],
|
||||||
render.x,
|
render.x,
|
||||||
render.y,
|
render.y,
|
||||||
render.width,
|
render.width,
|
||||||
|
|
|
@ -137,7 +137,8 @@ gimp_prop_check_button_callback (GtkWidget *widget,
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_object_set (config,
|
g_object_set (config,
|
||||||
param_spec->name, GTK_TOGGLE_BUTTON (widget)->active,
|
param_spec->name,
|
||||||
|
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)),
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
gimp_toggle_button_sensitive_update (GTK_TOGGLE_BUTTON (widget));
|
gimp_toggle_button_sensitive_update (GTK_TOGGLE_BUTTON (widget));
|
||||||
|
@ -154,7 +155,7 @@ gimp_prop_check_button_notify (GObject *config,
|
||||||
param_spec->name, &value,
|
param_spec->name, &value,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
if (GTK_TOGGLE_BUTTON (button)->active != value)
|
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)) != value)
|
||||||
{
|
{
|
||||||
g_signal_handlers_block_by_func (button,
|
g_signal_handlers_block_by_func (button,
|
||||||
gimp_prop_check_button_callback,
|
gimp_prop_check_button_callback,
|
||||||
|
@ -260,7 +261,8 @@ gimp_prop_enum_check_button_callback (GtkWidget *widget,
|
||||||
|
|
||||||
g_object_set (config,
|
g_object_set (config,
|
||||||
param_spec->name,
|
param_spec->name,
|
||||||
GTK_TOGGLE_BUTTON (widget)->active ? true_value : false_value,
|
gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)) ?
|
||||||
|
true_value : false_value,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
gtk_toggle_button_set_inconsistent (GTK_TOGGLE_BUTTON (widget), FALSE);
|
gtk_toggle_button_set_inconsistent (GTK_TOGGLE_BUTTON (widget), FALSE);
|
||||||
|
@ -296,7 +298,7 @@ gimp_prop_enum_check_button_notify (GObject *config,
|
||||||
gtk_toggle_button_set_inconsistent (GTK_TOGGLE_BUTTON (button),
|
gtk_toggle_button_set_inconsistent (GTK_TOGGLE_BUTTON (button),
|
||||||
inconsistent);
|
inconsistent);
|
||||||
|
|
||||||
if (GTK_TOGGLE_BUTTON (button)->active != active)
|
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button)) != active)
|
||||||
{
|
{
|
||||||
g_signal_handlers_block_by_func (button,
|
g_signal_handlers_block_by_func (button,
|
||||||
gimp_prop_enum_check_button_callback,
|
gimp_prop_enum_check_button_callback,
|
||||||
|
@ -954,7 +956,7 @@ static void
|
||||||
gimp_prop_radio_button_callback (GtkWidget *widget,
|
gimp_prop_radio_button_callback (GtkWidget *widget,
|
||||||
GObject *config)
|
GObject *config)
|
||||||
{
|
{
|
||||||
if (GTK_TOGGLE_BUTTON (widget)->active)
|
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)))
|
||||||
{
|
{
|
||||||
GParamSpec *param_spec;
|
GParamSpec *param_spec;
|
||||||
gint value;
|
gint value;
|
||||||
|
|
|
@ -565,6 +565,7 @@ gimp_scrolled_preview_nav_button_press (GtkWidget *widget,
|
||||||
|
|
||||||
if (event->type == GDK_BUTTON_PRESS && event->button == 1)
|
if (event->type == GDK_BUTTON_PRESS && event->button == 1)
|
||||||
{
|
{
|
||||||
|
GtkStyle *style = gtk_widget_get_style (widget);
|
||||||
GtkWidget *outer;
|
GtkWidget *outer;
|
||||||
GtkWidget *inner;
|
GtkWidget *inner;
|
||||||
GtkWidget *area;
|
GtkWidget *area;
|
||||||
|
@ -625,8 +626,8 @@ gimp_scrolled_preview_nav_button_press (GtkWidget *widget,
|
||||||
y += event->y - v * (gdouble) GIMP_PREVIEW_AREA (area)->height;
|
y += event->y - v * (gdouble) GIMP_PREVIEW_AREA (area)->height;
|
||||||
|
|
||||||
gtk_window_move (GTK_WINDOW (preview->nav_popup),
|
gtk_window_move (GTK_WINDOW (preview->nav_popup),
|
||||||
x - 2 * widget->style->xthickness,
|
x - 2 * style->xthickness,
|
||||||
y - 2 * widget->style->ythickness);
|
y - 2 * style->ythickness);
|
||||||
|
|
||||||
gtk_widget_show (preview->nav_popup);
|
gtk_widget_show (preview->nav_popup);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue