From: Abhishek Sharma Public Date: Sat, 3 Jul 2010 17:20:36 +0000 (+0530) Subject: another c++ification for sp-object.h/cpp and still in progress... X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=ab17729e09d54ccfcb65645e6dae62a343e9c6b7;p=inkscape.git another c++ification for sp-object.h/cpp and still in progress... --- diff --git a/src/box3d-context.cpp b/src/box3d-context.cpp index 88763e183..354fa1234 100644 --- a/src/box3d-context.cpp +++ b/src/box3d-context.cpp @@ -191,7 +191,7 @@ static void sp_box3d_context_ensure_persp_in_defs(SPDocument *document) { SPDefs *defs = (SPDefs *) SP_DOCUMENT_DEFS(document); bool has_persp = false; - for (SPObject *child = sp_object_first_child(defs); child != NULL; child = SP_OBJECT_NEXT(child) ) { + for (SPObject *child = defs->first_child(); child != NULL; child = SP_OBJECT_NEXT(child) ) { if (SP_IS_PERSP3D(child)) { has_persp = true; break; diff --git a/src/box3d.cpp b/src/box3d.cpp index bdbbbfa7e..7985640cd 100644 --- a/src/box3d.cpp +++ b/src/box3d.cpp @@ -332,7 +332,7 @@ box3d_position_set (SPBox3D *box) { /* This draws the curve and calls requestDisplayUpdate() for each side (the latter is done in box3d_side_position_set() to avoid update conflicts with the parent box) */ - for (SPObject *child = sp_object_first_child(SP_OBJECT (box)); child != NULL; child = SP_OBJECT_NEXT(child) ) { + for (SPObject *child = SP_OBJECT (box)->first_child(); child != NULL; child = SP_OBJECT_NEXT(child) ) { if (SP_IS_BOX3D_SIDE(child)) box3d_side_position_set(SP_BOX3D_SIDE(child)); } @@ -350,7 +350,7 @@ box3d_set_transform(SPItem *item, Geom::Matrix const &xform) gdouble const sw = hypot(ret[0], ret[1]); gdouble const sh = hypot(ret[2], ret[3]); - for (SPObject *child = sp_object_first_child(box); child != NULL; child = SP_OBJECT_NEXT(child)) { + for (SPObject *child = box->first_child(); child != NULL; child = SP_OBJECT_NEXT(child)) { if (SP_IS_ITEM(child)) { SPItem *childitem = SP_ITEM(child); @@ -1151,7 +1151,7 @@ box3d_recompute_z_orders (SPBox3D *box) { static std::map box3d_get_sides (SPBox3D *box) { std::map sides; - for (SPObject *side = sp_object_first_child(box); side != NULL; side = SP_OBJECT_NEXT(side)) { + for (SPObject *side = box->first_child(); side != NULL; side = SP_OBJECT_NEXT(side)) { if (SP_IS_BOX3D_SIDE(side)) sides[Box3D::face_to_int(sp_repr_get_int_attribute(SP_OBJECT_REPR(side), "inkscape:box3dsidetype", -1))] = SP_BOX3D_SIDE(side); @@ -1293,7 +1293,7 @@ box3d_extract_boxes_rec(SPObject *obj, std::list &boxes) { if (SP_IS_BOX3D(obj)) { boxes.push_back(SP_BOX3D(obj)); } else if (SP_IS_GROUP(obj)) { - for (SPObject *child = sp_object_first_child(obj); child != NULL; child = SP_OBJECT_NEXT(child) ) { + for (SPObject *child = obj->first_child(); child != NULL; child = SP_OBJECT_NEXT(child) ) { box3d_extract_boxes_rec(child, boxes); } } @@ -1354,7 +1354,7 @@ box3d_convert_to_group(SPBox3D *box) { Inkscape::XML::Node *grepr = xml_doc->createElement("svg:g"); Inkscape::XML::Node *repr; - for (SPObject *child = sp_object_first_child(SP_OBJECT(box)); child != NULL; child = SP_OBJECT_NEXT(child) ) { + for (SPObject *child = SP_OBJECT(box)->first_child(); child != NULL; child = SP_OBJECT_NEXT(child) ) { if (SP_IS_BOX3D_SIDE(child)) { repr = box3d_side_convert_to_path(SP_BOX3D_SIDE(child)); grepr->appendChild(repr); diff --git a/src/conn-avoid-ref.cpp b/src/conn-avoid-ref.cpp index 70e0c3856..a6ac2387a 100644 --- a/src/conn-avoid-ref.cpp +++ b/src/conn-avoid-ref.cpp @@ -550,7 +550,7 @@ static Avoid::Polygon avoid_item_poly(SPItem const *item) GSList *get_avoided_items(GSList *list, SPObject *from, SPDesktop *desktop, bool initialised) { - for (SPObject *child = sp_object_first_child(SP_OBJECT(from)) ; + for (SPObject *child = SP_OBJECT(from)->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child) ) { if (SP_IS_ITEM(child) && !desktop->isLayer(SP_ITEM(child)) && diff --git a/src/desktop-style.cpp b/src/desktop-style.cpp index 19a45a285..9a8725fac 100644 --- a/src/desktop-style.cpp +++ b/src/desktop-style.cpp @@ -138,7 +138,7 @@ sp_desktop_apply_css_recursive(SPObject *o, SPCSSAttr *css, bool skip_lines) if (SP_IS_USE(o)) return; - for (SPObject *child = sp_object_first_child(SP_OBJECT(o)) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { + for (SPObject *child = SP_OBJECT(o)->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { if (sp_repr_css_property(css, "opacity", NULL) != NULL) { // Unset properties which are accumulating and thus should not be set recursively. // For example, setting opacity 0.5 on a group recursively would result in the visible opacity of 0.25 for an item in the group. diff --git a/src/dialogs/clonetiler.cpp b/src/dialogs/clonetiler.cpp index b1c1cf74a..e25f2602b 100644 --- a/src/dialogs/clonetiler.cpp +++ b/src/dialogs/clonetiler.cpp @@ -849,7 +849,7 @@ clonetiler_trace_hide_tiled_clones_recursively (SPObject *from) if (!trace_arena) return; - for (SPObject *o = sp_object_first_child(from); o != NULL; o = SP_OBJECT_NEXT(o)) { + for (SPObject *o = from->first_child(); o != NULL; o = SP_OBJECT_NEXT(o)) { if (SP_IS_ITEM(o) && clonetiler_is_a_clone_of (o, NULL)) SP_ITEM(o)->invoke_hide(trace_visionkey); // FIXME: hide each tiled clone's original too! clonetiler_trace_hide_tiled_clones_recursively (o); @@ -981,7 +981,7 @@ clonetiler_unclump( GtkWidget */*widget*/, void * ) GSList *to_unclump = NULL; // not including the original - for (SPObject *child = sp_object_first_child(parent); child != NULL; child = SP_OBJECT_NEXT(child)) { + for (SPObject *child = parent->first_child(); child != NULL; child = SP_OBJECT_NEXT(child)) { if (clonetiler_is_a_clone_of (child, obj)) { to_unclump = g_slist_prepend (to_unclump, child); } @@ -1004,7 +1004,7 @@ clonetiler_number_of_clones (SPObject *obj) guint n = 0; - for (SPObject *child = sp_object_first_child(parent); child != NULL; child = SP_OBJECT_NEXT(child)) { + for (SPObject *child = parent->first_child(); child != NULL; child = SP_OBJECT_NEXT(child)) { if (clonetiler_is_a_clone_of (child, obj)) { n ++; } @@ -1033,7 +1033,7 @@ clonetiler_remove( GtkWidget */*widget*/, void *, bool do_undo = true ) // remove old tiling GSList *to_delete = NULL; - for (SPObject *child = sp_object_first_child(parent); child != NULL; child = SP_OBJECT_NEXT(child)) { + for (SPObject *child = parent->first_child(); child != NULL; child = SP_OBJECT_NEXT(child)) { if (clonetiler_is_a_clone_of (child, obj)) { to_delete = g_slist_prepend (to_delete, child); } diff --git a/src/dialogs/find.cpp b/src/dialogs/find.cpp index ed693f6ed..89b389d44 100644 --- a/src/dialogs/find.cpp +++ b/src/dialogs/find.cpp @@ -292,7 +292,7 @@ all_items (SPObject *r, GSList *l, bool hidden, bool locked) if (!strcmp (SP_OBJECT_REPR (r)->name(), "svg:metadata")) return l; // we're not interested in metadata - for (SPObject *child = sp_object_first_child(r); child; child = SP_OBJECT_NEXT (child)) { + for (SPObject *child = r->first_child(); child; child = SP_OBJECT_NEXT (child)) { if (SP_IS_ITEM (child) && !SP_OBJECT_IS_CLONED (child) && !desktop->isLayer(SP_ITEM(child))) { if ((hidden || !desktop->itemIsHidden(SP_ITEM(child))) && (locked || !SP_ITEM(child)->isLocked())) { l = g_slist_prepend (l, child); diff --git a/src/dialogs/spellcheck.cpp b/src/dialogs/spellcheck.cpp index 5372a8bb5..f95dce0e6 100644 --- a/src/dialogs/spellcheck.cpp +++ b/src/dialogs/spellcheck.cpp @@ -203,7 +203,7 @@ all_text_items (SPObject *r, GSList *l, bool hidden, bool locked) if (!strcmp (SP_OBJECT_REPR (r)->name(), "svg:metadata")) return l; // we're not interested in metadata - for (SPObject *child = sp_object_first_child(r); child; child = SP_OBJECT_NEXT (child)) { + for (SPObject *child = r->first_child(); child; child = SP_OBJECT_NEXT (child)) { if (SP_IS_ITEM (child) && !SP_OBJECT_IS_CLONED (child) && !_desktop->isLayer(SP_ITEM(child))) { if ((hidden || !_desktop->itemIsHidden(SP_ITEM(child))) && (locked || !SP_ITEM(child)->isLocked())) { if (SP_IS_TEXT(child) || SP_IS_FLOWTEXT(child)) diff --git a/src/document.cpp b/src/document.cpp index e68bc1f94..6b72f0bb8 100644 --- a/src/document.cpp +++ b/src/document.cpp @@ -245,7 +245,7 @@ SPDocument::setCurrentPersp3D(Persp3D * const persp) { void SPDocument::getPerspectivesInDefs(std::vector &list) { SPDefs *defs = SP_ROOT(this->root)->defs; - for (SPObject *i = sp_object_first_child(SP_OBJECT(defs)); i != NULL; i = SP_OBJECT_NEXT(i) ) { + for (SPObject *i = SP_OBJECT(defs)->first_child(); i != NULL; i = SP_OBJECT_NEXT(i) ) { if (SP_IS_PERSP3D(i)) list.push_back(SP_PERSP3D(i)); } @@ -1118,7 +1118,7 @@ static GSList *find_items_in_area(GSList *s, SPGroup *group, unsigned int dkey, { g_return_val_if_fail(SP_IS_GROUP(group), s); - for (SPObject *o = sp_object_first_child(SP_OBJECT(group)) ; o != NULL ; o = SP_OBJECT_NEXT(o) ) { + for (SPObject *o = SP_OBJECT(group)->first_child() ; o != NULL ; o = SP_OBJECT_NEXT(o) ) { if (!SP_IS_ITEM(o)) { continue; } @@ -1141,7 +1141,7 @@ Returns true if an item is among the descendants of group (recursively). */ bool item_is_in_group(SPItem *item, SPGroup *group) { - for (SPObject *o = sp_object_first_child(SP_OBJECT(group)) ; o != NULL ; o = SP_OBJECT_NEXT(o) ) { + for (SPObject *o = SP_OBJECT(group)->first_child() ; o != NULL ; o = SP_OBJECT_NEXT(o) ) { if (!SP_IS_ITEM(o)) continue; if (SP_ITEM(o) == item) return true; @@ -1162,7 +1162,7 @@ SPDocument::item_from_list_at_point_bottom(unsigned int dkey, SPGroup *group, GS Inkscape::Preferences *prefs = Inkscape::Preferences::get(); gdouble delta = prefs->getDouble("/options/cursortolerance/value", 1.0); - for (SPObject *o = sp_object_first_child(SP_OBJECT(group)) ; o != NULL ; o = SP_OBJECT_NEXT(o) ) { + for (SPObject *o = SP_OBJECT(group)->first_child() ; o != NULL ; o = SP_OBJECT_NEXT(o) ) { if (!SP_IS_ITEM(o)) continue; @@ -1199,7 +1199,7 @@ find_item_at_point(unsigned int dkey, SPGroup *group, Geom::Point const p, gbool Inkscape::Preferences *prefs = Inkscape::Preferences::get(); gdouble delta = prefs->getDouble("/options/cursortolerance/value", 1.0); - for (SPObject *o = sp_object_first_child(SP_OBJECT(group)) ; o != NULL ; o = SP_OBJECT_NEXT(o) ) { + for (SPObject *o = SP_OBJECT(group)->first_child() ; o != NULL ; o = SP_OBJECT_NEXT(o) ) { if (!SP_IS_ITEM(o)) continue; if (upto && SP_ITEM(o) == upto) @@ -1241,7 +1241,7 @@ find_group_at_point(unsigned int dkey, SPGroup *group, Geom::Point const p) Inkscape::Preferences *prefs = Inkscape::Preferences::get(); gdouble delta = prefs->getDouble("/options/cursortolerance/value", 1.0); - for (SPObject *o = sp_object_first_child(SP_OBJECT(group)) ; o != NULL ; o = SP_OBJECT_NEXT(o) ) { + for (SPObject *o = SP_OBJECT(group)->first_child() ; o != NULL ; o = SP_OBJECT_NEXT(o) ) { if (!SP_IS_ITEM(o)) continue; if (SP_IS_GROUP(o) && SP_GROUP(o)->effectiveLayerMode(dkey) == SPGroup::LAYER) { SPItem *newseen = find_group_at_point(dkey, SP_GROUP(o), p); @@ -1421,7 +1421,7 @@ count_objects_recursive(SPObject *obj, unsigned int count) { count++; // obj itself - for (SPObject *i = sp_object_first_child(obj); i != NULL; i = SP_OBJECT_NEXT(i)) { + for (SPObject *i = obj->first_child(); i != NULL; i = SP_OBJECT_NEXT(i)) { count = count_objects_recursive(i, count); } @@ -1443,7 +1443,7 @@ vacuum_document_recursive(SPObject *obj) def->requestOrphanCollection(); } } else { - for (SPObject *i = sp_object_first_child(obj); i != NULL; i = SP_OBJECT_NEXT(i)) { + for (SPObject *i = obj->first_child(); i != NULL; i = SP_OBJECT_NEXT(i)) { vacuum_document_recursive(i); } } diff --git a/src/extension/internal/cairo-render-context.cpp b/src/extension/internal/cairo-render-context.cpp index 5849230bf..b6b411e0e 100644 --- a/src/extension/internal/cairo-render-context.cpp +++ b/src/extension/internal/cairo-render-context.cpp @@ -962,7 +962,7 @@ CairoRenderContext::popState(void) static bool pattern_hasItemChildren (SPPattern *pat) { - for (SPObject *child = sp_object_first_child(SP_OBJECT(pat)) ; child != NULL; child = SP_OBJECT_NEXT(child) ) { + for (SPObject *child = SP_OBJECT(pat)->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child) ) { if (SP_IS_ITEM (child)) { return true; } @@ -1068,7 +1068,7 @@ CairoRenderContext::_createPatternPainter(SPPaintServer const *const paintserver // show items and render them for (SPPattern *pat_i = pat; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) { if (pat_i && SP_IS_OBJECT (pat_i) && pattern_hasItemChildren(pat_i)) { // find the first one with item children - for (SPObject *child = sp_object_first_child(SP_OBJECT(pat_i)) ; child != NULL; child = SP_OBJECT_NEXT(child) ) { + for (SPObject *child = SP_OBJECT(pat_i)->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child) ) { if (SP_IS_ITEM (child)) { SP_ITEM (child)->invoke_show (arena, dkey, SP_ITEM_REFERENCE_FLAGS); _renderer->renderItem(pattern_ctx, SP_ITEM (child)); @@ -1097,7 +1097,7 @@ CairoRenderContext::_createPatternPainter(SPPaintServer const *const paintserver // hide all items for (SPPattern *pat_i = pat; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) { if (pat_i && SP_IS_OBJECT (pat_i) && pattern_hasItemChildren(pat_i)) { // find the first one with item children - for (SPObject *child = sp_object_first_child(SP_OBJECT(pat_i)) ; child != NULL; child = SP_OBJECT_NEXT(child) ) { + for (SPObject *child = SP_OBJECT(pat_i)->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child) ) { if (SP_IS_ITEM (child)) { SP_ITEM (child)->invoke_hide (dkey); } diff --git a/src/extension/internal/cairo-renderer.cpp b/src/extension/internal/cairo-renderer.cpp index 81531b2db..3c5cfc7c1 100644 --- a/src/extension/internal/cairo-renderer.cpp +++ b/src/extension/internal/cairo-renderer.cpp @@ -671,7 +671,7 @@ CairoRenderer::applyClipPath(CairoRenderContext *ctx, SPClipPath const *cp) TRACE(("BEGIN clip\n")); SPObject *co = SP_OBJECT(cp); - for (SPObject *child = sp_object_first_child(co) ; child != NULL; child = SP_OBJECT_NEXT(child) ) { + for (SPObject *child = co->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child) ) { if (SP_IS_ITEM(child)) { SPItem *item = SP_ITEM(child); @@ -729,7 +729,7 @@ CairoRenderer::applyMask(CairoRenderContext *ctx, SPMask const *mask) TRACE(("BEGIN mask\n")); SPObject *co = SP_OBJECT(mask); - for (SPObject *child = sp_object_first_child(co) ; child != NULL; child = SP_OBJECT_NEXT(child) ) { + for (SPObject *child = co->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child) ) { if (SP_IS_ITEM(child)) { SPItem *item = SP_ITEM(child); renderItem(ctx, item); diff --git a/src/file.cpp b/src/file.cpp index 2344c67f2..15e5bbe72 100644 --- a/src/file.cpp +++ b/src/file.cpp @@ -976,7 +976,7 @@ file_import(SPDocument *in_doc, const Glib::ustring &uri, // Count the number of top-level items in the imported document. guint items_count = 0; - for (SPObject *child = sp_object_first_child(SP_DOCUMENT_ROOT(doc)); + for (SPObject *child = SP_DOCUMENT_ROOT(doc)->first_child(); child != NULL; child = SP_OBJECT_NEXT(child)) { if (SP_IS_ITEM(child)) items_count++; @@ -1004,7 +1004,7 @@ file_import(SPDocument *in_doc, const Glib::ustring &uri, // Construct a new object representing the imported image, // and insert it into the current document. SPObject *new_obj = NULL; - for (SPObject *child = sp_object_first_child(SP_DOCUMENT_ROOT(doc)); + for (SPObject *child = SP_DOCUMENT_ROOT(doc)->first_child(); child != NULL; child = SP_OBJECT_NEXT(child) ) { if (SP_IS_ITEM(child)) { @@ -1024,7 +1024,7 @@ file_import(SPDocument *in_doc, const Glib::ustring &uri, else if (SP_OBJECT_REPR(child)->type() == Inkscape::XML::ELEMENT_NODE) { const gchar *tag = SP_OBJECT_REPR(child)->name(); if (!strcmp(tag, "svg:defs")) { - for (SPObject *x = sp_object_first_child(child); + for (SPObject *x = child->first_child(); x != NULL; x = SP_OBJECT_NEXT(x)) { SP_OBJECT_REPR(in_defs)->addChild(SP_OBJECT_REPR(x)->duplicate(xml_in_doc), last_def); diff --git a/src/filter-chemistry.cpp b/src/filter-chemistry.cpp index 3d5a795c7..f180dc661 100644 --- a/src/filter-chemistry.cpp +++ b/src/filter-chemistry.cpp @@ -50,7 +50,7 @@ count_filter_hrefs(SPObject *o, SPFilter *filter) i ++; } - for (SPObject *child = sp_object_first_child(o); + for (SPObject *child = o->first_child(); child != NULL; child = SP_OBJECT_NEXT(child)) { i += count_filter_hrefs(child, filter); } diff --git a/src/gradient-chemistry.cpp b/src/gradient-chemistry.cpp index 76b29bb09..0d99e7fa6 100644 --- a/src/gradient-chemistry.cpp +++ b/src/gradient-chemistry.cpp @@ -155,7 +155,7 @@ count_gradient_hrefs(SPObject *o, SPGradient *gr) i ++; } - for (SPObject *child = sp_object_first_child(o); + for (SPObject *child = o->first_child(); child != NULL; child = SP_OBJECT_NEXT(child)) { i += count_gradient_hrefs(child, gr); } @@ -718,7 +718,7 @@ sp_item_gradient_reverse_vector (SPItem *item, bool fill_or_stroke) GSList *child_reprs = NULL; GSList *child_objects = NULL; std::vector offsets; - for (SPObject *child = sp_object_first_child(vector); + for (SPObject *child = vector->first_child(); child != NULL; child = SP_OBJECT_NEXT(child)) { child_reprs = g_slist_prepend (child_reprs, SP_OBJECT_REPR(child)); child_objects = g_slist_prepend (child_objects, child); diff --git a/src/gradient-drag.cpp b/src/gradient-drag.cpp index 5fb490b8b..e6dc22cea 100644 --- a/src/gradient-drag.cpp +++ b/src/gradient-drag.cpp @@ -2001,7 +2001,7 @@ GrDrag::deleteSelected (bool just_one) // cannot use vector->vector.stops.size() because the vector might be invalidated by deletion of a midstop // manually count the children, don't know if there already exists a function for this... int len = 0; - for ( SPObject *child = sp_object_first_child(stopinfo->vector) ; + for ( SPObject *child = (stopinfo->vector)->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { diff --git a/src/helper/pixbuf-ops.cpp b/src/helper/pixbuf-ops.cpp index 2b0d5781a..b5630edd3 100644 --- a/src/helper/pixbuf-ops.cpp +++ b/src/helper/pixbuf-ops.cpp @@ -56,7 +56,7 @@ hide_other_items_recursively(SPObject *o, GSList *list, unsigned dkey) // recurse if (!g_slist_find(list, o)) { - for (SPObject *child = sp_object_first_child(o) ; child != NULL; child = SP_OBJECT_NEXT(child) ) { + for (SPObject *child = o->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child) ) { hide_other_items_recursively(child, list, dkey); } } diff --git a/src/helper/png-write.cpp b/src/helper/png-write.cpp index f8321cc03..5ccb6c7fa 100644 --- a/src/helper/png-write.cpp +++ b/src/helper/png-write.cpp @@ -376,7 +376,7 @@ hide_other_items_recursively(SPObject *o, GSList *list, unsigned dkey) // recurse if (!g_slist_find(list, o)) { - for (SPObject *child = sp_object_first_child(o) ; child != NULL; child = SP_OBJECT_NEXT(child) ) { + for (SPObject *child = o->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child) ) { hide_other_items_recursively(child, list, dkey); } } diff --git a/src/helper/stock-items.cpp b/src/helper/stock-items.cpp index cb2769c8e..6cdb50c35 100644 --- a/src/helper/stock-items.cpp +++ b/src/helper/stock-items.cpp @@ -199,7 +199,7 @@ SPObject *get_stock_item(gchar const *urn) SPObject *object = NULL; if (!strcmp(base, "marker")) { - for (SPObject *child = sp_object_first_child(SP_OBJECT(defs)); + for (SPObject *child = SP_OBJECT(defs)->first_child(); child != NULL; child = SP_OBJECT_NEXT(child)) { @@ -213,7 +213,7 @@ SPObject *get_stock_item(gchar const *urn) } else if (!strcmp(base,"pattern")) { - for (SPObject *child = sp_object_first_child(SP_OBJECT(defs)) ; + for (SPObject *child = SP_OBJECT(defs)->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child) ) { @@ -227,7 +227,7 @@ SPObject *get_stock_item(gchar const *urn) } else if (!strcmp(base,"gradient")) { - for (SPObject *child = sp_object_first_child(SP_OBJECT(defs)); + for (SPObject *child = SP_OBJECT(defs)->first_child(); child != NULL; child = SP_OBJECT_NEXT(child)) { diff --git a/src/id-clash.cpp b/src/id-clash.cpp index 43ce393dd..7572e6a42 100644 --- a/src/id-clash.cpp +++ b/src/id-clash.cpp @@ -165,7 +165,7 @@ find_references(SPObject *elem, refmap_type *refmap) } /* recurse */ - for (SPObject *child = sp_object_first_child(elem); + for (SPObject *child = elem->first_child(); child; child = SP_OBJECT_NEXT(child) ) { find_references(child, refmap); @@ -204,7 +204,7 @@ change_clashing_ids(SPDocument *imported_doc, SPDocument *current_doc, } /* recurse */ - for (SPObject *child = sp_object_first_child(elem); + for (SPObject *child = elem->first_child(); child; child = SP_OBJECT_NEXT(child) ) { change_clashing_ids(imported_doc, current_doc, child, refmap, id_changes); diff --git a/src/object-snapper.cpp b/src/object-snapper.cpp index 379626683..00bd10fe2 100644 --- a/src/object-snapper.cpp +++ b/src/object-snapper.cpp @@ -98,7 +98,7 @@ void Inkscape::ObjectSnapper::_findCandidates(SPObject* parent, Geom::Rect bbox_to_snap_incl = bbox_to_snap; // _incl means: will include the snapper tolerance bbox_to_snap_incl.expandBy(getSnapperTolerance()); // see? - for (SPObject* o = sp_object_first_child(parent); o != NULL; o = SP_OBJECT_NEXT(o)) { + for (SPObject* o = parent->first_child(); o != NULL; o = SP_OBJECT_NEXT(o)) { g_assert(_snapmanager->getDesktop() != NULL); if (SP_IS_ITEM(o) && !(_snapmanager->getDesktop()->itemIsHidden(SP_ITEM(o)) && !clip_or_mask)) { // Snapping to items in a locked layer is allowed diff --git a/src/persp3d.cpp b/src/persp3d.cpp index 817bb97d7..4b2e55b9d 100644 --- a/src/persp3d.cpp +++ b/src/persp3d.cpp @@ -246,14 +246,14 @@ persp3d_create_xml_element (SPDocument *document, Persp3DImpl *dup) {// if dup i SP_OBJECT_REPR(defs)->addChild(repr, NULL); Inkscape::GC::release(repr); - return (Persp3D *) sp_object_get_child_by_repr (SP_OBJECT(defs), repr); + return (Persp3D *) SP_OBJECT(defs)->get_child_by_repr (repr); } Persp3D * persp3d_document_first_persp (SPDocument *document) { SPDefs *defs = (SPDefs *) SP_DOCUMENT_DEFS(document); Inkscape::XML::Node *repr; - for (SPObject *child = sp_object_first_child(defs); child != NULL; child = SP_OBJECT_NEXT(child) ) { + for (SPObject *child = defs->first_child(); child != NULL; child = SP_OBJECT_NEXT(child) ) { repr = SP_OBJECT_REPR(child); if (SP_IS_PERSP3D(child)) { return SP_PERSP3D(child); @@ -568,7 +568,7 @@ void persp3d_print_debugging_info_all(SPDocument *document) { SPDefs *defs = (SPDefs *) SP_DOCUMENT_DEFS(document); Inkscape::XML::Node *repr; - for (SPObject *child = sp_object_first_child(defs); child != NULL; child = SP_OBJECT_NEXT(child) ) { + for (SPObject *child = defs->first_child(); child != NULL; child = SP_OBJECT_NEXT(child) ) { repr = SP_OBJECT_REPR(child); if (SP_IS_PERSP3D(child)) { persp3d_print_debugging_info(SP_PERSP3D(child)); diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index 066b86ddf..7b0f353ab 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -338,7 +338,7 @@ void add_ids_recursive(std::vector &ids, SPObject *obj) ids.push_back(obj->getId()); if (SP_IS_GROUP(obj)) { - for (SPObject *child = sp_object_first_child(obj) ; child != NULL; child = SP_OBJECT_NEXT(child) ) { + for (SPObject *child = obj->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child) ) { add_ids_recursive(ids, child); } } @@ -453,7 +453,7 @@ void sp_edit_clear_all(SPDesktop *dt) GSList * get_all_items(GSList *list, SPObject *from, SPDesktop *desktop, bool onlyvisible, bool onlysensitive, GSList const *exclude) { - for (SPObject *child = sp_object_first_child(SP_OBJECT(from)) ; child != NULL; child = SP_OBJECT_NEXT(child) ) { + for (SPObject *child = SP_OBJECT(from)->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child) ) { if (SP_IS_ITEM(child) && !desktop->isLayer(SP_ITEM(child)) && (!onlysensitive || !SP_ITEM(child)->isLocked()) && @@ -782,7 +782,7 @@ prev_sibling(SPObject *child) if (!SP_IS_GROUP(parent)) { return NULL; } - for ( SPObject *i = sp_object_first_child(parent) ; i; i = SP_OBJECT_NEXT(i) ) { + for ( SPObject *i = parent->first_child() ; i; i = SP_OBJECT_NEXT(i) ) { if (i->next == child) return i; } @@ -981,7 +981,7 @@ void sp_selection_lower_to_bottom(SPDesktop *desktop) pp = document->getObjectByRepr(sp_repr_parent(repr)); minpos = 0; g_assert(SP_IS_GROUP(pp)); - pc = sp_object_first_child(pp); + pc = pp->first_child(); while (!SP_IS_ITEM(pc)) { minpos += 1; pc = pc->next; @@ -1339,7 +1339,7 @@ void sp_selection_apply_affine(Inkscape::Selection *selection, Geom::Matrix cons // we're moving both a clone and its original or any ancestor in clone chain? bool transform_clone_with_original = selection_contains_original(item, selection); // ...both a text-on-path and its path? - bool transform_textpath_with_path = (SP_IS_TEXT_TEXTPATH(item) && selection->includes( sp_textpath_get_path_item(SP_TEXTPATH(sp_object_first_child(SP_OBJECT(item)))) )); + bool transform_textpath_with_path = (SP_IS_TEXT_TEXTPATH(item) && selection->includes( sp_textpath_get_path_item(SP_TEXTPATH(SP_OBJECT(item)->first_child())) )); // ...both a flowtext and its frame? bool transform_flowtext_with_frame = (SP_IS_FLOWTEXT(item) && selection->includes( SP_FLOWTEXT(item)->get_frame(NULL))); // (only the first frame is checked so far) // ...both an offset and its source? @@ -1743,7 +1743,7 @@ SPItem *next_item_from_list(SPDesktop *desktop, GSList const *items, SPObject *r struct Forward { typedef SPObject *Iterator; - static Iterator children(SPObject *o) { return sp_object_first_child(o); } + static Iterator children(SPObject *o) { return o->first_child(); } static Iterator siblings_after(SPObject *o) { return SP_OBJECT_NEXT(o); } static void dispose(Iterator /*i*/) {} @@ -2200,7 +2200,7 @@ sp_select_clone_original(SPDesktop *desktop) } else if (SP_IS_OFFSET(item) && SP_OFFSET(item)->sourceHref) { original = sp_offset_get_source(SP_OFFSET(item)); } else if (SP_IS_TEXT_TEXTPATH(item)) { - original = sp_textpath_get_path_item(SP_TEXTPATH(sp_object_first_child(SP_OBJECT(item)))); + original = sp_textpath_get_path_item(SP_TEXTPATH(SP_OBJECT(item)->first_child())); } else if (SP_IS_FLOWTEXT(item)) { original = SP_FLOWTEXT(item)->get_frame(NULL); // first frame only } else { // it's an object that we don't know what to do with @@ -2520,7 +2520,7 @@ sp_selection_untile(SPDesktop *desktop) Geom::Matrix pat_transform = to_2geom(pattern_patternTransform(SP_PATTERN(server))); pat_transform *= item->transform; - for (SPObject *child = sp_object_first_child(SP_OBJECT(pattern)) ; child != NULL; child = SP_OBJECT_NEXT(child) ) { + for (SPObject *child = SP_OBJECT(pattern)->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child) ) { Inkscape::XML::Node *copy = SP_OBJECT_REPR(child)->duplicate(xml_doc); SPItem *i = SP_ITEM(desktop->currentLayer()->appendChildRepr(copy)); @@ -3099,7 +3099,7 @@ void sp_selection_unset_mask(SPDesktop *desktop, bool apply_clip_path) { for ( std::map::iterator it = referenced_objects.begin() ; it != referenced_objects.end() ; ++it) { SPObject *obj = (*it).first; // Group containing the clipped paths or masks GSList *items_to_move = NULL; - for (SPObject *child = sp_object_first_child(obj) ; child != NULL; child = SP_OBJECT_NEXT(child) ) { + for (SPObject *child = obj->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child) ) { // Collect all clipped paths and masks within a single group Inkscape::XML::Node *copy = SP_OBJECT_REPR(child)->duplicate(xml_doc); items_to_move = g_slist_prepend(items_to_move, copy); diff --git a/src/sp-clippath.cpp b/src/sp-clippath.cpp index bae5f5e56..a36d9b443 100644 --- a/src/sp-clippath.cpp +++ b/src/sp-clippath.cpp @@ -187,7 +187,7 @@ sp_clippath_update(SPObject *object, SPCtx *ctx, guint flags) SPObjectGroup *og = SP_OBJECTGROUP(object); GSList *l = NULL; - for (SPObject *child = sp_object_first_child(SP_OBJECT(og)); child != NULL; child = SP_OBJECT_NEXT(child)) { + for (SPObject *child = SP_OBJECT(og)->first_child(); child != NULL; child = SP_OBJECT_NEXT(child)) { g_object_ref(G_OBJECT(child)); l = g_slist_prepend(l, child); } @@ -225,7 +225,7 @@ sp_clippath_modified(SPObject *object, guint flags) SPObjectGroup *og = SP_OBJECTGROUP(object); GSList *l = NULL; - for (SPObject *child = sp_object_first_child(SP_OBJECT(og)); child != NULL; child = SP_OBJECT_NEXT(child)) { + for (SPObject *child = SP_OBJECT(og)->first_child(); child != NULL; child = SP_OBJECT_NEXT(child)) { g_object_ref(G_OBJECT(child)); l = g_slist_prepend(l, child); } @@ -264,7 +264,7 @@ sp_clippath_show(SPClipPath *cp, NRArena *arena, unsigned int key) NRArenaItem *ai = NRArenaGroup::create(arena); cp->display = sp_clippath_view_new_prepend(cp->display, key, ai); - for (SPObject *child = sp_object_first_child(SP_OBJECT(cp)) ; child != NULL; child = SP_OBJECT_NEXT(child)) { + for (SPObject *child = SP_OBJECT(cp)->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child)) { if (SP_IS_ITEM(child)) { NRArenaItem *ac = SP_ITEM(child)->invoke_show(arena, key, SP_ITEM_REFERENCE_FLAGS); if (ac) { @@ -290,7 +290,7 @@ sp_clippath_hide(SPClipPath *cp, unsigned int key) g_return_if_fail(cp != NULL); g_return_if_fail(SP_IS_CLIPPATH(cp)); - for (SPObject *child = sp_object_first_child(SP_OBJECT(cp)) ; child != NULL; child = SP_OBJECT_NEXT(child)) { + for (SPObject *child = SP_OBJECT(cp)->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child)) { if (SP_IS_ITEM(child)) { SP_ITEM(child)->invoke_hide(key); } @@ -327,7 +327,7 @@ void sp_clippath_get_bbox(SPClipPath *cp, NRRect *bbox, Geom::Matrix const &transform, unsigned const /*flags*/) { SPObject *i; - for (i = sp_object_first_child(SP_OBJECT(cp)); i && !SP_IS_ITEM(i); i = SP_OBJECT_NEXT(i)){}; + for (i = SP_OBJECT(cp)->first_child(); i && !SP_IS_ITEM(i); i = SP_OBJECT_NEXT(i)){}; if (!i) return; SP_ITEM(i)->invoke_bbox_full( bbox, Geom::Matrix(SP_ITEM(i)->transform) * transform, SPItem::GEOMETRIC_BBOX, FALSE); diff --git a/src/sp-defs.cpp b/src/sp-defs.cpp index aa0cb0be7..76cb2e1d9 100644 --- a/src/sp-defs.cpp +++ b/src/sp-defs.cpp @@ -104,7 +104,7 @@ static void sp_defs_modified(SPObject *object, guint flags) flags &= SP_OBJECT_MODIFIED_CASCADE; GSList *l = NULL; - for ( SPObject *child = sp_object_first_child(object) ; child != NULL; child = SP_OBJECT_NEXT(child) ) { + for ( SPObject *child = object->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child) ) { g_object_ref(G_OBJECT(child)); l = g_slist_prepend(l, child); } @@ -130,7 +130,7 @@ static Inkscape::XML::Node *sp_defs_write(SPObject *object, Inkscape::XML::Docum } GSList *l = NULL; - for ( SPObject *child = sp_object_first_child(object) ; child != NULL; child = SP_OBJECT_NEXT(child) ) { + for ( SPObject *child = object->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child) ) { Inkscape::XML::Node *crepr = child->updateRepr(xml_doc, NULL, flags); if (crepr) l = g_slist_prepend(l, crepr); } @@ -142,7 +142,7 @@ static Inkscape::XML::Node *sp_defs_write(SPObject *object, Inkscape::XML::Docum } } else { - for ( SPObject *child = sp_object_first_child(object) ; child != NULL; child = SP_OBJECT_NEXT(child) ) { + for ( SPObject *child = object->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child) ) { child->updateRepr(flags); } } diff --git a/src/sp-filter.cpp b/src/sp-filter.cpp index 1ac8a6733..2464b73a5 100644 --- a/src/sp-filter.cpp +++ b/src/sp-filter.cpp @@ -294,7 +294,7 @@ sp_filter_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::N repr = doc->createElement("svg:filter"); } l = NULL; - for (child = sp_object_first_child(object); child != NULL; child = SP_OBJECT_NEXT(child) ) { + for (child = object->first_child(); child != NULL; child = SP_OBJECT_NEXT(child) ) { crepr = child->updateRepr(doc, NULL, flags); if (crepr) l = g_slist_prepend (l, crepr); } @@ -304,7 +304,7 @@ sp_filter_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::N l = g_slist_remove (l, l->data); } } else { - for (child = sp_object_first_child(object) ; child != NULL; child = SP_OBJECT_NEXT(child) ) { + for (child = object->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child) ) { child->updateRepr(flags); } } diff --git a/src/sp-flowdiv.cpp b/src/sp-flowdiv.cpp index 6d679701f..41df69609 100644 --- a/src/sp-flowdiv.cpp +++ b/src/sp-flowdiv.cpp @@ -127,7 +127,7 @@ sp_flowdiv_update (SPObject *object, SPCtx *ctx, unsigned int flags) flags &= SP_OBJECT_MODIFIED_CASCADE; GSList* l = NULL; - for (SPObject *child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { + for (SPObject *child = object->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { g_object_ref (G_OBJECT (child)); l = g_slist_prepend (l, child); } @@ -161,7 +161,7 @@ sp_flowdiv_modified (SPObject *object, guint flags) flags &= SP_OBJECT_MODIFIED_CASCADE; l = NULL; - for (child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { + for (child = object->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { g_object_ref (G_OBJECT (child)); l = g_slist_prepend (l, child); } @@ -200,7 +200,7 @@ sp_flowdiv_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape:: if ( flags&SP_OBJECT_WRITE_BUILD ) { if ( repr == NULL ) repr = xml_doc->createElement("svg:flowDiv"); GSList *l = NULL; - for (SPObject* child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { + for (SPObject* child = object->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { Inkscape::XML::Node* c_repr=NULL; if ( SP_IS_FLOWTSPAN (child) ) { c_repr = child->updateRepr(xml_doc, NULL, flags); @@ -217,7 +217,7 @@ sp_flowdiv_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape:: l = g_slist_remove (l, l->data); } } else { - for (SPObject* child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { + for (SPObject* child = object->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { if ( SP_IS_FLOWTSPAN (child) ) { child->updateRepr(flags); } else if ( SP_IS_FLOWPARA(child) ) { @@ -305,7 +305,7 @@ sp_flowtspan_update (SPObject *object, SPCtx *ctx, unsigned int flags) flags &= SP_OBJECT_MODIFIED_CASCADE; GSList* l = NULL; - for (SPObject *child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { + for (SPObject *child = object->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { g_object_ref (G_OBJECT (child)); l = g_slist_prepend (l, child); } @@ -339,7 +339,7 @@ sp_flowtspan_modified (SPObject *object, guint flags) flags &= SP_OBJECT_MODIFIED_CASCADE; l = NULL; - for (child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { + for (child = object->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { g_object_ref (G_OBJECT (child)); l = g_slist_prepend (l, child); } @@ -371,7 +371,7 @@ sp_flowtspan_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape if ( flags&SP_OBJECT_WRITE_BUILD ) { if ( repr == NULL ) repr = xml_doc->createElement("svg:flowSpan"); GSList *l = NULL; - for (SPObject* child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { + for (SPObject* child = object->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { Inkscape::XML::Node* c_repr=NULL; if ( SP_IS_FLOWTSPAN (child) ) { c_repr = child->updateRepr(xml_doc, NULL, flags); @@ -388,7 +388,7 @@ sp_flowtspan_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape l = g_slist_remove (l, l->data); } } else { - for (SPObject* child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { + for (SPObject* child = object->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { if ( SP_IS_FLOWTSPAN (child) ) { child->updateRepr(flags); } else if ( SP_IS_FLOWPARA (child) ) { @@ -476,7 +476,7 @@ sp_flowpara_update (SPObject *object, SPCtx *ctx, unsigned int flags) flags &= SP_OBJECT_MODIFIED_CASCADE; GSList* l = NULL; - for (SPObject *child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { + for (SPObject *child = object->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { g_object_ref (G_OBJECT (child)); l = g_slist_prepend (l, child); } @@ -510,7 +510,7 @@ sp_flowpara_modified (SPObject *object, guint flags) flags &= SP_OBJECT_MODIFIED_CASCADE; l = NULL; - for (child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { + for (child = object->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { g_object_ref (G_OBJECT (child)); l = g_slist_prepend (l, child); } @@ -544,7 +544,7 @@ sp_flowpara_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape: if ( flags&SP_OBJECT_WRITE_BUILD ) { if ( repr == NULL ) repr = xml_doc->createElement("svg:flowPara"); GSList *l = NULL; - for (SPObject* child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { + for (SPObject* child = object->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { Inkscape::XML::Node* c_repr=NULL; if ( SP_IS_FLOWTSPAN (child) ) { c_repr = child->updateRepr(xml_doc, NULL, flags); @@ -561,7 +561,7 @@ sp_flowpara_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape: l = g_slist_remove (l, l->data); } } else { - for (SPObject* child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { + for (SPObject* child = object->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { if ( SP_IS_FLOWTSPAN (child) ) { child->updateRepr(flags); } else if ( SP_IS_FLOWPARA (child) ) { diff --git a/src/sp-flowregion.cpp b/src/sp-flowregion.cpp index 79007cac7..29ee05f5e 100644 --- a/src/sp-flowregion.cpp +++ b/src/sp-flowregion.cpp @@ -162,7 +162,7 @@ sp_flowregion_update (SPObject *object, SPCtx *ctx, unsigned int flags) flags &= SP_OBJECT_MODIFIED_CASCADE; l = NULL; - for (child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { + for (child = object->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { g_object_ref (G_OBJECT (child)); l = g_slist_prepend (l, child); } @@ -194,7 +194,7 @@ void SPFlowregion::UpdateComputed(void) delete *it; computed.clear(); - for (SPObject* child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { + for (SPObject* child = object->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { Shape *shape = NULL; GetDest(child,&shape); computed.push_back(shape); @@ -214,7 +214,7 @@ sp_flowregion_modified (SPObject *object, guint flags) flags &= SP_OBJECT_MODIFIED_CASCADE; l = NULL; - for (child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { + for (child = object->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { g_object_ref (G_OBJECT (child)); l = g_slist_prepend (l, child); } @@ -238,7 +238,7 @@ sp_flowregion_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscap } GSList *l = NULL; - for ( SPObject *child = sp_object_first_child(object) ; child != NULL; child = SP_OBJECT_NEXT(child) ) { + for ( SPObject *child = object->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child) ) { 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); @@ -251,7 +251,7 @@ sp_flowregion_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscap } } else { - for ( SPObject *child = sp_object_first_child(object) ; child != NULL; child = SP_OBJECT_NEXT(child) ) { + for ( SPObject *child = object->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child) ) { if (SP_IS_TITLE(child) || SP_IS_DESC(child)) continue; child->updateRepr(flags); } @@ -380,7 +380,7 @@ sp_flowregionexclude_update (SPObject *object, SPCtx *ctx, unsigned int flags) flags &= SP_OBJECT_MODIFIED_CASCADE; l = NULL; - for (child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { + for (child = object->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { g_object_ref (G_OBJECT (child)); l = g_slist_prepend (l, child); } @@ -412,7 +412,7 @@ void SPFlowregionExclude::UpdateComputed(void) computed = NULL; } - for (SPObject* child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { + for (SPObject* child = object->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { GetDest(child,&computed); } } @@ -430,7 +430,7 @@ sp_flowregionexclude_modified (SPObject *object, guint flags) flags &= SP_OBJECT_MODIFIED_CASCADE; l = NULL; - for (child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { + for (child = object->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { g_object_ref (G_OBJECT (child)); l = g_slist_prepend (l, child); } @@ -454,7 +454,7 @@ sp_flowregionexclude_write (SPObject *object, Inkscape::XML::Document *xml_doc, } GSList *l = NULL; - for ( SPObject *child = sp_object_first_child(object) ; child != NULL; child = SP_OBJECT_NEXT(child) ) { + for ( SPObject *child = object->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child) ) { Inkscape::XML::Node *crepr = child->updateRepr(xml_doc, NULL, flags); if (crepr) l = g_slist_prepend(l, crepr); } @@ -466,7 +466,7 @@ sp_flowregionexclude_write (SPObject *object, Inkscape::XML::Document *xml_doc, } } else { - for ( SPObject *child = sp_object_first_child(object) ; child != NULL; child = SP_OBJECT_NEXT(child) ) { + for ( SPObject *child = object->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child) ) { child->updateRepr(flags); } } diff --git a/src/sp-flowtext.cpp b/src/sp-flowtext.cpp index b18b72968..b18d6f182 100644 --- a/src/sp-flowtext.cpp +++ b/src/sp-flowtext.cpp @@ -153,7 +153,7 @@ sp_flowtext_update(SPObject *object, SPCtx *ctx, unsigned flags) flags &= SP_OBJECT_MODIFIED_CASCADE; GSList *l = NULL; - for (SPObject *child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { + for (SPObject *child = object->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { g_object_ref(G_OBJECT(child)); l = g_slist_prepend(l, child); } @@ -207,7 +207,7 @@ sp_flowtext_modified(SPObject *object, guint flags) } } - for (SPObject *o = sp_object_first_child(SP_OBJECT(ft)) ; o != NULL ; o = SP_OBJECT_NEXT(o) ) { + for (SPObject *o = SP_OBJECT(ft)->first_child() ; o != NULL ; o = SP_OBJECT_NEXT(o) ) { if (SP_IS_FLOWREGION(o)) { region = o; break; @@ -297,7 +297,7 @@ sp_flowtext_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape:: if ( flags & SP_OBJECT_WRITE_BUILD ) { if ( repr == NULL ) repr = xml_doc->createElement("svg:flowRoot"); GSList *l = NULL; - for (SPObject *child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { + for (SPObject *child = object->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { Inkscape::XML::Node *c_repr = NULL; if ( SP_IS_FLOWDIV(child) || SP_IS_FLOWPARA(child) || SP_IS_FLOWREGION(child) || SP_IS_FLOWREGIONEXCLUDE(child)) { c_repr = child->updateRepr(xml_doc, NULL, flags); @@ -310,7 +310,7 @@ sp_flowtext_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape:: l = g_slist_remove(l, l->data); } } else { - for (SPObject *child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { + for (SPObject *child = object->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { if ( SP_IS_FLOWDIV(child) || SP_IS_FLOWPARA(child) || SP_IS_FLOWREGION(child) || SP_IS_FLOWREGIONEXCLUDE(child) ) { child->updateRepr(flags); } @@ -456,7 +456,7 @@ void SPFlowtext::_buildLayoutInput(SPObject *root, Shape const *exclusion_shape, *pending_line_break_object = NULL; } - for (SPObject *child = sp_object_first_child(root) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { + for (SPObject *child = root->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { if (SP_IS_STRING(child)) { if (*pending_line_break_object) { if (SP_IS_FLOWREGIONBREAK(*pending_line_break_object)) @@ -653,7 +653,7 @@ SPItem *SPFlowtext::get_frame(SPItem *after) SPObject *ft = SP_OBJECT (this); SPObject *region = NULL; - for (SPObject *o = sp_object_first_child(SP_OBJECT(ft)) ; o != NULL ; o = SP_OBJECT_NEXT(o) ) { + for (SPObject *o = SP_OBJECT(ft)->first_child() ; o != NULL ; o = SP_OBJECT_NEXT(o) ) { if (SP_IS_FLOWREGION(o)) { region = o; break; @@ -665,7 +665,7 @@ SPItem *SPFlowtext::get_frame(SPItem *after) bool past = false; SPItem *frame = NULL; - for (SPObject *o = sp_object_first_child(SP_OBJECT(region)) ; o != NULL ; o = SP_OBJECT_NEXT(o) ) { + for (SPObject *o = SP_OBJECT(region)->first_child() ; o != NULL ; o = SP_OBJECT_NEXT(o) ) { if (SP_IS_ITEM(o)) { if (after == NULL || past) { frame = SP_ITEM(o); diff --git a/src/sp-gradient.cpp b/src/sp-gradient.cpp index bc86e2135..604da3b7c 100644 --- a/src/sp-gradient.cpp +++ b/src/sp-gradient.cpp @@ -426,7 +426,7 @@ void SPGradientImpl::build(SPObject *object, SPDocument *document, Inkscape::XML (* ((SPObjectClass *) gradient_parent_class)->build)(object, document, repr); SPObject *ochild; - for ( ochild = sp_object_first_child(object) ; ochild ; ochild = SP_OBJECT_NEXT(ochild) ) { + for ( ochild = object->first_child() ; ochild ; ochild = SP_OBJECT_NEXT(ochild) ) { if (SP_IS_STOP(ochild)) { gradient->has_stops = TRUE; break; @@ -585,7 +585,7 @@ void SPGradientImpl::childAdded(SPObject *object, Inkscape::XML::Node *child, In if (((SPObjectClass *) gradient_parent_class)->child_added) (* ((SPObjectClass *) gradient_parent_class)->child_added)(object, child, ref); - SPObject *ochild = sp_object_get_child_by_repr(object, child); + SPObject *ochild = object->get_child_by_repr(child); if ( ochild && SP_IS_STOP(ochild) ) { gr->has_stops = TRUE; } @@ -609,7 +609,7 @@ void SPGradientImpl::removeChild(SPObject *object, Inkscape::XML::Node *child) gr->has_stops = FALSE; SPObject *ochild; - for ( ochild = sp_object_first_child(object) ; ochild ; ochild = SP_OBJECT_NEXT(ochild) ) { + for ( ochild = object->first_child() ; ochild ; ochild = SP_OBJECT_NEXT(ochild) ) { if (SP_IS_STOP(ochild)) { gr->has_stops = TRUE; break; @@ -640,7 +640,7 @@ void SPGradientImpl::modified(SPObject *object, guint flags) // FIXME: climb up the ladder of hrefs GSList *l = NULL; - for (SPObject *child = sp_object_first_child(object) ; child != NULL; child = SP_OBJECT_NEXT(child) ) { + for (SPObject *child = object->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child) ) { g_object_ref(G_OBJECT(child)); l = g_slist_prepend(l, child); } @@ -658,7 +658,7 @@ void SPGradientImpl::modified(SPObject *object, guint flags) SPStop* SPGradient::getFirstStop() { SPStop* first = 0; - for (SPObject *ochild = sp_object_first_child(this); ochild && !first; ochild = SP_OBJECT_NEXT(ochild)) { + for (SPObject *ochild = this->first_child(); ochild && !first; ochild = SP_OBJECT_NEXT(ochild)) { if (SP_IS_STOP(ochild)) { first = SP_STOP(ochild); } @@ -689,7 +689,7 @@ Inkscape::XML::Node *SPGradientImpl::write(SPObject *object, Inkscape::XML::Docu if (flags & SP_OBJECT_WRITE_BUILD) { GSList *l = NULL; - for (SPObject *child = sp_object_first_child(object); child; child = SP_OBJECT_NEXT(child)) { + for (SPObject *child = object->first_child(); child; child = SP_OBJECT_NEXT(child)) { Inkscape::XML::Node *crepr; crepr = child->updateRepr(xml_doc, NULL, flags); if (crepr) l = g_slist_prepend(l, crepr); @@ -985,7 +985,7 @@ bool SPGradient::invalidateVector() void SPGradient::rebuildVector() { gint len = 0; - for ( SPObject *child = sp_object_first_child(SP_OBJECT(this)) ; + for ( SPObject *child = SP_OBJECT(this)->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { if (SP_IS_STOP(child)) { @@ -1009,7 +1009,7 @@ void SPGradient::rebuildVector() } } - for (SPObject *child = sp_object_first_child(SP_OBJECT(this)) ; + for (SPObject *child = SP_OBJECT(this)->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child) ) { if (SP_IS_STOP(child)) { diff --git a/src/sp-item-group.cpp b/src/sp-item-group.cpp index 1d38771bc..79a673e05 100644 --- a/src/sp-item-group.cpp +++ b/src/sp-item-group.cpp @@ -237,7 +237,7 @@ sp_group_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XM repr = xml_doc->createElement("svg:g"); } l = NULL; - for (child = sp_object_first_child(object); child != NULL; child = SP_OBJECT_NEXT(child) ) { + for (child = object->first_child(); child != NULL; child = SP_OBJECT_NEXT(child) ) { if (SP_IS_TITLE(child) || SP_IS_DESC(child)) continue; crepr = child->updateRepr(xml_doc, NULL, flags); if (crepr) l = g_slist_prepend (l, crepr); @@ -248,7 +248,7 @@ sp_group_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XM l = g_slist_remove (l, l->data); } } else { - for (child = sp_object_first_child(object) ; child != NULL; child = SP_OBJECT_NEXT(child) ) { + for (child = object->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child) ) { if (SP_IS_TITLE(child) || SP_IS_DESC(child)) continue; child->updateRepr(flags); } @@ -326,7 +326,7 @@ sp_group_hide (SPItem *item, unsigned int key) static void sp_group_snappoints (SPItem const *item, std::vector &p, Inkscape::SnapPreferences const *snapprefs) { - for (SPObject const *o = sp_object_first_child(SP_OBJECT(item)); + for (SPObject const *o = SP_OBJECT(item)->first_child(); o != NULL; o = SP_OBJECT_NEXT(o)) { @@ -368,7 +368,7 @@ sp_item_group_ungroup (SPGroup *group, GSList **children, bool do_done) /* Step 1 - generate lists of children objects */ GSList *items = NULL; GSList *objects = NULL; - for (SPObject *child = sp_object_first_child(SP_OBJECT(group)) ; child != NULL; child = SP_OBJECT_NEXT(child) ) { + for (SPObject *child = SP_OBJECT(group)->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child) ) { if (SP_IS_ITEM (child)) { @@ -512,7 +512,7 @@ sp_item_group_item_list (SPGroup * group) GSList *s = NULL; - for (SPObject *o = sp_object_first_child(SP_OBJECT(group)) ; o != NULL ; o = SP_OBJECT_NEXT(o) ) { + for (SPObject *o = SP_OBJECT(group)->first_child() ; o != NULL ; o = SP_OBJECT_NEXT(o) ) { if (SP_IS_ITEM (o)) { s = g_slist_prepend (s, o); } @@ -525,7 +525,7 @@ SPObject * sp_item_group_get_child_by_name (SPGroup *group, SPObject *ref, const gchar *name) { SPObject *child; - child = (ref) ? SP_OBJECT_NEXT(ref) : sp_object_first_child(SP_OBJECT(group)); + child = (ref) ? SP_OBJECT_NEXT(ref) : SP_OBJECT(group)->first_child(); while ( child && strcmp (SP_OBJECT_REPR(child)->name(), name) ) { child = SP_OBJECT_NEXT(child); } @@ -578,7 +578,7 @@ void SPGroup::translateChildItems(Geom::Translate const &tr) if (this->hasChildren()) { SPObject *o = NULL; - for (o = sp_object_first_child(SP_OBJECT(this)) ; o != NULL ; o = SP_OBJECT_NEXT(o) ) { + for (o = SP_OBJECT(this)->first_child() ; o != NULL ; o = SP_OBJECT_NEXT(o) ) { if (SP_IS_ITEM (o)) { sp_item_move_rel(static_cast(o), tr); } @@ -612,7 +612,7 @@ void CGroup::onChildAdded(Inkscape::XML::Node *child) { } } } else { // general case - SPObject *ochild = sp_object_get_child_by_repr(_group, child); + SPObject *ochild = _group->get_child_by_repr(child); if ( ochild && SP_IS_ITEM(ochild) ) { /* TODO: this should be moved into SPItem somehow */ SPItemView *v; @@ -730,7 +730,7 @@ void CGroup::onPrint(SPPrintContext *ctx) { gint CGroup::getItemCount() { gint len = 0; - for (SPObject *o = sp_object_first_child(SP_OBJECT(_group)) ; o != NULL ; o = SP_OBJECT_NEXT(o) ) { + for (SPObject *o = SP_OBJECT(_group)->first_child() ; o != NULL ; o = SP_OBJECT_NEXT(o) ) { if (SP_IS_ITEM(o)) { len++; } @@ -800,7 +800,7 @@ void CGroup::hide (unsigned int key) { void CGroup::onOrderChanged (Inkscape::XML::Node *child, Inkscape::XML::Node *, Inkscape::XML::Node *) { - SPObject *ochild = sp_object_get_child_by_repr(_group, child); + SPObject *ochild = _group->get_child_by_repr(child); if ( ochild && SP_IS_ITEM(ochild) ) { /* TODO: this should be moved into SPItem somehow */ SPItemView *v; diff --git a/src/sp-item.cpp b/src/sp-item.cpp index 72f318a25..7f67caee8 100644 --- a/src/sp-item.cpp +++ b/src/sp-item.cpp @@ -683,7 +683,7 @@ SPItem::sp_item_write(SPObject *const object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *crepr; GSList *l; l = NULL; - for (child = sp_object_first_child(object); child != NULL; child = SP_OBJECT_NEXT(child) ) { + for (child = object->first_child(); child != NULL; child = SP_OBJECT_NEXT(child) ) { if (!SP_IS_TITLE(child) && !SP_IS_DESC(child)) continue; crepr = child->updateRepr(xml_doc, NULL, flags); if (crepr) l = g_slist_prepend (l, crepr); @@ -694,7 +694,7 @@ SPItem::sp_item_write(SPObject *const object, Inkscape::XML::Document *xml_doc, l = g_slist_remove (l, l->data); } } else { - for (child = sp_object_first_child(object) ; child != NULL; child = SP_OBJECT_NEXT(child) ) { + for (child = object->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child) ) { if (!SP_IS_TITLE(child) && !SP_IS_DESC(child)) continue; child->updateRepr(flags); } @@ -921,7 +921,7 @@ unsigned SPItem::pos_in_parent() SPObject *object = SP_OBJECT(this); unsigned pos=0; - for ( SPObject *iter = sp_object_first_child(parent) ; iter ; iter = SP_OBJECT_NEXT(iter)) { + for ( SPObject *iter = parent->first_child() ; iter ; iter = SP_OBJECT_NEXT(iter)) { if ( iter == object ) { return pos; } @@ -1669,7 +1669,7 @@ sp_item_repr_compare_position(SPItem *first, SPItem *second) SPItem * sp_item_first_item_child (SPObject *obj) { - for ( SPObject *iter = sp_object_first_child(obj) ; iter ; iter = SP_OBJECT_NEXT(iter)) { + for ( SPObject *iter = obj->first_child() ; iter ; iter = SP_OBJECT_NEXT(iter)) { if (SP_IS_ITEM (iter)) return SP_ITEM (iter); } diff --git a/src/sp-lpe-item.cpp b/src/sp-lpe-item.cpp index 71352ed98..6c49b79c1 100644 --- a/src/sp-lpe-item.cpp +++ b/src/sp-lpe-item.cpp @@ -681,7 +681,7 @@ sp_lpe_item_child_added (SPObject *object, Inkscape::XML::Node *child, Inkscape: (* ((SPObjectClass *) (parent_class))->child_added) (object, child, ref); if (SP_IS_LPE_ITEM(object) && sp_lpe_item_has_path_effect_recursive(SP_LPE_ITEM(object))) { - SPObject *ochild = sp_object_get_child_by_repr(object, child); + SPObject *ochild = object->get_child_by_repr(child); if ( ochild && SP_IS_LPE_ITEM(ochild) ) { sp_lpe_item_create_original_path_recursive(SP_LPE_ITEM(ochild)); } @@ -692,7 +692,7 @@ static void sp_lpe_item_remove_child (SPObject * object, Inkscape::XML::Node * child) { if (SP_IS_LPE_ITEM(object) && sp_lpe_item_has_path_effect_recursive(SP_LPE_ITEM(object))) { - SPObject *ochild = sp_object_get_child_by_repr(object, child); + SPObject *ochild = object->get_child_by_repr(child); if ( ochild && SP_IS_LPE_ITEM(ochild) ) { sp_lpe_item_cleanup_original_path_recursive(SP_LPE_ITEM(ochild)); } diff --git a/src/sp-mask.cpp b/src/sp-mask.cpp index e57b5cc47..0c28cd014 100644 --- a/src/sp-mask.cpp +++ b/src/sp-mask.cpp @@ -201,7 +201,7 @@ sp_mask_update (SPObject *object, SPCtx *ctx, guint flags) SPObjectGroup *og = SP_OBJECTGROUP (object); GSList *l = NULL; - for (SPObject *child = sp_object_first_child(SP_OBJECT(og)); child != NULL; child = SP_OBJECT_NEXT(child)) { + for (SPObject *child = SP_OBJECT(og)->first_child(); child != NULL; child = SP_OBJECT_NEXT(child)) { g_object_ref (G_OBJECT (child)); l = g_slist_prepend (l, child); } @@ -239,7 +239,7 @@ sp_mask_modified (SPObject *object, guint flags) SPObjectGroup *og = SP_OBJECTGROUP (object); GSList *l = NULL; - for (SPObject *child = sp_object_first_child(SP_OBJECT(og)); child != NULL; child = SP_OBJECT_NEXT(child)) { + for (SPObject *child = SP_OBJECT(og)->first_child(); child != NULL; child = SP_OBJECT_NEXT(child)) { g_object_ref (G_OBJECT (child)); l = g_slist_prepend (l, child); } @@ -310,7 +310,7 @@ sp_mask_show (SPMask *mask, NRArena *arena, unsigned int key) NRArenaItem *ai = NRArenaGroup::create(arena); mask->display = sp_mask_view_new_prepend (mask->display, key, ai); - for (SPObject *child = sp_object_first_child(SP_OBJECT(mask)) ; child != NULL; child = SP_OBJECT_NEXT(child)) { + for (SPObject *child = SP_OBJECT(mask)->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child)) { if (SP_IS_ITEM (child)) { NRArenaItem *ac = SP_ITEM (child)->invoke_show (arena, key, SP_ITEM_REFERENCE_FLAGS); if (ac) { @@ -336,7 +336,7 @@ sp_mask_hide (SPMask *cp, unsigned int key) g_return_if_fail (cp != NULL); g_return_if_fail (SP_IS_MASK (cp)); - for (SPObject *child = sp_object_first_child(SP_OBJECT(cp)); child != NULL; child = SP_OBJECT_NEXT(child)) { + for (SPObject *child = SP_OBJECT(cp)->first_child(); child != NULL; child = SP_OBJECT_NEXT(child)) { if (SP_IS_ITEM (child)) { SP_ITEM(child)->invoke_hide (key); } diff --git a/src/sp-namedview.cpp b/src/sp-namedview.cpp index 8c750f347..52c42866e 100644 --- a/src/sp-namedview.cpp +++ b/src/sp-namedview.cpp @@ -266,7 +266,7 @@ static void sp_namedview_build(SPObject *object, SPDocument *document, Inkscape: sp_object_read_attr(object, "inkscape:connector-spacing"); /* Construct guideline list */ - for (SPObject *o = sp_object_first_child(SP_OBJECT(og)) ; o != NULL; o = SP_OBJECT_NEXT(o) ) { + for (SPObject *o = SP_OBJECT(og)->first_child() ; o != NULL; o = SP_OBJECT_NEXT(o) ) { if (SP_IS_GUIDE(o)) { SPGuide * g = SP_GUIDE(o); nv->guides = g_slist_prepend(nv->guides, g); @@ -789,7 +789,7 @@ void sp_namedview_update_layers_from_document (SPDesktop *desktop) } // if that didn't work out, look for the topmost layer if (!layer) { - SPObject *iter = sp_object_first_child(SP_DOCUMENT_ROOT(document)); + SPObject *iter = SP_DOCUMENT_ROOT(document)->first_child(); for ( ; iter ; iter = SP_OBJECT_NEXT(iter) ) { if (desktop->isLayer(iter)) { layer = iter; diff --git a/src/sp-object-group.cpp b/src/sp-object-group.cpp index 1d5c04339..02ae5d29a 100644 --- a/src/sp-object-group.cpp +++ b/src/sp-object-group.cpp @@ -112,7 +112,7 @@ sp_objectgroup_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inksca repr = xml_doc->createElement("svg:g"); } l = NULL; - for ( child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { + for ( child = object->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { crepr = child->updateRepr(xml_doc, NULL, flags); if (crepr) l = g_slist_prepend (l, crepr); } @@ -122,7 +122,7 @@ sp_objectgroup_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inksca l = g_slist_remove (l, l->data); } } else { - for ( child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { + for ( child = object->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { child->updateRepr(flags); } } diff --git a/src/sp-object-repr.cpp b/src/sp-object-repr.cpp index 62143e3ab..207d08277 100644 --- a/src/sp-object-repr.cpp +++ b/src/sp-object-repr.cpp @@ -107,7 +107,7 @@ sp_object_repr_build_tree(SPDocument *document, Inkscape::XML::Node *repr) g_assert(newobj != NULL); SPObject *const object = SP_OBJECT(newobj); g_assert(object != NULL); - sp_object_invoke_build(object, document, repr, FALSE); + object->invoke_build(document, repr, FALSE); return object; } diff --git a/src/sp-object.cpp b/src/sp-object.cpp index 08d13b2cc..edcdd60f5 100644 --- a/src/sp-object.cpp +++ b/src/sp-object.cpp @@ -495,7 +495,7 @@ SPObject::appendChildRepr(Inkscape::XML::Node *repr) { */ GSList *SPObject::childList(bool add_ref, Action) { GSList *l = NULL; - for (SPObject *child = sp_object_first_child(this) ; child != NULL; child = SP_OBJECT_NEXT(child) ) { + for (SPObject *child = this->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child) ) { if (add_ref) g_object_ref (G_OBJECT (child)); @@ -567,7 +567,7 @@ SPObject::requestOrphanCollection() { /** Sends the delete signal to all children of this object recursively */ void SPObject::_sendDeleteSignalRecursive() { - for (SPObject *child = sp_object_first_child(this); child; child = SP_OBJECT_NEXT(child)) { + for (SPObject *child = this->first_child(); child; child = SP_OBJECT_NEXT(child)) { child->_delete_signal.emit(child); child->_sendDeleteSignalRecursive(); } @@ -607,58 +607,58 @@ SPObject::deleteObject(bool propagate, bool propagate_descendants) * also update object's XML space. */ void -sp_object_attach(SPObject *parent, SPObject *object, SPObject *prev) +SPObject::attach(SPObject *object, SPObject *prev) { - g_return_if_fail(parent != NULL); - g_return_if_fail(SP_IS_OBJECT(parent)); + //g_return_if_fail(parent != NULL); + //g_return_if_fail(SP_IS_OBJECT(parent)); g_return_if_fail(object != NULL); g_return_if_fail(SP_IS_OBJECT(object)); g_return_if_fail(!prev || SP_IS_OBJECT(prev)); - g_return_if_fail(!prev || prev->parent == parent); + g_return_if_fail(!prev || prev->parent == this); g_return_if_fail(!object->parent); - sp_object_ref(object, parent); - object->parent = parent; - parent->_updateTotalHRefCount(object->_total_hrefcount); + sp_object_ref(object, this); + object->parent = this; + this->_updateTotalHRefCount(object->_total_hrefcount); SPObject *next; if (prev) { next = prev->next; prev->next = object; } else { - next = parent->children; - parent->children = object; + next = this->children; + this->children = object; } object->next = next; if (!next) { - parent->_last_child = object; + this->_last_child = object; } if (!object->xml_space.set) - object->xml_space.value = parent->xml_space.value; + object->xml_space.value = this->xml_space.value; } /** * In list of object's siblings, move object behind prev. */ void -sp_object_reorder(SPObject *object, SPObject *prev) { - g_return_if_fail(object != NULL); - g_return_if_fail(SP_IS_OBJECT(object)); - g_return_if_fail(object->parent != NULL); - g_return_if_fail(object != prev); +SPObject::reorder(SPObject *prev) { + //g_return_if_fail(object != NULL); + //g_return_if_fail(SP_IS_OBJECT(object)); + g_return_if_fail(this->parent != NULL); + g_return_if_fail(this != prev); g_return_if_fail(!prev || SP_IS_OBJECT(prev)); - g_return_if_fail(!prev || prev->parent == object->parent); + g_return_if_fail(!prev || prev->parent == this->parent); - SPObject *const parent=object->parent; + SPObject *const parent=this->parent; SPObject *old_prev=NULL; - for ( SPObject *child = parent->children ; child && child != object ; + for ( SPObject *child = parent->children ; child && child != this ; child = child->next ) { old_prev = child; } - SPObject *next=object->next; + SPObject *next=this->next; if (old_prev) { old_prev->next = next; } else { @@ -669,14 +669,14 @@ sp_object_reorder(SPObject *object, SPObject *prev) { } if (prev) { next = prev->next; - prev->next = object; + prev->next = this; } else { next = parent->children; - parent->children = object; + parent->children = this; } - object->next = next; + this->next = next; if (!next) { - parent->_last_child = object; + parent->_last_child = this; } } @@ -684,17 +684,17 @@ sp_object_reorder(SPObject *object, SPObject *prev) { * Remove object from parent's children, release and unref it. */ void -sp_object_detach(SPObject *parent, SPObject *object) { - g_return_if_fail(parent != NULL); - g_return_if_fail(SP_IS_OBJECT(parent)); +SPObject::detach(SPObject *object) { + //g_return_if_fail(parent != NULL); + //g_return_if_fail(SP_IS_OBJECT(parent)); g_return_if_fail(object != NULL); g_return_if_fail(SP_IS_OBJECT(object)); - g_return_if_fail(object->parent == parent); + g_return_if_fail(object->parent == this); object->releaseReferences(); SPObject *prev=NULL; - for ( SPObject *child = parent->children ; child && child != object ; + for ( SPObject *child = this->children ; child && child != object ; child = child->next ) { prev = child; @@ -704,32 +704,32 @@ sp_object_detach(SPObject *parent, SPObject *object) { if (prev) { prev->next = next; } else { - parent->children = next; + this->children = next; } if (!next) { - parent->_last_child = prev; + this->_last_child = prev; } object->next = NULL; object->parent = NULL; - parent->_updateTotalHRefCount(-object->_total_hrefcount); - sp_object_unref(object, parent); + this->_updateTotalHRefCount(-object->_total_hrefcount); + sp_object_unref(object, this); } /** * Return object's child whose node pointer equals repr. */ SPObject * -sp_object_get_child_by_repr(SPObject *object, Inkscape::XML::Node *repr) +SPObject::get_child_by_repr(Inkscape::XML::Node *repr) { - g_return_val_if_fail(object != NULL, NULL); - g_return_val_if_fail(SP_IS_OBJECT(object), NULL); + //g_return_val_if_fail(object != NULL, NULL); + //g_return_val_if_fail(SP_IS_OBJECT(object), NULL); g_return_val_if_fail(repr != NULL, NULL); - if (object->_last_child && SP_OBJECT_REPR(object->_last_child) == repr) - return object->_last_child; // optimization for common scenario - for ( SPObject *child = object->children ; child ; child = child->next ) { + if (this->_last_child && SP_OBJECT_REPR(this->_last_child) == repr) + return this->_last_child; // optimization for common scenario + for ( SPObject *child = this->children ; child ; child = child->next ) { if ( SP_OBJECT_REPR(child) == repr ) { return child; } @@ -750,11 +750,11 @@ sp_object_child_added(SPObject *object, Inkscape::XML::Node *child, Inkscape::XM return; } SPObject *ochild = SP_OBJECT(g_object_new(type, 0)); - SPObject *prev = ref ? sp_object_get_child_by_repr(object, ref) : NULL; - sp_object_attach(object, ochild, prev); + SPObject *prev = ref ? object->get_child_by_repr(ref) : NULL; + object->attach(ochild, prev); sp_object_unref(ochild, NULL); - sp_object_invoke_build(ochild, object->document, child, SP_OBJECT_IS_CLONED(object)); + ochild->invoke_build(object->document, child, SP_OBJECT_IS_CLONED(object)); } /** @@ -772,7 +772,7 @@ static void sp_object_release(SPObject *object) { debug("id=%x, typename=%s", object, g_type_name_from_instance((GTypeInstance*)object)); while (object->children) { - sp_object_detach(object, object->children); + object->detach(object->children); } } @@ -788,10 +788,10 @@ static void sp_object_remove_child(SPObject *object, Inkscape::XML::Node *child) { debug("id=%x, typename=%s", object, g_type_name_from_instance((GTypeInstance*)object)); - SPObject *ochild = sp_object_get_child_by_repr(object, child); + SPObject *ochild = object->get_child_by_repr(child); g_return_if_fail (ochild != NULL || !strcmp("comment", child->name())); // comments have no objects if (ochild) - sp_object_detach(object, ochild); + object->detach(ochild); } /** @@ -803,10 +803,10 @@ sp_object_remove_child(SPObject *object, Inkscape::XML::Node *child) static void sp_object_order_changed(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML::Node */*old_ref*/, Inkscape::XML::Node *new_ref) { - SPObject *ochild = sp_object_get_child_by_repr(object, child); + SPObject *ochild = object->get_child_by_repr(child); g_return_if_fail(ochild != NULL); - SPObject *prev = new_ref ? sp_object_get_child_by_repr(object, new_ref) : NULL; - sp_object_reorder(ochild, prev); + SPObject *prev = new_ref ? object->get_child_by_repr(new_ref) : NULL; + ochild->reorder(prev); ochild->_position_changed_signal.emit(ochild); } @@ -837,73 +837,73 @@ sp_object_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *rep continue; } SPObject *child = SP_OBJECT(g_object_new(type, 0)); - sp_object_attach(object, child, object->lastChild()); + object->attach(child, object->lastChild()); sp_object_unref(child, NULL); - sp_object_invoke_build(child, document, rchild, SP_OBJECT_IS_CLONED(object)); + child->invoke_build(document, rchild, SP_OBJECT_IS_CLONED(object)); } } -void sp_object_invoke_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr, unsigned int cloned) +void SPObject::invoke_build(SPDocument *document, Inkscape::XML::Node *repr, unsigned int cloned) { - debug("id=%x, typename=%s", object, g_type_name_from_instance((GTypeInstance*)object)); + debug("id=%x, typename=%s", this, g_type_name_from_instance((GTypeInstance*)this)); - g_assert(object != NULL); - g_assert(SP_IS_OBJECT(object)); + //g_assert(object != NULL); + //g_assert(SP_IS_OBJECT(object)); g_assert(document != NULL); g_assert(repr != NULL); - g_assert(object->document == NULL); - g_assert(object->repr == NULL); - g_assert(object->getId() == NULL); + g_assert(this->document == NULL); + g_assert(this->repr == NULL); + g_assert(this->getId() == NULL); /* Bookkeeping */ - object->document = document; - object->repr = repr; + this->document = document; + this->repr = repr; if (!cloned) Inkscape::GC::anchor(repr); - object->cloned = cloned; + this->cloned = cloned; - if (!SP_OBJECT_IS_CLONED(object)) { - object->document->bindObjectToRepr(object->repr, object); + if (!SP_OBJECT_IS_CLONED(this)) { + this->document->bindObjectToRepr(this->repr, this); - if (Inkscape::XML::id_permitted(object->repr)) { + if (Inkscape::XML::id_permitted(this->repr)) { /* If we are not cloned, and not seeking, force unique id */ - gchar const *id = object->repr->attribute("id"); + gchar const *id = this->repr->attribute("id"); if (!document->isSeeking()) { { - gchar *realid = sp_object_get_unique_id(object, id); + gchar *realid = sp_object_get_unique_id(this, id); g_assert(realid != NULL); - object->document->bindObjectToId(realid, object); - SPObjectImpl::setId(object, realid); + this->document->bindObjectToId(realid, this); + SPObjectImpl::setId(this, realid); g_free(realid); } /* Redefine ID, if required */ - if ((id == NULL) || (strcmp(id, object->getId()) != 0)) { - object->repr->setAttribute("id", object->getId()); + if ((id == NULL) || (strcmp(id, this->getId()) != 0)) { + this->repr->setAttribute("id", this->getId()); } } else if (id) { // bind if id, but no conflict -- otherwise, we can expect // a subsequent setting of the id attribute - if (!object->document->getObjectById(id)) { - object->document->bindObjectToId(id, object); - SPObjectImpl::setId(object, id); + if (!this->document->getObjectById(id)) { + this->document->bindObjectToId(id, this); + SPObjectImpl::setId(this, id); } } } } else { - g_assert(object->getId() == NULL); + g_assert(this->getId() == NULL); } /* Invoke derived methods, if any */ - if (((SPObjectClass *) G_OBJECT_GET_CLASS(object))->build) { - (*((SPObjectClass *) G_OBJECT_GET_CLASS(object))->build)(object, document, repr); + if (((SPObjectClass *) G_OBJECT_GET_CLASS(this))->build) { + (*((SPObjectClass *) G_OBJECT_GET_CLASS(this))->build)(this, document, repr); } /* Signalling (should be connected AFTER processing derived methods */ - sp_repr_add_listener(repr, &object_event_vector, object); + sp_repr_add_listener(repr, &object_event_vector, this); } void SPObject::releaseReferences() { @@ -1606,7 +1606,7 @@ SPObject * sp_object_prev(SPObject *child) { SPObject *parent = SP_OBJECT_PARENT(child); - for ( SPObject *i = sp_object_first_child(parent); i; i = SP_OBJECT_NEXT(i) ) { + for ( SPObject *i = parent->first_child(); i; i = SP_OBJECT_NEXT(i) ) { if (SP_OBJECT_NEXT(i) == child) return i; } diff --git a/src/sp-object.h b/src/sp-object.h index 633091668..cb7a5a6ce 100644 --- a/src/sp-object.h +++ b/src/sp-object.h @@ -498,6 +498,14 @@ public: CollectionPolicy _collection_policy; gchar *_label; mutable gchar *_default_label; + void attach(SPObject *object, SPObject *prev); + void reorder(SPObject *prev); + void detach(SPObject *object); + SPObject *get_child_by_repr(Inkscape::XML::Node *repr); + SPObject *first_child() { + return firstChild(); + } + void invoke_build(SPDocument *document, Inkscape::XML::Node *repr, unsigned int cloned); private: // Private member functions used in the definitions of setTitle(), @@ -540,16 +548,16 @@ struct SPObjectClass { * Attaching/detaching */ -void sp_object_attach(SPObject *parent, SPObject *object, SPObject *prev); -void sp_object_reorder(SPObject *object, SPObject *prev); -void sp_object_detach(SPObject *parent, SPObject *object); +//void sp_object_attach(SPObject *parent, SPObject *object, SPObject *prev); +//void sp_object_reorder(SPObject *object, SPObject *prev); +//void sp_object_detach(SPObject *parent, SPObject *object); -inline SPObject *sp_object_first_child(SPObject *parent) { +/*inline SPObject *sp_object_first_child(SPObject *parent) { return parent->firstChild(); -} -SPObject *sp_object_get_child_by_repr(SPObject *object, Inkscape::XML::Node *repr); +}*/ +//SPObject *sp_object_get_child_by_repr(SPObject *object, Inkscape::XML::Node *repr); -void sp_object_invoke_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr, unsigned int cloned); +//void sp_object_invoke_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr, unsigned int cloned); void sp_object_set(SPObject *object, unsigned int key, gchar const *value); diff --git a/src/sp-pattern.cpp b/src/sp-pattern.cpp index b076b5701..3958da66a 100644 --- a/src/sp-pattern.cpp +++ b/src/sp-pattern.cpp @@ -323,7 +323,7 @@ sp_pattern_child_added (SPObject *object, Inkscape::XML::Node *child, Inkscape:: if (((SPObjectClass *) (pattern_parent_class))->child_added) (* ((SPObjectClass *) (pattern_parent_class))->child_added) (object, child, ref); - SPObject *ochild = sp_object_get_child_by_repr(object, child); + SPObject *ochild = object->get_child_by_repr(child); if (SP_IS_ITEM (ochild)) { SPPaintServer *ps = SP_PAINT_SERVER (pat); @@ -353,8 +353,8 @@ pattern_getchildren (SPPattern *pat) GSList *l = NULL; for (SPPattern *pat_i = pat; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) { - if (sp_object_first_child(SP_OBJECT(pat_i))) { // find the first one with children - for (SPObject *child = sp_object_first_child(SP_OBJECT (pat)) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { + if (SP_OBJECT(pat_i)->first_child()) { // find the first one with children + for (SPObject *child = SP_OBJECT (pat)->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { l = g_slist_prepend (l, child); } break; // do not go further up the chain if children are found @@ -535,7 +535,7 @@ SPPattern * pattern_getroot (SPPattern *pat) { for (SPPattern *pat_i = pat; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) { - if (sp_object_first_child(SP_OBJECT(pat_i))) { // find the first one with children + if (SP_OBJECT (pat_i)->first_child()) { // find the first one with children return pat_i; } } @@ -621,7 +621,7 @@ NRRect *pattern_viewBox (SPPattern *pat) bool pattern_hasItemChildren (SPPattern *pat) { - for (SPObject *child = sp_object_first_child(SP_OBJECT(pat)) ; child != NULL; child = SP_OBJECT_NEXT(child) ) { + for (SPObject *child = SP_OBJECT (pat)->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child) ) { if (SP_IS_ITEM (child)) { return true; } @@ -736,7 +736,7 @@ sp_pattern_painter_new (SPPaintServer *ps, Geom::Matrix const &full_transform, G pp->_release_connections = new std::map; for (SPPattern *pat_i = pat; pat_i != NULL; pat_i = pat_i->ref ? pat_i->ref->getObject() : NULL) { if (pat_i && SP_IS_OBJECT (pat_i) && pattern_hasItemChildren(pat_i)) { // find the first one with item children - for (SPObject *child = sp_object_first_child(SP_OBJECT(pat_i)) ; child != NULL; child = SP_OBJECT_NEXT(child) ) { + for (SPObject *child = SP_OBJECT (pat_i)->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child) ) { if (SP_IS_ITEM (child)) { // for each item in pattern, NRArenaItem *cai; diff --git a/src/sp-root.cpp b/src/sp-root.cpp index 72c0b6de9..c032654ff 100644 --- a/src/sp-root.cpp +++ b/src/sp-root.cpp @@ -165,7 +165,7 @@ sp_root_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) (* ((SPObjectClass *) parent_class)->build) (object, document, repr); /* Search for first node */ - for (SPObject *o = sp_object_first_child(SP_OBJECT(group)) ; o != NULL; o = SP_OBJECT_NEXT(o) ) { + for (SPObject *o = SP_OBJECT(group)->first_child() ; o != NULL; o = SP_OBJECT_NEXT(o) ) { if (SP_IS_DEFS(o)) { root->defs = SP_DEFS(o); break; @@ -360,7 +360,7 @@ sp_root_child_added(SPObject *object, Inkscape::XML::Node *child, Inkscape::XML: if (co && SP_IS_DEFS(co)) { SPObject *c; /* We search for first node - it is not beautiful, but works */ - for (c = sp_object_first_child(SP_OBJECT(group)) ; c != NULL; c = SP_OBJECT_NEXT(c) ) { + for (c = SP_OBJECT(group)->first_child() ; c != NULL; c = SP_OBJECT_NEXT(c) ) { if (SP_IS_DEFS(c)) { root->defs = SP_DEFS(c); break; @@ -379,7 +379,7 @@ static void sp_root_remove_child(SPObject *object, Inkscape::XML::Node *child) if ( root->defs && SP_OBJECT_REPR(root->defs) == child ) { SPObject *iter; /* We search for first remaining node - it is not beautiful, but works */ - for ( iter = sp_object_first_child(object) ; iter ; iter = SP_OBJECT_NEXT(iter) ) { + for ( iter = object->first_child() ; iter ; iter = SP_OBJECT_NEXT(iter) ) { if ( SP_IS_DEFS(iter) && (SPDefs *)iter != root->defs ) { root->defs = (SPDefs *)iter; break; diff --git a/src/sp-style-elem-test.h b/src/sp-style-elem-test.h index 6d0b59daa..38dc1d367 100644 --- a/src/sp-style-elem-test.h +++ b/src/sp-style-elem-test.h @@ -108,7 +108,7 @@ public: SPStyleElem &style_elem = *SP_STYLE_ELEM(g_object_new(SP_TYPE_STYLE_ELEM, NULL)); Inkscape::XML::Node *const repr = sp_document_repr_doc(_doc)->createElement("svg:style"); repr->setAttribute("type", "text/css"); - sp_object_invoke_build(&style_elem, _doc, repr, false); + (&style_elem)->invoke_build( _doc, repr, false); TS_ASSERT( style_elem.is_css ); TS_ASSERT( style_elem.media.print ); TS_ASSERT( style_elem.media.screen ); @@ -138,7 +138,7 @@ public: repr->setAttribute("type", "text/css"); Inkscape::XML::Node *const content_repr = sp_document_repr_doc(_doc)->createTextNode(".myclass { }"); repr->addChild(content_repr, NULL); - sp_object_invoke_build(&style_elem, _doc, repr, false); + (&style_elem)->invoke_build(_doc, repr, false); TS_ASSERT( style_elem.is_css ); TS_ASSERT( _doc->style_cascade ); CRStyleSheet const *const stylesheet = cr_cascade_get_sheet(_doc->style_cascade, ORIGIN_AUTHOR); diff --git a/src/sp-switch.cpp b/src/sp-switch.cpp index 07575c4f0..2d67b8637 100644 --- a/src/sp-switch.cpp +++ b/src/sp-switch.cpp @@ -72,7 +72,7 @@ CSwitch::~CSwitch() { } SPObject *CSwitch::_evaluateFirst() { - for (SPObject *child = sp_object_first_child(_group) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { + for (SPObject *child = _group->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { if (SP_IS_ITEM(child) && sp_item_evaluate(SP_ITEM(child))) return child; } diff --git a/src/sp-text.cpp b/src/sp-text.cpp index 46e17a75a..7bdd84989 100644 --- a/src/sp-text.cpp +++ b/src/sp-text.cpp @@ -225,7 +225,7 @@ sp_text_update (SPObject *object, SPCtx *ctx, guint flags) /* Create temporary list of children */ GSList *l = NULL; - for (SPObject *child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { + for (SPObject *child = object->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { sp_object_ref (SP_OBJECT (child), object); l = g_slist_prepend (l, child); } @@ -286,7 +286,7 @@ sp_text_modified (SPObject *object, guint flags) /* Create temporary list of children */ GSList *l = NULL; SPObject *child; - for (child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { + for (child = object->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { sp_object_ref (SP_OBJECT (child), object); l = g_slist_prepend (l, child); } @@ -310,7 +310,7 @@ sp_text_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML if (!repr) repr = xml_doc->createElement("svg:text"); GSList *l = NULL; - for (SPObject *child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { + for (SPObject *child = object->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { if (SP_IS_TITLE(child) || SP_IS_DESC(child)) continue; Inkscape::XML::Node *crepr = NULL; if (SP_IS_STRING(child)) { @@ -326,7 +326,7 @@ sp_text_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML l = g_slist_remove (l, l->data); } } else { - for (SPObject *child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { + for (SPObject *child = object->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { if (SP_IS_TITLE(child) || SP_IS_DESC(child)) continue; if (SP_IS_STRING(child)) { SP_OBJECT_REPR(child)->setContent(SP_STRING(child)->string.c_str()); @@ -565,7 +565,7 @@ unsigned SPText::_buildLayoutInput(SPObject *root, Inkscape::Text::Layout::Optio child_attrs_offset--; } - for (SPObject *child = sp_object_first_child(root) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { + for (SPObject *child = root->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { if (SP_IS_STRING(child)) { Glib::ustring const &string = SP_STRING(child)->string; layout.appendText(string, root->style, child, &optional_attrs, child_attrs_offset + length); diff --git a/src/sp-textpath.h b/src/sp-textpath.h index 193196606..6642587d2 100644 --- a/src/sp-textpath.h +++ b/src/sp-textpath.h @@ -31,7 +31,7 @@ struct SPTextPathClass { GType sp_textpath_get_type(); -#define SP_IS_TEXT_TEXTPATH(obj) (SP_IS_TEXT(obj) && sp_object_first_child(obj) && SP_IS_TEXTPATH(sp_object_first_child(obj))) +#define SP_IS_TEXT_TEXTPATH(obj) (SP_IS_TEXT(obj) && obj->first_child() && SP_IS_TEXTPATH(obj->first_child())) SPItem *sp_textpath_get_path_item(SPTextPath *tp); void sp_textpath_to_text(SPObject *tp); diff --git a/src/sp-tref.cpp b/src/sp-tref.cpp index 382b55740..850ebbd42 100644 --- a/src/sp-tref.cpp +++ b/src/sp-tref.cpp @@ -388,7 +388,7 @@ sp_tref_href_changed(SPObject */*old_ref*/, SPObject */*ref*/, SPTRef *tref) tref->_delete_connection.disconnect(); if (tref->stringChild) { - sp_object_detach(SP_OBJECT(tref), tref->stringChild); + SP_OBJECT(tref)->detach(tref->stringChild); tref->stringChild = NULL; } @@ -516,7 +516,7 @@ sp_tref_update_text(SPTRef *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; } @@ -527,9 +527,9 @@ sp_tref_update_text(SPTRef *tref) 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); } @@ -633,7 +633,7 @@ sp_tref_convert_to_tspan(SPObject *obj) //////////////////// else { GSList *l = NULL; - for (SPObject *child = sp_object_first_child(obj) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { + for (SPObject *child = obj->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { sp_object_ref (SP_OBJECT (child), obj); l = g_slist_prepend (l, child); } diff --git a/src/sp-tspan.cpp b/src/sp-tspan.cpp index db2fe6fed..a7391ac98 100644 --- a/src/sp-tspan.cpp +++ b/src/sp-tspan.cpp @@ -178,7 +178,7 @@ sp_tspan_update(SPObject *object, SPCtx *ctx, guint flags) flags &= SP_OBJECT_MODIFIED_CASCADE; SPObject *ochild; - for ( ochild = sp_object_first_child(object) ; ochild ; ochild = SP_OBJECT_NEXT(ochild) ) { + for ( ochild = object->first_child() ; ochild ; ochild = SP_OBJECT_NEXT(ochild) ) { if ( flags || ( ochild->uflags & SP_OBJECT_MODIFIED_FLAG )) { ochild->updateDisplay(ctx, flags); } @@ -196,7 +196,7 @@ sp_tspan_modified(SPObject *object, unsigned flags) flags &= SP_OBJECT_MODIFIED_CASCADE; SPObject *ochild; - for ( ochild = sp_object_first_child(object) ; ochild ; ochild = SP_OBJECT_NEXT(ochild) ) { + for ( ochild = object->first_child() ; ochild ; ochild = SP_OBJECT_NEXT(ochild) ) { if (flags || (ochild->mflags & SP_OBJECT_MODIFIED_FLAG)) { ochild->emitModified(flags); } @@ -242,7 +242,7 @@ sp_tspan_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML if ( flags&SP_OBJECT_WRITE_BUILD ) { GSList *l = NULL; - for (SPObject* child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { + for (SPObject* child = object->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { Inkscape::XML::Node* c_repr=NULL; if ( SP_IS_TSPAN(child) || SP_IS_TREF(child) ) { c_repr = child->updateRepr(xml_doc, NULL, flags); @@ -259,7 +259,7 @@ sp_tspan_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML l = g_slist_remove(l, l->data); } } else { - for (SPObject* child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { + for (SPObject* child = object->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { if ( SP_IS_TSPAN(child) || SP_IS_TREF(child) ) { child->updateRepr(flags); } else if ( SP_IS_TEXTPATH(child) ) { @@ -455,7 +455,7 @@ sp_textpath_update(SPObject *object, SPCtx *ctx, guint flags) flags &= SP_OBJECT_MODIFIED_CASCADE; SPObject *ochild; - for ( ochild = sp_object_first_child(object) ; ochild ; ochild = SP_OBJECT_NEXT(ochild) ) { + for ( ochild = object->first_child() ; ochild ; ochild = SP_OBJECT_NEXT(ochild) ) { if ( flags || ( ochild->uflags & SP_OBJECT_MODIFIED_FLAG )) { ochild->updateDisplay(ctx, flags); } @@ -494,7 +494,7 @@ sp_textpath_modified(SPObject *object, unsigned flags) flags &= SP_OBJECT_MODIFIED_CASCADE; SPObject *ochild; - for ( ochild = sp_object_first_child(object) ; ochild ; ochild = SP_OBJECT_NEXT(ochild) ) { + for ( ochild = object->first_child() ; ochild ; ochild = SP_OBJECT_NEXT(ochild) ) { if (flags || (ochild->mflags & SP_OBJECT_MODIFIED_FLAG)) { ochild->emitModified(flags); } @@ -526,7 +526,7 @@ sp_textpath_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape:: if ( flags&SP_OBJECT_WRITE_BUILD ) { GSList *l = NULL; - for (SPObject* child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { + for (SPObject* child = object->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { Inkscape::XML::Node* c_repr=NULL; if ( SP_IS_TSPAN(child) || SP_IS_TREF(child) ) { c_repr = child->updateRepr(xml_doc, NULL, flags); @@ -543,7 +543,7 @@ sp_textpath_write(SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape:: l = g_slist_remove(l, l->data); } } else { - for (SPObject* child = sp_object_first_child(object) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { + for (SPObject* child = object->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { if ( SP_IS_TSPAN(child) || SP_IS_TREF(child) ) { child->updateRepr(flags); } else if ( SP_IS_TEXTPATH(child) ) { diff --git a/src/sp-use.cpp b/src/sp-use.cpp index 1125550c8..3770b2324 100644 --- a/src/sp-use.cpp +++ b/src/sp-use.cpp @@ -140,7 +140,7 @@ sp_use_finalize(GObject *obj) SPUse *use = (SPUse *) obj; if (use->child) { - sp_object_detach(SP_OBJECT(obj), use->child); + SP_OBJECT(obj)->detach(use->child); use->child = NULL; } @@ -177,7 +177,7 @@ sp_use_release(SPObject *object) SPUse *use = SP_USE(object); if (use->child) { - sp_object_detach(object, use->child); + object->detach(use->child); use->child = NULL; } @@ -525,7 +525,7 @@ sp_use_href_changed(SPObject */*old_ref*/, SPObject */*ref*/, SPUse *use) use->_transformed_connection.disconnect(); if (use->child) { - sp_object_detach(SP_OBJECT(use), use->child); + SP_OBJECT(use)->detach(use->child); use->child = NULL; } @@ -537,9 +537,9 @@ sp_use_href_changed(SPObject */*old_ref*/, SPObject */*ref*/, SPUse *use) 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_attach(SP_OBJECT(use), use->child, use->lastChild()); + SP_OBJECT(use)->attach(use->child, use->lastChild()); sp_object_unref(use->child, SP_OBJECT(use)); - sp_object_invoke_build(use->child, SP_OBJECT(use)->document, childrepr, TRUE); + (use->child)->invoke_build(SP_OBJECT(use)->document, childrepr, TRUE); for (SPItemView *v = item->display; v != NULL; v = v->next) { NRArenaItem *ai; diff --git a/src/text-chemistry.cpp b/src/text-chemistry.cpp index 5af97165e..9d4c23b25 100644 --- a/src/text-chemistry.cpp +++ b/src/text-chemistry.cpp @@ -215,7 +215,7 @@ text_remove_from_path() continue; } - SPObject *tp = sp_object_first_child(SP_OBJECT(items->data)); + SPObject *tp = SP_OBJECT(items->data)->first_child(); did = true; @@ -252,7 +252,7 @@ text_remove_all_kerns_recursively(SPObject *o) g_strfreev(xa_comma); } - for (SPObject *i = sp_object_first_child(o); i != NULL; i = SP_OBJECT_NEXT(i)) { + for (SPObject *i = o->first_child(); i != NULL; i = SP_OBJECT_NEXT(i)) { text_remove_all_kerns_recursively(i); } } diff --git a/src/text-editing.cpp b/src/text-editing.cpp index 600059303..2ed5270fd 100644 --- a/src/text-editing.cpp +++ b/src/text-editing.cpp @@ -872,8 +872,8 @@ sp_te_set_repr_text_multiline(SPItem *text, gchar const *str) SPObject *object; bool is_textpath = false; if (SP_IS_TEXT_TEXTPATH (text)) { - repr = SP_OBJECT_REPR (sp_object_first_child(SP_OBJECT (text))); - object = sp_object_first_child(SP_OBJECT (text)); + repr = SP_OBJECT_REPR (SP_OBJECT (text)->first_child()); + object = SP_OBJECT (text)->first_child(); is_textpath = true; } else { repr = SP_OBJECT_REPR (text); @@ -1331,7 +1331,7 @@ static void apply_css_recursive(SPObject *o, SPCSSAttr const *css) { sp_repr_css_change(SP_OBJECT_REPR(o), const_cast(css), "style"); - for (SPObject *child = sp_object_first_child(SP_OBJECT(o)) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { + for (SPObject *child = SP_OBJECT(o)->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { if (sp_repr_css_property(const_cast(css), "opacity", NULL) != NULL) { // Unset properties which are accumulating and thus should not be set recursively. // For example, setting opacity 0.5 on a group recursively would result in the visible opacity of 0.25 for an item in the group. @@ -1418,7 +1418,7 @@ static void recursively_apply_style(SPObject *common_ancestor, SPCSSAttr const * child_span->appendChild(text_in_span); Inkscape::GC::release(text_in_span); child->deleteObject(); - child = sp_object_get_child_by_repr(common_ancestor, child_span); + child = common_ancestor->get_child_by_repr(child_span); } else surround_entire_string = true; @@ -1430,7 +1430,7 @@ static void recursively_apply_style(SPObject *common_ancestor, SPCSSAttr const * SP_OBJECT_REPR(common_ancestor)->removeChild(child_repr); child_span->appendChild(child_repr); Inkscape::GC::release(child_repr); - child = sp_object_get_child_by_repr(common_ancestor, child_span); + child = common_ancestor->get_child_by_repr(child_span); } Inkscape::GC::release(child_span); diff --git a/src/tweak-context.cpp b/src/tweak-context.cpp index cd6ff325a..775e7aec3 100644 --- a/src/tweak-context.cpp +++ b/src/tweak-context.cpp @@ -425,7 +425,7 @@ sp_tweak_dilate_recursive (Inkscape::Selection *selection, SPItem *item, Geom::P if (SP_IS_GROUP(item) && !SP_IS_BOX3D(item)) { GSList *children = NULL; - for (SPObject *child = sp_object_first_child(SP_OBJECT(item)) ; child != NULL; child = SP_OBJECT_NEXT(child) ) { + for (SPObject *child = SP_OBJECT(item)->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child) ) { if (SP_IS_ITEM(child)) { children = g_slist_prepend(children, child); } @@ -863,7 +863,7 @@ tweak_colors_in_gradient (SPItem *item, bool fill_or_stroke, double offset_l = 0; double offset_h = 0; SPObject *child_prev = NULL; - for (SPObject *child = sp_object_first_child(vector); + for (SPObject *child = vector->first_child(); child != NULL; child = SP_OBJECT_NEXT(child)) { if (!SP_IS_STOP(child)) continue; @@ -923,7 +923,7 @@ sp_tweak_color_recursive (guint mode, SPItem *item, SPItem *item_at_point, bool did = false; if (SP_IS_GROUP(item)) { - for (SPObject *child = sp_object_first_child(SP_OBJECT(item)) ; child != NULL; child = SP_OBJECT_NEXT(child) ) { + for (SPObject *child = SP_OBJECT(item)->first_child() ; child != NULL; child = SP_OBJECT_NEXT(child) ) { if (SP_IS_ITEM(child)) { if (sp_tweak_color_recursive (mode, SP_ITEM(child), item_at_point, fill_goal, do_fill, diff --git a/src/ui/clipboard.cpp b/src/ui/clipboard.cpp index aa59a7b23..e050d69b4 100644 --- a/src/ui/clipboard.cpp +++ b/src/ui/clipboard.cpp @@ -702,7 +702,7 @@ void ClipboardManagerImpl::_copyUsedDefs(SPItem *item) } // Copy text paths if (SP_IS_TEXT_TEXTPATH(item)) { - _copyTextPath(SP_TEXTPATH(sp_object_first_child(SP_OBJECT(item)))); + _copyTextPath(SP_TEXTPATH(SP_OBJECT(item)->first_child())); } // Copy clipping objects if (item->clip_ref->getObject()) { @@ -759,7 +759,7 @@ void ClipboardManagerImpl::_copyPattern(SPPattern *pattern) _copyNode(SP_OBJECT_REPR(pattern), _doc, _defs); // items in the pattern may also use gradients and other patterns, so recurse - for (SPObject *child = sp_object_first_child(SP_OBJECT(pattern)) ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { + for (SPObject *child = SP_OBJECT(pattern)->first_child() ; child != NULL ; child = SP_OBJECT_NEXT(child) ) { if (!SP_IS_ITEM (child)) { continue; } diff --git a/src/ui/dialog/find.cpp b/src/ui/dialog/find.cpp index 837b82291..5068e3bf4 100644 --- a/src/ui/dialog/find.cpp +++ b/src/ui/dialog/find.cpp @@ -348,7 +348,7 @@ Find::all_items (SPObject *r, GSList *l, bool hidden, bool locked) if (!strcmp (SP_OBJECT_REPR (r)->name(), "svg:metadata")) return l; // we're not interested in metadata - for (SPObject *child = sp_object_first_child(r); child; child = SP_OBJECT_NEXT (child)) { + for (SPObject *child = r->first_child(); child; child = SP_OBJECT_NEXT (child)) { if (SP_IS_ITEM (child) && !SP_OBJECT_IS_CLONED (child) && !desktop->isLayer(SP_ITEM(child))) { if ((hidden || !desktop->itemIsHidden(SP_ITEM(child))) && (locked || !SP_ITEM(child)->isLocked())) { l = g_slist_prepend (l, child); diff --git a/src/widgets/gradient-vector.cpp b/src/widgets/gradient-vector.cpp index d8bbcd788..ffa5b12dd 100644 --- a/src/widgets/gradient-vector.cpp +++ b/src/widgets/gradient-vector.cpp @@ -463,7 +463,7 @@ static void verify_grad(SPGradient *gradient) int i = 0; SPStop *stop = NULL; /* count stops */ - for ( SPObject *ochild = sp_object_first_child(SP_OBJECT(gradient)) ; ochild != NULL ; ochild = SP_OBJECT_NEXT(ochild) ) { + for ( SPObject *ochild = SP_OBJECT(gradient)->first_child() ; ochild != NULL ; ochild = SP_OBJECT_NEXT(ochild) ) { if (SP_IS_STOP(ochild)) { i++; stop = SP_STOP(ochild); @@ -506,7 +506,7 @@ static void verify_grad(SPGradient *gradient) static void select_stop_in_list( GtkWidget *mnu, SPGradient *gradient, SPStop *new_stop) { int i = 0; - for ( SPObject *ochild = sp_object_first_child(SP_OBJECT(gradient)) ; ochild != NULL ; ochild = SP_OBJECT_NEXT(ochild) ) { + for ( SPObject *ochild = SP_OBJECT(gradient)->first_child() ; ochild != NULL ; ochild = SP_OBJECT_NEXT(ochild) ) { if (SP_IS_STOP(ochild)) { if (SP_OBJECT(ochild) == SP_OBJECT(new_stop)) { gtk_option_menu_set_history(GTK_OPTION_MENU(mnu), i); @@ -536,7 +536,7 @@ static void update_stop_list( GtkWidget *mnu, SPGradient *gradient, SPStop *new_ gtk_widget_show(m); GSList *sl = NULL; if ( gradient->hasStops() ) { - for ( SPObject *ochild = sp_object_first_child(SP_OBJECT(gradient)) ; ochild != NULL ; ochild = SP_OBJECT_NEXT(ochild) ) { + for ( SPObject *ochild = SP_OBJECT(gradient)->first_child() ; ochild != NULL ; ochild = SP_OBJECT_NEXT(ochild) ) { if (SP_IS_STOP(ochild)) { sl = g_slist_append(sl, ochild); } diff --git a/src/widgets/stroke-style.cpp b/src/widgets/stroke-style.cpp index 0d7b95f4c..65732d488 100644 --- a/src/widgets/stroke-style.cpp +++ b/src/widgets/stroke-style.cpp @@ -221,7 +221,7 @@ ink_marker_list_get (SPDocument *source) GSList *ml = NULL; SPDefs *defs = (SPDefs *) SP_DOCUMENT_DEFS (source); - for ( SPObject *child = sp_object_first_child(SP_OBJECT(defs)); + for ( SPObject *child = SP_OBJECT(defs)->first_child(); child != NULL; child = SP_OBJECT_NEXT (child) ) {