diff options
| author | John Smith <john.smith7545@yahoo.com> | 2012-09-22 12:14:14 +0000 |
|---|---|---|
| committer | John Smith <john.smith7545@yahoo.com> | 2012-09-22 12:14:14 +0000 |
| commit | 3f61bc675d5f2f0c92d7906b8552b09df3cd411f (patch) | |
| tree | a8fdb8a10dd8d071c703d2cb7e1984a528001ea3 /src/selection-chemistry.cpp | |
| parent | Fix for 367548 : Invert doesnt work on objects with gradients (diff) | |
| download | inkscape-3f61bc675d5f2f0c92d7906b8552b09df3cd411f.tar.gz inkscape-3f61bc675d5f2f0c92d7906b8552b09df3cd411f.zip | |
Fix for 172222 : Move direct to specified layer
(bzr r11695)
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) { |
