diff options
| author | Jon A. Cruz <jon@joncruz.org> | 2011-02-21 21:43:30 +0000 |
|---|---|---|
| committer | Jon A. Cruz <jon@joncruz.org> | 2011-02-21 21:43:30 +0000 |
| commit | aa8c0d876949c952ab355c096017301a00734456 (patch) | |
| tree | 6aeabb3dc05451470bc8c6a0f72ca1634eed2ace | |
| parent | emf import. support for round rectangle (Bug 247695) (diff) | |
| download | inkscape-aa8c0d876949c952ab355c096017301a00734456.tar.gz inkscape-aa8c0d876949c952ab355c096017301a00734456.zip | |
Finished cleanup of outdated SP_OBJECT_PARENT C macro.
(bzr r10064)
| -rw-r--r-- | src/desktop-style.cpp | 146 | ||||
| -rw-r--r-- | src/dialogs/clonetiler.cpp | 46 | ||||
| -rw-r--r-- | src/dialogs/xml-tree.cpp | 2 | ||||
| -rw-r--r-- | src/interface.cpp | 26 | ||||
| -rw-r--r-- | src/layer-manager.cpp | 12 | ||||
| -rw-r--r-- | src/live_effects/lpeobject-reference.cpp | 4 | ||||
| -rw-r--r-- | src/object-hierarchy.cpp | 6 | ||||
| -rw-r--r-- | src/path-chemistry.cpp | 95 | ||||
| -rw-r--r-- | src/selection-describer.cpp | 4 | ||||
| -rw-r--r-- | src/selection.cpp | 14 | ||||
| -rw-r--r-- | src/sp-flowregion.cpp | 4 | ||||
| -rw-r--r-- | src/sp-object.h | 1 | ||||
| -rw-r--r-- | src/sp-style-elem.cpp | 2 | ||||
| -rw-r--r-- | src/sp-tspan.cpp | 36 | ||||
| -rw-r--r-- | src/sp-use-reference.cpp | 12 | ||||
| -rw-r--r-- | src/sp-use.cpp | 72 | ||||
| -rw-r--r-- | src/text-chemistry.cpp | 76 | ||||
| -rw-r--r-- | src/text-editing.cpp | 2 | ||||
| -rw-r--r-- | src/ui/widget/layer-selector.cpp | 14 | ||||
| -rw-r--r-- | src/widgets/icon.cpp | 2 |
20 files changed, 317 insertions, 259 deletions
diff --git a/src/desktop-style.cpp b/src/desktop-style.cpp index b8de8aadc..d2ec093fc 100644 --- a/src/desktop-style.cpp +++ b/src/desktop-style.cpp @@ -108,9 +108,9 @@ sp_desktop_apply_css_recursive(SPObject *o, SPCSSAttr *css, bool skip_lines) !(SP_IS_FLOWREGION(o) || SP_IS_FLOWREGIONEXCLUDE(o) || (SP_IS_USE(o) && - SP_OBJECT_PARENT(o) && - (SP_IS_FLOWREGION(SP_OBJECT_PARENT(o)) || - SP_IS_FLOWREGIONEXCLUDE(SP_OBJECT_PARENT(o)) + o->parent && + (SP_IS_FLOWREGION(o->parent) || + SP_IS_FLOWREGIONEXCLUDE(o->parent) ) ) ) @@ -431,7 +431,7 @@ stroke_average_width (GSList const *objects) notstroked = false; } - avgwidth += SP_OBJECT_STYLE (object)->stroke_width.computed * i2d.descrim(); + avgwidth += object->style->stroke_width.computed * i2d.descrim(); } if (notstroked) @@ -482,13 +482,15 @@ objects_query_fillstroke (GSList *objects, SPStyle *style_res, bool const isfill for (GSList const *i = objects; i != NULL; i = i->next) { SPObject *obj = SP_OBJECT (i->data); - SPStyle *style = SP_OBJECT_STYLE (obj); - if (!style) continue; + SPStyle *style = obj->style; + if (!style) { + continue; + } SPIPaint *paint = isfill? &style->fill : &style->stroke; // We consider paint "effectively set" for anything within text hierarchy - SPObject *parent = SP_OBJECT_PARENT (obj); + SPObject *parent = obj->parent; bool paint_effectively_set = paint->set || (SP_IS_TEXT(parent) || SP_IS_TEXTPATH(parent) || SP_IS_TSPAN(parent) || SP_IS_FLOWTEXT(parent) || SP_IS_FLOWDIV(parent) || SP_IS_FLOWPARA(parent) @@ -649,18 +651,22 @@ objects_query_opacity (GSList *objects, SPStyle *style_res) for (GSList const *i = objects; i != NULL; i = i->next) { SPObject *obj = SP_OBJECT (i->data); - SPStyle *style = SP_OBJECT_STYLE (obj); - if (!style) continue; + SPStyle *style = obj->style; + if (!style) { + continue; + } double opacity = SP_SCALE24_TO_FLOAT(style->opacity.value); opacity_sum += opacity; - if (opacity_prev != -1 && opacity != opacity_prev) + if (opacity_prev != -1 && opacity != opacity_prev) { same_opacity = false; + } opacity_prev = opacity; opacity_items ++; } - if (opacity_items > 1) + if (opacity_items > 1) { opacity_sum /= opacity_items; + } style_res->opacity.value = SP_SCALE24_FROM_FLOAT(opacity_sum); @@ -669,10 +675,11 @@ objects_query_opacity (GSList *objects, SPStyle *style_res) } else if (opacity_items == 1) { return QUERY_STYLE_SINGLE; } else { - if (same_opacity) + if (same_opacity) { return QUERY_STYLE_MULTIPLE_SAME; - else + } else { return QUERY_STYLE_MULTIPLE_AVERAGED; + } } } @@ -697,9 +704,13 @@ objects_query_strokewidth (GSList *objects, SPStyle *style_res) for (GSList const *i = objects; i != NULL; i = i->next) { SPObject *obj = SP_OBJECT (i->data); - if (!SP_IS_ITEM(obj)) continue; - SPStyle *style = SP_OBJECT_STYLE (obj); - if (!style) continue; + if (!SP_IS_ITEM(obj)) { + continue; + } + SPStyle *style = obj->style; + if (!style) { + continue; + } if ( style->stroke.isNone() && !( style->marker[SP_MARKER_LOC].set || // stroke width affects markers, so if there's no stroke but only markers then we should @@ -762,9 +773,13 @@ objects_query_miterlimit (GSList *objects, SPStyle *style_res) for (GSList const *i = objects; i != NULL; i = i->next) { SPObject *obj = SP_OBJECT (i->data); - if (!SP_IS_ITEM(obj)) continue; - SPStyle *style = SP_OBJECT_STYLE (obj); - if (!style) continue; + if (!SP_IS_ITEM(obj)) { + continue; + } + SPStyle *style = obj->style; + if (!style) { + continue; + } if ( style->stroke.isNone() ) { continue; @@ -772,15 +787,17 @@ objects_query_miterlimit (GSList *objects, SPStyle *style_res) n_stroked ++; - if (prev_ml != -1 && fabs(style->stroke_miterlimit.value - prev_ml) > 1e-3) + if (prev_ml != -1 && fabs(style->stroke_miterlimit.value - prev_ml) > 1e-3) { same_ml = false; + } prev_ml = style->stroke_miterlimit.value; avgml += style->stroke_miterlimit.value; } - if (n_stroked > 1) + if (n_stroked > 1) { avgml /= (n_stroked); + } style_res->stroke_miterlimit.value = avgml; style_res->stroke_miterlimit.set = true; @@ -815,9 +832,13 @@ objects_query_strokecap (GSList *objects, SPStyle *style_res) for (GSList const *i = objects; i != NULL; i = i->next) { SPObject *obj = SP_OBJECT (i->data); - if (!SP_IS_ITEM(obj)) continue; - SPStyle *style = SP_OBJECT_STYLE (obj); - if (!style) continue; + if (!SP_IS_ITEM(obj)) { + continue; + } + SPStyle *style = obj->style; + if (!style) { + continue; + } if ( style->stroke.isNone() ) { continue; @@ -865,9 +886,13 @@ objects_query_strokejoin (GSList *objects, SPStyle *style_res) for (GSList const *i = objects; i != NULL; i = i->next) { SPObject *obj = SP_OBJECT (i->data); - if (!SP_IS_ITEM(obj)) continue; - SPStyle *style = SP_OBJECT_STYLE (obj); - if (!style) continue; + if (!SP_IS_ITEM(obj)) { + continue; + } + SPStyle *style = obj->style; + if (!style) { + continue; + } if ( style->stroke.isNone() ) { continue; @@ -875,8 +900,9 @@ objects_query_strokejoin (GSList *objects, SPStyle *style_res) n_stroked ++; - if (prev_join != -1 && style->stroke_linejoin.value != prev_join) + if (prev_join != -1 && style->stroke_linejoin.value != prev_join) { same_join = false; + } prev_join = style->stroke_linejoin.value; join = style->stroke_linejoin.value; @@ -925,26 +951,31 @@ objects_query_fontnumbers (GSList *objects, SPStyle *style_res) if (!SP_IS_TEXT(obj) && !SP_IS_FLOWTEXT(obj) && !SP_IS_TSPAN(obj) && !SP_IS_TREF(obj) && !SP_IS_TEXTPATH(obj) - && !SP_IS_FLOWDIV(obj) && !SP_IS_FLOWPARA(obj) && !SP_IS_FLOWTSPAN(obj)) + && !SP_IS_FLOWDIV(obj) && !SP_IS_FLOWPARA(obj) && !SP_IS_FLOWTSPAN(obj)) { continue; + } - SPStyle *style = SP_OBJECT_STYLE (obj); - if (!style) continue; + SPStyle *style = obj->style; + if (!style) { + continue; + } texts ++; size += style->font_size.computed * Geom::Affine(SP_ITEM(obj)->i2d_affine()).descrim(); /// \todo FIXME: we assume non-% units here if (style->letter_spacing.normal) { - if (!different && (letterspacing_prev == 0 || letterspacing_prev == letterspacing)) + if (!different && (letterspacing_prev == 0 || letterspacing_prev == letterspacing)) { letterspacing_normal = true; + } } else { letterspacing += style->letter_spacing.computed; /// \todo FIXME: we assume non-% units here letterspacing_normal = false; } if (style->word_spacing.normal) { - if (!different && (wordspacing_prev == 0 || wordspacing_prev == wordspacing)) + if (!different && (wordspacing_prev == 0 || wordspacing_prev == wordspacing)) { wordspacing_normal = true; + } } else { wordspacing += style->word_spacing.computed; /// \todo FIXME: we assume non-% units here wordspacing_normal = false; @@ -1035,8 +1066,10 @@ objects_query_fontstyle (GSList *objects, SPStyle *style_res) && !SP_IS_FLOWDIV(obj) && !SP_IS_FLOWPARA(obj) && !SP_IS_FLOWTSPAN(obj)) continue; - SPStyle *style = SP_OBJECT_STYLE (obj); - if (!style) continue; + SPStyle *style = obj->style; + if (!style) { + continue; + } texts ++; @@ -1095,11 +1128,14 @@ objects_query_baselines (GSList *objects, SPStyle *style_res) if (!SP_IS_TEXT(obj) && !SP_IS_FLOWTEXT(obj) && !SP_IS_TSPAN(obj) && !SP_IS_TREF(obj) && !SP_IS_TEXTPATH(obj) - && !SP_IS_FLOWDIV(obj) && !SP_IS_FLOWPARA(obj) && !SP_IS_FLOWTSPAN(obj)) + && !SP_IS_FLOWDIV(obj) && !SP_IS_FLOWPARA(obj) && !SP_IS_FLOWTSPAN(obj)) { continue; + } - SPStyle *style = SP_OBJECT_STYLE (obj); - if (!style) continue; + SPStyle *style = obj->style; + if (!style) { + continue; + } texts ++; @@ -1187,8 +1223,10 @@ objects_query_fontfamily (GSList *objects, SPStyle *style_res) continue; } - SPStyle *style = SP_OBJECT_STYLE (obj); - if (!style) continue; + SPStyle *style = obj->style; + if (!style) { + continue; + } texts ++; @@ -1206,8 +1244,9 @@ objects_query_fontfamily (GSList *objects, SPStyle *style_res) style_res->text->font_family.value = g_strdup(style->text->font_family.value); } - if (texts == 0 || !style_res->text->font_family.set) + if (texts == 0 || !style_res->text->font_family.set) { return QUERY_STYLE_NOTHING; + } if (texts > 1) { if (different) { @@ -1242,8 +1281,10 @@ objects_query_fontspecification (GSList *objects, SPStyle *style_res) continue; } - SPStyle *style = SP_OBJECT_STYLE (obj); - if (!style) continue; + SPStyle *style = obj->style; + if (!style) { + continue; + } texts ++; @@ -1265,8 +1306,9 @@ objects_query_fontspecification (GSList *objects, SPStyle *style_res) } } - if (texts == 0) + if (texts == 0) { return QUERY_STYLE_NOTHING; + } if (texts > 1) { if (different) { @@ -1291,8 +1333,10 @@ objects_query_blend (GSList *objects, SPStyle *style_res) for (GSList const *i = objects; i != NULL; i = i->next) { SPObject *obj = SP_OBJECT (i->data); - SPStyle *style = SP_OBJECT_STYLE (obj); - if(!style || !SP_IS_ITEM(obj)) continue; + SPStyle *style = obj->style; + if (!style || !SP_IS_ITEM(obj)) { + continue; + } items++; @@ -1376,9 +1420,13 @@ objects_query_blur (GSList *objects, SPStyle *style_res) for (GSList const *i = objects; i != NULL; i = i->next) { SPObject *obj = SP_OBJECT (i->data); - SPStyle *style = SP_OBJECT_STYLE (obj); - if (!style) continue; - if (!SP_IS_ITEM(obj)) continue; + SPStyle *style = obj->style; + if (!style) { + continue; + } + if (!SP_IS_ITEM(obj)) { + continue; + } Geom::Affine i2d = SP_ITEM(obj)->i2d_affine(); diff --git a/src/dialogs/clonetiler.cpp b/src/dialogs/clonetiler.cpp index bd5be5be5..c83c38a01 100644 --- a/src/dialogs/clonetiler.cpp +++ b/src/dialogs/clonetiler.cpp @@ -803,27 +803,29 @@ clonetiler_get_transform ( static bool clonetiler_is_a_clone_of (SPObject *tile, SPObject *obj) { + bool result = false; char *id_href = NULL; if (obj) { - Inkscape::XML::Node *obj_repr = SP_OBJECT_REPR(obj); + Inkscape::XML::Node *obj_repr = obj->getRepr(); id_href = g_strdup_printf("#%s", obj_repr->attribute("id")); } if (SP_IS_USE(tile) && - SP_OBJECT_REPR(tile)->attribute("xlink:href") && - (!id_href || !strcmp(id_href, SP_OBJECT_REPR(tile)->attribute("xlink:href"))) && - SP_OBJECT_REPR(tile)->attribute("inkscape:tiled-clone-of") && - (!id_href || !strcmp(id_href, SP_OBJECT_REPR(tile)->attribute("inkscape:tiled-clone-of")))) + tile->getRepr()->attribute("xlink:href") && + (!id_href || !strcmp(id_href, tile->getRepr()->attribute("xlink:href"))) && + tile->getRepr()->attribute("inkscape:tiled-clone-of") && + (!id_href || !strcmp(id_href, tile->getRepr()->attribute("inkscape:tiled-clone-of")))) { - if (id_href) - g_free (id_href); - return true; + result = true; } else { - if (id_href) - g_free (id_href); - return false; + result = false; } + if (id_href) { + g_free(id_href); + id_href = 0; + } + return result; } static NRArena const *trace_arena = NULL; @@ -856,7 +858,7 @@ clonetiler_trace_setup (SPDocument *doc, gdouble zoom, SPItem *original) // hide the (current) original and any tiled clones, we only want to pick the background original->invoke_hide(trace_visionkey); - clonetiler_trace_hide_tiled_clones_recursively(SP_OBJECT(trace_doc->getRoot())); + clonetiler_trace_hide_tiled_clones_recursively(trace_doc->getRoot()); trace_doc->getRoot()->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); trace_doc->ensureUpToDate(); @@ -965,8 +967,8 @@ clonetiler_unclump( GtkWidget */*widget*/, void * ) return; } - SPObject *obj = SP_OBJECT(selection->singleItem()); - SPObject *parent = SP_OBJECT_PARENT (obj); + SPObject *obj = selection->singleItem(); + SPObject *parent = obj->parent; GSList *to_unclump = NULL; // not including the original @@ -989,7 +991,7 @@ clonetiler_unclump( GtkWidget */*widget*/, void * ) static guint clonetiler_number_of_clones (SPObject *obj) { - SPObject *parent = SP_OBJECT_PARENT (obj); + SPObject *parent = obj->parent; guint n = 0; @@ -1017,8 +1019,8 @@ clonetiler_remove( GtkWidget */*widget*/, void *, bool do_undo = true ) return; } - SPObject *obj = SP_OBJECT(selection->singleItem()); - SPObject *parent = SP_OBJECT_PARENT (obj); + SPObject *obj = selection->singleItem(); + SPObject *parent = obj->parent; // remove old tiling GSList *to_delete = NULL; @@ -1102,10 +1104,10 @@ clonetiler_apply( GtkWidget */*widget*/, void * ) gtk_widget_queue_draw(GTK_WIDGET(status)); gdk_window_process_all_updates(); - SPObject *obj = SP_OBJECT(selection->singleItem()); - Inkscape::XML::Node *obj_repr = SP_OBJECT_REPR(obj); + SPObject *obj = selection->singleItem(); + Inkscape::XML::Node *obj_repr = obj->getRepr(); const char *id_href = g_strdup_printf("#%s", obj_repr->attribute("id")); - SPObject *parent = SP_OBJECT_PARENT (obj); + SPObject *parent = obj->parent; clonetiler_remove (NULL, NULL, false); @@ -1462,7 +1464,7 @@ clonetiler_apply( GtkWidget */*widget*/, void * ) } // add the new clone to the top of the original's parent - SP_OBJECT_REPR(parent)->appendChild(clone); + parent->getRepr()->appendChild(clone); if (blur > 0.0) { SPObject *clone_object = sp_desktop_document(desktop)->getObjectByRepr(clone); @@ -1475,7 +1477,7 @@ clonetiler_apply( GtkWidget */*widget*/, void * ) // that we can take bbox of; however here we only need a lower bound so that blur // margins are not too small, and the perimeter should work SPFilter *constructed = new_filter_gaussian_blur(sp_desktop_document(desktop), radius, t.descrim(), t.expansionX(), t.expansionY(), perimeter, perimeter); - sp_style_set_property_url (clone_object, "filter", SP_OBJECT(constructed), false); + sp_style_set_property_url (clone_object, "filter", constructed, false); } if (center_set) { diff --git a/src/dialogs/xml-tree.cpp b/src/dialogs/xml-tree.cpp index d25bdad72..ddb419dcd 100644 --- a/src/dialogs/xml-tree.cpp +++ b/src/dialogs/xml-tree.cpp @@ -1602,7 +1602,7 @@ bool in_dt_coordsys(SPObject const &item) if (!SP_IS_ITEM(child)) { return false; } - SPObject const * const parent = SP_OBJECT_PARENT(child); + SPObject const * const parent = child->parent; if (parent == NULL) { break; } diff --git a/src/interface.cpp b/src/interface.cpp index 551e2bf91..3c310b8d1 100644 --- a/src/interface.cpp +++ b/src/interface.cpp @@ -1025,7 +1025,7 @@ sp_ui_main_menubar(Inkscape::UI::View::View *view) } static void leave_group(GtkMenuItem *, SPDesktop *desktop) { - desktop->setCurrentLayer(SP_OBJECT_PARENT(desktop->currentLayer())); + desktop->setCurrentLayer(desktop->currentLayer()->parent); } static void enter_group(GtkMenuItem *mi, SPDesktop *desktop) { @@ -1071,13 +1071,13 @@ sp_ui_context_menu(Inkscape::UI::View::View *view, SPItem *item) if (item) { if (SP_IS_GROUP(item)) { group = SP_GROUP(item); - } else if ( item != dt->currentRoot() && SP_IS_GROUP(SP_OBJECT_PARENT(item)) ) { - group = SP_GROUP(SP_OBJECT_PARENT(item)); + } else if ( item != dt->currentRoot() && SP_IS_GROUP(item->parent) ) { + group = SP_GROUP(item->parent); } } if (( group && group != dt->currentLayer() ) || - ( dt->currentLayer() != dt->currentRoot() && SP_OBJECT_PARENT(dt->currentLayer()) != dt->currentRoot() ) ) { + ( dt->currentLayer() != dt->currentRoot() && dt->currentLayer()->parent != dt->currentRoot() ) ) { /* Separator */ sp_ui_menu_append_item(GTK_MENU(m), NULL, NULL, NULL, NULL, NULL, NULL); } @@ -1094,7 +1094,7 @@ sp_ui_context_menu(Inkscape::UI::View::View *view, SPItem *item) } if ( dt->currentLayer() != dt->currentRoot() ) { - if ( SP_OBJECT_PARENT(dt->currentLayer()) != dt->currentRoot() ) { + if ( dt->currentLayer()->parent != dt->currentRoot() ) { GtkWidget *w = gtk_menu_item_new_with_label(_("Go to parent")); g_signal_connect(G_OBJECT(w), "activate", GCallback(leave_group), dt); gtk_widget_show(w); @@ -1167,10 +1167,10 @@ sp_ui_drag_data_received(GtkWidget *widget, g_free(str); str = 0; - SP_OBJECT(item)->setAttribute( - fillnotstroke ? "inkscape:x-fill-tag":"inkscape:x-stroke-tag", - palName.c_str(), - false ); + item->setAttribute( + fillnotstroke ? "inkscape:x-fill-tag":"inkscape:x-stroke-tag", + palName.c_str(), + false ); item->updateRepr(); sp_repr_css_set_property( css, fillnotstroke ? "fill":"stroke", c ); @@ -1251,9 +1251,9 @@ sp_ui_drag_data_received(GtkWidget *widget, Inkscape::Preferences *prefs = Inkscape::Preferences::get(); delta = desktop->d2w(delta); double stroke_tolerance = - ( !SP_OBJECT_STYLE(item)->stroke.isNone() ? + ( !item->style->stroke.isNone() ? desktop->current_zoom() * - SP_OBJECT_STYLE (item)->stroke_width.computed * + item->style->stroke_width.computed * to_2geom(item->i2d_affine()).descrim() * 0.5 : 0.0) + prefs->getIntLimited("/options/dragtolerance/value", 0, 0, 100); @@ -1354,9 +1354,9 @@ sp_ui_drag_data_received(GtkWidget *widget, Inkscape::Preferences *prefs = Inkscape::Preferences::get(); delta = desktop->d2w(delta); double stroke_tolerance = - ( !SP_OBJECT_STYLE(item)->stroke.isNone() ? + ( !item->style->stroke.isNone() ? desktop->current_zoom() * - SP_OBJECT_STYLE (item)->stroke_width.computed * + item->style->stroke_width.computed * to_2geom(item->i2d_affine()).descrim() * 0.5 : 0.0) + prefs->getIntLimited("/options/dragtolerance/value", 0, 0, 100); diff --git a/src/layer-manager.cpp b/src/layer-manager.cpp index 95cefc229..e07d7b945 100644 --- a/src/layer-manager.cpp +++ b/src/layer-manager.cpp @@ -236,7 +236,7 @@ void LayerManager::_rebuild() { LayerWatcher* one = _watchers.back(); _watchers.pop_back(); if ( one->_obj ) { - Node* node = SP_OBJECT_REPR(one->_obj); + Node* node = one->_obj->getRepr(); if ( node ) { node->removeObserver(*one); } @@ -264,7 +264,7 @@ void LayerManager::_rebuild() { if ( root->isAncestorOf(layer) ) { needsAdd = true; - for ( SPObject* curr = layer; curr && (curr != root) && needsAdd; curr = SP_OBJECT_PARENT(curr) ) { + for ( SPObject* curr = layer; curr && (curr != root) && needsAdd; curr = curr->parent ) { if ( SP_IS_GROUP(curr) ) { SPGroup* group = SP_GROUP(curr); if ( group->layerMode() == SPGroup::LAYER ) { @@ -307,10 +307,10 @@ void LayerManager::_rebuild() { // See http://sourceforge.net/tracker/index.php?func=detail&aid=1339397&group_id=93438&atid=604306 SPObject const *higher = layer; - while ( higher && (SP_OBJECT_PARENT(higher) != root) ) { - higher = SP_OBJECT_PARENT(higher); + while ( higher && (higher->parent != root) ) { + higher = higher->parent; } - Node* node = higher ? SP_OBJECT_REPR(higher) : 0; + Node const* node = higher ? higher->getRepr() : 0; if ( node && node->parent() ) { // Debug::EventTracker<DebugAddLayer> tracker(*layer); @@ -318,7 +318,7 @@ void LayerManager::_rebuild() { LayerWatcher *eye = new LayerWatcher(this, layer, connection); _watchers.push_back( eye ); - SP_OBJECT_REPR(layer)->addObserver(*eye); + layer->getRepr()->addObserver(*eye); _addOne(layer); } diff --git a/src/live_effects/lpeobject-reference.cpp b/src/live_effects/lpeobject-reference.cpp index 9163d1c91..573c8a2fd 100644 --- a/src/live_effects/lpeobject-reference.cpp +++ b/src/live_effects/lpeobject-reference.cpp @@ -45,7 +45,7 @@ bool LPEObjectReference::_acceptObject(SPObject * const obj) const if (IS_LIVEPATHEFFECT(obj)) { SPObject * const owner = getOwner(); /* Refuse references to us or to an ancestor. */ - for ( SPObject *iter = owner ; iter ; iter = SP_OBJECT_PARENT(iter) ) { + for ( SPObject *iter = owner ; iter ; iter = iter->parent ) { if ( iter == obj ) { return false; } @@ -94,7 +94,7 @@ LPEObjectReference::start_listening(LivePathEffectObject* to) return; } lpeobject = to; - lpeobject_repr = SP_OBJECT_REPR(to); + lpeobject_repr = to->getRepr(); _delete_connection = to->connectDelete(sigc::bind(sigc::ptr_fun(&lpeobjectreference_delete_self), this)); _modified_connection = to->connectModified(sigc::bind<2>(sigc::ptr_fun(&lpeobjectreference_source_modified), this)); } diff --git a/src/object-hierarchy.cpp b/src/object-hierarchy.cpp index 55af55f28..e6a1618a7 100644 --- a/src/object-hierarchy.cpp +++ b/src/object-hierarchy.cpp @@ -70,10 +70,10 @@ void ObjectHierarchy::_addTop(SPObject *senior, SPObject *junior) { g_assert(junior != NULL); g_assert(senior != NULL); - SPObject *object=SP_OBJECT_PARENT(junior); + SPObject *object = junior->parent; do { _addTop(object); - object = SP_OBJECT_PARENT(object); + object = object->parent; } while ( object != senior ); } @@ -160,7 +160,7 @@ void ObjectHierarchy::_addBottom(SPObject *senior, SPObject *junior) { g_assert(senior != NULL); if ( junior != senior ) { - _addBottom(senior, SP_OBJECT_PARENT(junior)); + _addBottom(senior, junior->parent); _addBottom(junior); } } diff --git a/src/path-chemistry.cpp b/src/path-chemistry.cpp index bec3c5cbf..607d0ab6a 100644 --- a/src/path-chemistry.cpp +++ b/src/path-chemistry.cpp @@ -95,8 +95,9 @@ sp_selected_path_combine(SPDesktop *desktop) for (GSList *i = items; i != NULL; i = i->next) { // going from top to bottom SPItem *item = (SPItem *) i->data; - if (!SP_IS_PATH(item)) + if (!SP_IS_PATH(item)) { continue; + } if (!did) { selection->clear(); @@ -106,17 +107,17 @@ sp_selected_path_combine(SPDesktop *desktop) SPCurve *c = sp_path_get_curve_for_edit(SP_PATH(item)); if (first == NULL) { // this is the topmost path first = item; - parent = SP_OBJECT_REPR(first)->parent(); - position = SP_OBJECT_REPR(first)->position(); - id = SP_OBJECT_REPR(first)->attribute("id"); - transform = SP_OBJECT_REPR(first)->attribute("transform"); + parent = first->getRepr()->parent(); + position = first->getRepr()->position(); + id = first->getRepr()->attribute("id"); + transform = first->getRepr()->attribute("transform"); // FIXME: merge styles of combined objects instead of using the first one's style - style = g_strdup(SP_OBJECT_REPR(first)->attribute("style")); - path_effect = g_strdup(SP_OBJECT_REPR(first)->attribute("inkscape:path-effect")); + style = g_strdup(first->getRepr()->attribute("style")); + path_effect = g_strdup(first->getRepr()->attribute("inkscape:path-effect")); //c->transform(item->transform); curve = c; } else { - c->transform(item->getRelativeTransform(SP_OBJECT(first))); + c->transform(item->getRelativeTransform(first)); curve->append(c, false); c->unref(); } @@ -124,17 +125,18 @@ sp_selected_path_combine(SPDesktop *desktop) // unless this is the topmost object, if (item != first) { // reduce position only if the same parent - if (SP_OBJECT_REPR(item)->parent() == parent) + if (item->getRepr()->parent() == parent) { position--; + } // delete the object for real, so that its clones can take appropriate action - SP_OBJECT(item)->deleteObject(); + item->deleteObject(); } } g_slist_free(items); if (did) { - SP_OBJECT(first)->deleteObject(false); + first->deleteObject(false); // delete the topmost. Inkscape::XML::Document *xml_doc = desktop->doc()->getReprDoc(); @@ -214,21 +216,21 @@ sp_selected_path_break_apart(SPDesktop *desktop) did = true; - Inkscape::XML::Node *parent = SP_OBJECT_REPR(item)->parent(); - gint pos = SP_OBJECT_REPR(item)->position(); - char const *id = SP_OBJECT_REPR(item)->attribute("id"); + Inkscape::XML::Node *parent = item->getRepr()->parent(); + gint pos = item->getRepr()->position(); + char const *id = item->getRepr()->attribute("id"); // XML Tree being used directly here while it shouldn't be... - gchar *style = g_strdup(SP_OBJECT(item)->getRepr()->attribute("style")); + gchar *style = g_strdup(item->getRepr()->attribute("style")); // XML Tree being used directly here while it shouldn't be... - gchar *path_effect = g_strdup(SP_OBJECT(item)->getRepr()->attribute("inkscape:path-effect")); + gchar *path_effect = g_strdup(item->getRepr()->attribute("inkscape:path-effect")); Geom::PathVector apv = curve->get_pathvector() * SP_ITEM(path)->transform; curve->unref(); // it's going to resurrect as one of the pieces, so we delete without advertisement - SP_OBJECT(item)->deleteObject(false); + item->deleteObject(false); curve = new SPCurve(apv); g_assert(curve != NULL); @@ -380,7 +382,7 @@ sp_item_list_to_curves(const GSList *items, GSList **selected, GSList **to_selec if (SP_IS_BOX3D(item)) { // convert 3D box to ordinary group of paths; replace the old element in 'selected' with the new group - Inkscape::XML::Node *repr = SP_OBJECT_REPR(box3d_convert_to_group(SP_BOX3D(item))); + Inkscape::XML::Node *repr = box3d_convert_to_group(SP_BOX3D(item))->getRepr(); if (repr) { *to_select = g_slist_prepend (*to_select, repr); @@ -416,18 +418,18 @@ sp_item_list_to_curves(const GSList *items, GSList **selected, GSList **to_selec *selected = g_slist_remove (*selected, item); // remember the position of the item - gint pos = SP_OBJECT_REPR(item)->position(); + gint pos = item->getRepr()->position(); // remember parent - Inkscape::XML::Node *parent = SP_OBJECT_REPR(item)->parent(); + Inkscape::XML::Node *parent = item->getRepr()->parent(); // remember id - char const *id = SP_OBJECT_REPR(item)->attribute("id"); + char const *id = item->getRepr()->attribute("id"); // remember title gchar *title = item->title(); // remember description gchar *desc = item->desc(); // It's going to resurrect, so we delete without notifying listeners. - SP_OBJECT(item)->deleteObject(false); + item->deleteObject(false); // restore id repr->setAttribute("id", id); @@ -461,26 +463,26 @@ sp_selected_item_to_curved_repr(SPItem *item, guint32 /*text_grouping_policy*/) if (!item) return NULL; - Inkscape::XML::Document *xml_doc = SP_OBJECT_REPR(item)->document(); + Inkscape::XML::Document *xml_doc = item->getRepr()->document(); if (SP_IS_TEXT(item) || SP_IS_FLOWTEXT(item)) { // Special treatment for text: convert each glyph to separate path, then group the paths Inkscape::XML::Node *g_repr = xml_doc->createElement("svg:g"); - g_repr->setAttribute("transform", SP_OBJECT_REPR(item)->attribute("transform")); + g_repr->setAttribute("transform", item->getRepr()->attribute("transform")); /* Mask */ - gchar *mask_str = (gchar *) SP_OBJECT_REPR(item)->attribute("mask"); + gchar *mask_str = (gchar *) item->getRepr()->attribute("mask"); if ( mask_str ) g_repr->setAttribute("mask", mask_str); /* Clip path */ - gchar *clip_path_str = (gchar *) SP_OBJECT_REPR(item)->attribute("clip-path"); + gchar *clip_path_str = (gchar *) item->getRepr()->attribute("clip-path"); if ( clip_path_str ) g_repr->setAttribute("clip-path", clip_path_str); /* Rotation center */ - g_repr->setAttribute("inkscape:transform-center-x", SP_OBJECT_REPR(item)->attribute("inkscape:transform-center-x"), false); - g_repr->setAttribute("inkscape:transform-center-y", SP_OBJECT_REPR(item)->attribute("inkscape:transform-center-y"), false); + g_repr->setAttribute("inkscape:transform-center-x", item->getRepr()->attribute("inkscape:transform-center-x"), false); + g_repr->setAttribute("inkscape:transform-center-y", item->getRepr()->attribute("inkscape:transform-center-y"), false); /* Whole text's style */ - gchar *style_str = sp_style_write_difference(SP_OBJECT_STYLE(item), - SP_OBJECT_STYLE(SP_OBJECT_PARENT(item))); + gchar *style_str = sp_style_write_difference(item->style, + item->parent->style); g_repr->setAttribute("style", style_str); g_free(style_str); Inkscape::Text::Layout::iterator iter = te_get_layout(item)->begin(); @@ -497,11 +499,11 @@ sp_selected_item_to_curved_repr(SPItem *item, guint32 /*text_grouping_policy*/) if (!rawptr || !SP_IS_OBJECT(rawptr)) // no source for glyph, abort break; pos_obj = SP_OBJECT(rawptr); - while (SP_IS_STRING(pos_obj) && SP_OBJECT_PARENT(pos_obj)) { - pos_obj = SP_OBJECT_PARENT(pos_obj); // SPStrings don't have style + while (SP_IS_STRING(pos_obj) && pos_obj->parent) { + pos_obj = pos_obj->parent; // SPStrings don't have style } - gchar *style_str = sp_style_write_difference(SP_OBJECT_STYLE(pos_obj), - SP_OBJECT_STYLE(SP_OBJECT_PARENT(pos_obj))); + gchar *style_str = sp_style_write_difference(pos_obj->style, + pos_obj->parent->style); // get path from iter to iter_next: SPCurve *curve = te_get_layout(item)->convertToCurves(iter, iter_next); @@ -555,26 +557,26 @@ sp_selected_item_to_curved_repr(SPItem *item, guint32 /*text_grouping_policy*/) Inkscape::XML::Node *repr = xml_doc->createElement("svg:path"); /* Transformation */ - repr->setAttribute("transform", SP_OBJECT_REPR(item)->attribute("transform")); + repr->setAttribute("transform", item->getRepr()->attribute("transform")); /* Style */ - gchar *style_str = sp_style_write_difference(SP_OBJECT_STYLE(item), - SP_OBJECT_STYLE(SP_OBJECT_PARENT(item))); + gchar *style_str = sp_style_write_difference(item->style, + item->parent->style); repr->setAttribute("style", style_str); g_free(style_str); /* Mask */ - gchar *mask_str = (gchar *) SP_OBJECT_REPR(item)->attribute("mask"); + gchar *mask_str = (gchar *) item->getRepr()->attribute("mask"); if ( mask_str ) repr->setAttribute("mask", mask_str); /* Clip path */ - gchar *clip_path_str = (gchar *) SP_OBJECT_REPR(item)->attribute("clip-path"); + gchar *clip_path_str = (gchar *) item->getRepr()->attribute("clip-path"); if ( clip_path_str ) repr->setAttribute("clip-path", clip_path_str); /* Rotation center */ - repr->setAttribute("inkscape:transform-center-x", SP_OBJECT_REPR(item)->attribute("inkscape:transform-center-x"), false); - repr->setAttribute("inkscape:transform-center-y", SP_OBJECT_REPR(item)->attribute("inkscape:transform-center-y"), false); + repr->setAttribute("inkscape:transform-center-x", item->getRepr()->attribute("inkscape:transform-center-x"), false); + repr->setAttribute("inkscape:transform-center-y", item->getRepr()->attribute("inkscape:transform-center-y"), false); /* Definition */ gchar *def_str = sp_svg_write_path(curve->get_pathvector()); @@ -605,8 +607,9 @@ sp_selected_path_reverse(SPDesktop *desktop) for (GSList *i = items; i != NULL; i = i->next) { - if (!SP_IS_PATH(i->data)) + if (!SP_IS_PATH(i->data)) { continue; + } did = true; SPPath *path = SP_PATH(i->data); @@ -615,18 +618,18 @@ sp_selected_path_reverse(SPDesktop *desktop) gchar *str = sp_svg_write_path(rcurve->get_pathvector()); if ( sp_lpe_item_has_path_effect_recursive(SP_LPE_ITEM(path)) ) { - SP_OBJECT_REPR(path)->setAttribute("inkscape:original-d", str); + path->getRepr()->setAttribute("inkscape:original-d", str); } else { - SP_OBJECT_REPR(path)->setAttribute("d", str); + path->getRepr()->setAttribute("d", str); } g_free(str); rcurve->unref(); // reverse nodetypes order (Bug #179866) - gchar *nodetypes = g_strdup(SP_OBJECT_REPR(path)->attribute("sodipodi:nodetypes")); + gchar *nodetypes = g_strdup(path->getRepr()->attribute("sodipodi:nodetypes")); if ( nodetypes ) { - SP_OBJECT_REPR(path)->setAttribute("sodipodi:nodetypes", g_strreverse(nodetypes)); + path->getRepr()->setAttribute("sodipodi:nodetypes", g_strreverse(nodetypes)); g_free(nodetypes); } } diff --git a/src/selection-describer.cpp b/src/selection-describer.cpp index 7bc6adf38..5693ce351 100644 --- a/src/selection-describer.cpp +++ b/src/selection-describer.cpp @@ -128,7 +128,7 @@ void SelectionDescriber::_updateMessageFromSelection(Inkscape::Selection *select _context.set(Inkscape::NORMAL_MESSAGE, _when_nothing); } else { SPItem *item = SP_ITEM(items->data); - SPObject *layer = selection->desktop()->layerForObject (SP_OBJECT (item)); + SPObject *layer = selection->desktop()->layerForObject(item); SPObject *root = selection->desktop()->currentRoot(); // Layer name @@ -154,7 +154,7 @@ void SelectionDescriber::_updateMessageFromSelection(Inkscape::Selection *select } // Parent name - SPObject *parent = SP_OBJECT_PARENT (item); + SPObject *parent = item->parent; gchar const *parent_label = parent->getId(); char *quoted_parent_label = xml_quote_strdup(parent_label); gchar *parent_name = g_strdup_printf(_("<i>%s</i>"), quoted_parent_label); diff --git a/src/selection.cpp b/src/selection.cpp index 79a71afbd..7564fad3a 100644 --- a/src/selection.cpp +++ b/src/selection.cpp @@ -308,7 +308,7 @@ GSList const *Selection::reprList() { for ( GSList const *iter=itemList() ; iter != NULL ; iter = iter->next ) { SPObject *obj=reinterpret_cast<SPObject *>(iter->data); - _reprs = g_slist_prepend(_reprs, SP_OBJECT_REPR(obj)); + _reprs = g_slist_prepend(_reprs, obj->getRepr()); } _reprs = g_slist_reverse(_reprs); @@ -359,7 +359,7 @@ SPItem *Selection::singleItem() { Inkscape::XML::Node *Selection::singleRepr() { SPObject *obj=single(); - return obj ? SP_OBJECT_REPR(obj) : NULL; + return obj ? obj->getRepr() : NULL; } NRRect *Selection::bounds(NRRect *bbox, SPItem::BBoxType type) const @@ -489,24 +489,24 @@ void Selection::_removeObjectDescendants(SPObject *obj) { for ( iter = _objs ; iter ; iter = next ) { next = iter->next; SPObject *sel_obj=reinterpret_cast<SPObject *>(iter->data); - SPObject *parent=SP_OBJECT_PARENT(sel_obj); + SPObject *parent = sel_obj->parent; while (parent) { if ( parent == obj ) { _remove(sel_obj); break; } - parent = SP_OBJECT_PARENT(parent); + parent = parent->parent; } } } void Selection::_removeObjectAncestors(SPObject *obj) { - SPObject *parent=SP_OBJECT_PARENT(obj); + SPObject *parent = obj->parent; while (parent) { if (includes(parent)) { _remove(parent); } - parent = SP_OBJECT_PARENT(parent); + parent = parent->parent; } } @@ -537,7 +537,7 @@ guint Selection::numberOfParents() { GSList const *items = const_cast<Selection *>(this)->itemList(); GSList *parents = NULL; for (GSList const *iter = items; iter != NULL; iter = iter->next) { - SPObject *parent = SP_OBJECT_PARENT(iter->data); + SPObject *parent = SP_OBJECT(iter->data)->parent; if (g_slist_find (parents, parent) == NULL) { parents = g_slist_prepend (parents, parent); } diff --git a/src/sp-flowregion.cpp b/src/sp-flowregion.cpp index 210f350b8..46690167f 100644 --- a/src/sp-flowregion.cpp +++ b/src/sp-flowregion.cpp @@ -507,7 +507,7 @@ static void GetDest(SPObject* child,Shape **computed) 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)); + tr_mat = SP_ITEM(u_child)->getRelativeTransform(child->parent); } else { tr_mat = SP_ITEM(u_child)->transform; } @@ -524,7 +524,7 @@ static void GetDest(SPObject* child,Shape **computed) temp->Convert(0.25); temp->Fill(n_shp,0); Shape* uncross=new Shape; - SPStyle* style=SP_OBJECT_STYLE(u_child); + SPStyle* style = u_child->style; if ( style && style->fill_rule.computed == SP_WIND_RULE_EVENODD ) { uncross->ConvertToShape(n_shp,fill_oddEven); } else { diff --git a/src/sp-object.h b/src/sp-object.h index 094ad5bb0..5d9ac88ff 100644 --- a/src/sp-object.h +++ b/src/sp-object.h @@ -56,7 +56,6 @@ class SPObjectClass; /* Convenience stuff */ #define SP_OBJECT_REPR(o) (((SPObject *) (o))->getRepr()) -#define SP_OBJECT_PARENT(o) (((SPObject *) (o))->parent) #define SP_OBJECT_STYLE(o) (((SPObject *) (o))->style) #include <glib-object.h> diff --git a/src/sp-style-elem.cpp b/src/sp-style-elem.cpp index 02ed80445..2e14ae5ff 100644 --- a/src/sp-style-elem.cpp +++ b/src/sp-style-elem.cpp @@ -366,7 +366,7 @@ sp_style_elem_read_content(SPObject *const object) // Below is a partial hack that fixes this for a single case: when the <style> is a child of the object // that uses a style from it. It just forces the parent of <style> to reread its style as soon as the stylesheet // is fully loaded. Naturally, this won't work if the user of the stylesheet is its grandparent or precedent. - SPObject *parent = SP_OBJECT_PARENT (object); + SPObject *parent = object->parent; if ( parent ) { sp_style_read_from_object(parent->style, parent); } diff --git a/src/sp-tspan.cpp b/src/sp-tspan.cpp index 57c23929d..14e7452fe 100644 --- a/src/sp-tspan.cpp +++ b/src/sp-tspan.cpp @@ -207,15 +207,19 @@ static void sp_tspan_modified(SPObject *object, unsigned flags) static void sp_tspan_bbox(SPItem const *item, NRRect *bbox, Geom::Affine 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)){}; - if (parent_text == NULL) return; + SPObject const *parent_text = item; + while (parent_text && !SP_IS_TEXT(parent_text)) { + parent_text = parent_text->parent; + } + if (parent_text == NULL) { + return; + } // get the bbox of our portion of the layout SP_TEXT(parent_text)->layout.getBoundingBox(bbox, transform, sp_text_get_length_upto(parent_text, item), sp_text_get_length_upto(item, NULL) - 1); // 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 @@ -268,7 +272,7 @@ sp_tspan_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML } else if ( SP_IS_TEXTPATH(child) ) { //c_repr = child->updateRepr(xml_doc, NULL, flags); // shouldn't happen } else 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()); } } } @@ -365,7 +369,7 @@ sp_textpath_init(SPTextPath *textpath) textpath->originalPath = NULL; textpath->isUpdating=false; // set up the uri reference - textpath->sourcePath = new SPUsePath(SP_OBJECT(textpath)); + textpath->sourcePath = new SPUsePath(textpath); textpath->sourcePath->user_unlink = sp_textpath_to_text; } @@ -523,7 +527,7 @@ sp_textpath_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape:: if (textpath->startOffset.unit == SVGLength::PERCENT) { Inkscape::SVGOStringStream os; os << (textpath->startOffset.computed * 100.0) << "%"; - SP_OBJECT_REPR(textpath)->setAttribute("startOffset", os.str().c_str()); + textpath->getRepr()->setAttribute("startOffset", os.str().c_str()); } else { /* FIXME: This logic looks rather undesirable if e.g. startOffset is to be in ems. */ @@ -560,7 +564,7 @@ sp_textpath_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape:: } else if ( SP_IS_TEXTPATH(child) ) { //c_repr = child->updateRepr(xml_doc, NULL, flags); // shouldn't happen } else 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()); } } } @@ -587,7 +591,7 @@ sp_textpath_get_path_item(SPTextPath *tp) void sp_textpath_to_text(SPObject *tp) { - SPObject *text = SP_OBJECT_PARENT(tp); + SPObject *text = tp->parent; NRRect bbox; SP_ITEM(text)->invoke_bbox( &bbox, SP_ITEM(text)->i2doc_affine(), TRUE); @@ -595,17 +599,17 @@ sp_textpath_to_text(SPObject *tp) // make a list of textpath children GSList *tp_reprs = NULL; - for (SPObject *o = SP_OBJECT(tp)->firstChild() ; o != NULL; o = o->next) { - tp_reprs = g_slist_prepend(tp_reprs, SP_OBJECT_REPR(o)); + for (SPObject *o = tp->firstChild() ; o != NULL; o = o->next) { + tp_reprs = g_slist_prepend(tp_reprs, o->getRepr()); } for ( GSList *i = tp_reprs ; i ; i = i->next ) { // make a copy of each textpath child - Inkscape::XML::Node *copy = ((Inkscape::XML::Node *) i->data)->duplicate(SP_OBJECT_REPR(text)->document()); + Inkscape::XML::Node *copy = ((Inkscape::XML::Node *) i->data)->duplicate(text->getRepr()->document()); // remove the old repr from under textpath - SP_OBJECT_REPR(tp)->removeChild((Inkscape::XML::Node *) i->data); + tp->getRepr()->removeChild((Inkscape::XML::Node *) i->data); // put its copy under text - SP_OBJECT_REPR(text)->addChild(copy, NULL); // fixme: copy id + text->getRepr()->addChild(copy, NULL); // fixme: copy id } //remove textpath @@ -615,8 +619,8 @@ sp_textpath_to_text(SPObject *tp) // set x/y on text /* fixme: Yuck, is this really the right test? */ if (xy[Geom::X] != 1e18 && xy[Geom::Y] != 1e18) { - sp_repr_set_svg_double(SP_OBJECT_REPR(text), "x", xy[Geom::X]); - sp_repr_set_svg_double(SP_OBJECT_REPR(text), "y", xy[Geom::Y]); + sp_repr_set_svg_double(text->getRepr(), "x", xy[Geom::X]); + sp_repr_set_svg_double(text->getRepr(), "y", xy[Geom::Y]); } } diff --git a/src/sp-use-reference.cpp b/src/sp-use-reference.cpp index 0784f2dd1..ec03ffce6 100644 --- a/src/sp-use-reference.cpp +++ b/src/sp-use-reference.cpp @@ -27,8 +27,8 @@ bool SPUseReference::_acceptObject(SPObject * const obj) const { if (SP_IS_ITEM(obj)) { SPObject * const owner = getOwner(); - /* Refuse references to us or to an ancestor. */ - for ( SPObject *iter = owner ; iter ; iter = SP_OBJECT_PARENT(iter) ) { + // Refuse references to us or to an ancestor. + for ( SPObject *iter = owner ; iter ; iter = iter->parent ) { if ( iter == obj ) { return false; } @@ -107,7 +107,7 @@ SPUsePath::start_listening(SPObject* to) return; } sourceObject = to; - sourceRepr = SP_OBJECT_REPR(to); + sourceRepr = to->getRepr(); _delete_connection = to->connectDelete(sigc::bind(sigc::ptr_fun(&sp_usepath_delete_self), this)); _transformed_connection = SP_ITEM(to)->connectTransformed(sigc::bind(sigc::ptr_fun(&sp_usepath_move_compensate), this)); _modified_connection = to->connectModified(sigc::bind<2>(sigc::ptr_fun(&sp_usepath_source_modified), this)); @@ -135,7 +135,7 @@ sp_usepath_href_changed(SPObject */*old_ref*/, SPObject */*ref*/, SPUsePath *off offset->start_listening(refobj); } offset->sourceDirty=true; - SP_OBJECT(offset->owner)->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); + offset->owner->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); } static void @@ -171,14 +171,14 @@ sp_usepath_move_compensate(Geom::Affine const *mp, SPItem *original, SPUsePath * // Commit the compensation. item->transform *= clone_move; - sp_item_write_transform(item, SP_OBJECT_REPR(item), item->transform, &advertized_move); + sp_item_write_transform(item, item->getRepr(), item->transform, &advertized_move); #else (void)mp; (void)original; #endif self->sourceDirty = true; - SP_OBJECT(item)->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); + item->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); } static void diff --git a/src/sp-use.cpp b/src/sp-use.cpp index dd5a6c5f9..a92dbcaa9 100644 --- a/src/sp-use.cpp +++ b/src/sp-use.cpp @@ -129,7 +129,7 @@ sp_use_init(SPUse *use) new (&use->_transformed_connection) sigc::connection(); - use->ref = new SPUseReference(SP_OBJECT(use)); + use->ref = new SPUseReference(use); use->_changed_connection = use->ref->changedSignal().connect(sigc::bind(sigc::ptr_fun(sp_use_href_changed), use)); } @@ -137,15 +137,16 @@ sp_use_init(SPUse *use) static void sp_use_finalize(GObject *obj) { - SPUse *use = (SPUse *) obj; + SPUse *use = reinterpret_cast<SPUse *>(obj); if (use->child) { - SP_OBJECT(obj)->detach(use->child); + use->detach(use->child); use->child = NULL; } use->ref->detach(); delete use->ref; + use->ref = 0; use->_delete_connection.~connection(); use->_changed_connection.~connection(); @@ -354,7 +355,7 @@ sp_use_show(SPItem *item, NRArena *arena, unsigned key, unsigned flags) NRArenaItem *ai = NRArenaGroup::create(arena); nr_arena_group_set_transparent(NR_ARENA_GROUP(ai), FALSE); - nr_arena_group_set_style(NR_ARENA_GROUP(ai), SP_OBJECT_STYLE(item)); + nr_arena_group_set_style(NR_ARENA_GROUP(ai), item->style); if (use->child) { NRArenaItem *ac = SP_ITEM(use->child)->invoke_show(arena, key, flags); @@ -470,12 +471,12 @@ sp_use_move_compensate(Geom::Affine const *mp, SPItem */*original*/, SPUse *self { // the clone is orphaned; or this is not a real use, but a clone of another use; // we skip it, otherwise duplicate compensation will occur - if (SP_OBJECT_IS_CLONED(self)) { + if (self->cloned) { return; } // never compensate uses which are used in flowtext - if (SP_OBJECT_PARENT(self) && SP_IS_FLOWREGION(SP_OBJECT_PARENT(self))) { + if (self->parent && SP_IS_FLOWREGION(self->parent)) { return; } @@ -492,7 +493,7 @@ sp_use_move_compensate(Geom::Affine const *mp, SPItem */*original*/, SPUse *self return; // restore item->transform field from the repr, in case it was changed by seltrans - SP_OBJECT (self)->readAttr ("transform"); + self->readAttr ("transform"); Geom::Affine t = sp_use_get_parent_transform(self); Geom::Affine clone_move = t.inverse() * m * t; @@ -510,10 +511,9 @@ sp_use_move_compensate(Geom::Affine const *mp, SPItem */*original*/, SPUse *self } // commit the compensation - SPItem *item = SP_ITEM(self); - item->transform *= clone_move; - item->doWriteTransform(SP_OBJECT_REPR(item), item->transform, &advertized_move); - SP_OBJECT(item)->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); + self->transform *= clone_move; + self->doWriteTransform(self->getRepr(), self->transform, &advertized_move); + self->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG); } static void @@ -525,21 +525,21 @@ sp_use_href_changed(SPObject */*old_ref*/, SPObject */*ref*/, SPUse *use) use->_transformed_connection.disconnect(); if (use->child) { - SP_OBJECT(use)->detach(use->child); + use->detach(use->child); use->child = NULL; } if (use->href) { SPItem *refobj = use->ref->getObject(); if (refobj) { - Inkscape::XML::Node *childrepr = SP_OBJECT_REPR(refobj); + Inkscape::XML::Node *childrepr = refobj->getRepr(); GType type = sp_repr_type_lookup(childrepr); g_return_if_fail(type > G_TYPE_NONE); if (g_type_is_a(type, SP_TYPE_ITEM)) { use->child = (SPObject*) g_object_new(type, 0); - SP_OBJECT(use)->attach(use->child, use->lastChild()); - sp_object_unref(use->child, SP_OBJECT(use)); - (use->child)->invoke_build(SP_OBJECT(use)->document, childrepr, TRUE); + use->attach(use->child, use->lastChild()); + sp_object_unref(use->child, use); + (use->child)->invoke_build(use->document, childrepr, TRUE); for (SPItemView *v = item->display; v != NULL; v = v->next) { NRArenaItem *ai; @@ -550,7 +550,7 @@ sp_use_href_changed(SPObject */*old_ref*/, SPObject */*ref*/, SPUse *use) } } - use->_delete_connection = SP_OBJECT(refobj)->connectDelete(sigc::bind(sigc::ptr_fun(&sp_use_delete_self), use)); + use->_delete_connection = refobj->connectDelete(sigc::bind(sigc::ptr_fun(&sp_use_delete_self), use)); use->_transformed_connection = SP_ITEM(refobj)->connectTransformed(sigc::bind(sigc::ptr_fun(&sp_use_move_compensate), use)); } } @@ -560,8 +560,8 @@ static void sp_use_delete_self(SPObject */*deleted*/, SPUse *self) { // always delete uses which are used in flowtext - if (SP_OBJECT_PARENT(self) && SP_IS_FLOWREGION(SP_OBJECT_PARENT(self))) { - SP_OBJECT(self)->deleteObject(); + if (self->parent && SP_IS_FLOWREGION(self->parent)) { + self->deleteObject(); return; } @@ -572,7 +572,7 @@ sp_use_delete_self(SPObject */*deleted*/, SPUse *self) if (mode == SP_CLONE_ORPHANS_UNLINK) { sp_use_unlink(self); } else if (mode == SP_CLONE_ORPHANS_DELETE) { - SP_OBJECT(self)->deleteObject(); + self->deleteObject(); } } @@ -587,12 +587,14 @@ sp_use_update(SPObject *object, SPCtx *ctx, unsigned flags) if (((SPObjectClass *) (parent_class))->update) ((SPObjectClass *) (parent_class))->update(object, ctx, flags); - if (flags & SP_OBJECT_MODIFIED_FLAG) flags |= SP_OBJECT_PARENT_MODIFIED_FLAG; + if (flags & SP_OBJECT_MODIFIED_FLAG) { + flags |= SP_OBJECT_PARENT_MODIFIED_FLAG; + } flags &= SP_OBJECT_MODIFIED_CASCADE; if (flags & SP_OBJECT_STYLE_MODIFIED_FLAG) { for (SPItemView *v = SP_ITEM(object)->display; v != NULL; v = v->next) { - 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); } } @@ -650,7 +652,7 @@ sp_use_modified(SPObject *object, guint flags) if (flags & SP_OBJECT_STYLE_MODIFIED_FLAG) { for (SPItemView *v = SP_ITEM(object)->display; v != NULL; v = v->next) { - 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); } } @@ -670,13 +672,13 @@ SPItem *sp_use_unlink(SPUse *use) return NULL; } - Inkscape::XML::Node *repr = SP_OBJECT_REPR(use); + Inkscape::XML::Node *repr = use->getRepr(); if (!repr) { return NULL; } Inkscape::XML::Node *parent = sp_repr_parent(repr); - SPDocument *document = SP_OBJECT(use)->document; + SPDocument *document = use->document; Inkscape::XML::Document *xml_doc = document->getReprDoc(); // Track the ultimate source of a chain of uses. @@ -691,12 +693,12 @@ SPItem *sp_use_unlink(SPUse *use) Inkscape::XML::Node *copy = NULL; if (SP_IS_SYMBOL(orig)) { // make a group, copy children copy = xml_doc->createElement("svg:g"); - for (Inkscape::XML::Node *child = SP_OBJECT_REPR(orig)->firstChild() ; child != NULL; child = child->next()) { + for (Inkscape::XML::Node *child = orig->getRepr()->firstChild() ; child != NULL; child = child->next()) { Inkscape::XML::Node *newchild = child->duplicate(xml_doc); copy->appendChild(newchild); } } else { // just copy - copy = SP_OBJECT_REPR(orig)->duplicate(xml_doc); + copy = orig->getRepr()->duplicate(xml_doc); } // Add the duplicate repr just after the existing one. @@ -706,20 +708,20 @@ SPItem *sp_use_unlink(SPUse *use) SPObject *unlinked = document->getObjectByRepr(copy); // Merge style from the use. - SPStyle *unli_sty = SP_OBJECT_STYLE(unlinked); - SPStyle const *use_sty = SP_OBJECT_STYLE(use); + SPStyle *unli_sty = unlinked->style; + SPStyle const *use_sty = use->style; sp_style_merge_from_dying_parent(unli_sty, use_sty); sp_style_merge_from_parent(unli_sty, unlinked->parent->style); - SP_OBJECT(unlinked)->updateRepr(); + unlinked->updateRepr(); // Hold onto our SPObject and repr for now. - sp_object_ref(SP_OBJECT(use), NULL); + sp_object_ref(use, NULL); Inkscape::GC::anchor(repr); // Remove ourselves, not propagating delete events to avoid a // chain-reaction with other elements that might reference us. - SP_OBJECT(use)->deleteObject(false); + use->deleteObject(false); // Give the copy our old id and let go of our old repr. copy->setAttribute("id", repr->attribute("id")); @@ -733,15 +735,15 @@ SPItem *sp_use_unlink(SPUse *use) copy->setAttribute("inkscape:tile-cy", NULL); // Establish the succession and let go of our object. - SP_OBJECT(use)->setSuccessor(unlinked); - sp_object_unref(SP_OBJECT(use), NULL); + use->setSuccessor(unlinked); + sp_object_unref(use, NULL); SPItem *item = SP_ITEM(unlinked); // Set the accummulated transform. { Geom::Affine nomove(Geom::identity()); // Advertise ourselves as not moving. - item->doWriteTransform(SP_OBJECT_REPR(item), t, &nomove); + item->doWriteTransform(item->getRepr(), t, &nomove); } return item; } diff --git a/src/text-chemistry.cpp b/src/text-chemistry.cpp index f2ea4367b..b1b31b6f6 100644 --- a/src/text-chemistry.cpp +++ b/src/text-chemistry.cpp @@ -130,12 +130,12 @@ text_put_on_path() if (!repr) return; - Inkscape::XML::Node *parent = SP_OBJECT_REPR(text)->parent(); + Inkscape::XML::Node *parent = text->getRepr()->parent(); parent->appendChild(repr); SPItem *new_item = (SPItem *) sp_desktop_document(desktop)->getObjectByRepr(repr); new_item->doWriteTransform(repr, text->transform); - SP_OBJECT(new_item)->updateRepr(); + new_item->updateRepr(); Inkscape::GC::release(repr); text->deleteObject(); // delete the orignal flowtext @@ -152,23 +152,24 @@ text_put_on_path() // remove transform from text, but recursively scale text's fontsize by the expansion SP_TEXT(text)->_adjustFontsizeRecursive (text, NR::expansion(SP_ITEM(text)->transform)); - SP_OBJECT_REPR(text)->setAttribute("transform", NULL); + text->getRepr()->setAttribute("transform", NULL); // make a list of text children GSList *text_reprs = NULL; - for (SPObject *o = SP_OBJECT(text)->children; o != NULL; o = o->next) { - text_reprs = g_slist_prepend(text_reprs, SP_OBJECT_REPR(o)); + for (SPObject *o = text->children; o != NULL; o = o->next) { + text_reprs = g_slist_prepend(text_reprs, o->getRepr()); } // create textPath and put it into the text Inkscape::XML::Node *textpath = xml_doc->createElement("svg:textPath"); // reference the shape - textpath->setAttribute("xlink:href", g_strdup_printf("#%s", SP_OBJECT_REPR(shape)->attribute("id"))); - if (text_alignment == Inkscape::Text::Layout::RIGHT) + textpath->setAttribute("xlink:href", g_strdup_printf("#%s", shape->getRepr()->attribute("id"))); + if (text_alignment == Inkscape::Text::Layout::RIGHT) { textpath->setAttribute("startOffset", "100%"); - else if (text_alignment == Inkscape::Text::Layout::CENTER) + } else if (text_alignment == Inkscape::Text::Layout::CENTER) { textpath->setAttribute("startOffset", "50%"); - SP_OBJECT_REPR(text)->addChild(textpath, NULL); + } + text->getRepr()->addChild(textpath, NULL); for ( GSList *i = text_reprs ; i ; i = i->next ) { // Make a copy of each text child @@ -180,14 +181,14 @@ text_put_on_path() copy->setAttribute("y", NULL); } // remove the old repr from under text - SP_OBJECT_REPR(text)->removeChild((Inkscape::XML::Node *) i->data); + text->getRepr()->removeChild(reinterpret_cast<Inkscape::XML::Node *>(i->data)); // put its copy into under textPath textpath->addChild(copy, NULL); // fixme: copy id } // x/y are useless with textpath, and confuse Batik 1.5 - SP_OBJECT_REPR(text)->setAttribute("x", NULL); - SP_OBJECT_REPR(text)->setAttribute("y", NULL); + text->getRepr()->setAttribute("x", NULL); + text->getRepr()->setAttribute("y", NULL); DocumentUndo::done(sp_desktop_document(desktop), SP_VERB_CONTEXT_TEXT, _("Put text on path")); @@ -211,16 +212,15 @@ text_remove_from_path() for (GSList *items = g_slist_copy((GSList *) selection->itemList()); items != NULL; items = items->next) { + SPObject *obj = SP_OBJECT(items->data); - if (!SP_IS_TEXT_TEXTPATH(SP_OBJECT(items->data))) { - continue; - } - - SPObject *tp = SP_OBJECT(items->data)->firstChild(); + if (SP_IS_TEXT_TEXTPATH(obj)) { + SPObject *tp = obj->firstChild(); - did = true; + did = true; - sp_textpath_to_text(tp); + sp_textpath_to_text(tp); + } } if (!did) { @@ -235,19 +235,19 @@ text_remove_from_path() void text_remove_all_kerns_recursively(SPObject *o) { - SP_OBJECT_REPR(o)->setAttribute("dx", NULL); - SP_OBJECT_REPR(o)->setAttribute("dy", NULL); - SP_OBJECT_REPR(o)->setAttribute("rotate", NULL); + o->getRepr()->setAttribute("dx", NULL); + o->getRepr()->setAttribute("dy", NULL); + o->getRepr()->setAttribute("rotate", NULL); // if x contains a list, leave only the first value - gchar *x = (gchar *) SP_OBJECT_REPR(o)->attribute("x"); + gchar const *x = o->getRepr()->attribute("x"); if (x) { gchar **xa_space = g_strsplit(x, " ", 0); gchar **xa_comma = g_strsplit(x, ",", 0); if (xa_space && *xa_space && *(xa_space + 1)) { - SP_OBJECT_REPR(o)->setAttribute("x", g_strdup(*xa_space)); + o->getRepr()->setAttribute("x", g_strdup(*xa_space)); } else if (xa_comma && *xa_comma && *(xa_comma + 1)) { - SP_OBJECT_REPR(o)->setAttribute("x", g_strdup(*xa_comma)); + o->getRepr()->setAttribute("x", g_strdup(*xa_comma)); } g_strfreev(xa_space); g_strfreev(xa_comma); @@ -318,13 +318,13 @@ text_flow_into_shape() if (SP_IS_TEXT(text)) { // remove transform from text, but recursively scale text's fontsize by the expansion SP_TEXT(text)->_adjustFontsizeRecursive(text, NR::expansion(SP_ITEM(text)->transform)); - SP_OBJECT_REPR(text)->setAttribute("transform", NULL); + text->getRepr()->setAttribute("transform", NULL); } Inkscape::XML::Node *root_repr = xml_doc->createElement("svg:flowRoot"); root_repr->setAttribute("xml:space", "preserve"); // we preserve spaces in the text objects we create - root_repr->setAttribute("style", SP_OBJECT_REPR(text)->attribute("style")); // fixme: transfer style attrs too - SP_OBJECT_REPR(SP_OBJECT_PARENT(shape))->appendChild(root_repr); + root_repr->setAttribute("style", text->getRepr()->attribute("style")); // fixme: transfer style attrs too + shape->parent->getRepr()->appendChild(root_repr); SPObject *root_object = doc->getObjectByRepr(root_repr); g_return_if_fail(SP_IS_FLOWTEXT(root_object)); @@ -342,7 +342,7 @@ text_flow_into_shape() Inkscape::XML::Node *clone = xml_doc->createElement("svg:use"); clone->setAttribute("x", "0"); clone->setAttribute("y", "0"); - clone->setAttribute("xlink:href", g_strdup_printf("#%s", SP_OBJECT_REPR(item)->attribute("id"))); + clone->setAttribute("xlink:href", g_strdup_printf("#%s", item->getRepr()->attribute("id"))); // add the new clone to the region region_repr->appendChild(clone); @@ -365,9 +365,9 @@ text_flow_into_shape() Inkscape::GC::release(text_repr); } else { // reflow an already flowed text, preserving paras - for (SPObject *o = SP_OBJECT(text)->children; o != NULL; o = o->next) { + for (SPObject *o = text->children; o != NULL; o = o->next) { if (SP_IS_FLOWPARA(o)) { - Inkscape::XML::Node *para_repr = SP_OBJECT_REPR(o)->duplicate(xml_doc); + Inkscape::XML::Node *para_repr = o->getRepr()->duplicate(xml_doc); root_repr->appendChild(para_repr); object = doc->getObjectByRepr(para_repr); g_return_if_fail(SP_IS_FLOWPARA(object)); @@ -376,7 +376,7 @@ text_flow_into_shape() } } - SP_OBJECT(text)->deleteObject (true); + text->deleteObject(true); DocumentUndo::done(doc, SP_VERB_CONTEXT_TEXT, _("Flow text into shape")); @@ -431,7 +431,7 @@ text_unflow () rtext->setAttribute("xml:space", "preserve"); // we preserve spaces in the text objects we create /* Set style */ - rtext->setAttribute("style", SP_OBJECT_REPR(flowtext)->attribute("style")); // fixme: transfer style attrs too; and from descendants + rtext->setAttribute("style", flowtext->getRepr()->attribute("style")); // fixme: transfer style attrs too; and from descendants NRRect bbox; SP_ITEM(flowtext)->invoke_bbox( &bbox, SP_ITEM(flowtext)->i2doc_affine(), TRUE); @@ -451,7 +451,7 @@ text_unflow () free(text_string); rtspan->appendChild(text_repr); - SP_OBJECT_REPR(SP_OBJECT_PARENT(flowtext))->appendChild(rtext); + flowtext->parent->getRepr()->appendChild(rtext); SPObject *text_object = doc->getObjectByRepr(rtext); // restore the font size multiplier from the flowtext's transform @@ -515,12 +515,12 @@ flowtext_to_text() did = true; - Inkscape::XML::Node *parent = SP_OBJECT_REPR(item)->parent(); - parent->addChild(repr, SP_OBJECT_REPR(item)); + Inkscape::XML::Node *parent = item->getRepr()->parent(); + parent->addChild(repr, item->getRepr()); - SPItem *new_item = (SPItem *) sp_desktop_document(desktop)->getObjectByRepr(repr); + SPItem *new_item = reinterpret_cast<SPItem *>(sp_desktop_document(desktop)->getObjectByRepr(repr)); new_item->doWriteTransform(repr, item->transform); - SP_OBJECT(new_item)->updateRepr(); + new_item->updateRepr(); Inkscape::GC::release(repr); item->deleteObject(); diff --git a/src/text-editing.cpp b/src/text-editing.cpp index 1e918ae00..003af245d 100644 --- a/src/text-editing.cpp +++ b/src/text-editing.cpp @@ -1757,7 +1757,7 @@ static bool redundant_semi_nesting_processor(SPObject **item, SPObject *child, b SPObject *prev = (*item)->getPrev(); (*item)->parent->getRepr()->addChild(new_span, prev ? prev->getRepr() : NULL); } else { - SP_OBJECT_REPR(SP_OBJECT_PARENT(*item))->addChild(new_span, SP_OBJECT_REPR(*item)); + (*item)->parent->getRepr()->addChild(new_span, (*item)->getRepr()); } new_span->setAttribute("style", child->getRepr()->attribute("style")); move_child_nodes(child->getRepr(), new_span); diff --git a/src/ui/widget/layer-selector.cpp b/src/ui/widget/layer-selector.cpp index 6d1da0af0..7111e17be 100644 --- a/src/ui/widget/layer-selector.cpp +++ b/src/ui/widget/layer-selector.cpp @@ -460,7 +460,7 @@ void LayerSelector::_buildEntry(unsigned depth, SPObject &object) { ); SPObject *layer=_desktop->currentLayer(); - if ( &object == layer || &object == SP_OBJECT_PARENT(layer) ) { + if ( (&object == layer) || (&object == layer->parent) ) { callbacks->update_list = sigc::bind( sigc::mem_fun(*this, &LayerSelector::_protectUpdate), sigc::bind( @@ -498,12 +498,12 @@ void LayerSelector::_buildEntry(unsigned depth, SPObject &object) { sp_object_ref(&object, NULL); row->set_value(_model_columns.object, &object); - Inkscape::GC::anchor(SP_OBJECT_REPR(&object)); - row->set_value(_model_columns.repr, SP_OBJECT_REPR(&object)); + Inkscape::GC::anchor(object.getRepr()); + row->set_value(_model_columns.repr, object.getRepr()); row->set_value(_model_columns.callbacks, reinterpret_cast<void *>(callbacks)); - sp_repr_add_listener(SP_OBJECT_REPR(&object), vector, callbacks); + sp_repr_add_listener(object.getRepr(), vector, callbacks); } /** Removes a row from the _model_columns object, disconnecting listeners @@ -536,13 +536,13 @@ void LayerSelector::_prepareLabelRenderer( // (or before one has been selected) something appears to // "invent" an iterator with null data and try to render it; // where does it come from, and how can we avoid it? - if ( object && SP_OBJECT_REPR(object) ) { + if ( object && object->getRepr() ) { SPObject *layer=( _desktop ? _desktop->currentLayer() : NULL ); SPObject *root=( _desktop ? _desktop->currentRoot() : NULL ); - bool isancestor = !( (layer && (SP_OBJECT_PARENT(object) == SP_OBJECT_PARENT(layer))) || ((layer == root) && (SP_OBJECT_PARENT(object) == root))); + bool isancestor = !( (layer && (object->parent == layer->parent)) || ((layer == root) && (object->parent == root))); - bool iscurrent = ( object == layer && object != root ); + bool iscurrent = ( (object == layer) && (object != root) ); gchar *format = g_strdup_printf ( "<span size=\"smaller\" %s><tt>%*s%s</tt>%s%s%s%%s%s%s%s</span>", diff --git a/src/widgets/icon.cpp b/src/widgets/icon.cpp index 25be59942..c2634f6a1 100644 --- a/src/widgets/icon.cpp +++ b/src/widgets/icon.cpp @@ -1085,7 +1085,7 @@ extern "C" guchar *sp_icon_doc_icon( SPDocument *doc, NRArenaItem *root, Geom::Affine const i2doc(SP_ITEM(object)->i2doc_affine()); Geom::OptRect dbox = SP_ITEM(object)->getBounds(i2doc); - if ( SP_OBJECT_PARENT(object) == NULL ) + if ( object->parent == NULL ) { dbox = Geom::Rect(Geom::Point(0, 0), Geom::Point(doc->getWidth(), doc->getHeight())); |
