mirror of https://github.com/GNOME/gimp.git
app: rename the new gimp_drawable_*_undo() functions.
These are not generic undo function, but specific to the resize case (and even more particularly when calling the GimpItem's resize() class method). Also the variable was wrongly named no_undo when it actually was meant for the opposite meaning, i.e. when we want to push an undo for a resize() call. This made the call harder to understand. Furthermore the usage of double negation did not help with understanding the code.
This commit is contained in:
parent
aa7d7badc8
commit
ef8ddd7e30
|
@ -42,7 +42,7 @@ struct _GimpDrawablePrivate
|
|||
cairo_region_t *paint_copy_region;
|
||||
cairo_region_t *paint_update_region;
|
||||
|
||||
gboolean no_undo;
|
||||
gboolean push_resize_undo;
|
||||
};
|
||||
|
||||
#endif /* __GIMP_DRAWABLE_PRIVATE_H__ */
|
||||
|
|
|
@ -630,7 +630,7 @@ gimp_drawable_resize (GimpItem *item,
|
|||
|
||||
gimp_drawable_set_buffer_full (drawable,
|
||||
gimp_item_is_attached (item) &&
|
||||
(!gimp_drawable_get_undo (drawable)),
|
||||
drawable->private->push_resize_undo,
|
||||
NULL,
|
||||
new_buffer,
|
||||
GEGL_RECTANGLE (new_offset_x, new_offset_y,
|
||||
|
@ -1079,7 +1079,7 @@ gimp_drawable_new (GType type,
|
|||
gimp_drawable_set_buffer (drawable, FALSE, NULL, buffer);
|
||||
g_object_unref (buffer);
|
||||
|
||||
gimp_drawable_enable_undo (drawable);
|
||||
gimp_drawable_enable_resize_undo (drawable);
|
||||
|
||||
return drawable;
|
||||
}
|
||||
|
@ -1682,27 +1682,19 @@ gimp_drawable_push_undo (GimpDrawable *drawable,
|
|||
}
|
||||
|
||||
void
|
||||
gimp_drawable_disable_undo (GimpDrawable *drawable)
|
||||
gimp_drawable_disable_resize_undo (GimpDrawable *drawable)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
|
||||
|
||||
drawable->private->no_undo = FALSE;
|
||||
drawable->private->push_resize_undo = FALSE;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_drawable_enable_undo (GimpDrawable *drawable)
|
||||
gimp_drawable_enable_resize_undo (GimpDrawable *drawable)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
|
||||
|
||||
drawable->private->no_undo = TRUE;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gimp_drawable_get_undo (GimpDrawable *drawable)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_DRAWABLE (drawable), FALSE);
|
||||
|
||||
return !drawable->private->no_undo;
|
||||
drawable->private->push_resize_undo = TRUE;
|
||||
}
|
||||
|
||||
const Babl *
|
||||
|
|
|
@ -205,9 +205,8 @@ void gimp_drawable_push_undo (GimpDrawable *drawable,
|
|||
gint width,
|
||||
gint height);
|
||||
|
||||
void gimp_drawable_disable_undo (GimpDrawable *drawable);
|
||||
void gimp_drawable_enable_undo (GimpDrawable *drawable);
|
||||
gboolean gimp_drawable_get_undo (GimpDrawable *drawable);
|
||||
void gimp_drawable_disable_resize_undo (GimpDrawable *drawable);
|
||||
void gimp_drawable_enable_resize_undo (GimpDrawable *drawable);
|
||||
|
||||
const Babl * gimp_drawable_get_space (GimpDrawable *drawable);
|
||||
const Babl * gimp_drawable_get_format (GimpDrawable *drawable);
|
||||
|
|
|
@ -1045,21 +1045,21 @@ gimp_paint_core_expand_drawable (GimpPaintCore *core,
|
|||
|
||||
g_object_freeze_notify (G_OBJECT (layer));
|
||||
|
||||
gimp_drawable_disable_undo (GIMP_DRAWABLE (layer));
|
||||
gimp_drawable_disable_resize_undo (GIMP_DRAWABLE (layer));
|
||||
GIMP_LAYER_GET_CLASS (layer)->resize (layer, context, fill_type,
|
||||
new_width, new_height,
|
||||
*new_off_x, *new_off_y);
|
||||
gimp_drawable_enable_undo (GIMP_DRAWABLE (layer));
|
||||
gimp_drawable_enable_resize_undo (GIMP_DRAWABLE (layer));
|
||||
|
||||
if (layer->mask)
|
||||
{
|
||||
g_object_freeze_notify (G_OBJECT (layer->mask));
|
||||
|
||||
gimp_drawable_disable_undo (GIMP_DRAWABLE (layer->mask));
|
||||
gimp_drawable_disable_resize_undo (GIMP_DRAWABLE (layer->mask));
|
||||
GIMP_ITEM_GET_CLASS (layer->mask)->resize (GIMP_ITEM (layer->mask), context,
|
||||
mask_fill_type, new_width, new_height,
|
||||
*new_off_x, *new_off_y);
|
||||
gimp_drawable_enable_undo (GIMP_DRAWABLE (layer->mask));
|
||||
gimp_drawable_enable_resize_undo (GIMP_DRAWABLE (layer->mask));
|
||||
|
||||
g_object_thaw_notify (G_OBJECT (layer->mask));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue