ops: property meta-data api churn

parent 33e1d287
......@@ -527,7 +527,7 @@ set_property (GObject *gobject,
case PROP_##name: \
properties->name = g_value_get_boolean (value); \
break;
#define property_file_path (name, label, def_val) \
#define property_file_path(name, label, def_val) \
case PROP_##name: \
if (properties->name) \
g_free (properties->name); \
......@@ -554,8 +554,20 @@ set_property (GObject *gobject,
#define property_path(name, label, def_val) \
case PROP_##name: \
if (properties->name != NULL) \
g_object_unref (properties->name); \
{ \
if (properties->path_changed_handler) \
g_signal_handler_disconnect (G_OBJECT (properties->name), \
properties->path_changed_handler); \
properties->path_changed_handler = 0; \
g_object_unref (properties->name); \
} \
properties->name = g_value_dup_object (value); \
if (properties->name != NULL) \
{ \
properties->path_changed_handler = \
g_signal_connect (G_OBJECT (properties->name), "changed", \
G_CALLBACK(path_changed), gobject); \
} \
break;
#define property_pointer(name, label, def_val) \
case PROP_##name: \
......@@ -1095,7 +1107,7 @@ gegl_op_class_intern_init (gpointer klass)
#define property_string(name, label, def_val) \
REGISTER_IF_ANY \
}{ GParamSpec *pspec = \
g_param_spec_string (#name, label, def_val, flags);\
g_param_spec_string (#name, label, NULL, def_val, flags);\
current_prop = PROP_##name ;
#define property_boolean(name, label, def_val) \
......@@ -1110,10 +1122,10 @@ gegl_op_class_intern_init (gpointer klass)
gegl_param_spec_file_path (#name, label, NULL, FALSE, FALSE, def_val, flags);\
current_prop = PROP_##name ;
#define property_object(name, label, def_val) \
#define property_object(name, label, type) \
REGISTER_IF_ANY \
}{ GParamSpec *pspec = \
g_param_spec_object (#name, label, NULL, flags);\
g_param_spec_object (#name, label, NULL, type, flags);\
current_prop = PROP_##name ;
#define property_curve(name, label, def_val) \
......@@ -1131,7 +1143,7 @@ gegl_op_class_intern_init (gpointer klass)
#define property_path(name, label, def_val) \
REGISTER_IF_ANY \
}{ GParamSpec *pspec = \
gegl_param_spec_path (#name, label, NULL, flags);\
gegl_param_spec_path (#name, label, NULL, def_val, flags);\
current_prop = PROP_##name ;
#define property_pointer(name, label, def_val) \
......
......@@ -23,20 +23,17 @@
#ifdef GEGL_PROPERTIES
gegl_property_double (brightness, _("Brightness"),
"description", _("Overall brightness of the image"),
"min", -100.0, "max", 100.0,
NULL)
gegl_property_double (chromatic, _("Chromatic Adaptation"),
"description", _("Adaptation to color variation across the image"),
"min", 0.0, "max", 1.0,
NULL)
gegl_property_double (light, _("Light Adaptation"),
"description", _("Adaptation to light variation across the image"),
"default", 1.0, "min", 0.0, "max", 1.0,
NULL)
property_double (brightness, _("Brightness"), 0.0)
description(_("Overall brightness of the image"))
value_range (-100.0, 100.0)
property_double (chromatic, _("Chromatic Adaptation"), 0.0)
description(_("Adaptation to color variation across the image"))
value_range (0.0, 1.0)
property_double (light, _("Light Adaptation"), 1.0)
description(_("Adaptation to light variation across the image"))
value_range (0.0, 1.0)
#else
......
......@@ -29,38 +29,29 @@ enum_start (gegl_ripple_wave_type)
enum_value (GEGL_RIPPLE_WAVE_TYPE_SAWTOOTH, "Sawtooth")
enum_end (GeglRippleWaveType)
gegl_property_double (amplitude, _("Amplitude"),
"default", 25.0, "min", 0.0, "max", 1000.0,
"ui-min", 0.0, "ui-max", 1000.0, "ui-gamma", 2.0,
NULL)
gegl_property_double (period, _("Period"),
"default", 200.0, "min", 0.0, "max", 1000.0,
"ui-min", 0.0, "ui-max", 1000.0, "ui-gamma", 1.5,
NULL)
gegl_property_double (phi, _("Phase shift"),
"min", -1.0, "max", 1.0,
NULL)
gegl_property_double (angle, _("Angle"),
"min", -180.0, "max", 180.0,
"unit", "degree",
NULL)
gegl_property_enum (sampler_type, _("Resampling method"),
GeglSamplerType, gegl_sampler_type,
"default", GEGL_SAMPLER_CUBIC,
NULL)
gegl_property_enum (wave_type, _("Wave type"),
GeglRippleWaveType, gegl_ripple_wave_type,
"default", GEGL_RIPPLE_WAVE_TYPE_SINE,
NULL)
gegl_property_boolean (tileable, _("Tileable"),
"description", _("Retain tilebility"),
NULL)
property_double (amplitude, _("Amplitude"), 25.0)
value_range (0.0, 1000.0)
ui_gamma (2.0)
property_double (period, _("Period"), 200.0)
value_range (0.0, 1000.0)
ui_gamma (1.5)
property_double (phi, _("Phase shift"), 0.0)
value_range (-1.0, 1.0)
property_double (angle, _("Angle"), 0.0)
value_range (-180, 180)
ui_meta ("unit", "degree")
property_enum (sampler_type, _("Resampling method"),
GeglSamplerType, gegl_sampler_type, GEGL_SAMPLER_CUBIC)
property_enum (wave_type, _("Wave type"),
GeglRippleWaveType, gegl_ripple_wave_type, GEGL_RIPPLE_WAVE_TYPE_SINE)
property_boolean (tileable, _("Tileable"), FALSE)
description(_("Retain tilebility"))
#else
......
......@@ -22,9 +22,8 @@
#ifdef GEGL_PROPERTIES
gegl_property_file_path (path, _("File"),
"description", _("Path of file to save."),
NULL)
property_file_path (path, _("File"), "")
description(_("Path of file to save."))
#else
......
......@@ -28,18 +28,16 @@ enum_start (gegl_shift_direction)
enum_value (GEGL_SHIFT_DIRECTION_VERTICAL, "Vertical")
enum_end (GeglShiftDirection)
gegl_property_int (shift, _("Shift"),
"description", _("Maximum amount to shift"),
"default", 5, "min", 0, "max", 200,
"unit", "pixel-distance",
NULL)
property_int (shift, _("Shift"), 5)
description(_("Maximum amount to shift"))
value_range (0, 200)
ui_meta ("unit", "pixel-distance")
gegl_property_enum (direction, _("Shift direction"),
property_enum (direction, _("Shift direction"),
GeglShiftDirection, gegl_shift_direction,
"default", GEGL_SHIFT_DIRECTION_HORIZONTAL,
NULL)
GEGL_SHIFT_DIRECTION_HORIZONTAL)
gegl_property_seed (seed, _("Random seed"), rand, NULL)
property_seed (seed, _("Random seed"), rand)
#else
......
......@@ -23,17 +23,16 @@
#ifdef GEGL_PROPERTIES
gegl_property_int (radius, _("Radius"),
"description", _("Radius of square pixel region, (width and height will be radius*2+1)"),
"default", 8, "min", 0, "max", 100,
"ui-min", 0, "ui-max", 40, "ui-gamma", 1.5,
"unit", " pixel-distance",
NULL)
gegl_property_int (pairs, _("Pairs"),
"description", _("Number of pairs; higher number preserves more acute features"),
"default", 2, "min", 1, "max", 2,
NULL)
property_int (radius, _("Radius"), 8)
description(_("Radius of square pixel region, (width and height will be radius*2+1)"))
value_range (0, 100)
ui_range (0, 40)
ui_gamma (1.5)
ui_meta ("unit", "pixel-distance")
property_int (pairs, _("Pairs"), 2)
description(_("Number of pairs; higher number preserves more acute features"))
value_range (1, 2)
#else
......
......@@ -23,18 +23,15 @@
#ifdef GEGL_PROPERTIES
gegl_property_double (glow_radius, _("Glow radius"),
"default", 10.0, "min", 1.0, "max", 50.0,
"unit", "pixel-distance",
NULL)
gegl_property_double (brightness, _("Brightness"),
"default", 0.30, "min", 0.0, "max", 1.0,
NULL)
gegl_property_double (sharpness, _("Sharpness"),
"default", 0.85, "min", 0.0, "max", 1.0,
NULL)
property_double (glow_radius, _("Glow radius"), 10.0)
value_range (1.0, 50.0)
ui_meta ("unit", "pixel-distance")
property_double (brightness, _("Brightness"), 0.30)
value_range (0.0, 1.0)
property_double (sharpness, _("Sharpness"), 0.85)
value_range (0.0, 1.0)
#else
......
......@@ -24,28 +24,25 @@
#ifdef GEGL_PROPERTIES
gegl_property_int (radius, _("Radius"),
"description", _("Neighborhood taken into account, for enhancement ideal values are close to the longest side of the image, increasing this increases the runtime"),
"default", 300, "min", 2, "max", 5000,
"ui-min", 2, "ui-max", 2000, "ui-gamma", 1.0,
"unit", "pixel-distance",
NULL)
gegl_property_int (samples, _("Samples"),
"description", _("Number of samples to do per iteration looking for the range of colors"),
"default", 5, "min", 2, "max", 200,
"ui-min", 2, "ui-max", 10,
NULL)
gegl_property_int (iterations, _("Iterations"),
"description", _("Number of iterations, a higher number of iterations provides a less noisy rendering at a computational cost"),
"default", 5, "min", 1, "max", 200,
"ui-min", 1, "ui-max", 10,
NULL)
property_int (radius, _("Radius"), 300)
description(_("Neighborhood taken into account, for enhancement ideal values are close to the longest side of the image, increasing this increases the runtime"))
value_range (2, 5000)
ui_range (2, 2000)
ui_meta ("unit", "pixel-distance")
property_int (samples, _("Samples"), 5)
description(_("Number of samples to do per iteration looking for the range of colors"))
value_range (2, 200)
ui_range (2, 10)
property_int (iterations, _("Iterations"), 5)
description(_("Number of iterations, a higher number of iterations provides a less noisy rendering at a computational cost"))
value_range (1, 200)
ui_range (1, 10)
/*
gegl_property_double (rgamma, _("Radial Gamma"), 0.0, 8.0, 2.0,
property_double (rgamma, _("Radial Gamma"), 0.0, 8.0, 2.0,
_("Gamma applied to radial distribution"))
*/
......
......@@ -23,14 +23,14 @@
#include "config.h"
#include <glib/gi18n-lib.h>
#ifdef GEGL_CHANT_PROPERTIES
#ifdef GEGL_PROPERTIES
#else
#define GEGL_CHANT_TYPE_FILTER
#define GEGL_CHANT_C_FILE "stretch-contrast-hsv.c"
#define GEGL_OP_FILTER
#define GEGL_OP_C_FILE "stretch-contrast-hsv.c"
#include "gegl-chant.h"
#include "gegl-op.h"
typedef struct {
gfloat slo;
......@@ -184,7 +184,7 @@ operation_process (GeglOperation *operation,
const GeglRectangle *in_rect =
gegl_operation_source_get_bounding_box (operation, "input");
operation_class = GEGL_OPERATION_CLASS (gegl_chant_parent_class);
operation_class = GEGL_OPERATION_CLASS (gegl_op_parent_class);
if (in_rect && gegl_rectangle_is_infinite_plane (in_rect))
{
......@@ -202,7 +202,7 @@ operation_process (GeglOperation *operation,
}
static void
gegl_chant_class_init (GeglChantClass *klass)
gegl_op_class_init (GeglOpClass *klass)
{
GeglOperationClass *operation_class;
GeglOperationFilterClass *filter_class;
......
......@@ -22,10 +22,8 @@
#ifdef GEGL_PROPERTIES
gegl_property_boolean (keep_colors, _("Keep colors"),
"description", _("Impact each channel with the same amount"),
"default", TRUE,
NULL)
property_boolean (keep_colors, _("Keep colors"), TRUE)
description(_("Impact each channel with the same amount"))
#else
......
......@@ -24,9 +24,8 @@
#ifdef GEGL_PROPERTIES
gegl_property_string (values, _("Values"),
"description", _("list of <number>s"),
NULL)
property_string (values, _("Values"), "")
description(_("list of <number>s"))
#else
......
......@@ -24,9 +24,8 @@
#ifdef GEGL_PROPERTIES
gegl_property_string (values, _("Values"),
"description", _("list of <number>s"),
NULL)
property_string (values, _("Values"), "")
description(_("list of <number>s"))
#else
......@@ -131,7 +130,7 @@ gegl_op_class_init (GeglOpClass *klass)
gegl_operation_class_set_keys (operation_class,
"name" , "gegl:svg-matrix",
"categories" , "compositors:svgfilter",
"description", _("SVG color matrix operation svg_matrix"),
"description",_("SVG color matrix operation svg_matrix"),
NULL);
}
......
......@@ -22,9 +22,8 @@
#ifdef GEGL_PROPERTIES
gegl_property_string (values, _("Values"),
"description", _("list of <number>s"),
NULL)
property_string (values, _("Values"), "")
description(_("list of <number>s"))
#else
......
......@@ -31,18 +31,16 @@ enum_start (gegl_texturize_canvas_direction)
enum_value (GEGL_TEXTURIZE_CANVAS_DIRECTION_BOTTOM_RIGHT, "Bottom-right")
enum_end (GeglTexturizeCanvasDirection)
gegl_property_enum (direction, _("Direction"),
property_enum (direction, _("Direction"),
GeglTexturizeCanvasDirection, gegl_texturize_canvas_direction,
"description", _("Position of the light source which lightens the canvas: "
"Top-right, Top-left, Bottom-left or Bottom-right"),
"default", GEGL_TEXTURIZE_CANVAS_DIRECTION_TOP_RIGHT,
NULL)
GEGL_TEXTURIZE_CANVAS_DIRECTION_TOP_RIGHT)
description(_("Position of the light source which lightens the canvas: "
"Top-right, Top-left, Bottom-left or Bottom-right"))
gegl_property_int (depth, _("Depth"),
"description", _("Apparent depth of the rendered canvas effect; "
"from 1 (very flat) to 50 (very deep)"),
"default", 4, "min", 1, "max", 50,
NULL)
property_int (depth, _("Depth"), 4)
description (_("Apparent depth of the rendered canvas effect; "
"from 1 (very flat) to 50 (very deep)"))
value_range (1, 50)
#else
......@@ -4376,7 +4374,7 @@ gegl_op_class_init (GeglOpClass *klass)
"name" , "gegl:texturize-canvas",
"categories" , "artistic",
"license" , "GPL3+",
"description", _("Textures the image as if it were an artist's canvas."),
"description",_("Textures the image as if it were an artist's canvas."),
NULL);
}
......
......@@ -22,11 +22,10 @@
#ifdef GEGL_PROPERTIES
gegl_property_double (value, _("Threshold"),
"description", _("Scalar threshold level (overriden if an auxiliary input buffer is provided.)."),
"default", 0.5, "min", -200.0, "max", 200.0,
"ui-min", -10.0, "ui-max", 10.0,
NULL)
property_double (value, _("Threshold"), 0.5)
value_range (-200, 200)
ui_range (-1, 2)
description(_("Scalar threshold level (overriden if an auxiliary input buffer is provided.)."))
#else
......
......@@ -25,19 +25,17 @@
#ifdef GEGL_PROPERTIES
gegl_property_int (tile_width, _("Tile Width"),
"default", 25, "min", 10, "max", 500,
"ui-max", 50,
"unit", "pixel-distance",
"axis", "x",
NULL)
gegl_property_int (tile_height, _("Tile Height"),
"default", 25, "min", 10, "max", 500,
"ui-max", 50,
"unit", "pixel-distance",
"axis", "y",
NULL)
property_int (tile_width, _("Tile Width"), 25)
value_range (5, 500)
ui_range (5, 50)
ui_meta ("unit", "pixel-distance")
ui_meta ("axis", "x")
property_int (tile_height, _("Tile Height"), 25)
value_range (5, 500)
ui_range (5, 50)
ui_meta ("unit", "pixel-distance")
ui_meta ("axis", "y")
#else
......
......@@ -21,15 +21,15 @@
#ifdef GEGL_PROPERTIES
gegl_property_int (offset_x, _("Horizontal offset"),
"unit", "pixel-coordinate",
"axis", "x",
NULL)
gegl_property_int (offset_y, _("Vertical offset"),
"unit", "pixel-coordinate",
"axis", "y",
NULL)
property_int (offset_x, _("Horizontal offset"), 0)
ui_range (0, 1024)
ui_meta ("unit", "pixel-coordinate")
ui_meta ("axis", "x")
property_int (offset_y, _("Vertical offset"), 0)
ui_range (0, 1024)
ui_meta ("unit", "pixel-coordinate")
ui_meta ("axis", "y")
#else
......
......@@ -21,18 +21,18 @@
#ifdef GEGL_PROPERTIES
gegl_property_double (std_dev, _("Std. Dev."),
"description", _("Standard deviation (spatial scale factor)"),
"default", 0.55, "min", 0.2, "max", 300.0,
"ui-min", 0.2, "ui-max", 10.0, "ui-gamma", 3.0,
"unit", "pixel-distance",
NULL)
gegl_property_double (scale, _("Scale"),
"description", _("Scale, strength of effect"),
"default", 4.0, "min", 0.0, "max", 300.0,
"ui-max", 10.0, "ui-gamma", 3.0,
NULL)
property_double (std_dev, _("Std. Dev."), 0.55)
description(_("Standard deviation (spatial scale factor)"))
value_range (0.2, 300)
ui_range (0.2, 40.0)
ui_gamma (3.0)
ui_meta ("unit", "pixel-distance")
property_double (scale, _("Scale"), 4.0)
description(_("Scale, strength of effect"))
value_range (0.0, 300.0)
ui_range (0.0, 10.0)
ui_gamma (3.0)
#else
......
......@@ -20,9 +20,9 @@
#include <glib/gi18n-lib.h>
#include <math.h>
#ifdef GEGL_CHANT_PROPERTIES
#ifdef GEGL_PROPERTIES
gegl_chant_register_enum (gegl_warp_behavior)
enum_start (gegl_warp_behavior)
enum_value (GEGL_WARP_BEHAVIOR_MOVE, "Move pixels")
enum_value (GEGL_WARP_BEHAVIOR_GROW, "Grow area")
enum_value (GEGL_WARP_BEHAVIOR_SHRINK, "Shrink area")
......@@ -30,32 +30,28 @@ gegl_chant_register_enum (gegl_warp_behavior)
enum_value (GEGL_WARP_BEHAVIOR_SWIRL_CCW, "Swirl counter-clockwise")
enum_value (GEGL_WARP_BEHAVIOR_ERASE, "Erase warping")
enum_value (GEGL_WARP_BEHAVIOR_SMOOTH, "Smooth warping")
gegl_chant_register_enum_end (GeglWarpBehavior)
enum_end (GeglWarpBehavior)
gegl_chant_double (strength, _("Strength"),
0.0, 100.0, 50,
_("Effect Strength"))
property_double (strength, _("Strength"), 50)
value_range (0, 100)
gegl_chant_double (size, _("Size"),
1.0, 10000.0, 40.0,
_("Effect Size"))
property_double (size, _("Size"), 40.0)
value_range (1.0, 10000.0)
gegl_chant_double (hardness, _("Hardness"),
0.0, 1.0, 0.5,
_("Effect Hardness"))
property_double (hardness, _("Hardness"), 0.5)
value_range (0.0, 1.0)
gegl_chant_path (stroke, _("Stroke"),
_("Effect Strength"))
property_path (stroke, _("Stroke"), NULL)
gegl_chant_enum (behavior, _("Behavior"),
property_enum (behavior, _("Behavior"),
GeglWarpBehavior, gegl_warp_behavior,
GEGL_WARP_BEHAVIOR_MOVE,
_("Behavior of the op"))
GEGL_WARP_BEHAVIOR_MOVE)
description (_("Behavior of the op"))
#else
#define GEGL_CHANT_TYPE_FILTER
#define GEGL_CHANT_C_FILE "warp.c"
#define GEGL_OP_FILTER
#define GEGL_OP_C_FILE "warp.c"
#include "gegl-plugin.h"
#include "gegl-path.h"
......@@ -63,7 +59,7 @@ gegl_chant_enum (behavior, _("Behavior"),
static void path_changed (GeglPath *path,
const GeglRectangle *roi,
gpointer userdata);
#include "gegl-chant.h"
#include "gegl-op.h"
typedef struct {
gdouble *lookup;
......@@ -79,7 +75,7 @@ path_changed (GeglPath *path,
gpointer userdata)
{
GeglRectangle rect = *roi;
GeglChantO *o = GEGL_CHANT_PROPERTIES (userdata);
GeglProperties *o = GEGL_PROPERTIES (userdata);
/* invalidate the incoming rectangle */
rect.x -= o->size/2;
......@@ -93,19 +89,19 @@ path_changed (GeglPath *path,
static void
prepare (GeglOperation *operation)
{
GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
GeglProperties *o = GEGL_PROPERTIES (operation);
WarpPrivate *priv;
const Babl *format = babl_format_n (babl_type ("float"), 2);
gegl_operation_set_format (operation, "input", format);
gegl_operation_set_format (operation, "output", format);
if (!o->chant_data)
if (!o->user_data)
{
o->chant_data = g_slice_new (WarpPrivate);
o->user_data = g_slice_new (WarpPrivate);
}
priv = (WarpPrivate*) o->chant_data;
priv = (WarpPrivate*) o->user_data;
priv->last_point_set = FALSE;
priv->lookup = NULL;
priv->buffer = NULL;
......@@ -114,15 +110,15 @@ prepare (GeglOperation *operation)
static void
finalize (GObject *object)
{
GeglChantO *o = GEGL_CHANT_PROPERTIES (object);
GeglProperties *o = GEGL_PROPERTIES (object);
if (o->chant_data)
if (o->user_data)
{
g_slice_free (WarpPrivate, o->chant_data);
o->chant_data = NULL;
g_slice_free (WarpPrivate, o->user_data);
o->user_data = NULL;
}
G_OBJECT_CLASS (gegl_chant_parent_class)->finalize (object);
G_OBJECT_CLASS (gegl_op_parent_class)->finalize (object);
}
static gdouble
......@@ -153,9 +149,9 @@ gauss (gdouble f)
/* set up lookup table */
static void
calc_lut (GeglChantO *o)
calc_lut (GeglProperties *o)
{
WarpPrivate *priv = (WarpPrivate*) o->chant_data;
WarpPrivate *priv = (WarpPrivate*) o->user_data;
gint length;
gint x;
gdouble exponent;
......@@ -176,11 +172,11 @@ calc_lut (GeglChantO *o)
}
static gdouble
get_stamp_force (GeglChantO *o,
get_stamp_force (GeglProperties *o,
gdouble x,
gdouble y)
{
WarpPrivate *priv = (WarpPrivate*) o->chant_data;
WarpPrivate *priv = (WarpPrivate*) o->user_data;
gfloat radius;
if (!priv->lookup)
......@@ -210,12 +206,12 @@ get_stamp_force (GeglChantO *o,
}
static void
stamp (GeglChantO *o,
stamp (GeglProperties *o,
const GeglRectangle *result,
gdouble x,
gdouble y)
{
WarpPrivate *priv = (WarpPrivate*) o->chant_data;
WarpPrivate *priv = (WarpPrivate*) o->user_data;
GeglBufferIterator *it;
const Babl *format;
gdouble influence;
......@@ -341,8 +337,8 @@ process (GeglOperation *operation,
const GeglRectangle *result,
gint level)
{
GeglChantO *o = GEGL_CHANT_PROPERTIES (operation);
WarpPrivate *priv = (WarpPrivate*) o->chant_data;
GeglProperties *o = GEGL_PROPERTIES (operation);
WarpPrivate *priv = (WarpPrivate*) o->user_data;
gdouble dist;
gdouble stamps;
gdouble spacing = MAX (o->size * 0.01, 0.5); /*1% spacing for starters*/
......@@ -399,7 +395,7 @@ process (GeglOperation *operation,
}
static void
gegl_chant_class_init (GeglChantClass *klass)
gegl_op_class_init (GeglOpClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GeglOperationClass *operation_class = GEGL_OPERATION_CLASS (klass);
......
......@@ -33,23 +33,19 @@
#ifdef GEGL_PROPERTIES
gegl_property_double (whirl, _("Whirl"),
"description", _("Whirl angle (degrees)"),
"default", 90.0,
"ui-min", -720.0, "ui-max", 720.0,