summaryrefslogtreecommitdiffstats
path: root/src/dyna-draw-context.cpp
diff options
context:
space:
mode:
authorJon A. Cruz <jon@joncruz.org>2008-06-02 07:01:30 +0000
committerjoncruz <joncruz@users.sourceforge.net>2008-06-02 07:01:30 +0000
commit78be1b38be3e1e36279cfbc803778b77af9eb908 (patch)
tree7ce985afcc71cd9741a69a38cfb7d17c24786bf0 /src/dyna-draw-context.cpp
parentCorrected broken XML for size pref. (diff)
downloadinkscape-78be1b38be3e1e36279cfbc803778b77af9eb908.tar.gz
inkscape-78be1b38be3e1e36279cfbc803778b77af9eb908.zip
Pass through more calls to parent contexts, and added more common property handling.
Fixes bug #236667 and issues with middle-drag and ctrl-arrow. (bzr r5780)
Diffstat (limited to 'src/dyna-draw-context.cpp')
-rw-r--r--src/dyna-draw-context.cpp39
1 files changed, 6 insertions, 33 deletions
diff --git a/src/dyna-draw-context.cpp b/src/dyna-draw-context.cpp
index 9f759558c..7f3c41c2e 100644
--- a/src/dyna-draw-context.cpp
+++ b/src/dyna-draw-context.cpp
@@ -79,9 +79,6 @@
#define DYNA_MIN_WIDTH 1.0e-6
-#define DRAG_MIN 0.0
-#define DRAG_DEFAULT 1.0
-#define DRAG_MAX 1.0
// FIXME: move it to some shared file to be reused by both calligraphy and dropper
#define C1 0.552
@@ -258,39 +255,15 @@ sp_dyna_draw_context_set(SPEventContext *ec, gchar const *key, gchar const *val)
{
SPDynaDrawContext *ddc = SP_DYNA_DRAW_CONTEXT(ec);
- if (!strcmp(key, "mass")) {
- double const dval = ( val ? g_ascii_strtod (val, NULL) : 0.2 );
- ddc->mass = CLAMP(dval, -1000.0, 1000.0);
- } else if (!strcmp(key, "wiggle")) {
- double const dval = ( val ? g_ascii_strtod (val, NULL) : (1 - DRAG_DEFAULT));
- ddc->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);
- ddc->angle = CLAMP (dval, -90, 90);
- } else if (!strcmp(key, "width")) {
- double const dval = ( val ? g_ascii_strtod (val, NULL) : 0.1 );
- ddc->width = CLAMP(dval, -1000.0, 1000.0);
- } else if (!strcmp(key, "thinning")) {
- double const dval = ( val ? g_ascii_strtod (val, NULL) : 0.1 );
- ddc->vel_thin = CLAMP(dval, -1.0, 1.0);
- } else if (!strcmp(key, "tremor")) {
- double const dval = ( val ? g_ascii_strtod (val, NULL) : 0.0 );
- ddc->tremor = CLAMP(dval, 0.0, 1.0);
- } else if (!strcmp(key, "flatness")) {
- double const dval = ( val ? g_ascii_strtod (val, NULL) : 1.0 );
- ddc->flatness = CLAMP(dval, 0, 1.0);
- } else if (!strcmp(key, "tracebackground")) {
+ if (!strcmp(key, "tracebackground")) {
ddc->trace_bg = (val && strcmp(val, "0"));
- } else if (!strcmp(key, "usepressure")) {
- ddc->usepressure = (val && strcmp(val, "0"));
- } else if (!strcmp(key, "usetilt")) {
- ddc->usetilt = (val && strcmp(val, "0"));
- } else if (!strcmp(key, "abs_width")) {
- ddc->abs_width = (val && strcmp(val, "0"));
} else if (!strcmp(key, "keep_selected")) {
ddc->keep_selected = (val && strcmp(val, "0"));
- } else if (!strcmp(key, "cap_rounding")) {
- ddc->cap_rounding = ( val ? g_ascii_strtod (val, NULL) : 0.0 );
+ } else {
+ //pass on up to parent class to handle common attributes.
+ if ( dd_parent_class->set ) {
+ dd_parent_class->set(ec, key, val);
+ }
}
//g_print("DDC: %g %g %g %g\n", ddc->mass, ddc->drag, ddc->angle, ddc->width);