X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fextension%2Feffect.cpp;h=1fef1a9db9f0f8032099dd84a45504417cf13636;hb=300868e9fd6365e6815d376def3229cb5d1155d0;hp=168688f0ef75b2e46b3897d4522b6d6b7034bcd1;hpb=bc5774a8297b4be5c913670a62cf9184dcf533d0;p=inkscape.git diff --git a/src/extension/effect.cpp b/src/extension/effect.cpp index 168688f0e..1fef1a9db 100644 --- a/src/extension/effect.cpp +++ b/src/extension/effect.cpp @@ -34,28 +34,32 @@ Effect::Effect (Inkscape::XML::Node * in_repr, Implementation::Implementation * bool hidden = false; + no_doc = false; + if (repr != NULL) { - Inkscape::XML::Node * child_repr; - for (child_repr = sp_repr_children(repr); child_repr != NULL; child_repr = child_repr->next()) { - if (!strcmp(child_repr->name(), "effect")) { - for (child_repr = sp_repr_children(child_repr); child_repr != NULL; child_repr = child_repr->next()) { - if (!strcmp(child_repr->name(), "effects-menu")) { + for (Inkscape::XML::Node *child = sp_repr_children(repr); child != NULL; child = child->next()) { + if (!strcmp(child->name(), "effect")) { + if (child->attribute("needs-document") && !strcmp(child->attribute("needs-document"), "no")) { + no_doc = true; + } + for (Inkscape::XML::Node *effect_child = sp_repr_children(child); effect_child != NULL; effect_child = effect_child->next()) { + if (!strcmp(effect_child->name(), "effects-menu")) { // printf("Found local effects menu in %s\n", this->get_name()); - local_effects_menu = sp_repr_children(child_repr); - if (child_repr->attribute("hidden") && !strcmp(child_repr->attribute("hidden"), "yes")) { + local_effects_menu = sp_repr_children(effect_child); + if (effect_child->attribute("hidden") && !strcmp(effect_child->attribute("hidden"), "yes")) { hidden = true; } } - if (!strcmp(child_repr->name(), "menu-name") || - !strcmp(child_repr->name(), "_menu-name")) { + if (!strcmp(effect_child->name(), "menu-name") || + !strcmp(effect_child->name(), "_menu-name")) { // printf("Found local effects menu in %s\n", this->get_name()); - _verb.set_name(sp_repr_children(child_repr)->content()); + _verb.set_name(sp_repr_children(effect_child)->content()); } - if (!strcmp(child_repr->name(), "menu-tip") || - !strcmp(child_repr->name(), "_menu-tip")) { + if (!strcmp(effect_child->name(), "menu-tip") || + !strcmp(effect_child->name(), "_menu-tip")) { // printf("Found local effects menu in %s\n", this->get_name()); - _verb.set_tip(sp_repr_children(child_repr)->content()); + _verb.set_tip(sp_repr_children(effect_child)->content()); } } // children of "effect" break; // there can only be one effect @@ -67,7 +71,9 @@ Effect::Effect (Inkscape::XML::Node * in_repr, Implementation::Implementation * find_effects_list(inkscape_get_menus(INKSCAPE)); if (_effects_list != NULL) { - _menu_node = sp_repr_new("verb"); + Inkscape::XML::Document *xml_doc; + xml_doc = _effects_list->document(); + _menu_node = xml_doc->createElement("verb"); _menu_node->setAttribute("verb-id", this->get_id(), false); if (!hidden) @@ -99,8 +105,10 @@ Effect::merge_menu (Inkscape::XML::Node * base, gchar const * menuname = patern->attribute("name"); if (menuname == NULL) menuname = patern->attribute("_name"); if (menuname == NULL) return; - - tomerge = sp_repr_new("submenu"); + + Inkscape::XML::Document *xml_doc; + xml_doc = base->document(); + tomerge = xml_doc->createElement("submenu"); tomerge->setAttribute("name", menuname, false); mergename = _(menuname); @@ -228,8 +236,7 @@ Effect::effect (Inkscape::UI::View::View * doc) set_last_effect(this); imp->effect(this, doc); - sp_document_done(doc->doc(), SP_VERB_NONE, - /* TODO: annotate */ "effect.cpp:226"); + sp_document_done(doc->doc(), SP_VERB_NONE, _(this->get_name())); return; }