[gimp/multi-stroke: 20/30] app: simplify symmetry selection code.
- From: Jehan Pagès <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/multi-stroke: 20/30] app: simplify symmetry selection code.
- Date: Thu, 4 Jun 2015 17:05:40 +0000 (UTC)
commit 8342df6da9dfdbce8377cb321cddcc87c07c66a1
Author: Jehan <jehan girinstud io>
Date: Wed Mar 25 14:55:26 2015 +0100
app: simplify symmetry selection code.
Add an active property to the base GimpSymmetry class.
app/core/gimpimage-symmetry.c | 14 ++-
app/core/gimpsymmetry-mirror.c | 289 +++++++++++++++----------------------
app/core/gimpsymmetry.c | 24 +++
app/core/gimpsymmetry.h | 2 +
app/paint/gimppaintoptions.c | 11 +-
app/paint/gimppaintoptions.h | 4 +-
app/tools/gimppaintoptions-gui.c | 2 +-
app/tools/tool_manager.c | 12 +-
app/xcf/xcf-load.c | 14 +--
app/xcf/xcf-save.c | 13 --
10 files changed, 174 insertions(+), 211 deletions(-)
---
diff --git a/app/core/gimpimage-symmetry.c b/app/core/gimpimage-symmetry.c
index 6d292f2..1789f67 100644
--- a/app/core/gimpimage-symmetry.c
+++ b/app/core/gimpimage-symmetry.c
@@ -80,7 +80,6 @@ gimp_image_symmetry_add (GimpImage *image,
private->symmetries = g_list_prepend (private->symmetries,
sym);
- private->selected_symmetry = sym;
}
/**
@@ -103,7 +102,7 @@ gimp_image_symmetry_remove (GimpImage *image,
private = GIMP_IMAGE_GET_PRIVATE (image);
if (private->selected_symmetry == sym)
- private->selected_symmetry = NULL;
+ gimp_image_symmetry_select (image, G_TYPE_NONE);
private->symmetries = g_list_remove (private->symmetries,
sym);
g_object_unref (sym);
@@ -152,6 +151,10 @@ gimp_image_symmetry_select (GimpImage *image,
if (type == G_TYPE_NONE)
{
+ if (private->selected_symmetry)
+ g_object_set (private->selected_symmetry,
+ "active", FALSE,
+ NULL);
private->selected_symmetry = NULL;
return TRUE;
}
@@ -162,7 +165,14 @@ gimp_image_symmetry_select (GimpImage *image,
GimpSymmetry *sym = iter->data;
if (g_type_is_a (sym->type, type))
{
+ if (private->selected_symmetry)
+ g_object_set (private->selected_symmetry,
+ "active", FALSE,
+ NULL);
private->selected_symmetry = iter->data;
+ g_object_set (private->selected_symmetry,
+ "active", TRUE,
+ NULL);
return TRUE;
}
}
diff --git a/app/core/gimpsymmetry-mirror.c b/app/core/gimpsymmetry-mirror.c
index afdf571..3cdb062 100644
--- a/app/core/gimpsymmetry-mirror.c
+++ b/app/core/gimpsymmetry-mirror.c
@@ -77,8 +77,10 @@ static GeglNode * gimp_mirror_get_operation (GimpSymmetry *mirror,
gint paint_width,
gint paint_height);
static void gimp_mirror_reset (GimpMirror *mirror);
-static GimpGuide * gimp_mirror_create_guide (GimpImage *image,
- GimpOrientationType orientation);
+static void gimp_mirror_add_guide (GimpMirror *mirror,
+ GimpOrientationType orientation);
+static void gimp_mirror_remove_guide (GimpMirror *mirror,
+ GimpOrientationType orientation);
static void gimp_mirror_guide_removed_cb (GObject *object,
GimpMirror *mirror);
static void gimp_mirror_guide_position_cb (GObject *object,
@@ -86,6 +88,7 @@ static void gimp_mirror_guide_position_cb (GObject *object,
GimpMirror *mirror);
static GParamSpec ** gimp_mirror_get_settings (GimpSymmetry *sym,
gint *n_settings);
+static void gimp_mirror_active_changed (GimpSymmetry *sym);
static void gimp_mirror_set_horizontal_symmetry (GimpMirror *mirror,
gboolean active);
static void gimp_mirror_set_vertical_symmetry (GimpMirror *mirror,
@@ -111,6 +114,7 @@ gimp_mirror_class_init (GimpMirrorClass *klass)
symmetry_class->update_strokes = gimp_mirror_update_strokes;
symmetry_class->get_operation = gimp_mirror_get_operation;
symmetry_class->get_settings = gimp_mirror_get_settings;
+ symmetry_class->active_changed = gimp_mirror_active_changed;
/* Properties for user settings */
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_HORIZONTAL_SYMMETRY,
@@ -393,18 +397,28 @@ gimp_mirror_reset (GimpMirror *mirror)
}
}
-static GimpGuide *
-gimp_mirror_create_guide (GimpImage *image,
- GimpOrientationType orientation)
+static void
+gimp_mirror_add_guide (GimpMirror *mirror,
+ GimpOrientationType orientation)
{
static const GimpRGB normal_fg = { 1.0, 1.0, 1.0, 1.0 };
static const GimpRGB normal_bg = { 0.0, 1.0, 0.0, 1.0 };
static const GimpRGB active_fg = { 0.0, 1.0, 0.0, 1.0 };
static const GimpRGB active_bg = { 1.0, 0.0, 0.0, 1.0 };
- Gimp *gimp = GIMP (image->gimp);
+ GimpSymmetry *sym;
+ GimpImage *image;
+ Gimp *gimp;
GimpGuide *guide;
cairo_pattern_t *normal_style;
cairo_pattern_t *active_style;
+ gint position;
+
+
+ g_return_if_fail (GIMP_IS_MIRROR (mirror));
+
+ sym = GIMP_SYMMETRY (mirror);
+ image = sym->image;
+ gimp = GIMP (image->gimp);
normal_style = gimp_cairo_stipple_pattern_create (&normal_fg,
&normal_bg,
@@ -416,7 +430,65 @@ gimp_mirror_create_guide (GimpImage *image,
guide = gimp_guide_custom_new (orientation,
gimp->next_guide_ID++,
normal_style, active_style, 1.0);
- return guide;
+
+ if (orientation == GIMP_ORIENTATION_HORIZONTAL)
+ {
+ mirror->horizontal_guide = guide;
+
+ /* Mirror guide position at first activation is at canvas middle. */
+ if (mirror->horizontal_position < 1.0)
+ mirror->horizontal_position = (gdouble) gimp_image_get_height (image) / 2.0;
+ position = (gint) mirror->horizontal_position;
+ }
+ else
+ {
+ mirror->vertical_guide = guide;
+
+ /* Mirror guide position at first activation is at canvas middle. */
+ if (mirror->vertical_position < 1.0)
+ mirror->vertical_position = (gdouble) gimp_image_get_width (image) / 2.0;
+ position = (gint) mirror->vertical_position;
+ }
+ g_signal_connect (G_OBJECT (guide), "removed",
+ G_CALLBACK (gimp_mirror_guide_removed_cb),
+ mirror);
+
+ gimp_image_add_guide (image, guide,
+ (gint) position);
+
+ g_signal_connect (G_OBJECT (guide), "notify::position",
+ G_CALLBACK (gimp_mirror_guide_position_cb),
+ mirror);
+}
+
+static void
+gimp_mirror_remove_guide (GimpMirror *mirror,
+ GimpOrientationType orientation)
+{
+ GimpSymmetry *sym;
+ GimpImage *image;
+ GimpGuide *guide;
+
+ g_return_if_fail (GIMP_IS_MIRROR (mirror));
+
+ sym = GIMP_SYMMETRY (mirror);
+ image = sym->image;
+ guide = (orientation == GIMP_ORIENTATION_HORIZONTAL) ?
+ mirror->horizontal_guide : mirror->vertical_guide;
+
+ g_signal_handlers_disconnect_by_func (G_OBJECT (guide),
+ gimp_mirror_guide_removed_cb,
+ mirror);
+ g_signal_handlers_disconnect_by_func (G_OBJECT (guide),
+ gimp_mirror_guide_position_cb,
+ mirror);
+ gimp_image_remove_guide (image, guide, FALSE);
+ g_object_unref (guide);
+
+ if (orientation == GIMP_ORIENTATION_HORIZONTAL)
+ mirror->horizontal_guide = NULL;
+ else
+ mirror->vertical_guide = NULL;
}
static void
@@ -506,58 +578,46 @@ gimp_mirror_get_settings (GimpSymmetry *sym,
}
static void
+gimp_mirror_active_changed (GimpSymmetry *sym)
+{
+ GimpMirror *mirror = GIMP_MIRROR (sym);
+
+ if (sym->active)
+ {
+ if ((mirror->horizontal_mirror || mirror->point_symmetry) &&
+ ! mirror->horizontal_guide)
+ gimp_mirror_add_guide (mirror, GIMP_ORIENTATION_HORIZONTAL);
+ if ((mirror->vertical_mirror || mirror->point_symmetry) &&
+ ! mirror->vertical_guide)
+ gimp_mirror_add_guide (mirror, GIMP_ORIENTATION_VERTICAL);
+ }
+ else
+ {
+ if (mirror->horizontal_guide)
+ gimp_mirror_remove_guide (mirror, GIMP_ORIENTATION_HORIZONTAL);
+ if (mirror->vertical_guide)
+ gimp_mirror_remove_guide (mirror, GIMP_ORIENTATION_VERTICAL);
+ }
+}
+
+static void
gimp_mirror_set_horizontal_symmetry (GimpMirror *mirror,
gboolean active)
{
- GimpSymmetry *sym;
- GimpImage *image;
-
g_return_if_fail (GIMP_IS_MIRROR (mirror));
- sym = GIMP_SYMMETRY (mirror);
- image = sym->image;
-
if (active == mirror->horizontal_mirror)
return;
mirror->horizontal_mirror = active;
- if (active && ! mirror->horizontal_guide)
- {
- /* Create a new mirror guide. */
- GimpGuide *guide;
-
- guide = gimp_mirror_create_guide (image,
- GIMP_ORIENTATION_HORIZONTAL);
- mirror->horizontal_guide = guide;
-
- g_signal_connect (G_OBJECT (mirror->horizontal_guide), "removed",
- G_CALLBACK (gimp_mirror_guide_removed_cb),
- mirror);
-
- /* Mirror guide position at first activation is at canvas middle. */
- if (mirror->horizontal_position < 1.0)
- mirror->horizontal_position = (gdouble) gimp_image_get_height (image) / 2.0;
- gimp_image_add_guide (image, mirror->horizontal_guide,
- (gint) mirror->horizontal_position);
-
- g_signal_connect (G_OBJECT (mirror->horizontal_guide), "notify::position",
- G_CALLBACK (gimp_mirror_guide_position_cb),
- mirror);
- }
- else if (! active && ! mirror->point_symmetry)
+ if (active)
{
- g_signal_handlers_disconnect_by_func (G_OBJECT (mirror->horizontal_guide),
- gimp_mirror_guide_removed_cb,
- mirror);
- g_signal_handlers_disconnect_by_func (G_OBJECT (mirror->horizontal_guide),
- gimp_mirror_guide_position_cb,
- mirror);
- gimp_image_remove_guide (image, GIMP_GUIDE (mirror->horizontal_guide),
- FALSE);
- g_object_unref (mirror->horizontal_guide);
- mirror->horizontal_guide = NULL;
+ if (! mirror->horizontal_guide)
+ gimp_mirror_add_guide (mirror, GIMP_ORIENTATION_HORIZONTAL);
}
+ else if (! mirror->point_symmetry)
+ gimp_mirror_remove_guide (mirror, GIMP_ORIENTATION_HORIZONTAL);
gimp_mirror_reset (mirror);
}
@@ -566,14 +626,8 @@ static void
gimp_mirror_set_vertical_symmetry (GimpMirror *mirror,
gboolean active)
{
- GimpSymmetry *sym;
- GimpImage *image;
-
g_return_if_fail (GIMP_IS_MIRROR (mirror));
- sym = GIMP_SYMMETRY (mirror);
- image = sym->image;
-
if (active == mirror->vertical_mirror)
return;
@@ -582,43 +636,10 @@ gimp_mirror_set_vertical_symmetry (GimpMirror *mirror,
if (active)
{
if (! mirror->vertical_guide)
- {
- /* Create a new mirror guide. */
- GimpGuide *guide;
-
- guide = gimp_mirror_create_guide (image,
- GIMP_ORIENTATION_VERTICAL);
-
- mirror->vertical_guide = guide;
-
- g_signal_connect (G_OBJECT (mirror->vertical_guide), "removed",
- G_CALLBACK (gimp_mirror_guide_removed_cb),
- mirror);
-
- /* Mirror guide position at first activation is at canvas middle. */
- if (mirror->vertical_position < 1.0)
- mirror->vertical_position = (gdouble) gimp_image_get_width (image) / 2.0;
- gimp_image_add_guide (image, mirror->vertical_guide,
- (gint) mirror->vertical_position);
-
- g_signal_connect (G_OBJECT (mirror->vertical_guide), "notify::position",
- G_CALLBACK (gimp_mirror_guide_position_cb),
- mirror);
- }
+ gimp_mirror_add_guide (mirror, GIMP_ORIENTATION_VERTICAL);
}
else if (! mirror->point_symmetry)
- {
- g_signal_handlers_disconnect_by_func (G_OBJECT (mirror->vertical_guide),
- gimp_mirror_guide_removed_cb,
- mirror);
- g_signal_handlers_disconnect_by_func (G_OBJECT (mirror->vertical_guide),
- gimp_mirror_guide_position_cb,
- mirror);
- gimp_image_remove_guide (image, GIMP_GUIDE (mirror->vertical_guide),
- FALSE);
- g_object_unref (mirror->vertical_guide);
- mirror->vertical_guide = NULL;
- }
+ gimp_mirror_remove_guide (mirror, GIMP_ORIENTATION_VERTICAL);
gimp_mirror_reset (mirror);
}
@@ -627,14 +648,8 @@ static void
gimp_mirror_set_point_symmetry (GimpMirror *mirror,
gboolean active)
{
- GimpSymmetry *sym;
- GimpImage *image;
-
g_return_if_fail (GIMP_IS_MIRROR (mirror));
- sym = GIMP_SYMMETRY (mirror);
- image = sym->image;
-
if (active == mirror->point_symmetry)
return;
@@ -643,91 +658,21 @@ gimp_mirror_set_point_symmetry (GimpMirror *mirror,
if (active)
{
/* Show the horizontal guide unless already shown */
- if (! mirror->horizontal_mirror)
- {
- if (! mirror->horizontal_guide)
- {
- /* Create a new mirror guide. */
- GimpGuide *guide;
-
- guide = gimp_mirror_create_guide (image,
- GIMP_ORIENTATION_HORIZONTAL);
- mirror->horizontal_guide = guide;
-
- g_signal_connect (G_OBJECT (mirror->horizontal_guide), "removed",
- G_CALLBACK (gimp_mirror_guide_removed_cb),
- mirror);
-
- /* Mirror guide position at first activation is at canvas middle. */
- if (mirror->horizontal_position < 1.0)
- mirror->horizontal_position = (gdouble) gimp_image_get_height (image) / 2.0;
- gimp_image_add_guide (image, mirror->horizontal_guide,
- (gint) mirror->horizontal_position);
-
- g_signal_connect (G_OBJECT (mirror->horizontal_guide), "notify::position",
- G_CALLBACK (gimp_mirror_guide_position_cb),
- mirror);
- }
- }
+ if (! mirror->horizontal_guide)
+ gimp_mirror_add_guide (mirror, GIMP_ORIENTATION_HORIZONTAL);
/* Show the vertical guide unless already shown */
- if (! mirror->vertical_mirror)
- {
- if (! mirror->vertical_guide)
- {
- /* Create a new mirror guide. */
- GimpGuide *guide;
-
- guide = gimp_mirror_create_guide (image,
- GIMP_ORIENTATION_VERTICAL);
- mirror->vertical_guide = guide;
-
- g_signal_connect (G_OBJECT (mirror->vertical_guide), "removed",
- G_CALLBACK (gimp_mirror_guide_removed_cb),
- mirror);
-
- /* Mirror guide position at first activation is at canvas middle. */
- if (mirror->vertical_position < 1.0)
- mirror->vertical_position = (gdouble) gimp_image_get_width (image) / 2.0;
- gimp_image_add_guide (image, mirror->vertical_guide,
- (gint) mirror->vertical_position);
-
- g_signal_connect (G_OBJECT (mirror->vertical_guide), "notify::position",
- G_CALLBACK (gimp_mirror_guide_position_cb),
- mirror);
- }
- }
+ if (! mirror->vertical_guide)
+ gimp_mirror_add_guide (mirror, GIMP_ORIENTATION_VERTICAL);
}
else
{
- /* Hide the horizontal guide unless needed by horizontal mirror */
+ /* Remove the horizontal guide unless needed by horizontal mirror */
if (! mirror->horizontal_mirror)
- {
- g_signal_handlers_disconnect_by_func (G_OBJECT (mirror->horizontal_guide),
- gimp_mirror_guide_removed_cb,
- mirror);
- g_signal_handlers_disconnect_by_func (G_OBJECT (mirror->horizontal_guide),
- gimp_mirror_guide_position_cb,
- mirror);
- gimp_image_remove_guide (image, GIMP_GUIDE (mirror->horizontal_guide),
- FALSE);
- g_object_unref (mirror->horizontal_guide);
- mirror->horizontal_guide = NULL;
- }
- /* Hide the vertical guide unless needed by vertical mirror */
+ gimp_mirror_remove_guide (mirror, GIMP_ORIENTATION_HORIZONTAL);
+ /* Remove the vertical guide unless needed by vertical mirror */
if (! mirror->vertical_mirror)
- {
- g_signal_handlers_disconnect_by_func (G_OBJECT (mirror->vertical_guide),
- gimp_mirror_guide_removed_cb,
- mirror);
- g_signal_handlers_disconnect_by_func (G_OBJECT (mirror->vertical_guide),
- gimp_mirror_guide_position_cb,
- mirror);
- gimp_image_remove_guide (image, GIMP_GUIDE (mirror->vertical_guide),
- FALSE);
- g_object_unref (mirror->vertical_guide);
- mirror->vertical_guide = NULL;
- }
+ gimp_mirror_remove_guide (mirror, GIMP_ORIENTATION_VERTICAL);
}
gimp_mirror_reset (mirror);
diff --git a/app/core/gimpsymmetry.c b/app/core/gimpsymmetry.c
index 3664aae..bc6fa45 100644
--- a/app/core/gimpsymmetry.c
+++ b/app/core/gimpsymmetry.c
@@ -42,6 +42,7 @@ enum
{
STROKES_UPDATED,
UPDATE_UI,
+ ACTIVE_CHANGED,
LAST_SIGNAL
};
@@ -49,6 +50,7 @@ enum
{
PROP_0,
PROP_IMAGE,
+ PROP_ACTIVE,
};
/* Local function prototypes */
@@ -113,6 +115,14 @@ gimp_symmetry_class_init (GimpSymmetryClass *klass)
G_TYPE_NONE,
1, GIMP_TYPE_IMAGE);
+ gimp_symmetry_signals[ACTIVE_CHANGED] =
+ g_signal_new ("active-changed",
+ G_TYPE_FROM_CLASS (klass),
+ G_SIGNAL_RUN_FIRST,
+ G_STRUCT_OFFSET (GimpSymmetryClass, active_changed),
+ NULL, NULL,
+ NULL,
+ G_TYPE_NONE, 0);
object_class->finalize = gimp_symmetry_finalize;
object_class->set_property = gimp_symmetry_set_property;
@@ -122,6 +132,7 @@ gimp_symmetry_class_init (GimpSymmetryClass *klass)
klass->update_strokes = gimp_symmetry_real_update_strokes;
klass->get_operation = gimp_symmetry_real_get_op;
klass->get_settings = gimp_symmetry_real_get_settings;
+ klass->active_changed = NULL;
g_object_class_install_property (object_class, PROP_IMAGE,
g_param_spec_object ("image",
@@ -129,6 +140,11 @@ gimp_symmetry_class_init (GimpSymmetryClass *klass)
GIMP_TYPE_IMAGE,
GIMP_PARAM_READWRITE |
G_PARAM_CONSTRUCT_ONLY));
+ GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_ACTIVE,
+ "active",
+ _("Activate symmetry painting"),
+ FALSE,
+ GIMP_PARAM_STATIC_STRINGS);
}
@@ -168,6 +184,11 @@ gimp_symmetry_set_property (GObject *object,
case PROP_IMAGE:
sym->image = g_value_get_object (value);
break;
+ case PROP_ACTIVE:
+ sym->active = g_value_get_boolean (value);
+ g_signal_emit (sym, gimp_symmetry_signals[ACTIVE_CHANGED], 0,
+ sym->active);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
@@ -187,6 +208,9 @@ gimp_symmetry_get_property (GObject *object,
case PROP_IMAGE:
g_value_set_object (value, sym->image);
break;
+ case PROP_ACTIVE:
+ g_value_set_boolean (value, sym->active);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
diff --git a/app/core/gimpsymmetry.h b/app/core/gimpsymmetry.h
index ed966ef..f7b3b9e 100644
--- a/app/core/gimpsymmetry.h
+++ b/app/core/gimpsymmetry.h
@@ -41,6 +41,7 @@ struct _GimpSymmetry
GimpImage *image;
GimpDrawable *drawable;
GimpCoords *origin;
+ gboolean active;
GList *strokes;
@@ -64,6 +65,7 @@ struct _GimpSymmetryClass
GParamSpec **
(* get_settings) (GimpSymmetry *sym,
gint *n_properties);
+ void (* active_changed) (GimpSymmetry *sym);
};
diff --git a/app/paint/gimppaintoptions.c b/app/paint/gimppaintoptions.c
index 8568aac..2ad23e9 100644
--- a/app/paint/gimppaintoptions.c
+++ b/app/paint/gimppaintoptions.c
@@ -573,6 +573,7 @@ gimp_paint_options_set_property (GObject *object,
sym = gimp_image_symmetry_new (context->image,
options->symmetry);
gimp_image_symmetry_add (context->image, sym);
+ gimp_image_symmetry_select (context->image, options->symmetry);
}
}
else
@@ -1111,8 +1112,8 @@ gimp_paint_options_copy_gradient_props (GimpPaintOptions *src,
* depends on the current context image.
*/
void
-gimp_paint_options_set_mstroke_props (GimpPaintOptions *src,
- GimpPaintOptions *dest)
+gimp_paint_options_set_symmetry_props (GimpPaintOptions *src,
+ GimpPaintOptions *dest)
{
GimpContext *context;
GimpImage *image;
@@ -1125,13 +1126,13 @@ gimp_paint_options_set_mstroke_props (GimpPaintOptions *src,
if (image)
{
- GimpSymmetry *mstroke;
+ GimpSymmetry *sym;
- mstroke = gimp_image_symmetry_selected (image);
+ sym = gimp_image_symmetry_selected (image);
g_object_set (dest,
"symmetry",
- mstroke ? mstroke->type : G_TYPE_NONE,
+ sym ? sym->type : G_TYPE_NONE,
NULL);
}
}
diff --git a/app/paint/gimppaintoptions.h b/app/paint/gimppaintoptions.h
index 3a27c6c..f6f22a6 100644
--- a/app/paint/gimppaintoptions.h
+++ b/app/paint/gimppaintoptions.h
@@ -165,7 +165,7 @@ void gimp_paint_options_copy_dynamics_props (GimpPaintOptions *src,
void gimp_paint_options_copy_gradient_props (GimpPaintOptions *src,
GimpPaintOptions *dest);
-void gimp_paint_options_set_mstroke_props (GimpPaintOptions *src,
- GimpPaintOptions *dest);
+void gimp_paint_options_set_symmetry_props (GimpPaintOptions *src,
+ GimpPaintOptions *dest);
#endif /* __GIMP_PAINT_OPTIONS_H__ */
diff --git a/app/tools/gimppaintoptions-gui.c b/app/tools/gimppaintoptions-gui.c
index 67aa3ef..da7dd18 100644
--- a/app/tools/gimppaintoptions-gui.c
+++ b/app/tools/gimppaintoptions-gui.c
@@ -269,7 +269,7 @@ gimp_paint_options_gui (GimpToolOptions *tool_options)
for (syms = gimp_image_symmetry_list (); syms; syms = g_list_next (syms))
{
GimpSymmetryClass *klass;
- GType type;
+ GType type;
type = (GType) syms->data;
klass = g_type_class_ref (type);
diff --git a/app/tools/tool_manager.c b/app/tools/tool_manager.c
index e018bdf..e231511 100644
--- a/app/tools/tool_manager.c
+++ b/app/tools/tool_manager.c
@@ -775,8 +775,8 @@ tool_manager_preset_changed (GimpContext *user_context,
gimp_paint_options_copy_gradient_props (GIMP_PAINT_OPTIONS (src),
GIMP_PAINT_OPTIONS (dest));
- gimp_paint_options_set_mstroke_props (GIMP_PAINT_OPTIONS (src),
- GIMP_PAINT_OPTIONS (dest));
+ gimp_paint_options_set_symmetry_props (GIMP_PAINT_OPTIONS (src),
+ GIMP_PAINT_OPTIONS (dest));
}
}
@@ -846,8 +846,8 @@ tool_manager_connect_options (GimpToolManager *tool_manager,
gimp_paint_options_copy_gradient_props (tool_manager->shared_paint_options,
GIMP_PAINT_OPTIONS (tool_info->tool_options));
- gimp_paint_options_set_mstroke_props (tool_manager->shared_paint_options,
- GIMP_PAINT_OPTIONS (tool_info->tool_options));
+ gimp_paint_options_set_symmetry_props (tool_manager->shared_paint_options,
+ GIMP_PAINT_OPTIONS (tool_info->tool_options));
}
}
}
@@ -873,8 +873,8 @@ tool_manager_disconnect_options (GimpToolManager *tool_manager,
gimp_paint_options_copy_gradient_props (GIMP_PAINT_OPTIONS (tool_info->tool_options),
tool_manager->shared_paint_options);
- gimp_paint_options_set_mstroke_props (GIMP_PAINT_OPTIONS (tool_info->tool_options),
- tool_manager->shared_paint_options);
+ gimp_paint_options_set_symmetry_props (GIMP_PAINT_OPTIONS (tool_info->tool_options),
+ tool_manager->shared_paint_options);
}
gimp_context_set_parent (GIMP_CONTEXT (tool_info->tool_options), NULL);
diff --git a/app/xcf/xcf-load.c b/app/xcf/xcf-load.c
index 49148d6..798c2f9 100644
--- a/app/xcf/xcf-load.c
+++ b/app/xcf/xcf-load.c
@@ -294,19 +294,13 @@ xcf_load_image (Gimp *gimp,
gimp_parasite_name (parasite));
gimp_image_symmetry_add (image, sym);
+
+ g_signal_emit_by_name (sym, "active-changed", NULL);
+ if (sym->active)
+ gimp_image_symmetry_select (image, type);
}
}
}
- parasite = gimp_image_parasite_find (image, "gimp-image-symmetry-selected");
- if (parasite)
- {
- const gchar *str;
-
- str = gimp_parasite_data (parasite);
- if (! gimp_image_symmetry_select (image, g_type_from_name (str)))
- g_warning ("%s: no symmetry of type %s",
- G_STRFUNC, str);
- }
/* migrate the old "exif-data" parasite */
diff --git a/app/xcf/xcf-save.c b/app/xcf/xcf-save.c
index 4a689b6..a1ae467 100644
--- a/app/xcf/xcf-save.c
+++ b/app/xcf/xcf-save.c
@@ -426,19 +426,6 @@ xcf_save_image_props (XcfInfo *info,
gimp_parasite_list_add (private->parasites, parasite);
symmetry_parasites = g_list_prepend (symmetry_parasites, parasite);
}
- if (gimp_image_symmetry_selected (image))
- {
- const gchar *name;
-
- name = g_type_name (gimp_image_symmetry_selected (image)->type);
-
- parasite = gimp_parasite_new ("gimp-image-symmetry-selected",
- GIMP_PARASITE_PERSISTENT,
- strlen (name) + 1,
- name);
- gimp_parasite_list_add (private->parasites, parasite);
- symmetry_parasites = g_list_prepend (symmetry_parasites, parasite);
- }
}
if (gimp_parasite_list_length (private->parasites) > 0)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]