diff options
| author | Jon A. Cruz <jon@joncruz.org> | 2011-02-22 09:17:44 +0000 |
|---|---|---|
| committer | Jon A. Cruz <jon@joncruz.org> | 2011-02-22 09:17:44 +0000 |
| commit | 0e0ce7571944e0a9d60294b6efdc855e6df52db8 (patch) | |
| tree | 3cd452f4abfb51a8f4ffbbb08d001f651ff65d29 /src/ui/dialog | |
| parent | Finished cleanup of outdated SP_OBJECT_STYLE C macro. (diff) | |
| download | inkscape-0e0ce7571944e0a9d60294b6efdc855e6df52db8.tar.gz inkscape-0e0ce7571944e0a9d60294b6efdc855e6df52db8.zip | |
Finished cleanup of outdated SP_OBJECT_REPR C macro.
(bzr r10067)
Diffstat (limited to 'src/ui/dialog')
| -rw-r--r-- | src/ui/dialog/document-metadata.cpp | 10 | ||||
| -rw-r--r-- | src/ui/dialog/document-properties.cpp | 28 | ||||
| -rw-r--r-- | src/ui/dialog/find.cpp | 75 | ||||
| -rw-r--r-- | src/ui/dialog/svg-fonts-dialog.cpp | 8 | ||||
| -rw-r--r-- | src/ui/dialog/tile.cpp | 2 |
5 files changed, 73 insertions, 50 deletions
diff --git a/src/ui/dialog/document-metadata.cpp b/src/ui/dialog/document-metadata.cpp index a8a0fa191..08479275b 100644 --- a/src/ui/dialog/document-metadata.cpp +++ b/src/ui/dialog/document-metadata.cpp @@ -85,7 +85,7 @@ DocumentMetadata::init() { update(); - Inkscape::XML::Node *repr = SP_OBJECT_REPR(sp_desktop_namedview(getDesktop())); + Inkscape::XML::Node *repr = sp_desktop_namedview(getDesktop())->getRepr(); repr->addListener (&_repr_events, this); show_all_children(); @@ -93,7 +93,7 @@ DocumentMetadata::init() DocumentMetadata::~DocumentMetadata() { - Inkscape::XML::Node *repr = SP_OBJECT_REPR(sp_desktop_namedview(getDesktop())); + Inkscape::XML::Node *repr = sp_desktop_namedview(getDesktop())->getRepr(); repr->removeListenerByData (this); for (RDElist::iterator it = _rdflist.begin(); it != _rdflist.end(); it++) @@ -211,7 +211,7 @@ DocumentMetadata::update() void DocumentMetadata::_handleDocumentReplaced(SPDesktop* desktop, SPDocument *) { - Inkscape::XML::Node *repr = SP_OBJECT_REPR(sp_desktop_namedview(desktop)); + Inkscape::XML::Node *repr = sp_desktop_namedview(desktop)->getRepr(); repr->addListener (&_repr_events, this); update(); } @@ -219,7 +219,7 @@ DocumentMetadata::_handleDocumentReplaced(SPDesktop* desktop, SPDocument *) void DocumentMetadata::_handleActivateDesktop(Inkscape::Application *, SPDesktop *desktop) { - Inkscape::XML::Node *repr = SP_OBJECT_REPR(sp_desktop_namedview(desktop)); + Inkscape::XML::Node *repr = sp_desktop_namedview(desktop)->getRepr(); repr->addListener(&_repr_events, this); update(); } @@ -227,7 +227,7 @@ DocumentMetadata::_handleActivateDesktop(Inkscape::Application *, SPDesktop *des void DocumentMetadata::_handleDeactivateDesktop(Inkscape::Application *, SPDesktop *desktop) { - Inkscape::XML::Node *repr = SP_OBJECT_REPR(sp_desktop_namedview(desktop)); + Inkscape::XML::Node *repr = sp_desktop_namedview(desktop)->getRepr(); repr->removeListenerByData(this); } diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index 16212bef7..0c001da4b 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -143,9 +143,9 @@ DocumentProperties::init() { update(); - Inkscape::XML::Node *repr = SP_OBJECT_REPR(sp_desktop_namedview(getDesktop())); + Inkscape::XML::Node *repr = sp_desktop_namedview(getDesktop())->getRepr(); repr->addListener (&_repr_events, this); - Inkscape::XML::Node *root = SP_OBJECT_REPR(sp_desktop_document(getDesktop())->root); + Inkscape::XML::Node *root = sp_desktop_document(getDesktop())->root->getRepr(); root->addListener (&_repr_events, this); show_all_children(); @@ -154,9 +154,9 @@ DocumentProperties::init() DocumentProperties::~DocumentProperties() { - Inkscape::XML::Node *repr = SP_OBJECT_REPR(sp_desktop_namedview(getDesktop())); + Inkscape::XML::Node *repr = sp_desktop_namedview(getDesktop())->getRepr(); repr->removeListenerByData (this); - Inkscape::XML::Node *root = SP_OBJECT_REPR(sp_desktop_document(getDesktop())->root); + Inkscape::XML::Node *root = sp_desktop_document(getDesktop())->root->getRepr(); root->removeListenerByData (this); } @@ -439,7 +439,9 @@ DocumentProperties::populate_linked_profiles_box() { _LinkedProfilesListStore->clear(); const GSList *current = SP_ACTIVE_DOCUMENT->getResourceList( "iccprofile" ); - if (current) _emb_profiles_observer.set(SP_OBJECT(current->data)->parent); + if (current) { + _emb_profiles_observer.set(SP_OBJECT(current->data)->parent); + } while ( current ) { SPObject* obj = SP_OBJECT(current->data); Inkscape::ColorProfile* prof = reinterpret_cast<Inkscape::ColorProfile*>(obj); @@ -807,7 +809,7 @@ DocumentProperties::update() double const doc_w_px = sp_desktop_document(dt)->getWidth(); double const doc_h_px = sp_desktop_document(dt)->getHeight(); _page_sizer.setDim (doc_w_px, doc_h_px); - _page_sizer.updateFitMarginsUI(SP_OBJECT_REPR(nv)); + _page_sizer.updateFitMarginsUI(nv->getRepr()); //-----------------------------------------------------------guide page @@ -873,9 +875,9 @@ DocumentProperties::on_response (int id) void DocumentProperties::_handleDocumentReplaced(SPDesktop* desktop, SPDocument *document) { - Inkscape::XML::Node *repr = SP_OBJECT_REPR(sp_desktop_namedview(desktop)); + Inkscape::XML::Node *repr = sp_desktop_namedview(desktop)->getRepr(); repr->addListener(&_repr_events, this); - Inkscape::XML::Node *root = SP_OBJECT_REPR(document->root); + Inkscape::XML::Node *root = document->root->getRepr(); root->addListener(&_repr_events, this); update(); } @@ -883,9 +885,9 @@ DocumentProperties::_handleDocumentReplaced(SPDesktop* desktop, SPDocument *docu void DocumentProperties::_handleActivateDesktop(Inkscape::Application *, SPDesktop *desktop) { - Inkscape::XML::Node *repr = SP_OBJECT_REPR(sp_desktop_namedview(desktop)); + Inkscape::XML::Node *repr = sp_desktop_namedview(desktop)->getRepr(); repr->addListener(&_repr_events, this); - Inkscape::XML::Node *root = SP_OBJECT_REPR(sp_desktop_document(desktop)->root); + Inkscape::XML::Node *root = sp_desktop_document(desktop)->root->getRepr(); root->addListener(&_repr_events, this); update(); } @@ -893,9 +895,9 @@ DocumentProperties::_handleActivateDesktop(Inkscape::Application *, SPDesktop *d void DocumentProperties::_handleDeactivateDesktop(Inkscape::Application *, SPDesktop *desktop) { - Inkscape::XML::Node *repr = SP_OBJECT_REPR(sp_desktop_namedview(desktop)); + Inkscape::XML::Node *repr = sp_desktop_namedview(desktop)->getRepr(); repr->removeListenerByData(this); - Inkscape::XML::Node *root = SP_OBJECT_REPR(sp_desktop_document(desktop)->root); + Inkscape::XML::Node *root = sp_desktop_document(desktop)->root->getRepr(); root->removeListenerByData(this); } @@ -934,7 +936,7 @@ void DocumentProperties::onNewGrid() { SPDesktop *dt = getDesktop(); - Inkscape::XML::Node *repr = SP_OBJECT_REPR(sp_desktop_namedview(dt)); + Inkscape::XML::Node *repr = sp_desktop_namedview(dt)->getRepr(); SPDocument *doc = sp_desktop_document(dt); Glib::ustring typestring = _grids_combo_gridtype.get_active_text(); diff --git a/src/ui/dialog/find.cpp b/src/ui/dialog/find.cpp index b6d6a0319..bdae14c62 100644 --- a/src/ui/dialog/find.cpp +++ b/src/ui/dialog/find.cpp @@ -142,15 +142,18 @@ Find::~Find() bool Find::item_id_match (SPItem *item, const gchar *id, bool exact) { - if (SP_OBJECT_REPR (item) == NULL) + if (item->getRepr() == NULL) { return false; + } - if (SP_IS_STRING(item)) // SPStrings have "on demand" ids which are useless for searching + if (SP_IS_STRING(item)) { // SPStrings have "on demand" ids which are useless for searching return false; + } - const gchar *item_id = (SP_OBJECT_REPR (item))->attribute("id"); - if (item_id == NULL) + const gchar *item_id = item->getRepr()->attribute("id"); + if (item_id == NULL) { return false; + } if (exact) { return ((bool) !strcmp(item_id, id)); @@ -163,8 +166,9 @@ Find::item_id_match (SPItem *item, const gchar *id, bool exact) bool Find::item_text_match (SPItem *item, const gchar *text, bool exact) { - if (SP_OBJECT_REPR (item) == NULL) + if (item->getRepr() == NULL) { return false; + } if (SP_IS_TEXT(item) || SP_IS_FLOWTEXT(item)) { const gchar *item_text = sp_te_get_string_multiline (item); @@ -186,12 +190,14 @@ Find::item_text_match (SPItem *item, const gchar *text, bool exact) bool Find::item_style_match (SPItem *item, const gchar *text, bool exact) { - if (SP_OBJECT_REPR (item) == NULL) + if (item->getRepr() == NULL) { return false; + } - const gchar *item_text = (SP_OBJECT_REPR (item))->attribute("style"); - if (item_text == NULL) + const gchar *item_text = item->getRepr()->attribute("style"); + if (item_text == NULL) { return false; + } if (exact) { return ((bool) !strcmp(item_text, text)); @@ -200,18 +206,18 @@ Find::item_style_match (SPItem *item, const gchar *text, bool exact) } } -bool -Find::item_attr_match (SPItem *item, const gchar *name, bool exact) +bool Find::item_attr_match(SPItem *item, const gchar *name, bool exact) { - if (SP_OBJECT_REPR (item) == NULL) - return false; - - if (exact) { - const gchar *attr_value = (SP_OBJECT_REPR (item))->attribute(name); - return ((bool) (attr_value != NULL)); - } else { - return SP_OBJECT_REPR (item)->matchAttributeName(name); + bool result = false; + if (item->getRepr()) { + if (exact) { + const gchar *attr_value = item->getRepr()->attribute(name); + result = (attr_value != NULL); + } else { + result = item->getRepr()->matchAttributeName(name); + } } + return result; } @@ -342,17 +348,20 @@ Find::all_items (SPObject *r, GSList *l, bool hidden, bool locked) { SPDesktop *desktop = getDesktop(); - if (SP_IS_DEFS(r)) + if (SP_IS_DEFS(r)) { return l; // we're not interested in items in defs + } - if (!strcmp (SP_OBJECT_REPR (r)->name(), "svg:metadata")) + if (!strcmp(r->getRepr()->name(), "svg:metadata")) { return l; // we're not interested in metadata + } for (SPObject *child = r->firstChild(); child; child = child->getNext()) { - 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); - } + if (SP_IS_ITEM(child) && !child->cloned && !desktop->isLayer(SP_ITEM(child))) { + SPItem *item = reinterpret_cast<SPItem *>(child); + if ((hidden || !desktop->itemIsHidden(item)) && (locked || !item->isLocked())) { + l = g_slist_prepend (l, child); + } } l = all_items (child, l, hidden, locked); } @@ -365,9 +374,10 @@ Find::all_selection_items (Inkscape::Selection *s, GSList *l, SPObject *ancestor SPDesktop *desktop = getDesktop(); for (GSList *i = (GSList *) s->itemList(); i != NULL; i = i->next) { - if (SP_IS_ITEM (i->data) && !SP_OBJECT_IS_CLONED (i->data) && !desktop->isLayer(SP_ITEM(i->data))) { - if (!ancestor || ancestor->isAncestorOf(SP_OBJECT (i->data))) { - if ((hidden || !desktop->itemIsHidden(SP_ITEM(i->data))) && (locked || !SP_ITEM(i->data)->isLocked())) { + if (SP_IS_ITEM (i->data) && !reinterpret_cast<SPItem *>(i->data)->cloned && !desktop->isLayer(SP_ITEM(i->data))) { + SPItem *item = reinterpret_cast<SPItem *>(i->data); + if (!ancestor || ancestor->isAncestorOf(item)) { + if ((hidden || !desktop->itemIsHidden(item)) && (locked || !item->isLocked())) { l = g_slist_prepend (l, i->data); } } @@ -524,3 +534,14 @@ Find::squeeze_window() } // namespace UI } // namespace Inkscape + +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) + indent-tabs-mode:nil + fill-column:99 + End: +*/ +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 : diff --git a/src/ui/dialog/svg-fonts-dialog.cpp b/src/ui/dialog/svg-fonts-dialog.cpp index a7f914327..2d1b5ae39 100644 --- a/src/ui/dialog/svg-fonts-dialog.cpp +++ b/src/ui/dialog/svg-fonts-dialog.cpp @@ -114,7 +114,7 @@ void SvgFontsDialog::AttrEntry::on_attr_changed(){ const gchar* name = (const gchar*)sp_attribute_name(this->attr); if(name && o) { - SP_OBJECT_REPR(o)->setAttribute((const gchar*) name, this->entry.get_text().c_str()); + o->getRepr()->setAttribute((const gchar*) name, this->entry.get_text().c_str()); o->parent->requestModified(SP_OBJECT_MODIFIED_FLAG); Glib::ustring undokey = "svgfonts:"; @@ -438,7 +438,7 @@ SPGlyph *new_glyph(SPDocument* document, SPFont *font, const int count) repr->setAttribute("glyph-name", os.str().c_str()); // Append the new glyph node to the current font - SP_OBJECT_REPR(font)->appendChild(repr); + font->getRepr()->appendChild(repr); Inkscape::GC::release(repr); // get corresponding object @@ -732,7 +732,7 @@ void SvgFontsDialog::add_kerning_pair(){ repr->setAttribute("k", "0"); // Append the new hkern node to the current font - SP_OBJECT_REPR(get_selected_spfont())->appendChild(repr); + get_selected_spfont()->getRepr()->appendChild(repr); Inkscape::GC::release(repr); // get corresponding object @@ -797,7 +797,7 @@ SPFont *new_font(SPDocument *document) repr->setAttribute("horiz-adv-x", "1024"); // Append the new font node to defs - SP_OBJECT_REPR(defs)->appendChild(repr); + defs->getRepr()->appendChild(repr); //create a missing glyph Inkscape::XML::Node *fontface; diff --git a/src/ui/dialog/tile.cpp b/src/ui/dialog/tile.cpp index 8ae81d528..b0a39bd0e 100644 --- a/src/ui/dialog/tile.cpp +++ b/src/ui/dialog/tile.cpp @@ -316,7 +316,7 @@ g_print("\n row = %f col = %f selection x= %f selection y = %f", total_row_h for (; current_row != NULL; current_row = current_row->next) { SPItem *item=SP_ITEM(current_row->data); - Inkscape::XML::Node *repr = SP_OBJECT_REPR(item); + Inkscape::XML::Node *repr = item->getRepr(); Geom::OptRect b = item->getBounds(item->i2doc_affine()); Geom::Point min; if (b) { |
