diff options
Diffstat (limited to 'src')
44 files changed, 333 insertions, 173 deletions
diff --git a/src/document.h b/src/document.h index 38f930c31..a91d1e57f 100644 --- a/src/document.h +++ b/src/document.h @@ -162,8 +162,10 @@ sigc::connection connectCommit(CommitSignal::slot_type slot); void setModifiedSinceSave(bool modified = true) { modified_since_save = modified; } + //Inkscape::XML::Document * getRdoc(){ return rdoc; } private: + //Inkscape::XML::Document *rdoc; ///< Our Inkscape::XML::Document SPDocument(SPDocument const &); // no copy void operator=(SPDocument const &); // no assign diff --git a/src/extension/internal/grid.cpp b/src/extension/internal/grid.cpp index 8132ba1ad..4d07e401d 100644 --- a/src/extension/internal/grid.cpp +++ b/src/extension/internal/grid.cpp @@ -112,7 +112,9 @@ Grid::effect (Inkscape::Extension::Effect *module, Inkscape::UI::View::View *doc path_data = build_lines(bounding_area, offsets, spacings); Inkscape::XML::Document * xml_doc = sp_document_repr_doc(document->doc()); - Inkscape::XML::Node * current_layer = static_cast<SPDesktop *>(document)->currentLayer()->repr; + + //XML Tree being used directly here while it shouldn't be. + Inkscape::XML::Node * current_layer = static_cast<SPDesktop *>(document)->currentLayer()->getRepr(); Inkscape::XML::Node * path = xml_doc->createElement("svg:path"); path->setAttribute("d", path_data.c_str()); diff --git a/src/filter-chemistry.cpp b/src/filter-chemistry.cpp index f180dc661..1f4e91c3b 100644 --- a/src/filter-chemistry.cpp +++ b/src/filter-chemistry.cpp @@ -168,7 +168,8 @@ filter_add_primitive(SPFilter *filter, const Inkscape::Filters::FilterPrimitiveT } //set primitive as child of filter node - filter->repr->appendChild(repr); + // XML tree being used directly while/where it shouldn't be... + filter->getRepr()->appendChild(repr); Inkscape::GC::release(repr); // get corresponding object diff --git a/src/filters/blend.cpp b/src/filters/blend.cpp index 5998d7be3..3cec42291 100644 --- a/src/filters/blend.cpp +++ b/src/filters/blend.cpp @@ -213,7 +213,9 @@ sp_feBlend_update(SPObject *object, SPCtx *ctx, guint flags) { SPFilter *parent = SP_FILTER(object->parent); blend->in2 = sp_filter_primitive_name_previous_out(blend); - object->repr->setAttribute("in2", sp_filter_name_for_image(parent, blend->in2)); + + //XML Tree being used directly here while it shouldn't be. + object->getRepr()->setAttribute("in2", sp_filter_name_for_image(parent, blend->in2)); } if (((SPObjectClass *) feBlend_parent_class)->update) { diff --git a/src/filters/composite.cpp b/src/filters/composite.cpp index 93c692f94..761115850 100644 --- a/src/filters/composite.cpp +++ b/src/filters/composite.cpp @@ -240,7 +240,9 @@ sp_feComposite_update(SPObject *object, SPCtx *ctx, guint flags) { SPFilter *parent = SP_FILTER(object->parent); comp->in2 = sp_filter_primitive_name_previous_out(comp); - object->repr->setAttribute("in2", sp_filter_name_for_image(parent, comp->in2)); + + //XML Tree being used directly here while it shouldn't be. + object->getRepr()->setAttribute("in2", sp_filter_name_for_image(parent, comp->in2)); } if (((SPObjectClass *) feComposite_parent_class)->update) { diff --git a/src/filters/displacementmap.cpp b/src/filters/displacementmap.cpp index baa17d785..ea2535f3e 100644 --- a/src/filters/displacementmap.cpp +++ b/src/filters/displacementmap.cpp @@ -218,7 +218,9 @@ sp_feDisplacementMap_update(SPObject *object, SPCtx *ctx, guint flags) { SPFilter *parent = SP_FILTER(object->parent); disp->in2 = sp_filter_primitive_name_previous_out(disp); - object->repr->setAttribute("in2", sp_filter_name_for_image(parent, disp->in2)); + + //XML Tree being used directly here while it shouldn't be. + object->getRepr()->setAttribute("in2", sp_filter_name_for_image(parent, disp->in2)); } if (((SPObjectClass *) feDisplacementMap_parent_class)->update) { diff --git a/src/flood-context.cpp b/src/flood-context.cpp index 696efd3e3..5181809dc 100644 --- a/src/flood-context.cpp +++ b/src/flood-context.cpp @@ -417,7 +417,8 @@ static void do_trace(bitmap_coords_info bci, guchar *trace_px, SPDesktop *deskto std::vector<Inkscape::Trace::TracingEngineResult> results = pte.traceGrayMap(gray_map); gray_map->destroy(gray_map); - Inkscape::XML::Node *layer_repr = SP_GROUP(desktop->currentLayer())->repr; + //XML Tree being used here directly while it shouldn't be...." + Inkscape::XML::Node *layer_repr = SP_GROUP(desktop->currentLayer())->getRepr(); Inkscape::XML::Document *xml_doc = sp_document_repr_doc(desktop->doc()); long totalNodeCount = 0L; diff --git a/src/knotholder.cpp b/src/knotholder.cpp index 89f57da97..6778e9ad8 100644 --- a/src/knotholder.cpp +++ b/src/knotholder.cpp @@ -42,7 +42,8 @@ class SPDesktop; KnotHolder::KnotHolder(SPDesktop *desktop, SPItem *item, SPKnotHolderReleasedFunc relhandler) { - Inkscape::XML::Node *repr = SP_OBJECT(item)->repr; + //XML Tree being used directly here while it shouldn't be... + Inkscape::XML::Node *repr = SP_OBJECT(item)->getRepr(); if (!desktop || !item || !SP_IS_ITEM(item)) { g_print ("Error! Throw an exception, please!\n"); diff --git a/src/layer-manager.cpp b/src/layer-manager.cpp index 5c96bcee1..0ee7f76a9 100644 --- a/src/layer-manager.cpp +++ b/src/layer-manager.cpp @@ -269,13 +269,15 @@ void LayerManager::_rebuild() { if ( group->layerMode() == SPGroup::LAYER ) { // If we have a layer-group as the one or a parent, ensure it is listed as a valid layer. needsAdd &= ( g_slist_find(const_cast<GSList *>(layers), curr) != NULL ); - if ( (!(group->repr)) || (!(group->repr->parent())) ) { + // XML Tree being used here directly while it shouldn't be... + if ( (!(group->getRepr())) || (!(group->getRepr()->parent())) ) { needsAdd = false; } } else { // If a non-layer group is a parent of layer groups, then show it also as a layer. // TODO add the magic Inkscape group mode? - if ( group->repr && group->repr->parent() ) { + // XML Tree being used directly while it shouldn't be... + if ( group->getRepr() && group->getRepr()->parent() ) { additional.insert(group); } else { needsAdd = false; diff --git a/src/marker.cpp b/src/marker.cpp index e02276215..979ca3011 100644 --- a/src/marker.cpp +++ b/src/marker.cpp @@ -524,8 +524,10 @@ sp_marker_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::X repr->setAttribute("orient", NULL); } /* fixme: */ - repr->setAttribute("viewBox", object->repr->attribute("viewBox")); - repr->setAttribute("preserveAspectRatio", object->repr->attribute("preserveAspectRatio")); + //XML Tree being used directly here while it shouldn't be.... + repr->setAttribute("viewBox", object->getRepr()->attribute("viewBox")); + //XML Tree being used directly here while it shouldn't be.... + repr->setAttribute("preserveAspectRatio", object->getRepr()->attribute("preserveAspectRatio")); if (((SPObjectClass *) (parent_class))->write) ((SPObjectClass *) (parent_class))->write (object, xml_doc, repr, flags); diff --git a/src/path-chemistry.cpp b/src/path-chemistry.cpp index daa9ae595..639c7fa00 100644 --- a/src/path-chemistry.cpp +++ b/src/path-chemistry.cpp @@ -213,8 +213,10 @@ sp_selected_path_break_apart(SPDesktop *desktop) gint pos = SP_OBJECT_REPR(item)->position(); char const *id = SP_OBJECT_REPR(item)->attribute("id"); - gchar *style = g_strdup(SP_OBJECT(item)->repr->attribute("style")); - gchar *path_effect = g_strdup(SP_OBJECT(item)->repr->attribute("inkscape:path-effect")); + // XML Tree being used directly here while it shouldn't be... + gchar *style = g_strdup(SP_OBJECT(item)->getRepr()->attribute("style")); + // XML Tree being used directly here while it shouldn't be... + gchar *path_effect = g_strdup(SP_OBJECT(item)->getRepr()->attribute("inkscape:path-effect")); Geom::PathVector apv = curve->get_pathvector() * SP_ITEM(path)->transform; diff --git a/src/sp-anchor.cpp b/src/sp-anchor.cpp index aabefdfdb..379ddbb7c 100644 --- a/src/sp-anchor.cpp +++ b/src/sp-anchor.cpp @@ -154,13 +154,15 @@ static Inkscape::XML::Node *sp_anchor_write(SPObject *object, Inkscape::XML::Doc repr->setAttribute("xlink:href", anchor->href); if (repr != SP_OBJECT_REPR(object)) { - COPY_ATTR(repr, object->repr, "xlink:type"); - COPY_ATTR(repr, object->repr, "xlink:role"); - COPY_ATTR(repr, object->repr, "xlink:arcrole"); - COPY_ATTR(repr, object->repr, "xlink:title"); - COPY_ATTR(repr, object->repr, "xlink:show"); - COPY_ATTR(repr, object->repr, "xlink:actuate"); - COPY_ATTR(repr, object->repr, "target"); + /* XML Tree being directly used while it shouldn't be in the + below COPY_ATTR lines*/ + COPY_ATTR(repr, object->getRepr(), "xlink:type"); + COPY_ATTR(repr, object->getRepr(), "xlink:role"); + COPY_ATTR(repr, object->getRepr(), "xlink:arcrole"); + COPY_ATTR(repr, object->getRepr(), "xlink:title"); + COPY_ATTR(repr, object->getRepr(), "xlink:show"); + COPY_ATTR(repr, object->getRepr(), "xlink:actuate"); + COPY_ATTR(repr, object->getRepr(), "target"); } if (((SPObjectClass *) (parent_class))->write) { diff --git a/src/sp-clippath.h b/src/sp-clippath.h index 02395f3d2..308c3c893 100644 --- a/src/sp-clippath.h +++ b/src/sp-clippath.h @@ -61,8 +61,10 @@ protected: } SPObject * const owner = this->getOwner(); if (obj->isAncestorOf(owner)) { - Inkscape::XML::Node * const owner_repr = owner->repr; - Inkscape::XML::Node * const obj_repr = obj->repr; + //XML Tree being used directly here while it shouldn't be... + Inkscape::XML::Node * const owner_repr = owner->getRepr(); + //XML Tree being used directly here while it shouldn't be... + Inkscape::XML::Node * const obj_repr = obj->getRepr(); gchar const * owner_name = NULL; gchar const * owner_clippath = NULL; gchar const * obj_name = NULL; diff --git a/src/sp-filter-primitive.cpp b/src/sp-filter-primitive.cpp index 77325c4b1..7cf0a38bb 100644 --- a/src/sp-filter-primitive.cpp +++ b/src/sp-filter-primitive.cpp @@ -259,7 +259,8 @@ int sp_filter_primitive_name_previous_out(SPFilterPrimitive *prim) { Glib::ustring name = sp_filter_get_new_result_name(parent); int slot = sp_filter_set_image_name(parent, name.c_str()); i_prim->image_out = slot; - i_prim->repr->setAttribute("result", name.c_str()); + //XML Tree is being directly used while it shouldn't be. + i_prim->getRepr()->setAttribute("result", name.c_str()); return slot; } else { return i_prim->image_out; diff --git a/src/sp-flowtext.cpp b/src/sp-flowtext.cpp index b18d6f182..2d1f61a29 100644 --- a/src/sp-flowtext.cpp +++ b/src/sp-flowtext.cpp @@ -241,7 +241,8 @@ sp_flowtext_set(SPObject *object, unsigned key, gchar const *value) switch (key) { case SP_ATTR_LAYOUT_OPTIONS: { // deprecated attribute, read for backward compatibility only - SPCSSAttr *opts = sp_repr_css_attr((SP_OBJECT(group))->repr, "inkscape:layoutOptions"); + //XML Tree being directly used while it shouldn't be. + SPCSSAttr *opts = sp_repr_css_attr((SP_OBJECT(group))->getRepr(), "inkscape:layoutOptions"); { gchar const *val = sp_repr_css_property(opts, "justification", NULL); if (val != NULL && !object->style->text_align.set) { @@ -481,7 +482,8 @@ void SPFlowtext::_buildLayoutInput(SPObject *root, Shape const *exclusion_shape, layout.appendWrapShape(&shapes->back()); } } - else if (!SP_IS_FLOWREGIONEXCLUDE(child) && !sp_repr_is_meta_element(child->repr)) + //XML Tree is being directly used while it shouldn't be. + else if (!SP_IS_FLOWREGIONEXCLUDE(child) && !sp_repr_is_meta_element(child->getRepr())) _buildLayoutInput(child, exclusion_shape, shapes, pending_line_break_object); } diff --git a/src/sp-font-face.cpp b/src/sp-font-face.cpp index 1912676d4..20419a8e5 100644 --- a/src/sp-font-face.cpp +++ b/src/sp-font-face.cpp @@ -866,39 +866,41 @@ static Inkscape::XML::Node *sp_fontface_write(SPObject *object, Inkscape::XML::D sp_repr_set_svg_double(repr, "overline-thickness", face->overline_thickness); if (repr != SP_OBJECT_REPR(object)) { - COPY_ATTR(repr, object->repr, "font-family"); - COPY_ATTR(repr, object->repr, "font-style"); - COPY_ATTR(repr, object->repr, "font-variant"); - COPY_ATTR(repr, object->repr, "font-weight"); - COPY_ATTR(repr, object->repr, "font-stretch"); - COPY_ATTR(repr, object->repr, "font-size"); - COPY_ATTR(repr, object->repr, "unicode-range"); - COPY_ATTR(repr, object->repr, "units-per-em"); - COPY_ATTR(repr, object->repr, "panose-1"); - COPY_ATTR(repr, object->repr, "stemv"); - COPY_ATTR(repr, object->repr, "stemh"); - COPY_ATTR(repr, object->repr, "slope"); - COPY_ATTR(repr, object->repr, "cap-height"); - COPY_ATTR(repr, object->repr, "x-height"); - COPY_ATTR(repr, object->repr, "accent-height"); - COPY_ATTR(repr, object->repr, "ascent"); - COPY_ATTR(repr, object->repr, "descent"); - COPY_ATTR(repr, object->repr, "widths"); - COPY_ATTR(repr, object->repr, "bbox"); - COPY_ATTR(repr, object->repr, "ideographic"); - COPY_ATTR(repr, object->repr, "alphabetic"); - COPY_ATTR(repr, object->repr, "mathematical"); - COPY_ATTR(repr, object->repr, "hanging"); - COPY_ATTR(repr, object->repr, "v-ideographic"); - COPY_ATTR(repr, object->repr, "v-alphabetic"); - COPY_ATTR(repr, object->repr, "v-mathematical"); - COPY_ATTR(repr, object->repr, "v-hanging"); - COPY_ATTR(repr, object->repr, "underline-position"); - COPY_ATTR(repr, object->repr, "underline-thickness"); - COPY_ATTR(repr, object->repr, "strikethrough-position"); - COPY_ATTR(repr, object->repr, "strikethrough-thickness"); - COPY_ATTR(repr, object->repr, "overline-position"); - COPY_ATTR(repr, object->repr, "overline-thickness"); + /*/ In all COPY_ATTR given below the XML tree is + being used directly while it shouldn't be.*/ + COPY_ATTR(repr, object->getRepr(), "font-family"); + COPY_ATTR(repr, object->getRepr(), "font-style"); + COPY_ATTR(repr, object->getRepr(), "font-variant"); + COPY_ATTR(repr, object->getRepr(), "font-weight"); + COPY_ATTR(repr, object->getRepr(), "font-stretch"); + COPY_ATTR(repr, object->getRepr(), "font-size"); + COPY_ATTR(repr, object->getRepr(), "unicode-range"); + COPY_ATTR(repr, object->getRepr(), "units-per-em"); + COPY_ATTR(repr, object->getRepr(), "panose-1"); + COPY_ATTR(repr, object->getRepr(), "stemv"); + COPY_ATTR(repr, object->getRepr(), "stemh"); + COPY_ATTR(repr, object->getRepr(), "slope"); + COPY_ATTR(repr, object->getRepr(), "cap-height"); + COPY_ATTR(repr, object->getRepr(), "x-height"); + COPY_ATTR(repr, object->getRepr(), "accent-height"); + COPY_ATTR(repr, object->getRepr(), "ascent"); + COPY_ATTR(repr, object->getRepr(), "descent"); + COPY_ATTR(repr, object->getRepr(), "widths"); + COPY_ATTR(repr, object->getRepr(), "bbox"); + COPY_ATTR(repr, object->getRepr(), "ideographic"); + COPY_ATTR(repr, object->getRepr(), "alphabetic"); + COPY_ATTR(repr, object->getRepr(), "mathematical"); + COPY_ATTR(repr, object->getRepr(), "hanging"); + COPY_ATTR(repr, object->getRepr(), "v-ideographic"); + COPY_ATTR(repr, object->getRepr(), "v-alphabetic"); + COPY_ATTR(repr, object->getRepr(), "v-mathematical"); + COPY_ATTR(repr, object->getRepr(), "v-hanging"); + COPY_ATTR(repr, object->getRepr(), "underline-position"); + COPY_ATTR(repr, object->getRepr(), "underline-thickness"); + COPY_ATTR(repr, object->getRepr(), "strikethrough-position"); + COPY_ATTR(repr, object->getRepr(), "strikethrough-thickness"); + COPY_ATTR(repr, object->getRepr(), "overline-position"); + COPY_ATTR(repr, object->getRepr(), "overline-thickness"); } if (((SPObjectClass *) (parent_class))->write) { diff --git a/src/sp-font.cpp b/src/sp-font.cpp index 96973b657..4f8bbef6e 100644 --- a/src/sp-font.cpp +++ b/src/sp-font.cpp @@ -263,12 +263,14 @@ static Inkscape::XML::Node *sp_font_write(SPObject *object, Inkscape::XML::Docum sp_repr_set_svg_double(repr, "vert-adv-y", font->vert_adv_y); if (repr != SP_OBJECT_REPR(object)) { - COPY_ATTR(repr, object->repr, "horiz-origin-x"); - COPY_ATTR(repr, object->repr, "horiz-origin-y"); - COPY_ATTR(repr, object->repr, "horiz-adv-x"); - COPY_ATTR(repr, object->repr, "vert-origin-x"); - COPY_ATTR(repr, object->repr, "vert-origin-y"); - COPY_ATTR(repr, object->repr, "vert-adv-y"); + /*All the below COPY_ATTR funtions are directly using + the XML Tree while they shouldn't*/ + COPY_ATTR(repr, object->getRepr(), "horiz-origin-x"); + COPY_ATTR(repr, object->getRepr(), "horiz-origin-y"); + COPY_ATTR(repr, object->getRepr(), "horiz-adv-x"); + COPY_ATTR(repr, object->getRepr(), "vert-origin-x"); + COPY_ATTR(repr, object->getRepr(), "vert-origin-y"); + COPY_ATTR(repr, object->getRepr(), "vert-adv-y"); } if (((SPObjectClass *) (parent_class))->write) { diff --git a/src/sp-glyph-kerning.cpp b/src/sp-glyph-kerning.cpp index d62fbb2c2..93996d8bc 100644 --- a/src/sp-glyph-kerning.cpp +++ b/src/sp-glyph-kerning.cpp @@ -250,11 +250,13 @@ static Inkscape::XML::Node *sp_glyph_kerning_write(SPObject *object, Inkscape::X sp_repr_set_svg_double(repr, "vert-adv-y", glyph->vert_adv_y); */ if (repr != SP_OBJECT_REPR(object)) { - COPY_ATTR(repr, object->repr, "u1"); - COPY_ATTR(repr, object->repr, "g1"); - COPY_ATTR(repr, object->repr, "u2"); - COPY_ATTR(repr, object->repr, "g2"); - COPY_ATTR(repr, object->repr, "k"); + /* All the COPY_ATTR functions below use + XML Tree directly, while they shouldn't.*/ + COPY_ATTR(repr, object->getRepr(), "u1"); + COPY_ATTR(repr, object->getRepr(), "g1"); + COPY_ATTR(repr, object->getRepr(), "u2"); + COPY_ATTR(repr, object->getRepr(), "g2"); + COPY_ATTR(repr, object->getRepr(), "k"); } if (((SPObjectClass *) (parent_class))->write) { diff --git a/src/sp-glyph.cpp b/src/sp-glyph.cpp index 0b3b85d3f..203163b29 100644 --- a/src/sp-glyph.cpp +++ b/src/sp-glyph.cpp @@ -290,16 +290,18 @@ static Inkscape::XML::Node *sp_glyph_write(SPObject *object, Inkscape::XML::Docu sp_repr_set_svg_double(repr, "vert-adv-y", glyph->vert_adv_y); */ if (repr != SP_OBJECT_REPR(object)) { - COPY_ATTR(repr, object->repr, "unicode"); - COPY_ATTR(repr, object->repr, "glyph-name"); - COPY_ATTR(repr, object->repr, "d"); - COPY_ATTR(repr, object->repr, "orientation"); - COPY_ATTR(repr, object->repr, "arabic-form"); - COPY_ATTR(repr, object->repr, "lang"); - COPY_ATTR(repr, object->repr, "horiz-adv-x"); - COPY_ATTR(repr, object->repr, "vert-origin-x"); - COPY_ATTR(repr, object->repr, "vert-origin-y"); - COPY_ATTR(repr, object->repr, "vert-adv-y"); + /* All the COPY_ATTR functions below use + XML Tree directly while they shouldn't. */ + COPY_ATTR(repr, object->getRepr(), "unicode"); + COPY_ATTR(repr, object->getRepr(), "glyph-name"); + COPY_ATTR(repr, object->getRepr(), "d"); + COPY_ATTR(repr, object->getRepr(), "orientation"); + COPY_ATTR(repr, object->getRepr(), "arabic-form"); + COPY_ATTR(repr, object->getRepr(), "lang"); + COPY_ATTR(repr, object->getRepr(), "horiz-adv-x"); + COPY_ATTR(repr, object->getRepr(), "vert-origin-x"); + COPY_ATTR(repr, object->getRepr(), "vert-origin-y"); + COPY_ATTR(repr, object->getRepr(), "vert-adv-y"); } if (((SPObjectClass *) (parent_class))->write) { diff --git a/src/sp-guide.cpp b/src/sp-guide.cpp index 877e73979..955d4fedc 100644 --- a/src/sp-guide.cpp +++ b/src/sp-guide.cpp @@ -358,7 +358,8 @@ void sp_guide_moveto(SPGuide const &guide, Geom::Point const point_on_line, bool /* Calling sp_repr_set_point must precede calling sp_item_notify_moveto in the commit case, so that the guide's new position is available for sp_item_rm_unsatisfied_cns. */ if (commit) { - sp_repr_set_point(SP_OBJECT(&guide)->repr, "position", point_on_line); + //XML Tree being used here directly while it shouldn't be. + sp_repr_set_point(SP_OBJECT(&guide)->getRepr(), "position", point_on_line); } /* DISABLED CODE BECAUSE SPGuideAttachment IS NOT USE AT THE MOMENT (johan) @@ -388,7 +389,8 @@ void sp_guide_set_normal(SPGuide const &guide, Geom::Point const normal_to_line, /* Calling sp_repr_set_svg_point must precede calling sp_item_notify_moveto in the commit case, so that the guide's new position is available for sp_item_rm_unsatisfied_cns. */ if (commit) { - sp_repr_set_point(SP_OBJECT(&guide)->repr, "orientation", normal_to_line); + //XML Tree being used directly while it shouldn't be + sp_repr_set_point(SP_OBJECT(&guide)->getRepr(), "orientation", normal_to_line); } /* DISABLED CODE BECAUSE SPGuideAttachment IS NOT USE AT THE MOMENT (johan) @@ -457,8 +459,9 @@ void sp_guide_remove(SPGuide *guide) remove_last(att.item->constraints, SPGuideConstraint(guide, att.snappoint_ix)); } guide->attached_items.clear(); - - sp_repr_unparent(SP_OBJECT(guide)->repr); + + //XML Tree being used directly while it shouldn't be. + sp_repr_unparent(SP_OBJECT(guide)->getRepr()); } /* diff --git a/src/sp-image.cpp b/src/sp-image.cpp index c1fb9a571..33038d73c 100644 --- a/src/sp-image.cpp +++ b/src/sp-image.cpp @@ -838,8 +838,12 @@ sp_image_update (SPObject *object, SPCtx *ctx, unsigned int flags) pixbuf = sp_image_repr_read_image ( image->lastMod, image->pixPath, - object->repr->attribute("xlink:href"), - object->repr->attribute("sodipodi:absref"), + + //XML Tree being used directly while it shouldn't be. + object->getRepr()->attribute("xlink:href"), + + //XML Tree being used directly while it shouldn't be. + object->getRepr()->attribute("sodipodi:absref"), doc->base); if (pixbuf) { pixbuf = sp_image_pixbuf_force_rgba (pixbuf); @@ -1056,7 +1060,9 @@ sp_image_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XM if (image->height._set) { sp_repr_set_svg_double(repr, "height", image->height.computed); } - repr->setAttribute("preserveAspectRatio", object->repr->attribute("preserveAspectRatio")); + + //XML Tree being used directly here while it shouldn't be... + repr->setAttribute("preserveAspectRatio", object->getRepr()->attribute("preserveAspectRatio")); #if ENABLE_LCMS if (image->color_profile) { repr->setAttribute("color-profile", image->color_profile); diff --git a/src/sp-mask.h b/src/sp-mask.h index 0b995f0ce..ae3b76210 100644 --- a/src/sp-mask.h +++ b/src/sp-mask.h @@ -63,8 +63,10 @@ protected: } SPObject * const owner = this->getOwner(); if (obj->isAncestorOf(owner)) { - Inkscape::XML::Node * const owner_repr = owner->repr; - Inkscape::XML::Node * const obj_repr = obj->repr; + //XML Tree being used directly here while it shouldn't be... + Inkscape::XML::Node * const owner_repr = owner->getRepr(); + //XML Tree being used directly here while it shouldn't be... + Inkscape::XML::Node * const obj_repr = obj->getRepr(); gchar const * owner_name = NULL; gchar const * owner_mask = NULL; gchar const * obj_name = NULL; diff --git a/src/sp-missing-glyph.cpp b/src/sp-missing-glyph.cpp index 7d5c42763..d15000fcb 100644 --- a/src/sp-missing-glyph.cpp +++ b/src/sp-missing-glyph.cpp @@ -176,11 +176,14 @@ static Inkscape::XML::Node *sp_missing_glyph_write(SPObject *object, Inkscape::X sp_repr_set_svg_double(repr, "vert-adv-y", glyph->vert_adv_y); */ if (repr != SP_OBJECT_REPR(object)) { - COPY_ATTR(repr, object->repr, "d"); - COPY_ATTR(repr, object->repr, "horiz-adv-x"); - COPY_ATTR(repr, object->repr, "vert-origin-x"); - COPY_ATTR(repr, object->repr, "vert-origin-y"); - COPY_ATTR(repr, object->repr, "vert-adv-y"); + + /* All the COPY_ATTR functions below use + XML Tree directly while they shouldn't.*/ + COPY_ATTR(repr, object->getRepr(), "d"); + COPY_ATTR(repr, object->getRepr(), "horiz-adv-x"); + COPY_ATTR(repr, object->getRepr(), "vert-origin-x"); + COPY_ATTR(repr, object->getRepr(), "vert-origin-y"); + COPY_ATTR(repr, object->getRepr(), "vert-adv-y"); } if (((SPObjectClass *) (parent_class))->write) { diff --git a/src/sp-object.cpp b/src/sp-object.cpp index edcdd60f5..f81d5bdb5 100644 --- a/src/sp-object.cpp +++ b/src/sp-object.cpp @@ -207,7 +207,10 @@ sp_object_init(SPObject *object) object->document = NULL; object->children = object->_last_child = NULL; object->parent = object->next = NULL; - object->repr = NULL; + + //used XML Tree here. + Inkscape::XML::Node *repr = object->getRepr(); + repr = NULL; SPObjectImpl::setIdNull(object); object->_collection_policy = SPObject::COLLECT_WITH_PARENT; @@ -294,6 +297,15 @@ gchar const* SPObject::getId() const { return id; } +Inkscape::XML::Node * SPObject::getRepr() { + return repr; +} + +Inkscape::XML::Node const* SPObject::getRepr() const{ + return repr; +} + + /** * Increase reference count of object, with possible debugging. * @@ -1007,7 +1019,9 @@ sp_object_private_set(SPObject *object, unsigned int key, gchar const *value) switch (key) { case SP_ATTR_ID: - if ( !SP_OBJECT_IS_CLONED(object) && object->repr->type() == Inkscape::XML::ELEMENT_NODE ) { + + //XML Tree being used here. + if ( !SP_OBJECT_IS_CLONED(object) && object->getRepr()->type() == Inkscape::XML::ELEMENT_NODE ) { SPDocument *document=object->document; SPObject *conflict=NULL; @@ -1108,12 +1122,13 @@ sp_object_read_attr(SPObject *object, gchar const *key) g_assert(SP_IS_OBJECT(object)); g_assert(key != NULL); - g_assert(object->repr != NULL); + //XML Tree being used here. + g_assert(object->getRepr() != NULL); unsigned int keyid = sp_attribute_lookup(key); if (keyid != SP_ATTR_INVALID) { /* Retrieve the 'key' attribute from the object's XML representation */ - gchar const *value = object->repr->attribute(key); + gchar const *value = object->getRepr()->attribute(key); sp_object_set(object, keyid, value); } @@ -1441,7 +1456,8 @@ sp_object_tagName_get(SPObject const *object, SPException *ex) } /// \todo fixme: Exception if object is NULL? */ - return object->repr->name(); + //XML Tree being used here. + return object->getRepr()->name(); } gchar const * @@ -1453,7 +1469,8 @@ sp_object_getAttribute(SPObject const *object, gchar const *key, SPException *ex } /// \todo fixme: Exception if object is NULL? */ - return (gchar const *) object->repr->attribute(key); + //XML Tree being used here. + return (gchar const *) object->getRepr()->attribute(key); } void @@ -1463,7 +1480,8 @@ sp_object_setAttribute(SPObject *object, gchar const *key, gchar const *value, S g_return_if_fail(SP_EXCEPTION_IS_OK(ex)); /// \todo fixme: Exception if object is NULL? */ - object->repr->setAttribute(key, value, false); + //XML Tree being used here. + object->getRepr()->setAttribute(key, value, false); } void @@ -1473,7 +1491,8 @@ sp_object_removeAttribute(SPObject *object, gchar const *key, SPException *ex) g_return_if_fail(SP_EXCEPTION_IS_OK(ex)); /// \todo fixme: Exception if object is NULL? */ - object->repr->setAttribute(key, NULL, false); + //XML Tree being used here. + object->getRepr()->setAttribute(key, NULL, false); } /* Helper */ @@ -1487,7 +1506,8 @@ sp_object_get_unique_id(SPObject *object, gchar const *id) count++; - gchar const *name = object->repr->name(); + //XML Tree being used here. + gchar const *name = object->getRepr()->name(); g_assert(name != NULL); gchar const *local = strchr(name, ':'); @@ -1551,7 +1571,8 @@ sp_object_get_style_property(SPObject const *object, gchar const *key, gchar con g_return_val_if_fail(SP_IS_OBJECT(object), NULL); g_return_val_if_fail(key != NULL, NULL); - gchar const *style = object->repr->attribute("style"); + //XML Tree being used here. + gchar const *style = object->getRepr()->attribute("style"); if (style) { size_t const len = strlen(key); char const *p; @@ -1572,7 +1593,9 @@ sp_object_get_style_property(SPObject const *object, gchar const *key, gchar con } } } - gchar const *val = object->repr->attribute(key); + + //XML Tree being used here. + gchar const *val = object->getRepr()->attribute(key); if (val && !streq(val, "inherit")) { return val; } diff --git a/src/sp-object.h b/src/sp-object.h index cb7a5a6ce..e1d49b041 100644 --- a/src/sp-object.h +++ b/src/sp-object.h @@ -46,7 +46,7 @@ /* Convenience stuff */ #define SP_OBJECT_ID(o) (((SPObject *) (o))->getId()) -#define SP_OBJECT_REPR(o) (((SPObject *) (o))->repr) +#define SP_OBJECT_REPR(o) (((SPObject *) (o))->getRepr()) #define SP_OBJECT_DOCUMENT(o) (((SPObject *) (o))->document) #define SP_OBJECT_PARENT(o) (((SPObject *) (o))->parent) #define SP_OBJECT_NEXT(o) (((SPObject *) (o))->next) @@ -137,7 +137,8 @@ SPObject *sp_object_href(SPObject *object, gpointer owner); SPObject *sp_object_hunref(SPObject *object, gpointer owner); /// A refcounting tree node object. -struct SPObject : public GObject { +class SPObject : public GObject { + public: enum CollectionPolicy { COLLECT_WITH_PARENT, ALWAYS_COLLECT @@ -154,10 +155,11 @@ struct SPObject : public GObject { SPObject *children; /* Our children */ SPObject *_last_child; /* Remembered last child */ SPObject *next; /* Next object in linked list */ - Inkscape::XML::Node *repr; /* Our xml representation */ + //Inkscape::XML::Node *repr; /* Our xml representation */ private: gchar *id; /* Our very own unique id */ + Inkscape::XML::Node *repr; /* Our xml representation */ public: /** @@ -165,6 +167,17 @@ public: */ gchar const* getId() const; + /** + * Returns the XML representation of tree + */ + //Inkscape::XML::Node const* getRepr() const; + Inkscape::XML::Node * getRepr(); + + /** + * Returns the XML representation of tree + */ + Inkscape::XML::Node const* getRepr() const; + /** @brief cleans up an SPObject, releasing its references and * requesting that references to it be released */ diff --git a/src/sp-offset.cpp b/src/sp-offset.cpp index 30626695e..ff915c92f 100644 --- a/src/sp-offset.cpp +++ b/src/sp-offset.cpp @@ -217,37 +217,42 @@ sp_offset_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *rep if (((SPObjectClass *) parent_class)->build) ((SPObjectClass *) parent_class)->build (object, document, repr); - if (object->repr->attribute("inkscape:radius")) { + //XML Tree being used directly here while it shouldn't be. + if (object->getRepr()->attribute("inkscape:radius")) { sp_object_read_attr (object, "inkscape:radius"); } else { - gchar const *oldA = object->repr->attribute("sodipodi:radius"); - object->repr->setAttribute("inkscape:radius",oldA); - object->repr->setAttribute("sodipodi:radius",NULL); + + + //XML Tree being used directly here (as object->getRepr) + //in all the below lines in the block while it shouldn't be. + gchar const *oldA = object->getRepr()->attribute("sodipodi:radius"); + object->getRepr()->setAttribute("inkscape:radius",oldA); + object->getRepr()->setAttribute("sodipodi:radius",NULL); sp_object_read_attr (object, "inkscape:radius"); } - if (object->repr->attribute("inkscape:original")) { + if (object->getRepr()->attribute("inkscape:original")) { sp_object_read_attr (object, "inkscape:original"); } else { - gchar const *oldA = object->repr->attribute("sodipodi:original"); - object->repr->setAttribute("inkscape:original",oldA); - object->repr->setAttribute("sodipodi:original",NULL); + gchar const *oldA = object->getRepr()->attribute("sodipodi:original"); + object->getRepr()->setAttribute("inkscape:original",oldA); + object->getRepr()->setAttribute("sodipodi:original",NULL); sp_object_read_attr (object, "inkscape:original"); } - if (object->repr->attribute("xlink:href")) { + if (object->getRepr()->attribute("xlink:href")) { sp_object_read_attr(object, "xlink:href"); } else { - gchar const *oldA = object->repr->attribute("inkscape:href"); + gchar const *oldA = object->getRepr()->attribute("inkscape:href"); if (oldA) { size_t lA = strlen(oldA); char *nA=(char*)malloc((1+lA+1)*sizeof(char)); memcpy(nA+1,oldA,lA*sizeof(char)); nA[0]='#'; nA[lA+1]=0; - object->repr->setAttribute("xlink:href",nA); + object->getRepr()->setAttribute("xlink:href",nA); free(nA); - object->repr->setAttribute("inkscape:href",NULL); + object->getRepr()->setAttribute("inkscape:href",NULL); } sp_object_read_attr (object, "xlink:href"); } @@ -454,7 +459,8 @@ sp_offset_set_shape(SPShape *shape) // just put the source shape as the offseted one, no one will notice // it's also useless to compute the offset with a 0 radius - const char *res_d = SP_OBJECT(shape)->repr->attribute("inkscape:original"); + //XML Tree being used directly here while it shouldn't be. + const char *res_d = SP_OBJECT(shape)->getRepr()->attribute("inkscape:original"); if ( res_d ) { Geom::PathVector pv = sp_svg_read_pathv(res_d); SPCurve *c = new SPCurve(pv); @@ -1145,7 +1151,8 @@ refresh_offset_source(SPOffset* offset) delete res; delete orig; - SP_OBJECT (offset)->repr->setAttribute("inkscape:original", res_d); + //XML Tree being used diectly here while it shouldn't be. + SP_OBJECT (offset)->getRepr()->setAttribute("inkscape:original", res_d); free (res_d); } diff --git a/src/sp-paint-server.cpp b/src/sp-paint-server.cpp index 5858f9a0e..fa2cc4fda 100644 --- a/src/sp-paint-server.cpp +++ b/src/sp-paint-server.cpp @@ -160,7 +160,9 @@ bool SPPaintServer::isSwatch() const bool swatch = false; if (SP_IS_GRADIENT(this)) { SPGradient *grad = SP_GRADIENT(this); - swatch = grad->hasStops() && repr->attribute("osb:paint"); + + //XML Tree being used directly here while it shouldn't be. + swatch = grad->hasStops() && getRepr()->attribute("osb:paint"); } return swatch; } @@ -171,7 +173,9 @@ bool SPPaintServer::isSolid() const if (SP_IS_GRADIENT(this)) { SPGradient *grad = SP_GRADIENT(this); if ( grad->hasStops() && (grad->getStopCount() == 0) ) { - gchar const * attr = repr->attribute("osb:paint"); + + //XML Tree being used directly here while it shouldn't be. + gchar const * attr = getRepr()->attribute("osb:paint"); if (attr && !strcmp(attr, "solid")) { solid = true; } diff --git a/src/sp-root.cpp b/src/sp-root.cpp index c032654ff..e73e83a7f 100644 --- a/src/sp-root.cpp +++ b/src/sp-root.cpp @@ -146,7 +146,8 @@ sp_root_build(SPObject *object, SPDocument *document, Inkscape::XML::Node *repr) SPGroup *group = (SPGroup *) object; SPRoot *root = (SPRoot *) object; - if ( !object->repr->attribute("version") ) { + //XML Tree being used directly here while it shouldn't be. + if ( !object->getRepr()->attribute("version") ) { repr->setAttribute("version", SVG_VERSION); } diff --git a/src/sp-string.cpp b/src/sp-string.cpp index 871338ad5..8cf8d3291 100644 --- a/src/sp-string.cpp +++ b/src/sp-string.cpp @@ -116,7 +116,9 @@ sp_string_read_content(SPObject *object) SPString *string = SP_STRING(object); string->string.clear(); - gchar const *xml_string = string->repr->content(); + + //XML Tree being used directly here while it shouldn't be. + gchar const *xml_string = string->getRepr()->content(); // see algorithms described in svg 1.1 section 10.15 if (object->xml_space.value == SP_XML_SPACE_PRESERVE) { for ( ; *xml_string ; xml_string = g_utf8_next_char(xml_string) ) { diff --git a/src/sp-style-elem.cpp b/src/sp-style-elem.cpp index 46c311920..bb4ccb2e1 100644 --- a/src/sp-style-elem.cpp +++ b/src/sp-style-elem.cpp @@ -317,7 +317,8 @@ sp_style_elem_read_content(SPObject *const object) * Dodji replies "right, that's *bug*"; just an unexpected oversight. */ - GString *const text = concat_children(*style_elem.repr); + //XML Tree being used directly here while it shouldn't be. + GString *const text = concat_children(*style_elem.getRepr()); CRParser *parser = cr_parser_new_from_buf(reinterpret_cast<guchar *>(text->str), text->len, CR_UTF_8, FALSE); diff --git a/src/sp-symbol.cpp b/src/sp-symbol.cpp index 41004db6e..0dab82bc9 100644 --- a/src/sp-symbol.cpp +++ b/src/sp-symbol.cpp @@ -393,8 +393,11 @@ sp_symbol_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::X repr = xml_doc->createElement("svg:symbol"); } - repr->setAttribute("viewBox", object->repr->attribute("viewBox")); - repr->setAttribute("preserveAspectRatio", object->repr->attribute("preserveAspectRatio")); + //XML Tree being used directly here while it shouldn't be. + repr->setAttribute("viewBox", object->getRepr()->attribute("viewBox")); + + //XML Tree being used directly here while it shouldn't be. + repr->setAttribute("preserveAspectRatio", object->getRepr()->attribute("preserveAspectRatio")); if (((SPObjectClass *) (parent_class))->write) ((SPObjectClass *) (parent_class))->write (object, xml_doc, repr, flags); diff --git a/src/sp-text.cpp b/src/sp-text.cpp index 7bdd84989..e3e919796 100644 --- a/src/sp-text.cpp +++ b/src/sp-text.cpp @@ -570,7 +570,7 @@ unsigned SPText::_buildLayoutInput(SPObject *root, Inkscape::Text::Layout::Optio Glib::ustring const &string = SP_STRING(child)->string; layout.appendText(string, root->style, child, &optional_attrs, child_attrs_offset + length); length += string.length(); - } else if (!sp_repr_is_meta_element(child->repr)) { + } /*XML Tree being directly used here while it shouldn't be.*/ else if (!sp_repr_is_meta_element(child->getRepr())) { length += _buildLayoutInput(child, optional_attrs, child_attrs_offset + length, in_textpath); } } diff --git a/src/splivarot.cpp b/src/splivarot.cpp index 5073382e5..d9ac792b3 100644 --- a/src/splivarot.cpp +++ b/src/splivarot.cpp @@ -1323,7 +1323,8 @@ sp_selected_path_create_offset_object(SPDesktop *desktop, int expand, bool updat item->doWriteTransform(SP_OBJECT_REPR(item), Geom::identity()); - style = g_strdup(SP_OBJECT(item)->repr->attribute("style")); + //XML Tree being used directly here while it shouldn't be... + style = g_strdup(SP_OBJECT(item)->getRepr()->attribute("style")); // remember the position of the item gint pos = SP_OBJECT_REPR(item)->position(); @@ -1451,7 +1452,9 @@ sp_selected_path_create_offset_object(SPDesktop *desktop, int expand, bool updat g_free(str); if ( updating ) { - char const *id = SP_OBJECT(item)->repr->attribute("id"); + + //XML Tree being used directly here while it shouldn't be + char const *id = SP_OBJECT(item)->getRepr()->attribute("id"); char const *uri = g_strdup_printf("#%s", id); repr->setAttribute("xlink:href", uri); g_free((void *) uri); diff --git a/src/style.cpp b/src/style.cpp index 2b5804671..13967ec0c 100644 --- a/src/style.cpp +++ b/src/style.cpp @@ -1019,7 +1019,9 @@ sp_style_merge_property(SPStyle *style, gint id, gchar const *val) * Fixes Bug #324849 */ g_warning("attribute 'clip-path' given as CSS"); - style->object->repr->setAttribute("clip-path", val); + + //XML Tree being directly used here. + style->object->getRepr()->setAttribute("clip-path", val); break; case SP_PROP_CLIP_RULE: g_warning("Unimplemented style property SP_PROP_CLIP_RULE: value: %s", val); @@ -1029,7 +1031,9 @@ sp_style_merge_property(SPStyle *style, gint id, gchar const *val) * See comment for SP_PROP_CLIP_PATH */ g_warning("attribute 'mask' given as CSS"); - style->object->repr->setAttribute("mask", val); + + //XML Tree being directly used here. + style->object->getRepr()->setAttribute("mask", val); break; case SP_PROP_OPACITY: if (!style->opacity.set) { @@ -1288,9 +1292,11 @@ sp_style_merge_from_object_stylesheet(SPStyle *const style, SPObject const *cons } CRPropList *props = NULL; + + //XML Tree being directly used here while it shouldn't be. CRStatus status = cr_sel_eng_get_matched_properties_from_cascade(sel_eng, object->document->style_cascade, - object->repr, + object->getRepr(), &props); g_return_if_fail(status == CR_OK); /// \todo Check what errors can occur, and handle them properly. diff --git a/src/text-editing.cpp b/src/text-editing.cpp index 2ed5270fd..a307e5e27 100644 --- a/src/text-editing.cpp +++ b/src/text-editing.cpp @@ -1497,7 +1497,8 @@ static bool tidy_operator_empty_spans(SPObject **item) the repeated strings will be merged by another operator. */ static bool tidy_operator_inexplicable_spans(SPObject **item) { - if (*item && sp_repr_is_meta_element((*item)->repr)) return false; + //XML Tree being directly used here while it shouldn't be. + if (*item && sp_repr_is_meta_element((*item)->getRepr())) return false; if (SP_IS_STRING(*item)) return false; if (is_line_break_object(*item)) return false; TextTagAttributes *attrs = attributes_for_object(*item); diff --git a/src/trace/trace.cpp b/src/trace/trace.cpp index e9bc48372..cff464e9f 100644 --- a/src/trace/trace.cpp +++ b/src/trace/trace.cpp @@ -482,7 +482,8 @@ void Tracer::traceThread() } //### Get pointers to the <image> and its parent - Inkscape::XML::Node *imgRepr = SP_OBJECT(img)->repr; + //XML Tree being used directly here while it shouldn't be. + Inkscape::XML::Node *imgRepr = SP_OBJECT(img)->getRepr(); Inkscape::XML::Node *par = sp_repr_parent(imgRepr); //### Get some information for the new transform() diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index 2fe353533..4e1ddda2e 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -522,7 +522,9 @@ void DocumentProperties::removeSelectedProfile(){ SPObject* obj = SP_OBJECT(current->data); Inkscape::ColorProfile* prof = reinterpret_cast<Inkscape::ColorProfile*>(obj); if (!name.compare(prof->name)){ - sp_repr_unparent(obj->repr); + + //XML Tree being used directly here while it shouldn't be. + sp_repr_unparent(obj->getRepr()); SPDocumentUndo::done(SP_ACTIVE_DOCUMENT, SP_VERB_EDIT_REMOVE_COLOR_PROFILE, _("Remove linked color profile")); } current = g_slist_next(current); @@ -691,7 +693,9 @@ void DocumentProperties::removeExternalScript(){ SPObject* obj = SP_OBJECT(current->data); SPScript* script = (SPScript*) obj; if (name == script->xlinkhref){ - sp_repr_unparent(obj->repr); + + //XML Tree being used directly here while it shouldn't be. + sp_repr_unparent(obj->getRepr()); SPDocumentUndo::done(SP_ACTIVE_DOCUMENT, SP_VERB_EDIT_REMOVE_EXTERNAL_SCRIPT, _("Remove external script")); } current = g_slist_next(current); diff --git a/src/ui/dialog/filter-effects-dialog.cpp b/src/ui/dialog/filter-effects-dialog.cpp index 3a80c4ba8..07b8a4159 100644 --- a/src/ui/dialog/filter-effects-dialog.cpp +++ b/src/ui/dialog/filter-effects-dialog.cpp @@ -1023,12 +1023,14 @@ private: !(ls == 1 && SP_IS_FEPOINTLIGHT(child)) && !(ls == 2 && SP_IS_FESPOTLIGHT(child))) { if(child) - sp_repr_unparent(child->repr); + //XML Tree being used directly here while it shouldn't be. + sp_repr_unparent(child->getRepr()); if(ls != -1) { Inkscape::XML::Document *xml_doc = sp_document_repr_doc(prim->document); - Inkscape::XML::Node *repr = xml_doc->createElement(_light_source.get_active_data()->key.c_str()); - prim->repr->appendChild(repr); + Inkscape::XML::Node *repr = xml_doc->createElement(_light_source.get_active_data()->key.c_str()); + //XML Tree being used directly here while it shouldn't be. + prim->getRepr()->appendChild(repr); Inkscape::GC::release(repr); } @@ -1336,7 +1338,9 @@ void FilterEffectsDialog::FilterModifier::remove_filter() if(filter) { SPDocument* doc = filter->document; - sp_repr_unparent(filter->repr); + + //XML Tree being used directly here while it shouldn't be. + sp_repr_unparent(filter->getRepr()); SPDocumentUndo::done(doc, SP_VERB_DIALOG_FILTER_EFFECTS, _("Remove filter")); @@ -1488,7 +1492,9 @@ void FilterEffectsDialog::PrimitiveList::update() if(prim) { Gtk::TreeModel::Row row = *_model->append(); row[_columns.primitive] = prim; - row[_columns.type_id] = FPConverter.get_id_from_key(prim->repr->name()); + + //XML Tree being used directly here while it shouldn't be. + row[_columns.type_id] = FPConverter.get_id_from_key(prim->getRepr()->name()); row[_columns.type] = _(FPConverter.get_label(row[_columns.type_id]).c_str()); row[_columns.id] = prim->getId(); @@ -1541,7 +1547,8 @@ void FilterEffectsDialog::PrimitiveList::remove_selected() if(prim) { _observer->set(0); - sp_repr_unparent(prim->repr); + //XML Tree being used directly here while it shouldn't be. + sp_repr_unparent(prim->getRepr()); SPDocumentUndo::done(sp_desktop_document(_dialog.getDesktop()), SP_VERB_DIALOG_FILTER_EFFECTS, _("Remove filter primitive")); @@ -1914,7 +1921,9 @@ bool FilterEffectsDialog::PrimitiveList::on_button_release_event(GdkEventButton* if(c == _in_drag && SP_IS_FEMERGENODE(o)) { // If input is null, delete it if(!in_val) { - sp_repr_unparent(o->repr); + + //XML Tree being used directly here while it shouldn't be. + sp_repr_unparent(o->getRepr()); SPDocumentUndo::done(prim->document, SP_VERB_DIALOG_FILTER_EFFECTS, _("Remove merge node")); (*get_selection()->get_selected())[_columns.primitive] = prim; @@ -1929,7 +1938,9 @@ bool FilterEffectsDialog::PrimitiveList::on_button_release_event(GdkEventButton* Inkscape::XML::Document *xml_doc = sp_document_repr_doc(prim->document); Inkscape::XML::Node *repr = xml_doc->createElement("svg:feMergeNode"); repr->setAttribute("inkscape:collect", "always"); - prim->repr->appendChild(repr); + + //XML Tree being used directly here while it shouldn't be. + prim->getRepr()->appendChild(repr); SPFeMergeNode *node = SP_FEMERGENODE(prim->document->getObjectByRepr(repr)); Inkscape::GC::release(repr); _dialog.set_attr(node, SP_ATTR_IN, in_val); @@ -2467,7 +2478,9 @@ void FilterEffectsDialog::update_settings_view() SPFilterPrimitive* prim = _primitive_list.get_selected(); if(prim) { - _settings->show_and_update(FPConverter.get_id_from_key(prim->repr->name()), prim); + + //XML Tree being used directly here while it shouldn't be. + _settings->show_and_update(FPConverter.get_id_from_key(prim->getRepr()->name()), prim); _empty_settings.hide(); } diff --git a/src/ui/dialog/svg-fonts-dialog.cpp b/src/ui/dialog/svg-fonts-dialog.cpp index 7c6ced5aa..9f9f91bd1 100644 --- a/src/ui/dialog/svg-fonts-dialog.cpp +++ b/src/ui/dialog/svg-fonts-dialog.cpp @@ -170,7 +170,9 @@ void SvgFontsDialog::on_kerning_value_changed(){ undokey += this->kerning_pair->u2->attribute_string(); //slider values increase from right to left so that they match the kerning pair preview - this->kerning_pair->repr->setAttribute("k", Glib::Ascii::dtostr(get_selected_spfont()->horiz_adv_x - kerning_slider.get_value()).c_str()); + + //XML Tree being directly used here while it shouldn't be. + this->kerning_pair->getRepr()->setAttribute("k", Glib::Ascii::dtostr(get_selected_spfont()->horiz_adv_x - kerning_slider.get_value()).c_str()); SPDocumentUndo::maybe_done(document, undokey.c_str(), SP_VERB_DIALOG_SVG_FONTS, _("Adjust kerning value")); //populate_kerning_pairs_box(); @@ -505,7 +507,8 @@ void SvgFontsDialog::set_glyph_description_from_selected_path(){ msgStack->flash(Inkscape::ERROR_MESSAGE, msg); return; } - glyph->repr->setAttribute("d", (char*) sp_svg_write_path (pathv)); + //XML Tree being directly used here while it shouldn't be. + glyph->getRepr()->setAttribute("d", (char*) sp_svg_write_path (pathv)); SPDocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Set glyph curves")); update_glyphs(); @@ -547,7 +550,9 @@ void SvgFontsDialog::missing_glyph_description_from_selected_path(){ SPObject* obj; for (obj = get_selected_spfont()->children; obj; obj=obj->next){ if (SP_IS_MISSING_GLYPH(obj)){ - obj->repr->setAttribute("d", (char*) sp_svg_write_path (pathv)); + + //XML Tree being directly used here while it shouldn't be. + obj->getRepr()->setAttribute("d", (char*) sp_svg_write_path (pathv)); SPDocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Set glyph curves")); } } @@ -566,7 +571,8 @@ void SvgFontsDialog::reset_missing_glyph_description(){ SPObject* obj; for (obj = get_selected_spfont()->children; obj; obj=obj->next){ if (SP_IS_MISSING_GLYPH(obj)){ - obj->repr->setAttribute("d", (char*) "M0,0h1000v1024h-1000z"); + //XML Tree being directly used here while it shouldn't be. + obj->getRepr()->setAttribute("d", (char*) "M0,0h1000v1024h-1000z"); SPDocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Reset missing-glyph")); } } @@ -579,7 +585,8 @@ void SvgFontsDialog::glyph_name_edit(const Glib::ustring&, const Glib::ustring& if (!i) return; SPGlyph* glyph = (*i)[_GlyphsListColumns.glyph_node]; - glyph->repr->setAttribute("glyph-name", str.c_str()); + //XML Tree being directly used here while it shouldn't be. + glyph->getRepr()->setAttribute("glyph-name", str.c_str()); SPDocument* doc = sp_desktop_document(this->getDesktop()); SPDocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Edit glyph name")); @@ -592,7 +599,8 @@ void SvgFontsDialog::glyph_unicode_edit(const Glib::ustring&, const Glib::ustrin if (!i) return; SPGlyph* glyph = (*i)[_GlyphsListColumns.glyph_node]; - glyph->repr->setAttribute("unicode", str.c_str()); + //XML Tree being directly used here while it shouldn't be. + glyph->getRepr()->setAttribute("unicode", str.c_str()); SPDocument* doc = sp_desktop_document(this->getDesktop()); SPDocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Set glyph unicode")); @@ -603,7 +611,8 @@ void SvgFontsDialog::glyph_unicode_edit(const Glib::ustring&, const Glib::ustrin void SvgFontsDialog::remove_selected_font(){ SPFont* font = get_selected_spfont(); - sp_repr_unparent(font->repr); + //XML Tree being directly used here while it shouldn't be. + sp_repr_unparent(font->getRepr()); SPDocument* doc = sp_desktop_document(this->getDesktop()); SPDocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Remove font")); @@ -617,7 +626,9 @@ void SvgFontsDialog::remove_selected_glyph(){ if(!i) return; SPGlyph* glyph = (*i)[_GlyphsListColumns.glyph_node]; - sp_repr_unparent(glyph->repr); + + //XML Tree being directly used here while it shouldn't be. + sp_repr_unparent(glyph->getRepr()); SPDocument* doc = sp_desktop_document(this->getDesktop()); SPDocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Remove glyph")); @@ -632,7 +643,9 @@ void SvgFontsDialog::remove_selected_kerning_pair(){ if(!i) return; SPGlyphKerning* pair = (*i)[_KerningPairsListColumns.spnode]; - sp_repr_unparent(pair->repr); + + //XML Tree being directly used here while it shouldn't be. + sp_repr_unparent(pair->getRepr()); SPDocument* doc = sp_desktop_document(this->getDesktop()); SPDocumentUndo::done(doc, SP_VERB_DIALOG_SVG_FONTS, _("Remove kerning pair")); @@ -812,7 +825,8 @@ void set_font_family(SPFont* font, char* str){ SPObject* obj; for (obj=font->children; obj; obj=obj->next){ if (SP_IS_FONTFACE(obj)){ - obj->repr->setAttribute("font-family", str); + //XML Tree being directly used here while it shouldn't be. + obj->getRepr()->setAttribute("font-family", str); } } @@ -832,7 +846,8 @@ void SvgFontsDialog::add_font(){ SPObject* obj; for (obj=font->children; obj; obj=obj->next){ if (SP_IS_FONTFACE(obj)){ - obj->repr->setAttribute("font-family", os2.str().c_str()); + //XML Tree being directly used here while it shouldn't be. + obj->getRepr()->setAttribute("font-family", os2.str().c_str()); } } diff --git a/src/ui/dialog/swatches.cpp b/src/ui/dialog/swatches.cpp index 62682d623..6cef5bedd 100644 --- a/src/ui/dialog/swatches.cpp +++ b/src/ui/dialog/swatches.cpp @@ -182,7 +182,8 @@ void SwatchesPanelHook::convertGradient( GtkMenuItem * /*menuitem*/, gpointer us for (const GSList *item = gradients; item; item = item->next) { SPGradient* grad = SP_GRADIENT(item->data); if ( targetName == grad->getId() ) { - grad->repr->setAttribute("osb:paint", "solid"); // TODO make conditional + //XML Tree being used directly here while it shouldn't be + grad->getRepr()->setAttribute("osb:paint", "solid"); // TODO make conditional SPDocumentUndo::done(doc, SP_VERB_CONTEXT_GRADIENT, _("Add gradient stop")); @@ -948,7 +949,8 @@ void SwatchesPanel::_updateFromSelection() } } if ( target ) { - gchar const* id = target->repr->attribute("id"); + //XML Tree being used directly here while it shouldn't be + gchar const* id = target->getRepr()->attribute("id"); if ( id ) { fillId = id; } @@ -979,7 +981,9 @@ void SwatchesPanel::_updateFromSelection() } } if ( target ) { - gchar const* id = target->repr->attribute("id"); + + //XML Tree being used directly here while it shouldn't be + gchar const* id = target->getRepr()->attribute("id"); if ( id ) { strokeId = id; } diff --git a/src/ui/tool/node-tool.cpp b/src/ui/tool/node-tool.cpp index d10f46313..0b6d2168f 100644 --- a/src/ui/tool/node-tool.cpp +++ b/src/ui/tool/node-tool.cpp @@ -359,7 +359,8 @@ void gather_items(InkNodeTool *nt, SPItem *base, SPObject *obj, Inkscape::UI::Sh using namespace Inkscape::UI; if (!obj) return; - if (SP_IS_PATH(obj) && obj->repr->attribute("inkscape:original-d") != NULL) { + //XML Tree being used directly here while it shouldn't be. + if (SP_IS_PATH(obj) && obj->getRepr()->attribute("inkscape:original-d") != NULL) { ShapeRecord r; r.item = static_cast<SPItem*>(obj); r.edit_transform = Geom::identity(); // TODO wrong? @@ -408,8 +409,10 @@ void ink_node_tool_selection_changed(InkNodeTool *nt, Inkscape::Selection *sel) bool something_set = false; for (std::set<ShapeRecord>::iterator i = shapes.begin(); i != shapes.end(); ++i) { ShapeRecord const &r = *i; + + //XML Tree being used directly here while it shouldn't be. if (SP_IS_SHAPE(r.item) || - (SP_IS_PATH(r.item) && r.item->repr->attribute("inkscape:original-d") != NULL)) + (SP_IS_PATH(r.item) && r.item->getRepr()->attribute("inkscape:original-d") != NULL)) { nt->shape_editor->set_item(r.item, SH_KNOTHOLDER); something_set = true; diff --git a/src/ui/tool/path-manipulator.cpp b/src/ui/tool/path-manipulator.cpp index dec37cd1c..ba82b810b 100644 --- a/src/ui/tool/path-manipulator.cpp +++ b/src/ui/tool/path-manipulator.cpp @@ -108,7 +108,7 @@ PathManipulator::PathManipulator(MultiPathManipulator &mpm, SPPath *path, , _path(path) , _spcurve(new SPCurve()) , _dragpoint(new CurveDragPoint(*this)) - , _observer(new PathManipulatorObserver(this, SP_OBJECT(path)->repr)) + , /* XML Tree being used here directly while it shouldn't be*/_observer(new PathManipulatorObserver(this, SP_OBJECT(path)->getRepr())) , _edit_transform(et) , _num_selected(0) , _show_handles(true) @@ -1069,7 +1069,9 @@ void PathManipulator::_createControlPointsFromGeometry() // so that pickBestType works correctly // TODO maybe migrate to inkscape:node-types? // TODO move this into SPPath - do not manipulate directly - gchar const *nts_raw = _path ? _path->repr->attribute(_nodetypesKey().data()) : 0; + + //XML Tree being used here directly while it shouldn't be. + gchar const *nts_raw = _path ? _path->getRepr()->attribute(_nodetypesKey().data()) : 0; std::string nodetype_string = nts_raw ? nts_raw : ""; /* Calculate the needed length of the nodetype string. * For closed paths, the entry is duplicated for the starting node, @@ -1244,7 +1246,8 @@ void PathManipulator::_setGeometry() LIVEPATHEFFECT(_path)->requestModified(SP_OBJECT_MODIFIED_FLAG); } } else { - if (_path->repr->attribute("inkscape:original-d")) + //XML Tree being used here directly while it shouldn't be. + if (_path->getRepr()->attribute("inkscape:original-d")) sp_path_set_original_curve(_path, _spcurve, false, false); else sp_shape_set_curve(SP_SHAPE(_path), _spcurve, false); @@ -1262,8 +1265,10 @@ Glib::ustring PathManipulator::_nodetypesKey() * This method is wrong but necessary at the moment. */ Inkscape::XML::Node *PathManipulator::_getXMLNode() { - if (_lpe_key.empty()) return _path->repr; - return LIVEPATHEFFECT(_path)->repr; + //XML Tree being used here directly while it shouldn't be. + if (_lpe_key.empty()) return _path->getRepr(); + //XML Tree being used here directly while it shouldn't be. + return LIVEPATHEFFECT(_path)->getRepr(); } bool PathManipulator::_nodeClicked(Node *n, GdkEventButton *event) diff --git a/src/verbs.cpp b/src/verbs.cpp index 300fe7494..5c35c1e51 100644 --- a/src/verbs.cpp +++ b/src/verbs.cpp @@ -1207,7 +1207,8 @@ LayerVerb::perform(SPAction *action, void *data, void */*pdata*/) sp_edit_select_all(dt); #else // Copies everything, regardless of locks, visibility, sublayers. - Inkscape::XML::Node *selected = dt->currentLayer()->repr; + //XML Tree being directly used here while it shouldn't be. + Inkscape::XML::Node *selected = dt->currentLayer()->getRepr(); Inkscape::XML::Node *parent = sp_repr_parent(selected); Inkscape::XML::Node *dup = selected->duplicate(parent->document()); parent->addChild(dup, selected); diff --git a/src/xml/helper-observer.cpp b/src/xml/helper-observer.cpp index 620a88d8c..976a8a7ec 100644 --- a/src/xml/helper-observer.cpp +++ b/src/xml/helper-observer.cpp @@ -11,10 +11,12 @@ SignalObserver::SignalObserver() // Add this observer to the SPObject and remove it from any previous object void SignalObserver::set(SPObject* o) { - if(_oldsel && _oldsel->repr) - _oldsel->repr->removeObserver(*this); - if(o && o->repr) - o->repr->addObserver(*this); + /* XML Tree being used direcly in this function in the following code + while it shouldn't be */ + if(_oldsel && _oldsel->getRepr()) + _oldsel->getRepr()->removeObserver(*this); + if(o && o->getRepr()) + o->getRepr()->addObserver(*this); _oldsel = o; } |
