summaryrefslogtreecommitdiffstats
path: root/src/selection-describer.cpp
diff options
context:
space:
mode:
authorJon A. Cruz <jon@joncruz.org>2014-11-10 17:39:33 +0000
committerJon A. Cruz <jon@joncruz.org>2014-11-10 17:39:33 +0000
commite179290f049d5c34ae2b9c05fdfeab830b7c39e7 (patch)
tree3bc9ff1d6baf4c22bd383ca1ed33abf37c2bd6f7 /src/selection-describer.cpp
parentFix 32-bit build break. (diff)
downloadinkscape-e179290f049d5c34ae2b9c05fdfeab830b7c39e7.tar.gz
inkscape-e179290f049d5c34ae2b9c05fdfeab830b7c39e7.zip
Removed SP_USE/SP_IS_USE Gtk-ish macros and cleaned affected files.
(bzr r13700)
Diffstat (limited to 'src/selection-describer.cpp')
-rw-r--r--src/selection-describer.cpp77
1 files changed, 49 insertions, 28 deletions
diff --git a/src/selection-describer.cpp b/src/selection-describer.cpp
index 1cb96fed0..f7814fd57 100644
--- a/src/selection-describer.cpp
+++ b/src/selection-describer.cpp
@@ -5,6 +5,7 @@
* MenTaLguY <mental@rydia.net>
* bulia byak <buliabyak@users.sf.net>
* Abhishek Sharma
+ * Jon A. Cruz <jon@joncruz.org>
*
* Copyright (C) 2004-2006 Authors
*
@@ -46,11 +47,14 @@ char* collect_terms (GSList *items)
bool first = true;
for (GSList *i = (GSList *)items; i != NULL; i = i->next) {
- const char *term = SP_ITEM(i->data)->displayName();
- if (term != NULL && g_slist_find (check, term) == NULL) {
- check = g_slist_prepend (check, (void *) term);
- ss << (first ? "" : ", ") << "<b>" << term << "</b>";
- first = false;
+ SPItem *item = dynamic_cast<SPItem *>(reinterpret_cast<SPObject *>(i->data));
+ if (item) {
+ const char *term = item->displayName();
+ if (term != NULL && g_slist_find (check, term) == NULL) {
+ check = g_slist_prepend (check, (void *) term);
+ ss << (first ? "" : ", ") << "<b>" << term << "</b>";
+ first = false;
+ }
}
}
return g_strdup(ss.str().c_str());
@@ -62,10 +66,13 @@ static int count_terms (GSList *items)
GSList *check = NULL;
int count=0;
for (GSList *i = (GSList *)items; i != NULL; i = i->next) {
- const char *term = SP_ITEM(i->data)->displayName();
- if (term != NULL && g_slist_find (check, term) == NULL) {
- check = g_slist_prepend (check, (void *) term);
- count++;
+ SPItem *item = dynamic_cast<SPItem *>(reinterpret_cast<SPObject *>(i->data));
+ if (item) {
+ const char *term = item->displayName();
+ if (term != NULL && g_slist_find (check, term) == NULL) {
+ check = g_slist_prepend (check, (void *) term);
+ count++;
+ }
}
}
return count;
@@ -76,8 +83,10 @@ static int count_filtered (GSList *items)
{
int count=0;
for (GSList *i = items; i != NULL; i = i->next) {
- SPItem *item = SP_ITEM(i->data);
- count += item->isFiltered();
+ SPItem *item = dynamic_cast<SPItem *>(reinterpret_cast<SPObject *>((i->data)));
+ if (item) {
+ count += item->isFiltered();
+ }
}
return count;
}
@@ -118,7 +127,8 @@ void SelectionDescriber::_updateMessageFromSelection(Inkscape::Selection *select
if (!items) { // no items
_context.set(Inkscape::NORMAL_MESSAGE, _when_nothing);
} else {
- SPItem *item = SP_ITEM(items->data);
+ SPItem *item = dynamic_cast<SPItem *>(reinterpret_cast<SPObject *>(items->data));
+ g_assert(item != NULL);
SPObject *layer = selection->layers()->layerForObject(item);
SPObject *root = selection->layers()->currentRoot();
@@ -181,30 +191,41 @@ void SelectionDescriber::_updateMessageFromSelection(Inkscape::Selection *select
if (!items->next) { // one item
char *item_desc = item->detailedDescription();
- if (SP_IS_USE(item) && SP_IS_SYMBOL(item->firstChild())) {
+ bool isUse = dynamic_cast<SPUse *>(item) != NULL;
+ if (isUse && dynamic_cast<SPSymbol *>(item->firstChild())) {
_context.setF(Inkscape::NORMAL_MESSAGE, "%s%s. %s. %s.",
item_desc, in_phrase,
_("Convert symbol to group to edit"), _when_selected);
- } else if (SP_IS_SYMBOL(item)) {
+ } else if (dynamic_cast<SPSymbol *>(item)) {
_context.setF(Inkscape::NORMAL_MESSAGE, "%s%s. %s.",
item_desc, in_phrase,
_("Remove from symbols tray to edit symbol"));
- } else if (SP_IS_USE(item) || (SP_IS_OFFSET(item) && SP_OFFSET(item)->sourceHref)) {
- _context.setF(Inkscape::NORMAL_MESSAGE, "%s%s. %s. %s.",
- item_desc, in_phrase,
- _("Use <b>Shift+D</b> to look up original"), _when_selected);
- } else if (SP_IS_TEXT_TEXTPATH(item)) {
- _context.setF(Inkscape::NORMAL_MESSAGE, "%s%s. %s. %s.",
- item_desc, in_phrase,
- _("Use <b>Shift+D</b> to look up path"), _when_selected);
- } else if (SP_IS_FLOWTEXT(item) && !SP_FLOWTEXT(item)->has_internal_frame()) {
- _context.setF(Inkscape::NORMAL_MESSAGE, "%s%s. %s. %s.",
- item_desc, in_phrase,
- _("Use <b>Shift+D</b> to look up frame"), _when_selected);
} else {
- _context.setF(Inkscape::NORMAL_MESSAGE, "%s%s. %s.",
- item_desc, in_phrase, _when_selected);
+ SPOffset *offset = (isUse) ? NULL : dynamic_cast<SPOffset *>(item);
+ if (isUse || (offset && offset->sourceHref)) {
+ _context.setF(Inkscape::NORMAL_MESSAGE, "%s%s. %s. %s.",
+ item_desc, in_phrase,
+ _("Use <b>Shift+D</b> to look up original"), _when_selected);
+ } else {
+ SPText *text = dynamic_cast<SPText *>(item);
+ if (text && text->firstChild() && dynamic_cast<SPText *>(text->firstChild())) {
+ _context.setF(Inkscape::NORMAL_MESSAGE, "%s%s. %s. %s.",
+ item_desc, in_phrase,
+ _("Use <b>Shift+D</b> to look up path"), _when_selected);
+ } else {
+ SPFlowtext *flowtext = dynamic_cast<SPFlowtext *>(item);
+ if (flowtext && !flowtext->has_internal_frame()) {
+ _context.setF(Inkscape::NORMAL_MESSAGE, "%s%s. %s. %s.",
+ item_desc, in_phrase,
+ _("Use <b>Shift+D</b> to look up frame"), _when_selected);
+ } else {
+ _context.setF(Inkscape::NORMAL_MESSAGE, "%s%s. %s.",
+ item_desc, in_phrase, _when_selected);
+ }
+ }
+ }
}
+
g_free(item_desc);
} else { // multiple items
int objcount = g_slist_length((GSList *)items);