summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: edf01a9)
raw | patch | inline | side by side (parent: edf01a9)
author | joncruz <joncruz@users.sourceforge.net> | |
Sat, 14 Jun 2008 08:08:21 +0000 (08:08 +0000) | ||
committer | joncruz <joncruz@users.sourceforge.net> | |
Sat, 14 Jun 2008 08:08:21 +0000 (08:08 +0000) |
index ebb6d989d2086a7bd86259f8356dad284ab15da9..d54fb6fc770f6e48e175f35fee472c59f1530e7f 100644 (file)
BUTTON_BOTTOM,
BUTTON_UP,
BUTTON_DOWN,
-// BUTTON_DUPLICATE,
+ BUTTON_DUPLICATE,
BUTTON_DELETE,
BUTTON_SOLO
};
_fireAction( SP_VERB_LAYER_LOWER );
}
break;
+ case BUTTON_DUPLICATE:
+ {
+ _fireAction( SP_VERB_LAYER_DUPLICATE );
+ }
+ break;
case BUTTON_DELETE:
{
_fireAction( SP_VERB_LAYER_DELETE );
// -------------------------------------------------------
{
_watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_RENAME, 0, "Rename", (int)BUTTON_RENAME ) );
+ _watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_DUPLICATE, 0, "Duplicate", (int)BUTTON_DUPLICATE ) );
_watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_NEW, 0, "New", (int)BUTTON_NEW ) );
_watching.push_back( &_addPopupItem( targetDesktop, SP_VERB_LAYER_SOLO, 0, "Solo", (int)BUTTON_SOLO ) );
diff --git a/src/menus-skeleton.h b/src/menus-skeleton.h
index 02c81adcf5cad0c5e196081fb21d73c0c632eb20..4ae213bc012811cc8a4706e7b89d9c2c067fdf9a 100644 (file)
--- a/src/menus-skeleton.h
+++ b/src/menus-skeleton.h
" </submenu>\n"
" <submenu name=\"" N_("_Layer") "\">\n"
" <verb verb-id=\"LayerNew\" />\n"
+" <verb verb-id=\"LayerDuplicate\" />\n"
" <verb verb-id=\"LayerRename\" />\n"
" <separator/>\n"
" <verb verb-id=\"LayerNext\" />\n"
index f35e28f9a7bce8acf7212cae82a8b777bc793186..0f92f96805aa93f1907f795fe1b2000d3c48cba8 100644 (file)
}
/* fixme: sequencing */
-void sp_selection_duplicate()
+void sp_selection_duplicate(bool suppressDone)
{
SPDesktop *desktop = SP_ACTIVE_DESKTOP;
if (desktop == NULL)
Inkscape::GC::release(copy);
}
- sp_document_done(sp_desktop_document(desktop), SP_VERB_EDIT_DUPLICATE,
- _("Duplicate"));
+ if ( !suppressDone ) {
+ sp_document_done(sp_desktop_document(desktop), SP_VERB_EDIT_DUPLICATE,
+ _("Duplicate"));
+ }
selection->setReprList(newsel);
_("Paste size separately"));
}
-void sp_selection_to_next_layer ()
+void sp_selection_to_next_layer(bool suppressDone)
{
SPDesktop *dt = SP_ACTIVE_DESKTOP;
g_slist_free (copied);
if (temp_clip) g_slist_free (temp_clip);
if (next) dt->setCurrentLayer(next);
- sp_document_done(sp_desktop_document (dt), SP_VERB_LAYER_MOVE_TO_NEXT,
- _("Raise to next layer"));
+ if ( !suppressDone ) {
+ sp_document_done(sp_desktop_document (dt), SP_VERB_LAYER_MOVE_TO_NEXT,
+ _("Raise to next layer"));
+ }
} else {
no_more = true;
}
g_slist_free ((GSList *) items);
}
-void sp_selection_to_prev_layer ()
+void sp_selection_to_prev_layer(bool suppressDone)
{
SPDesktop *dt = SP_ACTIVE_DESKTOP;
g_slist_free (copied);
if (temp_clip) g_slist_free (temp_clip);
if (next) dt->setCurrentLayer(next);
- sp_document_done(sp_desktop_document (dt), SP_VERB_LAYER_MOVE_TO_PREV,
- _("Lower to previous layer"));
+ if ( !suppressDone ) {
+ sp_document_done(sp_desktop_document (dt), SP_VERB_LAYER_MOVE_TO_PREV,
+ _("Lower to previous layer"));
+ }
} else {
no_more = true;
}
index e5b2d9ef1d6af901f829b0866e023cf10bd12578..aa3c2b10054706661bb6949c3ce8f1df3b961f7f 100644 (file)
class SPCSSAttr;
void sp_selection_delete();
-void sp_selection_duplicate();
+void sp_selection_duplicate(bool suppressDone = false);
void sp_edit_clear_all();
void sp_edit_select_all();
void sp_selection_paste_size(bool apply_x, bool apply_y);
void sp_selection_paste_size_separately(bool apply_x, bool apply_y);
-void sp_selection_to_next_layer ();
-void sp_selection_to_prev_layer ();
+void sp_selection_to_next_layer( bool suppressDone = false );
+void sp_selection_to_prev_layer( bool suppressDone = false );
void sp_selection_apply_affine(Inkscape::Selection *selection, NR::Matrix const &affine, bool set_i2d = true);
void sp_selection_remove_transform (void);
diff --git a/src/verbs.cpp b/src/verbs.cpp
index a362d3c0f9e3678901c64648b3e6be595c61b7a3..4d859bab712c2f069fa40395a2e4dffcd6504899 100644 (file)
--- a/src/verbs.cpp
+++ b/src/verbs.cpp
#include <gtkmm/filechooserdialog.h>
#include <gtkmm/stock.h>
+#include "layer-manager.h"
#include "dialogs/text-edit.h"
#include "dialogs/xml-tree.h"
#include "dialogs/item-properties.h"
break;
}
+ case SP_VERB_LAYER_DUPLICATE: {
+ if ( dt->currentLayer() != dt->currentRoot() ) {
+ 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 );
+ g_free(name);
+ }
+
+ sp_edit_select_all();
+ sp_selection_duplicate(true);
+ sp_selection_to_prev_layer(true);
+ dt->setCurrentLayer(new_layer);
+ sp_edit_select_all();
+
+ sp_document_done(sp_desktop_document(dt), SP_VERB_LAYER_DUPLICATE,
+ _("Duplicate layer"));
+
+ // TRANSLATORS: this means "The layer has been duplicated."
+ dt->messageStack()->flash(Inkscape::NORMAL_MESSAGE, _("Duplicated layer."));
+ } else {
+ dt->messageStack()->flash(Inkscape::ERROR_MESSAGE, _("No current layer."));
+ }
+ break;
+ }
case SP_VERB_LAYER_DELETE: {
if ( dt->currentLayer() != dt->currentRoot() ) {
sp_desktop_selection(dt)->clear();
N_("Raise the current layer"), "raise_layer"),
new LayerVerb(SP_VERB_LAYER_LOWER, "LayerLower", N_("_Lower Layer"),
N_("Lower the current layer"), "lower_layer"),
+ new LayerVerb(SP_VERB_LAYER_DUPLICATE, "LayerDuplicate", N_("Duplicate Current Layer..."),
+ N_("Duplicate an existing layer"), 0),
new LayerVerb(SP_VERB_LAYER_DELETE, "LayerDelete", N_("_Delete Current Layer"),
N_("Delete the current layer"), "delete_layer"),
- new LayerVerb(SP_VERB_LAYER_SOLO, "LayerSolo", N_("_Solo Current Layer"),
+ new LayerVerb(SP_VERB_LAYER_SOLO, "LayerSolo", N_("_Show/hide other layers"),
N_("Solo the current layer"), 0),
/* Object */
diff --git a/src/verbs.h b/src/verbs.h
index 198a25521de91d0efc4a296112f013d37cdeebab..c1611092221f323d5300a72e0bb16a5b3fbd6265 100644 (file)
--- a/src/verbs.h
+++ b/src/verbs.h
SP_VERB_LAYER_TO_BOTTOM,
SP_VERB_LAYER_RAISE,
SP_VERB_LAYER_LOWER,
+ SP_VERB_LAYER_DUPLICATE,
SP_VERB_LAYER_DELETE,
SP_VERB_LAYER_SOLO,
/* Object */