mirror of https://github.com/GNOME/gimp.git
Build with GSEAL_ENABLE with a few exceptions
Use the new accessors in GTK+ 2.18 and #undef GSEAL_ENABLE where accessors are missing or where I'm not quite sure how to fix the stuff yet.
This commit is contained in:
parent
ee48b7b06e
commit
fcd346a227
|
@ -177,24 +177,29 @@ gimp_cell_renderer_color_get_size (GtkCellRenderer *cell,
|
|||
GimpCellRendererColor *color = GIMP_CELL_RENDERER_COLOR (cell);
|
||||
gint calc_width;
|
||||
gint calc_height;
|
||||
gfloat xalign;
|
||||
gfloat yalign;
|
||||
gint xpad;
|
||||
gint ypad;
|
||||
|
||||
gtk_icon_size_lookup_for_settings (gtk_widget_get_settings (widget),
|
||||
color->size, &calc_width, &calc_height);
|
||||
gtk_cell_renderer_get_alignment (cell, &xalign, &yalign);
|
||||
gtk_cell_renderer_get_padding (cell, &xpad, &ypad);
|
||||
|
||||
if (cell_area && calc_width > 0 && calc_height > 0)
|
||||
{
|
||||
if (x_offset)
|
||||
{
|
||||
*x_offset = (((gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) ?
|
||||
1.0 - cell->xalign : cell->xalign) *
|
||||
1.0 - xalign : xalign) *
|
||||
(cell_area->width - calc_width));
|
||||
*x_offset = MAX (*x_offset, 0) + cell->xpad;
|
||||
*x_offset = MAX (*x_offset, 0) + xpad;
|
||||
}
|
||||
if (y_offset)
|
||||
{
|
||||
*y_offset = (cell->yalign *
|
||||
(cell_area->height - calc_height));
|
||||
*y_offset = MAX (*y_offset, 0) + cell->ypad;
|
||||
*y_offset = (yalign * (cell_area->height - calc_height));
|
||||
*y_offset = MAX (*y_offset, 0) + ypad;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -206,9 +211,9 @@ gimp_cell_renderer_color_get_size (GtkCellRenderer *cell,
|
|||
}
|
||||
|
||||
if (width)
|
||||
*width = calc_width + 2 * cell->xpad;
|
||||
*width = calc_width + 2 * xpad;
|
||||
if (height)
|
||||
*height = calc_height + 2 * cell->ypad;
|
||||
*height = calc_height + 2 * ypad;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -222,6 +227,8 @@ gimp_cell_renderer_color_render (GtkCellRenderer *cell,
|
|||
{
|
||||
GimpCellRendererColor *color = GIMP_CELL_RENDERER_COLOR (cell);
|
||||
GdkRectangle rect;
|
||||
gint xpad;
|
||||
gint ypad;
|
||||
|
||||
gimp_cell_renderer_color_get_size (cell, widget, cell_area,
|
||||
&rect.x,
|
||||
|
@ -229,10 +236,12 @@ gimp_cell_renderer_color_render (GtkCellRenderer *cell,
|
|||
&rect.width,
|
||||
&rect.height);
|
||||
|
||||
rect.x += cell_area->x + cell->xpad;
|
||||
rect.y += cell_area->y + cell->ypad;
|
||||
rect.width -= 2 * cell->xpad;
|
||||
rect.height -= 2 * cell->ypad;
|
||||
gtk_cell_renderer_get_padding (cell, &xpad, &ypad);
|
||||
|
||||
rect.x += cell_area->x + xpad;
|
||||
rect.y += cell_area->y + ypad;
|
||||
rect.width -= 2 * xpad;
|
||||
rect.height -= 2 * ypad;
|
||||
|
||||
if (rect.width > 2 && rect.height > 2)
|
||||
{
|
||||
|
@ -273,8 +282,8 @@ gimp_cell_renderer_color_render (GtkCellRenderer *cell,
|
|||
rect.x + 0.5, rect.y + 0.5,
|
||||
rect.width - 1, rect.height - 1);
|
||||
|
||||
if (! cell->sensitive ||
|
||||
GTK_WIDGET_STATE (widget) == GTK_STATE_INSENSITIVE)
|
||||
if (! gtk_cell_renderer_get_sensitive (cell) ||
|
||||
! gtk_widget_is_sensitive (widget))
|
||||
{
|
||||
state = GTK_STATE_INSENSITIVE;
|
||||
}
|
||||
|
|
|
@ -224,6 +224,10 @@ gimp_cell_renderer_toggle_get_size (GtkCellRenderer *cell,
|
|||
gint calc_height;
|
||||
gint pixbuf_width;
|
||||
gint pixbuf_height;
|
||||
gfloat xalign;
|
||||
gfloat yalign;
|
||||
gint xpad;
|
||||
gint ypad;
|
||||
|
||||
if (! toggle->stock_id)
|
||||
{
|
||||
|
@ -235,6 +239,9 @@ gimp_cell_renderer_toggle_get_size (GtkCellRenderer *cell,
|
|||
return;
|
||||
}
|
||||
|
||||
gtk_cell_renderer_get_alignment (cell, &xalign, &yalign);
|
||||
gtk_cell_renderer_get_padding (cell, &xpad, &ypad);
|
||||
|
||||
if (! toggle->pixbuf)
|
||||
gimp_cell_renderer_toggle_create_pixbuf (toggle, widget);
|
||||
|
||||
|
@ -242,9 +249,9 @@ gimp_cell_renderer_toggle_get_size (GtkCellRenderer *cell,
|
|||
pixbuf_height = gdk_pixbuf_get_height (toggle->pixbuf);
|
||||
|
||||
calc_width = (pixbuf_width +
|
||||
(gint) cell->xpad * 2 + style->xthickness * 2);
|
||||
(gint) xpad * 2 + style->xthickness * 2);
|
||||
calc_height = (pixbuf_height +
|
||||
(gint) cell->ypad * 2 + style->ythickness * 2);
|
||||
(gint) ypad * 2 + style->ythickness * 2);
|
||||
|
||||
if (width)
|
||||
*width = calc_width;
|
||||
|
@ -257,14 +264,14 @@ gimp_cell_renderer_toggle_get_size (GtkCellRenderer *cell,
|
|||
if (x_offset)
|
||||
{
|
||||
*x_offset = (((gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) ?
|
||||
(1.0 - cell->xalign) : cell->xalign) *
|
||||
(1.0 - xalign) : xalign) *
|
||||
(cell_area->width - calc_width));
|
||||
*x_offset = MAX (*x_offset, 0);
|
||||
}
|
||||
|
||||
if (y_offset)
|
||||
{
|
||||
*y_offset = cell->yalign * (cell_area->height - calc_height);
|
||||
*y_offset = yalign * (cell_area->height - calc_height);
|
||||
*y_offset = MAX (*y_offset, 0);
|
||||
}
|
||||
}
|
||||
|
@ -285,6 +292,8 @@ gimp_cell_renderer_toggle_render (GtkCellRenderer *cell,
|
|||
GdkRectangle draw_rect;
|
||||
GtkStateType state;
|
||||
gboolean active;
|
||||
gint xpad;
|
||||
gint ypad;
|
||||
|
||||
if (! toggle->stock_id)
|
||||
{
|
||||
|
@ -301,10 +310,12 @@ gimp_cell_renderer_toggle_render (GtkCellRenderer *cell,
|
|||
&toggle_rect.width,
|
||||
&toggle_rect.height);
|
||||
|
||||
toggle_rect.x += cell_area->x + cell->xpad;
|
||||
toggle_rect.y += cell_area->y + cell->ypad;
|
||||
toggle_rect.width -= cell->xpad * 2;
|
||||
toggle_rect.height -= cell->ypad * 2;
|
||||
gtk_cell_renderer_get_padding (cell, &xpad, &ypad);
|
||||
|
||||
toggle_rect.x += cell_area->x + xpad;
|
||||
toggle_rect.y += cell_area->y + ypad;
|
||||
toggle_rect.width -= xpad * 2;
|
||||
toggle_rect.height -= ypad * 2;
|
||||
|
||||
if (toggle_rect.width <= 0 || toggle_rect.height <= 0)
|
||||
return;
|
||||
|
@ -314,14 +325,14 @@ gimp_cell_renderer_toggle_render (GtkCellRenderer *cell,
|
|||
|
||||
if ((flags & GTK_CELL_RENDERER_SELECTED) == GTK_CELL_RENDERER_SELECTED)
|
||||
{
|
||||
if (GTK_WIDGET_HAS_FOCUS (widget))
|
||||
if (gtk_widget_has_focus (widget))
|
||||
state = GTK_STATE_SELECTED;
|
||||
else
|
||||
state = GTK_STATE_ACTIVE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GTK_CELL_RENDERER_TOGGLE (cell)->activatable)
|
||||
if (gtk_cell_renderer_toggle_get_activatable (GTK_CELL_RENDERER_TOGGLE (cell)))
|
||||
state = GTK_STATE_NORMAL;
|
||||
else
|
||||
state = GTK_STATE_INSENSITIVE;
|
||||
|
@ -372,7 +383,7 @@ gimp_cell_renderer_toggle_activate (GtkCellRenderer *cell,
|
|||
{
|
||||
GtkCellRendererToggle *toggle = GTK_CELL_RENDERER_TOGGLE (cell);
|
||||
|
||||
if (toggle->activatable)
|
||||
if (gtk_cell_renderer_toggle_get_activatable (toggle))
|
||||
{
|
||||
GdkModifierType state = 0;
|
||||
|
||||
|
|
|
@ -335,7 +335,7 @@ gimp_chain_line_class_init (GimpChainLineClass *klass)
|
|||
static void
|
||||
gimp_chain_line_init (GimpChainLine *line)
|
||||
{
|
||||
GTK_WIDGET_SET_FLAGS (line, GTK_NO_WINDOW);
|
||||
gtk_widget_set_has_window (GTK_WIDGET (line), FALSE);
|
||||
}
|
||||
|
||||
static GtkWidget *
|
||||
|
@ -355,14 +355,17 @@ gimp_chain_line_expose_event (GtkWidget *widget,
|
|||
GdkEventExpose *event)
|
||||
{
|
||||
GimpChainLine *line = ((GimpChainLine *) widget);
|
||||
GtkAllocation allocation;
|
||||
GdkPoint points[3];
|
||||
GdkPoint buf;
|
||||
GtkShadowType shadow;
|
||||
GimpChainPosition position;
|
||||
|
||||
gtk_widget_get_allocation (widget, &allocation);
|
||||
|
||||
#define SHORT_LINE 4
|
||||
points[0].x = widget->allocation.x + widget->allocation.width / 2;
|
||||
points[0].y = widget->allocation.y + widget->allocation.height / 2;
|
||||
points[0].x = allocation.x + allocation.width / 2;
|
||||
points[0].y = allocation.y + allocation.height / 2;
|
||||
|
||||
position = line->position;
|
||||
|
||||
|
@ -392,8 +395,8 @@ gimp_chain_line_expose_event (GtkWidget *widget,
|
|||
points[1].y = points[0].y;
|
||||
points[2].x = points[1].x;
|
||||
points[2].y = (line->which == 1 ?
|
||||
widget->allocation.y + widget->allocation.height - 1 :
|
||||
widget->allocation.y);
|
||||
allocation.y + allocation.height - 1 :
|
||||
allocation.y);
|
||||
shadow = GTK_SHADOW_ETCHED_IN;
|
||||
break;
|
||||
|
||||
|
@ -403,8 +406,8 @@ gimp_chain_line_expose_event (GtkWidget *widget,
|
|||
points[1].y = points[0].y;
|
||||
points[2].x = points[1].x;
|
||||
points[2].y = (line->which == 1 ?
|
||||
widget->allocation.y + widget->allocation.height - 1 :
|
||||
widget->allocation.y);
|
||||
allocation.y + allocation.height - 1 :
|
||||
allocation.y);
|
||||
shadow = GTK_SHADOW_ETCHED_OUT;
|
||||
break;
|
||||
|
||||
|
@ -413,8 +416,8 @@ gimp_chain_line_expose_event (GtkWidget *widget,
|
|||
points[1].x = points[0].x;
|
||||
points[1].y = points[0].y - SHORT_LINE;
|
||||
points[2].x = (line->which == 1 ?
|
||||
widget->allocation.x + widget->allocation.width - 1 :
|
||||
widget->allocation.x);
|
||||
allocation.x + allocation.width - 1 :
|
||||
allocation.x);
|
||||
points[2].y = points[1].y;
|
||||
shadow = GTK_SHADOW_ETCHED_OUT;
|
||||
break;
|
||||
|
@ -424,8 +427,8 @@ gimp_chain_line_expose_event (GtkWidget *widget,
|
|||
points[1].x = points[0].x;
|
||||
points[1].y = points[0].y + SHORT_LINE;
|
||||
points[2].x = (line->which == 1 ?
|
||||
widget->allocation.x + widget->allocation.width - 1 :
|
||||
widget->allocation.x);
|
||||
allocation.x + allocation.width - 1 :
|
||||
allocation.x);
|
||||
points[2].y = points[1].y;
|
||||
shadow = GTK_SHADOW_ETCHED_IN;
|
||||
break;
|
||||
|
|
|
@ -289,11 +289,11 @@ gimp_color_area_size_allocate (GtkWidget *widget,
|
|||
if (GTK_WIDGET_CLASS (parent_class)->size_allocate)
|
||||
GTK_WIDGET_CLASS (parent_class)->size_allocate (widget, allocation);
|
||||
|
||||
if (widget->allocation.width != area->width ||
|
||||
widget->allocation.height != area->height)
|
||||
if (allocation->width != area->width ||
|
||||
allocation->height != area->height)
|
||||
{
|
||||
area->width = widget->allocation.width;
|
||||
area->height = widget->allocation.height;
|
||||
area->width = allocation->width;
|
||||
area->height = allocation->height;
|
||||
|
||||
area->rowstride = (area->width * 3 + 3) & ~0x3;
|
||||
|
||||
|
@ -308,7 +308,7 @@ static void
|
|||
gimp_color_area_state_changed (GtkWidget *widget,
|
||||
GtkStateType previous_state)
|
||||
{
|
||||
if (widget->state == GTK_STATE_INSENSITIVE ||
|
||||
if (gtk_widget_get_state (widget) == GTK_STATE_INSENSITIVE ||
|
||||
previous_state == GTK_STATE_INSENSITIVE)
|
||||
{
|
||||
GIMP_COLOR_AREA (widget)->needs_render = TRUE;
|
||||
|
@ -326,7 +326,7 @@ gimp_color_area_expose (GtkWidget *widget,
|
|||
GtkStyle *style = gtk_widget_get_style (widget);
|
||||
guchar *buf;
|
||||
|
||||
if (! area->buf || ! GTK_WIDGET_DRAWABLE (widget))
|
||||
if (! area->buf || ! gtk_widget_is_drawable (widget))
|
||||
return FALSE;
|
||||
|
||||
if (area->needs_render)
|
||||
|
@ -348,7 +348,7 @@ gimp_color_area_expose (GtkWidget *widget,
|
|||
|
||||
if (area->draw_border)
|
||||
gdk_draw_rectangle (gtk_widget_get_window (widget),
|
||||
style->fg_gc[widget->state],
|
||||
style->fg_gc[gtk_widget_get_state (widget)],
|
||||
FALSE,
|
||||
0, 0,
|
||||
area->width - 1, area->height - 1);
|
||||
|
@ -645,7 +645,7 @@ gimp_color_area_render (GimpColorArea *area)
|
|||
return;
|
||||
|
||||
_gimp_color_area_render_buf (GTK_WIDGET (area),
|
||||
! GTK_WIDGET_IS_SENSITIVE (area),
|
||||
! gtk_widget_is_sensitive (GTK_WIDGET (area)),
|
||||
area->type,
|
||||
area->buf,
|
||||
area->width, area->height, area->rowstride,
|
||||
|
|
|
@ -455,7 +455,7 @@ gimp_color_button_state_changed (GtkWidget *widget,
|
|||
{
|
||||
g_return_if_fail (GIMP_IS_COLOR_BUTTON (widget));
|
||||
|
||||
if (! GTK_WIDGET_IS_SENSITIVE (widget) && GIMP_COLOR_BUTTON (widget)->dialog)
|
||||
if (! gtk_widget_is_sensitive (widget) && GIMP_COLOR_BUTTON (widget)->dialog)
|
||||
gtk_widget_hide (GIMP_COLOR_BUTTON (widget)->dialog);
|
||||
|
||||
if (GTK_WIDGET_CLASS (parent_class)->state_changed)
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
|
||||
#include <string.h>
|
||||
|
||||
#undef GSEAL_ENABLE
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpcolor/gimpcolor.h"
|
||||
|
@ -76,12 +78,13 @@ gimp_color_scale_init (GimpColorScale *scale)
|
|||
{
|
||||
GtkRange *range = GTK_RANGE (scale);
|
||||
|
||||
GTK_SCALE (scale)->draw_value = FALSE;
|
||||
|
||||
range->slider_size_fixed = TRUE;
|
||||
range->flippable = TRUE;
|
||||
/* range->update_policy = GTK_UPDATE_DELAYED; */
|
||||
|
||||
gtk_range_set_flippable (GTK_RANGE (scale), TRUE);
|
||||
|
||||
gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE);
|
||||
|
||||
scale->channel = GIMP_COLOR_SELECTOR_VALUE;
|
||||
scale->needs_render = TRUE;
|
||||
|
||||
|
@ -124,7 +127,7 @@ gimp_color_scale_size_allocate (GtkWidget *widget,
|
|||
"trough-border", &trough_border,
|
||||
NULL);
|
||||
|
||||
if (GTK_WIDGET_CAN_FOCUS (widget))
|
||||
if (gtk_widget_get_can_focus (widget))
|
||||
{
|
||||
gint focus_padding = 0;
|
||||
|
||||
|
@ -175,7 +178,7 @@ static void
|
|||
gimp_color_scale_state_changed (GtkWidget *widget,
|
||||
GtkStateType previous_state)
|
||||
{
|
||||
if (widget->state == GTK_STATE_INSENSITIVE ||
|
||||
if (gtk_widget_get_state (widget) == GTK_STATE_INSENSITIVE ||
|
||||
previous_state == GTK_STATE_INSENSITIVE)
|
||||
{
|
||||
GIMP_COLOR_SCALE (widget)->needs_render = TRUE;
|
||||
|
@ -239,6 +242,7 @@ gimp_color_scale_expose (GtkWidget *widget,
|
|||
GtkRange *range = GTK_RANGE (widget);
|
||||
GtkStyle *style = gtk_widget_get_style (widget);
|
||||
GdkWindow *window = gtk_widget_get_window (widget);
|
||||
GtkAllocation allocation;
|
||||
GdkRectangle expose_area; /* Relative to widget->allocation */
|
||||
GdkRectangle area;
|
||||
gint focus = 0;
|
||||
|
@ -247,7 +251,7 @@ gimp_color_scale_expose (GtkWidget *widget,
|
|||
gint x, y;
|
||||
gint w, h;
|
||||
|
||||
if (! scale->buf || ! GTK_WIDGET_DRAWABLE (widget))
|
||||
if (! scale->buf || ! gtk_widget_is_drawable (widget))
|
||||
return FALSE;
|
||||
|
||||
/* This is ugly as it relies heavily on GTK+ internals, but I see no
|
||||
|
@ -266,7 +270,7 @@ gimp_color_scale_expose (GtkWidget *widget,
|
|||
"trough-border", &trough_border,
|
||||
NULL);
|
||||
|
||||
if (GTK_WIDGET_CAN_FOCUS (widget))
|
||||
if (gtk_widget_get_can_focus (widget))
|
||||
{
|
||||
gint focus_padding = 0;
|
||||
|
||||
|
@ -277,20 +281,22 @@ gimp_color_scale_expose (GtkWidget *widget,
|
|||
focus += focus_padding;
|
||||
}
|
||||
|
||||
x = widget->allocation.x + range->range_rect.x + focus;
|
||||
y = widget->allocation.y + range->range_rect.y + focus;
|
||||
gtk_widget_get_allocation (widget, &allocation);
|
||||
|
||||
x = allocation.x + range->range_rect.x + focus;
|
||||
y = allocation.y + range->range_rect.y + focus;
|
||||
w = range->range_rect.width - 2 * focus;
|
||||
h = range->range_rect.height - 2 * focus;
|
||||
|
||||
slider_size = range->min_slider_size / 2;
|
||||
|
||||
expose_area = event->area;
|
||||
expose_area.x -= widget->allocation.x;
|
||||
expose_area.y -= widget->allocation.y;
|
||||
expose_area.x -= allocation.x;
|
||||
expose_area.y -= allocation.y;
|
||||
|
||||
if (gdk_rectangle_intersect (&expose_area, &range->range_rect, &area))
|
||||
{
|
||||
gboolean sensitive = (GTK_WIDGET_STATE (widget) != GTK_STATE_INSENSITIVE);
|
||||
gboolean sensitive = gtk_widget_is_sensitive (widget);
|
||||
|
||||
if (scale->needs_render)
|
||||
{
|
||||
|
@ -302,8 +308,8 @@ gimp_color_scale_expose (GtkWidget *widget,
|
|||
scale->needs_render = FALSE;
|
||||
}
|
||||
|
||||
area.x += widget->allocation.x;
|
||||
area.y += widget->allocation.y;
|
||||
area.x += allocation.x;
|
||||
area.y += allocation.y;
|
||||
|
||||
gtk_paint_box (style, window,
|
||||
sensitive ? GTK_STATE_ACTIVE : GTK_STATE_INSENSITIVE,
|
||||
|
@ -345,18 +351,18 @@ gimp_color_scale_expose (GtkWidget *widget,
|
|||
gdk_gc_set_clip_rectangle (style->black_gc, NULL);
|
||||
}
|
||||
|
||||
if (GTK_WIDGET_IS_SENSITIVE (widget) && GTK_WIDGET_HAS_FOCUS (range))
|
||||
gtk_paint_focus (style, window, GTK_WIDGET_STATE (widget),
|
||||
if (gtk_widget_has_focus (widget))
|
||||
gtk_paint_focus (style, window, gtk_widget_get_state (widget),
|
||||
&area, widget, "trough",
|
||||
widget->allocation.x + range->range_rect.x,
|
||||
widget->allocation.y + range->range_rect.y,
|
||||
allocation.x + range->range_rect.x,
|
||||
allocation.y + range->range_rect.y,
|
||||
range->range_rect.width,
|
||||
range->range_rect.height);
|
||||
|
||||
switch (gtk_orientable_get_orientation (GTK_ORIENTABLE (range)))
|
||||
{
|
||||
case GTK_ORIENTATION_HORIZONTAL:
|
||||
area.x = widget->allocation.x + range->slider_start;
|
||||
area.x = allocation.x + range->slider_start;
|
||||
area.y = y + trough_border;
|
||||
area.width = 2 * slider_size + 1;
|
||||
area.height = h - 2 * trough_border;
|
||||
|
@ -364,7 +370,7 @@ gimp_color_scale_expose (GtkWidget *widget,
|
|||
|
||||
case GTK_ORIENTATION_VERTICAL:
|
||||
area.x = x + trough_border;
|
||||
area.y = widget->allocation.y + range->slider_start;
|
||||
area.y = allocation.y + range->slider_start;
|
||||
area.width = w - 2 * trough_border;
|
||||
area.height = 2 * slider_size + 1;
|
||||
break;
|
||||
|
@ -374,7 +380,7 @@ gimp_color_scale_expose (GtkWidget *widget,
|
|||
{
|
||||
GdkGC *gc;
|
||||
|
||||
gc = (GTK_WIDGET_IS_SENSITIVE (widget) ?
|
||||
gc = (gtk_widget_is_sensitive (widget) ?
|
||||
style->black_gc :
|
||||
style->dark_gc[GTK_STATE_INSENSITIVE]);
|
||||
|
||||
|
@ -396,7 +402,7 @@ gimp_color_scale_expose (GtkWidget *widget,
|
|||
|
||||
gdk_gc_set_clip_rectangle (gc, NULL);
|
||||
|
||||
gc = (GTK_WIDGET_IS_SENSITIVE (widget) ?
|
||||
gc = (gtk_widget_is_sensitive (widget) ?
|
||||
style->white_gc :
|
||||
style->light_gc[GTK_STATE_INSENSITIVE]);
|
||||
|
||||
|
@ -441,7 +447,8 @@ gimp_color_scale_new (GtkOrientation orientation,
|
|||
|
||||
scale->channel = channel;
|
||||
|
||||
GTK_RANGE (scale)->flippable = (orientation == GTK_ORIENTATION_HORIZONTAL);
|
||||
gtk_range_set_flippable (GTK_RANGE (scale),
|
||||
orientation == GTK_ORIENTATION_HORIZONTAL);
|
||||
|
||||
return GTK_WIDGET (scale);
|
||||
}
|
||||
|
@ -496,16 +503,23 @@ gimp_color_scale_set_color (GimpColorScale *scale,
|
|||
static gboolean
|
||||
should_invert (GtkRange *range)
|
||||
{
|
||||
gboolean inverted = gtk_range_get_inverted (range);
|
||||
gboolean flippable = gtk_range_get_flippable (range);
|
||||
|
||||
if (gtk_orientable_get_orientation (GTK_ORIENTABLE (range)) ==
|
||||
GTK_ORIENTATION_HORIZONTAL)
|
||||
return
|
||||
(range->inverted && !range->flippable) ||
|
||||
(range->inverted && range->flippable &&
|
||||
gtk_widget_get_direction (GTK_WIDGET (range)) == GTK_TEXT_DIR_LTR) ||
|
||||
(!range->inverted && range->flippable &&
|
||||
gtk_widget_get_direction (GTK_WIDGET (range)) == GTK_TEXT_DIR_RTL);
|
||||
{
|
||||
return
|
||||
(inverted && !flippable) ||
|
||||
(inverted && flippable &&
|
||||
gtk_widget_get_direction (GTK_WIDGET (range)) == GTK_TEXT_DIR_LTR) ||
|
||||
(!inverted && flippable &&
|
||||
gtk_widget_get_direction (GTK_WIDGET (range)) == GTK_TEXT_DIR_RTL);
|
||||
}
|
||||
else
|
||||
return range->inverted;
|
||||
{
|
||||
return inverted;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -643,8 +643,8 @@ gimp_color_select_xy_events (GtkWidget *widget,
|
|||
GdkEvent *event,
|
||||
GimpColorSelect *select)
|
||||
{
|
||||
gint width, height;
|
||||
gint x, y;
|
||||
GtkAllocation allocation;
|
||||
gint x, y;
|
||||
|
||||
switch (event->type)
|
||||
{
|
||||
|
@ -701,13 +701,12 @@ gimp_color_select_xy_events (GtkWidget *widget,
|
|||
|
||||
gimp_color_select_draw_xy_marker (select, NULL);
|
||||
|
||||
width = select->xy_color->allocation.width;
|
||||
height = select->xy_color->allocation.height;
|
||||
gtk_widget_get_allocation (select->xy_color, &allocation);
|
||||
|
||||
if (width > 1 && height > 1)
|
||||
if (allocation.width > 1 && allocation.height > 1)
|
||||
{
|
||||
select->pos[0] = (x * 255) / (width - 1);
|
||||
select->pos[1] = 255 - (y * 255) / (height - 1);
|
||||
select->pos[0] = (x * 255) / (allocation.width - 1);
|
||||
select->pos[1] = 255 - (y * 255) / (allocation.height - 1);
|
||||
}
|
||||
|
||||
select->pos[0] = CLAMP (select->pos[0], 0, 255);
|
||||
|
@ -749,8 +748,8 @@ gimp_color_select_z_events (GtkWidget *widget,
|
|||
GdkEvent *event,
|
||||
GimpColorSelect *select)
|
||||
{
|
||||
gint height;
|
||||
gint z;
|
||||
GtkAllocation allocation;
|
||||
gint z;
|
||||
|
||||
switch (event->type)
|
||||
{
|
||||
|
@ -804,10 +803,10 @@ gimp_color_select_z_events (GtkWidget *widget,
|
|||
|
||||
gimp_color_select_draw_z_marker (select, NULL);
|
||||
|
||||
height = select->z_color->allocation.height;
|
||||
gtk_widget_get_allocation (select->z_color, &allocation);
|
||||
|
||||
if (height > 1)
|
||||
select->pos[2] = 255 - (z * 255) / (height - 1);
|
||||
if (allocation.height > 1)
|
||||
select->pos[2] = 255 - (z * 255) / (allocation.height - 1);
|
||||
|
||||
select->pos[2] = CLAMP (select->pos[2], 0, 255);
|
||||
|
||||
|
@ -827,12 +826,15 @@ gimp_color_select_image_fill (GtkWidget *preview,
|
|||
const GimpHSV *hsv,
|
||||
const GimpRGB *rgb)
|
||||
{
|
||||
GtkAllocation allocation;
|
||||
ColorSelectFill csf;
|
||||
|
||||
gtk_widget_get_allocation (preview, &allocation);
|
||||
|
||||
csf.update = update_procs[fill_type];
|
||||
|
||||
csf.width = preview->allocation.width;
|
||||
csf.height = preview->allocation.height;
|
||||
csf.width = allocation.width;
|
||||
csf.height = allocation.height;
|
||||
csf.hsv = *hsv;
|
||||
csf.rgb = *rgb;
|
||||
|
||||
|
@ -856,17 +858,20 @@ static void
|
|||
gimp_color_select_draw_z_marker (GimpColorSelect *select,
|
||||
GdkRectangle *clip)
|
||||
{
|
||||
gint width;
|
||||
gint height;
|
||||
gint y;
|
||||
gint minx;
|
||||
gint miny;
|
||||
GtkAllocation allocation;
|
||||
gint width;
|
||||
gint height;
|
||||
gint y;
|
||||
gint minx;
|
||||
gint miny;
|
||||
|
||||
if (! select->gc)
|
||||
return;
|
||||
|
||||
width = select->z_color->allocation.width;
|
||||
height = select->z_color->allocation.height;
|
||||
gtk_widget_get_allocation (select->z_color, &allocation);
|
||||
|
||||
width = allocation.width;
|
||||
height = allocation.height;
|
||||
|
||||
if (width < 1 || height < 1)
|
||||
return;
|
||||
|
@ -897,16 +902,19 @@ static void
|
|||
gimp_color_select_draw_xy_marker (GimpColorSelect *select,
|
||||
GdkRectangle *clip)
|
||||
{
|
||||
gint width;
|
||||
gint height;
|
||||
gint x, y;
|
||||
gint minx, miny;
|
||||
GtkAllocation allocation;
|
||||
gint width;
|
||||
gint height;
|
||||
gint x, y;
|
||||
gint minx, miny;
|
||||
|
||||
if (! select->gc)
|
||||
return;
|
||||
|
||||
width = select->xy_color->allocation.width;
|
||||
height = select->xy_color->allocation.height;
|
||||
gtk_widget_get_allocation (select->xy_color, &allocation);
|
||||
|
||||
width = allocation.width;
|
||||
height = allocation.height;
|
||||
|
||||
if (width < 1 || height < 1)
|
||||
return;
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
|
||||
#include <string.h>
|
||||
|
||||
#undef GSEAL_ENABLE
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "gimpwidgetstypes.h"
|
||||
|
@ -103,7 +105,7 @@ gimp_frame_size_request (GtkWidget *widget,
|
|||
GtkRequisition child_requisition;
|
||||
gint border_width;
|
||||
|
||||
if (label_widget && GTK_WIDGET_VISIBLE (label_widget))
|
||||
if (label_widget && gtk_widget_get_visible (label_widget))
|
||||
{
|
||||
gtk_widget_size_request (label_widget, requisition);
|
||||
}
|
||||
|
@ -115,7 +117,7 @@ gimp_frame_size_request (GtkWidget *widget,
|
|||
|
||||
requisition->height += gimp_frame_get_label_spacing (frame);
|
||||
|
||||
if (child && GTK_WIDGET_VISIBLE (child))
|
||||
if (child && gtk_widget_get_visible (child))
|
||||
{
|
||||
gint indent = gimp_frame_get_indent (widget);
|
||||
|
||||
|
@ -140,14 +142,14 @@ gimp_frame_size_allocate (GtkWidget *widget,
|
|||
GtkWidget *label_widget = gtk_frame_get_label_widget (frame);
|
||||
GtkWidget *child = gtk_bin_get_child (GTK_BIN (widget));
|
||||
|
||||
widget->allocation = *allocation;
|
||||
gtk_widget_set_allocation (widget, allocation);
|
||||
|
||||
gimp_frame_child_allocate (frame, &frame->child_allocation);
|
||||
|
||||
if (child && GTK_WIDGET_VISIBLE (child))
|
||||
if (child && gtk_widget_get_visible (child))
|
||||
gtk_widget_size_allocate (child, &frame->child_allocation);
|
||||
|
||||
if (label_widget && GTK_WIDGET_VISIBLE (label_widget))
|
||||
if (label_widget && gtk_widget_get_visible (label_widget))
|
||||
{
|
||||
GtkAllocation label_allocation;
|
||||
GtkRequisition label_requisition;
|
||||
|
@ -173,14 +175,16 @@ gimp_frame_child_allocate (GtkFrame *frame,
|
|||
{
|
||||
GtkWidget *widget = GTK_WIDGET (frame);
|
||||
GtkWidget *label_widget = gtk_frame_get_label_widget (frame);
|
||||
GtkAllocation *allocation = &widget->allocation;
|
||||
GtkAllocation allocation;
|
||||
gint border_width;
|
||||
gint spacing = 0;
|
||||
gint indent = gimp_frame_get_indent (widget);
|
||||
|
||||
gtk_widget_get_allocation (widget, &allocation);
|
||||
|
||||
border_width = gtk_container_get_border_width (GTK_CONTAINER (frame));
|
||||
|
||||
if (label_widget && GTK_WIDGET_VISIBLE (label_widget))
|
||||
if (label_widget && gtk_widget_get_visible (label_widget))
|
||||
{
|
||||
GtkRequisition child_requisition;
|
||||
|
||||
|
@ -197,13 +201,13 @@ gimp_frame_child_allocate (GtkFrame *frame,
|
|||
|
||||
child_allocation->y = border_width + spacing;
|
||||
child_allocation->width = MAX (1,
|
||||
allocation->width - 2 * border_width - indent);
|
||||
allocation.width - 2 * border_width - indent);
|
||||
child_allocation->height = MAX (1,
|
||||
allocation->height -
|
||||
allocation.height -
|
||||
child_allocation->y - border_width);
|
||||
|
||||
child_allocation->x += allocation->x;
|
||||
child_allocation->y += allocation->y;
|
||||
child_allocation->x += allocation.x;
|
||||
child_allocation->y += allocation.y;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -221,7 +225,7 @@ static gboolean
|
|||
gimp_frame_expose_event (GtkWidget *widget,
|
||||
GdkEventExpose *event)
|
||||
{
|
||||
if (GTK_WIDGET_DRAWABLE (widget))
|
||||
if (gtk_widget_is_drawable (widget))
|
||||
{
|
||||
GtkWidgetClass *widget_class = g_type_class_peek_parent (parent_class);
|
||||
|
||||
|
@ -307,7 +311,7 @@ gimp_frame_get_label_spacing (GtkFrame *frame)
|
|||
GtkWidget *label_widget = gtk_frame_get_label_widget (frame);
|
||||
gint spacing = 0;
|
||||
|
||||
if ((label_widget && GTK_WIDGET_VISIBLE (label_widget)) ||
|
||||
if ((label_widget && gtk_widget_get_visible (label_widget)) ||
|
||||
(g_object_get_data (G_OBJECT (frame), GIMP_FRAME_IN_EXPANDER_KEY)))
|
||||
{
|
||||
gtk_widget_style_get (GTK_WIDGET (frame),
|
||||
|
|
|
@ -391,10 +391,13 @@ gimp_offset_area_expose_event (GtkWidget *widget,
|
|||
GimpOffsetArea *area = GIMP_OFFSET_AREA (widget);
|
||||
GtkStyle *style = gtk_widget_get_style (widget);
|
||||
GdkWindow *window = gtk_widget_get_window (widget);
|
||||
GtkAllocation allocation;
|
||||
GdkPixbuf *pixbuf;
|
||||
gint w, h;
|
||||
gint x, y;
|
||||
|
||||
gtk_widget_get_allocation (widget, &allocation);
|
||||
|
||||
x = (area->display_ratio_x *
|
||||
((area->orig_width <= area->width) ?
|
||||
area->offset_x :
|
||||
|
@ -438,7 +441,7 @@ gimp_offset_area_expose_event (GtkWidget *widget,
|
|||
else
|
||||
{
|
||||
x = -1;
|
||||
w = widget->allocation.width + 2;
|
||||
w = allocation.width + 2;
|
||||
}
|
||||
|
||||
if (area->orig_height > area->height)
|
||||
|
@ -449,7 +452,7 @@ gimp_offset_area_expose_event (GtkWidget *widget,
|
|||
else
|
||||
{
|
||||
y = -1;
|
||||
h = widget->allocation.height + 2;
|
||||
h = allocation.height + 2;
|
||||
}
|
||||
|
||||
w = MAX (w, 1);
|
||||
|
|
|
@ -384,14 +384,15 @@ void
|
|||
gimp_option_menu_set_history (GtkOptionMenu *option_menu,
|
||||
gpointer item_data)
|
||||
{
|
||||
GList *children;
|
||||
GList *list;
|
||||
gint history = 0;
|
||||
|
||||
g_return_if_fail (GTK_IS_OPTION_MENU (option_menu));
|
||||
|
||||
for (list = GTK_MENU_SHELL (option_menu->menu)->children;
|
||||
list;
|
||||
list = g_list_next (list))
|
||||
children = gtk_container_get_children (GTK_CONTAINER (option_menu->menu));
|
||||
|
||||
for (list = children; list; list = g_list_next (list))
|
||||
{
|
||||
GtkWidget *menu_item = GTK_WIDGET (list->data);
|
||||
|
||||
|
@ -407,6 +408,8 @@ gimp_option_menu_set_history (GtkOptionMenu *option_menu,
|
|||
|
||||
if (list)
|
||||
gtk_option_menu_set_history (option_menu, history);
|
||||
|
||||
g_list_free (children);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -446,14 +449,15 @@ gimp_option_menu_set_sensitive (GtkOptionMenu *option_menu,
|
|||
GimpOptionMenuSensitivityCallback callback,
|
||||
gpointer callback_data)
|
||||
{
|
||||
GList *children;
|
||||
GList *list;
|
||||
|
||||
g_return_if_fail (GTK_IS_OPTION_MENU (option_menu));
|
||||
g_return_if_fail (callback != NULL);
|
||||
|
||||
for (list = GTK_MENU_SHELL (option_menu->menu)->children;
|
||||
list;
|
||||
list = g_list_next (list))
|
||||
children = gtk_container_get_children (GTK_CONTAINER (option_menu->menu));
|
||||
|
||||
for (list = children; list; list = g_list_next (list))
|
||||
{
|
||||
GtkWidget *menu_item = GTK_WIDGET (list->data);
|
||||
|
||||
|
@ -468,6 +472,8 @@ gimp_option_menu_set_sensitive (GtkOptionMenu *option_menu,
|
|||
gtk_widget_set_sensitive (menu_item, sensitive);
|
||||
}
|
||||
}
|
||||
|
||||
g_list_free (children);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -489,14 +495,15 @@ gimp_int_option_menu_set_sensitive (GtkOptionMenu *option
|
|||
GimpIntOptionMenuSensitivityCallback callback,
|
||||
gpointer callback_data)
|
||||
{
|
||||
GList *children;
|
||||
GList *list;
|
||||
|
||||
g_return_if_fail (GTK_IS_OPTION_MENU (option_menu));
|
||||
g_return_if_fail (callback != NULL);
|
||||
|
||||
for (list = GTK_MENU_SHELL (option_menu->menu)->children;
|
||||
list;
|
||||
list = g_list_next (list))
|
||||
children = gtk_container_get_children (GTK_CONTAINER (option_menu->menu));
|
||||
|
||||
for (list = children; list; list = g_list_next (list))
|
||||
{
|
||||
GtkWidget *menu_item = GTK_WIDGET (list->data);
|
||||
|
||||
|
@ -511,6 +518,8 @@ gimp_int_option_menu_set_sensitive (GtkOptionMenu *option
|
|||
gtk_widget_set_sensitive (menu_item, sensitive);
|
||||
}
|
||||
}
|
||||
|
||||
g_list_free (children);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#undef GSEAL_ENABLE
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
@ -102,10 +104,12 @@ gimp_pixmap_set (GimpPixmap *pixmap,
|
|||
}
|
||||
else
|
||||
{
|
||||
GTK_WIDGET (pixmap)->requisition.width =
|
||||
width + GTK_MISC (pixmap)->xpad * 2;
|
||||
GTK_WIDGET (pixmap)->requisition.height =
|
||||
height + GTK_MISC (pixmap)->ypad * 2;
|
||||
gint xpad, ypad;
|
||||
|
||||
gtk_misc_get_padding (GTK_MISC (pixmap), &xpad, &ypad);
|
||||
|
||||
GTK_WIDGET (pixmap)->requisition.width = width + xpad * 2;
|
||||
GTK_WIDGET (pixmap)->requisition.height = height + ypad * 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#undef GSEAL_ENABLE
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpmath/gimpmath.h"
|
||||
|
|
|
@ -220,14 +220,17 @@ gimp_preview_area_expose (GtkWidget *widget,
|
|||
GdkEventExpose *event)
|
||||
{
|
||||
GimpPreviewArea *area = GIMP_PREVIEW_AREA (widget);
|
||||
GtkAllocation allocation;
|
||||
GdkRectangle rect;
|
||||
GdkRectangle render;
|
||||
|
||||
if (! area->buf)
|
||||
return FALSE;
|
||||
|
||||
rect.x = (widget->allocation.width - area->width) / 2;
|
||||
rect.y = (widget->allocation.height - area->height) / 2;
|
||||
gtk_widget_get_allocation (widget, &allocation);
|
||||
|
||||
rect.x = (allocation.width - area->width) / 2;
|
||||
rect.y = (allocation.height - area->height) / 2;
|
||||
rect.width = area->width;
|
||||
rect.height = area->height;
|
||||
|
||||
|
@ -239,7 +242,7 @@ gimp_preview_area_expose (GtkWidget *widget,
|
|||
guchar *buf = area->buf + x * 3 + y * area->rowstride;
|
||||
|
||||
gdk_draw_rgb_image_dithalign (gtk_widget_get_window (widget),
|
||||
style->fg_gc[widget->state],
|
||||
style->fg_gc[gtk_widget_get_state (widget)],
|
||||
render.x,
|
||||
render.y,
|
||||
render.width,
|
||||
|
@ -261,10 +264,13 @@ gimp_preview_area_queue_draw (GimpPreviewArea *area,
|
|||
gint width,
|
||||
gint height)
|
||||
{
|
||||
GtkWidget *widget = GTK_WIDGET (area);
|
||||
GtkWidget *widget = GTK_WIDGET (area);
|
||||
GtkAllocation allocation;
|
||||
|
||||
x += (widget->allocation.width - area->width) / 2;
|
||||
y += (widget->allocation.height - area->height) / 2;
|
||||
gtk_widget_get_allocation (widget, &allocation);
|
||||
|
||||
x += (allocation.width - area->width) / 2;
|
||||
y += (allocation.height - area->height) / 2;
|
||||
|
||||
gtk_widget_queue_draw_area (widget, x, y, width, height);
|
||||
}
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
|
||||
#include <string.h>
|
||||
|
||||
#undef GSEAL_ENABLE
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpbase/gimpbase.h"
|
||||
|
@ -496,16 +498,19 @@ static void
|
|||
gimp_ruler_realize (GtkWidget *widget)
|
||||
{
|
||||
GimpRuler *ruler = GIMP_RULER (widget);
|
||||
GtkAllocation allocation;
|
||||
GdkWindowAttr attributes;
|
||||
gint attributes_mask;
|
||||
|
||||
GTK_WIDGET_SET_FLAGS (ruler, GTK_REALIZED);
|
||||
|
||||
gtk_widget_get_allocation (widget, &allocation);
|
||||
|
||||
attributes.window_type = GDK_WINDOW_CHILD;
|
||||
attributes.x = widget->allocation.x;
|
||||
attributes.y = widget->allocation.y;
|
||||
attributes.width = widget->allocation.width;
|
||||
attributes.height = widget->allocation.height;
|
||||
attributes.x = allocation.x;
|
||||
attributes.y = allocation.y;
|
||||
attributes.width = allocation.width;
|
||||
attributes.height = allocation.height;
|
||||
attributes.wclass = GDK_INPUT_OUTPUT;
|
||||
attributes.visual = gtk_widget_get_visual (widget);
|
||||
attributes.colormap = gtk_widget_get_colormap (widget);
|
||||
|
@ -516,12 +521,15 @@ gimp_ruler_realize (GtkWidget *widget)
|
|||
|
||||
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
|
||||
|
||||
widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
|
||||
&attributes, attributes_mask);
|
||||
gdk_window_set_user_data (widget->window, ruler);
|
||||
gtk_widget_set_window (widget,
|
||||
gdk_window_new (gtk_widget_get_parent_window (widget),
|
||||
&attributes, attributes_mask));
|
||||
gdk_window_set_user_data (gtk_widget_get_window (widget), ruler);
|
||||
|
||||
widget->style = gtk_style_attach (widget->style, widget->window);
|
||||
gtk_style_set_background (gtk_widget_get_style (widget), widget->window,
|
||||
widget->style = gtk_style_attach (gtk_widget_get_style (widget),
|
||||
gtk_widget_get_window (widget));
|
||||
gtk_style_set_background (gtk_widget_get_style (widget),
|
||||
gtk_widget_get_window (widget),
|
||||
GTK_STATE_ACTIVE);
|
||||
|
||||
gimp_ruler_make_pixmap (ruler);
|
||||
|
@ -560,7 +568,7 @@ gimp_ruler_size_allocate (GtkWidget *widget,
|
|||
{
|
||||
GimpRuler *ruler = GIMP_RULER (widget);
|
||||
|
||||
widget->allocation = *allocation;
|
||||
gtk_widget_set_allocation (widget, allocation);
|
||||
|
||||
if (GTK_WIDGET_REALIZED (widget))
|
||||
{
|
||||
|
@ -624,11 +632,13 @@ gimp_ruler_motion_notify (GtkWidget *widget,
|
|||
{
|
||||
GimpRuler *ruler = GIMP_RULER (widget);
|
||||
GimpRulerPrivate *priv = GIMP_RULER_GET_PRIVATE (ruler);
|
||||
GtkAllocation allocation;
|
||||
gdouble lower;
|
||||
gdouble upper;
|
||||
|
||||
gdk_event_request_motions (event);
|
||||
|
||||
gtk_widget_get_allocation (widget, &allocation);
|
||||
gimp_ruler_get_range (ruler, &lower, &upper, NULL);
|
||||
|
||||
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
|
@ -636,14 +646,14 @@ gimp_ruler_motion_notify (GtkWidget *widget,
|
|||
gimp_ruler_set_position (ruler,
|
||||
lower +
|
||||
(upper - lower) * event->x /
|
||||
widget->allocation.width);
|
||||
allocation.width);
|
||||
}
|
||||
else
|
||||
{
|
||||
gimp_ruler_set_position (ruler,
|
||||
lower +
|
||||
(upper - lower) * event->y /
|
||||
widget->allocation.height);
|
||||
allocation.height);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
@ -653,10 +663,13 @@ static gboolean
|
|||
gimp_ruler_expose (GtkWidget *widget,
|
||||
GdkEventExpose *event)
|
||||
{
|
||||
if (GTK_WIDGET_DRAWABLE (widget))
|
||||
if (gtk_widget_is_drawable (widget))
|
||||
{
|
||||
GimpRuler *ruler = GIMP_RULER (widget);
|
||||
GimpRulerPrivate *priv = GIMP_RULER_GET_PRIVATE (ruler);
|
||||
GtkAllocation allocation;
|
||||
|
||||
gtk_widget_get_allocation (widget, &allocation);
|
||||
|
||||
gimp_ruler_draw_ticks (ruler);
|
||||
|
||||
|
@ -664,8 +677,8 @@ gimp_ruler_expose (GtkWidget *widget,
|
|||
priv->non_gr_exp_gc,
|
||||
priv->backing_store,
|
||||
0, 0, 0, 0,
|
||||
widget->allocation.width,
|
||||
widget->allocation.height);
|
||||
allocation.width,
|
||||
allocation.height);
|
||||
|
||||
gimp_ruler_draw_pos (ruler);
|
||||
}
|
||||
|
@ -679,6 +692,8 @@ gimp_ruler_draw_ticks (GimpRuler *ruler)
|
|||
GtkWidget *widget = GTK_WIDGET (ruler);
|
||||
GtkStyle *style = gtk_widget_get_style (widget);
|
||||
GimpRulerPrivate *priv = GIMP_RULER_GET_PRIVATE (ruler);
|
||||
GtkStateType state = gtk_widget_get_state (widget);
|
||||
GtkAllocation allocation;
|
||||
cairo_t *cr;
|
||||
gint i;
|
||||
gint width, height;
|
||||
|
@ -699,9 +714,11 @@ gimp_ruler_draw_ticks (GimpRuler *ruler)
|
|||
PangoLayout *layout;
|
||||
PangoRectangle logical_rect, ink_rect;
|
||||
|
||||
if (! GTK_WIDGET_DRAWABLE (widget))
|
||||
if (! gtk_widget_is_drawable (widget))
|
||||
return;
|
||||
|
||||
gtk_widget_get_allocation (widget, &allocation);
|
||||
|
||||
xthickness = style->xthickness;
|
||||
ythickness = style->ythickness;
|
||||
|
||||
|
@ -713,13 +730,13 @@ gimp_ruler_draw_ticks (GimpRuler *ruler)
|
|||
|
||||
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
{
|
||||
width = widget->allocation.width;
|
||||
height = widget->allocation.height - ythickness * 2;
|
||||
width = allocation.width;
|
||||
height = allocation.height - ythickness * 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
width = widget->allocation.height;
|
||||
height = widget->allocation.width - ythickness * 2;
|
||||
width = allocation.height;
|
||||
height = allocation.width - ythickness * 2;
|
||||
}
|
||||
|
||||
gtk_paint_box (style, priv->backing_store,
|
||||
|
@ -728,17 +745,17 @@ gimp_ruler_draw_ticks (GimpRuler *ruler)
|
|||
priv->orientation == GTK_ORIENTATION_HORIZONTAL ?
|
||||
"hruler" : "vruler",
|
||||
0, 0,
|
||||
widget->allocation.width, widget->allocation.height);
|
||||
allocation.width, allocation.height);
|
||||
|
||||
cr = gdk_cairo_create (priv->backing_store);
|
||||
gdk_cairo_set_source_color (cr, &style->fg[widget->state]);
|
||||
gdk_cairo_set_source_color (cr, &style->fg[state]);
|
||||
|
||||
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
{
|
||||
cairo_rectangle (cr,
|
||||
xthickness,
|
||||
height + ythickness,
|
||||
widget->allocation.width - 2 * xthickness,
|
||||
allocation.width - 2 * xthickness,
|
||||
1);
|
||||
}
|
||||
else
|
||||
|
@ -747,7 +764,7 @@ gimp_ruler_draw_ticks (GimpRuler *ruler)
|
|||
height + xthickness,
|
||||
ythickness,
|
||||
1,
|
||||
widget->allocation.height - 2 * ythickness);
|
||||
allocation.height - 2 * ythickness);
|
||||
}
|
||||
|
||||
gimp_ruler_get_range (ruler, &lower, &upper, &max_size);
|
||||
|
@ -847,7 +864,7 @@ gimp_ruler_draw_ticks (GimpRuler *ruler)
|
|||
|
||||
gtk_paint_layout (style,
|
||||
priv->backing_store,
|
||||
GTK_WIDGET_STATE (widget),
|
||||
state,
|
||||
FALSE,
|
||||
NULL,
|
||||
widget,
|
||||
|
@ -867,7 +884,7 @@ gimp_ruler_draw_ticks (GimpRuler *ruler)
|
|||
|
||||
gtk_paint_layout (style,
|
||||
priv->backing_store,
|
||||
GTK_WIDGET_STATE (widget),
|
||||
state,
|
||||
FALSE,
|
||||
NULL,
|
||||
widget,
|
||||
|
@ -892,22 +909,26 @@ gimp_ruler_draw_pos (GimpRuler *ruler)
|
|||
GtkWidget *widget = GTK_WIDGET (ruler);
|
||||
GtkStyle *style = gtk_widget_get_style (widget);
|
||||
GimpRulerPrivate *priv = GIMP_RULER_GET_PRIVATE (ruler);
|
||||
GtkStateType state = gtk_widget_get_state (widget);
|
||||
GtkAllocation allocation;
|
||||
gint x, y;
|
||||
gint width, height;
|
||||
gint bs_width, bs_height;
|
||||
gint xthickness;
|
||||
gint ythickness;
|
||||
|
||||
if (! GTK_WIDGET_DRAWABLE (ruler))
|
||||
if (! gtk_widget_is_drawable (widget))
|
||||
return;
|
||||
|
||||
gtk_widget_get_allocation (widget, &allocation);
|
||||
|
||||
xthickness = style->xthickness;
|
||||
ythickness = style->ythickness;
|
||||
|
||||
if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
|
||||
{
|
||||
width = widget->allocation.width;
|
||||
height = widget->allocation.height - ythickness * 2;
|
||||
width = allocation.width;
|
||||
height = allocation.height - ythickness * 2;
|
||||
|
||||
bs_width = height / 2 + 2;
|
||||
bs_width |= 1; /* make sure it's odd */
|
||||
|
@ -915,8 +936,8 @@ gimp_ruler_draw_pos (GimpRuler *ruler)
|
|||
}
|
||||
else
|
||||
{
|
||||
width = widget->allocation.width - xthickness * 2;
|
||||
height = widget->allocation.height;
|
||||
width = allocation.width - xthickness * 2;
|
||||
height = allocation.height;
|
||||
|
||||
bs_height = width / 2 + 2;
|
||||
bs_height |= 1; /* make sure it's odd */
|
||||
|
@ -959,7 +980,7 @@ gimp_ruler_draw_pos (GimpRuler *ruler)
|
|||
y = ROUND ((position - lower) * increment) + (ythickness - bs_height) / 2 - 1;
|
||||
}
|
||||
|
||||
gdk_cairo_set_source_color (cr, &style->fg[widget->state]);
|
||||
gdk_cairo_set_source_color (cr, &style->fg[state]);
|
||||
|
||||
cairo_move_to (cr, x, y);
|
||||
|
||||
|
@ -988,22 +1009,25 @@ gimp_ruler_make_pixmap (GimpRuler *ruler)
|
|||
{
|
||||
GtkWidget *widget = GTK_WIDGET (ruler);
|
||||
GimpRulerPrivate *priv = GIMP_RULER_GET_PRIVATE (ruler);
|
||||
GtkAllocation allocation;
|
||||
gint width;
|
||||
gint height;
|
||||
|
||||
gtk_widget_get_allocation (widget, &allocation);
|
||||
|
||||
if (priv->backing_store)
|
||||
{
|
||||
gdk_drawable_get_size (priv->backing_store, &width, &height);
|
||||
if ((width == widget->allocation.width) &&
|
||||
(height == widget->allocation.height))
|
||||
if ((width == allocation.width) &&
|
||||
(height == allocation.height))
|
||||
return;
|
||||
|
||||
g_object_unref (priv->backing_store);
|
||||
}
|
||||
|
||||
priv->backing_store = gdk_pixmap_new (gtk_widget_get_window (widget),
|
||||
widget->allocation.width,
|
||||
widget->allocation.height,
|
||||
allocation.width,
|
||||
allocation.height,
|
||||
-1);
|
||||
|
||||
if (!priv->non_gr_exp_gc)
|
||||
|
|
|
@ -20,6 +20,8 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#undef GSEAL_ENABLE
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpmath/gimpmath.h"
|
||||
|
@ -664,18 +666,21 @@ gimp_scrolled_preview_nav_popup_event (GtkWidget *widget,
|
|||
GdkEventMotion *mevent = (GdkEventMotion *) event;
|
||||
GtkAdjustment *hadj;
|
||||
GtkAdjustment *vadj;
|
||||
GtkAllocation allocation;
|
||||
gint cx, cy;
|
||||
gdouble x, y;
|
||||
|
||||
hadj = gtk_range_get_adjustment (GTK_RANGE (preview->hscr));
|
||||
vadj = gtk_range_get_adjustment (GTK_RANGE (preview->vscr));
|
||||
|
||||
gtk_widget_get_allocation (widget, &allocation);
|
||||
|
||||
gtk_widget_get_pointer (widget, &cx, &cy);
|
||||
|
||||
x = cx * (gtk_adjustment_get_upper (hadj) -
|
||||
gtk_adjustment_get_lower (hadj)) / widget->allocation.width;
|
||||
gtk_adjustment_get_lower (hadj)) / allocation.width;
|
||||
y = cy * (gtk_adjustment_get_upper (vadj) -
|
||||
gtk_adjustment_get_lower (vadj)) / widget->allocation.height;
|
||||
gtk_adjustment_get_lower (vadj)) / allocation.height;
|
||||
|
||||
x += (gtk_adjustment_get_lower (hadj) -
|
||||
gtk_adjustment_get_page_size (hadj) / 2);
|
||||
|
@ -713,11 +718,14 @@ gimp_scrolled_preview_nav_popup_expose (GtkWidget *widget,
|
|||
GimpScrolledPreview *preview)
|
||||
{
|
||||
GtkAdjustment *adj;
|
||||
GtkAllocation allocation;
|
||||
cairo_t *cr;
|
||||
gdouble x, y;
|
||||
gdouble w, h;
|
||||
|
||||
adj = gtk_range_get_adjustment (GTK_RANGE (preview->hscr));
|
||||
adj = gtk_range_get_adjustment (GTK_RANGE (preview->hscr));
|
||||
|
||||
gtk_widget_get_allocation (widget, &allocation);
|
||||
|
||||
x = (gtk_adjustment_get_value (adj) /
|
||||
(gtk_adjustment_get_upper (adj) -
|
||||
|
@ -738,10 +746,10 @@ gimp_scrolled_preview_nav_popup_expose (GtkWidget *widget,
|
|||
if (w >= 1.0 && h >= 1.0)
|
||||
return FALSE;
|
||||
|
||||
x = floor (x * (gdouble) widget->allocation.width);
|
||||
y = floor (y * (gdouble) widget->allocation.height);
|
||||
w = MAX (1, ceil (w * (gdouble) widget->allocation.width));
|
||||
h = MAX (1, ceil (h * (gdouble) widget->allocation.height));
|
||||
x = floor (x * (gdouble) allocation.width);
|
||||
y = floor (y * (gdouble) allocation.height);
|
||||
w = MAX (1, ceil (w * (gdouble) allocation.width));
|
||||
h = MAX (1, ceil (h * (gdouble) allocation.height));
|
||||
|
||||
cr = gdk_cairo_create (gtk_widget_get_window (widget));
|
||||
|
||||
|
@ -749,7 +757,7 @@ gimp_scrolled_preview_nav_popup_expose (GtkWidget *widget,
|
|||
cairo_clip (cr);
|
||||
|
||||
cairo_rectangle (cr,
|
||||
0, 0, widget->allocation.width, widget->allocation.height);
|
||||
0, 0, allocation.width, allocation.height);
|
||||
|
||||
cairo_rectangle (cr, x, y, w, h);
|
||||
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
|
||||
#include <string.h>
|
||||
|
||||
#undef GSEAL_ENABLE
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpbase/gimpbase.h"
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
#undef GSEAL_ENABLE
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpbase/gimpbase.h"
|
||||
|
|
Loading…
Reference in New Issue