diff options
| author | Jon A. Cruz <jon@joncruz.org> | 2014-11-15 18:37:38 +0000 |
|---|---|---|
| committer | Jon A. Cruz <jon@joncruz.org> | 2014-11-15 18:37:38 +0000 |
| commit | 692ee3551c1a101b16134b0b446ab98231fa4d1f (patch) | |
| tree | 5b6f59bc2aaab32513cb67042ce5b4be5e90dd2b /src | |
| parent | Purged SP_STYLE_ELEM/SP_IS_STYLE_ELEM macro abuse. (diff) | |
| download | inkscape-692ee3551c1a101b16134b0b446ab98231fa4d1f.tar.gz inkscape-692ee3551c1a101b16134b0b446ab98231fa4d1f.zip | |
Purged GTKish macros SP_SCRIPT/SP_IS_SCRIPT.
(bzr r13712)
Diffstat (limited to 'src')
| -rw-r--r-- | src/sp-object.cpp | 2 | ||||
| -rw-r--r-- | src/sp-script.h | 4 | ||||
| -rw-r--r-- | src/ui/dialog/document-properties.cpp | 19 |
3 files changed, 14 insertions, 11 deletions
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<SPStyleElem *>(this)) { // leave it - } else if (SP_IS_SCRIPT(this)) { + } else if (dynamic_cast<SPScript *>(this)) { // leave it } else if ((! prefs->getBool("/options/cleanupswatches/value", false)) && SP_IS_PAINT_SERVER(this) && static_cast<SPPaintServer*>(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 <juca@members.fsf.org> + * Jon A. Cruz <jon@joncruz.org> * * Copyright (C) 2008 Author * @@ -15,9 +16,6 @@ #include "sp-object.h" #include "document.h" -#define SP_SCRIPT(obj) (dynamic_cast<SPScript*>((SPObject*)obj)) -#define SP_IS_SCRIPT(obj) (dynamic_cast<const SPScript*>((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<SPObject *>(current->data); + if (obj) { + SPScript* script = dynamic_cast<SPScript *>(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<SPObject *>(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<SPObject *>(current->data); + SPScript* script = dynamic_cast<SPScript *>(obj); + g_assert(script != NULL); if (script->xlinkhref) { Gtk::TreeModel::Row row = *(_ExternalScriptsListStore->append()); |
