diff options
| author | Johan B. C. Engelen <jbc.engelen@swissonline.ch> | 2008-03-23 20:29:06 +0000 |
|---|---|---|
| committer | johanengelen <johanengelen@users.sourceforge.net> | 2008-03-23 20:29:06 +0000 |
| commit | a008ac03948f17fca7398359a8524c77b2e64445 (patch) | |
| tree | 2ad5598bca0ebc89e228b7a184d425352de0a1ff /src/live_effects/parameter/path.cpp | |
| parent | set primary path storage to vector<path> in lpe-PathParam. only convert to pw... (diff) | |
| download | inkscape-a008ac03948f17fca7398359a8524c77b2e64445.tar.gz inkscape-a008ac03948f17fca7398359a8524c77b2e64445.zip | |
prepare PathParam for linking to other object
(bzr r5180)
Diffstat (limited to 'src/live_effects/parameter/path.cpp')
| -rw-r--r-- | src/live_effects/parameter/path.cpp | 48 |
1 files changed, 28 insertions, 20 deletions
diff --git a/src/live_effects/parameter/path.cpp b/src/live_effects/parameter/path.cpp index c87cff613..12e67693a 100644 --- a/src/live_effects/parameter/path.cpp +++ b/src/live_effects/parameter/path.cpp @@ -44,7 +44,7 @@ PathParam::PathParam( const Glib::ustring& label, const Glib::ustring& tip, _pathvector(), must_recalculate_pwd2(false), _pwd2(), - referring(false) + href(NULL) { defvalue = g_strdup(default_value); param_readSVGValue(defvalue); @@ -59,26 +59,14 @@ PathParam::~PathParam() std::vector<Geom::Path> const & PathParam::get_pathvector() { - if (!referring) { - return _pathvector; - } else { - update_from_referred(); - must_recalculate_pwd2 = true; - return _pathvector; - } + return _pathvector; } Geom::Piecewise<Geom::D2<Geom::SBasis> > const & PathParam::get_pwd2() { - if (!referring) { - ensure_pwd2(); - return _pwd2; - } else { - update_from_referred(); - ensure_pwd2(); - return _pwd2; - } + ensure_pwd2(); + return _pwd2; } void @@ -98,9 +86,20 @@ PathParam::param_readSVGValue(const gchar * strvalue) { if (strvalue) { _pathvector.clear(); - _pathvector = SVGD_to_2GeomPath(strvalue); + if (href) { + g_free(href); + href = NULL; + } must_recalculate_pwd2 = true; + if (false /*if strvalue is xlink*/) { + href = g_strdup(strvalue); + update_from_referred(); + // TODO: add listener, because we must update when referred updates. we must always be up-to-date with referred path data + } else { + _pathvector = SVGD_to_2GeomPath(strvalue); + } + signal_path_changed.emit(); return true; } @@ -168,7 +167,11 @@ PathParam::param_editOncanvas(SPItem * item, SPDesktop * dt) } ShapeEditor * shape_editor = SP_NODE_CONTEXT( dt->event_context )->shape_editor; - shape_editor->set_item_lpe_path_parameter(item, SP_OBJECT(param_effect->getLPEObj()), param_key.c_str()); + if (!href) { + shape_editor->set_item_lpe_path_parameter(item, SP_OBJECT(param_effect->getLPEObj()), param_key.c_str()); + } else { + // set referred item for editing + } } void @@ -183,7 +186,7 @@ void PathParam::param_transform_multiply(Geom::Matrix const& postmul, bool /*set*/) { // TODO: recode this to apply transform to _pathvector instead? - if (!referring) { + if (!href) { // only apply transform when not referring to other path ensure_pwd2(); param_set_and_write_new_value( _pwd2 * postmul ); @@ -218,7 +221,12 @@ PathParam::ensure_pwd2() void PathParam::update_from_referred() { - // TODO + if (!href) { + g_warning("PathParam::update_from_referred - logical error, this should not possible"); + return; + } + + // TODO: implement! // optimize, only update from referred when referred changed. } |
