[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-kimageshop
Subject: [graphics/krita] libs/ui/actions: Make Ctrl+C/X/V shortcut work with layers when there is nothing el
From: Dmitry Kazakov <null () kde ! org>
Date: 2020-08-14 11:38:28
Message-ID: 20200814113828.730BE124151B () leptone ! kde ! org
[Download RAW message or body]
Git commit d402db85d8d0ee946369cae1875178cb08d8f2ec by Dmitry Kazakov.
Committed on 14/08/2020 at 11:38.
Pushed by dkazakov into branch 'master'.
Make Ctrl+C/X/V shortcut work with layers when there is nothing else to copy
The new priority list for copying/cutting:
1) Cut/Copy selected vector shapes
2) Cut/Copy the content of pixel selection
3) Cut/Copy the selected layer
If the user wants to Cut/Copy a layer when there is a selection active,
then he/she should use a special Layer->Cut/Copy Layer menu action instead
of the default shortcut.
BUG:411463
CC:kimageshop@kde.org
M +6 -0 libs/ui/actions/KisPasteActionFactories.cpp
M +13 -10 libs/ui/actions/kis_selection_action_factories.cpp
https://invent.kde.org/graphics/krita/commit/d402db85d8d0ee946369cae1875178cb08d8f2ec
diff --git a/libs/ui/actions/KisPasteActionFactories.cpp \
b/libs/ui/actions/KisPasteActionFactories.cpp index 71b3725ff3..afe6218be5 100644
--- a/libs/ui/actions/KisPasteActionFactories.cpp
+++ b/libs/ui/actions/KisPasteActionFactories.cpp
@@ -35,6 +35,7 @@
#include "commands/kis_image_layer_add_command.h"
#include "KisTransformToolActivationCommand.h"
#include "kis_processing_applicator.h"
+#include "kis_node_manager.h"
#include <KoDocumentInfo.h>
#include <KoSvgPaste.h>
@@ -203,6 +204,11 @@ void KisPasteActionFactory::run(bool pasteAtCursorPosition, \
KisViewManager *view KisImageSP image = view->image();
if (!image) return;
+ if (KisClipboard::instance()->hasLayers()) {
+ view->nodeManager()->pasteLayersFromClipboard();
+ return;
+ }
+
if (tryPasteShapes(pasteAtCursorPosition, view)) {
return;
}
diff --git a/libs/ui/actions/kis_selection_action_factories.cpp \
b/libs/ui/actions/kis_selection_action_factories.cpp index df9450db35..fff1f3471f \
100644
--- a/libs/ui/actions/kis_selection_action_factories.cpp
+++ b/libs/ui/actions/kis_selection_action_factories.cpp
@@ -63,7 +63,7 @@
#include "kis_image_animation_interface.h"
#include "kis_time_range.h"
#include "kis_keyframe_channel.h"
-
+#include "kis_node_manager.h"
#include <processing/fill_processing_visitor.h>
#include <kis_selection_tool_helper.h>
@@ -269,9 +269,12 @@ void KisCutCopyActionFactory::run(bool willCut, bool \
makeSharpClip, KisViewManag KisImageSP image = view->image();
if (!image) return;
- bool haveShapesSelected = view->selectionManager()->haveShapesSelected();
+ const bool haveShapesSelected = view->selectionManager()->haveShapesSelected();
- if (haveShapesSelected) {
+ KisNodeSP node = view->activeNode();
+ KisSelectionSP selection = view->selection();
+
+ if (!makeSharpClip && haveShapesSelected) {
// XXX: "Add saving of XML data for Cut/Copy of shapes"
KisImageBarrierLocker locker(image);
@@ -280,13 +283,7 @@ void KisCutCopyActionFactory::run(bool willCut, bool \
makeSharpClip, KisViewManag } else {
view->canvasBase()->toolProxy()->copy();
}
- } else {
- KisNodeSP node = view->activeNode();
- if (!node) return;
-
- KisSelectionSP selection = view->selection();
- if (selection.isNull()) return;
-
+ } else if (node && selection) {
{
KisImageBarrierLocker locker(image);
KisPaintDeviceSP dev = node->paintDevice();
@@ -375,6 +372,12 @@ void KisCutCopyActionFactory::run(bool willCut, bool \
makeSharpClip, KisViewManag KisOperationConfiguration config(id());
config.setProperty("will-cut", willCut);
endAction(ap, config.toXML());
+ } else if (!makeSharpClip) {
+ if (willCut) {
+ view->nodeManager()->cutLayersToClipboard();
+ } else {
+ view->nodeManager()->copyLayersToClipboard();
+ }
}
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic