Switch to using GimpDynamicsOutput's properties

* app/core/gimpdynamics.c: remove all boolean properties and add the
  outputs as properties instead. Make sure changes on the outputs get
  notified on the dynamics object.

* app/widgets/gimpdynamicseditor.c: change widget creation accordingly,
  also copy around the properties correctly when copying between
  dynamics objects (fixes NULL filenames on GimpData).
This commit is contained in:
Michael Natterer 2009-10-11 21:25:28 +02:00
parent c794fe0af2
commit 8df73b9323
2 changed files with 252 additions and 807 deletions

View File

@ -35,119 +35,20 @@
#define DEFAULT_NAME "Nameless dynamics"
#define DEFAULT_PRESSURE_OPACITY TRUE
#define DEFAULT_PRESSURE_HARDNESS FALSE
#define DEFAULT_PRESSURE_RATE FALSE
#define DEFAULT_PRESSURE_SIZE FALSE
#define DEFAULT_PRESSURE_ASPECT_RATIO FALSE
#define DEFAULT_PRESSURE_COLOR FALSE
#define DEFAULT_PRESSURE_ANGLE FALSE
#define DEFAULT_PRESSURE_JITTER FALSE
#define DEFAULT_VELOCITY_OPACITY FALSE
#define DEFAULT_VELOCITY_HARDNESS FALSE
#define DEFAULT_VELOCITY_RATE FALSE
#define DEFAULT_VELOCITY_SIZE FALSE
#define DEFAULT_VELOCITY_ASPECT_RATIO FALSE
#define DEFAULT_VELOCITY_COLOR FALSE
#define DEFAULT_VELOCITY_ANGLE FALSE
#define DEFAULT_VELOCITY_JITTER TRUE
#define DEFAULT_DIRECTION_OPACITY FALSE
#define DEFAULT_DIRECTION_HARDNESS FALSE
#define DEFAULT_DIRECTION_RATE FALSE
#define DEFAULT_DIRECTION_SIZE FALSE
#define DEFAULT_DIRECTION_ASPECT_RATIO FALSE
#define DEFAULT_DIRECTION_COLOR FALSE
#define DEFAULT_DIRECTION_ANGLE FALSE
#define DEFAULT_DIRECTION_JITTER FALSE
#define DEFAULT_TILT_OPACITY FALSE
#define DEFAULT_TILT_HARDNESS FALSE
#define DEFAULT_TILT_RATE FALSE
#define DEFAULT_TILT_SIZE FALSE
#define DEFAULT_TILT_ASPECT_RATIO FALSE
#define DEFAULT_TILT_COLOR FALSE
#define DEFAULT_TILT_ANGLE FALSE
#define DEFAULT_TILT_JITTER FALSE
#define DEFAULT_RANDOM_OPACITY FALSE
#define DEFAULT_RANDOM_HARDNESS FALSE
#define DEFAULT_RANDOM_RATE FALSE
#define DEFAULT_RANDOM_SIZE FALSE
#define DEFAULT_RANDOM_ASPECT_RATIO FALSE
#define DEFAULT_RANDOM_COLOR FALSE
#define DEFAULT_RANDOM_ANGLE FALSE
#define DEFAULT_RANDOM_JITTER FALSE
#define DEFAULT_FADING_OPACITY FALSE
#define DEFAULT_FADING_HARDNESS FALSE
#define DEFAULT_FADING_RATE FALSE
#define DEFAULT_FADING_SIZE FALSE
#define DEFAULT_FADING_ASPECT_RATIO FALSE
#define DEFAULT_FADING_COLOR FALSE
#define DEFAULT_FADING_ANGLE FALSE
#define DEFAULT_FADING_JITTER FALSE
enum
{
PROP_0,
PROP_NAME,
PROP_PRESSURE_OPACITY,
PROP_PRESSURE_HARDNESS,
PROP_PRESSURE_RATE,
PROP_PRESSURE_SIZE,
PROP_PRESSURE_ASPECT_RATIO,
PROP_PRESSURE_COLOR,
PROP_PRESSURE_ANGLE,
PROP_PRESSURE_JITTER,
PROP_VELOCITY_OPACITY,
PROP_VELOCITY_HARDNESS,
PROP_VELOCITY_RATE,
PROP_VELOCITY_SIZE,
PROP_VELOCITY_ASPECT_RATIO,
PROP_VELOCITY_COLOR,
PROP_VELOCITY_ANGLE,
PROP_VELOCITY_JITTER,
PROP_DIRECTION_OPACITY,
PROP_DIRECTION_HARDNESS,
PROP_DIRECTION_RATE,
PROP_DIRECTION_SIZE,
PROP_DIRECTION_ASPECT_RATIO,
PROP_DIRECTION_COLOR,
PROP_DIRECTION_ANGLE,
PROP_DIRECTION_JITTER,
PROP_TILT_OPACITY,
PROP_TILT_HARDNESS,
PROP_TILT_RATE,
PROP_TILT_SIZE,
PROP_TILT_ASPECT_RATIO,
PROP_TILT_COLOR,
PROP_TILT_ANGLE,
PROP_TILT_JITTER,
PROP_RANDOM_OPACITY,
PROP_RANDOM_HARDNESS,
PROP_RANDOM_RATE,
PROP_RANDOM_SIZE,
PROP_RANDOM_ASPECT_RATIO,
PROP_RANDOM_COLOR,
PROP_RANDOM_ANGLE,
PROP_RANDOM_JITTER,
PROP_FADING_OPACITY,
PROP_FADING_HARDNESS,
PROP_FADING_RATE,
PROP_FADING_SIZE,
PROP_FADING_ASPECT_RATIO,
PROP_FADING_COLOR,
PROP_FADING_ANGLE,
PROP_FADING_JITTER
PROP_OPACITY_OUTPUT,
PROP_HARDNESS_OUTPUT,
PROP_RATE_OUTPUT,
PROP_SIZE_OUTPUT,
PROP_ASPECT_RATIO_OUTPUT,
PROP_COLOR_OUTPUT,
PROP_ANGLE_OUTPUT,
PROP_JITTER_OUTPUT
};
@ -163,11 +64,17 @@ static void gimp_dynamics_get_property (GObject *object,
static const gchar * gimp_dynamics_get_extension (GimpData *data);
static GimpDynamicsOutput *
gimp_dynamics_create_output (GimpDynamics *dynamics,
const gchar *name);
static void gimp_dynamics_output_notify (GObject *output,
const GParamSpec *pspec,
GimpDynamics *dynamics);
G_DEFINE_TYPE (GimpDynamics, gimp_dynamics,
GIMP_TYPE_DATA)
#define parent_class gimp_dynamics_parent_class
@ -189,220 +96,68 @@ gimp_dynamics_class_init (GimpDynamicsClass *klass)
DEFAULT_NAME,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_PRESSURE_OPACITY,
"pressure-opacity", NULL,
DEFAULT_PRESSURE_OPACITY,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_PRESSURE_HARDNESS,
"pressure-hardness", NULL,
DEFAULT_PRESSURE_HARDNESS,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_PRESSURE_RATE,
"pressure-rate", NULL,
DEFAULT_PRESSURE_RATE,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_PRESSURE_SIZE,
"pressure-size", NULL,
DEFAULT_PRESSURE_SIZE,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_PRESSURE_COLOR,
"pressure-color", NULL,
DEFAULT_PRESSURE_COLOR,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_PRESSURE_ANGLE,
"pressure-angle", NULL,
DEFAULT_PRESSURE_COLOR,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_PRESSURE_ASPECT_RATIO,
"pressure-aspect-ratio", NULL,
DEFAULT_PRESSURE_ASPECT_RATIO,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_PRESSURE_JITTER,
"pressure-jitter", NULL,
DEFAULT_PRESSURE_JITTER,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_OBJECT (object_class, PROP_OPACITY_OUTPUT,
"opacity-output", NULL,
GIMP_TYPE_DYNAMICS_OUTPUT,
GIMP_CONFIG_PARAM_AGGREGATE);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_VELOCITY_OPACITY,
"velocity-opacity", NULL,
DEFAULT_VELOCITY_OPACITY,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_VELOCITY_HARDNESS,
"velocity-hardness", NULL,
DEFAULT_VELOCITY_HARDNESS,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_VELOCITY_RATE,
"velocity-rate", NULL,
DEFAULT_VELOCITY_RATE,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_VELOCITY_SIZE,
"velocity-size", NULL,
DEFAULT_VELOCITY_SIZE,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_VELOCITY_COLOR,
"velocity-color", NULL,
DEFAULT_VELOCITY_COLOR,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_VELOCITY_ANGLE,
"velocity-angle", NULL,
DEFAULT_VELOCITY_COLOR,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_VELOCITY_ASPECT_RATIO,
"velocity-aspect-ratio", NULL,
DEFAULT_VELOCITY_ASPECT_RATIO,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_VELOCITY_JITTER,
"velocity-jitter", NULL,
DEFAULT_VELOCITY_JITTER,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_OBJECT (object_class, PROP_HARDNESS_OUTPUT,
"hardness-output", NULL,
GIMP_TYPE_DYNAMICS_OUTPUT,
GIMP_CONFIG_PARAM_AGGREGATE);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_DIRECTION_OPACITY,
"direction-opacity", NULL,
DEFAULT_DIRECTION_OPACITY,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_DIRECTION_HARDNESS,
"direction-hardness", NULL,
DEFAULT_DIRECTION_HARDNESS,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_DIRECTION_RATE,
"direction-rate", NULL,
DEFAULT_DIRECTION_RATE,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_DIRECTION_SIZE,
"direction-size", NULL,
DEFAULT_DIRECTION_SIZE,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_DIRECTION_COLOR,
"direction-color", NULL,
DEFAULT_DIRECTION_COLOR,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_DIRECTION_ANGLE,
"direction-angle", NULL,
DEFAULT_DIRECTION_ANGLE,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_DIRECTION_ASPECT_RATIO,
"direction-aspect-ratio", NULL,
DEFAULT_DIRECTION_ASPECT_RATIO,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_DIRECTION_JITTER,
"direction-jitter", NULL,
DEFAULT_DIRECTION_JITTER,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_OBJECT (object_class, PROP_RATE_OUTPUT,
"rate-output", NULL,
GIMP_TYPE_DYNAMICS_OUTPUT,
GIMP_CONFIG_PARAM_AGGREGATE);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_TILT_OPACITY,
"tilt-opacity", NULL,
DEFAULT_TILT_OPACITY,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_TILT_HARDNESS,
"tilt-hardness", NULL,
DEFAULT_TILT_HARDNESS,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_TILT_RATE,
"tilt-rate", NULL,
DEFAULT_TILT_RATE,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_TILT_SIZE,
"tilt-size", NULL,
DEFAULT_TILT_SIZE,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_TILT_COLOR,
"tilt-color", NULL,
DEFAULT_TILT_COLOR,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_TILT_ANGLE,
"tilt-angle", NULL,
DEFAULT_TILT_ANGLE,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_TILT_ASPECT_RATIO,
"tilt-aspect-ratio", NULL,
DEFAULT_TILT_ASPECT_RATIO,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_TILT_JITTER,
"tilt-jitter", NULL,
DEFAULT_TILT_JITTER,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_OBJECT (object_class, PROP_SIZE_OUTPUT,
"size-output", NULL,
GIMP_TYPE_DYNAMICS_OUTPUT,
GIMP_CONFIG_PARAM_AGGREGATE);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_RANDOM_OPACITY,
"random-opacity", NULL,
DEFAULT_RANDOM_OPACITY,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_RANDOM_HARDNESS,
"random-hardness", NULL,
DEFAULT_RANDOM_HARDNESS,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_RANDOM_RATE,
"random-rate", NULL,
DEFAULT_RANDOM_RATE,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_RANDOM_SIZE,
"random-size", NULL,
DEFAULT_RANDOM_SIZE,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_RANDOM_COLOR,
"random-color", NULL,
DEFAULT_RANDOM_COLOR,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_RANDOM_ANGLE,
"random-angle", NULL,
DEFAULT_RANDOM_ANGLE,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_RANDOM_ASPECT_RATIO,
"random-aspect-ratio", NULL,
DEFAULT_RANDOM_ASPECT_RATIO,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_RANDOM_JITTER,
"random-jitter", NULL,
DEFAULT_RANDOM_JITTER,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_OBJECT (object_class, PROP_ASPECT_RATIO_OUTPUT,
"aspect-ratio-output", NULL,
GIMP_TYPE_DYNAMICS_OUTPUT,
GIMP_CONFIG_PARAM_AGGREGATE);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_FADING_OPACITY,
"fading-opacity", NULL,
DEFAULT_FADING_OPACITY,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_FADING_HARDNESS,
"fading-hardness", NULL,
DEFAULT_FADING_HARDNESS,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_FADING_RATE,
"fading-rate", NULL,
DEFAULT_FADING_RATE,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_FADING_SIZE,
"fading-size", NULL,
DEFAULT_FADING_SIZE,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_FADING_COLOR,
"fading-color", NULL,
DEFAULT_FADING_COLOR,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_FADING_ANGLE,
"fading-angle", NULL,
DEFAULT_FADING_ANGLE,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_FADING_ASPECT_RATIO,
"fading-aspect-ratio", NULL,
DEFAULT_FADING_ASPECT_RATIO,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_FADING_JITTER,
"fading-jitter", NULL,
DEFAULT_FADING_JITTER,
GIMP_PARAM_STATIC_STRINGS);
GIMP_CONFIG_INSTALL_PROP_OBJECT (object_class, PROP_COLOR_OUTPUT,
"color-output", NULL,
GIMP_TYPE_DYNAMICS_OUTPUT,
GIMP_CONFIG_PARAM_AGGREGATE);
GIMP_CONFIG_INSTALL_PROP_OBJECT (object_class, PROP_ANGLE_OUTPUT,
"angle-output", NULL,
GIMP_TYPE_DYNAMICS_OUTPUT,
GIMP_CONFIG_PARAM_AGGREGATE);
GIMP_CONFIG_INSTALL_PROP_OBJECT (object_class, PROP_JITTER_OUTPUT,
"jitter-output", NULL,
GIMP_TYPE_DYNAMICS_OUTPUT,
GIMP_CONFIG_PARAM_AGGREGATE);
}
static void
gimp_dynamics_init (GimpDynamics *dynamics)
{
dynamics->opacity_dynamics = gimp_dynamics_output_new ("");
dynamics->hardness_dynamics = gimp_dynamics_output_new ("");
dynamics->rate_dynamics = gimp_dynamics_output_new ("");
dynamics->size_dynamics = gimp_dynamics_output_new ("");
dynamics->aspect_ratio_dynamics = gimp_dynamics_output_new ("");
dynamics->color_dynamics = gimp_dynamics_output_new ("");
dynamics->angle_dynamics = gimp_dynamics_output_new ("");
dynamics->jitter_dynamics = gimp_dynamics_output_new ("");
dynamics->opacity_dynamics = gimp_dynamics_create_output (dynamics,
"opacity-output");
dynamics->hardness_dynamics = gimp_dynamics_create_output (dynamics,
"hardness-output");
dynamics->rate_dynamics = gimp_dynamics_create_output (dynamics,
"rate-output");
dynamics->size_dynamics = gimp_dynamics_create_output (dynamics,
"size-output");
dynamics->aspect_ratio_dynamics = gimp_dynamics_create_output (dynamics,
"aspect-ratio-output");
dynamics->color_dynamics = gimp_dynamics_create_output (dynamics,
"color-output");
dynamics->angle_dynamics = gimp_dynamics_create_output (dynamics,
"angle-output");
dynamics->jitter_dynamics = gimp_dynamics_create_output (dynamics,
"jitter-output");
}
static void
gimp_dynamics_finalize (GObject *object)
{
@ -427,14 +182,8 @@ gimp_dynamics_set_property (GObject *object,
GParamSpec *pspec)
{
GimpDynamics *dynamics = GIMP_DYNAMICS (object);
GimpDynamicsOutput *opacity_dynamics = dynamics->opacity_dynamics;
GimpDynamicsOutput *hardness_dynamics = dynamics->hardness_dynamics;
GimpDynamicsOutput *rate_dynamics = dynamics->rate_dynamics;
GimpDynamicsOutput *size_dynamics = dynamics->size_dynamics;
GimpDynamicsOutput *aspect_ratio_dynamics = dynamics->aspect_ratio_dynamics;
GimpDynamicsOutput *color_dynamics = dynamics->color_dynamics;
GimpDynamicsOutput *angle_dynamics = dynamics->angle_dynamics;
GimpDynamicsOutput *jitter_dynamics = dynamics->jitter_dynamics;
GimpDynamicsOutput *src_output = NULL;
GimpDynamicsOutput *dest_output = NULL;
switch (property_id)
{
@ -442,203 +191,57 @@ gimp_dynamics_set_property (GObject *object,
gimp_object_set_name (GIMP_OBJECT (dynamics), g_value_get_string (value));
break;
case PROP_PRESSURE_OPACITY:
opacity_dynamics->pressure = g_value_get_boolean (value);
case PROP_OPACITY_OUTPUT:
src_output = g_value_get_object (value);
dest_output = dynamics->opacity_dynamics;
break;
case PROP_PRESSURE_HARDNESS:
hardness_dynamics->pressure = g_value_get_boolean (value);
case PROP_HARDNESS_OUTPUT:
src_output = g_value_get_object (value);
dest_output = dynamics->hardness_dynamics;
break;
case PROP_PRESSURE_RATE:
rate_dynamics->pressure = g_value_get_boolean (value);
case PROP_RATE_OUTPUT:
src_output = g_value_get_object (value);
dest_output = dynamics->rate_dynamics;
break;
case PROP_PRESSURE_SIZE:
size_dynamics->pressure = g_value_get_boolean (value);
case PROP_SIZE_OUTPUT:
src_output = g_value_get_object (value);
dest_output = dynamics->size_dynamics;
break;
case PROP_PRESSURE_ASPECT_RATIO:
aspect_ratio_dynamics->pressure = g_value_get_boolean (value);
case PROP_ASPECT_RATIO_OUTPUT:
src_output = g_value_get_object (value);
dest_output = dynamics->aspect_ratio_dynamics;
break;
case PROP_PRESSURE_COLOR:
color_dynamics->pressure = g_value_get_boolean (value);
case PROP_COLOR_OUTPUT:
src_output = g_value_get_object (value);
dest_output = dynamics->color_dynamics;
break;
case PROP_PRESSURE_ANGLE:
angle_dynamics->pressure = g_value_get_boolean (value);
case PROP_ANGLE_OUTPUT:
src_output = g_value_get_object (value);
dest_output = dynamics->angle_dynamics;
break;
case PROP_PRESSURE_JITTER:
jitter_dynamics->pressure = g_value_get_boolean (value);
case PROP_JITTER_OUTPUT:
src_output = g_value_get_object (value);
dest_output = dynamics->jitter_dynamics;
break;
case PROP_VELOCITY_OPACITY:
opacity_dynamics->velocity = g_value_get_boolean (value);
break;
case PROP_VELOCITY_HARDNESS:
hardness_dynamics->velocity = g_value_get_boolean (value);
break;
case PROP_VELOCITY_RATE:
rate_dynamics->velocity = g_value_get_boolean (value);
break;
case PROP_VELOCITY_SIZE:
size_dynamics->velocity = g_value_get_boolean (value);
break;
case PROP_VELOCITY_ASPECT_RATIO:
aspect_ratio_dynamics->velocity = g_value_get_boolean (value);
break;
case PROP_VELOCITY_COLOR:
color_dynamics->velocity = g_value_get_boolean (value);
break;
case PROP_VELOCITY_ANGLE:
angle_dynamics->velocity = g_value_get_boolean (value);
break;
case PROP_VELOCITY_JITTER:
jitter_dynamics->velocity = g_value_get_boolean (value);
break;
case PROP_DIRECTION_OPACITY:
opacity_dynamics->direction = g_value_get_boolean (value);
break;
case PROP_DIRECTION_HARDNESS:
hardness_dynamics->direction = g_value_get_boolean (value);
break;
case PROP_DIRECTION_RATE:
rate_dynamics->direction = g_value_get_boolean (value);
break;
case PROP_DIRECTION_SIZE:
size_dynamics->direction = g_value_get_boolean (value);
break;
case PROP_DIRECTION_ASPECT_RATIO:
aspect_ratio_dynamics->direction = g_value_get_boolean (value);
break;
case PROP_DIRECTION_COLOR:
color_dynamics->direction = g_value_get_boolean (value);
break;
case PROP_DIRECTION_ANGLE:
angle_dynamics->direction = g_value_get_boolean (value);
break;
case PROP_DIRECTION_JITTER:
jitter_dynamics->direction = g_value_get_boolean (value);
break;
case PROP_TILT_OPACITY:
opacity_dynamics->tilt = g_value_get_boolean (value);
break;
case PROP_TILT_HARDNESS:
hardness_dynamics->tilt = g_value_get_boolean (value);
break;
case PROP_TILT_RATE:
rate_dynamics->tilt = g_value_get_boolean (value);
break;
case PROP_TILT_SIZE:
size_dynamics->tilt = g_value_get_boolean (value);
break;
case PROP_TILT_ASPECT_RATIO:
aspect_ratio_dynamics->tilt = g_value_get_boolean (value);
break;
case PROP_TILT_COLOR:
color_dynamics->tilt = g_value_get_boolean (value);
break;
case PROP_TILT_ANGLE:
angle_dynamics->tilt = g_value_get_boolean (value);
break;
case PROP_TILT_JITTER:
jitter_dynamics->tilt = g_value_get_boolean (value);
break;
case PROP_RANDOM_OPACITY:
opacity_dynamics->random = g_value_get_boolean (value);
break;
case PROP_RANDOM_HARDNESS:
hardness_dynamics->random = g_value_get_boolean (value);
break;
case PROP_RANDOM_RATE:
rate_dynamics->random = g_value_get_boolean (value);
break;
case PROP_RANDOM_SIZE:
size_dynamics->random = g_value_get_boolean (value);
break;
case PROP_RANDOM_ASPECT_RATIO:
aspect_ratio_dynamics->random = g_value_get_boolean (value);
break;
case PROP_RANDOM_COLOR:
color_dynamics->random = g_value_get_boolean (value);
break;
case PROP_RANDOM_ANGLE:
angle_dynamics->random = g_value_get_boolean (value);
break;
case PROP_RANDOM_JITTER:
jitter_dynamics->random = g_value_get_boolean (value);
break;
case PROP_FADING_OPACITY:
opacity_dynamics->fade = g_value_get_boolean (value);
break;
case PROP_FADING_HARDNESS:
hardness_dynamics->fade = g_value_get_boolean (value);
break;
case PROP_FADING_RATE:
rate_dynamics->fade = g_value_get_boolean (value);
break;
case PROP_FADING_SIZE:
size_dynamics->fade = g_value_get_boolean (value);
break;
case PROP_FADING_ASPECT_RATIO:
aspect_ratio_dynamics->fade = g_value_get_boolean (value);
break;
case PROP_FADING_COLOR:
color_dynamics->fade = g_value_get_boolean (value);
break;
case PROP_FADING_ANGLE:
angle_dynamics->fade = g_value_get_boolean (value);
break;
case PROP_FADING_JITTER:
jitter_dynamics->fade = g_value_get_boolean (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
}
if (src_output && dest_output)
{
gimp_config_copy (GIMP_CONFIG (src_output),
GIMP_CONFIG (dest_output),
GIMP_CONFIG_PARAM_SERIALIZE);
}
}
static void
@ -648,14 +251,6 @@ gimp_dynamics_get_property (GObject *object,
GParamSpec *pspec)
{
GimpDynamics *dynamics = GIMP_DYNAMICS (object);
GimpDynamicsOutput *opacity_dynamics = dynamics->opacity_dynamics;
GimpDynamicsOutput *hardness_dynamics = dynamics->hardness_dynamics;
GimpDynamicsOutput *rate_dynamics = dynamics->rate_dynamics;
GimpDynamicsOutput *size_dynamics = dynamics->size_dynamics;
GimpDynamicsOutput *aspect_ratio_dynamics = dynamics->aspect_ratio_dynamics;
GimpDynamicsOutput *color_dynamics = dynamics->color_dynamics;
GimpDynamicsOutput *angle_dynamics = dynamics->angle_dynamics;
GimpDynamicsOutput *jitter_dynamics = dynamics->jitter_dynamics;
switch (property_id)
{
@ -663,199 +258,36 @@ gimp_dynamics_get_property (GObject *object,
g_value_set_string (value, gimp_object_get_name (dynamics));
break;
case PROP_PRESSURE_OPACITY:
g_value_set_boolean (value, opacity_dynamics->pressure);
case PROP_OPACITY_OUTPUT:
g_value_set_object (value, dynamics->opacity_dynamics);
break;
case PROP_PRESSURE_HARDNESS:
g_value_set_boolean (value, hardness_dynamics->pressure);
case PROP_HARDNESS_OUTPUT:
g_value_set_object (value, dynamics->hardness_dynamics);
break;
case PROP_PRESSURE_RATE:
g_value_set_boolean (value, rate_dynamics->pressure);
case PROP_RATE_OUTPUT:
g_value_set_object (value, dynamics->rate_dynamics);
break;
case PROP_PRESSURE_SIZE:
g_value_set_boolean (value, size_dynamics->pressure);
case PROP_SIZE_OUTPUT:
g_value_set_object (value, dynamics->size_dynamics);
break;
case PROP_PRESSURE_ASPECT_RATIO:
g_value_set_boolean (value, aspect_ratio_dynamics->pressure);
case PROP_ASPECT_RATIO_OUTPUT:
g_value_set_object (value, dynamics->aspect_ratio_dynamics);
break;
case PROP_PRESSURE_COLOR:
g_value_set_boolean (value, color_dynamics->pressure);
case PROP_COLOR_OUTPUT:
g_value_set_object (value, dynamics->color_dynamics);
break;
case PROP_PRESSURE_ANGLE:
g_value_set_boolean (value, angle_dynamics->pressure);
case PROP_ANGLE_OUTPUT:
g_value_set_object (value, dynamics->angle_dynamics);
break;
case PROP_PRESSURE_JITTER:
g_value_set_boolean (value, jitter_dynamics->pressure);
break;
case PROP_VELOCITY_OPACITY:
g_value_set_boolean (value, opacity_dynamics->velocity);
break;
case PROP_VELOCITY_HARDNESS:
g_value_set_boolean (value, hardness_dynamics->velocity);
break;
case PROP_VELOCITY_RATE:
g_value_set_boolean (value, rate_dynamics->velocity);
break;
case PROP_VELOCITY_SIZE:
g_value_set_boolean (value, size_dynamics->velocity);
break;
case PROP_VELOCITY_ASPECT_RATIO:
g_value_set_boolean (value, aspect_ratio_dynamics->velocity);
break;
case PROP_VELOCITY_COLOR:
g_value_set_boolean (value, color_dynamics->velocity);
break;
case PROP_VELOCITY_ANGLE:
g_value_set_boolean (value, angle_dynamics->velocity);
break;
case PROP_VELOCITY_JITTER:
g_value_set_boolean (value, jitter_dynamics->velocity);
break;
case PROP_DIRECTION_OPACITY:
g_value_set_boolean (value, opacity_dynamics->direction);
break;
case PROP_DIRECTION_HARDNESS:
g_value_set_boolean (value, hardness_dynamics->direction);
break;
case PROP_DIRECTION_RATE:
g_value_set_boolean (value, rate_dynamics->direction);
break;
case PROP_DIRECTION_SIZE:
g_value_set_boolean (value, size_dynamics->direction);
break;
case PROP_DIRECTION_ASPECT_RATIO:
g_value_set_boolean (value, aspect_ratio_dynamics->direction);
break;
case PROP_DIRECTION_COLOR:
g_value_set_boolean (value, color_dynamics->direction);
break;
case PROP_DIRECTION_ANGLE:
g_value_set_boolean (value, angle_dynamics->direction);
break;
case PROP_DIRECTION_JITTER:
g_value_set_boolean (value, jitter_dynamics->direction);
break;
case PROP_TILT_OPACITY:
g_value_set_boolean (value, opacity_dynamics->tilt);
break;
case PROP_TILT_HARDNESS:
g_value_set_boolean (value, hardness_dynamics->tilt);
break;
case PROP_TILT_RATE:
g_value_set_boolean (value, rate_dynamics->tilt);
break;
case PROP_TILT_SIZE:
g_value_set_boolean (value, size_dynamics->tilt);
break;
case PROP_TILT_ASPECT_RATIO:
g_value_set_boolean (value, aspect_ratio_dynamics->tilt);
break;
case PROP_TILT_COLOR:
g_value_set_boolean (value, color_dynamics->tilt);
break;
case PROP_TILT_ANGLE:
g_value_set_boolean (value, angle_dynamics->tilt);
break;
case PROP_TILT_JITTER:
g_value_set_boolean (value, jitter_dynamics->tilt);
break;
case PROP_RANDOM_OPACITY:
g_value_set_boolean (value, opacity_dynamics->random);
break;
case PROP_RANDOM_HARDNESS:
g_value_set_boolean (value, hardness_dynamics->random);
break;
case PROP_RANDOM_RATE:
g_value_set_boolean (value, rate_dynamics->random);
break;
case PROP_RANDOM_SIZE:
g_value_set_boolean (value, size_dynamics->random);
break;
case PROP_RANDOM_ASPECT_RATIO:
g_value_set_boolean (value, aspect_ratio_dynamics->random);
break;
case PROP_RANDOM_COLOR:
g_value_set_boolean (value, color_dynamics->random);
break;
case PROP_RANDOM_ANGLE:
g_value_set_boolean (value, angle_dynamics->random);
break;
case PROP_RANDOM_JITTER:
g_value_set_boolean (value, jitter_dynamics->random);
break;
/*fading*/
case PROP_FADING_OPACITY:
g_value_set_boolean (value, opacity_dynamics->fade);
break;
case PROP_FADING_HARDNESS:
g_value_set_boolean (value, hardness_dynamics->fade);
break;
case PROP_FADING_RATE:
g_value_set_boolean (value, rate_dynamics->fade);
break;
case PROP_FADING_SIZE:
g_value_set_boolean (value, size_dynamics->fade);
break;
case PROP_FADING_ASPECT_RATIO:
g_value_set_boolean (value, aspect_ratio_dynamics->fade);
break;
case PROP_FADING_COLOR:
g_value_set_boolean (value, color_dynamics->fade);
break;
case PROP_FADING_ANGLE:
g_value_set_boolean (value, angle_dynamics->fade);
break;
case PROP_FADING_JITTER:
g_value_set_boolean (value, jitter_dynamics->fade);
case PROP_JITTER_OUTPUT:
g_value_set_object (value, dynamics->jitter_dynamics);
break;
default:
@ -864,6 +296,15 @@ gimp_dynamics_get_property (GObject *object,
}
}
static const gchar *
gimp_dynamics_get_extension (GimpData *data)
{
return GIMP_DYNAMICS_FILE_EXTENSION;
}
/* public functions */
GimpData *
gimp_dynamics_new (const gchar *name)
{
@ -891,12 +332,6 @@ gimp_dynamics_get_standard (void)
return standard_dynamics;
}
static const gchar *
gimp_dynamics_get_extension (GimpData *data)
{
return GIMP_DYNAMICS_FILE_EXTENSION;
}
gboolean
gimp_dynamics_input_fade_enabled (GimpDynamics *dynamics)
{
@ -909,3 +344,27 @@ gimp_dynamics_input_fade_enabled (GimpDynamics *dynamics)
dynamics->jitter_dynamics->fade ||
dynamics->angle_dynamics->fade);
}
/* private functions */
static GimpDynamicsOutput *
gimp_dynamics_create_output (GimpDynamics *dynamics,
const gchar *name)
{
GimpDynamicsOutput *output = gimp_dynamics_output_new (name);
g_signal_connect (output, "notify",
G_CALLBACK (gimp_dynamics_output_notify),
dynamics);
return output;
}
static void
gimp_dynamics_output_notify (GObject *output,
const GParamSpec *pspec,
GimpDynamics *dynamics)
{
g_object_notify (G_OBJECT (dynamics), gimp_object_get_name (output));
}

View File

@ -70,8 +70,7 @@ static void gimp_dynamics_editor_notify_data (GimpDynamics *options,
GimpDynamicsEditor *editor);
static void dynamics_output_maping_row_gui (GObject *config,
const gchar *property_name_part,
const gchar *property_label,
const gchar *row_label,
GtkTable *table,
gint row,
GtkWidget *labels[]);
@ -161,67 +160,59 @@ gimp_dynamics_editor_init (GimpDynamicsEditor *editor)
gtk_container_add (GTK_CONTAINER (vbox), inner_frame);
gtk_widget_show (inner_frame);
table = gtk_table_new (9, n_dynamics + 2, FALSE);
gtk_container_add (GTK_CONTAINER (inner_frame), table);
gtk_widget_show (table);
dynamics_output_maping_row_gui(G_OBJECT(editor->dynamics_model),
"opacity",
dynamics_output_maping_row_gui (G_OBJECT (dynamics->opacity_dynamics),
_("Opacity"),
table,
GTK_TABLE (table),
1,
dynamics_labels);
dynamics_output_maping_row_gui(G_OBJECT(editor->dynamics_model),
"hardness",
dynamics_output_maping_row_gui (G_OBJECT (dynamics->hardness_dynamics),
_("Hardness"),
table,
GTK_TABLE (table),
2,
dynamics_labels);
NULL);
dynamics_output_maping_row_gui(G_OBJECT(editor->dynamics_model),
"rate",
dynamics_output_maping_row_gui (G_OBJECT (dynamics->rate_dynamics),
_("Rate"),
table,
GTK_TABLE (table),
3,
dynamics_labels);
NULL);
dynamics_output_maping_row_gui(G_OBJECT(editor->dynamics_model),
"size",
dynamics_output_maping_row_gui (G_OBJECT (dynamics->size_dynamics),
_("Size"),
table,
GTK_TABLE (table),
4,
dynamics_labels);
NULL);
dynamics_output_maping_row_gui(G_OBJECT(editor->dynamics_model),
"aspect-ratio",
dynamics_output_maping_row_gui (G_OBJECT (dynamics->aspect_ratio_dynamics),
_("Aspect ratio"),
table,
GTK_TABLE (table),
5,
dynamics_labels);
NULL);
dynamics_output_maping_row_gui(G_OBJECT(editor->dynamics_model),
"color",
dynamics_output_maping_row_gui (G_OBJECT (dynamics->color_dynamics),
_("Color"),
table,
GTK_TABLE (table),
6,
dynamics_labels);
NULL);
dynamics_output_maping_row_gui(G_OBJECT(editor->dynamics_model),
"angle",
dynamics_output_maping_row_gui (G_OBJECT (dynamics->angle_dynamics),
_("Angle"),
table,
GTK_TABLE (table),
7,
dynamics_labels);
NULL);
dynamics_output_maping_row_gui(G_OBJECT(editor->dynamics_model),
"jitter",
dynamics_output_maping_row_gui (G_OBJECT (dynamics->jitter_dynamics),
_("Jitter"),
table,
GTK_TABLE (table),
8,
dynamics_labels);
NULL);
fixed = gtk_fixed_new ();
gtk_table_attach (GTK_TABLE (table), fixed, 0, n_dynamics + 2, 0, 1,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
@ -235,7 +226,6 @@ gimp_dynamics_editor_init (GimpDynamicsEditor *editor)
gtk_fixed_put (GTK_FIXED (fixed), dynamics_labels[i], 0, 0);
gtk_widget_show (dynamics_labels[i]);
}
}
}
@ -297,7 +287,7 @@ gimp_dynamics_editor_set_data (GimpDataEditor *editor,
gimp_config_copy (GIMP_CONFIG (editor->data),
GIMP_CONFIG (dynamics_editor->dynamics_model),
0);
GIMP_CONFIG_PARAM_SERIALIZE);
g_signal_handlers_unblock_by_func (dynamics_editor->dynamics_model,
gimp_dynamics_editor_notify_model,
@ -324,7 +314,7 @@ gimp_dynamics_editor_notify_model (GimpDynamics *options,
gimp_config_copy (GIMP_CONFIG (editor->dynamics_model),
GIMP_CONFIG (data_editor->data),
0);
GIMP_CONFIG_PARAM_SERIALIZE);
g_signal_handlers_unblock_by_func (data_editor->data,
gimp_dynamics_editor_notify_data,
@ -345,7 +335,7 @@ gimp_dynamics_editor_notify_data (GimpDynamics *options,
gimp_config_copy (GIMP_CONFIG (data_editor->data),
GIMP_CONFIG (editor->dynamics_model),
0);
GIMP_CONFIG_PARAM_SERIALIZE);
g_signal_handlers_unblock_by_func (editor->dynamics_model,
gimp_dynamics_editor_notify_model,
@ -385,73 +375,69 @@ gimp_dynamics_editor_new (GimpContext *context,
/* private functions */
static void
dynamics_output_maping_row_gui(GObject *config,
const gchar *property_name_part,
const gchar *property_label,
dynamics_output_maping_row_gui (GObject *config,
const gchar *row_label,
GtkTable *table,
gint row,
GtkWidget *labels[])
{
GtkWidget *label;
GtkWidget *button;
gint column=1;
gint column = 1;
label = gtk_label_new (property_label);
label = gtk_label_new (row_label);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_table_attach (GTK_TABLE (table), label, 0, 1, row, row+1,
gtk_table_attach (GTK_TABLE (table), label, 0, 1, row, row + 1,
GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
gtk_widget_show (label);
/*gboolean pressure;
gboolean velocity;
gboolean direction;
gboolean tilt;
gboolean random;
gboolean fade;
*/
button = dynamics_check_button_new (config, g_strconcat("pressure-", property_name_part, NULL),
button = dynamics_check_button_new (config, "pressure",
table, column, row);
if (labels)
g_signal_connect (button, "size-allocate",
G_CALLBACK (dynamics_check_button_size_allocate),
labels[column - 1]);
column++;
button = dynamics_check_button_new (config, g_strconcat("velocity-", property_name_part, NULL),
button = dynamics_check_button_new (config, "velocity",
table, column, row);
if (labels)
g_signal_connect (button, "size-allocate",
G_CALLBACK (dynamics_check_button_size_allocate),
labels[column - 1]);
column++;
button = dynamics_check_button_new (config, g_strconcat("direction-", property_name_part, NULL),
button = dynamics_check_button_new (config, "direction",
table, column, row);
if (labels)
g_signal_connect (button, "size-allocate",
G_CALLBACK (dynamics_check_button_size_allocate),
labels[column - 1]);
column++;
button = dynamics_check_button_new (config, g_strconcat("tilt-", property_name_part, NULL),
button = dynamics_check_button_new (config, "tilt",
table, column, row);
if (labels)
g_signal_connect (button, "size-allocate",
G_CALLBACK (dynamics_check_button_size_allocate),
labels[column - 1]);
column++;
button = dynamics_check_button_new (config, g_strconcat("random-", property_name_part, NULL),
button = dynamics_check_button_new (config, "random",
table, column, row);
if (labels)
g_signal_connect (button, "size-allocate",
G_CALLBACK (dynamics_check_button_size_allocate),
labels[column - 1]);
column++;
button = dynamics_check_button_new (config, g_strconcat("fading-", property_name_part, NULL),
button = dynamics_check_button_new (config, "fade",
table, column, row);
if (labels)
g_signal_connect (button, "size-allocate",
G_CALLBACK (dynamics_check_button_size_allocate),
labels[column - 1]);
column++;
}
static GtkWidget *