diff options
| author | Bastien Bouclet <bastien.bouclet@gmail.com> | 2008-03-28 19:13:14 +0000 |
|---|---|---|
| committer | bgk <bgk@users.sourceforge.net> | 2008-03-28 19:13:14 +0000 |
| commit | 6ba273d25f2e2e2697d502eb9b56c10da96d7c1e (patch) | |
| tree | 33a74ec0fae6b19d0948ce84a49c350767c8be7d /src/sp-item-group.cpp | |
| parent | nr_matrix_inverse is no more, removed test from nr-matrix-test (diff) | |
| download | inkscape-6ba273d25f2e2e2697d502eb9b56c10da96d7c1e.tar.gz inkscape-6ba273d25f2e2e2697d502eb9b56c10da96d7c1e.zip | |
- Created a SPLPEItem class that handles applying a LPE to an Item
- LPEs can now be applied to groups
- Updated the bend path to work properly with groups
(bzr r5219)
Diffstat (limited to 'src/sp-item-group.cpp')
| -rw-r--r-- | src/sp-item-group.cpp | 39 |
1 files changed, 33 insertions, 6 deletions
diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp index d0a1d9111..cd74f88b8 100644 --- a/src/sp-item-group.cpp +++ b/src/sp-item-group.cpp @@ -65,7 +65,9 @@ static NRArenaItem *sp_group_show (SPItem *item, NRArena *arena, unsigned int ke static void sp_group_hide (SPItem * item, unsigned int key); static void sp_group_snappoints (SPItem const *item, SnapPointsIter p); -static SPItemClass * parent_class; +static void sp_group_update_patheffect(SPLPEItem *lpeitem, bool write); + +static SPLPEItemClass * parent_class; GType sp_group_get_type (void) @@ -84,7 +86,7 @@ sp_group_get_type (void) (GInstanceInitFunc) sp_group_init, NULL, /* value_table */ }; - group_type = g_type_register_static (SP_TYPE_ITEM, "SPGroup", &group_info, (GTypeFlags)0); + group_type = g_type_register_static (SP_TYPE_LPE_ITEM, "SPGroup", &group_info, (GTypeFlags)0); } return group_type; } @@ -95,12 +97,14 @@ sp_group_class_init (SPGroupClass *klass) GObjectClass * object_class; SPObjectClass * sp_object_class; SPItemClass * item_class; + SPLPEItemClass * lpe_item_class; object_class = (GObjectClass *) klass; sp_object_class = (SPObjectClass *) klass; item_class = (SPItemClass *) klass; + lpe_item_class = (SPLPEItemClass *) klass; - parent_class = (SPItemClass *)g_type_class_ref (SP_TYPE_ITEM); + parent_class = (SPLPEItemClass *)g_type_class_ref (SP_TYPE_LPE_ITEM); object_class->dispose = sp_group_dispose; @@ -121,6 +125,8 @@ sp_group_class_init (SPGroupClass *klass) item_class->show = sp_group_show; item_class->hide = sp_group_hide; item_class->snappoints = sp_group_snappoints; + + lpe_item_class->update_patheffect = sp_group_update_patheffect; } static void @@ -289,16 +295,16 @@ sp_group_set_transform(SPItem *item, NR::Matrix const &xform) } static void sp_group_set(SPObject *object, unsigned key, char const *value) { - SPGroup *group=SP_GROUP(object); + SPGroup *group = SP_GROUP(object); switch (key) { - case SP_ATTR_INKSCAPE_GROUPMODE: { + case SP_ATTR_INKSCAPE_GROUPMODE: if ( value && !strcmp(value, "layer") ) { group->setLayerMode(SPGroup::LAYER); } else { group->setLayerMode(SPGroup::GROUP); } - } break; + break; default: { if (((SPObjectClass *) (parent_class))->set) { (* ((SPObjectClass *) (parent_class))->set)(object, key, value); @@ -361,6 +367,8 @@ sp_item_group_ungroup (SPGroup *group, GSList **children, bool do_done) } } + sp_lpe_item_remove_path_effect(SP_LPE_ITEM(group), false); + /* Step 1 - generate lists of children objects */ GSList *items = NULL; GSList *objects = NULL; @@ -796,6 +804,25 @@ void CGroup::onOrderChanged (Inkscape::XML::Node *child, Inkscape::XML::Node *, _group->requestModified(SP_OBJECT_MODIFIED_FLAG); } +static void +sp_group_update_patheffect (SPLPEItem *lpeitem, bool write) +{ +#ifdef GROUP_VERBOSE + g_message("sp_group_update_patheffect: %p\n", lpeitem); +#endif + g_return_if_fail (lpeitem != NULL); + g_return_if_fail (SP_IS_GROUP (lpeitem)); + + GSList const *item_list = sp_item_group_item_list(SP_GROUP(lpeitem)); + for ( GSList const *iter = item_list; iter; iter = iter->next ) { + SPObject *subitem = static_cast<SPObject *>(iter->data); + if (SP_IS_LPE_ITEM(subitem)) { + sp_lpe_item_update_patheffect(SP_LPE_ITEM(subitem), true); + } + } +} + + /* Local Variables: mode:c++ |
