SVN commit 1181987 by langkamp: fix interaction of move tool and move command with selection masks CCBUG:252463 M +8 -2 image/commands/kis_node_move_command.cpp M +3 -1 image/commands/kis_node_move_command.h M +6 -2 plugins/tools/defaulttools/kis_tool_move.cc --- trunk/koffice/krita/image/commands/kis_node_move_command.cpp #1181986:1181987 @@ -22,10 +22,12 @@ #include #include "kis_node.h" #include "commands/kis_node_move_command.h" +#include +#include -KisNodeMoveCommand::KisNodeMoveCommand(KisNodeSP node, const QPoint& oldpos, const QPoint& newpos) : - KisNodeCommand(i18n("Move"), node) +KisNodeMoveCommand::KisNodeMoveCommand(KisNodeSP node, const QPoint& oldpos, const QPoint& newpos, KisImageSP image) : + KisNodeCommand(i18n("Move"), node), m_image(image) { m_oldPos = oldpos; m_newPos = newpos; @@ -57,4 +59,8 @@ m_node->setY(pos.y()); m_node->setDirty(m_updateRect); + + if(m_image && m_node->inherits("KisSelectionMask")) { + m_image->undoAdapter()->emitSelectionChanged(); } +} --- trunk/koffice/krita/image/commands/kis_node_move_command.h #1181986:1181987 @@ -32,8 +32,9 @@ * @param node The node the command will be working on. * @param oldpos the old layer position * @param newpos the new layer position + * @param image image, only needed if the moved node is a selection mask and the image should be notified */ - KisNodeMoveCommand(KisNodeSP node, const QPoint& oldpos, const QPoint& newpos); + KisNodeMoveCommand(KisNodeSP node, const QPoint& oldpos, const QPoint& newpos, KisImageSP image = 0); virtual ~KisNodeMoveCommand(); virtual void redo(); @@ -46,6 +47,7 @@ QRect m_updateRect; QPoint m_oldPos; QPoint m_newPos; + KisImageSP m_image; }; --- trunk/koffice/krita/plugins/tools/defaulttools/kis_tool_move.cc #1181986:1181987 @@ -159,7 +159,7 @@ currentImage()->undoAdapter()->beginMacro(i18n("Move")); - if (selection && !selection->isTotallyUnselected(image->bounds()) && !selection->isDeselected()) { + if (selection && !selection->isTotallyUnselected(image->bounds()) && !selection->isDeselected() && !node->inherits("KisSelectionMask")) { // Create a temporary layer with the contents of the selection of the current layer. Q_ASSERT(!node->inherits("KisGroupLayer")); @@ -251,7 +251,7 @@ QPoint pos = convertToPixelCoord(event).toPoint(); drag(pos); - QUndoCommand *cmd = new KisNodeMoveCommand(m_selectedNode, m_layerStart, m_layerPosition); + QUndoCommand *cmd = new KisNodeMoveCommand(m_selectedNode, m_layerStart, m_layerPosition, currentImage()); Q_CHECK_PTR(cmd); canvas()->addCommand(cmd); @@ -281,6 +281,10 @@ m_layerPosition = QPoint(m_selectedNode->x(), m_selectedNode->y()); m_dragStart = original; + if (m_selectedNode->inherits("KisSelectionMask")) { + currentImage()->undoAdapter()->emitSelectionChanged(); + } + m_selectedNode->setDirty(rc); } }