Commit de2d7bc3 authored by Boudewijn Rempt's avatar Boudewijn Rempt

Merge branch 'master' into rempt/T6282-replace-add-shape-docker

parents 3edd3118 c2b3000e
......@@ -2262,6 +2262,54 @@
<isCheckable>true</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="toggle_layer_lock">
<icon>layer-locked</icon>
<text>&amp;Lock/unlock layer</text>
<whatsThis></whatsThis>
<toolTip>Lock/unlock layer</toolTip>
<iconText>Lock/unlock layer</iconText>
<activationFlags>1000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="toggle_layer_visibility">
<icon>visible</icon>
<text>Toggle layer &amp;visibility</text>
<whatsThis></whatsThis>
<toolTip>Toggle layer visibility</toolTip>
<iconText>Toggle layer visibility</iconText>
<activationFlags>1000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="toggle_layer_alpha_lock">
<icon>transparency-locked</icon>
<text>Lock/unlock layer &amp;alpha</text>
<whatsThis></whatsThis>
<toolTip>Lock/unlock layer's alpha</toolTip>
<iconText>Lock/unlock layer's alpha</iconText>
<activationFlags>1000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="toggle_layer_inherit_alpha">
<icon>transparency-enabled</icon>
<text>Toggle layer alpha &amp;inheritance</text>
<whatsThis></whatsThis>
<toolTip>Toggle layer alpha inheritance</toolTip>
<iconText>Toggle layer alpha inheritance</iconText>
<activationFlags>1000</activationFlags>
<activationConditions>0</activationConditions>
<shortcut></shortcut>
<isCheckable>false</isCheckable>
<statusTip></statusTip>
</Action>
<Action name="add_new_paint_layer">
<icon>paintLayer</icon>
<text>&amp;Paint Layer</text>
......
......@@ -544,8 +544,13 @@ public:
class WheelEvent : public InputEvent {
public:
#if QT_VERSION >= 0x050700
WheelEvent(QWindow *w, ulong time, const QPointF & local, const QPointF & global, QPoint pixelD, QPoint angleD, int qt4D, Qt::Orientation qt4O,
Qt::KeyboardModifiers mods, Qt::ScrollPhase phase = Qt::NoScrollPhase, Qt::MouseEventSource src = Qt::MouseEventNotSynthesized)
#else
WheelEvent(QWindow *w, ulong time, const QPointF & local, const QPointF & global, QPoint pixelD, QPoint angleD, int qt4D, Qt::Orientation qt4O,
Qt::KeyboardModifiers mods, Qt::ScrollPhase phase = Qt::ScrollUpdate, Qt::MouseEventSource src = Qt::MouseEventNotSynthesized)
#endif
: InputEvent(w, time, Wheel, mods), pixelDelta(pixelD), angleDelta(angleD), qt4Delta(qt4D), qt4Orientation(qt4O), localPos(local), globalPos(global), phase(phase), source(src) { }
QPoint pixelDelta;
QPoint angleDelta;
......
......@@ -109,7 +109,11 @@ public:
ENTER_FUNCTION();
}
#if QT_VERSION >= 0x050700
static void handleWheelEvent(QWindow *w, ulong timestamp, const QPointF & local, const QPointF & global, QPoint pixelDelta, QPoint angleDelta, Qt::KeyboardModifiers mods = Qt::NoModifier, Qt::ScrollPhase phase = Qt::NoScrollPhase, Qt::MouseEventSource source = Qt::MouseEventNotSynthesized);
#else
static void handleWheelEvent(QWindow *w, ulong timestamp, const QPointF & local, const QPointF & global, QPoint pixelDelta, QPoint angleDelta, Qt::KeyboardModifiers mods = Qt::NoModifier, Qt::ScrollPhase phase = Qt::ScrollUpdate, Qt::MouseEventSource source = Qt::MouseEventNotSynthesized);
#endif
static void handleTabletEnterProximityEvent(int device, int pointerType, qint64 uid);
static void handleTabletLeaveProximityEvent(int device, int pointerType, qint64 uid);
......
......@@ -340,6 +340,18 @@ void KisNodeManager::setup(KActionCollection * actionCollection, KisActionManage
action = actionManager->createAction("isolate_layer");
connect(action, SIGNAL(triggered(bool)), this, SLOT(toggleIsolateMode(bool)));
action = actionManager->createAction("toggle_layer_lock");
connect(action, SIGNAL(triggered()), this, SLOT(toggleLock()));
action = actionManager->createAction("toggle_layer_visibility");
connect(action, SIGNAL(triggered()), this, SLOT(toggleVisibility()));
action = actionManager->createAction("toggle_layer_alpha_lock");
connect(action, SIGNAL(triggered()), this, SLOT(toggleAlphaLock()));
action = actionManager->createAction("toggle_layer_inherit_alpha");
connect(action, SIGNAL(triggered()), this, SLOT(toggleInheritAlpha()));
action = actionManager->createAction("split_alpha_into_mask");
connect(action, SIGNAL(triggered()), this, SLOT(slotSplitAlphaIntoMask()));
......@@ -1131,6 +1143,74 @@ void KisNodeManager::slotSplitAlphaSaveMerged()
m_d->mergeTransparencyMaskAsAlpha(false);
}
void KisNodeManager::toggleLock()
{
KisNodeList nodes = this->selectedNodes();
KisNodeSP active = activeNode();
if (nodes.isEmpty() || !active) return;
bool isLocked = active->userLocked();
for (auto &node : nodes) {
node->setUserLocked(!isLocked);
}
}
void KisNodeManager::toggleVisibility()
{
KisNodeList nodes = this->selectedNodes();
KisNodeSP active = activeNode();
if (nodes.isEmpty() || !active) return;
bool isVisible = active->visible();
for (auto &node : nodes) {
node->setVisible(!isVisible);
node->setDirty();
}
}
void KisNodeManager::toggleAlphaLock()
{
KisNodeList nodes = this->selectedNodes();
KisNodeSP active = activeNode();
if (nodes.isEmpty() || !active) return;
auto layer = qobject_cast<KisPaintLayer*>(active.data());
if (!layer) {
return;
}
bool isAlphaLocked = layer->alphaLocked();
for (auto &node : nodes) {
auto layer = qobject_cast<KisPaintLayer*>(node.data());
if (layer) {
layer->setAlphaLocked(!isAlphaLocked);
}
}
}
void KisNodeManager::toggleInheritAlpha()
{
KisNodeList nodes = this->selectedNodes();
KisNodeSP active = activeNode();
if (nodes.isEmpty() || !active) return;
auto layer = qobject_cast<KisLayer*>(active.data());
if (!layer) {
return;
}
bool isAlphaDisabled = layer->alphaChannelDisabled();
for (auto &node : nodes) {
auto layer = qobject_cast<KisLayer*>(node.data());
if (layer) {
layer->disableAlphaChannel(!isAlphaDisabled);
node->setDirty();
}
}
}
void KisNodeManager::cutLayersToClipboard()
{
KisNodeList nodes = this->selectedNodes();
......
......@@ -200,6 +200,11 @@ public Q_SLOTS:
void slotSplitAlphaWrite();
void slotSplitAlphaSaveMerged();
void toggleLock();
void toggleVisibility();
void toggleAlphaLock();
void toggleInheritAlpha();
/**
* @brief slotSetSelectedNodes set the list of nodes selected in the layerbox. Selected nodes are not necessarily active nodes.
* @param nodes the selected nodes
......
......@@ -564,6 +564,11 @@ void KisLayerBox::slotContextMenuRequested(const QPoint &pos, const QModelIndex
addActionToMenu(groupMenu, "create_quick_group");
addActionToMenu(groupMenu, "create_quick_clipping_group");
addActionToMenu(groupMenu, "quick_ungroup");
QMenu *locksMenu = menu.addMenu(i18n("&Locks && visibility"));
addActionToMenu(locksMenu, "toggle_layer_lock");
addActionToMenu(locksMenu, "toggle_layer_visibility");
addActionToMenu(locksMenu, "toggle_layer_alpha_lock");
addActionToMenu(locksMenu, "toggle_layer_inherit_alpha");
if (singleLayer) {
QMenu *addLayerMenu = menu.addMenu(i18n("&Add"));
......
Markdown is supported
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