Use gimp_display_get_image() instead of display->image

This commit is contained in:
Michael Natterer 2009-10-07 19:00:42 +02:00
parent c17dfd22a8
commit 08f35de4ac
13 changed files with 221 additions and 207 deletions

View File

@ -324,7 +324,7 @@ gimp_align_tool_button_release (GimpTool *tool,
GimpAlignTool *align_tool = GIMP_ALIGN_TOOL (tool);
GimpDisplayShell *shell = gimp_display_get_shell (display);
GObject *object = NULL;
GimpImage *image = display->image;
GimpImage *image = gimp_display_get_image (display);
gint i;
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
@ -361,7 +361,7 @@ gimp_align_tool_button_release (GimpTool *tool,
object = G_OBJECT (vectors);
}
else if (gimp_display_shell_get_show_guides (shell) &&
(guide = gimp_image_find_guide (display->image,
(guide = gimp_image_find_guide (image,
coords->x, coords->y,
FUNSCALEX (shell, snap_distance),
FUNSCALEY (shell, snap_distance))))
@ -370,7 +370,7 @@ gimp_align_tool_button_release (GimpTool *tool,
}
else
{
if ((layer = select_layer_by_coords (display->image,
if ((layer = select_layer_by_coords (image,
coords->x, coords->y)))
{
object = G_OBJECT (layer);
@ -475,9 +475,10 @@ gimp_align_tool_oper_update (GimpTool *tool,
gboolean proximity,
GimpDisplay *display)
{
GimpAlignTool *align_tool = GIMP_ALIGN_TOOL (tool);
GimpDisplayShell *shell = gimp_display_get_shell (display);
gint snap_distance = display->config->snap_distance;
GimpAlignTool *align_tool = GIMP_ALIGN_TOOL (tool);
GimpDisplayShell *shell = gimp_display_get_shell (display);
GimpImage *image = gimp_display_get_image (display);
gint snap_distance = display->config->snap_distance;
if (gimp_draw_tool_on_vectors (GIMP_DRAW_TOOL (tool), display,
coords, snap_distance, snap_distance,
@ -489,7 +490,7 @@ gimp_align_tool_oper_update (GimpTool *tool,
align_tool->function = ALIGN_TOOL_PICK_PATH;
}
else if (gimp_display_shell_get_show_guides (shell) &&
(NULL != gimp_image_find_guide (display->image,
(NULL != gimp_image_find_guide (image,
coords->x, coords->y,
FUNSCALEX (shell, snap_distance),
FUNSCALEY (shell, snap_distance))))
@ -501,7 +502,7 @@ gimp_align_tool_oper_update (GimpTool *tool,
}
else
{
GimpLayer *layer = select_layer_by_coords (display->image,
GimpLayer *layer = select_layer_by_coords (image,
coords->x, coords->y);
if (layer)
@ -714,7 +715,7 @@ gimp_align_tool_draw (GimpDrawTool *draw_tool)
else if (GIMP_IS_GUIDE (list->data))
{
GimpGuide *guide = GIMP_GUIDE (list->data);
GimpImage *image = GIMP_TOOL (draw_tool)->display->image;
GimpImage *image = gimp_display_get_image (GIMP_TOOL (draw_tool)->display);
gint x, y;
gint w, h;
@ -916,13 +917,13 @@ do_alignment (GtkWidget *widget,
gpointer data)
{
GimpAlignTool *align_tool = GIMP_ALIGN_TOOL (data);
GimpAlignmentType action;
GimpImage *image;
GimpAlignmentType action;
GObject *reference_object = NULL;
GList *list;
gint offset;
image = GIMP_TOOL (align_tool)->display->image;
image = gimp_display_get_image (GIMP_TOOL (align_tool)->display);
action = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget), "action"));
offset = align_tool->horz_offset;

View File

@ -153,7 +153,8 @@ gimp_blend_tool_initialize (GimpTool *tool,
GimpDisplay *display,
GError **error)
{
GimpDrawable *drawable = gimp_image_get_active_drawable (display->image);
GimpImage *image = gimp_display_get_image (display);
GimpDrawable *drawable = gimp_image_get_active_drawable (image);
if (! GIMP_TOOL_CLASS (parent_class)->initialize (tool, display, error))
{
@ -221,7 +222,7 @@ gimp_blend_tool_button_release (GimpTool *tool,
GimpBlendOptions *options = GIMP_BLEND_TOOL_GET_OPTIONS (tool);
GimpPaintOptions *paint_options = GIMP_PAINT_OPTIONS (options);
GimpContext *context = GIMP_CONTEXT (options);
GimpImage *image = display->image;
GimpImage *image = gimp_display_get_image (display);
gimp_tool_pop_status (tool, display);
@ -357,11 +358,10 @@ gimp_blend_tool_cursor_update (GimpTool *tool,
GdkModifierType state,
GimpDisplay *display)
{
GimpDrawable *drawable;
GimpImage *image = gimp_display_get_image (display);
GimpDrawable *drawable = gimp_image_get_active_drawable (image);
GimpCursorModifier modifier = GIMP_CURSOR_MODIFIER_NONE;
drawable = gimp_image_get_active_drawable (display->image);
if (gimp_drawable_is_indexed (drawable) ||
gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) ||
gimp_item_is_content_locked (GIMP_ITEM (drawable)))

View File

@ -121,7 +121,8 @@ gimp_bucket_fill_tool_initialize (GimpTool *tool,
GimpDisplay *display,
GError **error)
{
GimpDrawable *drawable = gimp_image_get_active_drawable (display->image);
GimpImage *image = gimp_display_get_image (display);
GimpDrawable *drawable = gimp_image_get_active_drawable (image);
if (! GIMP_TOOL_CLASS (parent_class)->initialize (tool, display, error))
{
@ -154,13 +155,14 @@ gimp_bucket_fill_tool_button_release (GimpTool *tool,
GimpDisplay *display)
{
GimpBucketFillOptions *options = GIMP_BUCKET_FILL_TOOL_GET_OPTIONS (tool);
GimpImage *image = gimp_display_get_image (display);
if ((release_type == GIMP_BUTTON_RELEASE_CLICK ||
release_type == GIMP_BUTTON_RELEASE_NO_MOTION) &&
gimp_image_coords_in_active_pickable (display->image, coords,
gimp_image_coords_in_active_pickable (image, coords,
options->sample_merged, TRUE))
{
GimpDrawable *drawable = gimp_image_get_active_drawable (display->image);
GimpDrawable *drawable = gimp_image_get_active_drawable (image);
GimpContext *context = GIMP_CONTEXT (options);
gint x, y;
GError *error = NULL;
@ -196,7 +198,7 @@ gimp_bucket_fill_tool_button_release (GimpTool *tool,
}
else
{
gimp_image_flush (display->image);
gimp_image_flush (image);
}
}
@ -246,11 +248,12 @@ gimp_bucket_fill_tool_cursor_update (GimpTool *tool,
{
GimpBucketFillOptions *options = GIMP_BUCKET_FILL_TOOL_GET_OPTIONS (tool);
GimpCursorModifier modifier = GIMP_CURSOR_MODIFIER_BAD;
GimpImage *image = gimp_display_get_image (display);
if (gimp_image_coords_in_active_pickable (display->image, coords,
if (gimp_image_coords_in_active_pickable (image, coords,
options->sample_merged, TRUE))
{
GimpDrawable *drawable = gimp_image_get_active_drawable (display->image);
GimpDrawable *drawable = gimp_image_get_active_drawable (image);
if (! gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) &&
! gimp_item_is_content_locked (GIMP_ITEM (drawable)))

View File

@ -290,6 +290,7 @@ gimp_color_tool_button_release (GimpTool *tool,
{
GimpColorTool *color_tool = GIMP_COLOR_TOOL (tool);
GimpDisplayShell *shell = gimp_display_get_shell (display);
GimpImage *image = gimp_display_get_image (display);
/* Chain up to halt the tool */
GIMP_TOOL_CLASS (parent_class)->button_release (tool, coords, time, state,
@ -326,7 +327,7 @@ gimp_color_tool_button_release (GimpTool *tool,
{
if (color_tool->sample_point)
{
gimp_image_remove_sample_point (display->image,
gimp_image_remove_sample_point (image,
color_tool->sample_point, TRUE);
color_tool->sample_point = NULL;
}
@ -335,7 +336,7 @@ gimp_color_tool_button_release (GimpTool *tool,
{
if (color_tool->sample_point)
{
gimp_image_move_sample_point (display->image,
gimp_image_move_sample_point (image,
color_tool->sample_point,
color_tool->sample_point_x,
color_tool->sample_point_y,
@ -344,7 +345,7 @@ gimp_color_tool_button_release (GimpTool *tool,
else
{
color_tool->sample_point =
gimp_image_add_sample_point_at_pos (display->image,
gimp_image_add_sample_point_at_pos (image,
color_tool->sample_point_x,
color_tool->sample_point_y,
TRUE);
@ -352,7 +353,7 @@ gimp_color_tool_button_release (GimpTool *tool,
}
gimp_display_shell_selection_control (shell, GIMP_SELECTION_RESUME);
gimp_image_flush (display->image);
gimp_image_flush (image);
if (color_tool->sample_point)
gimp_display_shell_draw_sample_point (shell, color_tool->sample_point,
@ -471,6 +472,7 @@ gimp_color_tool_oper_update (GimpTool *tool,
{
GimpColorTool *color_tool = GIMP_COLOR_TOOL (tool);
GimpDisplayShell *shell = gimp_display_get_shell (display);
GimpImage *image = gimp_display_get_image (display);
GimpSamplePoint *sample_point = NULL;
if (color_tool->enabled &&
@ -481,15 +483,15 @@ gimp_color_tool_oper_update (GimpTool *tool,
snap_distance = GIMP_DISPLAY_CONFIG (display->gimp->config)->snap_distance;
sample_point =
gimp_image_find_sample_point (display->image,
gimp_image_find_sample_point (image,
coords->x, coords->y,
FUNSCALEX (shell, snap_distance),
FUNSCALEY (shell, snap_distance));
}
if (color_tool->sample_point && color_tool->sample_point != sample_point)
gimp_image_update_sample_point (shell->display->image,
color_tool->sample_point);
if (color_tool->sample_point &&
color_tool->sample_point != sample_point)
gimp_image_update_sample_point (image, color_tool->sample_point);
color_tool->sample_point = sample_point;
@ -505,6 +507,7 @@ gimp_color_tool_cursor_update (GimpTool *tool,
GimpDisplay *display)
{
GimpColorTool *color_tool = GIMP_COLOR_TOOL (tool);
GimpImage *image = gimp_display_get_image (display);
if (color_tool->enabled)
{
@ -519,7 +522,7 @@ gimp_color_tool_cursor_update (GimpTool *tool,
{
GimpCursorModifier modifier = GIMP_CURSOR_MODIFIER_BAD;
if (gimp_image_coords_in_active_pickable (display->image, coords,
if (gimp_image_coords_in_active_pickable (image, coords,
color_tool->options->sample_merged,
FALSE))
{
@ -564,7 +567,7 @@ gimp_color_tool_draw (GimpDrawTool *draw_tool)
if (color_tool->sample_point_x != -1 &&
color_tool->sample_point_y != -1)
{
GimpImage *image = draw_tool->display->image;
GimpImage *image = gimp_display_get_image (draw_tool->display);
gimp_draw_tool_draw_line (draw_tool,
0, color_tool->sample_point_y + 0.5,
@ -606,12 +609,13 @@ gimp_color_tool_real_pick (GimpColorTool *color_tool,
GimpRGB *color,
gint *color_index)
{
GimpTool *tool = GIMP_TOOL (color_tool);
GimpTool *tool = GIMP_TOOL (color_tool);
GimpImage *image = gimp_display_get_image (tool->display);
g_return_val_if_fail (tool->display != NULL, FALSE);
g_return_val_if_fail (tool->drawable != NULL, FALSE);
return gimp_image_pick_color (tool->display->image, tool->drawable, x, y,
return gimp_image_pick_color (image, tool->drawable, x, y,
color_tool->options->sample_merged,
color_tool->options->sample_average,
color_tool->options->average_radius,

View File

@ -624,7 +624,7 @@ gimp_foreground_select_tool_select (GimpFreeSelectTool *free_sel,
{
GimpForegroundSelectTool *fg_select;
GimpForegroundSelectOptions *options;
GimpImage *image = display->image;
GimpImage *image = gimp_display_get_image (display);
GimpDrawable *drawable;
GimpScanConvert *scan_convert;
GimpChannel *mask;
@ -761,10 +761,11 @@ gimp_foreground_select_tool_apply (GimpForegroundSelectTool *fg_select,
{
GimpTool *tool = GIMP_TOOL (fg_select);
GimpSelectionOptions *options = GIMP_SELECTION_TOOL_GET_OPTIONS (tool);
GimpImage *image = gimp_display_get_image (display);
g_return_if_fail (fg_select->mask != NULL);
gimp_channel_select_channel (gimp_image_get_mask (display->image),
gimp_channel_select_channel (gimp_image_get_mask (image),
C_("command", "Foreground Select"),
fg_select->mask, 0, 0,
options->operation,
@ -774,7 +775,7 @@ gimp_foreground_select_tool_apply (GimpForegroundSelectTool *fg_select,
gimp_tool_control (tool, GIMP_TOOL_ACTION_HALT, display);
gimp_image_flush (display->image);
gimp_image_flush (image);
}
static void

View File

@ -789,7 +789,7 @@ gimp_free_select_tool_commit (GimpFreeSelectTool *fst,
gimp_free_select_tool_select (fst, display);
}
gimp_image_flush (display->image);
gimp_image_flush (gimp_display_get_image (display));
}
static void
@ -846,12 +846,13 @@ gimp_free_select_tool_handle_click (GimpFreeSelectTool *fst,
guint32 time,
GimpDisplay *display)
{
GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
GimpImage *image = gimp_display_get_image (display);
/* If there is a floating selection, anchor it */
if (gimp_image_get_floating_selection (display->image))
if (gimp_image_get_floating_selection (image))
{
floating_sel_anchor (gimp_image_get_floating_selection (display->image));
floating_sel_anchor (gimp_image_get_floating_selection (image));
gimp_free_select_tool_halt (fst);
}
else
@ -1578,8 +1579,9 @@ gimp_free_select_tool_real_select (GimpFreeSelectTool *fst,
{
GimpSelectionOptions *options = GIMP_SELECTION_TOOL_GET_OPTIONS (fst);
GimpFreeSelectToolPrivate *priv = GET_PRIVATE (fst);
GimpImage *image = gimp_display_get_image (display);
gimp_channel_select_polygon (gimp_image_get_mask (display->image),
gimp_channel_select_polygon (gimp_image_get_mask (image),
C_("command", "Free Select"),
priv->n_points,
priv->points,

View File

@ -408,6 +408,7 @@ gimp_iscissors_tool_button_press (GimpTool *tool,
{
GimpIscissorsTool *iscissors = GIMP_ISCISSORS_TOOL (tool);
GimpIscissorsOptions *options = GIMP_ISCISSORS_TOOL_GET_OPTIONS (tool);
GimpImage *image = gimp_display_get_image (display);
iscissors->x = RINT (coords->x);
iscissors->y = RINT (coords->y);
@ -437,15 +438,12 @@ gimp_iscissors_tool_button_press (GimpTool *tool,
iscissors->draw = DRAW_CURRENT_SEED;
if (! (state & GDK_SHIFT_MASK))
find_max_gradient (iscissors,
display->image,
find_max_gradient (iscissors, image,
&iscissors->x,
&iscissors->y);
iscissors->x = CLAMP (iscissors->x,
0, gimp_image_get_width (display->image) - 1);
iscissors->y = CLAMP (iscissors->y,
0, gimp_image_get_height (display->image) - 1);
iscissors->x = CLAMP (iscissors->x, 0, gimp_image_get_width (image) - 1);
iscissors->y = CLAMP (iscissors->y, 0, gimp_image_get_height (image) - 1);
iscissors->ix = iscissors->x;
iscissors->iy = iscissors->y;
@ -499,6 +497,7 @@ iscissors_convert (GimpIscissorsTool *iscissors,
GimpDisplay *display)
{
GimpSelectionOptions *options = GIMP_SELECTION_TOOL_GET_OPTIONS (iscissors);
GimpImage *image = gimp_display_get_image (display);
GimpScanConvert *sc;
GList *list;
GimpVector2 *points = NULL;
@ -547,9 +546,9 @@ iscissors_convert (GimpIscissorsTool *iscissors,
if (iscissors->mask)
g_object_unref (iscissors->mask);
iscissors->mask = gimp_channel_new_mask (display->image,
gimp_image_get_width (display->image),
gimp_image_get_height (display->image));
iscissors->mask = gimp_channel_new_mask (image,
gimp_image_get_width (image),
gimp_image_get_height (image));
gimp_scan_convert_render (sc,
gimp_drawable_get_tiles (GIMP_DRAWABLE (iscissors->mask)),
0, 0, options->antialias);
@ -682,6 +681,7 @@ gimp_iscissors_tool_motion (GimpTool *tool,
{
GimpIscissorsTool *iscissors = GIMP_ISCISSORS_TOOL (tool);
GimpIscissorsOptions *options = GIMP_ISCISSORS_TOOL_GET_OPTIONS (tool);
GimpImage *image = gimp_display_get_image (display);
if (iscissors->state == NO_ACTION)
return;
@ -708,13 +708,11 @@ gimp_iscissors_tool_motion (GimpTool *tool,
case SEED_PLACEMENT:
/* Hold the shift key down to disable the auto-edge snap feature */
if (! (state & GDK_SHIFT_MASK))
find_max_gradient (iscissors, display->image,
find_max_gradient (iscissors, image,
&iscissors->x, &iscissors->y);
iscissors->x = CLAMP (iscissors->x,
0, gimp_image_get_width (display->image) - 1);
iscissors->y = CLAMP (iscissors->y,
0, gimp_image_get_height (display->image) - 1);
iscissors->x = CLAMP (iscissors->x, 0, gimp_image_get_width (image) - 1);
iscissors->y = CLAMP (iscissors->y, 0, gimp_image_get_height (image) - 1);
if (iscissors->first_point)
{
@ -726,13 +724,11 @@ gimp_iscissors_tool_motion (GimpTool *tool,
case SEED_ADJUSTMENT:
/* Move the current seed to the location of the cursor */
if (! (state & GDK_SHIFT_MASK))
find_max_gradient (iscissors, display->image,
find_max_gradient (iscissors, image,
&iscissors->x, &iscissors->y);
iscissors->x = CLAMP (iscissors->x,
0, gimp_image_get_width (display->image) - 1);
iscissors->y = CLAMP (iscissors->y,
0, gimp_image_get_height (display->image) - 1);
iscissors->x = CLAMP (iscissors->x, 0, gimp_image_get_width (image) - 1);
iscissors->y = CLAMP (iscissors->y, 0, gimp_image_get_height (image) - 1);
iscissors->nx = iscissors->x;
iscissors->ny = iscissors->y;
@ -1118,6 +1114,7 @@ gimp_iscissors_tool_apply (GimpIscissorsTool *iscissors,
{
GimpTool *tool = GIMP_TOOL (iscissors);
GimpSelectionOptions *options = GIMP_SELECTION_TOOL_GET_OPTIONS (tool);
GimpImage *image = gimp_display_get_image (display);
/* Undraw the curve */
gimp_tool_control_halt (tool->control);
@ -1125,7 +1122,7 @@ gimp_iscissors_tool_apply (GimpIscissorsTool *iscissors,
iscissors->draw = DRAW_CURVE;
gimp_draw_tool_stop (GIMP_DRAW_TOOL (tool));
gimp_channel_select_channel (gimp_image_get_mask (display->image),
gimp_channel_select_channel (gimp_image_get_mask (image),
tool->tool_info->blurb,
iscissors->mask,
0, 0,
@ -1136,7 +1133,7 @@ gimp_iscissors_tool_apply (GimpIscissorsTool *iscissors,
gimp_iscissors_tool_reset (iscissors);
gimp_image_flush (display->image);
gimp_image_flush (image);
}
static void
@ -1375,8 +1372,9 @@ static void
calculate_curve (GimpTool *tool,
ICurve *curve)
{
GimpIscissorsTool *iscissors;
GimpDisplay *display;
GimpIscissorsTool *iscissors = GIMP_ISCISSORS_TOOL (tool);
GimpDisplay *display = tool->display;
GimpImage *image = gimp_display_get_image (display);
gint x, y, dir;
gint xs, ys, xe, ye;
gint x1, y1, x2, y2;
@ -1393,15 +1391,11 @@ calculate_curve (GimpTool *tool,
* structure.
*/
iscissors = GIMP_ISCISSORS_TOOL (tool);
display = tool->display;
/* Get the bounding box */
xs = CLAMP (curve->x1, 0, gimp_image_get_width (display->image) - 1);
ys = CLAMP (curve->y1, 0, gimp_image_get_height (display->image) - 1);
xe = CLAMP (curve->x2, 0, gimp_image_get_width (display->image) - 1);
ye = CLAMP (curve->y2, 0, gimp_image_get_height (display->image) - 1);
xs = CLAMP (curve->x1, 0, gimp_image_get_width (image) - 1);
ys = CLAMP (curve->y1, 0, gimp_image_get_height (image) - 1);
xe = CLAMP (curve->x2, 0, gimp_image_get_width (image) - 1);
ye = CLAMP (curve->y2, 0, gimp_image_get_height (image) - 1);
x1 = MIN (xs, xe);
y1 = MIN (ys, ye);
x2 = MAX (xs, xe) + 1; /* +1 because if xe = 199 & xs = 0, x2 - x1, width = 200 */
@ -1418,12 +1412,12 @@ calculate_curve (GimpTool *tool,
eheight = (y2 - y1) * EXTEND_BY + FIXED;
if (xe >= xs)
x2 += CLAMP (ewidth, 0, gimp_image_get_width (display->image) - x2);
x2 += CLAMP (ewidth, 0, gimp_image_get_width (image) - x2);
else
x1 -= CLAMP (ewidth, 0, x1);
if (ye >= ys)
y2 += CLAMP (eheight, 0, gimp_image_get_height (display->image) - y2);
y2 += CLAMP (eheight, 0, gimp_image_get_height (image) - y2);
else
y1 -= CLAMP (eheight, 0, y1);
@ -1443,7 +1437,7 @@ calculate_curve (GimpTool *tool,
/* Initialise the gradient map tile manager for this image if we
* don't already have one. */
if (!iscissors->gradient_map)
iscissors->gradient_map = gradient_map_new (display->image);
iscissors->gradient_map = gradient_map_new (image);
/* allocate the dynamic programming array */
iscissors->dp_buf =

View File

@ -190,6 +190,7 @@ gimp_measure_tool_button_press (GimpTool *tool,
GimpMeasureTool *measure = GIMP_MEASURE_TOOL (tool);
GimpMeasureOptions *options = GIMP_MEASURE_TOOL_GET_OPTIONS (tool);
GimpDisplayShell *shell = gimp_display_get_shell (display);
GimpImage *image = gimp_display_get_image (display);
gint i;
/* if we are changing displays, pop the statusbar of the old one */
@ -230,40 +231,40 @@ gimp_measure_tool_button_press (GimpTool *tool,
(measure->y[i] ==
CLAMP (measure->y[i],
0,
gimp_image_get_height (display->image))));
gimp_image_get_height (image))));
create_vguide = ((state & GDK_MOD1_MASK) &&
(measure->x[i] ==
CLAMP (measure->x[i],
0,
gimp_image_get_width (display->image))));
gimp_image_get_width (image))));
if (create_hguide && create_vguide)
gimp_image_undo_group_start (display->image,
gimp_image_undo_group_start (image,
GIMP_UNDO_GROUP_GUIDE,
_("Add Guides"));
if (create_hguide)
{
guide = gimp_image_add_hguide (display->image,
guide = gimp_image_add_hguide (image,
measure->y[i],
TRUE);
gimp_image_update_guide (display->image, guide);
gimp_image_update_guide (image, guide);
}
if (create_vguide)
{
guide = gimp_image_add_vguide (display->image,
guide = gimp_image_add_vguide (image,
measure->x[i],
TRUE);
gimp_image_update_guide (display->image, guide);
gimp_image_update_guide (image, guide);
}
if (create_hguide && create_vguide)
gimp_image_undo_group_end (display->image);
gimp_image_undo_group_end (image);
if (create_hguide || create_vguide)
gimp_image_flush (display->image);
gimp_image_flush (image);
measure->function = GUIDING;
break;
@ -344,7 +345,7 @@ gimp_measure_tool_button_press (GimpTool *tool,
if (measure->dialog)
gimp_viewable_dialog_set_viewable (GIMP_VIEWABLE_DIALOG (measure->dialog),
GIMP_VIEWABLE (tool->display->image),
GIMP_VIEWABLE (image),
GIMP_CONTEXT (options));
}
@ -812,7 +813,7 @@ gimp_measure_tool_dialog_update (GimpMeasureTool *measure,
GimpDisplay *display)
{
GimpDisplayShell *shell = gimp_display_get_shell (display);
GimpImage *image = display->image;
GimpImage *image = gimp_display_get_image (display);
gint ax, ay;
gint bx, by;
gint pixel_width;

View File

@ -210,8 +210,9 @@ gimp_move_tool_button_press (GimpTool *tool,
GimpDisplay *display)
{
GimpMoveTool *move = GIMP_MOVE_TOOL (tool);
GimpDisplayShell *shell = gimp_display_get_shell (display);
GimpMoveOptions *options = GIMP_MOVE_TOOL_GET_OPTIONS (tool);
GimpDisplayShell *shell = gimp_display_get_shell (display);
GimpImage *image = gimp_display_get_image (display);
tool->display = display;
@ -233,9 +234,9 @@ gimp_move_tool_button_press (GimpTool *tool,
&vectors))
{
move->old_active_vectors =
gimp_image_get_active_vectors (display->image);
gimp_image_get_active_vectors (image);
gimp_image_set_active_vectors (display->image, vectors);
gimp_image_set_active_vectors (image, vectors);
}
else
{
@ -250,7 +251,7 @@ gimp_move_tool_button_press (GimpTool *tool,
gint snap_distance = display->config->snap_distance;
if (gimp_display_shell_get_show_guides (shell) &&
(guide = gimp_image_find_guide (display->image,
(guide = gimp_image_find_guide (image,
coords->x, coords->y,
FUNSCALEX (shell, snap_distance),
FUNSCALEY (shell, snap_distance))))
@ -279,18 +280,18 @@ gimp_move_tool_button_press (GimpTool *tool,
return;
}
else if ((layer = gimp_image_pick_layer (display->image,
else if ((layer = gimp_image_pick_layer (image,
coords->x,
coords->y)))
{
if (gimp_image_get_floating_selection (display->image) &&
if (gimp_image_get_floating_selection (image) &&
! gimp_layer_is_floating_sel (layer))
{
/* If there is a floating selection, and this aint it,
* use the move tool to anchor it.
*/
move->floating_layer =
gimp_image_get_floating_selection (display->image);
gimp_image_get_floating_selection (image);
gimp_tool_control_activate (tool->control);
@ -298,10 +299,9 @@ gimp_move_tool_button_press (GimpTool *tool,
}
else
{
move->old_active_layer =
gimp_image_get_active_layer (display->image);
move->old_active_layer = gimp_image_get_active_layer (image);
gimp_image_set_active_layer (display->image, layer);
gimp_image_set_active_layer (image, layer);
}
}
else
@ -316,22 +316,20 @@ gimp_move_tool_button_press (GimpTool *tool,
switch (options->move_type)
{
case GIMP_TRANSFORM_TYPE_PATH:
if (gimp_image_get_active_vectors (display->image))
if (gimp_image_get_active_vectors (image))
gimp_edit_selection_tool_start (tool, display, coords,
GIMP_TRANSLATE_MODE_VECTORS, TRUE);
break;
case GIMP_TRANSFORM_TYPE_SELECTION:
if (! gimp_channel_is_empty (gimp_image_get_mask (display->image)))
if (! gimp_channel_is_empty (gimp_image_get_mask (image)))
gimp_edit_selection_tool_start (tool, display, coords,
GIMP_TRANSLATE_MODE_MASK, TRUE);
break;
case GIMP_TRANSFORM_TYPE_LAYER:
{
GimpDrawable *drawable;
drawable = gimp_image_get_active_drawable (display->image);
GimpDrawable *drawable = gimp_image_get_active_drawable (image);
if (GIMP_IS_LAYER_MASK (drawable))
gimp_edit_selection_tool_start (tool, display, coords,
@ -356,8 +354,9 @@ gimp_move_tool_button_release (GimpTool *tool,
GimpDisplay *display)
{
GimpMoveTool *move = GIMP_MOVE_TOOL (tool);
GimpDisplayShell *shell = gimp_display_get_shell (display);
GimpGuiConfig *config = GIMP_GUI_CONFIG (display->gimp->config);
GimpDisplayShell *shell = gimp_display_get_shell (display);
GimpImage *image = gimp_display_get_image (display);
if (gimp_tool_control_is_active (tool->control))
gimp_tool_control_halt (tool->control);
@ -409,7 +408,7 @@ gimp_move_tool_button_release (GimpTool *tool,
{
if (move->guide)
{
gimp_image_remove_guide (display->image, move->guide, TRUE);
gimp_image_remove_guide (image, move->guide, TRUE);
move->guide = NULL;
}
}
@ -417,7 +416,7 @@ gimp_move_tool_button_release (GimpTool *tool,
{
if (move->guide)
{
gimp_image_move_guide (display->image, move->guide,
gimp_image_move_guide (image, move->guide,
move->guide_position, TRUE);
}
else
@ -425,13 +424,13 @@ gimp_move_tool_button_release (GimpTool *tool,
switch (move->guide_orientation)
{
case GIMP_ORIENTATION_HORIZONTAL:
move->guide = gimp_image_add_hguide (display->image,
move->guide = gimp_image_add_hguide (image,
move->guide_position,
TRUE);
break;
case GIMP_ORIENTATION_VERTICAL:
move->guide = gimp_image_add_vguide (display->image,
move->guide = gimp_image_add_vguide (image,
move->guide_position,
TRUE);
break;
@ -443,7 +442,7 @@ gimp_move_tool_button_release (GimpTool *tool,
}
gimp_display_shell_selection_control (shell, GIMP_SELECTION_RESUME);
gimp_image_flush (display->image);
gimp_image_flush (image);
if (move->guide)
gimp_display_shell_draw_guide (shell, move->guide, TRUE);
@ -461,8 +460,7 @@ gimp_move_tool_button_release (GimpTool *tool,
{
if (move->old_active_layer)
{
gimp_image_set_active_layer (display->image,
move->old_active_layer);
gimp_image_set_active_layer (image, move->old_active_layer);
move->old_active_layer = NULL;
flush = TRUE;
@ -470,8 +468,7 @@ gimp_move_tool_button_release (GimpTool *tool,
if (move->old_active_vectors)
{
gimp_image_set_active_vectors (display->image,
move->old_active_vectors);
gimp_image_set_active_vectors (image, move->old_active_vectors);
move->old_active_vectors = NULL;
flush = TRUE;
@ -489,7 +486,7 @@ gimp_move_tool_button_release (GimpTool *tool,
}
if (flush)
gimp_image_flush (display->image);
gimp_image_flush (image);
}
}
@ -653,6 +650,7 @@ gimp_move_tool_oper_update (GimpTool *tool,
GimpMoveTool *move = GIMP_MOVE_TOOL (tool);
GimpMoveOptions *options = GIMP_MOVE_TOOL_GET_OPTIONS (tool);
GimpDisplayShell *shell = gimp_display_get_shell (display);
GimpImage *image = gimp_display_get_image (display);
GimpGuide *guide = NULL;
if (options->move_type == GIMP_TRANSFORM_TYPE_LAYER &&
@ -662,7 +660,7 @@ gimp_move_tool_oper_update (GimpTool *tool,
{
gint snap_distance = display->config->snap_distance;
guide = gimp_image_find_guide (display->image, coords->x, coords->y,
guide = gimp_image_find_guide (image, coords->x, coords->y,
FUNSCALEX (shell, snap_distance),
FUNSCALEY (shell, snap_distance));
}
@ -682,8 +680,9 @@ gimp_move_tool_cursor_update (GimpTool *tool,
GdkModifierType state,
GimpDisplay *display)
{
GimpDisplayShell *shell = gimp_display_get_shell (display);
GimpMoveOptions *options = GIMP_MOVE_TOOL_GET_OPTIONS (tool);
GimpDisplayShell *shell = gimp_display_get_shell (display);
GimpImage *image = gimp_display_get_image (display);
GimpCursorType cursor = GIMP_CURSOR_MOUSE;
GimpToolCursorType tool_cursor = GIMP_TOOL_CURSOR_MOVE;
GimpCursorModifier modifier = GIMP_CURSOR_MODIFIER_NONE;
@ -695,7 +694,7 @@ gimp_move_tool_cursor_update (GimpTool *tool,
if (options->move_current)
{
if (! gimp_image_get_active_vectors (display->image))
if (! gimp_image_get_active_vectors (image))
modifier = GIMP_CURSOR_MODIFIER_BAD;
}
else
@ -717,12 +716,12 @@ gimp_move_tool_cursor_update (GimpTool *tool,
tool_cursor = GIMP_TOOL_CURSOR_RECT_SELECT;
modifier = GIMP_CURSOR_MODIFIER_MOVE;
if (gimp_channel_is_empty (gimp_image_get_mask (display->image)))
if (gimp_channel_is_empty (gimp_image_get_mask (image)))
modifier = GIMP_CURSOR_MODIFIER_BAD;
}
else if (options->move_current)
{
if (! gimp_image_get_active_drawable (display->image))
if (! gimp_image_get_active_drawable (image))
modifier = GIMP_CURSOR_MODIFIER_BAD;
}
else
@ -732,24 +731,24 @@ gimp_move_tool_cursor_update (GimpTool *tool,
gint snap_distance = display->config->snap_distance;
if (gimp_display_shell_get_show_guides (shell) &&
(guide = gimp_image_find_guide (display->image, coords->x, coords->y,
(guide = gimp_image_find_guide (image, coords->x, coords->y,
FUNSCALEX (shell, snap_distance),
FUNSCALEY (shell, snap_distance))))
{
tool_cursor = GIMP_TOOL_CURSOR_HAND;
modifier = GIMP_CURSOR_MODIFIER_MOVE;
}
else if ((layer = gimp_image_pick_layer (display->image,
else if ((layer = gimp_image_pick_layer (image,
coords->x, coords->y)))
{
/* if there is a floating selection, and this aint it... */
if (gimp_image_get_floating_selection (display->image) &&
if (gimp_image_get_floating_selection (image) &&
! gimp_layer_is_floating_sel (layer))
{
tool_cursor = GIMP_TOOL_CURSOR_MOVE;
modifier = GIMP_CURSOR_MODIFIER_ANCHOR;
}
else if (layer != gimp_image_get_active_layer (display->image))
else if (layer != gimp_image_get_active_layer (image))
{
tool_cursor = GIMP_TOOL_CURSOR_HAND;
modifier = GIMP_CURSOR_MODIFIER_MOVE;

View File

@ -228,7 +228,8 @@ gimp_paint_tool_control (GimpTool *tool,
GimpDisplay *display)
{
GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (tool);
GimpDrawable *drawable = gimp_image_get_active_drawable (display->image);
GimpImage *image = gimp_display_get_image (display);
GimpDrawable *drawable = gimp_image_get_active_drawable (image);
switch (action)
{
@ -260,7 +261,8 @@ gimp_paint_tool_button_press (GimpTool *tool,
GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (tool);
GimpPaintOptions *paint_options = GIMP_PAINT_TOOL_GET_OPTIONS (tool);
GimpPaintCore *core = paint_tool->core;
GimpDrawable *drawable;
GimpImage *image = gimp_display_get_image (display);
GimpDrawable *drawable = gimp_image_get_active_drawable (image);
GimpCoords curr_coords;
gint off_x, off_y;
GError *error = NULL;
@ -272,8 +274,6 @@ gimp_paint_tool_button_press (GimpTool *tool,
return;
}
drawable = gimp_image_get_active_drawable (display->image);
if (gimp_viewable_get_children (GIMP_VIEWABLE (drawable)))
{
gimp_tool_message_literal (tool, display,
@ -298,9 +298,9 @@ gimp_paint_tool_button_press (GimpTool *tool,
if (gimp_draw_tool_is_active (draw_tool))
gimp_draw_tool_stop (draw_tool);
if (tool->display &&
if (tool->display &&
tool->display != display &&
tool->display->image == display->image)
gimp_display_get_image (tool->display) == image)
{
/* if this is a different display, but the same image, HACK around
* in tool internals AFTER stopping the current draw_tool, so
@ -345,7 +345,7 @@ gimp_paint_tool_button_press (GimpTool *tool,
press_type, display);
/* pause the current selection */
gimp_image_selection_control (display->image, GIMP_SELECTION_PAUSE);
gimp_image_selection_control (image, GIMP_SELECTION_PAUSE);
/* Let the specific painting function initialize itself */
gimp_paint_core_paint (core, drawable, paint_options,
@ -363,7 +363,7 @@ gimp_paint_tool_button_press (GimpTool *tool,
GIMP_PAINT_STATE_MOTION, time);
}
gimp_projection_flush_now (gimp_image_get_projection (display->image));
gimp_projection_flush_now (gimp_image_get_projection (image));
gimp_display_flush_now (display);
gimp_draw_tool_start (draw_tool, display);
@ -380,7 +380,8 @@ gimp_paint_tool_button_release (GimpTool *tool,
GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (tool);
GimpPaintOptions *paint_options = GIMP_PAINT_TOOL_GET_OPTIONS (tool);
GimpPaintCore *core = paint_tool->core;
GimpDrawable *drawable;
GimpImage *image = gimp_display_get_image (display);
GimpDrawable *drawable = gimp_image_get_active_drawable (image);
if (gimp_color_tool_is_enabled (GIMP_COLOR_TOOL (tool)))
{
@ -390,8 +391,6 @@ gimp_paint_tool_button_release (GimpTool *tool,
return;
}
drawable = gimp_image_get_active_drawable (display->image);
gimp_draw_tool_pause (GIMP_DRAW_TOOL (tool));
/* Let the specific painting function finish up */
@ -399,7 +398,7 @@ gimp_paint_tool_button_release (GimpTool *tool,
GIMP_PAINT_STATE_FINISH, time);
/* resume the current selection */
gimp_image_selection_control (display->image, GIMP_SELECTION_RESUME);
gimp_image_selection_control (image, GIMP_SELECTION_RESUME);
/* chain up to halt the tool */
GIMP_TOOL_CLASS (parent_class)->button_release (tool, coords, time, state,
@ -410,7 +409,7 @@ gimp_paint_tool_button_release (GimpTool *tool,
else
gimp_paint_core_finish (core, drawable, TRUE);
gimp_image_flush (display->image);
gimp_image_flush (image);
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
}
@ -425,7 +424,8 @@ gimp_paint_tool_motion (GimpTool *tool,
GimpPaintTool *paint_tool = GIMP_PAINT_TOOL (tool);
GimpPaintOptions *paint_options = GIMP_PAINT_TOOL_GET_OPTIONS (tool);
GimpPaintCore *core = paint_tool->core;
GimpDrawable *drawable;
GimpImage *image = gimp_display_get_image (display);
GimpDrawable *drawable = gimp_image_get_active_drawable (image);
GimpCoords curr_coords;
gint off_x, off_y;
@ -436,8 +436,6 @@ gimp_paint_tool_motion (GimpTool *tool,
curr_coords = *coords;
drawable = gimp_image_get_active_drawable (display->image);
gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
curr_coords.x -= off_x;
@ -455,7 +453,7 @@ gimp_paint_tool_motion (GimpTool *tool,
gimp_paint_core_interpolate (core, drawable, paint_options,
&curr_coords, time);
gimp_projection_flush_now (gimp_image_get_projection (display->image));
gimp_projection_flush_now (gimp_image_get_projection (image));
gimp_display_flush_now (display);
gimp_draw_tool_resume (GIMP_DRAW_TOOL (tool));
@ -538,7 +536,8 @@ gimp_paint_tool_cursor_update (GimpTool *tool,
if (! gimp_color_tool_is_enabled (GIMP_COLOR_TOOL (tool)))
{
GimpDrawable *drawable = gimp_image_get_active_drawable (display->image);
GimpImage *image = gimp_display_get_image (display);
GimpDrawable *drawable = gimp_image_get_active_drawable (image);
if (gimp_viewable_get_children (GIMP_VIEWABLE (drawable)) ||
gimp_item_is_content_locked (GIMP_ITEM (drawable)))
@ -577,7 +576,8 @@ gimp_paint_tool_oper_update (GimpTool *tool,
GimpPaintOptions *paint_options = GIMP_PAINT_TOOL_GET_OPTIONS (tool);
GimpPaintCore *core = paint_tool->core;
GimpDisplayShell *shell = gimp_display_get_shell (display);
GimpDrawable *drawable;
GimpImage *image = gimp_display_get_image (display);
GimpDrawable *drawable = gimp_image_get_active_drawable (image);
if (gimp_color_tool_is_enabled (GIMP_COLOR_TOOL (tool)))
{
@ -593,7 +593,7 @@ gimp_paint_tool_oper_update (GimpTool *tool,
if (tool->display &&
tool->display != display &&
tool->display->image == display->image)
gimp_display_get_image (tool->display) == image)
{
/* if this is a different display, but the same image, HACK around
* in tool internals AFTER stopping the current draw_tool, so
@ -604,8 +604,6 @@ gimp_paint_tool_oper_update (GimpTool *tool,
tool->display = display;
}
drawable = gimp_image_get_active_drawable (display->image);
if (drawable && proximity)
{
if (display == tool->display && (state & GDK_SHIFT_MASK))
@ -647,10 +645,9 @@ gimp_paint_tool_oper_update (GimpTool *tool,
}
else
{
GimpImage *image = display->image;
gdouble xres;
gdouble yres;
gchar format_str[64];
gdouble xres;
gdouble yres;
gchar format_str[64];
gimp_image_get_resolution (image, &xres, &yres);

View File

@ -710,16 +710,21 @@ void
gimp_rectangle_tool_frame_item (GimpRectangleTool *rect_tool,
GimpItem *item)
{
GimpDisplay *display = GIMP_TOOL (rect_tool)->display;
GimpDisplay *display;
gint offset_x;
gint offset_y;
gint width;
gint height;
g_return_if_fail (GIMP_IS_RECTANGLE_TOOL (rect_tool));
g_return_if_fail (GIMP_IS_ITEM (item));
g_return_if_fail (gimp_item_is_attached (item));
g_return_if_fail (display != NULL);
g_return_if_fail (display->image == gimp_item_get_image (item));
display = GIMP_TOOL (rect_tool)->display;
g_return_if_fail (GIMP_IS_DISPLAY (display));
g_return_if_fail (gimp_display_get_image (display) ==
gimp_item_get_image (item));
width = gimp_item_get_width (item);
height = gimp_item_get_height (item);
@ -2068,6 +2073,7 @@ gimp_rectangle_tool_start (GimpRectangleTool *rect_tool,
GimpTool *tool = GIMP_TOOL (rect_tool);
GimpRectangleOptionsPrivate *options_private;
GimpRectangleToolPrivate *private;
GimpImage *image;
gdouble xres;
gdouble yres;
@ -2076,6 +2082,8 @@ gimp_rectangle_tool_start (GimpRectangleTool *rect_tool,
private = GIMP_RECTANGLE_TOOL_GET_PRIVATE (rect_tool);
image = gimp_display_get_image (display);
tool->display = display;
g_signal_connect_object (gimp_display_get_shell (tool->display), "scrolled",
@ -2092,7 +2100,7 @@ gimp_rectangle_tool_start (GimpRectangleTool *rect_tool,
gimp_draw_tool_start (GIMP_DRAW_TOOL (tool), tool->display);
gimp_image_get_resolution (display->image, &xres, &yres);
gimp_image_get_resolution (image, &xres, &yres);
if (options_private->fixed_width_entry)
{
@ -2100,7 +2108,7 @@ gimp_rectangle_tool_start (GimpRectangleTool *rect_tool,
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (entry), 0, xres, FALSE);
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (entry), 0,
0, gimp_image_get_width (display->image));
0, gimp_image_get_width (image));
}
if (options_private->fixed_height_entry)
@ -2109,7 +2117,7 @@ gimp_rectangle_tool_start (GimpRectangleTool *rect_tool,
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (entry), 0, yres, FALSE);
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (entry), 0,
0, gimp_image_get_height (display->image));
0, gimp_image_get_height (image));
}
if (options_private->x_entry)
@ -2118,7 +2126,7 @@ gimp_rectangle_tool_start (GimpRectangleTool *rect_tool,
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (entry), 0, xres, FALSE);
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (entry), 0,
0, gimp_image_get_width (display->image));
0, gimp_image_get_width (image));
}
if (options_private->y_entry)
@ -2127,7 +2135,7 @@ gimp_rectangle_tool_start (GimpRectangleTool *rect_tool,
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (entry), 0, yres, FALSE);
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (entry), 0,
0, gimp_image_get_height (display->image));
0, gimp_image_get_height (image));
}
if (options_private->width_entry)
@ -2136,7 +2144,7 @@ gimp_rectangle_tool_start (GimpRectangleTool *rect_tool,
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (entry), 0, xres, FALSE);
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (entry), 0,
0, gimp_image_get_width (display->image));
0, gimp_image_get_width (image));
}
if (options_private->height_entry)
@ -2145,7 +2153,7 @@ gimp_rectangle_tool_start (GimpRectangleTool *rect_tool,
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (entry), 0, yres, FALSE);
gimp_size_entry_set_size (GIMP_SIZE_ENTRY (entry), 0,
0, gimp_image_get_height (display->image));
0, gimp_image_get_height (image));
}
if (options_private->auto_shrink_button)
@ -2578,6 +2586,7 @@ gimp_rectangle_tool_auto_shrink (GimpRectangleTool *rect_tool)
GimpTool *tool = GIMP_TOOL (rect_tool);
GimpRectangleToolPrivate *private = GIMP_RECTANGLE_TOOL_GET_PRIVATE (tool);
GimpDisplay *display = tool->display;
GimpImage *image;
gint width;
gint height;
gint offset_x = 0;
@ -2593,8 +2602,10 @@ gimp_rectangle_tool_auto_shrink (GimpRectangleTool *rect_tool)
if (! display)
return;
width = gimp_image_get_width (display->image);
height = gimp_image_get_height (display->image);
image = gimp_display_get_image (display);
width = gimp_image_get_width (image);
height = gimp_image_get_height (image);
g_object_get (gimp_tool_get_options (tool),
"shrink-merged", &shrink_merged,
@ -2605,7 +2616,7 @@ gimp_rectangle_tool_auto_shrink (GimpRectangleTool *rect_tool)
y1 = private->y1 - offset_y > 0 ? private->y1 - offset_y : 0;
y2 = private->y2 - offset_y < height ? private->y2 - offset_y : height;
if (gimp_image_crop_auto_shrink (display->image,
if (gimp_image_crop_auto_shrink (image,
x1, y1, x2, y2,
! shrink_merged,
&shrunk_x1,
@ -4006,11 +4017,13 @@ gimp_rectangle_tool_apply_fixed_rule (GimpRectangleTool *rect_tool)
GimpRectangleOptions *options;
GimpRectangleOptionsPrivate *options_private;
GimpRectangleConstraint constraint_to_use;
GimpImage *image;
tool = GIMP_TOOL (rect_tool);
private = GIMP_RECTANGLE_TOOL_GET_PRIVATE (tool);
options = GIMP_RECTANGLE_TOOL_GET_OPTIONS (tool);
options_private = GIMP_RECTANGLE_OPTIONS_GET_PRIVATE (options);
image = gimp_display_get_image (tool->display);
/* Calculate what constraint to use when needed. */
constraint_to_use = gimp_rectangle_tool_get_constraint (rect_tool);
@ -4022,8 +4035,8 @@ gimp_rectangle_tool_apply_fixed_rule (GimpRectangleTool *rect_tool)
aspect = CLAMP (options_private->aspect_numerator /
options_private->aspect_denominator,
1.0 / gimp_image_get_height (tool->display->image),
gimp_image_get_width (tool->display->image));
1.0 / gimp_image_get_height (image),
gimp_image_get_width (image));
if (constraint_to_use == GIMP_RECTANGLE_CONSTRAIN_NONE)
{
@ -4111,11 +4124,12 @@ gimp_rectangle_tool_get_constraints (GimpRectangleTool *rect_tool,
gint *max_y,
GimpRectangleConstraint constraint)
{
GimpTool *tool = GIMP_TOOL (rect_tool);
gint min_x_dummy;
gint min_y_dummy;
gint max_x_dummy;
gint max_y_dummy;
GimpTool *tool = GIMP_TOOL (rect_tool);
GimpImage *image = gimp_display_get_image (tool->display);
gint min_x_dummy;
gint min_y_dummy;
gint max_x_dummy;
gint max_y_dummy;
if (! min_x) min_x = &min_x_dummy;
if (! min_y) min_y = &min_y_dummy;
@ -4135,8 +4149,8 @@ gimp_rectangle_tool_get_constraints (GimpRectangleTool *rect_tool,
case GIMP_RECTANGLE_CONSTRAIN_IMAGE:
*min_x = 0;
*min_y = 0;
*max_x = gimp_image_get_width (tool->display->image);
*max_y = gimp_image_get_height (tool->display->image);
*max_x = gimp_image_get_width (image);
*max_y = gimp_image_get_height (image);
break;
case GIMP_RECTANGLE_CONSTRAIN_DRAWABLE:

View File

@ -181,6 +181,7 @@ gimp_region_select_tool_button_release (GimpTool *tool,
GimpRegionSelectTool *region_sel = GIMP_REGION_SELECT_TOOL (tool);
GimpSelectionOptions *sel_options = GIMP_SELECTION_TOOL_GET_OPTIONS (tool);
GimpRegionSelectOptions *options = GIMP_REGION_SELECT_TOOL_GET_OPTIONS (tool);
GimpImage *image = gimp_display_get_image (display);
gimp_tool_pop_status (tool, display);
@ -192,19 +193,18 @@ gimp_region_select_tool_button_release (GimpTool *tool,
{
if (GIMP_SELECTION_TOOL (tool)->function == SELECTION_ANCHOR)
{
if (gimp_image_get_floating_selection (display->image))
if (gimp_image_get_floating_selection (image))
{
/* If there is a floating selection, anchor it */
floating_sel_anchor (gimp_image_get_floating_selection (display->image));
floating_sel_anchor (gimp_image_get_floating_selection (image));
}
else
{
/* Otherwise, clear the selection mask */
gimp_channel_clear (gimp_image_get_mask (display->image), NULL,
TRUE);
gimp_channel_clear (gimp_image_get_mask (image), NULL, TRUE);
}
gimp_image_flush (display->image);
gimp_image_flush (image);
}
else if (region_sel->region_mask)
{
@ -213,14 +213,12 @@ gimp_region_select_tool_button_release (GimpTool *tool,
if (! options->sample_merged)
{
GimpDrawable *drawable;
drawable = gimp_image_get_active_drawable (display->image);
GimpDrawable *drawable = gimp_image_get_active_drawable (image);
gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
}
gimp_channel_select_channel (gimp_image_get_mask (display->image),
gimp_channel_select_channel (gimp_image_get_mask (image),
GIMP_REGION_SELECT_TOOL_GET_CLASS (tool)->undo_desc,
region_sel->region_mask,
off_x,
@ -231,7 +229,7 @@ gimp_region_select_tool_button_release (GimpTool *tool,
sel_options->feather_radius);
gimp_image_flush (display->image);
gimp_image_flush (image);
}
}
@ -309,8 +307,9 @@ gimp_region_select_tool_cursor_update (GimpTool *tool,
{
GimpRegionSelectOptions *options = GIMP_REGION_SELECT_TOOL_GET_OPTIONS (tool);
GimpCursorModifier modifier = GIMP_CURSOR_MODIFIER_NONE;
GimpImage *image = gimp_display_get_image (display);
if (! gimp_image_coords_in_active_pickable (display->image, coords,
if (! gimp_image_coords_in_active_pickable (image, coords,
options->sample_merged, FALSE))
modifier = GIMP_CURSOR_MODIFIER_BAD;
@ -344,13 +343,10 @@ gimp_region_select_tool_calculate (GimpRegionSelectTool *region_sel,
GimpTool *tool = GIMP_TOOL (region_sel);
GimpRegionSelectOptions *options = GIMP_REGION_SELECT_TOOL_GET_OPTIONS (tool);
GimpDisplayShell *shell = gimp_display_get_shell (display);
GimpDrawable *drawable;
GdkSegment *segs;
BoundSeg *bsegs;
PixelRegion maskPR;
drawable = gimp_image_get_active_drawable (display->image);
gimp_display_shell_set_override_cursor (shell, GDK_WATCH);
if (region_sel->region_mask)

View File

@ -334,10 +334,9 @@ gimp_transform_tool_initialize (GimpTool *tool,
GimpDisplay *display,
GError **error)
{
GimpTransformTool *tr_tool = GIMP_TRANSFORM_TOOL (tool);
GimpDrawable *drawable;
drawable = gimp_image_get_active_drawable (display->image);
GimpTransformTool *tr_tool = GIMP_TRANSFORM_TOOL (tool);
GimpImage *image = gimp_display_get_image (display);
GimpDrawable *drawable = gimp_image_get_active_drawable (image);
if (! GIMP_TOOL_CLASS (parent_class)->initialize (tool, display, error))
{
@ -704,6 +703,7 @@ gimp_transform_tool_cursor_update (GimpTool *tool,
GimpTransformOptions *options = GIMP_TRANSFORM_TOOL_GET_OPTIONS (tool);
GimpCursorType cursor;
GimpCursorModifier modifier = GIMP_CURSOR_MODIFIER_NONE;
GimpImage *image = gimp_display_get_image (display);
cursor = gimp_tool_control_get_cursor (tool->control);
@ -759,7 +759,7 @@ gimp_transform_tool_cursor_update (GimpTool *tool,
GimpDrawable *drawable;
case GIMP_TRANSFORM_TYPE_LAYER:
drawable = gimp_image_get_active_drawable (display->image);
drawable = gimp_image_get_active_drawable (image);
if (gimp_item_is_content_locked (GIMP_ITEM (drawable)))
modifier = GIMP_CURSOR_MODIFIER_BAD;
break;
@ -768,7 +768,7 @@ gimp_transform_tool_cursor_update (GimpTool *tool,
break;
case GIMP_TRANSFORM_TYPE_PATH:
if (! gimp_image_get_active_vectors (display->image))
if (! gimp_image_get_active_vectors (image))
modifier = GIMP_CURSOR_MODIFIER_BAD;
break;
}
@ -784,6 +784,7 @@ gimp_transform_tool_draw (GimpDrawTool *draw_tool)
{
GimpTool *tool = GIMP_TOOL (draw_tool);
GimpTransformTool *tr_tool = GIMP_TRANSFORM_TOOL (draw_tool);
GimpImage *image = gimp_display_get_image (tool->display);
gdouble z1, z2, z3, z4;
if (tr_tool->use_grid)
@ -948,7 +949,7 @@ gimp_transform_tool_draw (GimpDrawTool *draw_tool)
gint num_groups;
gint i;
gimp_channel_boundary (gimp_image_get_mask (tool->display->image),
gimp_channel_boundary (gimp_image_get_mask (image),
&orig_in, &orig_out,
&num_segs_in, &num_segs_out,
0, 0, 0, 0);
@ -1029,7 +1030,7 @@ gimp_transform_tool_draw (GimpDrawTool *draw_tool)
GimpStroke *stroke = NULL;
GimpMatrix3 matrix = tr_tool->transform;
vectors = gimp_image_get_active_vectors (tool->display->image);
vectors = gimp_image_get_active_vectors (image);
if (vectors)
{
@ -1176,6 +1177,7 @@ gimp_transform_tool_doit (GimpTransformTool *tr_tool,
GimpTransformOptions *options = GIMP_TRANSFORM_TOOL_GET_OPTIONS (tool);
GimpContext *context = GIMP_CONTEXT (options);
GimpDisplayShell *shell = gimp_display_get_shell (display);
GimpImage *image = gimp_display_get_image (display);
GimpItem *active_item = NULL;
TileManager *new_tiles;
const gchar *null_message = NULL;
@ -1186,20 +1188,20 @@ gimp_transform_tool_doit (GimpTransformTool *tr_tool,
switch (options->type)
{
case GIMP_TRANSFORM_TYPE_LAYER:
active_item = GIMP_ITEM (gimp_image_get_active_drawable (display->image));
active_item = GIMP_ITEM (gimp_image_get_active_drawable (image));
null_message = _("There is no layer to transform.");
locked_message = _("The active layer's pixels are locked.");
break;
case GIMP_TRANSFORM_TYPE_SELECTION:
active_item = GIMP_ITEM (gimp_image_get_mask (display->image));
active_item = GIMP_ITEM (gimp_image_get_mask (image));
/* cannot happen, so don't translate these messages */
null_message = "There is no selection to transform.";
locked_message = "The selection's pixels are locked.";
break;
case GIMP_TRANSFORM_TYPE_PATH:
active_item = GIMP_ITEM (gimp_image_get_active_vectors (display->image));
active_item = GIMP_ITEM (gimp_image_get_active_vectors (image));
null_message = _("There is no path to transform.");
locked_message = _("The active path's strokes are locked.");
break;
@ -1221,7 +1223,7 @@ gimp_transform_tool_doit (GimpTransformTool *tr_tool,
gimp_dialog_factory_hide_dialog (tr_tool->dialog);
mask_empty = gimp_channel_is_empty (gimp_image_get_mask (display->image));
mask_empty = gimp_channel_is_empty (gimp_image_get_mask (image));
gimp_set_busy (display->gimp);
@ -1232,7 +1234,7 @@ gimp_transform_tool_doit (GimpTransformTool *tr_tool,
gimp_tool_control_set_preserve (tool->control, TRUE);
/* Start a transform undo group */
gimp_image_undo_group_start (display->image, GIMP_UNDO_GROUP_TRANSFORM,
gimp_image_undo_group_start (image, GIMP_UNDO_GROUP_TRANSFORM,
tr_tool->undo_desc);
/* With the old UI, if original is NULL, then this is the
@ -1244,7 +1246,7 @@ gimp_transform_tool_doit (GimpTransformTool *tr_tool,
* selection pointer, so that the original source can be repeatedly
* modified.
*/
tool->drawable = gimp_image_get_active_drawable (display->image);
tool->drawable = gimp_image_get_active_drawable (image);
switch (options->type)
{
@ -1313,16 +1315,16 @@ gimp_transform_tool_doit (GimpTransformTool *tr_tool,
/* Make a note of the new current drawable (since we may have
* a floating selection, etc now.
*/
tool->drawable = gimp_image_get_active_drawable (display->image);
tool->drawable = gimp_image_get_active_drawable (image);
gimp_image_undo_push (display->image, GIMP_TYPE_TRANSFORM_TOOL_UNDO,
gimp_image_undo_push (image, GIMP_TYPE_TRANSFORM_TOOL_UNDO,
GIMP_UNDO_TRANSFORM, NULL,
0,
"transform-tool", tr_tool,
NULL);
/* push the undo group end */
gimp_image_undo_group_end (display->image);
gimp_image_undo_group_end (image);
/* We're done dirtying the image, and would like to be restarted
* if the image gets dirty while the tool exists
@ -1339,7 +1341,7 @@ gimp_transform_tool_doit (GimpTransformTool *tr_tool,
gimp_unset_busy (display->gimp);
gimp_image_flush (display->image);
gimp_image_flush (image);
gimp_transform_tool_halt (tr_tool);
}
@ -1513,8 +1515,7 @@ gimp_transform_tool_bounds (GimpTransformTool *tr_tool,
GimpDisplay *display)
{
GimpTransformOptions *options = GIMP_TRANSFORM_TOOL_GET_OPTIONS (tr_tool);
g_return_if_fail (GIMP_IS_DISPLAY (display));
GimpImage *image = gimp_display_get_image (display);
/* find the boundaries */
if (tr_tool->original)
@ -1534,7 +1535,7 @@ gimp_transform_tool_bounds (GimpTransformTool *tr_tool,
gint offset_x;
gint offset_y;
drawable = gimp_image_get_active_drawable (display->image);
drawable = gimp_image_get_active_drawable (image);
gimp_item_get_offset (GIMP_ITEM (drawable), &offset_x, &offset_y);
@ -1550,7 +1551,7 @@ gimp_transform_tool_bounds (GimpTransformTool *tr_tool,
case GIMP_TRANSFORM_TYPE_SELECTION:
case GIMP_TRANSFORM_TYPE_PATH:
gimp_channel_bounds (gimp_image_get_mask (display->image),
gimp_channel_bounds (gimp_image_get_mask (image),
&tr_tool->x1, &tr_tool->y1,
&tr_tool->x2, &tr_tool->y2);
break;
@ -1737,6 +1738,7 @@ gimp_transform_tool_prepare (GimpTransformTool *tr_tool,
GimpDisplay *display)
{
GimpTransformOptions *options = GIMP_TRANSFORM_TOOL_GET_OPTIONS (tr_tool);
GimpImage *image = gimp_display_get_image (display);
gboolean show_transform;
show_transform =
@ -1750,7 +1752,7 @@ gimp_transform_tool_prepare (GimpTransformTool *tr_tool,
if (tr_tool->dialog)
{
GimpDrawable *drawable = gimp_image_get_active_drawable (display->image);
GimpDrawable *drawable = gimp_image_get_active_drawable (image);
gimp_viewable_dialog_set_viewable (GIMP_VIEWABLE_DIALOG (tr_tool->dialog),
GIMP_VIEWABLE (drawable),