diff options
| author | Abhishek Sharma Public <spyzerdotabhishek0at-signgmaildotcom> | 2010-07-06 07:22:32 +0000 |
|---|---|---|
| committer | Abhishek Sharma Public <spyzerdotabhishek0at-signgmaildotcom> | 2010-07-06 07:22:32 +0000 |
| commit | 1aaf9a0ee3da28012bf43cfa61e2e5fa933edd2e (patch) | |
| tree | 1db3869074d0bfc803c4ec12516d2a557347c676 /src/ui | |
| parent | another c++ification for sp-object.h/cpp and still in progress... (diff) | |
| download | inkscape-1aaf9a0ee3da28012bf43cfa61e2e5fa933edd2e.tar.gz inkscape-1aaf9a0ee3da28012bf43cfa61e2e5fa933edd2e.zip | |
C++ification of SPObject continued along with the onset of XML Privatisation. Users may checkout [grep -Ir XML Tree *] in the source code and all the places where the XML node/Tree is being used shall be reflected.
(bzr r9546.1.5)
Diffstat (limited to 'src/ui')
| -rw-r--r-- | src/ui/dialog/document-properties.cpp | 8 | ||||
| -rw-r--r-- | src/ui/dialog/filter-effects-dialog.cpp | 31 | ||||
| -rw-r--r-- | src/ui/dialog/svg-fonts-dialog.cpp | 37 | ||||
| -rw-r--r-- | src/ui/dialog/swatches.cpp | 10 | ||||
| -rw-r--r-- | src/ui/tool/node-tool.cpp | 7 | ||||
| -rw-r--r-- | src/ui/tool/path-manipulator.cpp | 15 |
6 files changed, 76 insertions, 32 deletions
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) |
