Commit 7b62b5c4 authored by Sharaf Zaman's avatar Sharaf Zaman Committed by Amy spark
Browse files

Make cut/copy in reference tool consistent with other tools

E.g you couldn't Ctrl-X a reference image (you had to go through the
context menu).
parent 3ac9d688
Pipeline #169211 passed with stage
in 44 minutes and 17 seconds
......@@ -54,6 +54,7 @@
#include "kis_node_manager.h"
#include "kis_layer_utils.h"
#include <kis_selection_mask.h>
#include <KisReferenceImagesLayer.h>
#include <processing/fill_processing_visitor.h>
#include <kis_selection_tool_helper.h>
......@@ -266,7 +267,14 @@ void KisCutCopyActionFactory::run(bool willCut, bool makeSharpClip, KisViewManag
KisImageSP image = view->image();
if (!image) return;
const bool haveShapesSelected = view->selectionManager()->haveShapesSelected();
// Reference layers is a fake node, so it isn't added to the layer stack, this results in KisSelectedShapesProxy not
// being aware of the active shapeManager and its selected shapes.
const auto hasReferenceImageSelected = [&]() {
KisReferenceImagesLayerSP refLayer = view->document()->referenceImagesLayer();
return refLayer && refLayer->shapeManager()->selection()->count();
};
const bool haveShapesSelected = view->selectionManager()->haveShapesSelected() || hasReferenceImageSelected();
KisNodeSP node = view->activeNode();
KisSelectionSP selection = view->selection();
......
......@@ -311,20 +311,9 @@ QMenu* ToolReferenceImages::popupActionsMenu()
m_contextMenu->addSeparator();
KisAction* cut = new KisAction(i18n("Cut"));
cut->setIcon(KisIconUtils::loadIcon("edit-cut"));
KisAction* copy = new KisAction(i18n("Copy"));
copy->setIcon(KisIconUtils::loadIcon("edit-copy"));
KisAction* paste = new KisAction(i18n("Paste"));
paste->setIcon(KisIconUtils::loadIcon("edit-paste"));
connect(cut,SIGNAL(triggered()),this,SLOT(cut()));
connect(copy,SIGNAL(triggered()),this,SLOT(copy()));
connect(paste,SIGNAL(triggered()),this,SLOT(paste()));
m_contextMenu->addAction(cut);
m_contextMenu->addAction(copy);
m_contextMenu->addAction(paste);
m_contextMenu->addAction(action("edit_cut"));
m_contextMenu->addAction(action("edit_copy"));
m_contextMenu->addAction(action("edit_paste"));
m_contextMenu->addSeparator();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment