diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp
index 9c19ce75a1a9839509f4ad38c9cea83f39eabda4..5884277521c9a24fcfac82d519363029c005d18d 100644 (file)
--- a/src/sp-item-group.cpp
+++ b/src/sp-item-group.cpp
#include "inkscape.h"
#include "desktop-handles.h"
#include "selection.h"
+#include "live_effects/effect.h"
#include "live_effects/lpeobject.h"
#include "live_effects/lpeobject-reference.h"
#include "sp-title.h"
static void sp_group_bbox(SPItem const *item, NRRect *bbox, Geom::Matrix const &transform, unsigned const flags);
static void sp_group_print (SPItem * item, SPPrintContext *ctx);
static gchar * sp_group_description (SPItem * item);
-static Geom::Matrix sp_group_set_transform(SPItem *item, Geom::Matrix const &xform);
static NRArenaItem *sp_group_show (SPItem *item, NRArena *arena, unsigned int key, unsigned int flags);
static void sp_group_hide (SPItem * item, unsigned int key);
-static void sp_group_snappoints (SPItem const *item, bool const target, SnapPointsWithType &p, Inkscape::SnapPreferences const *snapprefs);
+static void sp_group_snappoints (SPItem const *item, std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs);
static void sp_group_update_patheffect(SPLPEItem *lpeitem, bool write);
-static void sp_group_perform_patheffect(SPGroup *group, SPGroup *topgroup);
+static void sp_group_perform_patheffect(SPGroup *group, SPGroup *topgroup, bool write);
static SPLPEItemClass * parent_class;
item_class->bbox = sp_group_bbox;
item_class->print = sp_group_print;
item_class->description = sp_group_description;
- item_class->set_transform = sp_group_set_transform;
item_class->show = sp_group_show;
item_class->hide = sp_group_hide;
item_class->snappoints = sp_group_snappoints;
@@ -259,6 +258,8 @@ sp_group_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XM
const char *value;
if ( group->_layer_mode == SPGroup::LAYER ) {
value = "layer";
+ } else if ( group->_layer_mode == SPGroup::MASK_HELPER ) {
+ value = "maskhelper";
} else if ( flags & SP_OBJECT_WRITE_ALL ) {
value = "group";
} else {
return SP_GROUP(item)->group->getDescription();
}
-static Geom::Matrix
-sp_group_set_transform(SPItem *item, Geom::Matrix const &xform)
-{
- Inkscape::Selection *selection = sp_desktop_selection(inkscape_active_desktop());
- persp3d_split_perspectives_according_to_selection(selection);
-
- Geom::Matrix last_trans;
- sp_svg_transform_read(SP_OBJECT_REPR(item)->attribute("transform"), &last_trans);
- Geom::Matrix inc_trans = last_trans.inverse()*xform;
-
- std::list<Persp3D *> plist = selection->perspList();
- for (std::list<Persp3D *>::iterator i = plist.begin(); i != plist.end(); ++i) {
- persp3d_apply_affine_transformation(*i, inc_trans);
- }
-
- return xform;
-}
-
static void sp_group_set(SPObject *object, unsigned key, char const *value) {
SPGroup *group = SP_GROUP(object);
case SP_ATTR_INKSCAPE_GROUPMODE:
if ( value && !strcmp(value, "layer") ) {
group->setLayerMode(SPGroup::LAYER);
+ } else if ( value && !strcmp(value, "maskhelper") ) {
+ group->setLayerMode(SPGroup::MASK_HELPER);
} else {
group->setLayerMode(SPGroup::GROUP);
}
SP_GROUP(item)->group->hide(key);
}
-static void sp_group_snappoints (SPItem const *item, bool const target, SnapPointsWithType &p, Inkscape::SnapPreferences const *snapprefs)
+static void sp_group_snappoints (SPItem const *item, std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs)
{
for (SPObject const *o = sp_object_first_child(SP_OBJECT(item));
o != NULL;
o = SP_OBJECT_NEXT(o))
{
if (SP_IS_ITEM(o)) {
- sp_item_snappoints(SP_ITEM(o), target, p, snapprefs);
+ sp_item_snappoints(SP_ITEM(o), p, snapprefs);
}
}
}
if ( _layer_mode != mode ) {
if ( mode == LAYER ) {
sp_document_add_resource(SP_OBJECT_DOCUMENT(this), "layer", this);
- } else {
+ } else if ( _layer_mode == LAYER ) {
sp_document_remove_resource(SP_OBJECT_DOCUMENT(this), "layer", this);
}
_layer_mode = mode;
}
}
- sp_group_perform_patheffect(SP_GROUP(lpeitem), SP_GROUP(lpeitem));
+ sp_group_perform_patheffect(SP_GROUP(lpeitem), SP_GROUP(lpeitem), write);
}
}
static void
-sp_group_perform_patheffect(SPGroup *group, SPGroup *topgroup)
+sp_group_perform_patheffect(SPGroup *group, SPGroup *topgroup, bool write)
{
GSList const *item_list = sp_item_group_item_list(SP_GROUP(group));
for ( GSList const *iter = item_list; iter; iter = iter->next ) {
SPObject *subitem = static_cast<SPObject *>(iter->data);
if (SP_IS_GROUP(subitem)) {
- sp_group_perform_patheffect(SP_GROUP(subitem), topgroup);
+ sp_group_perform_patheffect(SP_GROUP(subitem), topgroup, write);
} else if (SP_IS_SHAPE(subitem)) {
- SPCurve * c = sp_shape_get_curve(SP_SHAPE(subitem));
+ SPCurve * c = NULL;
+ if (SP_IS_PATH(subitem)) {
+ c = sp_path_get_original_curve(SP_PATH(subitem));
+ } else {
+ c = sp_shape_get_curve(SP_SHAPE(subitem));
+ }
// only run LPEs when the shape has a curve defined
if (c) {
sp_lpe_item_perform_path_effect(SP_LPE_ITEM(topgroup), c);
sp_shape_set_curve(SP_SHAPE(subitem), c, TRUE);
- Inkscape::XML::Node *repr = SP_OBJECT_REPR(subitem);
-
- gchar *str = sp_svg_write_path(c->get_pathvector());
- repr->setAttribute("d", str);
- g_free(str);
+ if (write) {
+ Inkscape::XML::Node *repr = SP_OBJECT_REPR(subitem);
+ gchar *str = sp_svg_write_path(c->get_pathvector());
+ repr->setAttribute("d", str);
+#ifdef GROUP_VERBOSE
+g_message("sp_group_perform_patheffect writes 'd' attribute");
+#endif
+ g_free(str);
+ }
c->unref();
}