From a907096a990015010ec1171cd8997d33951f28a2 Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Tue, 12 Apr 2016 11:35:15 +0100 Subject: Hackfest 2016: un-obfuscate the SPCanvas widget. (bzr r14790) --- src/selection-chemistry.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/selection-chemistry.cpp') diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index e6d5f174e..e9a3af83a 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -1126,7 +1126,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 +1137,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.")); -- cgit v1.2.3 From 1dfba12bc394644560de7d2560aa03061237d0b8 Mon Sep 17 00:00:00 2001 From: Raphael Rosch Date: Thu, 14 Apr 2016 14:19:03 -0400 Subject: function to release object from group Fixed bugs: - https://launchpad.net/bugs/484041 (bzr r14845) --- src/selection-chemistry.cpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'src/selection-chemistry.cpp') diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index e9a3af83a..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, _("No objects selected to pop out of group.")); + return; + } + std::vector selection_list = selection->itemList(); + + std::vector::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(obj->parent); + if (!SP_IS_GROUP(parent_group) || SP_IS_LAYER(parent_group)) { + desktop->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Selection not in a group.")); + return; + } + if (parent_group->firstChild()->getNext() == NULL) { + std::vector children; + sp_item_group_ungroup(static_cast(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) { -- cgit v1.2.3