[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [calligra/krita-chili-kazakov] krita/plugins/tools/tool_transform2: Let liquify transform tool save 
From:       Dmitry Kazakov <dimula73 () gmail ! com>
Date:       2014-10-17 11:29:40
Message-ID: E1Xf5j2-0007RF-TO () scm ! kde ! org
[Download RAW message or body]

Git commit cff8b16e3864d08fa3c02dd2ce3014a7f6432c9d by Dmitry Kazakov.
Committed on 15/10/2014 at 11:08.
Pushed by dkazakov into branch 'krita-chili-kazakov'.

Let liquify transform tool save the values of the options into the config file

M  +1    -0    krita/plugins/tools/tool_transform2/CMakeLists.txt
M  +4    -2    krita/plugins/tools/tool_transform2/kis_liquify_paint_helper.cpp
M  +5    -5    krita/plugins/tools/tool_transform2/kis_liquify_paint_helper.h
M  +23   -18   krita/plugins/tools/tool_transform2/kis_liquify_paintop.cpp
M  +5    -4    krita/plugins/tools/tool_transform2/kis_liquify_paintop.h
A  +77   -0    krita/plugins/tools/tool_transform2/kis_liquify_properties.cpp     \
[License: GPL (v2+)] A  +108  -0    \
krita/plugins/tools/tool_transform2/kis_liquify_properties.h     [License: GPL (v2+)] \
M  +4    -0    krita/plugins/tools/tool_transform2/kis_tool_transform.cc M  +30   -27 \
krita/plugins/tools/tool_transform2/kis_tool_transform_config_widget.cpp M  +6    -0  \
krita/plugins/tools/tool_transform2/tool_transform_args.cc M  +6    -84   \
krita/plugins/tools/tool_transform2/tool_transform_args.h

http://commits.kde.org/calligra/cff8b16e3864d08fa3c02dd2ce3014a7f6432c9d

diff --git a/krita/plugins/tools/tool_transform2/CMakeLists.txt \
b/krita/plugins/tools/tool_transform2/CMakeLists.txt index 171ef7b..075f606 100644
--- a/krita/plugins/tools/tool_transform2/CMakeLists.txt
+++ b/krita/plugins/tools/tool_transform2/CMakeLists.txt
@@ -10,6 +10,7 @@ set(kritatooltransform_PART_SRCS
     kis_liquify_transform_strategy.cpp
     kis_liquify_paint_helper.cpp
     kis_liquify_paintop.cpp
+    kis_liquify_properties.cpp
     kis_free_transform_strategy.cpp
     kis_free_transform_strategy_gsl_helpers.cpp
     kis_perspective_transform_strategy.cpp
diff --git a/krita/plugins/tools/tool_transform2/kis_liquify_paint_helper.cpp \
b/krita/plugins/tools/tool_transform2/kis_liquify_paint_helper.cpp index \
                7b327ed..0502b6b 100644
--- a/krita/plugins/tools/tool_transform2/kis_liquify_paint_helper.cpp
+++ b/krita/plugins/tools/tool_transform2/kis_liquify_paint_helper.cpp
@@ -25,6 +25,8 @@
 #include "kis_paintop_utils.h"
 #include "kis_coordinates_converter.h"
 #include "kis_liquify_paintop.h"
+#include "kis_liquify_properties.h"
+
 #include "kis_paintop_utils.h"
 
 
@@ -72,7 +74,7 @@ void KisLiquifyPaintHelper::Private::updatePreviousPaintInfo(const \
KisPaintInfor  previousPaintInfo = info;
 }
 
-QPainterPath KisLiquifyPaintHelper::brushOutline(const \
ToolTransformArgs::LiquifyProperties &props) const +QPainterPath \
KisLiquifyPaintHelper::brushOutline(const KisLiquifyProperties &props) const  {
     KisPaintInformation::DistanceInformationRegistrar registrar =
         m_d->previousPaintInfo.registerDistanceInformation(&m_d->previousDistanceInfo);
 @@ -80,7 +82,7 @@ QPainterPath KisLiquifyPaintHelper::brushOutline(const \
                ToolTransformArgs::Liquif
     return KisLiquifyPaintop::brushOutline(props, m_d->previousPaintInfo);
 }
 
-void KisLiquifyPaintHelper::configurePaintOp(const \
ToolTransformArgs::LiquifyProperties &props, +void \
                KisLiquifyPaintHelper::configurePaintOp(const KisLiquifyProperties \
                &props,
                                              KisLiquifyTransformWorker *worker)
 {
     m_d->paintOp.reset(new KisLiquifyPaintop(props, worker));
diff --git a/krita/plugins/tools/tool_transform2/kis_liquify_paint_helper.h \
b/krita/plugins/tools/tool_transform2/kis_liquify_paint_helper.h index \
                e02e93a..2b38230 100644
--- a/krita/plugins/tools/tool_transform2/kis_liquify_paint_helper.h
+++ b/krita/plugins/tools/tool_transform2/kis_liquify_paint_helper.h
@@ -21,13 +21,13 @@
 
 #include <QScopedPointer>
 
-// FIXME: for liquifyprops only
-#include "tool_transform_args.h"
-
 class KisPaintInformation;
 class KisLiquifyTransformWorker;
 class KisCoordinatesConverter;
 class KoPointerEvent;
+class KisLiquifyProperties;
+class QPainterPath;
+
 
 class KisLiquifyPaintHelper
 {
@@ -35,7 +35,7 @@ public:
     KisLiquifyPaintHelper(const KisCoordinatesConverter *converter);
     ~KisLiquifyPaintHelper();
 
-    void configurePaintOp(const ToolTransformArgs::LiquifyProperties &_props,
+    void configurePaintOp(const KisLiquifyProperties &_props,
                           KisLiquifyTransformWorker *worker);
 
     void startPaint(KoPointerEvent *event);
@@ -44,7 +44,7 @@ public:
 
     void hoverPaint(KoPointerEvent *event);
 
-    QPainterPath brushOutline(const ToolTransformArgs::LiquifyProperties &props) \
const; +    QPainterPath brushOutline(const KisLiquifyProperties &props) const;
 
 private:
     struct Private;
diff --git a/krita/plugins/tools/tool_transform2/kis_liquify_paintop.cpp \
b/krita/plugins/tools/tool_transform2/kis_liquify_paintop.cpp index a1a2391..478dc73 \
                100644
--- a/krita/plugins/tools/tool_transform2/kis_liquify_paintop.cpp
+++ b/krita/plugins/tools/tool_transform2/kis_liquify_paintop.cpp
@@ -18,21 +18,26 @@
 
 #include "kis_liquify_paintop.h"
 
+#include <QPainterPath>
+#include <QTransform>
+
+
 #include "kis_paint_information.h"
 #include "kis_liquify_transform_worker.h"
 #include "kis_algebra_2d.h"
+#include "kis_liquify_properties.h"
 
 
 struct KisLiquifyPaintop::Private
 {
-    Private(const ToolTransformArgs::LiquifyProperties &_props, \
KisLiquifyTransformWorker *_worker) +    Private(const KisLiquifyProperties &_props, \
KisLiquifyTransformWorker *_worker)  : props(_props), worker(_worker) {}
 
-    ToolTransformArgs::LiquifyProperties props;
+    KisLiquifyProperties props;
     KisLiquifyTransformWorker *worker;
 };
 
-KisLiquifyPaintop::KisLiquifyPaintop(const ToolTransformArgs::LiquifyProperties \
&props, KisLiquifyTransformWorker *worker) \
+KisLiquifyPaintop::KisLiquifyPaintop(const KisLiquifyProperties &props, \
KisLiquifyTransformWorker *worker)  : m_d(new Private(props, worker))
 {
 }
@@ -41,7 +46,7 @@ KisLiquifyPaintop::~KisLiquifyPaintop()
 {
 }
 
-QPainterPath KisLiquifyPaintop::brushOutline(const \
ToolTransformArgs::LiquifyProperties &props, +QPainterPath \
                KisLiquifyPaintop::brushOutline(const KisLiquifyProperties &props,
                                              const KisPaintInformation &info)
 {
     const qreal diameter = props.size();
@@ -51,11 +56,11 @@ QPainterPath KisLiquifyPaintop::brushOutline(const \
ToolTransformArgs::LiquifyPro  outline.addEllipse(-0.5 * diameter, -0.5 * diameter,
                        diameter, diameter);
 
-    switch (props.currentMode()) {
-    case ToolTransformArgs::LiquifyProperties::MOVE:
-    case ToolTransformArgs::LiquifyProperties::SCALE:
+    switch (props.mode()) {
+    case KisLiquifyProperties::MOVE:
+    case KisLiquifyProperties::SCALE:
         break;
-    case ToolTransformArgs::LiquifyProperties::ROTATE: {
+    case KisLiquifyProperties::ROTATE: {
         QPainterPath p;
         p.lineTo(-3.0, 4.0);
         p.moveTo(0.0, 0.0);
@@ -75,7 +80,7 @@ QPainterPath KisLiquifyPaintop::brushOutline(const \
ToolTransformArgs::LiquifyPro  
         break;
     }
-    case ToolTransformArgs::LiquifyProperties::OFFSET: {
+    case KisLiquifyProperties::OFFSET: {
         qreal normalAngle = info.drawingAngle() + reverseCoeff * 0.5 * M_PI;
 
         QPainterPath p = KisAlgebra2D::smallArrow();
@@ -91,7 +96,7 @@ QPainterPath KisLiquifyPaintop::brushOutline(const \
ToolTransformArgs::LiquifyPro  
         break;
     }
-    case ToolTransformArgs::LiquifyProperties::UNDO:
+    case KisLiquifyProperties::UNDO:
         break;
     }
 
@@ -109,8 +114,8 @@ KisSpacingInformation KisLiquifyPaintop::paintAt(const \
KisPaintInformation &pi)  const qreal spacing = m_d->props.spacing() * size;
 
     const qreal reverseCoeff =
-        m_d->props.currentMode() !=
-        ToolTransformArgs::LiquifyProperties::UNDO &&
+        m_d->props.mode() !=
+        KisLiquifyProperties::UNDO &&
         m_d->props.reverseDirection() ? -1.0 : 1.0;
     const qreal amount = m_d->props.amountHasPressure() ?
         pi.pressure() * reverseCoeff * m_d->props.amount():
@@ -118,8 +123,8 @@ KisSpacingInformation KisLiquifyPaintop::paintAt(const \
KisPaintInformation &pi)  
 
 
-    switch (m_d->props.currentMode()) {
-    case ToolTransformArgs::LiquifyProperties::MOVE: {
+    switch (m_d->props.mode()) {
+    case KisLiquifyProperties::MOVE: {
         const qreal offsetLength = size * amount;
         m_d->worker->translatePoints(pi.pos(),
                                      pi.drawingDirectionVector() * offsetLength,
@@ -127,24 +132,24 @@ KisSpacingInformation KisLiquifyPaintop::paintAt(const \
KisPaintInformation &pi)  
         break;
     }
-    case ToolTransformArgs::LiquifyProperties::SCALE:
+    case KisLiquifyProperties::SCALE:
         m_d->worker->scalePoints(pi.pos(),
                                  amount,
                                  size);
         break;
-    case ToolTransformArgs::LiquifyProperties::ROTATE:
+    case KisLiquifyProperties::ROTATE:
         m_d->worker->rotatePoints(pi.pos(),
                                   2.0 * M_PI * amount,
                                   size);
         break;
-    case ToolTransformArgs::LiquifyProperties::OFFSET: {
+    case KisLiquifyProperties::OFFSET: {
         const qreal offsetLength = size * amount;
         m_d->worker->translatePoints(pi.pos(),
                                      \
KisAlgebra2D::rightUnitNormal(pi.drawingDirectionVector()) * offsetLength,  size);
         break;
     }
-    case ToolTransformArgs::LiquifyProperties::UNDO:
+    case KisLiquifyProperties::UNDO:
         m_d->worker->undoPoints(pi.pos(),
                                 amount,
                                 size);
diff --git a/krita/plugins/tools/tool_transform2/kis_liquify_paintop.h \
b/krita/plugins/tools/tool_transform2/kis_liquify_paintop.h index 46b6575..d57d05b \
                100644
--- a/krita/plugins/tools/tool_transform2/kis_liquify_paintop.h
+++ b/krita/plugins/tools/tool_transform2/kis_liquify_paintop.h
@@ -21,22 +21,23 @@
 
 #include <QScopedPointer>
 
-#include "tool_transform_args.h"
-
 class KisLiquifyTransformWorker;
 class KisPaintInformation;
 class KisSpacingInformation;
+class KisLiquifyProperties;
+class QPainterPath;
+
 
 class KisLiquifyPaintop
 {
 public:
-    KisLiquifyPaintop(const ToolTransformArgs::LiquifyProperties &props,
+    KisLiquifyPaintop(const KisLiquifyProperties &props,
                       KisLiquifyTransformWorker *worker);
     ~KisLiquifyPaintop();
 
     KisSpacingInformation paintAt(const KisPaintInformation &pi);
 
-    static QPainterPath brushOutline(const ToolTransformArgs::LiquifyProperties \
&props, +    static QPainterPath brushOutline(const KisLiquifyProperties &props,
                                      const KisPaintInformation &info);
 
 private:
diff --git a/krita/plugins/tools/tool_transform2/kis_liquify_properties.cpp \
b/krita/plugins/tools/tool_transform2/kis_liquify_properties.cpp new file mode 100644
index 0000000..ad497fe
--- /dev/null
+++ b/krita/plugins/tools/tool_transform2/kis_liquify_properties.cpp
@@ -0,0 +1,77 @@
+/*
+ *  Copyright (c) 2014 Dmitry Kazakov <dimula73@gmail.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "kis_liquify_properties.h"
+
+#include <kglobal.h>
+#include <kglobalsettings.h>
+#include <kconfig.h>
+#include <kconfiggroup.h>
+#include "kis_debug.h"
+
+
+QString liquifyModeString(KisLiquifyProperties::LiquifyMode mode)
+{
+    QString result;
+
+    switch (mode) {
+    case KisLiquifyProperties::MOVE:
+        result = "Move";
+        break;
+    case KisLiquifyProperties::SCALE:
+        result = "Scale";
+        break;
+    case KisLiquifyProperties::ROTATE:
+        result = "Rotate";
+        break;
+    case KisLiquifyProperties::OFFSET:
+        result = "Offset";
+        break;
+    case KisLiquifyProperties::UNDO:
+        result = "Undo";
+        break;
+    }
+
+    return QString("LiquifyTool/%1").arg(result);
+}
+
+void KisLiquifyProperties::saveMode() const
+{
+    KConfigGroup cfg =
+        KGlobal::config()->group(liquifyModeString(m_mode));
+
+    cfg.writeEntry("size", m_size);
+    cfg.writeEntry("amount", m_amount);
+    cfg.writeEntry("spacing", m_spacing);
+    cfg.writeEntry("sizeHasPressure", m_sizeHasPressure);
+    cfg.writeEntry("amountHasPressure", m_amountHasPressure);
+    cfg.writeEntry("reverseDirection", m_reverseDirection);
+}
+
+void KisLiquifyProperties::loadMode()
+{
+    KConfigGroup cfg =
+        KGlobal::config()->group(liquifyModeString(m_mode));
+
+    m_size = cfg.readEntry("size", m_size);
+    m_amount = cfg.readEntry("amount", m_amount);
+    m_spacing = cfg.readEntry("spacing", m_spacing);
+    m_sizeHasPressure = cfg.readEntry("sizeHasPressure", m_sizeHasPressure);
+    m_amountHasPressure = cfg.readEntry("amountHasPressure", m_amountHasPressure);
+    m_reverseDirection = cfg.readEntry("reverseDirection", m_reverseDirection);
+}
diff --git a/krita/plugins/tools/tool_transform2/kis_liquify_properties.h \
b/krita/plugins/tools/tool_transform2/kis_liquify_properties.h new file mode 100644
index 0000000..0eea8f1
--- /dev/null
+++ b/krita/plugins/tools/tool_transform2/kis_liquify_properties.h
@@ -0,0 +1,108 @@
+/*
+ *  Copyright (c) 2014 Dmitry Kazakov <dimula73@gmail.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef __KIS_LIQUIFY_PROPERTIES_H
+#define __KIS_LIQUIFY_PROPERTIES_H
+
+#include <QtGlobal>
+
+
+class KisLiquifyProperties {
+public:
+    enum LiquifyMode {
+        MOVE,
+        SCALE,
+        ROTATE,
+        OFFSET,
+        UNDO
+    };
+
+    KisLiquifyProperties()
+        : m_mode(MOVE),
+          m_size(50),
+          m_amount(0.2),
+          m_spacing(0.2),
+          m_sizeHasPressure(false),
+          m_amountHasPressure(false),
+          m_reverseDirection(false)
+    {
+    }
+
+    LiquifyMode mode() const {
+        return m_mode;
+    }
+    void setMode(LiquifyMode value) {
+        m_mode = value;
+    }
+
+    qreal size() const {
+        return m_size;
+    }
+    void setSize(qreal value) {
+        m_size = value;
+    }
+
+    qreal amount() const {
+        return m_amount;
+    }
+    void setAmount(qreal value) {
+        m_amount = value;
+    }
+
+    qreal spacing() const {
+        return m_spacing;
+    }
+    void setSpacing(qreal value) {
+        m_spacing = value;
+    }
+
+    bool sizeHasPressure() const {
+        return m_sizeHasPressure;
+    }
+    void setSizeHasPressure(bool value) {
+        m_sizeHasPressure = value;
+    }
+
+    bool amountHasPressure() const {
+        return m_amountHasPressure;
+    }
+    void setAmountHasPressure(bool value) {
+        m_amountHasPressure = value;
+    }
+
+    bool reverseDirection() const {
+        return m_reverseDirection;
+    }
+    void setReverseDirection(bool value) {
+        m_reverseDirection = value;
+    }
+
+    void saveMode() const;
+    void loadMode();
+
+private:
+    LiquifyMode m_mode;
+    qreal m_size;
+    qreal m_amount;
+    qreal m_spacing;
+    bool m_sizeHasPressure;
+    bool m_amountHasPressure;
+    bool m_reverseDirection;
+};
+
+#endif /* __KIS_LIQUIFY_PROPERTIES_H */
diff --git a/krita/plugins/tools/tool_transform2/kis_tool_transform.cc \
b/krita/plugins/tools/tool_transform2/kis_tool_transform.cc index 74de208..9a0f930 \
                100644
--- a/krita/plugins/tools/tool_transform2/kis_tool_transform.cc
+++ b/krita/plugins/tools/tool_transform2/kis_tool_transform.cc
@@ -908,6 +908,10 @@ void KisToolTransform::slotUiChangedConfig()
 
     currentStrategy()->externalConfigChanged();
 
+    if (m_currentArgs.mode() == ToolTransformArgs::LIQUIFY) {
+        m_currentArgs.saveLiquifyTransformMode();
+    }
+
     outlineChanged();
     updateApplyResetAvailability();
 }
diff --git a/krita/plugins/tools/tool_transform2/kis_tool_transform_config_widget.cpp \
b/krita/plugins/tools/tool_transform2/kis_tool_transform_config_widget.cpp index \
                0c2f5db..eada719 100644
--- a/krita/plugins/tools/tool_transform2/kis_tool_transform_config_widget.cpp
+++ b/krita/plugins/tools/tool_transform2/kis_tool_transform_config_widget.cpp
@@ -22,6 +22,7 @@
 #include "rotation_icons.h"
 #include "kis_canvas2.h"
 #include <QSignalMapper>
+#include "kis_liquify_properties.h"
 
 
 template<typename T> inline T sign(T x) {
@@ -167,11 +168,11 @@ \
                KisToolTransformConfigWidget::KisToolTransformConfigWidget(TransformTransactionP
                
     connect(liquifyRotate, SIGNAL(toggled(bool)), liquifyModeMapper, SLOT(map()));
     connect(liquifyOffset, SIGNAL(toggled(bool)), liquifyModeMapper, SLOT(map()));
     connect(liquifyUndo, SIGNAL(toggled(bool)), liquifyModeMapper, SLOT(map()));
-    liquifyModeMapper->setMapping(liquifyMove, \
                (int)ToolTransformArgs::LiquifyProperties::MOVE);
-    liquifyModeMapper->setMapping(liquifyScale, \
                (int)ToolTransformArgs::LiquifyProperties::SCALE);
-    liquifyModeMapper->setMapping(liquifyRotate, \
                (int)ToolTransformArgs::LiquifyProperties::ROTATE);
-    liquifyModeMapper->setMapping(liquifyOffset, \
                (int)ToolTransformArgs::LiquifyProperties::OFFSET);
-    liquifyModeMapper->setMapping(liquifyUndo, \
(int)ToolTransformArgs::LiquifyProperties::UNDO); +    \
liquifyModeMapper->setMapping(liquifyMove, (int)KisLiquifyProperties::MOVE); +    \
liquifyModeMapper->setMapping(liquifyScale, (int)KisLiquifyProperties::SCALE); +    \
liquifyModeMapper->setMapping(liquifyRotate, (int)KisLiquifyProperties::ROTATE); +    \
liquifyModeMapper->setMapping(liquifyOffset, (int)KisLiquifyProperties::OFFSET); +    \
                liquifyModeMapper->setMapping(liquifyUndo, \
                (int)KisLiquifyProperties::UNDO);
     connect(liquifyModeMapper, SIGNAL(mapped(int)), \
SLOT(slotLiquifyModeChanged(int)));  
     liquifyMove->setToolTip(i18nc("@info:tooltip", "Drag the image along the brush \
stroke")); @@ -260,7 +261,7 @@ void \
KisToolTransformConfigWidget::updateLiquifyControls()  blockUiSlots();
 
     ToolTransformArgs *config = m_transaction->currentConfig();
-    ToolTransformArgs::LiquifyProperties *props =
+    KisLiquifyProperties *props =
         config->liquifyProperties();
 
     liquifySizeSlider->setValue(props->size());
@@ -271,11 +272,11 @@ void KisToolTransformConfigWidget::updateLiquifyControls()
     liquifyReverseDirectionChk->setChecked(props->reverseDirection());
 
 
-    ToolTransformArgs::LiquifyProperties::LiquifyMode mode =
-        static_cast<ToolTransformArgs::LiquifyProperties::LiquifyMode>(props->currentMode());
 +    KisLiquifyProperties::LiquifyMode mode =
+        static_cast<KisLiquifyProperties::LiquifyMode>(props->mode());
 
     bool canInverseDirection =
-        mode != ToolTransformArgs::LiquifyProperties::UNDO;
+        mode != KisLiquifyProperties::UNDO;
 
     liquifyReverseDirectionChk->setEnabled(canInverseDirection);
 
@@ -288,15 +289,17 @@ void KisToolTransformConfigWidget::slotLiquifyModeChanged(int \
value)  
     ToolTransformArgs *config = m_transaction->currentConfig();
 
-    ToolTransformArgs::LiquifyProperties *props =
+    KisLiquifyProperties *props =
         config->liquifyProperties();
 
-    ToolTransformArgs::LiquifyProperties::LiquifyMode mode =
-        static_cast<ToolTransformArgs::LiquifyProperties::LiquifyMode>(value);
+    KisLiquifyProperties::LiquifyMode mode =
+        static_cast<KisLiquifyProperties::LiquifyMode>(value);
 
-    if (mode == props->currentMode()) return;
+    if (mode == props->mode()) return;
+
+    props->setMode(mode);
+    props->loadMode();
 
-    props->setCurrentMode(mode);
     updateLiquifyControls();
 
     notifyConfigChanged();
@@ -307,7 +310,7 @@ void KisToolTransformConfigWidget::liquifySizeChanged(qreal \
value)  if (m_uiSlotsBlocked) return;
 
     ToolTransformArgs *config = m_transaction->currentConfig();
-    ToolTransformArgs::LiquifyProperties *props =
+    KisLiquifyProperties *props =
         config->liquifyProperties();
 
     props->setSize(value);
@@ -319,7 +322,7 @@ void KisToolTransformConfigWidget::liquifyAmountChanged(qreal \
value)  if (m_uiSlotsBlocked) return;
 
     ToolTransformArgs *config = m_transaction->currentConfig();
-    ToolTransformArgs::LiquifyProperties *props =
+    KisLiquifyProperties *props =
         config->liquifyProperties();
 
     props->setAmount(value);
@@ -331,7 +334,7 @@ void KisToolTransformConfigWidget::liquifySpacingChanged(qreal \
value)  if (m_uiSlotsBlocked) return;
 
     ToolTransformArgs *config = m_transaction->currentConfig();
-    ToolTransformArgs::LiquifyProperties *props =
+    KisLiquifyProperties *props =
         config->liquifyProperties();
 
     props->setSpacing(value);
@@ -343,7 +346,7 @@ void \
KisToolTransformConfigWidget::liquifySizePressureChanged(bool value)  if \
(m_uiSlotsBlocked) return;  
     ToolTransformArgs *config = m_transaction->currentConfig();
-    ToolTransformArgs::LiquifyProperties *props =
+    KisLiquifyProperties *props =
         config->liquifyProperties();
 
     props->setSizeHasPressure(value);
@@ -355,7 +358,7 @@ void \
KisToolTransformConfigWidget::liquifyAmountPressureChanged(bool value)  if \
(m_uiSlotsBlocked) return;  
     ToolTransformArgs *config = m_transaction->currentConfig();
-    ToolTransformArgs::LiquifyProperties *props =
+    KisLiquifyProperties *props =
         config->liquifyProperties();
 
     props->setAmountHasPressure(value);
@@ -367,7 +370,7 @@ void \
KisToolTransformConfigWidget::liquifyReverseDirectionChanged(bool value)  if \
(m_uiSlotsBlocked) return;  
     ToolTransformArgs *config = m_transaction->currentConfig();
-    ToolTransformArgs::LiquifyProperties *props =
+    KisLiquifyProperties *props =
         config->liquifyProperties();
 
     props->setReverseDirection(value);
@@ -451,23 +454,23 @@ void KisToolTransformConfigWidget::updateConfig(const \
ToolTransformArgs &config)  stackedWidget->setCurrentIndex(3);
         liquifyButton->setChecked(true);
 
-        const ToolTransformArgs::LiquifyProperties *props =
+        const KisLiquifyProperties *props =
             config.liquifyProperties();
 
-        switch (props->currentMode()) {
-        case ToolTransformArgs::LiquifyProperties::MOVE:
+        switch (props->mode()) {
+        case KisLiquifyProperties::MOVE:
             liquifyMove->setChecked(true);
             break;
-        case ToolTransformArgs::LiquifyProperties::SCALE:
+        case KisLiquifyProperties::SCALE:
             liquifyScale->setChecked(true);
             break;
-        case ToolTransformArgs::LiquifyProperties::ROTATE:
+        case KisLiquifyProperties::ROTATE:
             liquifyRotate->setChecked(true);
             break;
-        case ToolTransformArgs::LiquifyProperties::OFFSET:
+        case KisLiquifyProperties::OFFSET:
             liquifyOffset->setChecked(true);
             break;
-        case ToolTransformArgs::LiquifyProperties::UNDO:
+        case KisLiquifyProperties::UNDO:
             liquifyUndo->setChecked(true);
             break;
         }
diff --git a/krita/plugins/tools/tool_transform2/tool_transform_args.cc \
b/krita/plugins/tools/tool_transform2/tool_transform_args.cc index 4718a4a..397d6ff \
                100644
--- a/krita/plugins/tools/tool_transform2/tool_transform_args.cc
+++ b/krita/plugins/tools/tool_transform2/tool_transform_args.cc
@@ -167,5 +167,11 @@ bool ToolTransformArgs::isIdentity() const
 void ToolTransformArgs::initLiquifyTransformMode(const QRect &srcRect)
 {
     m_liquifyWorker.reset(new KisLiquifyTransformWorker(srcRect, 0, 8));
+    m_liquifyProperties.loadMode();
+}
+
+void ToolTransformArgs::saveLiquifyTransformMode() const
+{
+    m_liquifyProperties.saveMode();
 }
 
diff --git a/krita/plugins/tools/tool_transform2/tool_transform_args.h \
b/krita/plugins/tools/tool_transform2/tool_transform_args.h index 4dc38a7..99b3952 \
                100644
--- a/krita/plugins/tools/tool_transform2/tool_transform_args.h
+++ b/krita/plugins/tools/tool_transform2/tool_transform_args.h
@@ -25,6 +25,8 @@
 #include <QVector3D>
 #include <kis_warptransform_worker.h>
 #include <kis_filter_strategy.h>
+#include "kis_liquify_properties.h"
+
 
 #include <QScopedPointer>
 class KisLiquifyTransformWorker;
@@ -243,96 +245,16 @@ public:
         m_editTransformPoints = value;
     }
 
-    class LiquifyProperties {
-    public:
-        enum LiquifyMode {
-            MOVE,
-            SCALE,
-            ROTATE,
-            OFFSET,
-            UNDO
-        };
-
-        LiquifyProperties()
-            : m_currentMode(MOVE),
-              m_size(50),
-              m_amount(1.0),
-              m_spacing(0.2),
-              m_sizeHasPressure(false),
-              m_amountHasPressure(false),
-              m_reverseDirection(false)
-        {
-        }
-
-        // rename to just 'mode'
-        LiquifyMode currentMode() const {
-            return m_currentMode;
-        }
-        void setCurrentMode(LiquifyMode value) {
-            m_currentMode = value;
-        }
-
-        qreal size() const {
-            return m_size;
-        }
-        void setSize(qreal value) {
-            m_size = value;
-        }
-
-        qreal amount() const {
-            return m_amount;
-        }
-        void setAmount(qreal value) {
-            m_amount = value;
-        }
-
-        qreal spacing() const {
-            return m_spacing;
-        }
-        void setSpacing(qreal value) {
-            m_spacing = value;
-        }
-
-        bool sizeHasPressure() const {
-            return m_sizeHasPressure;
-        }
-        void setSizeHasPressure(bool value) {
-            m_sizeHasPressure = value;
-        }
-
-        bool amountHasPressure() const {
-            return m_amountHasPressure;
-        }
-        void setAmountHasPressure(bool value) {
-            m_amountHasPressure = value;
-        }
-
-        bool reverseDirection() const {
-            return m_reverseDirection;
-        }
-        void setReverseDirection(bool value) {
-            m_reverseDirection = value;
-        }
-
-    private:
-        LiquifyMode m_currentMode;
-        qreal m_size;
-        qreal m_amount;
-        qreal m_spacing;
-        bool m_sizeHasPressure;
-        bool m_amountHasPressure;
-        bool m_reverseDirection;
-    };
-
-    const LiquifyProperties* liquifyProperties() const {
+    const KisLiquifyProperties* liquifyProperties() const {
         return &m_liquifyProperties;
     }
 
-    LiquifyProperties* liquifyProperties() {
+    KisLiquifyProperties* liquifyProperties() {
         return &m_liquifyProperties;
     }
 
     void initLiquifyTransformMode(const QRect &srcRect);
+    void saveLiquifyTransformMode() const;
 
     KisLiquifyTransformWorker* liquifyWorker() const {
         return m_liquifyWorker.data();
@@ -375,7 +297,7 @@ private:
 
     KisFilterStrategy *m_filter;
     bool m_editTransformPoints;
-    LiquifyProperties m_liquifyProperties;
+    KisLiquifyProperties m_liquifyProperties;
     QScopedPointer<KisLiquifyTransformWorker> m_liquifyWorker;
 };
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic