summaryrefslogtreecommitdiffstats
path: root/src/selection-chemistry.cpp
diff options
context:
space:
mode:
authorJabier Arraiza Cenoz <jabier.arraiza@marker.es>2016-05-08 10:19:13 +0000
committerjabiertxof <info@marker.es>2016-05-08 10:19:13 +0000
commit1556c1a3619c415b3a7abacfdabd89398e411a91 (patch)
treed7718e5873db4b2c25cb3bed94fcc4c3ba87fea4 /src/selection-chemistry.cpp
parentremove a waring on compile (diff)
parentadd missing POTFILES.in line in mirror symmetry LPE (diff)
downloadinkscape-1556c1a3619c415b3a7abacfdabd89398e411a91.tar.gz
inkscape-1556c1a3619c415b3a7abacfdabd89398e411a91.zip
update to trunk
(bzr r13645.1.127)
Diffstat (limited to 'src/selection-chemistry.cpp')
-rw-r--r--src/selection-chemistry.cpp36
1 files changed, 34 insertions, 2 deletions
diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp
index e6d5f174e..7d32477a1 100644
--- a/src/selection-chemistry.cpp
+++ b/src/selection-chemistry.cpp
@@ -791,6 +791,38 @@ static gint clone_depth_descending(gconstpointer a, gconstpointer b) {
return -1;
}
}
+
+void sp_selection_ungroup_pop_selection(Inkscape::Selection *selection, SPDesktop *desktop)
+{
+ if (selection->isEmpty()) {
+ selection_display_message(desktop, Inkscape::WARNING_MESSAGE, _("<b>No objects selected</b> to pop out of group."));
+ return;
+ }
+ std::vector<SPItem*> selection_list = selection->itemList();
+
+ std::vector<SPItem*>::const_iterator item = selection_list.begin(); // leaving this because it will be useful for
+ // future implementation of complex pop ungrouping
+ SPItem *obj = *item;
+ SPItem *parent_group = static_cast<SPItem*>(obj->parent);
+ if (!SP_IS_GROUP(parent_group) || SP_IS_LAYER(parent_group)) {
+ desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Selection <b>not in a group</b>."));
+ return;
+ }
+ if (parent_group->firstChild()->getNext() == NULL) {
+ std::vector<SPItem*> children;
+ sp_item_group_ungroup(static_cast<SPGroup*>(parent_group), children, false);
+ }
+ else {
+ sp_selection_to_next_layer(desktop, 1); // suppress done
+ }
+
+ parent_group->requestDisplayUpdate(SP_OBJECT_MODIFIED_FLAG);
+
+ DocumentUndo::done(selection->layers()->getDocument(), SP_VERB_SELECTION_UNGROUP_POP_SELECTION,
+ _("Pop selection from group"));
+
+}
+
void sp_selection_ungroup(Inkscape::Selection *selection, SPDesktop *desktop)
{
@@ -1126,7 +1158,7 @@ void
sp_undo(SPDesktop *desktop, SPDocument *)
{
// No re/undo while dragging, too dangerous.
- if(desktop->getCanvas()->is_dragging) return;
+ if(desktop->getCanvas()->_is_dragging) return;
if (!DocumentUndo::undo(desktop->getDocument())) {
desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Nothing to undo."));
@@ -1137,7 +1169,7 @@ void
sp_redo(SPDesktop *desktop, SPDocument *)
{
// No re/undo while dragging, too dangerous.
- if(desktop->getCanvas()->is_dragging) return;
+ if(desktop->getCanvas()->_is_dragging) return;
if (!DocumentUndo::redo(desktop->getDocument())) {
desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Nothing to redo."));