summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b0667f2)
raw | patch | inline | side by side (parent: b0667f2)
author | gouldtj <gouldtj@users.sourceforge.net> | |
Mon, 30 Jan 2006 05:11:50 +0000 (05:11 +0000) | ||
committer | gouldtj <gouldtj@users.sourceforge.net> | |
Mon, 30 Jan 2006 05:11:50 +0000 (05:11 +0000) |
Basic submenus are working, and alphebetized
src/extension/effect.cpp | patch | blob | history | |
src/extension/effect.h | patch | blob | history |
index 78380dde1d71a74d4f36909d46535df6cbf5dbdb..1d0c4c4af4757bb31063a5437eccf90c5b0157e5 100644 (file)
--- a/src/extension/effect.cpp
+++ b/src/extension/effect.cpp
* 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
*/
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"
_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;
void
Effect::merge_menu (Inkscape::XML::Node * base,
+ Inkscape::XML::Node * start,
Inkscape::XML::Node * patern,
Inkscape::XML::Node * mergee) {
Glib::ustring mergename;
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;
diff --git a/src/extension/effect.h b/src/extension/effect.h
index fee2e5f8e14ffcc684841ca4bc29d481847acb5a..59953c7ad21b31b679ade70a9b3866854dc5e198 100644 (file)
--- a/src/extension/effect.h
+++ b/src/extension/effect.h
static Effect * _last_effect;
static Inkscape::XML::Node * _effects_list;
bool find_effects_list (Inkscape::XML::Node * menustruct);
- void merge_menu (Inkscape::XML::Node * base, Inkscape::XML::Node * patern, Inkscape::XML::Node * mergee);
+ void merge_menu (Inkscape::XML::Node * base, Inkscape::XML::Node * start, Inkscape::XML::Node * patern, Inkscape::XML::Node * mergee);
class EffectVerb : public Inkscape::Verb {
private: