Krita Source Code Documentation
Loading...
Searching...
No Matches
kis_image_signal_router.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2011 Dmitry Kazakov <dimula73@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
8
9#include <QThread>
11
12#include "kis_image.h"
13
14
15#define CONNECT_TO_IMAGE(signal) \
16 connect(this, SIGNAL(signal), m_image, SIGNAL(signal), Qt::DirectConnection)
17
18#define CONNECT_TO_IMAGE_QUEUED(signal) \
19 connect(this, SIGNAL(signal), m_image, SIGNAL(signal), Qt::QueuedConnection)
20
22 qRegisterMetaType<KisImageSignalType>("KisImageSignalType");
23}
24
25
55
59
64
66{
67 Q_FOREACH (const KisImageSignalType &type, notifications) {
68 emitNotification(type);
69 }
70}
71
73{
80 if (type.id == LayersChangedSignal ||
82 slotNotification(type);
83 } else {
84 Q_EMIT sigNotification(type);
85 }
86}
87
92
93void KisImageSignalRouter::emitNodeHasBeenAdded(KisNode *parent, int index, KisNodeAdditionFlags flags)
94{
95 KisNodeSP newNode = parent->at(index);
96
97 // overlay selection masks reset frames themselves
98 if (!newNode->inherits("KisSelectionMask")) {
100 if (image) {
101 image->invalidateAllFrames();
102 }
103 }
104
105 Q_EMIT sigNodeAddedAsync(newNode, flags);
106}
107
109{
110 KisNodeSP removedNode = parent->at(index);
111
112 // overlay selection masks reset frames themselves
113 if (!removedNode->inherits("KisSelectionMask")) {
115 if (image) {
116 image->invalidateAllFrames();
117 }
118 }
119
120 Q_EMIT sigRemoveNodeAsync(removedNode);
121}
122
127
132
137
139{
141 if (!image) {
142 return;
143 }
144
145 switch(type.id) {
147 image->invalidateAllFrames();
148 Q_EMIT sigLayersChangedAsync();
149 break;
152 break;
154 image->invalidateAllFrames();
157 break;
159 image->invalidateAllFrames();
160 Q_EMIT sigProfileChanged(image->profile());
161 break;
163 image->invalidateAllFrames();
164 Q_EMIT sigColorSpaceChanged(image->colorSpace());
165 break;
167 image->invalidateAllFrames();
168 Q_EMIT sigResolutionChanged(image->xRes(), image->yRes());
169 break;
172 !type.nodeReselectionSignal.newSelectedNodes.isEmpty()) {
173
176 }
177 break;
178 }
179}
float value(const T *src, size_t ch)
@ ColorSpaceChangedSignal
@ NodeReselectionRequestSignal
@ SizeChangedSignal
@ ProfileChangedSignal
@ LayersChangedSignal
@ ModifiedWithoutUndoSignal
@ ResolutionChangedSignal
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
void emitRequestLodPlanesSyncBlocked(bool value)
void sigRequestLodPlanesSyncBlocked(bool value)
void sigSizeChanged(const QPointF &oldStillPoint, const QPointF &newStillPoint)
void emitNotification(KisImageSignalType type)
void sigRequestNodeReselection(KisNodeSP activeNode, const KisNodeList &selectedNodes)
void emitNotifications(KisImageSignalVector notifications)
void slotNotification(KisImageSignalType type)
KisImageSignalRouter(KisImageWSP image)
void sigRemoveNodeAsync(KisNodeSP node)
void sigResolutionChanged(double xRes, double yRes)
void emitNodeHasBeenAdded(KisNode *parent, int index, KisNodeAdditionFlags flags)
void sigNotifyBatchUpdateStarted()
void sigNodeChanged(KisNodeSP node)
void emitAboutToRemoveANode(KisNode *parent, int index)
void emitNodeChanged(KisNodeSP node)
void sigImageModifiedWithoutUndo()
void sigNotification(KisImageSignalType type)
void sigNodeAddedAsync(KisNodeSP node, KisNodeAdditionFlags flags)
void sigNotifyBatchUpdateEnded()
void sigColorSpaceChanged(const KoColorSpace *cs)
void sigProfileChanged(const KoColorProfile *profile)
void invalidateAllFrames() override
Definition kis_image.cc:632
const KoColorSpace * colorSpace() const
double xRes() const
double yRes() const
const KoColorProfile * profile() const
KisSharedPtr< T > toStrongRef() const
toStrongRef returns a KisSharedPtr which may be dereferenced.
KIS_DECLARE_STATIC_INITIALIZER
#define CONNECT_TO_IMAGE_QUEUED(signal)
#define CONNECT_TO_IMAGE(signal)
ComplexSizeChangedSignal sizeChangedSignal
ComplexNodeReselectionSignal nodeReselectionSignal
KisImageSignalTypeEnum id