summaryrefslogtreecommitdiffstats
path: root/src/extension/effect.cpp
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2006-01-30 05:11:50 +0000
committergouldtj <gouldtj@users.sourceforge.net>2006-01-30 05:11:50 +0000
commited285c07e2e7d9280176ad86704227a9881b282b (patch)
tree0d88df982f1ed1d4152febe9e0f6cd351546fa73 /src/extension/effect.cpp
parentr10816@tres: ted | 2006-01-29 15:14:36 -0800 (diff)
downloadinkscape-ed285c07e2e7d9280176ad86704227a9881b282b.tar.gz
inkscape-ed285c07e2e7d9280176ad86704227a9881b282b.zip
r10817@tres: ted | 2006-01-29 15:45:22 -0800
Basic submenus are working, and alphebetized (bzr r52)
Diffstat (limited to 'src/extension/effect.cpp')
-rw-r--r--src/extension/effect.cpp64
1 files changed, 32 insertions, 32 deletions
diff --git a/src/extension/effect.cpp b/src/extension/effect.cpp
index 78380dde1..1d0c4c4af 100644
--- a/src/extension/effect.cpp
+++ b/src/extension/effect.cpp
@@ -2,7 +2,7 @@
* Authors:
* Ted Gould <ted@gould.cx>
*
- * Copyright (C) 2002-2005 Authors
+ * Copyright (C) 2002-2006 Authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
@@ -39,7 +39,7 @@ Effect::Effect (Inkscape::XML::Node * in_repr, Implementation::Implementation *
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")) {
- printf("Found local effects menu in %s\n", this->get_name());
+ // printf("Found local effects menu in %s\n", this->get_name());
local_effects_menu = sp_repr_children(child_repr);
}
} // children of "effect"
@@ -55,9 +55,7 @@ Effect::Effect (Inkscape::XML::Node * in_repr, Implementation::Implementation *
_menu_node = sp_repr_new("verb");
_menu_node->setAttribute("verb-id", this->get_id(), false);
- merge_menu(_effects_list, local_effects_menu, _menu_node);
- if (!strcmp(this->get_id(), "org.ekips.filter.interp"))
- sp_repr_print(_effects_list->parent());
+ merge_menu(_effects_list->parent(), _effects_list, local_effects_menu, _menu_node);
}
return;
@@ -65,6 +63,7 @@ Effect::Effect (Inkscape::XML::Node * in_repr, Implementation::Implementation *
void
Effect::merge_menu (Inkscape::XML::Node * base,
+ Inkscape::XML::Node * start,
Inkscape::XML::Node * patern,
Inkscape::XML::Node * mergee) {
Glib::ustring mergename;
@@ -90,41 +89,42 @@ Effect::merge_menu (Inkscape::XML::Node * base,
mergename = _(menuname);
}
- base->parent()->appendChild(tomerge);
+ base->appendChild(tomerge);
Inkscape::GC::release(tomerge);
- Inkscape::XML::Node * menupass;
- for (menupass = base->next(); menupass != NULL; menupass = menupass->next()) {
- gchar const * compare_char = NULL;
- if (!strcmp(menupass->name(), "verb")) {
- gchar const * verbid = menupass->attribute("verb-id");
- Inkscape::Verb * verb = Inkscape::Verb::getbyid(verbid);
- if (verb == NULL) {
- printf("Unable to find verb\n");
- return;
+ if (start != NULL) {
+ Inkscape::XML::Node * menupass;
+ for (menupass = start->next(); menupass != NULL; menupass = menupass->next()) {
+ gchar const * compare_char = NULL;
+ if (!strcmp(menupass->name(), "verb")) {
+ gchar const * verbid = menupass->attribute("verb-id");
+ Inkscape::Verb * verb = Inkscape::Verb::getbyid(verbid);
+ if (verb == NULL) {
+ continue;
+ }
+ compare_char = verb->get_name();
+ } else if (!strcmp(menupass->name(), "submenu")) {
+ compare_char = menupass->attribute("name");
+ if (compare_char == NULL)
+ compare_char = menupass->attribute("_name");
}
- compare_char = verb->get_name();
- } else { // submenu
- compare_char = menupass->attribute("name");
- if (compare_char == NULL)
- compare_char = menupass->attribute("_name");
- }
- if (compare_char == NULL) {
- printf("Nothing to compare against\n");
- return;
- }
+ /* This will cause us to skip tags we don't understand */
+ if (compare_char == NULL) {
+ continue;
+ }
- Glib::ustring compare(_(compare_char));
+ Glib::ustring compare(_(compare_char));
- if (mergename < compare) {
- tomerge->setPosition(menupass->position());
- break;
- }
- }
+ if (mergename < compare) {
+ tomerge->setPosition(menupass->position());
+ break;
+ }
+ } // for menu items
+ } // start != NULL
if (patern != NULL) {
- merge_menu(tomerge, patern->firstChild(), mergee);
+ merge_menu(tomerge, tomerge->firstChild(), patern->firstChild(), mergee);
}
return;