37#include <boost/operators.hpp>
59 setObjectName(
"tool_move");
69 specialSpacer->setObjectName(
"SpecialSpacer");
70 specialSpacer->setFixedSize(0, 0);
117 const bool canUseSelectionMode =
120 !
selection->selectedExactRect().isEmpty();
122 if (canUseSelectionMode) {
158 const bool canUseSelectionMode =
161 !
selection->selectedExactRect().isEmpty();
196 bool isMoveSelection =
false;
197 if (canUseSelectionMode) {
206 connect(moveStrategy,
207 SIGNAL(sigHandlesRectCalculated(
const QRect&)),
209 connect(moveStrategy,
210 SIGNAL(sigStrokeStartedEmpty()),
213 strategy = moveStrategy;
214 isMoveSelection =
true;
215 nodes = {paintLayer};
229 connect(moveStrategy,
230 SIGNAL(sigHandlesRectCalculated(
const QRect&)),
232 connect(moveStrategy,
233 SIGNAL(sigStrokeStartedEmpty()),
235 connect(moveStrategy,
239 strategy = moveStrategy;
244 KConfigGroup group = KSharedConfig::openConfig()->group(
toolId());
245 const bool forceLodMode = group.readEntry(
"forceLodMode",
false);
258 if (!isMoveSelection) {
287 if (showCoordinates && showFloatingMessage) {
291 i18nc(
"floating message in move tool",
292 "X: %1 px, Y: %2 px",
293 QLocale().toString(currentTopLeft.x()),
294 QLocale().toString(currentTopLeft.y())),
303 bool strokeEnded =
false;
319 if (lastState && *lastState == *newState)
return;
339 i18nc(
"floating message in move tool",
340 "Selected area has no pixels"),
354 if (nodes.isEmpty()) {
365 if (!
image())
return;
376 const QPoint offset =
377 direction ==
Up ? QPoint( 0, -moveStep) :
378 direction ==
Down ? QPoint( 0, moveStep) :
379 direction ==
Left ? QPoint(-moveStep, 0) :
380 QPoint( moveStep, 0) ;
436 QPainterPath handles;
563 qobject_cast<KisCanvas2*>(
canvas())->updateCanvas();
579 qobject_cast<KisCanvas2*>(
canvas())->updateCanvas();
605 qobject_cast<KisCanvas2*>(
canvas())->updateCanvas();
634 qobject_cast<KisCanvas2*>(
canvas())->updateCanvas();
707 qobject_cast<KisCanvas2*>(
canvas())->updateCanvas();
727 if (modifiers & Qt::ShiftModifier) {
732 if (modifiers & Qt::AltModifier) {
733 const qreal SCALE_FACTOR = .2;
734 move = SCALE_FACTOR * move;
797 SIGNAL(sigCalculationFinished(
const QRect&)),
825 actions << actionRegistry->
makeQAction(
"movetool-move-up",
this);
826 actions << actionRegistry->
makeQAction(
"movetool-move-down",
this);
827 actions << actionRegistry->
makeQAction(
"movetool-move-left",
this);
828 actions << actionRegistry->
makeQAction(
"movetool-move-right",
this);
829 actions << actionRegistry->
makeQAction(
"movetool-move-up-more",
this);
830 actions << actionRegistry->
makeQAction(
"movetool-move-down-more",
this);
831 actions << actionRegistry->
makeQAction(
"movetool-move-left-more",
this);
832 actions << actionRegistry->
makeQAction(
"movetool-move-right-more",
this);
833 actions << actionRegistry->
makeQAction(
"movetool-show-coordinates",
this);
QAction * makeQAction(const QString &name, QObject *parent=0)
static KisActionRegistry * instance()
void cancelUpdateStream()
void startUpdateStream(KisStrokesFacade *strokesFacade, KisStrokeId strokeId)
KisViewManager * viewManager() const
bool cancelStroke(KisStrokeId id) override
void addJob(KisStrokeId id, KisStrokeJobData *data) override
KisStrokeId startStroke(KisStrokeStrategy *strokeStrategy) override
QRect bounds() const override
void addSpontaneousJob(KisSpontaneousJob *spontaneousJob)
void endStroke(KisStrokeId id) override
KisNodeList selectedNodes
KisNodeList selectNodesToProcess() const
The KisResourcesSnapshot class takes a snapshot of the various resources like colors and settings use...
KisSelectionSP activeSelection() const
void addUniqueConnection(Sender sender, Signal signal, Receiver receiver, Method method)
void addConnection(Sender sender, Signal signal, Receiver receiver, Method method, Qt::ConnectionType type=Qt::AutoConnection)
void setForceLodModeIfPossible(bool forceLodModeIfPossible)
Qt::KeyboardModifiers modifiers() const
#define KIS_SAFE_ASSERT_RECOVER(cond)
#define KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE(cond, val)
#define KIS_SAFE_ASSERT_RECOVER_RETURN(cond)
PointType snapToClosestAxis(PointType P)
bool compareListsUnordered(const QList< T > &a, const QList< T > &b)
bool isEditable(bool checkVisibility=true) const