diff options
| author | su_v <suv-sf@users.sourceforge.net> | 2012-09-23 17:24:25 +0000 |
|---|---|---|
| committer | ~suv <suv-sf@users.sourceforge.net> | 2012-09-23 17:24:25 +0000 |
| commit | ac16411f213f98407fc42c1d04eb4ae6c187e4a6 (patch) | |
| tree | b8fd94caee6b202043810a7366ab3f032882a48f /src/selection-chemistry.cpp | |
| parent | add newly linked-in m4 files to .bzrignore (diff) | |
| parent | Fix for 170395 : Add Trace Bitmap to context menu of images : Focus fix (diff) | |
| download | inkscape-ac16411f213f98407fc42c1d04eb4ae6c187e4a6.tar.gz inkscape-ac16411f213f98407fc42c1d04eb4ae6c187e4a6.zip | |
merge from trunk (r11698)
(bzr r11668.1.10)
Diffstat (limited to 'src/selection-chemistry.cpp')
| -rw-r--r-- | src/selection-chemistry.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/selection-chemistry.cpp b/src/selection-chemistry.cpp index 068928d8f..4cdab4336 100644 --- a/src/selection-chemistry.cpp +++ b/src/selection-chemistry.cpp @@ -1314,6 +1314,36 @@ void sp_selection_to_prev_layer(SPDesktop *dt, bool suppressDone) g_slist_free(const_cast<GSList *>(items)); } +void sp_selection_to_layer(SPDesktop *dt, SPObject *moveto, bool suppressDone) +{ + Inkscape::Selection *selection = sp_desktop_selection(dt); + + // check if something is selected + if (selection->isEmpty()) { + dt->messageStack()->flash(Inkscape::WARNING_MESSAGE, _("Select <b>object(s)</b> to move.")); + return; + } + + GSList const *items = g_slist_copy(const_cast<GSList *>(selection->itemList())); + + if (moveto) { + GSList *temp_clip = NULL; + sp_selection_copy_impl(items, &temp_clip, dt->doc()->getReprDoc()); // we're in the same doc, so no need to copy defs + sp_selection_delete_impl(items, false, false); + GSList *copied = sp_selection_paste_impl(sp_desktop_document(dt), moveto, &temp_clip); + selection->setReprList((GSList const *) copied); + g_slist_free(copied); + if (temp_clip) g_slist_free(temp_clip); + if (moveto) dt->setCurrentLayer(moveto); + if ( !suppressDone ) { + DocumentUndo::done(sp_desktop_document(dt), SP_VERB_LAYER_MOVE_TO, + _("Move selection to layer")); + } + } + + g_slist_free(const_cast<GSList *>(items)); +} + bool selection_contains_original(SPItem *item, Inkscape::Selection *selection) { |
