sp-item-group.cpp revision e47f938224eea9450007fcfd9139474cdf186ffd
e9b6af083e34e2397a8ddbe9781920733d09d151Ted Gould * SVG <g> implementation
c57da20fee24a6e5b368730153d72eabe26425b2buliabyak * Lauris Kaplinski <lauris@kaplinski.com>
c57da20fee24a6e5b368730153d72eabe26425b2buliabyak * bulia byak <buliabyak@users.sf.net>
c57da20fee24a6e5b368730153d72eabe26425b2buliabyak * Johan Engelen <j.b.c.engelen@ewi.utwente.nl>
c57da20fee24a6e5b368730153d72eabe26425b2buliabyak * Jon A. Cruz <jon@joncruz.org>
c57da20fee24a6e5b368730153d72eabe26425b2buliabyak * Abhishek Sharma
c57da20fee24a6e5b368730153d72eabe26425b2buliabyak * Copyright (C) 1999-2006 authors
c57da20fee24a6e5b368730153d72eabe26425b2buliabyak * Copyright (C) 2000-2001 Ximian, Inc.
c57da20fee24a6e5b368730153d72eabe26425b2buliabyak * Released under GNU GPL, read the file 'COPYING' for more information
c57da20fee24a6e5b368730153d72eabe26425b2buliabyakstatic void sp_group_class_init (SPGroupClass *klass);
c57da20fee24a6e5b368730153d72eabe26425b2buliabyakstatic void sp_group_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr);
c57da20fee24a6e5b368730153d72eabe26425b2buliabyakstatic void sp_group_child_added (SPObject * object, Inkscape::XML::Node * child, Inkscape::XML::Node * ref);
c57da20fee24a6e5b368730153d72eabe26425b2buliabyakstatic void sp_group_remove_child (SPObject * object, Inkscape::XML::Node * child);
c57da20fee24a6e5b368730153d72eabe26425b2buliabyakstatic void sp_group_order_changed (SPObject * object, Inkscape::XML::Node * child, Inkscape::XML::Node * old_ref, Inkscape::XML::Node * new_ref);
c57da20fee24a6e5b368730153d72eabe26425b2buliabyakstatic void sp_group_update (SPObject *object, SPCtx *ctx, guint flags);
c57da20fee24a6e5b368730153d72eabe26425b2buliabyakstatic void sp_group_modified (SPObject *object, guint flags);
c57da20fee24a6e5b368730153d72eabe26425b2buliabyakstatic Inkscape::XML::Node *sp_group_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
c57da20fee24a6e5b368730153d72eabe26425b2buliabyakstatic void sp_group_set(SPObject *object, unsigned key, char const *value);
c57da20fee24a6e5b368730153d72eabe26425b2buliabyakstatic Geom::OptRect sp_group_bbox(SPItem const *item, Geom::Affine const &transform, SPItem::BBoxType type);
c57da20fee24a6e5b368730153d72eabe26425b2buliabyakstatic void sp_group_print (SPItem * item, SPPrintContext *ctx);
c57da20fee24a6e5b368730153d72eabe26425b2buliabyakstatic gchar * sp_group_description (SPItem * item);
c57da20fee24a6e5b368730153d72eabe26425b2buliabyakstatic Inkscape::DrawingItem *sp_group_show (SPItem *item, Inkscape::Drawing &drawing, unsigned int key, unsigned int flags);
c57da20fee24a6e5b368730153d72eabe26425b2buliabyakstatic void sp_group_hide (SPItem * item, unsigned int key);
c57da20fee24a6e5b368730153d72eabe26425b2buliabyakstatic void sp_group_snappoints (SPItem const *item, std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs);
c57da20fee24a6e5b368730153d72eabe26425b2buliabyakstatic void sp_group_update_patheffect(SPLPEItem *lpeitem, bool write);
c57da20fee24a6e5b368730153d72eabe26425b2buliabyakstatic void sp_group_perform_patheffect(SPGroup *group, SPGroup *topgroup, bool write);
c57da20fee24a6e5b368730153d72eabe26425b2buliabyak group_type = g_type_register_static (SP_TYPE_LPE_ITEM, "SPGroup", &group_info, (GTypeFlags)0);
c57da20fee24a6e5b368730153d72eabe26425b2buliabyak parent_class = (SPLPEItemClass *)g_type_class_ref (SP_TYPE_LPE_ITEM);
068e269d6d0391bdf69963f651be776f3fcb4dd5gustav_b sp_object_class->child_added = sp_group_child_added;
c57da20fee24a6e5b368730153d72eabe26425b2buliabyak sp_object_class->remove_child = sp_group_remove_child;
c57da20fee24a6e5b368730153d72eabe26425b2buliabyak sp_object_class->order_changed = sp_group_order_changed;
c57da20fee24a6e5b368730153d72eabe26425b2buliabyak lpe_item_class->update_patheffect = sp_group_update_patheffect;
c57da20fee24a6e5b368730153d72eabe26425b2buliabyak new (&group->_display_modes) std::map<unsigned int, SPGroup::LayerMode>();
c57da20fee24a6e5b368730153d72eabe26425b2buliabyakstatic void sp_group_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
c57da20fee24a6e5b368730153d72eabe26425b2buliabyak ((SPObjectClass *)parent_class)->build(object, document, repr);
c57da20fee24a6e5b368730153d72eabe26425b2buliabyak if ( SP_GROUP(object)->_layer_mode == SPGroup::LAYER ) {
c57da20fee24a6e5b368730153d72eabe26425b2buliabyak object->document->removeResource("layer", object);
static void sp_group_child_added(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *ref)
sp_group_order_changed (SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node *old_ref, Inkscape::XML::Node *new_ref)
static Inkscape::XML::Node * sp_group_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
GSList *l;
if (!repr) {
l = NULL;
if (crepr) {
const char *value;
return repr;
switch (key) {
static void sp_group_snappoints(SPItem const *item, std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs)
if (SP_IS_ITEM(o)) {
g_return_if_fail (!strcmp (grepr->name(), "svg:g") || !strcmp (grepr->name(), "svg:a") || !strcmp (grepr->name(), "svg:switch"));
ctrans = citem->transform * g; // then we should apply the transformation of the group to the offset
// the group is leaving forever, no heir, clones should take note; its children however are going to reemerge
if (objects) {
while (objects) {
while (items) {
if (do_done) {
if ( SP_IS_ITEM(o) ) {
s = g_slist_prepend(s, o);
return g_slist_reverse (s);
return child;
return GROUP;
if ( hasChildren() ) {
if ( SP_IS_ITEM(o) ) {
SPItemView *v;
if (ac) {
SPItemView *v;
if (ac) {
l = g_slist_remove (l, o);
return bbox;
if (SP_IS_ITEM(o)) {
l = g_slist_remove (l, o);
if (SP_IS_ITEM(o)) {
len++;
return len;
return g_strdup_printf(
Inkscape::DrawingItem *CGroup::show (Inkscape::Drawing &drawing, unsigned int key, unsigned int flags) {
return ai;
void CGroup::_showChildren (Inkscape::Drawing &drawing, Inkscape::DrawingItem *ai, unsigned int key, unsigned int flags) {
if (SP_IS_ITEM (o)) {
l = g_slist_remove (l, o);
if (SP_IS_ITEM (o)) {
l = g_slist_remove (l, o);
void CGroup::onOrderChanged (Inkscape::XML::Node *child, Inkscape::XML::Node *, Inkscape::XML::Node *)
SPItemView *v;
#ifdef GROUP_VERBOSE
for (PathEffectList::iterator it = lpeitem->path_effect_list->begin(); it != lpeitem->path_effect_list->end(); it++)
if (write) {
#ifdef GROUP_VERBOSE
c->unref();