11#include <klocalizedstring.h>
91 SelectAll(
KisImageSP image) : m_image(image) {}
116 KisImageBarrierLock lock(image, std::try_to_lock);
117 if (!lock.owns_lock())
return;
151 bool usePattern =
false;
152 bool useBgColor =
false;
153 if (fillSource.contains(
"pattern")) {
155 }
else if (fillSource.contains(
"bg")) {
161 if (!fillSource.contains(
"opacity")) {
219 if (!selection)
return;
233 const auto currentToolHasSelection =
236 const bool haveShapesSelected =
241 const bool skipShapes = selection && !currentToolHasSelection;
243 if (!skipShapes && !flags.testFlag(
SharpClip) && (haveShapesSelected || currentToolHasSelection)) {
251 KisImageBarrierLock lock(image, std::try_to_lock);
252 if (!lock.owns_lock())
return;
259 }
else if (selection) {
263 Q_FOREACH (
KisNodeSP node, selectedNodes) {
264 if (node->inherits(
"KisMask")) {
272 Q_FOREACH (
KisNodeSP node, selectedNodes) {
274 if (node->inherits(
"KisShapeLayer") || node->inherits(
"KisFileLayer")
278 || (node->inherits(
"KisPaintLayer") && node->
isAnimated())) {
284 dupNode = node->
clone();
286 nodes.append(dupNode);
291 if (node && node->
paintDevice() && !node->inherits(
"KisMask")) {
292 KisToolUtils::trimDeviceForClipboard(image, node->paintDevice(), view->selection(), flags.testFlag(SharpClip));
310 selectedNodes.append(masks);
311 Q_FOREACH (
KisNodeSP node, selectedNodes) {
319 if (node->inherits(
"KisMask") && !masks.contains(node)) {
325 : m_node(node), m_sel(sel) {}
355 KUndo2Command *command =
new ClearSelection(node, selection);
409 "Selection is already in a vector format "),
421 QPainterPath selectionOutline = selection->
outlineCache();
449 "Selection is already in a raster format "),
481 bool hasSelectionShapes =
false;
484 Q_FOREACH (
KoShape *shape, originalShapes) {
486 hasSelectionShapes =
true;
493 if (clonedShapes.isEmpty()) {
494 if (hasSelectionShapes) {
496 "The shape already belongs to a selection"),
513 QPainterPath selectionOutline = selection->
outlineCache();
550 if (!currentNode->inherits(
"KisShapeLayer") && currentNode->
paintDevice()) {
563 QPen pen(Qt::red, size);
564 pen.setJoinStyle(Qt::RoundJoin);
573 else if (currentNode->inherits(
"KisShapeLayer")) {
606 if (!currentNode->inherits(
"KisShapeLayer") && currentNode->
paintDevice())
const quint8 OPACITY_OPAQUE_U8
void setOutDirtyRect(QSharedPointer< QRect > outDirtyRect)
void setSeedPoint(const QPoint &seedPoint)
void setSelectionOnly(bool selectionOnly)
void setUseBgColor(bool useBgColor)
void setUsePattern(bool usePattern)
KUndo2MagicString text() const
KisCoordinatesConverter * coordinatesConverter
KoShapeManager shapeManager
KoCanvasResourceProvider * resourceManager()
static KisClipboard * instance()
void setLayers(KisNodeList nodes, KisImageSP image, const QRect referenceRect, bool forceCopy=false)
QTransform imageToDocumentTransform() const
void barrierLock(bool readOnly=false)
Wait until all the queued background jobs are completed and lock the image.
void addJob(KisStrokeId id, KisStrokeJobData *data) override
void cropImage(const QRect &newRect)
start asynchronous operation on cropping the image
KisStrokeId startStroke(KisStrokeStrategy *strokeStrategy) override
KisSelectionSP globalSelection() const
QRect bounds() const override
void addSpontaneousJob(KisSpontaneousJob *spontaneousJob)
void endStroke(KisStrokeId id) override
KisNodeList selectedNodes()
void cutLayersToClipboard()
void copyLayersToClipboard()
void endAction(KisProcessingApplicator *applicator, const QString &xmlData)
KisProcessingApplicator * beginAction(KisViewManager *view, const KUndo2MagicString &actionName, Flags flags=Normal)
void clearSelection(KisSelectionSP selection)
static void runSingleCommandStroke(KisImageSP image, KUndo2Command *cmd, KisStrokeJobData::Sequentiality sequentiality=KisStrokeJobData::SEQUENTIAL, KisStrokeJobData::Exclusivity exclusivity=KisStrokeJobData::NORMAL)
runSingleCommandStroke creates a stroke and runs cmd in it. The text() field of cmd is used as a titl...
void applyCommand(KUndo2Command *command, KisStrokeJobData::Sequentiality sequentiality=KisStrokeJobData::SEQUENTIAL, KisStrokeJobData::Exclusivity exclusivity=KisStrokeJobData::NORMAL)
The KisResourcesSnapshot class takes a snapshot of the various resources like colors and settings use...
void setOpacity(qreal opacity)
bool haveShapesSelected()
void setSupportsWrapAroundMode(bool value)
KUndo2Command * endAndTake()
bool blockUntilOperationsFinished(KisImageSP image)
blockUntilOperationsFinished blocks the GUI of the application until execution of actions on image is...
KisCanvas2 * canvasBase() const
Return the canvas base class.
KisSelectionSP selection()
KisNodeManager * nodeManager() const
The node manager handles everything about nodes.
KisSelectionManager * selectionManager()
KisImageWSP image() const
Return the image this view is displaying.
KisCanvasResourceProvider * canvasResourceProvider()
void showFloatingMessage(const QString &message, const QIcon &icon, int timeout=4500, KisFloatingMessage::Priority priority=KisFloatingMessage::Medium, int alignment=Qt::AlignCenter|Qt::TextWordWrap)
shows a floating message in the top right corner of the canvas
QPointer< KoShapeController > shapeController
QPointer< KoCanvasResourceProvider > resourceManager
QVariant resource(int key) const
void toQColor(QColor *c) const
a convenience method for the above.
static KoPathShape * createShapeFromPainterPath(const QPainterPath &path)
Creates path shape from given QPainterPath.
const QList< KoShape * > selectedShapes() const
KoShapeUserData * userData() const
KoShape * cloneShapeAndBakeAbsoluteTransform() const
creates a deep copy of the shape/shapes tree and bakes the absolute transform of this into the result...
virtual void setStroke(KoShapeStrokeModelSP stroke)
void setUserData(KoShapeUserData *userData)
void setShapeId(const QString &id)
#define KIS_SAFE_ASSERT_RECOVER_RETURN(cond)
QSharedPointer< KUndo2Command > KUndo2CommandSP
KUndo2MagicString kundo2_i18n(const char *text)
KisNodeList sortAndFilterMergeableInternalNodes(KisNodeList nodes, bool allowMasks)
void recursiveApplyNodes(NodePointer node, Functor func)
@ ForegroundColor
The active foreground color selected for this canvas.
virtual KisPaintDeviceSP projection() const =0
virtual KisPaintDeviceSP paintDevice() const =0
bool hasEditablePaintDevice() const
void run(KisViewManager *view) override
The LambdaCommand struct is a shorthand for creation of AggregateCommand commands using C++ lambda fe...
void run(KisViewManager *view) override
void run(Flags flags, KisViewManager *view)
void run(KisViewManager *view) override
void run(const QString &fillSource, KisViewManager *view)
void runFilter(KisSelectionFilter *filter, KisViewManager *view, const KisOperationConfiguration &config)
void run(KisViewManager *view) override
void runFromXML(KisViewManager *view, const KisOperationConfiguration &config) override
virtual KisNodeSP clone() const =0
QPainterPath outlineCache
void recalculateOutlineCache() override
void clear(const QRect &r)
void select(const QRect &r, quint8 selectedness=MAX_SELECTED)
void toXML(QDomDocument &, QDomElement &) const override
virtual void setProperty(const QString &name, const QVariant &value)
void run(KisViewManager *view) override
void run(KisViewManager *view) override
void run(KisViewManager *view) override
void run(KisViewManager *view) override
void run(KisViewManager *view) override
KisPixelSelectionSP projection() const
bool outlineCacheValid() const
KisPixelSelectionSP pixelSelection
QRect selectedRect() const
bool hasShapeSelection() const
QRect selectedExactRect() const
Slow, but exact way of determining the rectangle that encloses the selection.
QPainterPath outlineCache() const
void run(KisViewManager *view) override
void run(KisViewManager *view, const StrokeSelectionOptions ¶ms)
void run(KisViewManager *view, const StrokeSelectionOptions ¶ms)
KisToolShapeUtils::FillStyle fillStyle() const