summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 95a229a)
raw | patch | inline | side by side (parent: 95a229a)
author | buliabyak <buliabyak@users.sourceforge.net> | |
Tue, 10 Feb 2009 06:35:55 +0000 (06:35 +0000) | ||
committer | buliabyak <buliabyak@users.sourceforge.net> | |
Tue, 10 Feb 2009 06:35:55 +0000 (06:35 +0000) |
src/extension/effect.cpp | patch | blob | history | |
src/extension/effect.h | patch | blob | history | |
src/menus-skeleton.h | patch | blob | history |
index 5abcdbf7997424166f85ea8aa8d65582811ae90a..20f0d0b3dec0eee3bbdb72b521418455e875610b 100644 (file)
--- a/src/extension/effect.cpp
+++ b/src/extension/effect.cpp
Effect * Effect::_last_effect = NULL;
Inkscape::XML::Node * Effect::_effects_list = NULL;
+Inkscape::XML::Node * Effect::_filters_list = NULL;
+
+#define EFFECTS_LIST "effects-list"
+#define FILTERS_LIST "filters-list"
Effect::Effect (Inkscape::XML::Node * in_repr, Implementation::Implementation * in_imp)
: Extension(in_repr, in_imp),
} // children of "inkscape-extension"
} // if we have an XML file
- if (_effects_list == NULL && INKSCAPE != NULL) {
- find_effects_list(inkscape_get_menus(INKSCAPE));
+ if (INKSCAPE != NULL) {
+ if (_effects_list == NULL)
+ _effects_list = find_menu(inkscape_get_menus(INKSCAPE), EFFECTS_LIST);
+ if (_filters_list == NULL)
+ _filters_list = find_menu(inkscape_get_menus(INKSCAPE), FILTERS_LIST);
}
- if (_effects_list != NULL) {
+ if ((_effects_list != NULL || _filters_list != NULL)) {
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)
- merge_menu(_effects_list->parent(), _effects_list, local_effects_menu, _menu_node);
+ if (!hidden) {
+ if (_filters_list &&
+ local_effects_menu &&
+ local_effects_menu->attribute("name") &&
+ !strcmp(local_effects_menu->attribute("name"), _("Filters"))) {
+ merge_menu(_filters_list->parent(), _filters_list, sp_repr_children(local_effects_menu), _menu_node);
+ } else if (_effects_list) {
+ merge_menu(_effects_list->parent(), _effects_list, local_effects_menu, _menu_node);
+ }
+ }
}
return;
if (start != NULL) {
Inkscape::XML::Node * menupass;
- for (menupass = start; menupass != NULL; menupass = menupass->next()) {
+ for (menupass = start; menupass != NULL && strcmp(menupass->name(), "separator"); menupass = menupass->next()) {
gchar const * compare_char = NULL;
if (!strcmp(menupass->name(), "verb")) {
gchar const * verbid = menupass->attribute("verb-id");
compare_char = menupass->attribute("_name");
}
+ position = menupass->position() + 1;
+
/* This will cause us to skip tags we don't understand */
if (compare_char == NULL) {
continue;
return;
}
-#define EFFECTS_LIST "effects-list"
-
-bool
-Effect::find_effects_list (Inkscape::XML::Node * menustruct)
+Inkscape::XML::Node *
+Effect::find_menu (Inkscape::XML::Node * menustruct, const gchar *name)
{
if (menustruct == NULL) return false;
for (Inkscape::XML::Node * child = menustruct;
child != NULL;
child = child->next()) {
- if (!strcmp(child->name(), EFFECTS_LIST)) {
- _effects_list = child;
- return true;
+ if (!strcmp(child->name(), name)) {
+ return child;
}
Inkscape::XML::Node * firstchild = child->firstChild();
- if (firstchild != NULL)
- if (find_effects_list(firstchild))
- return true;
+ if (firstchild != NULL) {
+ Inkscape::XML::Node *found = find_menu (firstchild, name);
+ if (found)
+ return found;
+ }
}
- return false;
+ return NULL;
}
+
Gtk::VBox *
Effect::get_info_widget(void)
{
diff --git a/src/extension/effect.h b/src/extension/effect.h
index 0724bd9610bb1ad597ab7d633db6aaecf7e6eb7a..c02ce542b09e7d4de1c3366ad1a6edb3a52bedb6 100644 (file)
--- a/src/extension/effect.h
+++ b/src/extension/effect.h
/** \brief This is the last effect that was used. This is used in
a menu item to rapidly recall the same effect. */
static Effect * _last_effect;
- /** \brief The location of the effects menu on the menu structure
+ /** \brief The location of the Extensions and Filters menus on the menu structure
XML file. This is saved so it only has to be discovered
once. */
static Inkscape::XML::Node * _effects_list;
- bool find_effects_list (Inkscape::XML::Node * menustruct);
+ static Inkscape::XML::Node * _filters_list;
+ Inkscape::XML::Node *find_menu (Inkscape::XML::Node * menustruct, const gchar *name);
void merge_menu (Inkscape::XML::Node * base, Inkscape::XML::Node * start, Inkscape::XML::Node * patern, Inkscape::XML::Node * mergee);
/** \brief This is the verb type that is used for all effect's verbs.
diff --git a/src/menus-skeleton.h b/src/menus-skeleton.h
index a19c3d0e0ec9560f6222e41c6e9796209c054157..904aad678b76dbf44558ba0dc0a027834f6bdbe4 100644 (file)
--- a/src/menus-skeleton.h
+++ b/src/menus-skeleton.h
" <verb verb-id=\"DialogFillStroke\" />\n"
" <verb verb-id=\"DialogObjectProperties\" />\n"
" <separator/>\n"
-" <verb verb-id=\"DialogFilterEffects\" />\n"
-" <verb verb-id=\"RemoveFilter\" />\n"
-" <separator/>\n"
" <verb verb-id=\"SelectionGroup\" />\n"
" <verb verb-id=\"SelectionUnGroup\" />\n"
" <separator/>\n"
" <separator/>\n"
" <verb verb-id=\"SelectionTextRemoveKerns\" />\n"
" </submenu>\n"
-" <submenu name=\"" N_("Effe_cts") "\">\n"
+" <submenu name=\"" N_("F_ilters") "\">\n"
+" <filters-list/>\n"
+" <separator/>\n"
+" <verb verb-id=\"DialogFilterEffects\" />\n"
+" <verb verb-id=\"RemoveFilter\" />\n"
+" </submenu>\n"
+" <submenu name=\"" N_("E_xtensions") "\">\n"
" <verb verb-id=\"EffectLast\" />\n"
" <verb verb-id=\"EffectLastPref\" />\n"
" <separator/>\n"