[gimp] app: some cleanup in the new symmetry code, mostly harmless
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: some cleanup in the new symmetry code, mostly harmless
- Date: Wed, 3 Feb 2016 13:29:56 +0000 (UTC)
commit 3415d22e588d5923e0202d592be2f64ef7eacfe8
Author: Michael Natterer <mitch gimp org>
Date: Wed Feb 3 14:29:23 2016 +0100
app: some cleanup in the new symmetry code, mostly harmless
app/actions/dialogs-actions.c | 2 +-
app/core/Makefile.am | 16 +++---
app/core/core-types.h | 1 +
app/core/gimpbrush.c | 50 +++++++++--------
app/core/gimpbrushcache.c | 59 +++++++++-----------
app/core/gimpguide.c | 1 +
app/core/gimpguide.h | 1 +
app/core/gimpimage-symmetry.c | 15 +++---
app/core/gimpimage-symmetry.h | 2 +
app/core/gimpimage.c | 6 +-
app/core/gimpsymmetry-mandala.c | 65 ++++++++++-------------
app/core/gimpsymmetry-mandala.h | 5 ++-
app/core/gimpsymmetry-mirror.c | 88 ++++++++++++-------------------
app/core/gimpsymmetry-mirror.h | 4 +-
app/core/gimpsymmetry-tiling.c | 19 +++----
app/core/gimpsymmetry-tiling.h | 5 ++-
app/core/gimpsymmetry.c | 27 +++++-----
app/core/gimpsymmetry.h | 5 ++-
app/display/display-enums.c | 62 +++++++++++-----------
app/display/display-enums.h | 22 ++++----
app/tools/gimpblendtool.c | 4 +-
app/widgets/gimpsymmetryeditor.c | 109 ++++++++++++++++++--------------------
app/widgets/gimpsymmetryeditor.h | 8 ++--
23 files changed, 279 insertions(+), 297 deletions(-)
---
diff --git a/app/actions/dialogs-actions.c b/app/actions/dialogs-actions.c
index 4d197c1..198a1fd 100644
--- a/app/actions/dialogs-actions.c
+++ b/app/actions/dialogs-actions.c
@@ -62,7 +62,7 @@ const GimpStringActionEntry dialogs_dockable_actions[] =
GIMP_HELP_DEVICE_STATUS_DIALOG },
{ "dialogs-symmetry", GIMP_STOCK_SYMMETRY,
- NC_("dialogs-action", "_Symmetry painting"), NULL,
+ NC_("dialogs-action", "_Symmetry Painting"), NULL,
NC_("dialogs-action", "Open the symmetry dialog"),
"gimp-symmetry-editor",
GIMP_HELP_SYMMETRY_DIALOG },
diff --git a/app/core/Makefile.am b/app/core/Makefile.am
index 2e8ad3f..7b8b413 100644
--- a/app/core/Makefile.am
+++ b/app/core/Makefile.am
@@ -369,14 +369,14 @@ libappcore_a_sources = \
gimpstrokeoptions.h \
gimpsubprogress.c \
gimpsubprogress.h \
- gimpsymmetry.c \
- gimpsymmetry.h \
- gimpsymmetry-mandala.c \
- gimpsymmetry-mandala.h \
- gimpsymmetry-mirror.c \
- gimpsymmetry-mirror.h \
- gimpsymmetry-tiling.c \
- gimpsymmetry-tiling.h \
+ gimpsymmetry.c \
+ gimpsymmetry.h \
+ gimpsymmetry-mandala.c \
+ gimpsymmetry-mandala.h \
+ gimpsymmetry-mirror.c \
+ gimpsymmetry-mirror.h \
+ gimpsymmetry-tiling.c \
+ gimpsymmetry-tiling.h \
gimptag.c \
gimptag.h \
gimptagcache.c \
diff --git a/app/core/core-types.h b/app/core/core-types.h
index 9b1e704..6e92e23 100644
--- a/app/core/core-types.h
+++ b/app/core/core-types.h
@@ -182,6 +182,7 @@ typedef struct _GimpMirror GimpMirror;
typedef struct _GimpTiling GimpTiling;
typedef struct _GimpMandala GimpMandala;
+
/* misc objects */
typedef struct _GimpBuffer GimpBuffer;
diff --git a/app/core/gimpbrush.c b/app/core/gimpbrush.c
index c8d987c..f1e6b9d 100644
--- a/app/core/gimpbrush.c
+++ b/app/core/gimpbrush.c
@@ -652,19 +652,19 @@ gimp_brush_transform_mask (GimpBrush *brush,
if (op)
{
- GeglNode *graph, *source, *target;
- GeglBuffer *buffer = gimp_temp_buf_create_buffer ((GimpTempBuf *) mask);
-
- graph = gegl_node_new ();
- source = gegl_node_new_child (graph,
- "operation", "gegl:buffer-source",
- "buffer", buffer,
- NULL);
+ GeglNode *graph, *source, *target;
+ GeglBuffer *buffer = gimp_temp_buf_create_buffer ((GimpTempBuf *) mask);
+
+ graph = gegl_node_new ();
+ source = gegl_node_new_child (graph,
+ "operation", "gegl:buffer-source",
+ "buffer", buffer,
+ NULL);
gegl_node_add_child (graph, op);
- target = gegl_node_new_child (graph,
- "operation", "gegl:write-buffer",
- "buffer", buffer,
- NULL);
+ target = gegl_node_new_child (graph,
+ "operation", "gegl:write-buffer",
+ "buffer", buffer,
+ NULL);
gegl_node_link_many (source, op, target, NULL);
gegl_node_process (target);
@@ -672,6 +672,7 @@ gimp_brush_transform_mask (GimpBrush *brush,
g_object_unref (graph);
g_object_unref (buffer);
}
+
gimp_brush_cache_add (brush->priv->mask_cache,
(gpointer) mask,
op, width, height,
@@ -725,19 +726,19 @@ gimp_brush_transform_pixmap (GimpBrush *brush,
if (op)
{
- GeglNode *graph, *source, *target;
- GeglBuffer *buffer = gimp_temp_buf_create_buffer ((GimpTempBuf *) pixmap);
-
- graph = gegl_node_new ();
- source = gegl_node_new_child (graph,
- "operation", "gegl:buffer-source",
- "buffer", buffer,
- NULL);
+ GeglNode *graph, *source, *target;
+ GeglBuffer *buffer = gimp_temp_buf_create_buffer ((GimpTempBuf *) pixmap);
+
+ graph = gegl_node_new ();
+ source = gegl_node_new_child (graph,
+ "operation", "gegl:buffer-source",
+ "buffer", buffer,
+ NULL);
gegl_node_add_child (graph, op);
- target = gegl_node_new_child (graph,
- "operation", "gegl:write-buffer",
- "buffer", buffer,
- NULL);
+ target = gegl_node_new_child (graph,
+ "operation", "gegl:write-buffer",
+ "buffer", buffer,
+ NULL);
gegl_node_link_many (source, op, target, NULL);
gegl_node_process (target);
@@ -745,6 +746,7 @@ gimp_brush_transform_pixmap (GimpBrush *brush,
g_object_unref (graph);
g_object_unref (buffer);
}
+
gimp_brush_cache_add (brush->priv->pixmap_cache,
(gpointer) pixmap,
op, width, height,
diff --git a/app/core/gimpbrushcache.c b/app/core/gimpbrushcache.c
index 11c74b8..99aab4d 100644
--- a/app/core/gimpbrushcache.c
+++ b/app/core/gimpbrushcache.c
@@ -29,29 +29,33 @@
#include "gimp-log.h"
#include "gimp-intl.h"
+
#define MAX_CACHED_DATA 20
+
enum
{
PROP_0,
PROP_DATA_DESTROY
};
+
typedef struct _GimpBrushCacheUnit GimpBrushCacheUnit;
struct _GimpBrushCacheUnit
{
- gpointer data;
-
- gint width;
- gint height;
- gdouble scale;
- gdouble aspect_ratio;
- gdouble angle;
- gdouble hardness;
- GeglNode *op;
+ gpointer data;
+
+ gint width;
+ gint height;
+ gdouble scale;
+ gdouble aspect_ratio;
+ gdouble angle;
+ gdouble hardness;
+ GeglNode *op;
};
+
static void gimp_brush_cache_constructed (GObject *object);
static void gimp_brush_cache_finalize (GObject *object);
static void gimp_brush_cache_set_property (GObject *object,
@@ -106,19 +110,7 @@ gimp_brush_cache_finalize (GObject *object)
{
GimpBrushCache *cache = GIMP_BRUSH_CACHE (object);
- if (cache->cached_units)
- {
- GList *iter;
-
- for (iter = cache->cached_units; iter; iter = g_list_next (iter))
- {
- GimpBrushCacheUnit *unit = iter->data;
-
- cache->data_destroy (unit->data);
- }
- g_list_free_full (cache->cached_units, g_free);
- cache->cached_units = NULL;
- }
+ gimp_brush_cache_clear (cache);
G_OBJECT_CLASS (parent_class)->finalize (object);
}
@@ -200,6 +192,7 @@ gimp_brush_cache_clear (GimpBrushCache *cache)
cache->data_destroy (unit->data);
}
+
g_list_free_full (cache->cached_units, g_free);
cache->cached_units = NULL;
}
@@ -241,6 +234,7 @@ gimp_brush_cache_get (GimpBrushCache *cache,
if (cache->cached_units)
cache->cached_units->prev = iter;
cache->cached_units = iter;
+
return (gconstpointer) unit->data;
}
}
@@ -262,7 +256,7 @@ gimp_brush_cache_add (GimpBrushCache *cache,
gdouble angle,
gdouble hardness)
{
- GList *iter;
+ GList *iter;
GimpBrushCacheUnit *unit;
g_return_if_fail (GIMP_IS_BRUSH_CACHE (cache));
@@ -271,6 +265,7 @@ gimp_brush_cache_add (GimpBrushCache *cache,
for (iter = cache->cached_units; iter; iter = g_list_next (iter))
{
unit = iter->data;
+
if (data == unit->data)
return;
}
@@ -284,16 +279,16 @@ gimp_brush_cache_add (GimpBrushCache *cache,
cache->cached_units = g_list_delete_link (cache->cached_units, iter);
}
- unit = g_new (GimpBrushCacheUnit, 1);
+ unit = g_new0 (GimpBrushCacheUnit, 1);
- unit->data = data;
- unit->width = width;
- unit->height = height;
- unit->scale = scale;
- unit->aspect_ratio = aspect_ratio;
- unit->angle = angle;
- unit->hardness = hardness;
- unit->op = op;
+ unit->data = data;
+ unit->width = width;
+ unit->height = height;
+ unit->scale = scale;
+ unit->aspect_ratio = aspect_ratio;
+ unit->angle = angle;
+ unit->hardness = hardness;
+ unit->op = op;
cache->cached_units = g_list_prepend (cache->cached_units, unit);
}
diff --git a/app/core/gimpguide.c b/app/core/gimpguide.c
index aca4da8..b9e93d9 100644
--- a/app/core/gimpguide.c
+++ b/app/core/gimpguide.c
@@ -34,6 +34,7 @@
#include "gimpguide.h"
#include "gimpmarshal.h"
+
enum
{
REMOVED,
diff --git a/app/core/gimpguide.h b/app/core/gimpguide.h
index ade9f57..010ac9e 100644
--- a/app/core/gimpguide.h
+++ b/app/core/gimpguide.h
@@ -87,4 +87,5 @@ void gimp_guide_get_active_style (GimpGuide *guide,
gdouble gimp_guide_get_line_width (GimpGuide *guide);
gboolean gimp_guide_is_custom (GimpGuide *guide);
+
#endif /* __GIMP_GUIDE_H__ */
diff --git a/app/core/gimpimage-symmetry.c b/app/core/gimpimage-symmetry.c
index b6c6dff..53b3f82 100644
--- a/app/core/gimpimage-symmetry.c
+++ b/app/core/gimpimage-symmetry.c
@@ -33,6 +33,7 @@
#include "gimpsymmetry-mirror.h"
#include "gimpsymmetry-tiling.h"
+
/**
* gimp_image_symmetry_list:
*
@@ -46,6 +47,7 @@ gimp_image_symmetry_list (void)
list = g_list_prepend (list, GINT_TO_POINTER (GIMP_TYPE_MIRROR));
list = g_list_prepend (list, GINT_TO_POINTER (GIMP_TYPE_TILING));
list = g_list_prepend (list, GINT_TO_POINTER (GIMP_TYPE_MANDALA));
+
return list;
}
@@ -66,15 +68,13 @@ gimp_image_symmetry_new (GimpImage *image,
GType type)
{
GimpSymmetry *sym = NULL;
+
g_return_val_if_fail (g_type_is_a (type, GIMP_TYPE_SYMMETRY), NULL);
- if (type != G_TYPE_NONE)
- {
- sym = g_object_new (type,
- "image", image,
- NULL);
- sym->type = type;
- }
+ sym = g_object_new (type,
+ "image", image,
+ NULL);
+ sym->type = type;
return sym;
}
@@ -123,6 +123,7 @@ gimp_image_symmetry_remove (GimpImage *image,
if (private->selected_symmetry == sym)
gimp_image_symmetry_select (image, G_TYPE_NONE);
+
private->symmetries = g_list_remove (private->symmetries,
sym);
g_object_unref (sym);
diff --git a/app/core/gimpimage-symmetry.h b/app/core/gimpimage-symmetry.h
index 109bd53..60b1f38 100644
--- a/app/core/gimpimage-symmetry.h
+++ b/app/core/gimpimage-symmetry.h
@@ -21,6 +21,7 @@
#ifndef __GIMP_IMAGE_SYMMETRY_H__
#define __GIMP_IMAGE_SYMMETRY_H__
+
GList * gimp_image_symmetry_list (void);
GimpSymmetry * gimp_image_symmetry_new (GimpImage *image,
@@ -35,4 +36,5 @@ gboolean gimp_image_symmetry_select (GimpImage *image,
GType type);
GimpSymmetry * gimp_image_symmetry_selected (GimpImage *image);
+
#endif /* __GIMP_IMAGE_SYMMETRY_H__ */
diff --git a/app/core/gimpimage.c b/app/core/gimpimage.c
index 6e762ec..7755e01 100644
--- a/app/core/gimpimage.c
+++ b/app/core/gimpimage.c
@@ -633,6 +633,7 @@ gimp_image_class_init (GimpImageClass *klass)
GIMP_TYPE_SYMMETRY,
GIMP_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
+
g_type_class_add_private (klass, sizeof (GimpImagePrivate));
}
@@ -883,7 +884,6 @@ gimp_image_set_property (GObject *object,
NULL);
private->selected_symmetry = NULL;
-
for (iter = private->symmetries; iter; iter = g_list_next (iter))
{
GimpSymmetry *sym = iter->data;
@@ -893,12 +893,12 @@ gimp_image_set_property (GObject *object,
if (private->selected_symmetry == NULL)
{
- GimpSymmetry *sym;
+ GimpSymmetry *sym = gimp_image_symmetry_new (image, type);
- sym = gimp_image_symmetry_new (image, type);
gimp_image_symmetry_add (image, sym);
private->selected_symmetry = sym;
}
+
g_object_set (private->selected_symmetry,
"active", TRUE,
NULL);
diff --git a/app/core/gimpsymmetry-mandala.c b/app/core/gimpsymmetry-mandala.c
index 86e6752..1242fae 100644
--- a/app/core/gimpsymmetry-mandala.c
+++ b/app/core/gimpsymmetry-mandala.c
@@ -43,16 +43,17 @@
#include "gimp-intl.h"
+
enum
{
PROP_0,
-
PROP_CENTER_X,
PROP_CENTER_Y,
PROP_SIZE,
PROP_DISABLE_TRANSFORMATION,
};
+
/* Local function prototypes */
static void gimp_mandala_constructed (GObject *object);
@@ -94,10 +95,12 @@ static void
gint previous_height,
GimpSymmetry *sym);
+
G_DEFINE_TYPE (GimpMandala, gimp_mandala, GIMP_TYPE_SYMMETRY)
#define parent_class gimp_mandala_parent_class
+
static void
gimp_mandala_class_init (GimpMandalaClass *klass)
{
@@ -164,9 +167,7 @@ gimp_mandala_constructed (GObject *object)
static void
gimp_mandala_finalize (GObject *object)
{
- GimpMandala *mandala;
-
- mandala = GIMP_MANDALA (object);
+ GimpMandala *mandala = GIMP_MANDALA (object);
if (mandala->horizontal_guide)
g_object_unref (mandala->horizontal_guide);
@@ -283,17 +284,14 @@ gimp_mandala_add_guide (GimpMandala *mandala,
static GimpRGB normal_bg = { 0.0, 1.0, 1.0, 1.0 };
static GimpRGB active_fg = { 0.0, 1.0, 1.0, 1.0 };
static GimpRGB active_bg = { 1.0, 0.0, 0.0, 1.0 };
- GimpSymmetry *sym;
+ GimpSymmetry *sym = GIMP_SYMMETRY (mandala);
GimpImage *image;
Gimp *gimp;
GimpGuide *guide;
gint position;
- g_return_if_fail (GIMP_IS_MANDALA (mandala));
-
- sym = GIMP_SYMMETRY (mandala);
image = sym->image;
- gimp = GIMP (image->gimp);
+ gimp = image->gimp;
guide = gimp_guide_custom_new (orientation,
gimp->next_guide_ID++,
@@ -319,14 +317,13 @@ gimp_mandala_add_guide (GimpMandala *mandala,
mandala->center_x = (gdouble) gimp_image_get_width (image) / 2.0;
position = (gint) mandala->center_x;
}
- g_signal_connect (G_OBJECT (guide), "removed",
+ g_signal_connect (guide, "removed",
G_CALLBACK (gimp_mandala_guide_removed_cb),
mandala);
- gimp_image_add_guide (image, guide,
- (gint) position);
+ gimp_image_add_guide (image, guide, position);
- g_signal_connect (G_OBJECT (guide), "notify::position",
+ g_signal_connect (guide, "notify::position",
G_CALLBACK (gimp_mandala_guide_position_cb),
mandala);
}
@@ -335,23 +332,21 @@ static void
gimp_mandala_remove_guide (GimpMandala *mandala,
GimpOrientationType orientation)
{
- GimpSymmetry *sym;
+ GimpSymmetry *sym = GIMP_SYMMETRY (mandala);
GimpImage *image;
GimpGuide *guide;
- g_return_if_fail (GIMP_IS_MANDALA (mandala));
-
- sym = GIMP_SYMMETRY (mandala);
image = sym->image;
guide = (orientation == GIMP_ORIENTATION_HORIZONTAL) ?
mandala->horizontal_guide : mandala->vertical_guide;
- g_signal_handlers_disconnect_by_func (G_OBJECT (guide),
+ g_signal_handlers_disconnect_by_func (guide,
gimp_mandala_guide_removed_cb,
mandala);
- g_signal_handlers_disconnect_by_func (G_OBJECT (guide),
+ g_signal_handlers_disconnect_by_func (guide,
gimp_mandala_guide_position_cb,
mandala);
+
gimp_image_remove_guide (image, guide, FALSE);
g_object_unref (guide);
@@ -365,9 +360,7 @@ static void
gimp_mandala_guide_removed_cb (GObject *object,
GimpMandala *mandala)
{
- GimpSymmetry *sym;
-
- sym = GIMP_SYMMETRY (mandala);
+ GimpSymmetry *sym = GIMP_SYMMETRY (mandala);
g_signal_handlers_disconnect_by_func (object,
gimp_mandala_guide_removed_cb,
@@ -375,6 +368,7 @@ gimp_mandala_guide_removed_cb (GObject *object,
g_signal_handlers_disconnect_by_func (object,
gimp_mandala_guide_position_cb,
mandala);
+
if (GIMP_GUIDE (object) == mandala->horizontal_guide)
{
g_object_unref (mandala->horizontal_guide);
@@ -401,9 +395,7 @@ gimp_mandala_guide_position_cb (GObject *object,
GParamSpec *pspec,
GimpMandala *mandala)
{
- GimpGuide *guide;
-
- guide = GIMP_GUIDE (object);
+ GimpGuide *guide = GIMP_GUIDE (object);
if (guide == mandala->horizontal_guide)
{
@@ -420,14 +412,11 @@ gimp_mandala_update_strokes (GimpSymmetry *sym,
GimpDrawable *drawable,
GimpCoords *origin)
{
- GimpMandala *mandala = GIMP_MANDALA (sym);
+ GimpMandala *mandala = GIMP_MANDALA (sym);
GimpCoords *coords;
GimpMatrix3 matrix;
gint i;
- g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
- g_return_if_fail (GIMP_IS_SYMMETRY (sym));
-
g_list_free_full (sym->strokes, g_free);
sym->strokes = NULL;
@@ -456,6 +445,7 @@ gimp_mandala_update_strokes (GimpSymmetry *sym,
coords->y = new_y;
sym->strokes = g_list_prepend (sym->strokes, coords);
}
+
sym->strokes = g_list_reverse (sym->strokes);
g_signal_emit_by_name (sym, "strokes-updated", sym->image);
@@ -467,13 +457,10 @@ gimp_mandala_get_operation (GimpSymmetry *sym,
gint paint_width,
gint paint_height)
{
- GimpMandala *mandala = GIMP_MANDALA (sym);
- GeglNode *op = NULL;
+ GimpMandala *mandala = GIMP_MANDALA (sym);
+ GeglNode *op = NULL;
gint i;
- g_return_val_if_fail (GIMP_IS_MANDALA (sym), NULL);
- g_return_val_if_fail (stroke < mandala->size, NULL);
-
if (! mandala->disable_transformation &&
stroke != 0 &&
paint_width != 0 &&
@@ -484,6 +471,7 @@ gimp_mandala_get_operation (GimpSymmetry *sym,
mandala->cached_paint_height != paint_height)
{
GList *iter;
+
if (mandala->ops)
{
for (iter = mandala->ops; iter; iter = g_list_next (iter))
@@ -496,6 +484,7 @@ gimp_mandala_get_operation (GimpSymmetry *sym,
}
mandala->ops = g_list_prepend (mandala->ops, NULL);
+
for (i = 1; i < mandala->size; i++)
{
op = gegl_node_new_child (NULL,
@@ -509,9 +498,11 @@ gimp_mandala_get_operation (GimpSymmetry *sym,
NULL);
mandala->ops = g_list_prepend (mandala->ops, op);
}
+
mandala->ops = g_list_reverse (mandala->ops);
- mandala->cached_size = mandala->size;
- mandala->cached_paint_width = paint_width;
+
+ mandala->cached_size = mandala->size;
+ mandala->cached_paint_width = paint_width;
mandala->cached_paint_height = paint_height;
}
@@ -523,7 +514,7 @@ gimp_mandala_get_operation (GimpSymmetry *sym,
static GParamSpec **
gimp_mandala_get_settings (GimpSymmetry *sym,
- gint *n_settings)
+ gint *n_settings)
{
GParamSpec **pspecs;
diff --git a/app/core/gimpsymmetry-mandala.h b/app/core/gimpsymmetry-mandala.h
index 476e7b4..a7a3e0a 100644
--- a/app/core/gimpsymmetry-mandala.h
+++ b/app/core/gimpsymmetry-mandala.h
@@ -32,6 +32,7 @@
#define GIMP_IS_MANDALA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_MANDALA))
#define GIMP_MANDALA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_MANDALA, GimpMandalaClass))
+
typedef struct _GimpMandalaClass GimpMandalaClass;
struct _GimpMandala
@@ -57,6 +58,8 @@ struct _GimpMandalaClass
GimpSymmetryClass parent_class;
};
-GType gimp_mandala_get_type (void) G_GNUC_CONST;
+
+GType gimp_mandala_get_type (void) G_GNUC_CONST;
+
#endif /* __GIMP_MANDALA_H__ */
diff --git a/app/core/gimpsymmetry-mirror.c b/app/core/gimpsymmetry-mirror.c
index 878f760..4ea9752 100644
--- a/app/core/gimpsymmetry-mirror.c
+++ b/app/core/gimpsymmetry-mirror.c
@@ -42,10 +42,10 @@
#include "gimp-intl.h"
+
enum
{
PROP_0,
-
PROP_HORIZONTAL_SYMMETRY,
PROP_VERTICAL_SYMMETRY,
PROP_POINT_SYMMETRY,
@@ -54,6 +54,7 @@ enum
PROP_VERTICAL_POSITION
};
+
/* Local function prototypes */
static void gimp_mirror_finalize (GObject *object);
@@ -96,10 +97,12 @@ static void gimp_mirror_set_vertical_symmetry (GimpMirror *mirr
static void gimp_mirror_set_point_symmetry (GimpMirror *mirror,
gboolean active);
+
G_DEFINE_TYPE (GimpMirror, gimp_mirror, GIMP_TYPE_SYMMETRY)
#define parent_class gimp_mirror_parent_class
+
static void
gimp_mirror_class_init (GimpMirrorClass *klass)
{
@@ -266,8 +269,8 @@ gimp_mirror_update_strokes (GimpSymmetry *sym,
GimpDrawable *drawable,
GimpCoords *origin)
{
- GList *strokes = NULL;
GimpMirror *mirror = GIMP_MIRROR (sym);
+ GList *strokes = NULL;
GimpCoords *coords;
g_list_free_full (sym->strokes, g_free);
@@ -280,12 +283,14 @@ gimp_mirror_update_strokes (GimpSymmetry *sym,
coords->y = 2.0 * mirror->horizontal_position - origin->y;
strokes = g_list_prepend (strokes, coords);
}
+
if (mirror->vertical_mirror)
{
coords = g_memdup (origin, sizeof (GimpCoords));
coords->x = 2.0 * mirror->vertical_position - origin->x;
strokes = g_list_prepend (strokes, coords);
}
+
if (mirror->point_symmetry)
{
coords = g_memdup (origin, sizeof (GimpCoords));
@@ -293,6 +298,7 @@ gimp_mirror_update_strokes (GimpSymmetry *sym,
coords->y = 2.0 * mirror->horizontal_position - origin->y;
strokes = g_list_prepend (strokes, coords);
}
+
sym->strokes = g_list_reverse (strokes);
g_signal_emit_by_name (sym, "strokes-updated", sym->image);
@@ -314,13 +320,10 @@ static void gimp_mirror_prepare_operations (GimpMirror *mirror,
mirror->horizontal_op = gegl_node_new_child (NULL,
"operation", "gegl:reflect",
- "origin-x", 0.0,
- "origin-y",
- (gdouble) paint_height / 2.0,
- "x",
- 1.0,
- "y",
- 0.0,
+ "origin-x", 0.0,
+ "origin-y", paint_height / 2.0,
+ "x", 1.0,
+ "y", 0.0,
NULL);
if (mirror->vertical_op)
@@ -328,13 +331,10 @@ static void gimp_mirror_prepare_operations (GimpMirror *mirror,
mirror->vertical_op = gegl_node_new_child (NULL,
"operation", "gegl:reflect",
- "origin-x",
- (gdouble) paint_width / 2.0,
- "origin-y", 0.0,
- "x",
- 0.0,
- "y",
- 1.0,
+ "origin-x", paint_width / 2.0,
+ "origin-y", 0.0,
+ "x", 0.0,
+ "y", 1.0,
NULL);
if (mirror->central_op)
@@ -342,12 +342,9 @@ static void gimp_mirror_prepare_operations (GimpMirror *mirror,
mirror->central_op = gegl_node_new_child (NULL,
"operation", "gegl:rotate",
- "origin-x",
- (gdouble) paint_width / 2.0,
- "origin-y",
- (gdouble) paint_height / 2.0,
- "degrees",
- 180.0,
+ "origin-x", paint_width / 2.0,
+ "origin-y", paint_height / 2.0,
+ "degrees", 180.0,
NULL);
}
@@ -357,7 +354,7 @@ gimp_mirror_get_operation (GimpSymmetry *sym,
gint paint_width,
gint paint_height)
{
- GimpMirror *mirror = GIMP_MIRROR (sym);
+ GimpMirror *mirror = GIMP_MIRROR (sym);
GeglNode *op;
g_return_val_if_fail (stroke >= 0 &&
@@ -384,11 +381,7 @@ gimp_mirror_get_operation (GimpSymmetry *sym,
static void
gimp_mirror_reset (GimpMirror *mirror)
{
- GimpSymmetry *sym;
-
- g_return_if_fail (GIMP_IS_MIRROR (mirror));
-
- sym = GIMP_SYMMETRY (mirror);
+ GimpSymmetry *sym = GIMP_SYMMETRY (mirror);
if (sym->origin)
{
@@ -405,17 +398,14 @@ gimp_mirror_add_guide (GimpMirror *mirror,
static GimpRGB normal_bg = { 0.0, 1.0, 0.0, 1.0 };
static GimpRGB active_fg = { 0.0, 1.0, 0.0, 1.0 };
static GimpRGB active_bg = { 1.0, 0.0, 0.0, 1.0 };
- GimpSymmetry *sym;
+ GimpSymmetry *sym = GIMP_SYMMETRY (mirror);
GimpImage *image;
Gimp *gimp;
GimpGuide *guide;
gint position;
- g_return_if_fail (GIMP_IS_MIRROR (mirror));
-
- sym = GIMP_SYMMETRY (mirror);
image = sym->image;
- gimp = GIMP (image->gimp);
+ gimp = image->gimp;
guide = gimp_guide_custom_new (orientation,
gimp->next_guide_ID++,
@@ -429,8 +419,8 @@ gimp_mirror_add_guide (GimpMirror *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;
- position = (gint) mirror->horizontal_position;
+ mirror->horizontal_position = gimp_image_get_height (image) / 2.0;
+ position = mirror->horizontal_position;
}
else
{
@@ -438,17 +428,17 @@ gimp_mirror_add_guide (GimpMirror *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;
- position = (gint) mirror->vertical_position;
+ mirror->vertical_position = gimp_image_get_width (image) / 2.0;
+ position = mirror->vertical_position;
}
- g_signal_connect (G_OBJECT (guide), "removed",
+
+ g_signal_connect (guide, "removed",
G_CALLBACK (gimp_mirror_guide_removed_cb),
mirror);
- gimp_image_add_guide (image, guide,
- (gint) position);
+ gimp_image_add_guide (image, guide, position);
- g_signal_connect (G_OBJECT (guide), "notify::position",
+ g_signal_connect (guide, "notify::position",
G_CALLBACK (gimp_mirror_guide_position_cb),
mirror);
}
@@ -457,13 +447,10 @@ static void
gimp_mirror_remove_guide (GimpMirror *mirror,
GimpOrientationType orientation)
{
- GimpSymmetry *sym;
+ GimpSymmetry *sym = GIMP_SYMMETRY (mirror);
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;
@@ -495,6 +482,7 @@ gimp_mirror_guide_removed_cb (GObject *object,
g_signal_handlers_disconnect_by_func (object,
gimp_mirror_guide_position_cb,
mirror);
+
if (GIMP_GUIDE (object) == mirror->horizontal_guide)
{
g_object_unref (mirror->horizontal_guide);
@@ -563,9 +551,7 @@ gimp_mirror_guide_position_cb (GObject *object,
GParamSpec *pspec,
GimpMirror *mirror)
{
- GimpGuide *guide;
-
- guide = GIMP_GUIDE (object);
+ GimpGuide *guide = GIMP_GUIDE (object);
if (guide == mirror->horizontal_guide)
{
@@ -626,8 +612,6 @@ static void
gimp_mirror_set_horizontal_symmetry (GimpMirror *mirror,
gboolean active)
{
- g_return_if_fail (GIMP_IS_MIRROR (mirror));
-
if (active == mirror->horizontal_mirror)
return;
@@ -648,8 +632,6 @@ static void
gimp_mirror_set_vertical_symmetry (GimpMirror *mirror,
gboolean active)
{
- g_return_if_fail (GIMP_IS_MIRROR (mirror));
-
if (active == mirror->vertical_mirror)
return;
@@ -670,8 +652,6 @@ static void
gimp_mirror_set_point_symmetry (GimpMirror *mirror,
gboolean active)
{
- g_return_if_fail (GIMP_IS_MIRROR (mirror));
-
if (active == mirror->point_symmetry)
return;
diff --git a/app/core/gimpsymmetry-mirror.h b/app/core/gimpsymmetry-mirror.h
index 6d83de0..0fe42fc 100644
--- a/app/core/gimpsymmetry-mirror.h
+++ b/app/core/gimpsymmetry-mirror.h
@@ -32,6 +32,7 @@
#define GIMP_IS_MIRROR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_MIRROR))
#define GIMP_MIRROR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_MIRROR, GimpMirrorClass))
+
typedef struct _GimpMirrorClass GimpMirrorClass;
struct _GimpMirror
@@ -62,6 +63,7 @@ struct _GimpMirrorClass
};
-GType gimp_mirror_get_type (void) G_GNUC_CONST;
+GType gimp_mirror_get_type (void) G_GNUC_CONST;
+
#endif /* __GIMP_MIRROR_H__ */
diff --git a/app/core/gimpsymmetry-tiling.c b/app/core/gimpsymmetry-tiling.c
index f6f62b9..6fd5adc 100644
--- a/app/core/gimpsymmetry-tiling.c
+++ b/app/core/gimpsymmetry-tiling.c
@@ -37,6 +37,7 @@
#include "gimp-intl.h"
+
/* Using same epsilon as in GLIB. */
#define G_DOUBLE_EPSILON (1e-90)
@@ -51,6 +52,7 @@ enum
PROP_Y_MAX
};
+
/* Local function prototypes */
static void gimp_tiling_constructed (GObject *object);
@@ -81,10 +83,12 @@ static void
gint previous_height,
GimpSymmetry *sym);
+
G_DEFINE_TYPE (GimpTiling, gimp_tiling, GIMP_TYPE_SYMMETRY)
#define parent_class gimp_tiling_parent_class
+
static void
gimp_tiling_class_init (GimpTilingClass *klass)
{
@@ -131,13 +135,10 @@ gimp_tiling_init (GimpTiling *tiling)
static void
gimp_tiling_constructed (GObject *object)
{
- GimpSymmetry *sym;
- GimpTiling *tiling;
+ GimpSymmetry *sym = GIMP_SYMMETRY (object);
+ GimpTiling *tiling = GIMP_TILING (object);
GParamSpecDouble *dspec;
- sym = GIMP_SYMMETRY (object);
- tiling = GIMP_TILING (object);
-
/* Update property values to actual image size. */
dspec = G_PARAM_SPEC_DOUBLE (g_object_class_find_property (G_OBJECT_GET_CLASS (object),
"x-interval"));
@@ -173,7 +174,7 @@ gimp_tiling_set_property (GObject *object,
GParamSpec *pspec)
{
GimpTiling *tiling = GIMP_TILING (object);
- GimpSymmetry *sym = GIMP_SYMMETRY (tiling);
+ GimpSymmetry *sym = GIMP_SYMMETRY (tiling);
switch (property_id)
{
@@ -285,8 +286,8 @@ gimp_tiling_update_strokes (GimpSymmetry *sym,
GimpDrawable *drawable,
GimpCoords *origin)
{
- GList *strokes = NULL;
GimpTiling *tiling = GIMP_TILING (sym);
+ GList *strokes = NULL;
GimpCoords *coords;
gint width;
gint height;
@@ -297,9 +298,6 @@ gimp_tiling_update_strokes (GimpSymmetry *sym,
gint x_count;
gint y_count;
- g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
- g_return_if_fail (GIMP_IS_SYMMETRY (sym));
-
g_list_free_full (sym->strokes, g_free);
sym->strokes = NULL;
@@ -335,6 +333,7 @@ gimp_tiling_update_strokes (GimpSymmetry *sym,
if (tiling->interval_y < 1.0)
break;
}
+
sym->strokes = strokes;
g_signal_emit_by_name (sym, "strokes-updated", sym->image);
diff --git a/app/core/gimpsymmetry-tiling.h b/app/core/gimpsymmetry-tiling.h
index 7f61b98..57a5da1 100644
--- a/app/core/gimpsymmetry-tiling.h
+++ b/app/core/gimpsymmetry-tiling.h
@@ -32,6 +32,7 @@
#define GIMP_IS_TILING_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_TILING))
#define GIMP_TILING_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_TILING, GimpTilingClass))
+
typedef struct _GimpTilingClass GimpTilingClass;
struct _GimpTiling
@@ -50,6 +51,8 @@ struct _GimpTilingClass
GimpSymmetryClass parent_class;
};
-GType gimp_tiling_get_type (void) G_GNUC_CONST;
+
+GType gimp_tiling_get_type (void) G_GNUC_CONST;
+
#endif /* __GIMP_TILING_H__ */
diff --git a/app/core/gimpsymmetry.c b/app/core/gimpsymmetry.c
index 5724707..83eaaf2 100644
--- a/app/core/gimpsymmetry.c
+++ b/app/core/gimpsymmetry.c
@@ -38,6 +38,7 @@
#include "gimp-intl.h"
+
enum
{
STROKES_UPDATED,
@@ -53,6 +54,7 @@ enum
PROP_ACTIVE,
};
+
/* Local function prototypes */
static void gimp_symmetry_finalize (GObject *object);
@@ -78,21 +80,23 @@ static GParamSpec **
gimp_symmetry_real_get_settings (GimpSymmetry *sym,
gint *n_properties);
+
G_DEFINE_TYPE_WITH_CODE (GimpSymmetry, gimp_symmetry, GIMP_TYPE_OBJECT,
G_IMPLEMENT_INTERFACE (GIMP_TYPE_CONFIG, NULL))
-
#define parent_class gimp_symmetry_parent_class
static guint gimp_symmetry_signals[LAST_SIGNAL] = { 0 };
+
static void
gimp_symmetry_class_init (GimpSymmetryClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- /* This signal should likely be emitted at the end of update_strokes()
- * if stroke coordinates were changed. */
+ /* This signal should likely be emitted at the end of
+ * update_strokes() if stroke coordinates were changed.
+ */
gimp_symmetry_signals[STROKES_UPDATED] =
g_signal_new ("strokes-updated",
G_TYPE_FROM_CLASS (klass),
@@ -102,9 +106,11 @@ gimp_symmetry_class_init (GimpSymmetryClass *klass)
NULL,
G_TYPE_NONE,
1, GIMP_TYPE_IMAGE);
- /* This signal should be emitted when you request a change in
- * the settings UI. For instance adding some settings (therefore having a
- * dynamic UI), or changing scale min/max extremes, etc. */
+
+ /* This signal should be emitted when you request a change in the
+ * settings UI. For instance adding some settings (therefore having
+ * a dynamic UI), or changing scale min/max extremes, etc.
+ */
gimp_symmetry_signals[UPDATE_UI] =
g_signal_new ("update-ui",
G_TYPE_FROM_CLASS (klass),
@@ -147,7 +153,6 @@ gimp_symmetry_class_init (GimpSymmetryClass *klass)
GIMP_PARAM_STATIC_STRINGS);
}
-
static void
gimp_symmetry_init (GimpSymmetry *sym)
{
@@ -282,9 +287,7 @@ gimp_symmetry_set_origin (GimpSymmetry *sym,
g_list_free_full (sym->strokes, g_free);
sym->strokes = NULL;
- GIMP_SYMMETRY_GET_CLASS (sym)->update_strokes (sym,
- drawable,
- origin);
+ GIMP_SYMMETRY_GET_CLASS (sym)->update_strokes (sym, drawable, origin);
}
/**
@@ -385,9 +388,7 @@ gimp_symmetry_get_settings (GimpSymmetry *sym,
gchar *
gimp_symmetry_parasite_name (GType type)
{
- GimpSymmetryClass *klass;
-
- klass = g_type_class_ref (type);
+ GimpSymmetryClass *klass = g_type_class_ref (type);
return g_strconcat ("gimp-image-symmetry:", klass->label, NULL);
}
diff --git a/app/core/gimpsymmetry.h b/app/core/gimpsymmetry.h
index 50c3d4e..b75846b 100644
--- a/app/core/gimpsymmetry.h
+++ b/app/core/gimpsymmetry.h
@@ -32,6 +32,7 @@
#define GIMP_IS_SYMMETRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_SYMMETRY))
#define GIMP_SYMMETRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_SYMMETRY,
GimpSymmetryClass))
+
typedef struct _GimpSymmetryClass GimpSymmetryClass;
struct _GimpSymmetry
@@ -86,9 +87,11 @@ GeglNode * gimp_symmetry_get_operation (GimpSymmetry *symmetry,
GParamSpec ** gimp_symmetry_get_settings (GimpSymmetry *symmetry,
gint *n_properties);
-gchar * gimp_symmetry_parasite_name (GType type);
+gchar * gimp_symmetry_parasite_name (GType type);
GimpParasite * gimp_symmetry_to_parasite (const GimpSymmetry *symmetry);
GimpSymmetry * gimp_symmetry_from_parasite (const GimpParasite *parasite,
GimpImage *image,
GType type);
+
+
#endif /* __GIMP_SYMMETRY_H__ */
diff --git a/app/display/display-enums.c b/app/display/display-enums.c
index 7eda7dd..934e81c 100644
--- a/app/display/display-enums.c
+++ b/app/display/display-enums.c
@@ -40,6 +40,37 @@ gimp_cursor_precision_get_type (void)
}
GType
+gimp_guide_style_get_type (void)
+{
+ static const GEnumValue values[] =
+ {
+ { GIMP_GUIDE_STYLE_NONE, "GIMP_GUIDE_STYLE_NONE", "none" },
+ { GIMP_GUIDE_STYLE_NORMAL, "GIMP_GUIDE_STYLE_NORMAL", "normal" },
+ { GIMP_GUIDE_STYLE_MIRROR, "GIMP_GUIDE_STYLE_MIRROR", "mirror" },
+ { 0, NULL, NULL }
+ };
+
+ static const GimpEnumDesc descs[] =
+ {
+ { GIMP_GUIDE_STYLE_NONE, "GIMP_GUIDE_STYLE_NONE", NULL },
+ { GIMP_GUIDE_STYLE_NORMAL, "GIMP_GUIDE_STYLE_NORMAL", NULL },
+ { GIMP_GUIDE_STYLE_MIRROR, "GIMP_GUIDE_STYLE_MIRROR", NULL },
+ { 0, NULL, NULL }
+ };
+
+ static GType type = 0;
+
+ if (G_UNLIKELY (! type))
+ {
+ type = g_enum_register_static ("GimpGuideStyle", values);
+ gimp_type_set_translation_context (type, "guide-style");
+ gimp_enum_set_value_descriptions (type, descs);
+ }
+
+ return type;
+}
+
+GType
gimp_guides_type_get_type (void)
{
static const GEnumValue values[] =
@@ -228,37 +259,6 @@ gimp_zoom_focus_get_type (void)
return type;
}
-GType
-gimp_guide_style_get_type (void)
-{
- static const GEnumValue values[] =
- {
- { GIMP_GUIDE_STYLE_NONE, "GIMP_GUIDE_STYLE_NONE", "none" },
- { GIMP_GUIDE_STYLE_NORMAL, "GIMP_GUIDE_STYLE_NORMAL", "normal" },
- { GIMP_GUIDE_STYLE_MIRROR, "GIMP_GUIDE_STYLE_MIRROR", "mirror" },
- { 0, NULL, NULL }
- };
-
- static const GimpEnumDesc descs[] =
- {
- { GIMP_GUIDE_STYLE_NONE, "GIMP_GUIDE_STYLE_NONE", NULL },
- { GIMP_GUIDE_STYLE_NORMAL, "GIMP_GUIDE_STYLE_NORMAL", NULL },
- { GIMP_GUIDE_STYLE_MIRROR, "GIMP_GUIDE_STYLE_MIRROR", NULL },
- { 0, NULL, NULL }
- };
-
- static GType type = 0;
-
- if (G_UNLIKELY (! type))
- {
- type = g_enum_register_static ("GimpGuideStyle", values);
- gimp_type_set_translation_context (type, "guide-style");
- gimp_enum_set_value_descriptions (type, descs);
- }
-
- return type;
-}
-
/* Generated data ends here */
diff --git a/app/display/display-enums.h b/app/display/display-enums.h
index 5d164ed..46c3d40 100644
--- a/app/display/display-enums.h
+++ b/app/display/display-enums.h
@@ -31,6 +31,18 @@ typedef enum
} GimpCursorPrecision;
+#define GIMP_TYPE_GUIDE_STYLE (gimp_guide_style_get_type ())
+
+GType gimp_guide_style_get_type (void) G_GNUC_CONST;
+
+typedef enum
+{
+ GIMP_GUIDE_STYLE_NONE,
+ GIMP_GUIDE_STYLE_NORMAL,
+ GIMP_GUIDE_STYLE_MIRROR
+} GimpGuideStyle;
+
+
#define GIMP_TYPE_GUIDES_TYPE (gimp_guides_type_get_type ())
GType gimp_guides_type_get_type (void) G_GNUC_CONST;
@@ -117,15 +129,5 @@ typedef enum
} GimpZoomFocus;
-#define GIMP_TYPE_GUIDE_STYLE (gimp_guide_style_get_type ())
-
-GType gimp_guide_style_get_type (void) G_GNUC_CONST;
-
-typedef enum
-{
- GIMP_GUIDE_STYLE_NONE,
- GIMP_GUIDE_STYLE_NORMAL,
- GIMP_GUIDE_STYLE_MIRROR
-} GimpGuideStyle;
#endif /* __DISPLAY_ENUMS_H__ */
diff --git a/app/tools/gimpblendtool.c b/app/tools/gimpblendtool.c
index 8fb03f4..be46710 100644
--- a/app/tools/gimpblendtool.c
+++ b/app/tools/gimpblendtool.c
@@ -31,6 +31,8 @@
#include "tools-types.h"
+#include "gegl/gimp-gegl-config.h"
+
#include "core/gimp-utils.h"
#include "core/gimpdrawable.h"
#include "core/gimpdrawable-blend.h"
@@ -41,8 +43,6 @@
#include "core/gimpprogress.h"
#include "core/gimpprojection.h"
-#include "gegl/gimp-gegl-config.h"
-
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpwidgets-utils.h"
diff --git a/app/widgets/gimpsymmetryeditor.c b/app/widgets/gimpsymmetryeditor.c
index 9674aef..c2426fc 100644
--- a/app/widgets/gimpsymmetryeditor.c
+++ b/app/widgets/gimpsymmetryeditor.c
@@ -43,24 +43,26 @@
#include "gimp-intl.h"
+
enum
{
PROP_0,
PROP_GIMP,
};
+
struct _GimpSymmetryEditorPrivate
{
- Gimp *gimp;
- GimpImage *image;
+ Gimp *gimp;
+ GimpImage *image;
- GtkWidget *menu;
- GtkWidget *options_frame;
+ GtkWidget *menu;
+ GtkWidget *options_frame;
};
+
static void gimp_symmetry_editor_docked_iface_init (GimpDockedInterface *iface);
-/* Signal handlers on the GObject. */
static void gimp_symmetry_editor_constructed (GObject *object);
static void gimp_symmetry_editor_dispose (GObject *object);
static void gimp_symmetry_editor_set_property (GObject *object,
@@ -157,7 +159,7 @@ static void
gimp_symmetry_editor_constructed (GObject *object)
{
GimpSymmetryEditor *editor = GIMP_SYMMETRY_EDITOR (object);
- GimpContext *user_context;
+ GimpContext *user_context;
G_OBJECT_CLASS (parent_class)->constructed (object);
@@ -360,7 +362,7 @@ gimp_symmetry_editor_symmetry_updated (GimpSymmetry *symmetry,
if (image != context->image ||
symmetry != gimp_image_symmetry_selected (image))
{
- g_signal_handlers_disconnect_by_func (G_OBJECT (symmetry),
+ g_signal_handlers_disconnect_by_func (symmetry,
gimp_symmetry_editor_symmetry_updated,
editor);
return;
@@ -369,8 +371,6 @@ gimp_symmetry_editor_symmetry_updated (GimpSymmetry *symmetry,
gimp_symmetry_editor_set_options (editor, symmetry);
}
-/* private functions */
-
static void
gimp_symmetry_editor_set_options (GimpSymmetryEditor *editor,
GimpSymmetry *symmetry)
@@ -427,50 +427,48 @@ gimp_symmetry_editor_set_options (GimpSymmetryEditor *editor,
switch (spec->value_type)
{
case G_TYPE_BOOLEAN:
- {
- GtkWidget *checkbox;
-
- checkbox = gimp_prop_check_button_new (G_OBJECT (symmetry),
- name,
- blurb);
- gtk_box_pack_start (GTK_BOX (vbox), checkbox,
- FALSE, FALSE, 0);
- gtk_widget_show (checkbox);
- }
+ {
+ GtkWidget *checkbox;
+
+ checkbox = gimp_prop_check_button_new (G_OBJECT (symmetry),
+ name, blurb);
+ gtk_box_pack_start (GTK_BOX (vbox), checkbox, FALSE, FALSE, 0);
+ gtk_widget_show (checkbox);
+ }
break;
case G_TYPE_DOUBLE:
case G_TYPE_INT:
case G_TYPE_UINT:
- {
- GtkWidget *scale;
- gdouble minimum;
- gdouble maximum;
-
- if (spec->value_type == G_TYPE_DOUBLE)
- {
- minimum = G_PARAM_SPEC_DOUBLE (spec)->minimum;
- maximum = G_PARAM_SPEC_DOUBLE (spec)->maximum;
- }
- else if (spec->value_type == G_TYPE_INT)
- {
- minimum = G_PARAM_SPEC_INT (spec)->minimum;
- maximum = G_PARAM_SPEC_INT (spec)->maximum;
- }
- else
- {
- minimum = G_PARAM_SPEC_UINT (spec)->minimum;
- maximum = G_PARAM_SPEC_UINT (spec)->maximum;
- }
-
- scale = gimp_prop_spin_scale_new (G_OBJECT (symmetry),
- name, blurb,
- 1.0, 10.0, 1);
- gimp_spin_scale_set_scale_limits (GIMP_SPIN_SCALE (scale),
- minimum,
- maximum);
- gtk_box_pack_start (GTK_BOX (vbox), scale, TRUE, TRUE, 0);
- gtk_widget_show (scale);
- }
+ {
+ GtkWidget *scale;
+ gdouble minimum;
+ gdouble maximum;
+
+ if (spec->value_type == G_TYPE_DOUBLE)
+ {
+ minimum = G_PARAM_SPEC_DOUBLE (spec)->minimum;
+ maximum = G_PARAM_SPEC_DOUBLE (spec)->maximum;
+ }
+ else if (spec->value_type == G_TYPE_INT)
+ {
+ minimum = G_PARAM_SPEC_INT (spec)->minimum;
+ maximum = G_PARAM_SPEC_INT (spec)->maximum;
+ }
+ else
+ {
+ minimum = G_PARAM_SPEC_UINT (spec)->minimum;
+ maximum = G_PARAM_SPEC_UINT (spec)->maximum;
+ }
+
+ scale = gimp_prop_spin_scale_new (G_OBJECT (symmetry),
+ name, blurb,
+ 1.0, 10.0, 1);
+ gimp_spin_scale_set_scale_limits (GIMP_SPIN_SCALE (scale),
+ minimum,
+ maximum);
+ gtk_box_pack_start (GTK_BOX (vbox), scale, TRUE, TRUE, 0);
+ gtk_widget_show (scale);
+ }
break;
default:
/* Type of parameter we haven't handled yet. */
@@ -484,6 +482,7 @@ gimp_symmetry_editor_set_options (GimpSymmetryEditor *editor,
gtk_widget_show (frame);
}
+
/* public functions */
GtkWidget *
@@ -491,16 +490,12 @@ gimp_symmetry_editor_new (Gimp *gimp,
GimpImage *image,
GimpMenuFactory *menu_factory)
{
- GimpSymmetryEditor *editor;
-
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
g_return_val_if_fail (GIMP_IS_MENU_FACTORY (menu_factory), NULL);
g_return_val_if_fail (image == NULL || GIMP_IS_IMAGE (image), NULL);
- editor = g_object_new (GIMP_TYPE_SYMMETRY_EDITOR,
- "gimp", gimp,
- "menu-factory", menu_factory,
- NULL);
-
- return GTK_WIDGET (editor);
+ return g_object_new (GIMP_TYPE_SYMMETRY_EDITOR,
+ "gimp", gimp,
+ "menu-factory", menu_factory,
+ NULL);
}
diff --git a/app/widgets/gimpsymmetryeditor.h b/app/widgets/gimpsymmetryeditor.h
index fd4d1cc..d53364c 100644
--- a/app/widgets/gimpsymmetryeditor.h
+++ b/app/widgets/gimpsymmetryeditor.h
@@ -49,10 +49,10 @@ struct _GimpSymmetryEditorClass
};
-GType gimp_symmetry_editor_get_type (void) G_GNUC_CONST;
-GtkWidget * gimp_symmetry_editor_new (Gimp *gimp,
- GimpImage *image,
- GimpMenuFactory *menu_factory);
+GType gimp_symmetry_editor_get_type (void) G_GNUC_CONST;
+GtkWidget * gimp_symmetry_editor_new (Gimp *gimp,
+ GimpImage *image,
+ GimpMenuFactory *menu_factory);
#endif /* __GIMP_SYMMETRY_EDITOR_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]