mirror of https://github.com/GNOME/gimp.git
added gimp_guide_get_ID().
2006-06-07 Michael Natterer <mitch@gimp.org> * app/core/gimpguide.[ch]: added gimp_guide_get_ID(). * app/core/gimpimage-crop.c * app/core/gimpimage-duplicate.c * app/core/gimpimage-flip.c * app/core/gimpimage-guides.c * app/core/gimpimage-resize.c * app/core/gimpimage-rotate.c * app/core/gimpimage-scale.c * app/core/gimpimage-snap.c * app/core/gimpimage-undo-push.c * app/display/gimpdisplayshell-draw.c * app/display/gimpdisplayshell.c * app/tools/gimpmovetool.c * app/xcf/xcf-save.c * tools/pdbgen/pdb/guides.pdb: use accessors instead of accessing GimpGuide's struct members directly. * app/pdb/guides_cmds.c: regenerated.
This commit is contained in:
parent
bb2d9cbbdd
commit
7499fc89ff
13
ChangeLog
13
ChangeLog
|
@ -1,8 +1,7 @@
|
|||
2006-06-07 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/core/gimpguide.[ch]
|
||||
* app/core/gimpguide.[ch]: added gimp_guide_get_ID().
|
||||
|
||||
* app/core/gimpimage-convert.c
|
||||
* app/core/gimpimage-crop.c
|
||||
* app/core/gimpimage-duplicate.c
|
||||
* app/core/gimpimage-flip.c
|
||||
|
@ -12,18 +11,14 @@
|
|||
* app/core/gimpimage-scale.c
|
||||
* app/core/gimpimage-snap.c
|
||||
* app/core/gimpimage-undo-push.c
|
||||
|
||||
* app/display/gimpdisplayshell-draw.c
|
||||
* app/display/gimpdisplayshell.c
|
||||
|
||||
* app/tools/gimpmovetool.c
|
||||
|
||||
* app/widgets/gimpeditor.c
|
||||
* app/xcf/xcf-save.c
|
||||
* tools/pdbgen/pdb/guides.pdb: use accessors instead of accessing
|
||||
GimpGuide's struct members directly.
|
||||
|
||||
* tools/pdbgen/pdb/guides.pdb
|
||||
|
||||
* app/pdb/guides_cmds.c
|
||||
* app/pdb/guides_cmds.c: regenerated.
|
||||
|
||||
2006-06-07 Sven Neumann <sven@gimp.org>
|
||||
|
||||
|
|
|
@ -46,13 +46,13 @@ enum
|
|||
|
||||
|
||||
static void gimp_guide_get_property (GObject *object,
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
guint property_id,
|
||||
GValue *value,
|
||||
GParamSpec *pspec);
|
||||
static void gimp_guide_set_property (GObject *object,
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
guint property_id,
|
||||
const GValue *value,
|
||||
GParamSpec *pspec);
|
||||
|
||||
|
||||
G_DEFINE_TYPE (GimpGuide, gimp_guide, G_TYPE_OBJECT)
|
||||
|
@ -73,12 +73,14 @@ gimp_guide_class_init (GimpGuideClass *klass)
|
|||
G_MAXINT, 0,
|
||||
G_PARAM_CONSTRUCT_ONLY |
|
||||
GIMP_PARAM_STATIC_STRINGS);
|
||||
|
||||
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_ORIENTATION,
|
||||
"orientation",
|
||||
N_("Orientation of the guide."),
|
||||
GIMP_TYPE_ORIENTATION_TYPE,
|
||||
GIMP_ORIENTATION_UNKNOWN,
|
||||
GIMP_PARAM_STATIC_STRINGS);
|
||||
|
||||
GIMP_CONFIG_INSTALL_PROP_INT (object_class, PROP_POSITION,
|
||||
"position",
|
||||
N_("Offset of the guide."),
|
||||
|
@ -152,6 +154,14 @@ gimp_guide_new (GimpOrientationType orientation,
|
|||
NULL);
|
||||
}
|
||||
|
||||
guint32
|
||||
gimp_guide_get_ID (GimpGuide *guide)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_GUIDE (guide), 0);
|
||||
|
||||
return guide->guide_ID;
|
||||
}
|
||||
|
||||
GimpOrientationType
|
||||
gimp_guide_get_orientation (GimpGuide *guide)
|
||||
{
|
||||
|
|
|
@ -34,18 +34,17 @@
|
|||
#define GIMP_GUIDE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_GUIDE, GimpGuideClass))
|
||||
|
||||
|
||||
typedef struct _GimpGuideClass GimpGuideClass;
|
||||
typedef struct _GimpGuideClass GimpGuideClass;
|
||||
|
||||
struct _GimpGuide
|
||||
{
|
||||
GObject parent_instance;
|
||||
|
||||
gint position;
|
||||
GimpOrientationType orientation;
|
||||
guint32 guide_ID;
|
||||
GimpOrientationType orientation;
|
||||
gint position;
|
||||
};
|
||||
|
||||
|
||||
struct _GimpGuideClass
|
||||
{
|
||||
GObjectClass parent_class;
|
||||
|
@ -56,9 +55,13 @@ GType gimp_guide_get_type (void) G_GNUC_CONST;
|
|||
|
||||
GimpGuide * gimp_guide_new (GimpOrientationType orientation,
|
||||
guint32 guide_ID);
|
||||
|
||||
guint32 gimp_guide_get_ID (GimpGuide *guide);
|
||||
|
||||
GimpOrientationType gimp_guide_get_orientation (GimpGuide *guide);
|
||||
void gimp_guide_set_orientation (GimpGuide *guide,
|
||||
GimpOrientationType orientation);
|
||||
|
||||
gint gimp_guide_get_position (GimpGuide *guide);
|
||||
void gimp_guide_set_position (GimpGuide *guide,
|
||||
gint position);
|
||||
|
|
|
@ -203,22 +203,24 @@ gimp_image_crop (GimpImage *image,
|
|||
{
|
||||
GimpGuide *guide = list->data;
|
||||
gboolean remove_guide = FALSE;
|
||||
gint new_position = guide->position;
|
||||
gint position = gimp_guide_get_position (guide);
|
||||
|
||||
list = g_list_next (list);
|
||||
|
||||
switch (guide->orientation)
|
||||
switch (gimp_guide_get_orientation (guide))
|
||||
{
|
||||
case GIMP_ORIENTATION_HORIZONTAL:
|
||||
new_position -= y1;
|
||||
if ((guide->position < y1) || (guide->position > y2))
|
||||
if ((position < y1) || (position > y2))
|
||||
remove_guide = TRUE;
|
||||
else
|
||||
position -= y1;
|
||||
break;
|
||||
|
||||
case GIMP_ORIENTATION_VERTICAL:
|
||||
new_position -= x1;
|
||||
if ((guide->position < x1) || (guide->position > x2))
|
||||
if ((position < x1) || (position > x2))
|
||||
remove_guide = TRUE;
|
||||
else
|
||||
position -= x1;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -227,8 +229,8 @@ gimp_image_crop (GimpImage *image,
|
|||
|
||||
if (remove_guide)
|
||||
gimp_image_remove_guide (image, guide, TRUE);
|
||||
else if (new_position != guide->position)
|
||||
gimp_image_move_guide (image, guide, new_position, TRUE);
|
||||
else if (position != gimp_guide_get_position (guide))
|
||||
gimp_image_move_guide (image, guide, position, TRUE);
|
||||
}
|
||||
|
||||
/* Reposition or remove sample points */
|
||||
|
|
|
@ -222,16 +222,17 @@ gimp_image_duplicate (GimpImage *image)
|
|||
/* Copy any guides */
|
||||
for (list = image->guides; list; list = g_list_next (list))
|
||||
{
|
||||
GimpGuide *guide = list->data;
|
||||
GimpGuide *guide = list->data;
|
||||
gint position = gimp_guide_get_position (guide);
|
||||
|
||||
switch (guide->orientation)
|
||||
switch (gimp_guide_get_orientation (guide))
|
||||
{
|
||||
case GIMP_ORIENTATION_HORIZONTAL:
|
||||
gimp_image_add_hguide (new_image, guide->position, FALSE);
|
||||
gimp_image_add_hguide (new_image, position, FALSE);
|
||||
break;
|
||||
|
||||
case GIMP_ORIENTATION_VERTICAL:
|
||||
gimp_image_add_vguide (new_image, guide->position, FALSE);
|
||||
gimp_image_add_vguide (new_image, position, FALSE);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -125,20 +125,21 @@ gimp_image_flip (GimpImage *image,
|
|||
/* Flip all Guides */
|
||||
for (list = image->guides; list; list = g_list_next (list))
|
||||
{
|
||||
GimpGuide *guide = list->data;
|
||||
GimpGuide *guide = list->data;
|
||||
gint position = gimp_guide_get_position (guide);
|
||||
|
||||
switch (guide->orientation)
|
||||
switch (gimp_guide_get_orientation (guide))
|
||||
{
|
||||
case GIMP_ORIENTATION_HORIZONTAL:
|
||||
if (flip_type == GIMP_ORIENTATION_VERTICAL)
|
||||
gimp_image_move_guide (image, guide,
|
||||
image->height - guide->position, TRUE);
|
||||
image->height - position, TRUE);
|
||||
break;
|
||||
|
||||
case GIMP_ORIENTATION_VERTICAL:
|
||||
if (flip_type == GIMP_ORIENTATION_HORIZONTAL)
|
||||
gimp_image_move_guide (image, guide,
|
||||
image->width - guide->position, TRUE);
|
||||
image->width - position, TRUE);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -86,14 +86,14 @@ gimp_image_add_guide (GimpImage *image,
|
|||
g_return_if_fail (GIMP_IS_GUIDE (guide));
|
||||
g_return_if_fail (position >= 0);
|
||||
|
||||
if (guide->orientation == GIMP_ORIENTATION_HORIZONTAL)
|
||||
if (gimp_guide_get_orientation (guide) == GIMP_ORIENTATION_HORIZONTAL)
|
||||
g_return_if_fail (position <= image->height);
|
||||
else
|
||||
g_return_if_fail (position <= image->width);
|
||||
|
||||
image->guides = g_list_prepend (image->guides, guide);
|
||||
|
||||
guide->position = position;
|
||||
gimp_guide_set_position (guide, position);
|
||||
g_object_ref (G_OBJECT (guide));
|
||||
|
||||
gimp_image_update_guide (image, guide);
|
||||
|
@ -114,7 +114,7 @@ gimp_image_remove_guide (GimpImage *image,
|
|||
|
||||
image->guides = g_list_remove (image->guides, guide);
|
||||
|
||||
guide->position = -1;
|
||||
gimp_guide_set_position (guide, -1);
|
||||
g_object_unref (G_OBJECT (guide));
|
||||
}
|
||||
|
||||
|
@ -128,7 +128,7 @@ gimp_image_move_guide (GimpImage *image,
|
|||
g_return_if_fail (GIMP_IS_GUIDE (guide));
|
||||
g_return_if_fail (position >= 0);
|
||||
|
||||
if (guide->orientation == GIMP_ORIENTATION_HORIZONTAL)
|
||||
if (gimp_guide_get_orientation (guide) == GIMP_ORIENTATION_HORIZONTAL)
|
||||
g_return_if_fail (position <= image->height);
|
||||
else
|
||||
g_return_if_fail (position <= image->width);
|
||||
|
@ -137,7 +137,7 @@ gimp_image_move_guide (GimpImage *image,
|
|||
gimp_image_undo_push_image_guide (image, _("Move Guide"), guide);
|
||||
|
||||
gimp_image_update_guide (image, guide);
|
||||
guide->position = position;
|
||||
gimp_guide_set_position (guide, position);
|
||||
gimp_image_update_guide (image, guide);
|
||||
}
|
||||
|
||||
|
@ -153,7 +153,8 @@ gimp_image_get_guide (GimpImage *image,
|
|||
{
|
||||
GimpGuide *guide = guides->data;
|
||||
|
||||
if (guide->guide_ID == id && guide->position >= 0)
|
||||
if (gimp_guide_get_ID (guide) == id &&
|
||||
gimp_guide_get_position (guide) >= 0)
|
||||
return guide;
|
||||
}
|
||||
|
||||
|
@ -179,13 +180,13 @@ gimp_image_get_next_guide (GimpImage *image,
|
|||
{
|
||||
GimpGuide *guide = guides->data;
|
||||
|
||||
if (guide->position < 0)
|
||||
if (gimp_guide_get_position (guide) < 0)
|
||||
continue;
|
||||
|
||||
if (*guide_found) /* this is the first guide after the found one */
|
||||
return guide;
|
||||
|
||||
if (guide->guide_ID == id) /* found it, next one will be returned */
|
||||
if (gimp_guide_get_ID (guide) == id) /* found it, next one will be returned */
|
||||
*guide_found = TRUE;
|
||||
}
|
||||
|
||||
|
@ -216,15 +217,18 @@ gimp_image_find_guide (GimpImage *image,
|
|||
|
||||
for (list = image->guides; list; list = g_list_next (list))
|
||||
{
|
||||
guide = list->data;
|
||||
gint position;
|
||||
|
||||
if (guide->position < 0)
|
||||
guide = list->data;
|
||||
position = gimp_guide_get_position (guide);
|
||||
|
||||
if (position < 0)
|
||||
continue;
|
||||
|
||||
switch (guide->orientation)
|
||||
switch (gimp_guide_get_orientation (guide))
|
||||
{
|
||||
case GIMP_ORIENTATION_HORIZONTAL:
|
||||
dist = ABS (guide->position - y);
|
||||
dist = ABS (position - y);
|
||||
if (dist < MIN (epsilon_y, mindist))
|
||||
{
|
||||
mindist = dist;
|
||||
|
@ -234,7 +238,7 @@ gimp_image_find_guide (GimpImage *image,
|
|||
|
||||
/* mindist always is in vertical resolution to make it comparable */
|
||||
case GIMP_ORIENTATION_VERTICAL:
|
||||
dist = ABS (guide->position - x);
|
||||
dist = ABS (position - x);
|
||||
if (dist < MIN (epsilon_x, mindist / epsilon_y * epsilon_x))
|
||||
{
|
||||
mindist = dist * epsilon_y / epsilon_x;
|
||||
|
|
|
@ -167,9 +167,9 @@ gimp_image_resize_with_layers (GimpImage *image,
|
|||
{
|
||||
GimpGuide *guide = list->data;
|
||||
gboolean remove_guide = FALSE;
|
||||
gint new_position = guide->position;
|
||||
gint new_position = gimp_guide_get_position (guide);
|
||||
|
||||
switch (guide->orientation)
|
||||
switch (gimp_guide_get_orientation (guide))
|
||||
{
|
||||
case GIMP_ORIENTATION_HORIZONTAL:
|
||||
new_position += offset_y;
|
||||
|
@ -189,7 +189,7 @@ gimp_image_resize_with_layers (GimpImage *image,
|
|||
|
||||
if (remove_guide)
|
||||
gimp_image_remove_guide (image, guide, TRUE);
|
||||
else if (new_position != guide->position)
|
||||
else if (new_position != gimp_guide_get_position (guide))
|
||||
gimp_image_move_guide (image, guide, new_position, TRUE);
|
||||
}
|
||||
|
||||
|
|
|
@ -253,22 +253,24 @@ gimp_image_rotate_guides (GimpImage *image,
|
|||
/* Rotate all Guides */
|
||||
for (list = image->guides; list; list = g_list_next (list))
|
||||
{
|
||||
GimpGuide *guide = list->data;
|
||||
GimpGuide *guide = list->data;
|
||||
GimpOrientationType orientation = gimp_guide_get_orientation (guide);
|
||||
gint position = gimp_guide_get_position (guide);
|
||||
|
||||
switch (rotate_type)
|
||||
{
|
||||
case GIMP_ROTATE_90:
|
||||
switch (guide->orientation)
|
||||
switch (orientation)
|
||||
{
|
||||
case GIMP_ORIENTATION_HORIZONTAL:
|
||||
gimp_image_undo_push_image_guide (image, NULL, guide);
|
||||
guide->orientation = GIMP_ORIENTATION_VERTICAL;
|
||||
guide->position = image->height - guide->position;
|
||||
gimp_guide_set_orientation (guide, GIMP_ORIENTATION_VERTICAL);
|
||||
gimp_guide_set_position (guide, image->height - position);
|
||||
break;
|
||||
|
||||
case GIMP_ORIENTATION_VERTICAL:
|
||||
gimp_image_undo_push_image_guide (image, NULL, guide);
|
||||
guide->orientation = GIMP_ORIENTATION_HORIZONTAL;
|
||||
gimp_guide_set_orientation (guide, GIMP_ORIENTATION_HORIZONTAL);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -277,16 +279,16 @@ gimp_image_rotate_guides (GimpImage *image,
|
|||
break;
|
||||
|
||||
case GIMP_ROTATE_180:
|
||||
switch (guide->orientation)
|
||||
switch (orientation)
|
||||
{
|
||||
case GIMP_ORIENTATION_HORIZONTAL:
|
||||
gimp_image_move_guide (image, guide,
|
||||
image->height - guide->position, TRUE);
|
||||
image->height - position, TRUE);
|
||||
break;
|
||||
|
||||
case GIMP_ORIENTATION_VERTICAL:
|
||||
gimp_image_move_guide (image, guide,
|
||||
image->width - guide->position, TRUE);
|
||||
image->width - position, TRUE);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -295,17 +297,17 @@ gimp_image_rotate_guides (GimpImage *image,
|
|||
break;
|
||||
|
||||
case GIMP_ROTATE_270:
|
||||
switch (guide->orientation)
|
||||
switch (orientation)
|
||||
{
|
||||
case GIMP_ORIENTATION_HORIZONTAL:
|
||||
gimp_image_undo_push_image_guide (image, NULL, guide);
|
||||
guide->orientation = GIMP_ORIENTATION_VERTICAL;
|
||||
gimp_guide_set_orientation (guide, GIMP_ORIENTATION_VERTICAL);
|
||||
break;
|
||||
|
||||
case GIMP_ORIENTATION_VERTICAL:
|
||||
gimp_image_undo_push_image_guide (image, NULL, guide);
|
||||
guide->orientation = GIMP_ORIENTATION_HORIZONTAL;
|
||||
guide->position = image->width - guide->position;
|
||||
gimp_guide_set_orientation (guide, GIMP_ORIENTATION_HORIZONTAL);
|
||||
gimp_guide_set_position (guide, image->width - position);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -164,18 +164,19 @@ gimp_image_scale (GimpImage *image,
|
|||
/* Scale all Guides */
|
||||
for (list = image->guides; list; list = g_list_next (list))
|
||||
{
|
||||
GimpGuide *guide = list->data;
|
||||
GimpGuide *guide = list->data;
|
||||
gint position = gimp_guide_get_position (guide);
|
||||
|
||||
switch (guide->orientation)
|
||||
switch (gimp_guide_get_orientation (guide))
|
||||
{
|
||||
case GIMP_ORIENTATION_HORIZONTAL:
|
||||
gimp_image_undo_push_image_guide (image, NULL, guide);
|
||||
guide->position = (guide->position * new_height) / old_height;
|
||||
gimp_guide_set_position (guide, (position * new_height) / old_height);
|
||||
break;
|
||||
|
||||
case GIMP_ORIENTATION_VERTICAL:
|
||||
gimp_image_undo_push_image_guide (image, NULL, guide);
|
||||
guide->position = (guide->position * new_width) / old_width;
|
||||
gimp_guide_set_position (guide, (position * new_width) / old_width);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -71,19 +71,20 @@ gimp_image_snap_x (GimpImage *image,
|
|||
|
||||
for (list = image->guides; list; list = g_list_next (list))
|
||||
{
|
||||
GimpGuide *guide = list->data;
|
||||
GimpGuide *guide = list->data;
|
||||
gint position = gimp_guide_get_position (guide);
|
||||
|
||||
if (guide->position < 0)
|
||||
if (position < 0)
|
||||
continue;
|
||||
|
||||
if (guide->orientation == GIMP_ORIENTATION_VERTICAL)
|
||||
if (gimp_guide_get_orientation (guide) == GIMP_ORIENTATION_VERTICAL)
|
||||
{
|
||||
dist = ABS (guide->position - x);
|
||||
dist = ABS (position - x);
|
||||
|
||||
if (dist < MIN (epsilon_x, mindist))
|
||||
{
|
||||
mindist = dist;
|
||||
*tx = guide->position;
|
||||
*tx = position;
|
||||
snapped = TRUE;
|
||||
}
|
||||
}
|
||||
|
@ -175,19 +176,20 @@ gimp_image_snap_y (GimpImage *image,
|
|||
|
||||
for (list = image->guides; list; list = g_list_next (list))
|
||||
{
|
||||
GimpGuide *guide = list->data;
|
||||
GimpGuide *guide = list->data;
|
||||
gint position = gimp_guide_get_position (guide);
|
||||
|
||||
if (guide->position < 0)
|
||||
if (position < 0)
|
||||
continue;
|
||||
|
||||
if (guide->orientation == GIMP_ORIENTATION_HORIZONTAL)
|
||||
if (gimp_guide_get_orientation (guide) == GIMP_ORIENTATION_HORIZONTAL)
|
||||
{
|
||||
dist = ABS (guide->position - y);
|
||||
dist = ABS (position - y);
|
||||
|
||||
if (dist < MIN (epsilon_y, mindist))
|
||||
{
|
||||
mindist = dist;
|
||||
*ty = guide->position;
|
||||
*ty = position;
|
||||
snapped = TRUE;
|
||||
}
|
||||
}
|
||||
|
@ -290,31 +292,32 @@ gimp_image_snap_point (GimpImage *image,
|
|||
|
||||
for (list = image->guides; list; list = g_list_next (list))
|
||||
{
|
||||
GimpGuide *guide = list->data;
|
||||
GimpGuide *guide = list->data;
|
||||
gint position = gimp_guide_get_position (guide);
|
||||
|
||||
if (guide->position < 0)
|
||||
if (position < 0)
|
||||
continue;
|
||||
|
||||
switch (guide->orientation)
|
||||
switch (gimp_guide_get_orientation (guide))
|
||||
{
|
||||
case GIMP_ORIENTATION_HORIZONTAL:
|
||||
dist = ABS (guide->position - y);
|
||||
dist = ABS (position - y);
|
||||
|
||||
if (dist < MIN (epsilon_y, mindist_y))
|
||||
{
|
||||
mindist_y = dist;
|
||||
*ty = guide->position;
|
||||
*ty = position;
|
||||
snapped = TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
case GIMP_ORIENTATION_VERTICAL:
|
||||
dist = ABS (guide->position - x);
|
||||
dist = ABS (position - x);
|
||||
|
||||
if (dist < MIN (epsilon_x, mindist_x))
|
||||
{
|
||||
mindist_x = dist;
|
||||
*tx = guide->position;
|
||||
*tx = position;
|
||||
snapped = TRUE;
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -317,8 +317,8 @@ typedef struct _GuideUndo GuideUndo;
|
|||
struct _GuideUndo
|
||||
{
|
||||
GimpGuide *guide;
|
||||
gint position;
|
||||
GimpOrientationType orientation;
|
||||
gint position;
|
||||
};
|
||||
|
||||
static gboolean undo_pop_image_guide (GimpUndo *undo,
|
||||
|
@ -335,7 +335,7 @@ gimp_image_undo_push_image_guide (GimpImage *image,
|
|||
GimpUndo *new;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_IMAGE (image), FALSE);
|
||||
g_return_val_if_fail (guide != NULL, FALSE);
|
||||
g_return_val_if_fail (GIMP_IS_GUIDE (guide), FALSE);
|
||||
|
||||
if ((new = gimp_image_undo_push (image, GIMP_TYPE_UNDO,
|
||||
sizeof (GuideUndo),
|
||||
|
@ -349,8 +349,8 @@ gimp_image_undo_push_image_guide (GimpImage *image,
|
|||
GuideUndo *gu = new->data;
|
||||
|
||||
gu->guide = g_object_ref (guide);
|
||||
gu->position = guide->position;
|
||||
gu->orientation = guide->orientation;
|
||||
gu->orientation = gimp_guide_get_orientation (guide);
|
||||
gu->position = gimp_guide_get_position (guide);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -364,11 +364,11 @@ undo_pop_image_guide (GimpUndo *undo,
|
|||
GimpUndoAccumulator *accum)
|
||||
{
|
||||
GuideUndo *gu = undo->data;
|
||||
gint old_position;
|
||||
GimpOrientationType old_orientation;
|
||||
gint old_position;
|
||||
|
||||
old_position = gu->guide->position;
|
||||
old_orientation = gu->guide->orientation;
|
||||
old_orientation = gimp_guide_get_orientation (gu->guide);
|
||||
old_position = gimp_guide_get_position (gu->guide);
|
||||
|
||||
/* add and move guides manually (nor using the gimp_image_guide
|
||||
* API), because we might be in the middle of an image resizing
|
||||
|
@ -376,10 +376,10 @@ undo_pop_image_guide (GimpUndo *undo,
|
|||
* image.
|
||||
*/
|
||||
|
||||
if (gu->guide->position == -1)
|
||||
if (old_position == -1)
|
||||
{
|
||||
undo->image->guides = g_list_prepend (undo->image->guides, gu->guide);
|
||||
gu->guide->position = gu->position;
|
||||
gimp_guide_set_position (gu->guide, gu->position);
|
||||
g_object_ref (gu->guide);
|
||||
gimp_image_update_guide (undo->image, gu->guide);
|
||||
}
|
||||
|
@ -390,11 +390,11 @@ undo_pop_image_guide (GimpUndo *undo,
|
|||
else
|
||||
{
|
||||
gimp_image_update_guide (undo->image, gu->guide);
|
||||
gu->guide->position = gu->position;
|
||||
gimp_guide_set_position (gu->guide, gu->position);
|
||||
gimp_image_update_guide (undo->image, gu->guide);
|
||||
}
|
||||
|
||||
gu->guide->orientation = gu->orientation;
|
||||
gimp_guide_set_orientation (gu->guide, gu->orientation);
|
||||
|
||||
gu->position = old_position;
|
||||
gu->orientation = old_orientation;
|
||||
|
|
|
@ -62,15 +62,16 @@ gimp_display_shell_draw_guide (GimpDisplayShell *shell,
|
|||
GimpGuide *guide,
|
||||
gboolean active)
|
||||
{
|
||||
gint x1, x2;
|
||||
gint y1, y2;
|
||||
gint x, y;
|
||||
gint w, h;
|
||||
gint position;
|
||||
gint x1, x2, y1, y2;
|
||||
gint x, y, w, h;
|
||||
|
||||
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
||||
g_return_if_fail (guide != NULL);
|
||||
g_return_if_fail (GIMP_IS_GUIDE (guide));
|
||||
|
||||
if (guide->position < 0)
|
||||
position = gimp_guide_get_position (guide);
|
||||
|
||||
if (position < 0)
|
||||
return;
|
||||
|
||||
gimp_display_shell_transform_xy (shell, 0, 0, &x1, &y1, FALSE);
|
||||
|
@ -81,22 +82,20 @@ gimp_display_shell_draw_guide (GimpDisplayShell *shell,
|
|||
|
||||
gdk_drawable_get_size (shell->canvas->window, &w, &h);
|
||||
|
||||
if (x1 < 0) x1 = 0;
|
||||
if (y1 < 0) y1 = 0;
|
||||
if (x2 > w) x2 = w;
|
||||
if (y2 > h) y2 = h;
|
||||
x1 = MAX (x1, 0);
|
||||
y1 = MAX (y1, 0);
|
||||
x2 = MIN (x2, w);
|
||||
y2 = MIN (y2, h);
|
||||
|
||||
switch (guide->orientation)
|
||||
switch (gimp_guide_get_orientation (guide))
|
||||
{
|
||||
case GIMP_ORIENTATION_HORIZONTAL:
|
||||
gimp_display_shell_transform_xy (shell,
|
||||
0, guide->position, &x, &y, FALSE);
|
||||
gimp_display_shell_transform_xy (shell, 0, position, &x, &y, FALSE);
|
||||
y1 = y2 = y;
|
||||
break;
|
||||
|
||||
case GIMP_ORIENTATION_VERTICAL:
|
||||
gimp_display_shell_transform_xy (shell,
|
||||
guide->position, 0, &x, &y, FALSE);
|
||||
gimp_display_shell_transform_xy (shell, position, 0, &x, &y, FALSE);
|
||||
x1 = x2 = x;
|
||||
break;
|
||||
|
||||
|
|
|
@ -1283,22 +1283,23 @@ void
|
|||
gimp_display_shell_expose_guide (GimpDisplayShell *shell,
|
||||
GimpGuide *guide)
|
||||
{
|
||||
gint x;
|
||||
gint y;
|
||||
gint position;
|
||||
gint x, y;
|
||||
|
||||
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
||||
g_return_if_fail (guide != NULL);
|
||||
g_return_if_fail (GIMP_IS_GUIDE (guide));
|
||||
|
||||
if (guide->position < 0)
|
||||
position = gimp_guide_get_position (guide);
|
||||
|
||||
if (position < 0)
|
||||
return;
|
||||
|
||||
gimp_display_shell_transform_xy (shell,
|
||||
guide->position,
|
||||
guide->position,
|
||||
position, position,
|
||||
&x, &y,
|
||||
FALSE);
|
||||
|
||||
switch (guide->orientation)
|
||||
switch (gimp_guide_get_position (guide))
|
||||
{
|
||||
case GIMP_ORIENTATION_HORIZONTAL:
|
||||
gimp_display_shell_expose_area (shell, 0, y, shell->disp_width, 1);
|
||||
|
|
|
@ -57,7 +57,7 @@ image_add_hguide_invoker (GimpProcedure *procedure,
|
|||
GimpGuide *g;
|
||||
|
||||
g = gimp_image_add_hguide (image, yposition, TRUE);
|
||||
guide = g->guide_ID;
|
||||
guide = gimp_guide_get_ID (g);
|
||||
}
|
||||
else
|
||||
success = FALSE;
|
||||
|
@ -94,7 +94,7 @@ image_add_vguide_invoker (GimpProcedure *procedure,
|
|||
GimpGuide *g;
|
||||
|
||||
g = gimp_image_add_vguide (image, xposition, TRUE);
|
||||
guide = g->guide_ID;
|
||||
guide = gimp_guide_get_ID (g);
|
||||
}
|
||||
else
|
||||
success = FALSE;
|
||||
|
@ -156,7 +156,7 @@ image_find_next_guide_invoker (GimpProcedure *procedure,
|
|||
GimpGuide *g = gimp_image_get_next_guide (image, guide, &success);
|
||||
|
||||
if (g)
|
||||
next_guide = g->guide_ID;
|
||||
next_guide = gimp_guide_get_ID (g);
|
||||
}
|
||||
|
||||
return_vals = gimp_procedure_get_return_values (procedure, success);
|
||||
|
@ -188,7 +188,7 @@ image_get_guide_orientation_invoker (GimpProcedure *procedure,
|
|||
GimpGuide *g = gimp_image_get_guide (image, guide);
|
||||
|
||||
if (g)
|
||||
orientation = g->orientation;
|
||||
orientation = gimp_guide_get_orientation (g);
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
|
@ -222,7 +222,7 @@ image_get_guide_position_invoker (GimpProcedure *procedure,
|
|||
GimpGuide *g = gimp_image_get_guide (image, guide);
|
||||
|
||||
if (g)
|
||||
position = g->position;
|
||||
position = gimp_guide_get_position (g);
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
|
|
|
@ -252,8 +252,8 @@ gimp_move_tool_button_press (GimpTool *tool,
|
|||
{
|
||||
move->guide = guide;
|
||||
move->moving_guide = TRUE;
|
||||
move->guide_position = guide->position;
|
||||
move->guide_orientation = guide->orientation;
|
||||
move->guide_position = gimp_guide_get_position (guide);
|
||||
move->guide_orientation = gimp_guide_get_orientation (guide);
|
||||
|
||||
gimp_tool_control_set_scroll_lock (tool->control, TRUE);
|
||||
gimp_tool_control_activate (tool->control);
|
||||
|
|
|
@ -828,27 +828,24 @@ xcf_save_prop (XcfInfo *info,
|
|||
|
||||
case PROP_GUIDES:
|
||||
{
|
||||
GList *guides;
|
||||
GimpGuide *guide;
|
||||
gint32 position;
|
||||
gint8 orientation;
|
||||
gint nguides;
|
||||
GList *guides;
|
||||
gint n_guides;
|
||||
|
||||
guides = va_arg (args, GList *);
|
||||
nguides = g_list_length (guides);
|
||||
n_guides = g_list_length (guides);
|
||||
|
||||
size = nguides * (4 + 1);
|
||||
size = n_guides * (4 + 1);
|
||||
|
||||
xcf_write_prop_type_check_error (info, prop_type);
|
||||
xcf_write_int32_check_error (info, &size, 1);
|
||||
|
||||
for (; guides; guides = g_list_next (guides))
|
||||
{
|
||||
guide = (GimpGuide *) guides->data;
|
||||
GimpGuide *guide = guides->data;
|
||||
gint32 position = gimp_guide_get_position (guide);
|
||||
gint8 orientation;
|
||||
|
||||
position = guide->position;
|
||||
|
||||
switch (guide->orientation)
|
||||
switch (gimp_guide_get_orientation (guide))
|
||||
{
|
||||
case GIMP_ORIENTATION_HORIZONTAL:
|
||||
orientation = XCF_ORIENTATION_HORIZONTAL;
|
||||
|
|
|
@ -48,7 +48,7 @@ HELP
|
|||
GimpGuide *g;
|
||||
|
||||
g = gimp_image_add_hguide (image, yposition, TRUE);
|
||||
guide = g->guide_ID;
|
||||
guide = gimp_guide_get_ID (g);
|
||||
}
|
||||
else
|
||||
success = FALSE;
|
||||
|
@ -88,7 +88,7 @@ HELP
|
|||
GimpGuide *g;
|
||||
|
||||
g = gimp_image_add_vguide (image, xposition, TRUE);
|
||||
guide = g->guide_ID;
|
||||
guide = gimp_guide_get_ID (g);
|
||||
}
|
||||
else
|
||||
success = FALSE;
|
||||
|
@ -158,7 +158,7 @@ HELP
|
|||
GimpGuide *g = gimp_image_get_next_guide (image, guide, &success);
|
||||
|
||||
if (g)
|
||||
next_guide = g->guide_ID;
|
||||
next_guide = gimp_guide_get_ID (g);
|
||||
}
|
||||
CODE
|
||||
);
|
||||
|
@ -194,7 +194,7 @@ HELP
|
|||
GimpGuide *g = gimp_image_get_guide (image, guide);
|
||||
|
||||
if (g)
|
||||
orientation = g->orientation;
|
||||
orientation = gimp_guide_get_orientation (g);
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
|
@ -230,7 +230,7 @@ HELP
|
|||
GimpGuide *g = gimp_image_get_guide (image, guide);
|
||||
|
||||
if (g)
|
||||
position = g->position;
|
||||
position = gimp_guide_get_position (g);
|
||||
else
|
||||
success = FALSE;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue