From 692ee3551c1a101b16134b0b446ab98231fa4d1f Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Sat, 15 Nov 2014 10:37:38 -0800 Subject: Purged GTKish macros SP_SCRIPT/SP_IS_SCRIPT. (bzr r13712) --- src/sp-object.cpp | 2 +- src/sp-script.h | 4 +--- src/ui/dialog/document-properties.cpp | 19 ++++++++++++------- 3 files changed, 14 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/sp-object.cpp b/src/sp-object.cpp index 569714bae..024fce85a 100644 --- a/src/sp-object.cpp +++ b/src/sp-object.cpp @@ -408,7 +408,7 @@ void SPObject::requestOrphanCollection() { // do not remove style or script elements (Bug #276244) if (dynamic_cast(this)) { // leave it - } else if (SP_IS_SCRIPT(this)) { + } else if (dynamic_cast(this)) { // leave it } else if ((! prefs->getBool("/options/cleanupswatches/value", false)) && SP_IS_PAINT_SERVER(this) && static_cast(this)->isSwatch() ) { diff --git a/src/sp-script.h b/src/sp-script.h index b71f86720..cdacb8493 100644 --- a/src/sp-script.h +++ b/src/sp-script.h @@ -6,6 +6,7 @@ * * Author: * Felipe C. da S. Sanches + * Jon A. Cruz * * Copyright (C) 2008 Author * @@ -15,9 +16,6 @@ #include "sp-object.h" #include "document.h" -#define SP_SCRIPT(obj) (dynamic_cast((SPObject*)obj)) -#define SP_IS_SCRIPT(obj) (dynamic_cast((SPObject*)obj) != NULL) - /* SPScript */ class SPScript : public SPObject { public: diff --git a/src/ui/dialog/document-properties.cpp b/src/ui/dialog/document-properties.cpp index dc8a0fee2..6064c2a5e 100644 --- a/src/ui/dialog/document-properties.cpp +++ b/src/ui/dialog/document-properties.cpp @@ -1205,10 +1205,10 @@ void DocumentProperties::removeExternalScript(){ const GSList *current = SP_ACTIVE_DOCUMENT->getResourceList( "script" ); while ( current ) { - if (current->data && SP_IS_OBJECT(current->data)) { - SPObject* obj = SP_OBJECT(current->data); - SPScript* script = SP_SCRIPT(obj); - if (name == script->xlinkhref){ + SPObject* obj = reinterpret_cast(current->data); + if (obj) { + SPScript* script = dynamic_cast(obj); + if (script && (name == script->xlinkhref)) { //XML Tree being used directly here while it shouldn't be. Inkscape::XML::Node *repr = obj->getRepr(); @@ -1354,10 +1354,15 @@ void DocumentProperties::populate_script_lists(){ _ExternalScriptsListStore->clear(); _EmbeddedScriptsListStore->clear(); const GSList *current = SP_ACTIVE_DOCUMENT->getResourceList( "script" ); - if (current) _scripts_observer.set(SP_OBJECT(current->data)->parent); + if (current) { + SPObject *obj = reinterpret_cast(current->data); + g_assert(obj != NULL); + _scripts_observer.set(obj->parent); + } while ( current ) { - SPObject* obj = SP_OBJECT(current->data); - SPScript* script = SP_SCRIPT(obj); + SPObject* obj = reinterpret_cast(current->data); + SPScript* script = dynamic_cast(obj); + g_assert(script != NULL); if (script->xlinkhref) { Gtk::TreeModel::Row row = *(_ExternalScriptsListStore->append()); -- cgit v1.2.3