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) {
207 SIGNAL(sigHandlesRectCalculated(
const QRect&)),
210 SIGNAL(sigStrokeStartedEmpty()),
213 strategy = moveStrategy;
214 isMoveSelection =
true;
215 nodes = {paintLayer};
230 SIGNAL(sigHandlesRectCalculated(
const QRect&)),
233 SIGNAL(sigStrokeStartedEmpty()),
239 strategy = moveStrategy;
244 KConfigGroup group = KSharedConfig::openConfig()->group(
toolId());
245 const bool forceLodMode = group.readEntry(
"forceLodMode",
false);
258 if (!isMoveSelection) {
288 if (showCoordinates && showFloatingMessage) {
292 i18nc(
"floating message in move tool",
293 "X: %1 px, Y: %2 px",
294 QLocale().toString(currentTopLeft.x()),
295 QLocale().toString(currentTopLeft.y())),
304 bool strokeEnded =
false;
320 if (lastState && *lastState == *newState)
return;
340 i18nc(
"floating message in move tool",
341 "Selected area has no pixels"),
355 if (nodes.isEmpty()) {
366 if (!
image())
return;
377 const QPoint offset =
378 direction ==
Up ? QPoint( 0, -moveStep) :
379 direction ==
Down ? QPoint( 0, moveStep) :
380 direction ==
Left ? QPoint(-moveStep, 0) :
381 QPoint( moveStep, 0) ;
437 QPainterPath handles;
564 qobject_cast<KisCanvas2*>(
canvas())->updateCanvas();
580 qobject_cast<KisCanvas2*>(
canvas())->updateCanvas();
606 qobject_cast<KisCanvas2*>(
canvas())->updateCanvas();
635 qobject_cast<KisCanvas2*>(
canvas())->updateCanvas();
708 qobject_cast<KisCanvas2*>(
canvas())->updateCanvas();
728 if (modifiers & Qt::ShiftModifier) {
733 if (modifiers & Qt::AltModifier) {
734 const qreal SCALE_FACTOR = .2;
735 move = SCALE_FACTOR * move;
798 SIGNAL(sigCalculationFinished(
const QRect&)),
826 actions << actionRegistry->
makeQAction(
"movetool-move-up",
this);
827 actions << actionRegistry->
makeQAction(
"movetool-move-down",
this);
828 actions << actionRegistry->
makeQAction(
"movetool-move-left",
this);
829 actions << actionRegistry->
makeQAction(
"movetool-move-right",
this);
830 actions << actionRegistry->
makeQAction(
"movetool-move-up-more",
this);
831 actions << actionRegistry->
makeQAction(
"movetool-move-down-more",
this);
832 actions << actionRegistry->
makeQAction(
"movetool-move-left-more",
this);
833 actions << actionRegistry->
makeQAction(
"movetool-move-right-more",
this);
834 actions << actionRegistry->
makeQAction(
"movetool-show-coordinates",
this);
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
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