summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 38fbda5)
raw | patch | inline | side by side (parent: 38fbda5)
author | speare <speare@users.sourceforge.net> | |
Tue, 10 Mar 2009 02:43:40 +0000 (02:43 +0000) | ||
committer | speare <speare@users.sourceforge.net> | |
Tue, 10 Mar 2009 02:43:40 +0000 (02:43 +0000) |
src/verbs.cpp | patch | blob | history |
diff --git a/src/verbs.cpp b/src/verbs.cpp
index 5e911552cde796e3afa7fc839690bef289446762..06abe93693462ba23036c9908082033ff38550b7 100644 (file)
--- a/src/verbs.cpp
+++ b/src/verbs.cpp
}
case SP_VERB_LAYER_DUPLICATE: {
if ( dt->currentLayer() != dt->currentRoot() ) {
+ // Note with either approach:
+ // Any clone masters are duplicated, their clones use the *original*,
+ // but the duplicated master is not linked up as master nor clone of the original.
+#if 0
+ // Only copies selectable things, honoring locks, visibility, avoids sublayers.
SPObject *new_layer = Inkscape::create_layer(dt->currentRoot(), dt->currentLayer(), LPOS_BELOW);
if ( dt->currentLayer()->label() ) {
gchar* name = g_strdup_printf(_("%s copy"), dt->currentLayer()->label());
dt->layer_manager->renameLayer( new_layer, name, TRUE );
g_free(name);
}
-
sp_edit_select_all(dt);
sp_selection_duplicate(dt, true);
sp_selection_to_prev_layer(dt, true);
dt->setCurrentLayer(new_layer);
sp_edit_select_all(dt);
-
+#else
+ // Copies everything, regardless of locks, visibility, sublayers.
+ Inkscape::XML::Node *selected = dt->currentLayer()->repr;
+ Inkscape::XML::Node *parent = sp_repr_parent(selected);
+ Inkscape::XML::Node *dup = selected->duplicate(parent->document());
+ parent->addChild(dup, selected);
+ SPObject *new_layer = dt->currentLayer()->next;
+ if (new_layer) {
+ if (new_layer->label()) {
+ gchar* name = g_strdup_printf(_("%s copy"), new_layer->label());
+ dt->layer_manager->renameLayer( new_layer, name, TRUE );
+ g_free(name);
+ }
+ dt->setCurrentLayer(new_layer);
+ }
+#endif
sp_document_done(sp_desktop_document(dt), SP_VERB_LAYER_DUPLICATE,
_("Duplicate layer"));