19#include <glibmm/i18n.h>
95 SPObject *old_parent_parent = (old_parent !=
nullptr) ? old_parent->
parent :
nullptr;
98 if (survivor !=
nullptr && survivor->
parent == old_layer) {
99 while (survivor !=
nullptr &&
100 survivor->
parent != old_parent &&
101 survivor->
parent != old_parent_parent)
107 if (survivor ==
nullptr || (survivor->
parent != old_parent && survivor->
parent != old_layer)) {
109 while (survivor !=
nullptr &&
110 survivor != old_parent &&
111 survivor->
parent != old_parent)
170 layer->setHidden(!layer->isHidden());
213 layer->setLocked(!layer->isLocked());
299 g_return_if_fail(layer !=
nullptr);
303 if (layer->
getNext() != old_pos) {
305 char const * message = g_strdup_printf(_(
"Raised layer <b>%s</b>."), layer->
defaultLabel());
308 g_free((
void *) message);
326 g_return_if_fail(layer !=
nullptr);
334 if (layer->
getNext() != old_pos) {
336 char const * message = g_strdup_printf(_(
"Raised layer <b>%s</b>."), layer->
defaultLabel());
339 g_free((
void *) message);
357 g_return_if_fail(layer !=
nullptr);
361 if (layer->
getNext() != old_pos) {
363 char const * message = g_strdup_printf(_(
"Lowered layer <b>%s</b>."), layer->
defaultLabel());
366 g_free((
void *) message);
384 g_return_if_fail(layer !=
nullptr);
388 if (layer->
getNext() != old_pos) {
390 char const * message = g_strdup_printf(_(
"Lowered layer <b>%s</b>."), layer->
defaultLabel());
393 g_free((
void *) message);
412 layer->updateRepr(SP_OBJECT_WRITE_NO_CHILDREN | SP_OBJECT_WRITE_EXT);
423 std::vector<SPItem*>
items(selection->items().begin(), selection->items().end());
424 if (
items.size() != 1) {
425 show_output(
"layer_to_group: only one selected item allowed!");
429 if (
auto group = cast<SPGroup>(
items[0])) {
430 if (!group->isLayer()) {
432 group->updateRepr(SP_OBJECT_WRITE_NO_CHILDREN | SP_OBJECT_WRITE_EXT);
433 selection->set(group);
450 std::vector<SPItem*>
items(selection->items().begin(), selection->items().end());
451 if (
items.size() == 1 && cast<SPGroup>(
items[0])) {
468 std::vector<SPItem*>
items(selection->items().begin(), selection->items().end());
469 if (
items.size() == 1 && cast<SPGroup>(
items[0]->parent) ) {
483 {
"win.layer-new", N_(
"Add Layer"),
SECTION_LAYER, N_(
"Create a new layer")},
484 {
"win.layer-new-above", N_(
"Add Layer Above"),
SECTION_LAYER, N_(
"Create a new layer above current")},
485 {
"win.layer-duplicate", N_(
"Duplicate Current Layer"),
SECTION_LAYER, N_(
"Duplicate the current layer")},
486 {
"win.layer-delete", N_(
"Delete Current Layer"),
SECTION_LAYER, N_(
"Delete the current layer")},
487 {
"win.layer-rename", N_(
"Rename Layer"),
SECTION_LAYER, N_(
"Rename the current layer")},
489 {
"win.layer-hide-toggle", N_(
"Show/Hide Current Layer"),
SECTION_LAYER, N_(
"Toggle visibility of current layer")},
490 {
"win.layer-lock-toggle", N_(
"Lock/Unlock Current Layer"),
SECTION_LAYER, N_(
"Toggle lock on current layer")},
492 {
"win.layer-previous", N_(
"Switch to Layer Above"),
SECTION_LAYER, N_(
"Switch to the layer above the current")},
493 {
"win.layer-next", N_(
"Switch to Layer Below"),
SECTION_LAYER, N_(
"Switch to the layer below the current")},
495 {
"win.selection-move-to-layer-above", N_(
"Move Selection to Layer Above"),
SECTION_LAYER, N_(
"Move selection to the layer above the current")},
496 {
"win.selection-move-to-layer-below", N_(
"Move Selection to Layer Below"),
SECTION_LAYER, N_(
"Move selection to the layer below the current")},
497 {
"win.selection-move-to-layer", N_(
"Move Selection to Layer..."),
SECTION_LAYER, N_(
"Move selection to layer")},
499 {
"win.layer-top", N_(
"Layer to Top"),
SECTION_LAYER, N_(
"Raise the current layer to the top")},
500 {
"win.layer-raise", N_(
"Raise Layer"),
SECTION_LAYER, N_(
"Raise the current layer")},
501 {
"win.layer-lower", N_(
"Lower Layer"),
SECTION_LAYER, N_(
"Lower the current layer")},
502 {
"win.layer-bottom", N_(
"Layer to Bottom"),
SECTION_LAYER, N_(
"Lower the current layer to the bottom")},
504 {
"win.layer-to-group", N_(
"Layer to Group"),
SECTION_LAYER, N_(
"Convert the current layer to a group")},
505 {
"win.layer-from-group", N_(
"Layer from Group"),
SECTION_LAYER, N_(
"Convert the group to a layer")},
508 {
"win.selection-group-enter", N_(
"Enter Group"),
SECTION_SELECT, N_(
"Enter group")},
509 {
"win.selection-group-exit", N_(
"Exit Group"),
SECTION_SELECT, N_(
"Exit group")},
517 win->add_action(
"layer-new", sigc::bind(sigc::ptr_fun(&
layer_new), win));
518 win->add_action(
"layer-new-above", sigc::bind(sigc::ptr_fun(&
layer_new_above), win));
519 win->add_action(
"layer-duplicate", sigc::bind(sigc::ptr_fun(&
layer_duplicate), win));
520 win->add_action(
"layer-delete", sigc::bind(sigc::ptr_fun(&
layer_delete), win));
521 win->add_action(
"layer-rename", sigc::bind(sigc::ptr_fun(&
layer_rename), win));
523 win->add_action(
"layer-hide-all", sigc::bind(sigc::ptr_fun(&
layer_hide_all), win));
524 win->add_action(
"layer-unhide-all", sigc::bind(sigc::ptr_fun(&
layer_unhide_all), win));
525 win->add_action(
"layer-hide-toggle", sigc::bind(sigc::ptr_fun(&
layer_hide_toggle), win));
528 win->add_action(
"layer-lock-all", sigc::bind(sigc::ptr_fun(&
layer_lock_all), win));
529 win->add_action(
"layer-unlock-all", sigc::bind(sigc::ptr_fun(&
layer_unlock_all), win));
530 win->add_action(
"layer-lock-toggle", sigc::bind(sigc::ptr_fun(&
layer_lock_toggle), win));
533 win->add_action(
"layer-previous", sigc::bind(sigc::ptr_fun(&
layer_previous), win));
534 win->add_action(
"layer-next", sigc::bind(sigc::ptr_fun(&
layer_next), win));
540 win->add_action(
"layer-top", sigc::bind(sigc::ptr_fun(&
layer_top), win));
541 win->add_action(
"layer-raise", sigc::bind(sigc::ptr_fun(&
layer_raise), win));
542 win->add_action(
"layer-lower", sigc::bind(sigc::ptr_fun(&
layer_lower), win));
543 win->add_action(
"layer-bottom", sigc::bind(sigc::ptr_fun(&
layer_bottom), win));
545 win->add_action(
"layer-to-group", sigc::bind(sigc::ptr_fun(&
layer_to_group), win));
546 win->add_action(
"layer-from-group", sigc::bind(sigc::ptr_fun(&
layer_from_group), win));
548 win->add_action(
"selection-group-enter", sigc::bind(sigc::ptr_fun(&
group_enter), win));
549 win->add_action(
"selection-group-exit", sigc::bind(sigc::ptr_fun(&
group_exit), win));
void show_output(Glib::ustring const &data, bool const is_cerr)
void add_actions_layer(InkscapeWindow *win)
void layer_lock_all(InkscapeWindow *win)
void layer_unhide_all(InkscapeWindow *win)
void layer_bottom(InkscapeWindow *win)
const Glib::ustring SECTION_SELECT
void selection_move_to_layer(InkscapeWindow *win)
void layer_raise(InkscapeWindow *win)
void layer_hide_toggle(InkscapeWindow *win)
void layer_lock_toggle(InkscapeWindow *win)
void layer_rename(InkscapeWindow *win)
void group_enter(InkscapeWindow *win)
void layer_new(InkscapeWindow *win)
void layer_from_group(InkscapeWindow *win)
void layer_new_above(InkscapeWindow *win)
void layer_unlock_all(InkscapeWindow *win)
void layer_hide_all(InkscapeWindow *win)
const Glib::ustring SECTION_LAYER
void layer_next(InkscapeWindow *win)
void layer_lock_toggle_others(InkscapeWindow *win)
std::vector< std::vector< Glib::ustring > > raw_data_layer
void layer_hide_toggle_others(InkscapeWindow *win)
void layer_lower(InkscapeWindow *win)
void layer_previous(InkscapeWindow *win)
void layer_delete(InkscapeWindow *win)
void group_exit(InkscapeWindow *win)
void layer_top(InkscapeWindow *win)
void layer_duplicate(InkscapeWindow *win)
void layer_to_group(InkscapeWindow *win)
void selection_move_to_layer_below(InkscapeWindow *win)
void selection_move_to_layer_above(InkscapeWindow *win)
Authors: Sushant A A sushant.co19@gmail.com
static InkscapeApplication * instance()
Singleton instance.
SPDesktop * get_desktop()
static void done(SPDocument *document, Glib::ustring const &event_description, Glib::ustring const &undo_icon, unsigned int object_modified_tag=0)
static void maybeDone(SPDocument *document, const gchar *keyconst, Glib::ustring const &event_description, Glib::ustring const &undo_icon, unsigned int object_modified_tag=0)
void toggleLayerSolo(SPObject *object, bool force_hide=false)
Toggle the visibility of every layer except the given layer.
void renameLayer(SPObject *obj, char const *label, bool uniquify)
void setCurrentLayer(SPObject *object, bool clear=false)
Sets the current layer of the desktop.
void toggleHideAllLayers(bool hide)
SPGroup * currentLayer() const
Returns current top layer.
void toggleLockOtherLayers(SPObject *object, bool force_lock=false)
Toggle the sensitivity of every layer except the given layer.
SPGroup * currentRoot() const
Returns current root (=bottom) layer.
void toggleLockAllLayers(bool lock)
MessageId flash(MessageType type, char const *message)
Temporarily pushes a message onto the stack.
void toNextLayer(bool skip_undo=false)
void duplicate(bool suppressDone=false, bool duplicateLayer=false)
void toPrevLayer(bool skip_undo=false)
void clear()
Unselects all selected objects.
void set(XML::Node *repr)
Set the selection to an XML node's SPObject.
static void showMove(SPDesktop *desktop, SPObject *layer)
static void showCreate(SPDesktop *desktop, SPObject *layer)
static void showRename(SPDesktop *desktop, SPObject *layer)
To do: update description of desktop.
SPDocument * getDocument() const
Inkscape::MessageStack * messageStack() const
Inkscape::Selection * getSelection() const
Inkscape::LayerManager & layerManager()
Base class for visual SVG elements.
SPObject is an abstract base class of all of the document nodes at the SVG document level.
char const * defaultLabel() const
Returns a default label property for this object.
void deleteObject(bool propagate, bool propagate_descendants)
Deletes an object, unparenting it from its parent.
Editable view implementation.
static char const *const parent
TODO: insert short description here.
Macro for icon names used in Inkscape.
Inkscape - An SVG editor.
Dialog for renaming layers.
Raw stack of active status messages.
SPObject * create_layer(SPObject *root, SPObject *layer, LayerRelativePosition position)
Creates a new layer.
SPObject * next_layer(SPObject *root, SPObject *layer)
Finds the next layer under root, relative to layer in depth-first order.
SPObject * previous_layer(SPObject *root, SPObject *layer)
Finds the previous layer under root, relative to layer in depth-first order.
SPRoot: SVG <svg> implementation.