Krita Source Code Documentation
Loading...
Searching...
No Matches
kis_reselect_global_selection_command.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2007 Sven Langkamp <sven.langkamp@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
8#include <klocalizedstring.h>
9
10#include "kis_image.h"
11#include "kis_group_layer.h"
12#include "kis_selection_mask.h"
18
19
21 : KisCommandUtils::AggregateCommand(kundo2_i18n("Reselect"), parent)
22 , m_image(image)
23{
24}
25
29
31{
34
36
38 if (selectionMask) {
39 KisSelectionMaskSP activeSelectionMask = image->rootLayer()->selectionMask();
40 if (activeSelectionMask) {
41 addCommand(new KisImageLayerRemoveCommand(image, activeSelectionMask, false, false));
42 }
43
44 addCommand(new KisChangeDeselectedMaskCommand(image, nullptr));
45 addCommand(new KisImageLayerAddCommand(image, selectionMask, image->root(), image->root()->lastChild(), false, false));
46 }
47
49}
50
KisSelectionMaskSP deselectedGlobalSelection() const
Definition kis_image.cc:305
The command for adding a layer.
KisImageGlobalSelectionManagementInterface * globalSelectionManagementInterface() const
Definition kis_image.cc:710
KisGroupLayerSP rootLayer() const
KisReselectGlobalSelectionCommand(KisImageWSP image, KUndo2Command *parent=nullptr)
KisSharedPtr< T > toStrongRef() const
toStrongRef returns a KisSharedPtr which may be dereferenced.
#define KIS_SAFE_ASSERT_RECOVER_RETURN(cond)
Definition kis_assert.h:128
KUndo2MagicString kundo2_i18n(const char *text)
void addCommand(KUndo2Command *cmd)
virtual KisSelectionMaskSP selectionMask() const
Definition kis_layer.cc:498
KisNodeSP lastChild() const
Definition kis_node.cpp:367