=== modified file 'src/menus-skeleton.h'
--- src/menus-skeleton.h 2014-10-08 02:22:03 +0000
+++ src/menus-skeleton.h 2015-02-27 00:21:14 +0000
@@ -187,6 +187,7 @@
" \n"
" \n"
" \n"
+" \n"
" \n"
" \n"
" \n"
=== modified file 'src/selection-chemistry.cpp'
--- src/selection-chemistry.cpp 2014-12-25 19:30:29 +0000
+++ src/selection-chemistry.cpp 2015-02-27 17:58:00 +0000
@@ -794,6 +794,29 @@
return -1;
}
}
+
+void sp_selection_ungroup_pop_selection(Inkscape::Selection *selection, SPDesktop *desktop)
+{ // TODO: empty groups are not automatically removed
+ // TODO: using the xml browser to select objects prevents pop selection from working
+ // TODO: grey out menu entry in file menu when action cannot be performed
+ GSList *selection_list = const_cast(selection->itemList());
+ if (selection_list == NULL) {
+ // selection_display_message(desktop, Inkscape::ERROR_MESSAGE, _("No grouped objects to ungroup in empty selection."));
+ desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("No objects selected to pop out of group."));
+ return;
+ }
+ SPItem *obj = static_cast(selection_list->data);
+ SPItem *parent_group = static_cast(obj->parent);
+ if (!SP_IS_GROUP(parent_group) || SP_IS_LAYER(parent_group)) {
+ // selection_display_message(desktop, Inkscape::ERROR_MESSAGE, _("Selection not in a group."));
+ desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Selection not in a group."));
+ return;
+ }
+ sp_selection_to_next_layer(desktop, 0);
+ parent_group->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
+
+}
+
void sp_selection_ungroup(Inkscape::Selection *selection, SPDesktop *desktop)
{
=== modified file 'src/selection-chemistry.h'
--- src/selection-chemistry.h 2014-10-08 02:22:03 +0000
+++ src/selection-chemistry.h 2015-02-27 00:08:04 +0000
@@ -78,6 +78,7 @@
//void sp_selection_group_impl(GSList const *reprs_to_group, Inkscape::XML::Node *group, Inkscape::XML::Document *xml_doc, SPDocument *doc);
void sp_selection_group(Inkscape::Selection *selection, SPDesktop *desktop);
void sp_selection_ungroup(Inkscape::Selection *selection, SPDesktop *desktop);
+void sp_selection_ungroup_pop_selection(Inkscape::Selection *selection, SPDesktop *desktop);
void sp_selection_raise(Inkscape::Selection *selection, SPDesktop *desktop);
void sp_selection_raise_to_top(Inkscape::Selection *selection, SPDesktop *desktop);
=== modified file 'src/ui/interface.cpp'
--- src/ui/interface.cpp 2014-12-21 21:58:32 +0000
+++ src/ui/interface.cpp 2015-02-27 00:26:05 +0000
@@ -1514,6 +1514,12 @@
MIParent.signal_activate().connect(sigc::mem_fun(*this, &ContextMenu::LeaveGroup));
MIParent.show();
append(MIParent);
+
+ /* Pop selection out of group */
+ Gtk::MenuItem* miu = Gtk::manage(new Gtk::MenuItem(_("_Pop selection out of group"), 1));
+ miu->signal_activate().connect(sigc::mem_fun(*this, &ContextMenu::ActivateUngroupPopSelection));
+ miu->show();
+ append(*miu);
}
}
}
@@ -1912,6 +1918,12 @@
_desktop->selection->setList(children);
g_slist_free(children);
}
+
+void ContextMenu::ActivateUngroupPopSelection(void)
+{
+ sp_selection_ungroup_pop_selection(_desktop->selection, _desktop);
+}
+
void ContextMenu::MakeAnchorMenu(void)
{
=== modified file 'src/ui/interface.h'
--- src/ui/interface.h 2014-10-08 02:22:03 +0000
+++ src/ui/interface.h 2015-02-27 00:06:01 +0000
@@ -194,6 +194,7 @@
/**
* callback, is executed on clicking the anchor "Group" and "Ungroup" menu entry
*/
+ void ActivateUngroupPopSelection(void);
void ActivateUngroup(void);
void ActivateGroup(void);
=== modified file 'src/verbs.cpp'
--- src/verbs.cpp 2014-12-21 21:58:32 +0000
+++ src/verbs.cpp 2015-02-26 23:48:55 +0000
@@ -1142,6 +1142,9 @@
case SP_VERB_SELECTION_UNGROUP:
sp_selection_ungroup(selection, dt);
break;
+ case SP_VERB_SELECTION_UNGROUP_POP_SELECTION:
+ sp_selection_ungroup_pop_selection(selection, dt);
+ break;
default:
handled = false;
break;
@@ -2566,6 +2569,8 @@
N_("Group selected objects"), INKSCAPE_ICON("object-group")),
new SelectionVerb(SP_VERB_SELECTION_UNGROUP, "SelectionUnGroup", N_("_Ungroup"),
N_("Ungroup selected groups"), INKSCAPE_ICON("object-ungroup")),
+ new SelectionVerb(SP_VERB_SELECTION_UNGROUP_POP_SELECTION, "SelectionUnGroupPopSelection", N_("_Pop selected objects out of group"),
+ N_("Pop selected objects out of group"), INKSCAPE_ICON("object-ungroup-pop-selection")),
new SelectionVerb(SP_VERB_SELECTION_TEXTTOPATH, "SelectionTextToPath", N_("_Put on Path"),
N_("Put text on path"), INKSCAPE_ICON("text-put-on-path")),
=== modified file 'src/verbs.h'
--- src/verbs.h 2014-10-08 02:22:03 +0000
+++ src/verbs.h 2015-02-26 23:47:26 +0000
@@ -116,6 +116,7 @@
SP_VERB_SELECTION_LOWER,
SP_VERB_SELECTION_GROUP,
SP_VERB_SELECTION_UNGROUP,
+ SP_VERB_SELECTION_UNGROUP_POP_SELECTION,
SP_VERB_SELECTION_TEXTTOPATH,
SP_VERB_SELECTION_TEXTFROMPATH,
SP_VERB_SELECTION_REMOVE_KERNS,