summaryrefslogtreecommitdiffstats
path: root/src/box3d.cpp
diff options
context:
space:
mode:
authorKrzysztof Kosi??ski <tweenk.pl@gmail.com>2011-04-07 23:42:04 +0000
committerKrzysztof KosiƄski <tweenk.pl@gmail.com>2011-04-07 23:42:04 +0000
commit945ce419c806c73d70203dec33ececafbe108a92 (patch)
treecfcdb59bf47e9db7f9e01f7eebb59924bdeaea94 /src/box3d.cpp
parentMerge from trunk (again) (diff)
parentExtensions. SVG+media fix (see Bug #400356). (diff)
downloadinkscape-945ce419c806c73d70203dec33ececafbe108a92.tar.gz
inkscape-945ce419c806c73d70203dec33ececafbe108a92.zip
Merge from trunk
(bzr r9508.1.73)
Diffstat (limited to 'src/box3d.cpp')
-rw-r--r--src/box3d.cpp42
1 files changed, 20 insertions, 22 deletions
diff --git a/src/box3d.cpp b/src/box3d.cpp
index b6bebc141..ac5814e4d 100644
--- a/src/box3d.cpp
+++ b/src/box3d.cpp
@@ -49,7 +49,7 @@ static void box3d_update(SPObject *object, SPCtx *ctx, guint flags);
static Inkscape::XML::Node *box3d_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
static gchar *box3d_description(SPItem *item);
-static Geom::Matrix box3d_set_transform(SPItem *item, Geom::Matrix const &xform);
+static Geom::Affine box3d_set_transform(SPItem *item, Geom::Affine const &xform);
static void box3d_convert_to_guides(SPItem *item);
static void box3d_ref_changed(SPObject *old_ref, SPObject *ref, SPBox3D *box);
@@ -105,11 +105,10 @@ static void
box3d_init(SPBox3D *box)
{
box->persp_href = NULL;
- box->persp_ref = new Persp3DReference(SP_OBJECT(box));
+ box->persp_ref = new Persp3DReference(box);
}
-static void
-box3d_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
+static void box3d_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
{
if (((SPObjectClass *) (parent_class))->build) {
((SPObjectClass *) (parent_class))->build(object, document, repr);
@@ -125,15 +124,14 @@ box3d_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
// TODO: Create/link to the correct perspective
- SPDocument *doc = SP_OBJECT_DOCUMENT(box);
- if (!doc)
- return;
-
- box->persp_ref->changedSignal().connect(sigc::bind(sigc::ptr_fun(box3d_ref_changed), box));
+ SPDocument *doc = box->document;
+ if ( doc ) {
+ box->persp_ref->changedSignal().connect(sigc::bind(sigc::ptr_fun(box3d_ref_changed), box));
- object->readAttr( "inkscape:perspectiveID" );
- object->readAttr( "inkscape:corner0" );
- object->readAttr( "inkscape:corner7" );
+ object->readAttr( "inkscape:perspectiveID" );
+ object->readAttr( "inkscape:corner0" );
+ object->readAttr( "inkscape:corner7" );
+ }
}
/**
@@ -168,7 +166,7 @@ box3d_release(SPObject *object)
// by the following code and then again by the redo mechanism! Perhaps we should perform
// deletion of the perspective from another location "outside" the undo/redo mechanism?
if (persp->perspective_impl->boxes.empty()) {
- SPDocument *doc = SP_OBJECT_DOCUMENT(box);
+ SPDocument *doc = box->document;
persp->deleteObject();
doc->setCurrentPersp3D(persp3d_document_first_persp(doc));
}
@@ -283,7 +281,7 @@ static Inkscape::XML::Node * box3d_write(SPObject *object, Inkscape::XML::Docume
repr->setAttribute("inkscape:perspectiveID", box->persp_href);
} else {
/* box is not yet linked to a perspective; use the document's current perspective */
- SPDocument *doc = SP_OBJECT_DOCUMENT(object);
+ SPDocument *doc = object->document;
if (box->persp_ref->getURI()) {
gchar *uri_string = box->persp_ref->getURI()->toString();
repr->setAttribute("inkscape:perspectiveID", uri_string);
@@ -335,15 +333,15 @@ void box3d_position_set(SPBox3D *box)
}
}
-static Geom::Matrix
-box3d_set_transform(SPItem *item, Geom::Matrix const &xform)
+static Geom::Affine
+box3d_set_transform(SPItem *item, Geom::Affine const &xform)
{
SPBox3D *box = SP_BOX3D(item);
// We don't apply the transform to the box directly but instead to its perspective (which is
// done in sp_selection_apply_affine). Here we only adjust strokes, patterns, etc.
- Geom::Matrix ret(Geom::Matrix(xform).without_translation());
+ Geom::Affine ret(Geom::Affine(xform).withoutTranslation());
gdouble const sw = hypot(ret[0], ret[1]);
gdouble const sh = hypot(ret[2], ret[3]);
@@ -390,7 +388,7 @@ box3d_get_corner_screen (SPBox3D const *box, guint id, bool item_coords) {
if (!box3d_get_perspective(box)) {
return Geom::Point (Geom::infinity(), Geom::infinity());
}
- Geom::Matrix const i2d (SP_ITEM(box)->i2d_affine ());
+ Geom::Affine const i2d (SP_ITEM(box)->i2d_affine ());
if (item_coords) {
return box3d_get_perspective(box)->perspective_impl->tmat.image(proj_corner).affine() * i2d.inverse();
} else {
@@ -414,7 +412,7 @@ box3d_get_center_screen (SPBox3D *box) {
if (!box3d_get_perspective(box)) {
return Geom::Point (Geom::infinity(), Geom::infinity());
}
- Geom::Matrix const i2d (SP_ITEM(box)->i2d_affine ());
+ Geom::Affine const i2d (SP_ITEM(box)->i2d_affine ());
return box3d_get_perspective(box)->perspective_impl->tmat.image(proj_center).affine() * i2d.inverse();
}
@@ -1344,7 +1342,7 @@ box3d_switch_perspectives(SPBox3D *box, Persp3D *old_persp, Persp3D *new_persp,
the original box and deletes the latter */
SPGroup *box3d_convert_to_group(SPBox3D *box)
{
- SPDocument *doc = SP_OBJECT_DOCUMENT(box);
+ SPDocument *doc = box->document;
Inkscape::XML::Document *xml_doc = doc->getReprDoc();
// remember position of the box
@@ -1369,7 +1367,7 @@ SPGroup *box3d_convert_to_group(SPBox3D *box)
}
// add the new group to the box's parent and set remembered position
- SPObject *parent = SP_OBJECT_PARENT(box);
+ SPObject *parent = box->parent;
parent->appendChild(grepr);
grepr->setPosition(pos);
grepr->setAttribute("style", style);
@@ -1378,7 +1376,7 @@ SPGroup *box3d_convert_to_group(SPBox3D *box)
if (clip_path)
grepr->setAttribute("clip-path", clip_path);
- SP_OBJECT(box)->deleteObject(true);
+ box->deleteObject(true);
grepr->setAttribute("id", id);