diff --git a/src/sp-flowregion.cpp b/src/sp-flowregion.cpp
index 95695768e8f5025c9738696006c79347db1e5e0d..79007cac7735a7494fb43db723ef5395de4f491c 100644 (file)
--- a/src/sp-flowregion.cpp
+++ b/src/sp-flowregion.cpp
#include "sp-text.h"
#include "sp-use.h"
#include "style.h"
+#include "document.h"
+#include "sp-title.h"
+#include "sp-desc.h"
#include "sp-flowregion.h"
static void sp_flowregion_remove_child (SPObject * object, Inkscape::XML::Node * child);
static void sp_flowregion_update (SPObject *object, SPCtx *ctx, guint flags);
static void sp_flowregion_modified (SPObject *object, guint flags);
-static Inkscape::XML::Node *sp_flowregion_write (SPObject *object, Inkscape::XML::Node *repr, guint flags);
+static Inkscape::XML::Node *sp_flowregion_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
static gchar * sp_flowregion_description (SPItem * item);
@@ -45,14 +48,14 @@ static void sp_flowregionexclude_child_added (SPObject * object, Inkscape::XML::
static void sp_flowregionexclude_remove_child (SPObject * object, Inkscape::XML::Node * child);
static void sp_flowregionexclude_update (SPObject *object, SPCtx *ctx, guint flags);
static void sp_flowregionexclude_modified (SPObject *object, guint flags);
-static Inkscape::XML::Node *sp_flowregionexclude_write (SPObject *object, Inkscape::XML::Node *repr, guint flags);
+static Inkscape::XML::Node *sp_flowregionexclude_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
static gchar * sp_flowregionexclude_description (SPItem * item);
static SPItemClass * flowregionexclude_parent_class;
-static void GetDest(SPObject* child,Shape **computed,NR::Matrix itr_mat);
+static void GetDest(SPObject* child,Shape **computed);
GType
sp_flowregion_get_type (void)
{
SPObject* object=SP_OBJECT(this);
- NR::Matrix itr_mat=sp_item_i2root_affine (SP_ITEM(object));
- itr_mat=itr_mat.inverse();
-
for (std::vector<Shape*>::iterator it = computed.begin() ; it != computed.end() ; it++)
delete *it;
computed.clear();
for (SPObject* child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
Shape *shape = NULL;
- GetDest(child,&shape,itr_mat);
+ GetDest(child,&shape);
computed.push_back(shape);
}
}
}
static Inkscape::XML::Node *
-sp_flowregion_write (SPObject *object, Inkscape::XML::Node *repr, guint flags)
+sp_flowregion_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
{
if (flags & SP_OBJECT_WRITE_BUILD) {
- if ( repr == NULL ) repr = sp_repr_new ("svg:flowRegion");
+ if ( repr == NULL ) {
+ repr = xml_doc->createElement("svg:flowRegion");
+ }
GSList *l = NULL;
for ( SPObject *child = sp_object_first_child(object) ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
- Inkscape::XML::Node *crepr = child->updateRepr(NULL, flags);
+ if (SP_IS_TITLE(child) || SP_IS_DESC(child)) continue;
+ Inkscape::XML::Node *crepr = child->updateRepr(xml_doc, NULL, flags);
if (crepr) l = g_slist_prepend(l, crepr);
}
@@ -249,18 +252,19 @@ sp_flowregion_write (SPObject *object, Inkscape::XML::Node *repr, guint flags)
} else {
for ( SPObject *child = sp_object_first_child(object) ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
+ if (SP_IS_TITLE(child) || SP_IS_DESC(child)) continue;
child->updateRepr(flags);
}
}
if (((SPObjectClass *) (flowregion_parent_class))->write)
- ((SPObjectClass *) (flowregion_parent_class))->write (object, repr, flags);
-
+ ((SPObjectClass *) (flowregion_parent_class))->write (object, xml_doc, repr, flags);
+
return repr;
}
-static gchar *sp_flowregion_description(SPItem *item)
+static gchar *sp_flowregion_description(SPItem */*item*/)
{
// TRANSLATORS: "Flow region" is an area where text is allowed to flow
return g_strdup_printf(_("Flow region"));
{
SPObject* object=SP_OBJECT(this);
- if (computed) {
+ if (computed) {
delete computed;
computed = NULL;
}
- NR::Matrix itr_mat=sp_item_i2root_affine (SP_ITEM(object));
- itr_mat=itr_mat.inverse();
for (SPObject* child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
- GetDest(child,&computed,itr_mat);
+ GetDest(child,&computed);
}
}
}
static Inkscape::XML::Node *
-sp_flowregionexclude_write (SPObject *object, Inkscape::XML::Node *repr, guint flags)
+sp_flowregionexclude_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
{
if (flags & SP_OBJECT_WRITE_BUILD) {
- if ( repr == NULL ) repr = sp_repr_new ("svg:flowRegionExclude");
+ if ( repr == NULL ) {
+ repr = xml_doc->createElement("svg:flowRegionExclude");
+ }
GSList *l = NULL;
for ( SPObject *child = sp_object_first_child(object) ; child != NULL; child = SP_OBJECT_NEXT(child) ) {
- Inkscape::XML::Node *crepr = child->updateRepr(NULL, flags);
+ Inkscape::XML::Node *crepr = child->updateRepr(xml_doc, NULL, flags);
if (crepr) l = g_slist_prepend(l, crepr);
}
@@ -468,13 +472,13 @@ sp_flowregionexclude_write (SPObject *object, Inkscape::XML::Node *repr, guint f
}
if (((SPObjectClass *) (flowregionexclude_parent_class))->write)
- ((SPObjectClass *) (flowregionexclude_parent_class))->write (object, repr, flags);
-
+ ((SPObjectClass *) (flowregionexclude_parent_class))->write (object, xml_doc, repr, flags);
+
return repr;
}
-static gchar *sp_flowregionexclude_description(SPItem *item)
+static gchar *sp_flowregionexclude_description(SPItem */*item*/)
{
/* TRANSLATORS: A region "cut out of" a flow region; text is not allowed to flow inside the
* flow excluded region. flowRegionExclude in SVG 1.2: see
}
}
-static void GetDest(SPObject* child,Shape **computed,NR::Matrix itr_mat)
+static void GetDest(SPObject* child,Shape **computed)
{
if ( child == NULL ) return;
SPCurve *curve=NULL;
+ Geom::Matrix tr_mat;
SPObject* u_child=child;
if ( SP_IS_USE(u_child) ) {
u_child=SP_USE(u_child)->child;
+ tr_mat = SP_ITEM(u_child)->getRelativeTransform(SP_OBJECT_PARENT(child));
+ } else {
+ tr_mat = SP_ITEM(u_child)->transform;
}
if ( SP_IS_SHAPE (u_child) ) {
curve = sp_shape_get_curve (SP_SHAPE (u_child));
if ( curve ) {
Path* temp=new Path;
- NR::Matrix tr_mat=sp_item_i2root_affine (SP_ITEM(u_child));
- tr_mat=itr_mat*tr_mat;
- temp->LoadArtBPath(curve->bpath,tr_mat,true);
+ temp->LoadPathVector(curve->get_pathvector(), tr_mat, true);
Shape* n_shp=new Shape;
temp->Convert(0.25);
temp->Fill(n_shp,0);
delete uncross;
delete n_shp;
delete temp;
- sp_curve_unref(curve);
+ curve->unref();
} else {
// printf("no curve\n");
}