X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fsp-item-group.cpp;h=422d033ca3fb117839435fc2f093b4a5032d329c;hb=28a38cc6b34b86f6e970a6b009cbe4aaa0cef749;hp=b5f6881b72e73909f6f9e2f3ba4b755b08bb4585;hpb=b79f3338a624d38a58133d70f0baa440f9a9ffd2;p=inkscape.git diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp index b5f6881b7..422d033ca 100644 --- a/src/sp-item-group.cpp +++ b/src/sp-item-group.cpp @@ -17,9 +17,7 @@ # include "config.h" #endif -#if defined(WIN32) || defined(__APPLE__) -# include -#endif +#include #include "display/nr-arena-group.h" #include "libnr/nr-matrix-ops.h" @@ -446,7 +444,8 @@ sp_item_group_ungroup (SPGroup *group, GSList **children, bool do_done) items = g_slist_remove (items, items->data); } - if (do_done) sp_document_done (doc); + if (do_done) + sp_document_done (doc, SP_VERB_NONE, _("Ungroup")); } /* @@ -593,18 +592,27 @@ void CGroup::onChildRemoved(Inkscape::XML::Node */*child*/) { } void CGroup::onUpdate(SPCtx *ctx, unsigned int flags) { - SPObject *child; SPItemCtx *ictx, cctx; ictx = (SPItemCtx *) ctx; cctx = *ictx; - if (flags & SP_OBJECT_MODIFIED_FLAG) flags |= SP_OBJECT_PARENT_MODIFIED_FLAG; + if (flags & SP_OBJECT_MODIFIED_FLAG) { + flags |= SP_OBJECT_PARENT_MODIFIED_FLAG; + } + flags &= SP_OBJECT_MODIFIED_CASCADE; - GSList *l = g_slist_reverse(_childList(true, ActionUpdate)); + if (flags & SP_OBJECT_STYLE_MODIFIED_FLAG) { + SPObject *object = SP_OBJECT(_group); + for (SPItemView *v = SP_ITEM(_group)->display; v != NULL; v = v->next) { + nr_arena_group_set_style(NR_ARENA_GROUP(v->arenaitem), SP_OBJECT_STYLE(object)); + } + } + + GSList *l = g_slist_reverse(_group->childList(true, SPObject::ActionUpdate)); while (l) { - child = SP_OBJECT (l->data); + SPObject *child = SP_OBJECT (l->data); l = g_slist_remove (l, child); if (flags || (child->uflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) { if (SP_IS_ITEM (child)) { @@ -620,24 +628,20 @@ void CGroup::onUpdate(SPCtx *ctx, unsigned int flags) { } } -GSList *CGroup::_childList(bool add_ref, Action) { - GSList *l = NULL; - for (SPObject *child = sp_object_first_child(_group) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { - if (add_ref) - g_object_ref (G_OBJECT (child)); - - l = g_slist_prepend (l, child); - } - return l; -} - void CGroup::onModified(guint flags) { SPObject *child; if (flags & SP_OBJECT_MODIFIED_FLAG) flags |= SP_OBJECT_PARENT_MODIFIED_FLAG; flags &= SP_OBJECT_MODIFIED_CASCADE; - GSList *l = g_slist_reverse(_childList(true)); + if (flags & SP_OBJECT_STYLE_MODIFIED_FLAG) { + SPObject *object = SP_OBJECT(_group); + for (SPItemView *v = SP_ITEM(_group)->display; v != NULL; v = v->next) { + nr_arena_group_set_style(NR_ARENA_GROUP(v->arenaitem), SP_OBJECT_STYLE(object)); + } + } + + GSList *l = g_slist_reverse(_group->childList(true)); while (l) { child = SP_OBJECT (l->data); l = g_slist_remove (l, child); @@ -649,7 +653,7 @@ void CGroup::onModified(guint flags) { } void CGroup::calculateBBox(NRRect *bbox, NR::Matrix const &transform, unsigned const flags) { - GSList *l = _childList(false, ActionBBox); + GSList *l = _group->childList(false, SPObject::ActionBBox); while (l) { SPObject *o = SP_OBJECT (l->data); if (SP_IS_ITEM(o)) { @@ -662,7 +666,7 @@ void CGroup::calculateBBox(NRRect *bbox, NR::Matrix const &transform, unsigned c } void CGroup::onPrint(SPPrintContext *ctx) { - GSList *l = g_slist_reverse(_childList(false)); + GSList *l = g_slist_reverse(_group->childList(false)); while (l) { SPObject *o = SP_OBJECT (l->data); if (SP_IS_ITEM(o)) { @@ -693,11 +697,14 @@ gchar *CGroup::getDescription() { NRArenaItem *CGroup::show (NRArena *arena, unsigned int key, unsigned int flags) { NRArenaItem *ai; + SPObject *object = SP_OBJECT(_group); ai = NRArenaGroup::create(arena); + nr_arena_group_set_transparent(NR_ARENA_GROUP (ai), _group->effectiveLayerMode(key) == SPGroup::LAYER); + nr_arena_group_set_style(NR_ARENA_GROUP(ai), SP_OBJECT_STYLE(object)); _showChildren(arena, ai, key, flags); return ai; @@ -707,7 +714,7 @@ void CGroup::_showChildren (NRArena *arena, NRArenaItem *ai, unsigned int key, u NRArenaItem *ac = NULL; NRArenaItem *ar = NULL; SPItem * child = NULL; - GSList *l = g_slist_reverse(_childList(false, ActionShow)); + GSList *l = g_slist_reverse(_group->childList(false, SPObject::ActionShow)); while (l) { SPObject *o = SP_OBJECT (l->data); if (SP_IS_ITEM (o)) { @@ -726,7 +733,7 @@ void CGroup::_showChildren (NRArena *arena, NRArenaItem *ai, unsigned int key, u void CGroup::hide (unsigned int key) { SPItem * child; - GSList *l = g_slist_reverse(_childList(false, ActionShow)); + GSList *l = g_slist_reverse(_group->childList(false, SPObject::ActionShow)); while (l) { SPObject *o = SP_OBJECT (l->data); if (SP_IS_ITEM (o)) {