diff options
| author | Jon A. Cruz <jon@joncruz.org> | 2011-02-21 07:59:34 +0000 |
|---|---|---|
| committer | Jon A. Cruz <jon@joncruz.org> | 2011-02-21 07:59:34 +0000 |
| commit | ccba415bc620a21239f11361078c8c30006106c7 (patch) | |
| tree | b68a10c9bfa0af11aed2a2db8ef8ed025af39654 /src/sp-text.cpp | |
| parent | Pass removing some outdated C-macro use. (diff) | |
| download | inkscape-ccba415bc620a21239f11361078c8c30006106c7.tar.gz inkscape-ccba415bc620a21239f11361078c8c30006106c7.zip | |
Finished cleanup of outated SP_OBJECT_DOCUMENT C macro.
(bzr r10060)
Diffstat (limited to 'src/sp-text.cpp')
| -rw-r--r-- | src/sp-text.cpp | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/src/sp-text.cpp b/src/sp-text.cpp index 3abeadaee..57f9dd14e 100644 --- a/src/sp-text.cpp +++ b/src/sp-text.cpp @@ -227,18 +227,18 @@ static void sp_text_update(SPObject *object, SPCtx *ctx, guint flags) // Create temporary list of children GSList *l = NULL; for (SPObject *child = object->firstChild() ; child ; child = child->getNext() ) { - sp_object_ref (SP_OBJECT (child), object); + sp_object_ref(child, object); l = g_slist_prepend (l, child); } l = g_slist_reverse (l); while (l) { - SPObject *child = SP_OBJECT (l->data); + SPObject *child = reinterpret_cast<SPObject*>(l->data); // We just built this list, so cast is safe. l = g_slist_remove (l, child); if (cflags || (child->uflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) { /* fixme: Do we need transform? */ child->updateDisplay(ctx, cflags); } - sp_object_unref (SP_OBJECT (child), object); + sp_object_unref(child, object); } if (flags & ( SP_OBJECT_STYLE_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG | @@ -253,7 +253,7 @@ static void sp_text_update(SPObject *object, SPCtx *ctx, guint flags) text->invoke_bbox( &paintbox, Geom::identity(), TRUE); for (SPItemView* v = text->display; v != NULL; v = v->next) { text->_clearFlow(NR_ARENA_GROUP(v->arenaitem)); - nr_arena_group_set_style(NR_ARENA_GROUP(v->arenaitem), SP_OBJECT_STYLE(object)); + nr_arena_group_set_style(NR_ARENA_GROUP(v->arenaitem), object->style); // pass the bbox of the text object as paintbox (used for paintserver fills) text->layout.show(NR_ARENA_GROUP(v->arenaitem), &paintbox); } @@ -281,7 +281,7 @@ static void sp_text_modified(SPObject *object, guint flags) text->invoke_bbox( &paintbox, Geom::identity(), TRUE); for (SPItemView* v = text->display; v != NULL; v = v->next) { text->_clearFlow(NR_ARENA_GROUP(v->arenaitem)); - nr_arena_group_set_style(NR_ARENA_GROUP(v->arenaitem), SP_OBJECT_STYLE(object)); + nr_arena_group_set_style(NR_ARENA_GROUP(v->arenaitem), object->style); text->layout.show(NR_ARENA_GROUP(v->arenaitem), &paintbox); } } @@ -289,17 +289,17 @@ static void sp_text_modified(SPObject *object, guint flags) // Create temporary list of children GSList *l = NULL; for (SPObject *child = object->firstChild() ; child ; child = child->getNext() ) { - sp_object_ref (SP_OBJECT (child), object); + sp_object_ref(child, object); l = g_slist_prepend (l, child); } l = g_slist_reverse (l); while (l) { - SPObject *child = SP_OBJECT (l->data); + SPObject *child = reinterpret_cast<SPObject*>(l->data); // We just built this list, so cast is safe. l = g_slist_remove (l, child); if (cflags || (child->mflags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_CHILD_MODIFIED_FLAG))) { child->emitModified(cflags); } - sp_object_unref (SP_OBJECT (child), object); + sp_object_unref(child, object); } } @@ -337,7 +337,7 @@ static Inkscape::XML::Node *sp_text_write(SPObject *object, Inkscape::XML::Docum continue; } if (SP_IS_STRING(child)) { - SP_OBJECT_REPR(child)->setContent(SP_STRING(child)->string.c_str()); + child->getRepr()->setContent(SP_STRING(child)->string.c_str()); } else { child->updateRepr(flags); } @@ -350,9 +350,9 @@ static Inkscape::XML::Node *sp_text_write(SPObject *object, Inkscape::XML::Docum if (text->style->line_height.set && !text->style->line_height.inherit && !text->style->line_height.normal && text->style->line_height.unit == SP_CSS_UNIT_PERCENT) { Inkscape::SVGOStringStream os; os << (text->style->line_height.value * 100.0) << "%"; - SP_OBJECT_REPR(text)->setAttribute("sodipodi:linespacing", os.str().c_str()); + text->getRepr()->setAttribute("sodipodi:linespacing", os.str().c_str()); } else { - SP_OBJECT_REPR(text)->setAttribute("sodipodi:linespacing", NULL); + text->getRepr()->setAttribute("sodipodi:linespacing", NULL); } if (((SPObjectClass *) (text_parent_class))->write) { @@ -368,7 +368,7 @@ sp_text_bbox(SPItem const *item, NRRect *bbox, Geom::Affine const &transform, un SP_TEXT(item)->layout.getBoundingBox(bbox, transform); // Add stroke width - SPStyle* style=SP_OBJECT_STYLE (item); + SPStyle* style = item->style; if (!style->stroke.isNone()) { double const scale = transform.descrim(); if ( fabs(style->stroke_width.computed * scale) > 0.01 ) { // sinon c'est 0=oon veut pas de bord @@ -409,11 +409,10 @@ sp_text_hide(SPItem *item, unsigned key) ((SPItemClass *) text_parent_class)->hide (item, key); } -static char * -sp_text_description(SPItem *item) +static char * sp_text_description(SPItem *item) { - SPText *text = (SPText *) item; - SPStyle *style = SP_OBJECT_STYLE(text); + SPText *text = reinterpret_cast<SPText *>(item); + SPStyle *style = text->style; font_instance *tf = font_factory::Default()->FaceFromStyle(style); @@ -515,8 +514,8 @@ sp_text_print (SPItem *item, SPPrintContext *ctx) item->getBboxDesktop (&bbox); dbox.x0 = 0.0; dbox.y0 = 0.0; - dbox.x1 = SP_OBJECT_DOCUMENT (item)->getWidth (); - dbox.y1 = SP_OBJECT_DOCUMENT (item)->getHeight (); + dbox.x1 = item->document->getWidth(); + dbox.y1 = item->document->getHeight(); Geom::Affine const ctm (item->i2d_affine()); group->layout.print(ctx,&pbox,&dbox,&bbox,ctm); @@ -623,7 +622,7 @@ void SPText::rebuildLayout() void SPText::_adjustFontsizeRecursive(SPItem *item, double ex, bool is_root) { - SPStyle *style = SP_OBJECT_STYLE (item); + SPStyle *style = item->style; if (style && !NR_DF_TEST_CLOSE (ex, 1.0, NR_EPSILON)) { if (!style->font_size.set && is_root) { |
