diff --git a/src/sp-tref.cpp b/src/sp-tref.cpp
index ad85b4d85d3419103dd947272558ae93ff46c93d..eddcd270c482a79be553201b5d7a21f5d9840833 100644 (file)
--- a/src/sp-tref.cpp
+++ b/src/sp-tref.cpp
-#define __SP_TREF_CPP__
-
/** \file
* SVG <tref> implementation - All character data within the referenced
* element, including character data enclosed within additional markup,
/*
* Authors:
* Gail Banaszkiewicz <Gail.Banaszkiewicz@gmail.com>
+ * Jon A. Cruz <jon@joncruz.org>
+ * Abhishek Sharma
*
* Copyright (C) 2007 Gail Banaszkiewicz
*
static void sp_tref_modified(SPObject *object, guint flags);
static Inkscape::XML::Node *sp_tref_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
-static void sp_tref_bbox(SPItem const *item, NRRect *bbox, NR::Matrix const &transform, unsigned const flags);
+static void sp_tref_bbox(SPItem const *item, NRRect *bbox, Geom::Matrix const &transform, unsigned const flags);
static gchar *sp_tref_description(SPItem *item);
static void sp_tref_href_changed(SPObject *old_ref, SPObject *ref, SPTRef *tref);
@@ -154,12 +154,12 @@ sp_tref_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr)
((SPObjectClass *) tref_parent_class)->build(object, document, repr);
}
- sp_object_read_attr(object, "xlink:href");
- sp_object_read_attr(object, "x");
- sp_object_read_attr(object, "y");
- sp_object_read_attr(object, "dx");
- sp_object_read_attr(object, "dy");
- sp_object_read_attr(object, "rotate");
+ object->readAttr( "xlink:href" );
+ object->readAttr( "x" );
+ object->readAttr( "y" );
+ object->readAttr( "dx" );
+ object->readAttr( "dy" );
+ object->readAttr( "rotate" );
}
/**
@@ -320,11 +320,11 @@ sp_tref_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML:
* The code for this function is swiped from the tspan bbox code, since tref should work pretty much the same way
*/
static void
-sp_tref_bbox(SPItem const *item, NRRect *bbox, NR::Matrix const &transform, unsigned const /*flags*/)
+sp_tref_bbox(SPItem const *item, NRRect *bbox, Geom::Matrix const &transform, unsigned const /*flags*/)
{
// find out the ancestor text which holds our layout
SPObject *parent_text = SP_OBJECT(item);
- for (; parent_text != NULL && !SP_IS_TEXT(parent_text); parent_text = SP_OBJECT_PARENT (parent_text));
+ for (; parent_text != NULL && !SP_IS_TEXT(parent_text); parent_text = SP_OBJECT_PARENT (parent_text)){};
if (parent_text == NULL) return;
// get the bbox of our portion of the layout
@@ -334,7 +334,7 @@ sp_tref_bbox(SPItem const *item, NRRect *bbox, NR::Matrix const &transform, unsi
// Add stroke width
SPStyle* style=SP_OBJECT_STYLE (item);
if (!style->stroke.isNone()) {
- double const scale = expansion(transform);
+ double const scale = transform.descrim();
if ( fabs(style->stroke_width.computed * scale) > 0.01 ) { // sinon c'est 0=oon veut pas de bord
double const width = MAX(0.125, style->stroke_width.computed * scale);
if ( fabs(bbox->x1 - bbox->x0) > -0.00001 && fabs(bbox->y1 - bbox->y0) > -0.00001 ) {
char *child_desc;
if (SP_IS_ITEM(referred)) {
- child_desc = sp_item_description(SP_ITEM(referred));
+ child_desc = SP_ITEM(referred)->description();
} else {
child_desc = g_strdup("");
}
tref->_delete_connection.disconnect();
if (tref->stringChild) {
- sp_object_detach(SP_OBJECT(tref), tref->stringChild);
+ SP_OBJECT(tref)->detach(tref->stringChild);
tref->stringChild = NULL;
}
}
-void
-sp_tref_update_text(SPTRef *tref)
+void sp_tref_update_text(SPTRef *tref)
{
if (tref) {
// Get the character data that will be used with this tref
build_string_from_root(SP_OBJECT_REPR(tref->getObjectReferredTo()), &charData);
if (tref->stringChild) {
- sp_object_detach(SP_OBJECT(tref), tref->stringChild);
+ SP_OBJECT(tref)->detach(tref->stringChild);
tref->stringChild = NULL;
}
// Create the node and SPString to be the tref's child
- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(tref));
+ Inkscape::XML::Document *xml_doc = SP_OBJECT_DOCUMENT(tref)->getReprDoc();
Inkscape::XML::Node *newStringRepr = xml_doc->createTextNode(charData.c_str());
tref->stringChild = SP_OBJECT(g_object_new(sp_repr_type_lookup(newStringRepr), NULL));
// Add this SPString as a child of the tref
- sp_object_attach(SP_OBJECT(tref), tref->stringChild, tref->lastChild());
+ SP_OBJECT(tref)->attach(tref->stringChild, tref->lastChild());
sp_object_unref(tref->stringChild, NULL);
- sp_object_invoke_build(tref->stringChild, SP_OBJECT(tref)->document, newStringRepr, TRUE);
+ (tref->stringChild)->invoke_build(SP_OBJECT(tref)->document, newStringRepr, TRUE);
Inkscape::GC::release(newStringRepr);
}
Inkscape::XML::Node *tref_parent = sp_repr_parent(tref_repr);
SPDocument *document = SP_OBJECT(tref)->document;
- Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document);
+ Inkscape::XML::Document *xml_doc = document->getReprDoc();
Inkscape::XML::Node *new_tspan_repr = xml_doc->createElement("svg:tspan");
////////////////////
else {
GSList *l = NULL;
- for (SPObject *child = sp_object_first_child(obj) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) {
+ for (SPObject *child = obj->firstChild() ; child != NULL ; child = child->getNext() ) {
sp_object_ref (SP_OBJECT (child), obj);
l = g_slist_prepend (l, child);
}
fill-column:99
End:
*/
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :