diff --git a/src/eraser-context.cpp b/src/eraser-context.cpp
index 1920baed5be3bd11dbca846afb3548d2039e51a4..88496b06554c157517467a9da66f607b869c206b 100644 (file)
--- a/src/eraser-context.cpp
+++ b/src/eraser-context.cpp
static void
sp_eraser_context_set(SPEventContext *ec, gchar const *key, gchar const *val)
{
- SPEraserContext *erc = SP_ERASER_CONTEXT(ec);
-
- if (!strcmp(key, "mass")) {
- double const dval = ( val ? g_ascii_strtod (val, NULL) : 0.2 );
- erc->mass = CLAMP(dval, -1000.0, 1000.0);
- } else if (!strcmp(key, "wiggle")) {
- double const dval = ( val ? g_ascii_strtod (val, NULL) : (1 - DRAG_DEFAULT));
- erc->drag = CLAMP((1 - dval), DRAG_MIN, DRAG_MAX); // drag is inverse to wiggle
- } else if (!strcmp(key, "angle")) {
- double const dval = ( val ? g_ascii_strtod (val, NULL) : 0.0);
- erc->angle = CLAMP (dval, -90, 90);
- } else if (!strcmp(key, "width")) {
- double const dval = ( val ? g_ascii_strtod (val, NULL) : 0.1 );
- erc->width = CLAMP(dval, -1000.0, 1000.0);
- } else if (!strcmp(key, "thinning")) {
- double const dval = ( val ? g_ascii_strtod (val, NULL) : 0.1 );
- erc->vel_thin = CLAMP(dval, -1.0, 1.0);
- } else if (!strcmp(key, "tremor")) {
- double const dval = ( val ? g_ascii_strtod (val, NULL) : 0.0 );
- erc->tremor = CLAMP(dval, 0.0, 1.0);
- } else if (!strcmp(key, "flatness")) {
- double const dval = ( val ? g_ascii_strtod (val, NULL) : 1.0 );
- erc->flatness = CLAMP(dval, 0, 1.0);
- } else if (!strcmp(key, "usepressure")) {
- erc->usepressure = (val && strcmp(val, "0"));
- } else if (!strcmp(key, "usetilt")) {
- erc->usetilt = (val && strcmp(val, "0"));
- } else if (!strcmp(key, "abs_width")) {
- erc->abs_width = (val && strcmp(val, "0"));
- } else if (!strcmp(key, "cap_rounding")) {
- erc->cap_rounding = ( val ? g_ascii_strtod (val, NULL) : 0.0 );
+ //pass on up to parent class to handle common attributes.
+ if ( eraser_parent_class->set ) {
+ eraser_parent_class->set(ec, key, val);
}
-
- //g_print("ERC: %g %g %g %g\n", erc->mass, erc->drag, erc->angle, erc->width);
}
static double