Commit 93faf98f authored by Srirupa Datta's avatar Srirupa Datta Committed by Dmitry Kazakov
Browse files

Remove work recursively button

All layers and groups work recursively now. To achieve  unrecursive
behaviour, lock the layer/mask.

GUI:
BUG: 429501
FIXED IN: 5.0.0
parent 30754f5f
......@@ -83,7 +83,6 @@
KisToolTransform::KisToolTransform(KoCanvasBase * canvas)
: KisTool(canvas, KisCursor::rotateCursor())
, m_workRecursively(true)
, m_warpStrategy(
new KisWarpTransformStrategy(
dynamic_cast<KisCanvas2*>(canvas)->coordinatesConverter(),
......@@ -845,11 +844,6 @@ void KisToolTransform::startStroke(ToolTransformArgs::TransformMode mode, bool f
return;
}
if (m_optionsWidget) {
m_workRecursively = m_optionsWidget->workRecursively() ||
!currentNode->paintDevice();
}
KisSelectionSP selection = resources->activeSelection();
/**
......@@ -873,7 +867,7 @@ void KisToolTransform::startStroke(ToolTransformArgs::TransformMode mode, bool f
KisStrokeStrategy *strategy = 0;
if (m_currentlyUsingOverlayPreviewStyle) {
TransformStrokeStrategy *transformStrategy = new TransformStrokeStrategy(mode, m_workRecursively, m_currentArgs.filterId(), forceReset, currentNode, selection, image().data(), image().data());
TransformStrokeStrategy *transformStrategy = new TransformStrokeStrategy(mode, m_currentArgs.filterId(), forceReset, currentNode, selection, image().data(), image().data());
connect(transformStrategy, SIGNAL(sigPreviewDeviceReady(KisPaintDeviceSP)), SLOT(slotPreviewDeviceGenerated(KisPaintDeviceSP)));
connect(transformStrategy, SIGNAL(sigTransactionGenerated(TransformTransactionProperties, ToolTransformArgs, void*)), SLOT(slotTransactionGenerated(TransformTransactionProperties, ToolTransformArgs, void*)));
strategy = transformStrategy;
......@@ -885,7 +879,7 @@ void KisToolTransform::startStroke(ToolTransformArgs::TransformMode mode, bool f
m_strokeStrategyCookie = transformStrategy;
} else {
InplaceTransformStrokeStrategy *transformStrategy = new InplaceTransformStrokeStrategy(mode, m_workRecursively, m_currentArgs.filterId(), forceReset, currentNode, selection, externalSource, image().data(), image().data(), image()->root(), m_forceLodMode);
InplaceTransformStrokeStrategy *transformStrategy = new InplaceTransformStrokeStrategy(mode, m_currentArgs.filterId(), forceReset, currentNode, selection, externalSource, image().data(), image().data(), image()->root(), m_forceLodMode);
connect(transformStrategy, SIGNAL(sigTransactionGenerated(TransformTransactionProperties, ToolTransformArgs, void*)), SLOT(slotTransactionGenerated(TransformTransactionProperties, ToolTransformArgs, void*)));
strategy = transformStrategy;
......@@ -1023,7 +1017,7 @@ void KisToolTransform::slotTrackerChangedConfig(KisToolChangesTrackerDataSP stat
updateOptionWidget();
}
QList<KisNodeSP> KisToolTransform::fetchNodesList(ToolTransformArgs::TransformMode mode, KisNodeSP root, bool recursive)
QList<KisNodeSP> KisToolTransform::fetchNodesList(ToolTransformArgs::TransformMode mode, KisNodeSP root, bool isExternalSourcePresent)
{
QList<KisNodeSP> result;
......@@ -1038,10 +1032,10 @@ QList<KisNodeSP> KisToolTransform::fetchNodesList(ToolTransformArgs::TransformMo
}
};
if (recursive) {
KisLayerUtils::recursiveApplyNodes(root, fetchFunc);
} else {
if (isExternalSourcePresent) {
fetchFunc(root);
} else {
KisLayerUtils::recursiveApplyNodes(root, fetchFunc);
}
return result;
......@@ -1050,8 +1044,8 @@ QList<KisNodeSP> KisToolTransform::fetchNodesList(ToolTransformArgs::TransformMo
QWidget* KisToolTransform::createOptionWidget()
{
if (!m_canvas) return 0;
m_optionsWidget = new KisToolTransformConfigWidget(&m_transaction, m_canvas, m_workRecursively, 0);
m_optionsWidget = new KisToolTransformConfigWidget(&m_transaction, m_canvas, 0);
Q_CHECK_PTR(m_optionsWidget);
m_optionsWidget->setObjectName(toolId() + " option widget");
......@@ -1104,7 +1098,7 @@ QWidget* KisToolTransform::createOptionWidget()
}
void KisToolTransform::updateOptionWidget()
{
{
if (!m_optionsWidget) return;
if (!currentNode()) {
......
......@@ -230,7 +230,7 @@ public Q_SLOTS:
void imageTooBigRequested(bool value);
private:
QList<KisNodeSP> fetchNodesList(ToolTransformArgs::TransformMode mode, KisNodeSP root, bool recursive);
QList<KisNodeSP> fetchNodesList(ToolTransformArgs::TransformMode mode, KisNodeSP root, bool isExternalSourcePresent);
QScopedPointer<QMenu> m_contextMenu;
void startStroke(ToolTransformArgs::TransformMode mode, bool forceReset);
......@@ -268,7 +268,6 @@ private:
bool m_preferOverlayPreviewStyle {false};
bool m_forceLodMode {false};
bool m_workRecursively {false};
QPainterPath m_selectionPath; // original (unscaled) selection outline, used for painting decorations
......
......@@ -24,7 +24,7 @@ template<typename T> inline T sign(T x) {
const int KisToolTransformConfigWidget::DEFAULT_POINTS_PER_LINE = 3;
KisToolTransformConfigWidget::KisToolTransformConfigWidget(TransformTransactionProperties *transaction, KisCanvas2 *canvas, bool workRecursively, QWidget *parent)
KisToolTransformConfigWidget::KisToolTransformConfigWidget(TransformTransactionProperties *transaction, KisCanvas2 *canvas, QWidget *parent)
: QWidget(parent),
m_transaction(transaction),
m_notificationsBlocked(0),
......@@ -32,15 +32,11 @@ KisToolTransformConfigWidget::KisToolTransformConfigWidget(TransformTransactionP
m_configChanged(false)
{
setupUi(this);
chkWorkRecursively->setIcon(KisIconUtils::loadIcon("krita_tool_transform_recursive"));
flipXButton->setIcon(KisIconUtils::loadIcon("transform_icons_mirror_x"));
flipYButton->setIcon(KisIconUtils::loadIcon("transform_icons_mirror_y"));
rotateCWButton->setIcon(KisIconUtils::loadIcon("transform_icons_rotate_cw"));
rotateCCWButton->setIcon(KisIconUtils::loadIcon("transform_icons_rotate_ccw"));
chkWorkRecursively->setChecked(workRecursively);
connect(chkWorkRecursively, SIGNAL(toggled(bool)), this, SIGNAL(sigRestartTransform()));
// Granularity can only be specified in the power of 2's
QStringList granularityValues{"4","8","16","32"};
changeGranularity->addItems(granularityValues);
......@@ -499,7 +495,7 @@ void KisToolTransformConfigWidget::liquifyReverseDirectionChanged(bool value)
void KisToolTransformConfigWidget::updateConfig(const ToolTransformArgs &config)
{
blockUiSlots();
if (config.mode() == ToolTransformArgs::FREE_TRANSFORM ||
config.mode() == ToolTransformArgs::PERSPECTIVE_4POINT) {
......@@ -670,11 +666,6 @@ void KisToolTransformConfigWidget::resetRotationCenterButtons()
}
}
bool KisToolTransformConfigWidget::workRecursively() const
{
return chkWorkRecursively->isChecked();
}
void KisToolTransformConfigWidget::setTooBigLabelVisible(bool value)
{
tooBigLabelWidget->setVisible(value);
......
......@@ -19,13 +19,12 @@ class KisToolTransformConfigWidget : public QWidget, private Ui::WdgToolTransfor
Q_OBJECT
public:
KisToolTransformConfigWidget(TransformTransactionProperties *transaction, KisCanvas2 *canvas, bool workRecursively, QWidget *parent);
KisToolTransformConfigWidget(TransformTransactionProperties *transaction, KisCanvas2 *canvas, QWidget *parent);
void setApplyResetDisabled(bool disabled);
void resetRotationCenterButtons();
void setDefaultWarpPoints(int pointsPerLine = -1);
void setTooBigLabelVisible(bool value);
bool workRecursively() const;
public Q_SLOTS:
void updateConfig(const ToolTransformArgs &config);
......
......@@ -609,7 +609,7 @@ KisNodeSP KisTransformUtils::tryOverrideRootToTransformMask(KisNodeSP root)
return root;
}
QList<KisNodeSP> KisTransformUtils::fetchNodesList(ToolTransformArgs::TransformMode mode, KisNodeSP root, bool recursive)
QList<KisNodeSP> KisTransformUtils::fetchNodesList(ToolTransformArgs::TransformMode mode, KisNodeSP root, bool isExternalSourcePresent)
{
QList<KisNodeSP> result;
......@@ -634,10 +634,10 @@ QList<KisNodeSP> KisTransformUtils::fetchNodesList(ToolTransformArgs::TransformM
}
};
if (recursive) {
KisLayerUtils::recursiveApplyNodes(root, fetchFunc);
} else {
if (isExternalSourcePresent) {
fetchFunc(root);
} else {
KisLayerUtils::recursiveApplyNodes(root, fetchFunc);
}
return result;
......
......@@ -182,7 +182,7 @@ public:
static KisNodeSP tryOverrideRootToTransformMask(KisNodeSP root);
static QList<KisNodeSP> fetchNodesList(ToolTransformArgs::TransformMode mode, KisNodeSP root, bool recursive);
static QList<KisNodeSP> fetchNodesList(ToolTransformArgs::TransformMode mode, KisNodeSP root, bool isExternalSourcePresent);
static bool tryInitArgsFromNode(KisNodeSP node, ToolTransformArgs *args);
static bool tryFetchArgsFromCommandAndUndo(ToolTransformArgs *outArgs, ToolTransformArgs::TransformMode mode, KisNodeSP currentNode, KisNodeList selectedNodes, KisStrokeUndoFacade *undoFacade, QVector<KisStrokeJobData *> *undoJobs, const KisSavedMacroCommand **overriddenCommand);
......
......@@ -54,7 +54,6 @@ struct InplaceTransformStrokeStrategy::Private
KisUpdatesFacade *updatesFacade;
KisStrokeUndoFacade *undoFacade;
ToolTransformArgs::TransformMode mode;
bool workRecursively;
QString filterId;
bool forceReset;
KisNodeSP rootNode;
......@@ -119,7 +118,6 @@ struct InplaceTransformStrokeStrategy::Private
InplaceTransformStrokeStrategy::InplaceTransformStrokeStrategy(ToolTransformArgs::TransformMode mode,
bool workRecursively,
const QString &filterId,
bool forceReset,
KisNodeSP rootNode,
......@@ -134,7 +132,6 @@ InplaceTransformStrokeStrategy::InplaceTransformStrokeStrategy(ToolTransformArgs
{
m_d->mode = mode;
m_d->workRecursively = workRecursively;
m_d->filterId = filterId;
m_d->forceReset = forceReset;
m_d->rootNode = rootNode;
......@@ -286,7 +283,7 @@ void InplaceTransformStrokeStrategy::initStrokeCallback()
m_d->rootNode = KisTransformUtils::tryOverrideRootToTransformMask(m_d->rootNode);
// When placing an external source image, we never work recursively on any layer masks
m_d->processedNodes = KisTransformUtils::fetchNodesList(m_d->mode, m_d->rootNode, m_d->workRecursively && !m_d->externalSource);
m_d->processedNodes = KisTransformUtils::fetchNodesList(m_d->mode, m_d->rootNode, m_d->externalSource);
bool argsAreInitialized = false;
QVector<KisStrokeJobData *> lastCommandUndoJobs;
......
......@@ -90,7 +90,6 @@ public:
public:
InplaceTransformStrokeStrategy(ToolTransformArgs::TransformMode mode,
bool workRecursively,
const QString &filterId,
bool forceReset,
KisNodeSP rootNode,
......
......@@ -44,7 +44,6 @@
TransformStrokeStrategy::TransformStrokeStrategy(ToolTransformArgs::TransformMode mode,
bool workRecursively,
const QString &filterId,
bool forceReset,
KisNodeSP rootNode,
......@@ -54,7 +53,6 @@ TransformStrokeStrategy::TransformStrokeStrategy(ToolTransformArgs::TransformMod
: KisStrokeStrategyUndoCommandBased(kundo2_i18n("Transform"), false, undoFacade),
m_updatesFacade(updatesFacade),
m_mode(mode),
m_workRecursively(workRecursively),
m_filterId(filterId),
m_forceReset(forceReset),
m_selection(selection)
......@@ -392,7 +390,8 @@ void TransformStrokeStrategy::initStrokeCallback()
}
ToolTransformArgs initialTransformArgs;
m_processedNodes = KisTransformUtils::fetchNodesList(m_mode, m_rootNode, m_workRecursively);
bool isExternalSourcePresent = false;
m_processedNodes = KisTransformUtils::fetchNodesList(m_mode, m_rootNode, isExternalSourcePresent);
bool argsAreInitialized = false;
QVector<KisStrokeJobData *> lastCommandUndoJobs;
......
......@@ -78,7 +78,6 @@ public:
public:
TransformStrokeStrategy(ToolTransformArgs::TransformMode mode,
bool workRecursively,
const QString &filterId,
bool forceReset,
KisNodeSP rootNode,
......@@ -118,7 +117,6 @@ private:
private:
KisUpdatesFacade *m_updatesFacade;
ToolTransformArgs::TransformMode m_mode;
bool m_workRecursively;
QString m_filterId;
bool m_forceReset;
......
......@@ -11,7 +11,7 @@
<x>0</x>
<y>0</y>
<width>515</width>
<height>724</height>
<height>780</height>
</rect>
</property>
<property name="sizePolicy">
......@@ -371,6 +371,12 @@
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
<item>
......@@ -565,6 +571,12 @@
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
......@@ -1173,6 +1185,9 @@
<height>16777215</height>
</size>
</property>
<property name="focusPolicy">
<enum>Qt::TabFocus</enum>
</property>
<property name="toolTip">
<string>Flip selection horizontally</string>
</property>
......@@ -2112,35 +2127,7 @@
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,1,0">
<item>
<widget class="QPushButton" name="chkWorkRecursively">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>32</width>
<height>16777215</height>
</size>
</property>
<property name="toolTip">
<string>Work Recursively</string>
</property>
<property name="text">
<string/>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="1,0">
<item>
<spacer name="horizontalSpacer_5">
<property name="orientation">
......@@ -2210,8 +2197,8 @@
<resources/>
<connections/>
<buttongroups>
<buttongroup name="cageTransformButtonGroup"/>
<buttongroup name="freeTransformRadioGroup"/>
<buttongroup name="buttonGroup"/>
<buttongroup name="cageTransformButtonGroup"/>
</buttongroups>
</ui>
Supports Markdown
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