diff options
| author | Krzysztof Kosi??ski <tweenk.pl@gmail.com> | 2011-04-07 23:42:04 +0000 |
|---|---|---|
| committer | Krzysztof KosiĆski <tweenk.pl@gmail.com> | 2011-04-07 23:42:04 +0000 |
| commit | 945ce419c806c73d70203dec33ececafbe108a92 (patch) | |
| tree | cfcdb59bf47e9db7f9e01f7eebb59924bdeaea94 /src/dialogs/find.cpp | |
| parent | Merge from trunk (again) (diff) | |
| parent | Extensions. SVG+media fix (see Bug #400356). (diff) | |
| download | inkscape-945ce419c806c73d70203dec33ececafbe108a92.tar.gz inkscape-945ce419c806c73d70203dec33ececafbe108a92.zip | |
Merge from trunk
(bzr r9508.1.73)
Diffstat (limited to 'src/dialogs/find.cpp')
| -rw-r--r-- | src/dialogs/find.cpp | 64 |
1 files changed, 37 insertions, 27 deletions
diff --git a/src/dialogs/find.cpp b/src/dialogs/find.cpp index fe264892a..c112b3531 100644 --- a/src/dialogs/find.cpp +++ b/src/dialogs/find.cpp @@ -110,15 +110,18 @@ sp_find_squeeze_window() bool 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)); @@ -131,8 +134,9 @@ item_id_match (SPItem *item, const gchar *id, bool exact) bool 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); @@ -154,12 +158,14 @@ item_text_match (SPItem *item, const gchar *text, bool exact) bool 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)); @@ -168,18 +174,18 @@ item_style_match (SPItem *item, const gchar *text, bool exact) } } -bool -item_attr_match (SPItem *item, const gchar *name, bool exact) +bool 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; } @@ -288,17 +294,20 @@ all_items (SPObject *r, GSList *l, bool hidden, bool locked) { SPDesktop *desktop = SP_ACTIVE_DESKTOP; - 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->next) { - 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(child) ) { + SPItem *item = SP_ITEM(child); + if ((hidden || !desktop->itemIsHidden(item)) && (locked || !item->isLocked())) { + l = g_slist_prepend (l, child); + } } l = all_items (child, l, hidden, locked); } @@ -311,9 +320,10 @@ all_selection_items (Inkscape::Selection *s, GSList *l, SPObject *ancestor, bool SPDesktop *desktop = SP_ACTIVE_DESKTOP; 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<SPObject*>(i->data)->cloned && !desktop->isLayer(SP_ITEM(i->data))) { + SPItem * item = SP_ITEM(i->data); + if (!ancestor || ancestor->isAncestorOf(item)) { + if ((hidden || !desktop->itemIsHidden(item)) && (locked || !item->isLocked())) { l = g_slist_prepend (l, i->data); } } |
