[krita/krita/3.0.1] /: Fix Shift+gensture slowdown
Dmitry Kazakov
dimula73 at gmail.com
Thu Sep 15 13:48:32 UTC 2016
Git commit 8f2a13b9448a4aae775ce2b84a09ae53db5036d0 by Dmitry Kazakov.
Committed on 15/09/2016 at 11:56.
Pushed by dkazakov into branch 'krita/3.0.1'.
Fix Shift+gensture slowdown
Thsi is a really severe refactoring! I need your help with testing
is the paintop editor popup still works fine!
CC:kimageshop at kde.org
M +1 -0 libs/brush/CMakeLists.txt
M +3 -3 libs/brush/kis_abr_brush.cpp
M +2 -2 libs/brush/kis_abr_brush.h
M +2 -2 libs/brush/kis_abr_brush_collection.cpp
M +2 -2 libs/brush/kis_abr_brush_collection.h
M +12 -0 libs/brush/kis_auto_brush.cpp
M +3 -0 libs/brush/kis_auto_brush.h
M +3 -0 libs/brush/kis_brush.h
M +5 -5 libs/brush/kis_gbr_brush.cpp
M +2 -2 libs/brush/kis_gbr_brush.h
M +1 -1 libs/brush/kis_png_brush.cpp
M +2 -2 libs/brush/kis_png_brush.h
C +17 -14 libs/brush/kis_scaling_size_brush.cpp [from: plugins/paintops/experiment/kis_experiment_paintop_settings_widget.h - 058% similarity]
C +12 -11 libs/brush/kis_scaling_size_brush.h [from: plugins/paintops/experiment/kis_experiment_paintop_settings_widget.h - 059% similarity]
M +2 -2 libs/brush/kis_svg_brush.cpp
M +2 -2 libs/brush/kis_svg_brush.h
M +1 -1 libs/brush/kis_text_brush.cpp
M +2 -2 libs/brush/kis_text_brush.h
M +1 -0 libs/image/CMakeLists.txt
C +12 -14 libs/image/brushengine/kis_no_size_paintop_settings.cpp [from: plugins/paintops/experiment/kis_experiment_paintop_settings_widget.h - 058% similarity]
C +10 -11 libs/image/brushengine/kis_no_size_paintop_settings.h [from: plugins/paintops/experiment/kis_experiment_paintop_settings_widget.h - 059% similarity]
M +0 -9 libs/image/brushengine/kis_paintop_config_widget.cpp
M +0 -10 libs/image/brushengine/kis_paintop_config_widget.h
M +0 -32 libs/image/brushengine/kis_paintop_settings.cpp
M +2 -2 libs/image/brushengine/kis_paintop_settings.h
M +7 -0 libs/image/kis_base_mask_generator.cpp
M +3 -1 libs/image/kis_base_mask_generator.h
C +1 -18 libs/image/kisproofingconfiguration.cpp [from: plugins/paintops/experiment/kis_experiment_paintop_settings_widget.h - 057% similarity]
M +4 -2 libs/ui/kis_paintop_box.cc
M +4 -4 libs/ui/tool/kis_tool_freehand.cc
M +1 -0 libs/ui/widgets/kis_paintop_presets_popup.cpp
M +1 -0 libs/ui/widgets/kis_paintop_presets_popup.h
M +15 -0 plugins/paintops/chalk/kis_chalk_paintop_settings.cpp
M +3 -0 plugins/paintops/chalk/kis_chalk_paintop_settings.h
M +0 -14 plugins/paintops/chalk/kis_chalk_paintop_settings_widget.cpp
M +0 -4 plugins/paintops/chalk/kis_chalk_paintop_settings_widget.h
M +7 -0 plugins/paintops/chalk/kis_chalkop_option.h
M +16 -1 plugins/paintops/curvebrush/kis_curve_paintop_settings.cpp
M +3 -0 plugins/paintops/curvebrush/kis_curve_paintop_settings.h
M +15 -0 plugins/paintops/deform/kis_deform_paintop_settings.cpp
M +3 -0 plugins/paintops/deform/kis_deform_paintop_settings.h
M +0 -19 plugins/paintops/deform/kis_deform_paintop_settings_widget.cpp
M +0 -2 plugins/paintops/deform/kis_deform_paintop_settings_widget.h
M +17 -1 plugins/paintops/dynadraw/kis_dyna_paintop_settings.cpp
M +3 -0 plugins/paintops/dynadraw/kis_dyna_paintop_settings.h
M +2 -2 plugins/paintops/experiment/kis_experiment_paintop_settings.h
M +0 -4 plugins/paintops/experiment/kis_experiment_paintop_settings_widget.cpp
M +0 -1 plugins/paintops/experiment/kis_experiment_paintop_settings_widget.h
M +2 -2 plugins/paintops/gridbrush/kis_grid_paintop.cpp
M +2 -1 plugins/paintops/gridbrush/kis_grid_paintop.h
M +17 -1 plugins/paintops/gridbrush/kis_grid_paintop_settings.cpp
M +3 -0 plugins/paintops/gridbrush/kis_grid_paintop_settings.h
M +0 -15 plugins/paintops/gridbrush/kis_grid_paintop_settings_widget.cpp
M +0 -2 plugins/paintops/gridbrush/kis_grid_paintop_settings_widget.h
M +4 -4 plugins/paintops/gridbrush/kis_gridop_option.h
M +0 -11 plugins/paintops/libpaintop/kis_brush_based_paintop_options_widget.cpp
M +0 -2 plugins/paintops/libpaintop/kis_brush_based_paintop_options_widget.h
M +56 -43 plugins/paintops/libpaintop/kis_brush_based_paintop_settings.cpp
M +2 -0 plugins/paintops/libpaintop/kis_brush_based_paintop_settings.h
M +0 -11 plugins/paintops/libpaintop/kis_brush_option_widget.cpp
M +0 -3 plugins/paintops/libpaintop/kis_brush_option_widget.h
M +1 -46 plugins/paintops/libpaintop/kis_brush_selection_widget.cpp
M +0 -2 plugins/paintops/libpaintop/kis_brush_selection_widget.h
M +2 -2 plugins/paintops/particle/kis_particle_paintop_settings.h
M +17 -1 plugins/paintops/spray/kis_spray_paintop_settings.cpp
M +4 -1 plugins/paintops/spray/kis_spray_paintop_settings.h
M +0 -13 plugins/paintops/spray/kis_spray_paintop_settings_widget.cpp
M +0 -3 plugins/paintops/spray/kis_spray_paintop_settings_widget.h
http://commits.kde.org/krita/8f2a13b9448a4aae775ce2b84a09ae53db5036d0
diff --git a/libs/brush/CMakeLists.txt b/libs/brush/CMakeLists.txt
index 415553c..704906c 100644
--- a/libs/brush/CMakeLists.txt
+++ b/libs/brush/CMakeLists.txt
@@ -9,6 +9,7 @@ set(kritalibbrush_LIB_SRCS
kis_auto_brush.cpp
kis_boundary.cc
kis_brush.cpp
+ kis_scaling_size_brush.cpp
kis_brush_registry.cpp
kis_brush_server.cpp
kis_gbr_brush.cpp
diff --git a/libs/brush/kis_abr_brush.cpp b/libs/brush/kis_abr_brush.cpp
index fbdca10..aeb5c83 100644
--- a/libs/brush/kis_abr_brush.cpp
+++ b/libs/brush/kis_abr_brush.cpp
@@ -40,7 +40,7 @@
#define DEFAULT_SPACING 0.25
KisAbrBrush::KisAbrBrush(const QString& filename, KisAbrBrushCollection *parent)
- : KisBrush(filename)
+ : KisScalingSizeBrush(filename)
, m_parent(parent)
{
setBrushType(INVALID);
@@ -49,14 +49,14 @@ KisAbrBrush::KisAbrBrush(const QString& filename, KisAbrBrushCollection *parent)
}
KisAbrBrush::KisAbrBrush(const KisAbrBrush& rhs)
- : KisBrush(rhs),
+ : KisScalingSizeBrush(rhs),
m_parent(0)
{
// Warning! The brush became detached from the parent!
}
KisAbrBrush::KisAbrBrush(const KisAbrBrush& rhs, KisAbrBrushCollection *parent)
- : KisBrush(rhs),
+ : KisScalingSizeBrush(rhs),
m_parent(parent)
{
}
diff --git a/libs/brush/kis_abr_brush.h b/libs/brush/kis_abr_brush.h
index 5b5af6e..0eb9ca9 100644
--- a/libs/brush/kis_abr_brush.h
+++ b/libs/brush/kis_abr_brush.h
@@ -23,7 +23,7 @@
#include <QImage>
#include <QVector>
-#include <kis_brush.h>
+#include <kis_scaling_size_brush.h>
#include <kis_types.h>
#include <kis_shared.h>
#include <brushengine/kis_paint_information.h>
@@ -38,7 +38,7 @@ class QString;
class QIODevice;
-class BRUSH_EXPORT KisAbrBrush : public KisBrush
+class BRUSH_EXPORT KisAbrBrush : public KisScalingSizeBrush
{
public:
diff --git a/libs/brush/kis_abr_brush_collection.cpp b/libs/brush/kis_abr_brush_collection.cpp
index 0ee1e90..8ae392b 100644
--- a/libs/brush/kis_abr_brush_collection.cpp
+++ b/libs/brush/kis_abr_brush_collection.cpp
@@ -523,12 +523,12 @@ qint32 KisAbrBrushCollection::abr_brush_load(QDataStream & abr, AbrInfo *abr_hdr
KisAbrBrushCollection::KisAbrBrushCollection(const QString& filename)
- : KisBrush(filename)
+ : KisScalingSizeBrush(filename)
{
}
KisAbrBrushCollection::KisAbrBrushCollection(const KisAbrBrushCollection& rhs)
- : KisBrush(rhs)
+ : KisScalingSizeBrush(rhs)
{
for (auto it = rhs.m_abrBrushes.begin();
it != rhs.m_abrBrushes.end();
diff --git a/libs/brush/kis_abr_brush_collection.h b/libs/brush/kis_abr_brush_collection.h
index aca684c..bb857a4 100644
--- a/libs/brush/kis_abr_brush_collection.h
+++ b/libs/brush/kis_abr_brush_collection.h
@@ -26,7 +26,7 @@
#include <QString>
#include <kis_debug.h>
-#include <kis_brush.h>
+#include <kis_scaling_size_brush.h>
#include <kis_types.h>
#include <kis_shared.h>
#include <brushengine/kis_paint_information.h>
@@ -40,7 +40,7 @@ struct AbrInfo;
/**
* load a collection of brushes from an abr file
*/
-class BRUSH_EXPORT KisAbrBrushCollection : public KisBrush
+class BRUSH_EXPORT KisAbrBrushCollection : public KisScalingSizeBrush
{
protected:
diff --git a/libs/brush/kis_auto_brush.cpp b/libs/brush/kis_auto_brush.cpp
index d91f232..2bb6916 100644
--- a/libs/brush/kis_auto_brush.cpp
+++ b/libs/brush/kis_auto_brush.cpp
@@ -99,6 +99,16 @@ KisAutoBrush::~KisAutoBrush()
{
}
+qreal KisAutoBrush::userEffectiveSize() const
+{
+ return d->shape->diameter();
+}
+
+void KisAutoBrush::setUserEffectiveSize(qreal value)
+{
+ d->shape->setDiameter(value);
+}
+
KisAutoBrush::KisAutoBrush(const KisAutoBrush& rhs)
: KisBrush(rhs),
d(new Private(*rhs.d))
@@ -324,6 +334,8 @@ void KisAutoBrush::toXML(QDomDocument& doc, QDomElement& e) const
QImage KisAutoBrush::createBrushPreview()
{
+ return QImage();
+
srand(0);
srand48(0);
int width = maskWidth(KisDabShape(), 0.0, 0.0, KisPaintInformation());
diff --git a/libs/brush/kis_auto_brush.h b/libs/brush/kis_auto_brush.h
index cda35e2..86cad04 100644
--- a/libs/brush/kis_auto_brush.h
+++ b/libs/brush/kis_auto_brush.h
@@ -42,6 +42,9 @@ public:
public:
+ qreal userEffectiveSize() const;
+ void setUserEffectiveSize(qreal value);
+
qint32 maskHeight(KisDabShape const& shape, qreal subPixelX, qreal subPixelY,
const KisPaintInformation& info) const Q_DECL_OVERRIDE;
diff --git a/libs/brush/kis_brush.h b/libs/brush/kis_brush.h
index 4ded24a..be7adb2 100644
--- a/libs/brush/kis_brush.h
+++ b/libs/brush/kis_brush.h
@@ -120,6 +120,9 @@ public:
virtual ~KisBrush();
+ virtual qreal userEffectiveSize() const { return 0;};
+ virtual void setUserEffectiveSize(qreal value) {};
+
virtual bool load() {
return false;
}
diff --git a/libs/brush/kis_gbr_brush.cpp b/libs/brush/kis_gbr_brush.cpp
index 6969837..2a17626 100644
--- a/libs/brush/kis_gbr_brush.cpp
+++ b/libs/brush/kis_gbr_brush.cpp
@@ -84,7 +84,7 @@ struct KisGbrBrush::Private {
#define DEFAULT_SPACING 0.25
KisGbrBrush::KisGbrBrush(const QString& filename)
- : KisBrush(filename)
+ : KisScalingSizeBrush(filename)
, d(new Private)
{
d->ownData = true;
@@ -96,7 +96,7 @@ KisGbrBrush::KisGbrBrush(const QString& filename)
KisGbrBrush::KisGbrBrush(const QString& filename,
const QByteArray& data,
qint32 & dataPos)
- : KisBrush(filename)
+ : KisScalingSizeBrush(filename)
, d(new Private)
{
d->ownData = false;
@@ -111,7 +111,7 @@ KisGbrBrush::KisGbrBrush(const QString& filename,
}
KisGbrBrush::KisGbrBrush(KisPaintDeviceSP image, int x, int y, int w, int h)
- : KisBrush()
+ : KisScalingSizeBrush()
, d(new Private)
{
d->ownData = true;
@@ -122,7 +122,7 @@ KisGbrBrush::KisGbrBrush(KisPaintDeviceSP image, int x, int y, int w, int h)
}
KisGbrBrush::KisGbrBrush(const QImage& image, const QString& name)
- : KisBrush()
+ : KisScalingSizeBrush()
, d(new Private)
{
d->ownData = false;
@@ -135,7 +135,7 @@ KisGbrBrush::KisGbrBrush(const QImage& image, const QString& name)
}
KisGbrBrush::KisGbrBrush(const KisGbrBrush& rhs)
- : KisBrush(rhs)
+ : KisScalingSizeBrush(rhs)
, d(new Private(*rhs.d))
{
setName(rhs.name());
diff --git a/libs/brush/kis_gbr_brush.h b/libs/brush/kis_gbr_brush.h
index cc27d00..faefbe3 100644
--- a/libs/brush/kis_gbr_brush.h
+++ b/libs/brush/kis_gbr_brush.h
@@ -23,7 +23,7 @@
#include <QImage>
#include <QVector>
-#include "kis_brush.h"
+#include "kis_scaling_size_brush.h"
#include <kis_types.h>
#include <kis_shared.h>
#include <brushengine/kis_paint_information.h>
@@ -36,7 +36,7 @@ typedef KisSharedPtr<KisQImagemask> KisQImagemaskSP;
class QString;
class QIODevice;
-class BRUSH_EXPORT KisGbrBrush : public KisBrush
+class BRUSH_EXPORT KisGbrBrush : public KisScalingSizeBrush
{
protected:
diff --git a/libs/brush/kis_png_brush.cpp b/libs/brush/kis_png_brush.cpp
index 12f9390..6709913 100644
--- a/libs/brush/kis_png_brush.cpp
+++ b/libs/brush/kis_png_brush.cpp
@@ -27,7 +27,7 @@
#include <kis_dom_utils.h>
KisPngBrush::KisPngBrush(const QString& filename)
- : KisBrush(filename)
+ : KisScalingSizeBrush(filename)
{
setBrushType(INVALID);
setSpacing(0.25);
diff --git a/libs/brush/kis_png_brush.h b/libs/brush/kis_png_brush.h
index c993847..4c524c5 100644
--- a/libs/brush/kis_png_brush.h
+++ b/libs/brush/kis_png_brush.h
@@ -19,9 +19,9 @@
#ifndef KIS_PNG_BRUSH_
#define KIS_PNG_BRUSH_
-#include "kis_brush.h"
+#include "kis_scaling_size_brush.h"
-class BRUSH_EXPORT KisPngBrush : public KisBrush
+class BRUSH_EXPORT KisPngBrush : public KisScalingSizeBrush
{
public:
/// Construct brush to load filename later as brush
diff --git a/plugins/paintops/experiment/kis_experiment_paintop_settings_widget.h b/libs/brush/kis_scaling_size_brush.cpp
similarity index 58%
copy from plugins/paintops/experiment/kis_experiment_paintop_settings_widget.h
copy to libs/brush/kis_scaling_size_brush.cpp
index ec136cc..276b295 100644
--- a/plugins/paintops/experiment/kis_experiment_paintop_settings_widget.h
+++ b/libs/brush/kis_scaling_size_brush.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009,2010 Lukáš Tvrdý <lukast.dev at gmail.com>
+ * Copyright (c) 2016 Dmitry Kazakov <dimula73 at 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
@@ -16,21 +16,24 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef KIS_EXPERIMENTPAINTOP_SETTINGS_WIDGET_H_
-#define KIS_EXPERIMENTPAINTOP_SETTINGS_WIDGET_H_
-
-#include <kis_paintop_settings_widget.h>
+#include "kis_scaling_size_brush.h"
+KisScalingSizeBrush::KisScalingSizeBrush()
+ : KisBrush()
+{
+}
-class KisExperimentPaintOpSettingsWidget : public KisPaintOpSettingsWidget
+KisScalingSizeBrush::KisScalingSizeBrush(const QString &filename)
+ : KisBrush(filename)
{
- Q_OBJECT
-public:
- KisExperimentPaintOpSettingsWidget(QWidget* parent = 0);
- virtual ~KisExperimentPaintOpSettingsWidget();
- virtual void changePaintOpSize(qreal x, qreal y);
+}
- KisPropertiesConfiguration* configuration() const;
-};
+qreal KisScalingSizeBrush::userEffectiveSize() const
+{
+ return this->width() * this->scale();
+}
-#endif
+void KisScalingSizeBrush::setUserEffectiveSize(qreal value)
+{
+ this->setScale(value / this->width());
+}
diff --git a/plugins/paintops/experiment/kis_experiment_paintop_settings_widget.h b/libs/brush/kis_scaling_size_brush.h
similarity index 59%
copy from plugins/paintops/experiment/kis_experiment_paintop_settings_widget.h
copy to libs/brush/kis_scaling_size_brush.h
index ec136cc..e5718a4 100644
--- a/plugins/paintops/experiment/kis_experiment_paintop_settings_widget.h
+++ b/libs/brush/kis_scaling_size_brush.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009,2010 Lukáš Tvrdý <lukast.dev at gmail.com>
+ * Copyright (c) 2016 Dmitry Kazakov <dimula73 at 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
@@ -16,21 +16,22 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef KIS_EXPERIMENTPAINTOP_SETTINGS_WIDGET_H_
-#define KIS_EXPERIMENTPAINTOP_SETTINGS_WIDGET_H_
+#ifndef KISSCALINGSIZEBRUSH_H
+#define KISSCALINGSIZEBRUSH_H
-#include <kis_paintop_settings_widget.h>
+#include "kritabrush_export.h"
+#include "kis_brush.h"
-class KisExperimentPaintOpSettingsWidget : public KisPaintOpSettingsWidget
+class BRUSH_EXPORT KisScalingSizeBrush : public KisBrush
{
- Q_OBJECT
public:
- KisExperimentPaintOpSettingsWidget(QWidget* parent = 0);
- virtual ~KisExperimentPaintOpSettingsWidget();
- virtual void changePaintOpSize(qreal x, qreal y);
- KisPropertiesConfiguration* configuration() const;
+ KisScalingSizeBrush();
+ KisScalingSizeBrush(const QString& filename);
+
+ qreal userEffectiveSize() const;
+ void setUserEffectiveSize(qreal value);
};
-#endif
+#endif // KISSCALINGSIZEBRUSH_H
diff --git a/libs/brush/kis_svg_brush.cpp b/libs/brush/kis_svg_brush.cpp
index efc5893..1d3175a 100644
--- a/libs/brush/kis_svg_brush.cpp
+++ b/libs/brush/kis_svg_brush.cpp
@@ -25,7 +25,7 @@
#include <QSvgRenderer>
KisSvgBrush::KisSvgBrush(const QString& filename)
- : KisBrush(filename)
+ : KisScalingSizeBrush(filename)
{
setBrushType(INVALID);
setSpacing(0.25);
@@ -34,7 +34,7 @@ KisSvgBrush::KisSvgBrush(const QString& filename)
}
KisSvgBrush::KisSvgBrush(const KisSvgBrush& rhs)
- : KisBrush(rhs),
+ : KisScalingSizeBrush(rhs),
m_svg(rhs.m_svg)
{
}
diff --git a/libs/brush/kis_svg_brush.h b/libs/brush/kis_svg_brush.h
index 3e6b038..4374e31 100644
--- a/libs/brush/kis_svg_brush.h
+++ b/libs/brush/kis_svg_brush.h
@@ -19,9 +19,9 @@
#ifndef KIS_SVG_BRUSH_
#define KIS_SVG_BRUSH_
-#include "kis_brush.h"
+#include "kis_scaling_size_brush.h"
-class BRUSH_EXPORT KisSvgBrush : public KisBrush
+class BRUSH_EXPORT KisSvgBrush : public KisScalingSizeBrush
{
public:
/// Construct brush to load filename later as brush
diff --git a/libs/brush/kis_text_brush.cpp b/libs/brush/kis_text_brush.cpp
index e0630cd..d95ea9b 100644
--- a/libs/brush/kis_text_brush.cpp
+++ b/libs/brush/kis_text_brush.cpp
@@ -164,7 +164,7 @@ KisTextBrush::KisTextBrush()
}
KisTextBrush::KisTextBrush(const KisTextBrush &rhs)
- : KisBrush(rhs),
+ : KisScalingSizeBrush(rhs),
m_brushesPipe(new KisTextBrushesPipe(*rhs.m_brushesPipe))
{
}
diff --git a/libs/brush/kis_text_brush.h b/libs/brush/kis_text_brush.h
index d91f0d1..69617da 100644
--- a/libs/brush/kis_text_brush.h
+++ b/libs/brush/kis_text_brush.h
@@ -22,13 +22,13 @@
#include <QFont>
-#include "kis_brush.h"
+#include "kis_scaling_size_brush.h"
#include "kritabrush_export.h"
class KisTextBrushesPipe;
-class BRUSH_EXPORT KisTextBrush : public KisBrush
+class BRUSH_EXPORT KisTextBrush : public KisScalingSizeBrush
{
public:
diff --git a/libs/image/CMakeLists.txt b/libs/image/CMakeLists.txt
index d4cd630..c07ae71 100644
--- a/libs/image/CMakeLists.txt
+++ b/libs/image/CMakeLists.txt
@@ -66,6 +66,7 @@ set(kritaimage_LIB_SRCS
brushengine/kis_paintop_registry.cc
brushengine/kis_paintop_settings.cpp
brushengine/kis_paintop_settings_update_proxy.cpp
+ brushengine/kis_no_size_paintop_settings.cpp
brushengine/kis_locked_properties.cc
brushengine/kis_locked_properties_proxy.cpp
brushengine/kis_locked_properties_server.cpp
diff --git a/plugins/paintops/experiment/kis_experiment_paintop_settings_widget.h b/libs/image/brushengine/kis_no_size_paintop_settings.cpp
similarity index 58%
copy from plugins/paintops/experiment/kis_experiment_paintop_settings_widget.h
copy to libs/image/brushengine/kis_no_size_paintop_settings.cpp
index ec136cc..1efdf16 100644
--- a/plugins/paintops/experiment/kis_experiment_paintop_settings_widget.h
+++ b/libs/image/brushengine/kis_no_size_paintop_settings.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009,2010 Lukáš Tvrdý <lukast.dev at gmail.com>
+ * Copyright (c) 2016 Dmitry Kazakov <dimula73 at 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
@@ -16,21 +16,19 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef KIS_EXPERIMENTPAINTOP_SETTINGS_WIDGET_H_
-#define KIS_EXPERIMENTPAINTOP_SETTINGS_WIDGET_H_
-
-#include <kis_paintop_settings_widget.h>
+#include "kis_no_size_paintop_settings.h"
+KisNoSizePaintOpSettings::KisNoSizePaintOpSettings()
+{
+}
-class KisExperimentPaintOpSettingsWidget : public KisPaintOpSettingsWidget
+void KisNoSizePaintOpSettings::setPaintOpSize(qreal value)
{
- Q_OBJECT
-public:
- KisExperimentPaintOpSettingsWidget(QWidget* parent = 0);
- virtual ~KisExperimentPaintOpSettingsWidget();
- virtual void changePaintOpSize(qreal x, qreal y);
+ Q_UNUSED(value);
+}
- KisPropertiesConfiguration* configuration() const;
-};
+qreal KisNoSizePaintOpSettings::paintOpSize() const
+{
+ return 1.0;
+}
-#endif
diff --git a/plugins/paintops/experiment/kis_experiment_paintop_settings_widget.h b/libs/image/brushengine/kis_no_size_paintop_settings.h
similarity index 59%
copy from plugins/paintops/experiment/kis_experiment_paintop_settings_widget.h
copy to libs/image/brushengine/kis_no_size_paintop_settings.h
index ec136cc..accd1f2 100644
--- a/plugins/paintops/experiment/kis_experiment_paintop_settings_widget.h
+++ b/libs/image/brushengine/kis_no_size_paintop_settings.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009,2010 Lukáš Tvrdý <lukast.dev at gmail.com>
+ * Copyright (c) 2016 Dmitry Kazakov <dimula73 at 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
@@ -16,21 +16,20 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef KIS_EXPERIMENTPAINTOP_SETTINGS_WIDGET_H_
-#define KIS_EXPERIMENTPAINTOP_SETTINGS_WIDGET_H_
+#ifndef KISNOSIZEPAINTOPSETTINGS_H
+#define KISNOSIZEPAINTOPSETTINGS_H
-#include <kis_paintop_settings_widget.h>
+#include "kis_paintop_settings.h"
+#include "kritaimage_export.h"
-class KisExperimentPaintOpSettingsWidget : public KisPaintOpSettingsWidget
+class KRITAIMAGE_EXPORT KisNoSizePaintOpSettings : public KisPaintOpSettings
{
- Q_OBJECT
public:
- KisExperimentPaintOpSettingsWidget(QWidget* parent = 0);
- virtual ~KisExperimentPaintOpSettingsWidget();
- virtual void changePaintOpSize(qreal x, qreal y);
+ KisNoSizePaintOpSettings();
- KisPropertiesConfiguration* configuration() const;
+ void setPaintOpSize(qreal value) Q_DECL_OVERRIDE;
+ qreal paintOpSize() const Q_DECL_OVERRIDE;
};
-#endif
+#endif // KISNOSIZEPAINTOPSETTINGS_H
diff --git a/libs/image/brushengine/kis_paintop_config_widget.cpp b/libs/image/brushengine/kis_paintop_config_widget.cpp
index 2fbc631..66e8a78 100644
--- a/libs/image/brushengine/kis_paintop_config_widget.cpp
+++ b/libs/image/brushengine/kis_paintop_config_widget.cpp
@@ -66,15 +66,6 @@ void KisPaintOpConfigWidget::setNode(KisNodeWSP node) {
m_node = node;
}
-void KisPaintOpConfigWidget::changePaintOpSize(qreal x, qreal y) {
- Q_UNUSED(x);
- Q_UNUSED(y);
-}
-
-QSizeF KisPaintOpConfigWidget::paintOpSize() const {
- return QSizeF(1.0, 1.0);
-}
-
bool KisPaintOpConfigWidget::presetIsValid() {
return true;
}
diff --git a/libs/image/brushengine/kis_paintop_config_widget.h b/libs/image/brushengine/kis_paintop_config_widget.h
index f1d3a3f..5933b26 100644
--- a/libs/image/brushengine/kis_paintop_config_widget.h
+++ b/libs/image/brushengine/kis_paintop_config_widget.h
@@ -56,16 +56,6 @@ public:
virtual void setNode(KisNodeWSP node);
/**
- * @see KisPaintOpSettings::changePaintOpSize(qreal x, qreal y)
- */
- virtual void changePaintOpSize(qreal x, qreal y);
-
- /**
- * @see KisPaintOpSettings::paintOpSize()
- */
- virtual QSizeF paintOpSize() const;
-
- /**
* This is true for all of the paintop widget except for the Custom brush tab in the Brush tip dialog
*/
virtual bool presetIsValid();
diff --git a/libs/image/brushengine/kis_paintop_settings.cpp b/libs/image/brushengine/kis_paintop_settings.cpp
index 993c762..29cd8df 100644
--- a/libs/image/brushengine/kis_paintop_settings.cpp
+++ b/libs/image/brushengine/kis_paintop_settings.cpp
@@ -201,38 +201,6 @@ qreal KisPaintOpSettings::paintOpFlow() const
return proxy->getDouble("FlowValue", 1.0);
}
-void KisPaintOpSettings::setPaintOpSize(qreal value)
-{
- /**
- * The widget already has the wrapping for the locked setings
- * functionality, so just request it.
- */
-
- if (d->settingsWidget) {
- const qreal sizeDiff = value - paintOpSize();
-
- {
- KisSignalsBlocker b(d->settingsWidget);
- d->settingsWidget.data()->setConfigurationSafe(this);
- d->settingsWidget.data()->changePaintOpSize(sizeDiff, 0);
- }
- d->settingsWidget.data()->writeConfigurationSafe(this);
- }
-}
-
-qreal KisPaintOpSettings::paintOpSize() const
-{
- // see a comment about locked settings in setPaintOpSize()
-
- qreal size = 1.0;
-
- if (d->settingsWidget) {
- size = d->settingsWidget.data()->paintOpSize().width();
- }
-
- return size;
-}
-
QString KisPaintOpSettings::paintOpCompositeOp() const
{
KisLockedPropertiesProxySP proxy(
diff --git a/libs/image/brushengine/kis_paintop_settings.h b/libs/image/brushengine/kis_paintop_settings.h
index 1af16fc..925b588 100644
--- a/libs/image/brushengine/kis_paintop_settings.h
+++ b/libs/image/brushengine/kis_paintop_settings.h
@@ -193,12 +193,12 @@ public:
/**
* Set paintop size directly in the properties
*/
- void setPaintOpSize(qreal value);
+ virtual void setPaintOpSize(qreal value) = 0;
/**
* @return size saved in the properties
*/
- qreal paintOpSize() const;
+ virtual qreal paintOpSize() const = 0;
void setEraserMode(bool value);
bool eraserMode() const;
diff --git a/libs/image/kis_base_mask_generator.cpp b/libs/image/kis_base_mask_generator.cpp
index 14f8adb..f6d451a 100644
--- a/libs/image/kis_base_mask_generator.cpp
+++ b/libs/image/kis_base_mask_generator.cpp
@@ -249,6 +249,13 @@ qreal KisMaskGenerator::diameter() const
return d->diameter;
}
+void KisMaskGenerator::setDiameter(qreal value)
+{
+ d->diameter = value;
+ init();
+ setScale(d->scaleX, d->scaleY);
+}
+
qreal KisMaskGenerator::ratio() const
{
return d->ratio;
diff --git a/libs/image/kis_base_mask_generator.h b/libs/image/kis_base_mask_generator.h
index ef7cb34..8df0dfe 100644
--- a/libs/image/kis_base_mask_generator.h
+++ b/libs/image/kis_base_mask_generator.h
@@ -92,7 +92,9 @@ public:
qreal height() const;
- qreal diameter() const;
+ qreal diameter() const;
+ void setDiameter(qreal value);
+
qreal ratio() const;
qreal horizontalFade() const;
qreal verticalFade() const;
diff --git a/plugins/paintops/experiment/kis_experiment_paintop_settings_widget.h b/libs/image/kisproofingconfiguration.cpp
similarity index 57%
copy from plugins/paintops/experiment/kis_experiment_paintop_settings_widget.h
copy to libs/image/kisproofingconfiguration.cpp
index ec136cc..ccbecdf 100644
--- a/plugins/paintops/experiment/kis_experiment_paintop_settings_widget.h
+++ b/libs/image/kisproofingconfiguration.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009,2010 Lukáš Tvrdý <lukast.dev at gmail.com>
+ * Copyright (c) 2016 Dmitry Kazakov <dimula73 at 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
@@ -16,21 +16,4 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-#ifndef KIS_EXPERIMENTPAINTOP_SETTINGS_WIDGET_H_
-#define KIS_EXPERIMENTPAINTOP_SETTINGS_WIDGET_H_
-#include <kis_paintop_settings_widget.h>
-
-
-class KisExperimentPaintOpSettingsWidget : public KisPaintOpSettingsWidget
-{
- Q_OBJECT
-public:
- KisExperimentPaintOpSettingsWidget(QWidget* parent = 0);
- virtual ~KisExperimentPaintOpSettingsWidget();
- virtual void changePaintOpSize(qreal x, qreal y);
-
- KisPropertiesConfiguration* configuration() const;
-};
-
-#endif
diff --git a/libs/ui/kis_paintop_box.cc b/libs/ui/kis_paintop_box.cc
index 7ac139a..ca1a2b9 100644
--- a/libs/ui/kis_paintop_box.cc
+++ b/libs/ui/kis_paintop_box.cc
@@ -431,6 +431,7 @@ KisPaintopBox::KisPaintopBox(KisViewManager *view, QWidget *parent, const char *
m_presetsPopup = new KisPaintOpPresetsPopup(m_resourceProvider);
m_brushEditorPopupButton->setPopupWidget(m_presetsPopup);
m_presetsPopup->switchDetached(false);
+ connect(m_presetsPopup, SIGNAL(brushEditorShown()), SLOT(slotUpdateOptionsWidget()));
connect(m_viewManager->mainWindow(), SIGNAL(themeChanged()), m_presetsPopup, SLOT(updateThemedIcons()));
m_presetsChooserPopup = new KisPaintOpPresetsChooserPopup();
@@ -641,8 +642,9 @@ void KisPaintopBox::slotUpdateOptionsWidget()
KIS_SAFE_ASSERT_RECOVER_RETURN(preset);
KIS_SAFE_ASSERT_RECOVER_RETURN(m_optionWidget);
- KisSignalsBlocker b(m_optionWidget);
- m_optionWidget->setConfigurationSafe(preset->settings().data());
+ if (m_optionWidget->isVisible()) {
+ m_optionWidget->setConfigurationSafe(preset->settings().data());
+ }
m_presetsPopup->resourceSelected(preset.data());
m_presetsPopup->updateViewSettings();
diff --git a/libs/ui/tool/kis_tool_freehand.cc b/libs/ui/tool/kis_tool_freehand.cc
index 44ae2a2..c1968c9 100644
--- a/libs/ui/tool/kis_tool_freehand.cc
+++ b/libs/ui/tool/kis_tool_freehand.cc
@@ -361,12 +361,12 @@ void KisToolFreehand::continueAlternateAction(KoPointerEvent *event, AlternateAc
const qreal sizeDiff = scaleCoeff * offset.x() ;
if (qAbs(sizeDiff) > 0.01) {
- //KisPaintOpSettingsSP settings = currentPaintOpPreset()->settings();
+ KisPaintOpSettingsSP settings = currentPaintOpPreset()->settings();
const qreal newSize = qBound(0.01, m_lastPaintOpSize + sizeDiff, maxBrushSize);
- //settings->setPaintOpSize(newSize);
- //requestUpdateOutline(m_initialGestureDocPoint, 0);
- m_brushResizeCompressor.start(newSize);
+ settings->setPaintOpSize(newSize);
+ requestUpdateOutline(m_initialGestureDocPoint, 0);
+ //m_brushResizeCompressor.start(newSize);
m_lastDocumentPoint = event->point;
m_lastPaintOpSize = newSize;
diff --git a/libs/ui/widgets/kis_paintop_presets_popup.cpp b/libs/ui/widgets/kis_paintop_presets_popup.cpp
index d19ceca..9b829f5 100644
--- a/libs/ui/widgets/kis_paintop_presets_popup.cpp
+++ b/libs/ui/widgets/kis_paintop_presets_popup.cpp
@@ -368,6 +368,7 @@ void KisPaintOpPresetsPopup::showEvent(QShowEvent *)
if (m_d->detached) {
window()->setGeometry(m_d->detachedGeometry);
}
+ emit brushEditorShown();
}
void KisPaintOpPresetsPopup::resizeEvent(QResizeEvent* event)
diff --git a/libs/ui/widgets/kis_paintop_presets_popup.h b/libs/ui/widgets/kis_paintop_presets_popup.h
index d4b9ee3..bf291bc 100644
--- a/libs/ui/widgets/kis_paintop_presets_popup.h
+++ b/libs/ui/widgets/kis_paintop_presets_popup.h
@@ -96,6 +96,7 @@ Q_SIGNALS:
void eraserBrushSizeToggled(bool value);
void sizeChanged();
+ void brushEditorShown();
private Q_SLOTS:
void slotSwitchPresetStrip(bool visible);
diff --git a/plugins/paintops/chalk/kis_chalk_paintop_settings.cpp b/plugins/paintops/chalk/kis_chalk_paintop_settings.cpp
index 8f2f60d..e0f5616 100644
--- a/plugins/paintops/chalk/kis_chalk_paintop_settings.cpp
+++ b/plugins/paintops/chalk/kis_chalk_paintop_settings.cpp
@@ -57,3 +57,18 @@ QPainterPath KisChalkPaintOpSettings::brushOutline(const KisPaintInformation &in
}
return path;
}
+
+void KisChalkPaintOpSettings::setPaintOpSize(qreal value)
+{
+ ChalkProperties properties;
+ properties.readOptionSetting(this);
+ properties.radius = qRound(0.5 * value);
+ properties.writeOptionSetting(this);
+}
+
+qreal KisChalkPaintOpSettings::paintOpSize() const
+{
+ ChalkProperties properties;
+ properties.readOptionSetting(this);
+ return properties.radius * 2;
+}
diff --git a/plugins/paintops/chalk/kis_chalk_paintop_settings.h b/plugins/paintops/chalk/kis_chalk_paintop_settings.h
index 6826057..9cbf4aa 100644
--- a/plugins/paintops/chalk/kis_chalk_paintop_settings.h
+++ b/plugins/paintops/chalk/kis_chalk_paintop_settings.h
@@ -36,6 +36,9 @@ public:
QPainterPath brushOutline(const KisPaintInformation &info, OutlineMode mode) const;
+ void setPaintOpSize(qreal value) Q_DECL_OVERRIDE;
+ qreal paintOpSize() const Q_DECL_OVERRIDE;
+
bool paintIncremental();
bool isAirbrushing() const;
int rate() const;
diff --git a/plugins/paintops/chalk/kis_chalk_paintop_settings_widget.cpp b/plugins/paintops/chalk/kis_chalk_paintop_settings_widget.cpp
index 5e6e16e..3b5eec2 100644
--- a/plugins/paintops/chalk/kis_chalk_paintop_settings_widget.cpp
+++ b/plugins/paintops/chalk/kis_chalk_paintop_settings_widget.cpp
@@ -50,17 +50,3 @@ KisPropertiesConfiguration* KisChalkPaintOpSettingsWidget::configuration() cons
writeConfiguration(config);
return config;
}
-
-void KisChalkPaintOpSettingsWidget::changePaintOpSize(qreal x, qreal y)
-{
- // if the movement is more left<->right then up<->down
- if (qAbs(x) > qAbs(y)) {
- m_chalkOption->setRadius(m_chalkOption->radius() + qRound(x));
- }
-}
-
-QSizeF KisChalkPaintOpSettingsWidget::paintOpSize() const
-{
- qreal width = m_chalkOption->radius() * 2.0 + 1.0;
- return QSizeF(width, width);
-}
diff --git a/plugins/paintops/chalk/kis_chalk_paintop_settings_widget.h b/plugins/paintops/chalk/kis_chalk_paintop_settings_widget.h
index 5e7f618..0d4f9c5 100644
--- a/plugins/paintops/chalk/kis_chalk_paintop_settings_widget.h
+++ b/plugins/paintops/chalk/kis_chalk_paintop_settings_widget.h
@@ -35,10 +35,6 @@ public:
KisPropertiesConfiguration* configuration() const;
- ///Reimplemented
- void changePaintOpSize(qreal x, qreal y);
- virtual QSizeF paintOpSize() const;
-
public:
KisChalkOpOption* m_chalkOption;
};
diff --git a/plugins/paintops/chalk/kis_chalkop_option.h b/plugins/paintops/chalk/kis_chalkop_option.h
index d61a4d2..7479dd5 100644
--- a/plugins/paintops/chalk/kis_chalkop_option.h
+++ b/plugins/paintops/chalk/kis_chalkop_option.h
@@ -64,6 +64,13 @@ public:
useOpacity = settings->getBool(CHALK_USE_OPACITY);
useSaturation = settings->getBool(CHALK_USE_SATURATION);
}
+
+ void writeOptionSetting(KisPropertiesConfiguration* settings) {
+ settings->setProperty(CHALK_RADIUS, radius);
+ settings->setProperty(CHALK_INK_DEPLETION, inkDepletion);
+ settings->setProperty(CHALK_USE_OPACITY, useOpacity);
+ settings->setProperty(CHALK_USE_SATURATION, useSaturation);
+ }
};
#endif
diff --git a/plugins/paintops/curvebrush/kis_curve_paintop_settings.cpp b/plugins/paintops/curvebrush/kis_curve_paintop_settings.cpp
index ed5368e..dd9401f 100644
--- a/plugins/paintops/curvebrush/kis_curve_paintop_settings.cpp
+++ b/plugins/paintops/curvebrush/kis_curve_paintop_settings.cpp
@@ -17,6 +17,7 @@
*/
#include <kis_curve_paintop_settings.h>
#include <kis_paint_action_type_option.h>
+#include "kis_curve_line_option.h"
struct KisCurvePaintOpSettings::Private
{
@@ -32,6 +33,21 @@ KisCurvePaintOpSettings::~KisCurvePaintOpSettings()
{
}
+void KisCurvePaintOpSettings::setPaintOpSize(qreal value)
+{
+ CurveOption option;
+ option.readOptionSetting(this);
+ option.curve_line_width = value;
+ option.writeOptionSetting(this);
+}
+
+qreal KisCurvePaintOpSettings::paintOpSize() const
+{
+ CurveOption option;
+ option.readOptionSetting(this);
+ return option.curve_line_width;
+}
+
bool KisCurvePaintOpSettings::paintIncremental()
{
return (enumPaintActionType)getInt("PaintOpAction", WASH) == BUILDUP;
@@ -41,7 +57,6 @@ bool KisCurvePaintOpSettings::paintIncremental()
#include <brushengine/kis_slider_based_paintop_property.h>
#include "kis_paintop_preset.h"
#include "kis_paintop_settings_update_proxy.h"
-#include "kis_curve_line_option.h"
#include "kis_standard_uniform_properties_factory.h"
typedef KisCallbackBasedPaintopProperty<KisUniformPaintOpProperty> KisUniformPaintOpPropertyCallback;
diff --git a/plugins/paintops/curvebrush/kis_curve_paintop_settings.h b/plugins/paintops/curvebrush/kis_curve_paintop_settings.h
index 485c9fe..49072e1 100644
--- a/plugins/paintops/curvebrush/kis_curve_paintop_settings.h
+++ b/plugins/paintops/curvebrush/kis_curve_paintop_settings.h
@@ -29,6 +29,9 @@ public:
KisCurvePaintOpSettings();
virtual ~KisCurvePaintOpSettings();
+ void setPaintOpSize(qreal value) Q_DECL_OVERRIDE;
+ qreal paintOpSize() const Q_DECL_OVERRIDE;
+
virtual bool paintIncremental();
QList<KisUniformPaintOpPropertySP> uniformProperties();
diff --git a/plugins/paintops/deform/kis_deform_paintop_settings.cpp b/plugins/paintops/deform/kis_deform_paintop_settings.cpp
index 508081a..43a68a1 100644
--- a/plugins/paintops/deform/kis_deform_paintop_settings.cpp
+++ b/plugins/paintops/deform/kis_deform_paintop_settings.cpp
@@ -40,6 +40,21 @@ KisDeformPaintOpSettings::~KisDeformPaintOpSettings()
{
}
+void KisDeformPaintOpSettings::setPaintOpSize(qreal value)
+{
+ BrushSizeOption option;
+ option.readOptionSetting(this);
+ option.brush_diameter = value;
+ option.writeOptionSetting(this);
+}
+
+qreal KisDeformPaintOpSettings::paintOpSize() const
+{
+ BrushSizeOption option;
+ option.readOptionSetting(this);
+ return option.brush_diameter;
+}
+
bool KisDeformPaintOpSettings::paintIncremental()
{
return true;
diff --git a/plugins/paintops/deform/kis_deform_paintop_settings.h b/plugins/paintops/deform/kis_deform_paintop_settings.h
index c4d8855..0ab27ce 100644
--- a/plugins/paintops/deform/kis_deform_paintop_settings.h
+++ b/plugins/paintops/deform/kis_deform_paintop_settings.h
@@ -31,6 +31,9 @@ public:
KisDeformPaintOpSettings();
~KisDeformPaintOpSettings();
+ void setPaintOpSize(qreal value) Q_DECL_OVERRIDE;
+ qreal paintOpSize() const Q_DECL_OVERRIDE;
+
QPainterPath brushOutline(const KisPaintInformation &info, OutlineMode mode) const;
bool paintIncremental();
diff --git a/plugins/paintops/deform/kis_deform_paintop_settings_widget.cpp b/plugins/paintops/deform/kis_deform_paintop_settings_widget.cpp
index bb2f519..cd5fd82 100644
--- a/plugins/paintops/deform/kis_deform_paintop_settings_widget.cpp
+++ b/plugins/paintops/deform/kis_deform_paintop_settings_widget.cpp
@@ -50,25 +50,6 @@ KisDeformPaintOpSettingsWidget::~ KisDeformPaintOpSettingsWidget()
}
-void KisDeformPaintOpSettingsWidget::changePaintOpSize(qreal x, qreal y)
-{
- // if the movement is more left<->right then up<->down
- if (qAbs(x) > qAbs(y)) {
- m_brushSizeOption->setDiameter(m_brushSizeOption->diameter() + qRound(x));
- }
- else { // vice-versa
- // we can do something different, e.g. change deform mode or ...
- }
-}
-
-
-QSizeF KisDeformPaintOpSettingsWidget::paintOpSize() const
-{
- qreal height = m_brushSizeOption->diameter() * m_brushSizeOption->brushAspect();
- return QSizeF(m_brushSizeOption->diameter(), height);
-}
-
-
KisPropertiesConfiguration* KisDeformPaintOpSettingsWidget::configuration() const
{
KisDeformPaintOpSettings* config = new KisDeformPaintOpSettings();
diff --git a/plugins/paintops/deform/kis_deform_paintop_settings_widget.h b/plugins/paintops/deform/kis_deform_paintop_settings_widget.h
index 1811409..a87fb29 100644
--- a/plugins/paintops/deform/kis_deform_paintop_settings_widget.h
+++ b/plugins/paintops/deform/kis_deform_paintop_settings_widget.h
@@ -32,8 +32,6 @@ public:
virtual ~KisDeformPaintOpSettingsWidget();
virtual KisPropertiesConfiguration* configuration() const;
- virtual void changePaintOpSize(qreal x, qreal y);
- virtual QSizeF paintOpSize() const;
private:
KisDeformOption * m_deformOption;
diff --git a/plugins/paintops/dynadraw/kis_dyna_paintop_settings.cpp b/plugins/paintops/dynadraw/kis_dyna_paintop_settings.cpp
index 8915c1e..cfe817b 100644
--- a/plugins/paintops/dynadraw/kis_dyna_paintop_settings.cpp
+++ b/plugins/paintops/dynadraw/kis_dyna_paintop_settings.cpp
@@ -19,6 +19,7 @@
#include "kis_dyna_paintop_settings.h"
#include <kis_paint_action_type_option.h>
#include <kis_airbrush_option.h>
+#include "kis_dynaop_option.h"
struct KisDynaPaintOpSettings::Private
{
@@ -34,6 +35,22 @@ KisDynaPaintOpSettings::~KisDynaPaintOpSettings()
{
}
+void KisDynaPaintOpSettings::setPaintOpSize(qreal value)
+{
+ DynaOption option;
+ option.readOptionSetting(this);
+ option.dyna_diameter = value;
+ option.writeOptionSetting(this);
+}
+
+qreal KisDynaPaintOpSettings::paintOpSize() const
+{
+ DynaOption option;
+ option.readOptionSetting(this);
+
+ return option.dyna_diameter;
+}
+
bool KisDynaPaintOpSettings::paintIncremental()
{
return (enumPaintActionType)getInt("PaintOpAction", WASH) == BUILDUP;
@@ -54,7 +71,6 @@ int KisDynaPaintOpSettings::rate() const
#include <brushengine/kis_combo_based_paintop_property.h>
#include "kis_paintop_preset.h"
#include "kis_paintop_settings_update_proxy.h"
-#include "kis_dynaop_option.h"
#include "kis_standard_uniform_properties_factory.h"
diff --git a/plugins/paintops/dynadraw/kis_dyna_paintop_settings.h b/plugins/paintops/dynadraw/kis_dyna_paintop_settings.h
index 96f0ce0..e203a7c 100644
--- a/plugins/paintops/dynadraw/kis_dyna_paintop_settings.h
+++ b/plugins/paintops/dynadraw/kis_dyna_paintop_settings.h
@@ -29,6 +29,9 @@ public:
KisDynaPaintOpSettings();
~KisDynaPaintOpSettings();
+ void setPaintOpSize(qreal value) Q_DECL_OVERRIDE;
+ qreal paintOpSize() const Q_DECL_OVERRIDE;
+
bool paintIncremental();
virtual bool isAirbrushing() const;
virtual int rate() const;
diff --git a/plugins/paintops/experiment/kis_experiment_paintop_settings.h b/plugins/paintops/experiment/kis_experiment_paintop_settings.h
index 9701ec4..5a088a3 100644
--- a/plugins/paintops/experiment/kis_experiment_paintop_settings.h
+++ b/plugins/paintops/experiment/kis_experiment_paintop_settings.h
@@ -19,10 +19,10 @@
#ifndef KIS_EXPERIMENT_PAINTOP_SETTINGS_H_
#define KIS_EXPERIMENT_PAINTOP_SETTINGS_H_
-#include <brushengine/kis_paintop_settings.h>
+#include <brushengine/kis_no_size_paintop_settings.h>
#include <QScopedPointer>
-class KisExperimentPaintOpSettings : public KisPaintOpSettings
+class KisExperimentPaintOpSettings : public KisNoSizePaintOpSettings
{
public:
KisExperimentPaintOpSettings();
diff --git a/plugins/paintops/experiment/kis_experiment_paintop_settings_widget.cpp b/plugins/paintops/experiment/kis_experiment_paintop_settings_widget.cpp
index 225d4f5..8bd7b11 100644
--- a/plugins/paintops/experiment/kis_experiment_paintop_settings_widget.cpp
+++ b/plugins/paintops/experiment/kis_experiment_paintop_settings_widget.cpp
@@ -49,8 +49,4 @@ KisPropertiesConfiguration* KisExperimentPaintOpSettingsWidget::configuration()
writeConfiguration(config);
return config;
}
-void KisExperimentPaintOpSettingsWidget::changePaintOpSize(qreal /*x*/, qreal /*y*/)
-{
- //m_experimentOption->setDiameter( m_experimentOption->startSize() + qRound(x) );
-}
diff --git a/plugins/paintops/experiment/kis_experiment_paintop_settings_widget.h b/plugins/paintops/experiment/kis_experiment_paintop_settings_widget.h
index ec136cc..65422e7 100644
--- a/plugins/paintops/experiment/kis_experiment_paintop_settings_widget.h
+++ b/plugins/paintops/experiment/kis_experiment_paintop_settings_widget.h
@@ -28,7 +28,6 @@ class KisExperimentPaintOpSettingsWidget : public KisPaintOpSettingsWidget
public:
KisExperimentPaintOpSettingsWidget(QWidget* parent = 0);
virtual ~KisExperimentPaintOpSettingsWidget();
- virtual void changePaintOpSize(qreal x, qreal y);
KisPropertiesConfiguration* configuration() const;
};
diff --git a/plugins/paintops/gridbrush/kis_grid_paintop.cpp b/plugins/paintops/gridbrush/kis_grid_paintop.cpp
index b2e09a8..ad8db9e 100644
--- a/plugins/paintops/gridbrush/kis_grid_paintop.cpp
+++ b/plugins/paintops/gridbrush/kis_grid_paintop.cpp
@@ -53,7 +53,7 @@ KisGridPaintOp::KisGridPaintOp(const KisGridPaintOpSettings *settings, KisPainte
, m_image(image)
, m_node(node)
{
- m_properties.fillProperties(settings);
+ m_properties.readOptionSetting(settings);
m_colorProperties.fillProperties(settings);
m_xSpacing = m_properties.gridWidth * m_properties.scale;
@@ -240,7 +240,7 @@ KisSpacingInformation KisGridPaintOp::paintAt(const KisPaintInformation& info)
return KisSpacingInformation(m_spacing * additionalScale);
}
-void KisGridProperties::fillProperties(const KisPropertiesConfiguration* setting)
+void KisGridProperties::readOptionSetting(const KisPropertiesConfiguration* setting)
{
gridWidth = qMax(1, setting->getInt(GRID_WIDTH));
gridHeight = qMax(1, setting->getInt(GRID_HEIGHT));
diff --git a/plugins/paintops/gridbrush/kis_grid_paintop.h b/plugins/paintops/gridbrush/kis_grid_paintop.h
index 54794de..0e333c9 100644
--- a/plugins/paintops/gridbrush/kis_grid_paintop.h
+++ b/plugins/paintops/gridbrush/kis_grid_paintop.h
@@ -45,7 +45,8 @@ public:
quint8 shape;
public:
- void fillProperties(const KisPropertiesConfiguration* setting);
+ void readOptionSetting(const KisPropertiesConfiguration* setting);
+ void writeOptionSetting(KisPropertiesConfiguration* setting);
};
class KisGridPaintOp : public KisPaintOp
diff --git a/plugins/paintops/gridbrush/kis_grid_paintop_settings.cpp b/plugins/paintops/gridbrush/kis_grid_paintop_settings.cpp
index 1cc71f0..a346d9c 100644
--- a/plugins/paintops/gridbrush/kis_grid_paintop_settings.cpp
+++ b/plugins/paintops/gridbrush/kis_grid_paintop_settings.cpp
@@ -36,6 +36,23 @@ KisGridPaintOpSettings::KisGridPaintOpSettings()
{
}
+void KisGridPaintOpSettings::setPaintOpSize(qreal value)
+{
+ GridOption option;
+ option.readOptionSetting(this);
+ option.grid_width = value;
+ option.grid_height = value;
+ option.writeOptionSetting(this);
+}
+
+qreal KisGridPaintOpSettings::paintOpSize() const
+{
+ GridOption option;
+ option.readOptionSetting(this);
+
+ return option.grid_width;
+}
+
bool KisGridPaintOpSettings::paintIncremental()
{
return (enumPaintActionType)getInt("PaintOpAction", WASH) == BUILDUP;
@@ -64,7 +81,6 @@ QPainterPath KisGridPaintOpSettings::brushOutline(const KisPaintInformation &inf
#include <brushengine/kis_slider_based_paintop_property.h>
#include "kis_paintop_preset.h"
#include "kis_paintop_settings_update_proxy.h"
-#include "kis_gridop_option.h"
typedef KisCallbackBasedPaintopProperty<KisUniformPaintOpProperty> KisUniformPaintOpPropertyCallback;
diff --git a/plugins/paintops/gridbrush/kis_grid_paintop_settings.h b/plugins/paintops/gridbrush/kis_grid_paintop_settings.h
index c7827c0..6b24765 100644
--- a/plugins/paintops/gridbrush/kis_grid_paintop_settings.h
+++ b/plugins/paintops/gridbrush/kis_grid_paintop_settings.h
@@ -34,6 +34,9 @@ class KisGridPaintOpSettings : public KisOutlineGenerationPolicy<KisPaintOpSetti
public:
KisGridPaintOpSettings();
+ void setPaintOpSize(qreal value) Q_DECL_OVERRIDE;
+ qreal paintOpSize() const Q_DECL_OVERRIDE;
+
QPainterPath brushOutline(const KisPaintInformation &info, OutlineMode mode) const;
bool paintIncremental();
diff --git a/plugins/paintops/gridbrush/kis_grid_paintop_settings_widget.cpp b/plugins/paintops/gridbrush/kis_grid_paintop_settings_widget.cpp
index bdac8f4..37aadfb 100644
--- a/plugins/paintops/gridbrush/kis_grid_paintop_settings_widget.cpp
+++ b/plugins/paintops/gridbrush/kis_grid_paintop_settings_widget.cpp
@@ -54,18 +54,3 @@ KisPropertiesConfiguration* KisGridPaintOpSettingsWidget::configuration() const
writeConfiguration(config);
return config;
}
-void KisGridPaintOpSettingsWidget::changePaintOpSize(qreal x, qreal y)
-{
- if (qAbs(x) > qAbs(y)) {
- m_gridOption->setWidth(m_gridOption->gridWidth() + qRound(x));
- m_gridOption->setHeight(m_gridOption->gridHeight() + qRound(x));
- }
- else {
- //m_options->m_gridOption->setHeight( gridHeight() + qRound(y) );
- }
-}
-
-QSizeF KisGridPaintOpSettingsWidget::paintOpSize() const
-{
- return QSizeF(m_gridOption->gridWidth(), m_gridOption->gridHeight());
-}
diff --git a/plugins/paintops/gridbrush/kis_grid_paintop_settings_widget.h b/plugins/paintops/gridbrush/kis_grid_paintop_settings_widget.h
index 51c2698..da5e272 100644
--- a/plugins/paintops/gridbrush/kis_grid_paintop_settings_widget.h
+++ b/plugins/paintops/gridbrush/kis_grid_paintop_settings_widget.h
@@ -32,8 +32,6 @@ class KisGridPaintOpSettingsWidget : public KisPaintOpSettingsWidget
public:
KisGridPaintOpSettingsWidget(QWidget* parent = 0);
virtual ~KisGridPaintOpSettingsWidget();
- virtual void changePaintOpSize(qreal x, qreal y);
- virtual QSizeF paintOpSize() const;
KisPropertiesConfiguration* configuration() const;
diff --git a/plugins/paintops/gridbrush/kis_gridop_option.h b/plugins/paintops/gridbrush/kis_gridop_option.h
index 3f67817..ddcf69b 100644
--- a/plugins/paintops/gridbrush/kis_gridop_option.h
+++ b/plugins/paintops/gridbrush/kis_gridop_option.h
@@ -75,8 +75,8 @@ struct GridOption
void readOptionSetting(const KisPropertiesConfiguration* setting) {
- grid_width = setting->getInt(GRID_WIDTH);
- grid_height = setting->getInt(GRID_HEIGHT);
+ grid_width = qMax(1, setting->getInt(GRID_WIDTH));
+ grid_height = qMax(1, setting->getInt(GRID_HEIGHT));
grid_division_level = setting->getInt(GRID_DIVISION_LEVEL);
grid_pressure_division = setting->getBool(GRID_PRESSURE_DIVISION);
grid_scale = setting->getDouble(GRID_SCALE);
@@ -86,8 +86,8 @@ struct GridOption
}
void writeOptionSetting(KisPropertiesConfiguration* setting) const {
- setting->setProperty(GRID_WIDTH, grid_width);
- setting->setProperty(GRID_HEIGHT, grid_height);
+ setting->setProperty(GRID_WIDTH, qMax(1, grid_width));
+ setting->setProperty(GRID_HEIGHT, qMax(1, grid_height));
setting->setProperty(GRID_DIVISION_LEVEL, grid_division_level);
setting->setProperty(GRID_PRESSURE_DIVISION, grid_pressure_division);
setting->setProperty(GRID_SCALE, grid_scale);
diff --git a/plugins/paintops/libpaintop/kis_brush_based_paintop_options_widget.cpp b/plugins/paintops/libpaintop/kis_brush_based_paintop_options_widget.cpp
index 439002e..6e098cb 100644
--- a/plugins/paintops/libpaintop/kis_brush_based_paintop_options_widget.cpp
+++ b/plugins/paintops/libpaintop/kis_brush_based_paintop_options_widget.cpp
@@ -42,17 +42,6 @@ KisBrushSP KisBrushBasedPaintopOptionWidget::brush()
return m_brushOption->brush();
}
-void KisBrushBasedPaintopOptionWidget::changePaintOpSize(qreal x, qreal y)
-{
- m_brushOption->setBrushSize(x, y);
-}
-
-QSizeF KisBrushBasedPaintopOptionWidget::paintOpSize() const
-{
- return m_brushOption->brushSize();
-}
-
-
bool KisBrushBasedPaintopOptionWidget::presetIsValid()
{
return m_brushOption->presetIsValid();
diff --git a/plugins/paintops/libpaintop/kis_brush_based_paintop_options_widget.h b/plugins/paintops/libpaintop/kis_brush_based_paintop_options_widget.h
index 05843a4..b1aa32d 100644
--- a/plugins/paintops/libpaintop/kis_brush_based_paintop_options_widget.h
+++ b/plugins/paintops/libpaintop/kis_brush_based_paintop_options_widget.h
@@ -36,8 +36,6 @@ public:
KisBrushSP brush();
- void changePaintOpSize(qreal x, qreal y);
- virtual QSizeF paintOpSize() const;
virtual bool presetIsValid();
diff --git a/plugins/paintops/libpaintop/kis_brush_based_paintop_settings.cpp b/plugins/paintops/libpaintop/kis_brush_based_paintop_settings.cpp
index 021345d..4dfcfd4 100644
--- a/plugins/paintops/libpaintop/kis_brush_based_paintop_settings.cpp
+++ b/plugins/paintops/libpaintop/kis_brush_based_paintop_settings.cpp
@@ -25,6 +25,41 @@
#include "kis_brush_server.h"
#include <QLineF>
#include "kis_signals_blocker.h"
+#include "kis_brush_option.h"
+
+struct BrushReader {
+ BrushReader(const KisBrushBasedPaintOpSettings *parent)
+ : m_parent(parent)
+ {
+ m_option.readOptionSetting(m_parent, false);
+ }
+
+ KisBrushSP brush() {
+ return m_option.brush();
+ }
+
+ const KisBrushBasedPaintOpSettings *m_parent;
+ KisBrushOption m_option;
+};
+
+struct BrushWriter {
+ BrushWriter(KisBrushBasedPaintOpSettings *parent)
+ : m_parent(parent)
+ {
+ m_option.readOptionSetting(m_parent, false);
+ }
+
+ ~BrushWriter() {
+ m_option.writeOptionSetting(m_parent);
+ }
+
+ KisBrushSP brush() {
+ return m_option.brush();
+ }
+
+ KisBrushBasedPaintOpSettings *m_parent;
+ KisBrushOption m_option;
+};
KisBrushBasedPaintOpSettings::KisBrushBasedPaintOpSettings()
@@ -64,8 +99,10 @@ KisPaintOpSettingsSP KisBrushBasedPaintOpSettings::clone() const
KisBrushSP KisBrushBasedPaintOpSettings::brush() const
{
- KisBrushBasedPaintopOptionWidget *widget = dynamic_cast<KisBrushBasedPaintopOptionWidget*>(optionsWidget());
- return widget ? widget->brush() : m_savedBrush;
+ BrushReader w(this);
+ if (!w.brush()) return 0;
+
+ return w.brush();
}
QPainterPath KisBrushBasedPaintOpSettings::brushOutlineImpl(const KisPaintInformation &info,
@@ -125,47 +162,6 @@ bool KisBrushBasedPaintOpSettings::isLoadable()
return (KisBrushServer::instance()->brushServer()->resources().count() > 0);
}
-struct BrushReader {
- BrushReader(const KisBrushBasedPaintOpSettings *parent)
- : m_parent(parent)
- {
- if (m_parent->optionsWidget()) {
- KisSignalsBlocker b(m_parent->optionsWidget());
- m_parent->optionsWidget()->setConfigurationSafe(m_parent);
- } else {
- m_parent = 0;
- }
- }
-
- KisBrushSP brush() {
- return m_parent ? m_parent->brush() : 0;
- }
-
- const KisBrushBasedPaintOpSettings *m_parent;
-};
-
-struct BrushWriter {
- BrushWriter(KisBrushBasedPaintOpSettings *parent)
- : m_parent(parent)
- {
- if (!m_parent->optionsWidget()) {
- m_parent = 0;
- }
- }
-
- ~BrushWriter() {
- if (m_parent && m_parent->optionsWidget()) {
- m_parent->optionsWidget()->writeConfigurationSafe(m_parent);
- }
- }
-
- KisBrushSP brush() {
- return m_parent ? m_parent->brush() : 0;
- }
-
- KisBrushBasedPaintOpSettings *m_parent;
-};
-
void KisBrushBasedPaintOpSettings::setAngle(qreal value)
{
BrushWriter w(this);
@@ -216,6 +212,23 @@ qreal KisBrushBasedPaintOpSettings::autoSpacingCoeff() const
return w.brush()->autoSpacingCoeff();
}
+void KisBrushBasedPaintOpSettings::setPaintOpSize(qreal value)
+{
+ BrushWriter w(this);
+ if (!w.brush()) return;
+
+ w.brush()->setUserEffectiveSize(value);
+}
+
+qreal KisBrushBasedPaintOpSettings::paintOpSize() const
+{
+ BrushReader w(this);
+ if (!w.brush()) return 0.0;
+
+ return w.brush()->userEffectiveSize();
+}
+
+
#include <brushengine/kis_slider_based_paintop_property.h>
#include "kis_paintop_preset.h"
diff --git a/plugins/paintops/libpaintop/kis_brush_based_paintop_settings.h b/plugins/paintops/libpaintop/kis_brush_based_paintop_settings.h
index 5a6d1b6..d065b61 100644
--- a/plugins/paintops/libpaintop/kis_brush_based_paintop_settings.h
+++ b/plugins/paintops/libpaintop/kis_brush_based_paintop_settings.h
@@ -63,6 +63,8 @@ public:
bool autoSpacingActive() const;
qreal autoSpacingCoeff() const;
+ void setPaintOpSize(qreal value);
+ qreal paintOpSize() const;
QList<KisUniformPaintOpPropertySP> uniformProperties();
diff --git a/plugins/paintops/libpaintop/kis_brush_option_widget.cpp b/plugins/paintops/libpaintop/kis_brush_option_widget.cpp
index 7ac9c0d..bce0a15 100644
--- a/plugins/paintops/libpaintop/kis_brush_option_widget.cpp
+++ b/plugins/paintops/libpaintop/kis_brush_option_widget.cpp
@@ -93,17 +93,6 @@ void KisBrushOptionWidget::lodLimitations(KisPaintopLodLimitations *l) const
brush->lodLimitations(l);
}
-void KisBrushOptionWidget::setBrushSize(qreal dxPixels, qreal dyPixels)
-{
- m_brushSelectionWidget->setBrushSize(dxPixels, dyPixels);
-}
-
-
-QSizeF KisBrushOptionWidget::brushSize() const
-{
- return m_brushSelectionWidget->brushSize();
-}
-
void KisBrushOptionWidget::brushChanged()
{
m_brushOption.setBrush(brush());
diff --git a/plugins/paintops/libpaintop/kis_brush_option_widget.h b/plugins/paintops/libpaintop/kis_brush_option_widget.h
index 0c230fc..041b5b6 100644
--- a/plugins/paintops/libpaintop/kis_brush_option_widget.h
+++ b/plugins/paintops/libpaintop/kis_brush_option_widget.h
@@ -57,9 +57,6 @@ public:
void lodLimitations(KisPaintopLodLimitations *l) const;
- void setBrushSize(qreal dxPixels, qreal dyPixels);
- QSizeF brushSize() const;
-
bool presetIsValid();
private Q_SLOTS:
diff --git a/plugins/paintops/libpaintop/kis_brush_selection_widget.cpp b/plugins/paintops/libpaintop/kis_brush_selection_widget.cpp
index 9456146..642ad7a 100644
--- a/plugins/paintops/libpaintop/kis_brush_selection_widget.cpp
+++ b/plugins/paintops/libpaintop/kis_brush_selection_widget.cpp
@@ -175,51 +175,6 @@ void KisBrushSelectionWidget::setCurrentBrush(KisBrushSP brush)
}
-void KisBrushSelectionWidget::setBrushSize(qreal dxPixels, qreal dyPixels)
-{
- if (m_buttonGroup->checkedId() == AUTOBRUSH) {
- m_autoBrushWidget->setBrushSize(dxPixels, dyPixels);
- }
- else if (m_buttonGroup->checkedId() == PREDEFINEDBRUSH) {
- m_brushChooser->setBrushSize(dxPixels, dyPixels);
- }
- else if (m_buttonGroup->checkedId() == CUSTOMBRUSH ||
- m_buttonGroup->checkedId() == CLIPBOARDBRUSH) {
-
- // switch to the predefined brush and resize it
- KisBrushSP brush = this->brush();
- if (brush) {
- setCurrentWidget(m_brushChooser);
- m_brushChooser->setBrush(brush);
- m_brushChooser->setBrushSize(dxPixels, dyPixels);
- }
- }
- if(m_precisionOption.autoPrecisionEnabled())
- {
- m_precisionOption.setAutoPrecision(this->brushSize().width());
- uiWdgBrushChooser.lblPrecisionValue->setText("Precision:"+QString::number(m_precisionOption.precisionLevel()));
- emit sigPrecisionChanged();
- }
-}
-
-
-QSizeF KisBrushSelectionWidget::brushSize() const
-{
- if (m_buttonGroup->checkedId() == AUTOBRUSH) {
- return m_autoBrushWidget->brushSize();
- }
- else if (KisBrushSP brush = this->brush()) {
- qreal width = brush->width() * brush->scale();
- qreal height = brush->height() * brush->scale();
- return QSizeF(width, height);
- }
-
- // return neutral value
- return QSizeF(1.0, 1.0);
-}
-
-
-
void KisBrushSelectionWidget::buttonClicked(int id)
{
setCurrentWidget(m_chooserMap[id]);
@@ -336,7 +291,7 @@ void KisBrushSelectionWidget::setAutoPrecisionEnabled(int value)
m_precisionOption.setAutoPrecisionEnabled(value);
if(m_precisionOption.autoPrecisionEnabled())
{
- m_precisionOption.setAutoPrecision(this->brushSize().height());
+ m_precisionOption.setAutoPrecision(brush()->width());
setPrecisionEnabled(false);
precisionChanged(m_precisionOption.precisionLevel());
uiWdgBrushChooser.label->setVisible(true);
diff --git a/plugins/paintops/libpaintop/kis_brush_selection_widget.h b/plugins/paintops/libpaintop/kis_brush_selection_widget.h
index 8f187bd..38bb26d 100644
--- a/plugins/paintops/libpaintop/kis_brush_selection_widget.h
+++ b/plugins/paintops/libpaintop/kis_brush_selection_widget.h
@@ -57,8 +57,6 @@ public:
void setCurrentBrush(KisBrushSP brush);
- void setBrushSize(qreal dxPixels, qreal dyPixels);
- QSizeF brushSize() const;
bool presetIsValid() {
return m_presetIsValid;
}
diff --git a/plugins/paintops/particle/kis_particle_paintop_settings.h b/plugins/paintops/particle/kis_particle_paintop_settings.h
index 7062770..0f01a6e 100644
--- a/plugins/paintops/particle/kis_particle_paintop_settings.h
+++ b/plugins/paintops/particle/kis_particle_paintop_settings.h
@@ -20,10 +20,10 @@
#define KIS_PARTICLE_PAINTOP_SETTINGS_H_
#include <QScopedPointer>
-#include <brushengine/kis_paintop_settings.h>
+#include <brushengine/kis_no_size_paintop_settings.h>
#include <kis_types.h>
-class KisParticlePaintOpSettings : public KisPaintOpSettings
+class KisParticlePaintOpSettings : public KisNoSizePaintOpSettings
{
public:
diff --git a/plugins/paintops/spray/kis_spray_paintop_settings.cpp b/plugins/paintops/spray/kis_spray_paintop_settings.cpp
index 4706ba8..3b3f393 100644
--- a/plugins/paintops/spray/kis_spray_paintop_settings.cpp
+++ b/plugins/paintops/spray/kis_spray_paintop_settings.cpp
@@ -43,6 +43,23 @@ KisSprayPaintOpSettings::~KisSprayPaintOpSettings()
{
}
+void KisSprayPaintOpSettings::setPaintOpSize(qreal value)
+{
+ KisSprayProperties option;
+ option.readOptionSetting(this);
+ option.diameter = value;
+ option.writeOptionSetting(this);
+}
+
+qreal KisSprayPaintOpSettings::paintOpSize() const
+{
+
+ KisSprayProperties option;
+ option.readOptionSetting(this);
+
+ return option.diameter;
+}
+
bool KisSprayPaintOpSettings::paintIncremental()
{
return (enumPaintActionType)getInt("PaintOpAction", WASH) == BUILDUP;
@@ -80,7 +97,6 @@ QPainterPath KisSprayPaintOpSettings::brushOutline(const KisPaintInformation &in
#include <brushengine/kis_slider_based_paintop_property.h>
#include "kis_paintop_preset.h"
#include "kis_paintop_settings_update_proxy.h"
-#include "kis_sprayop_option.h"
#include "kis_standard_uniform_properties_factory.h"
typedef KisCallbackBasedPaintopProperty<KisUniformPaintOpProperty> KisUniformPaintOpPropertyCallback;
diff --git a/plugins/paintops/spray/kis_spray_paintop_settings.h b/plugins/paintops/spray/kis_spray_paintop_settings.h
index 9da8eca..da75cd9 100644
--- a/plugins/paintops/spray/kis_spray_paintop_settings.h
+++ b/plugins/paintops/spray/kis_spray_paintop_settings.h
@@ -21,7 +21,7 @@
#include <QScopedPointer>
-#include <brushengine/kis_paintop_settings.h>
+#include <brushengine/kis_no_size_paintop_settings.h>
#include <kis_types.h>
#include <kis_outline_generation_policy.h>
@@ -34,6 +34,9 @@ public:
KisSprayPaintOpSettings();
~KisSprayPaintOpSettings();
+ void setPaintOpSize(qreal value) Q_DECL_OVERRIDE;
+ qreal paintOpSize() const Q_DECL_OVERRIDE;
+
QPainterPath brushOutline(const KisPaintInformation &info, OutlineMode mode) const;
diff --git a/plugins/paintops/spray/kis_spray_paintop_settings_widget.cpp b/plugins/paintops/spray/kis_spray_paintop_settings_widget.cpp
index d12db67..e0acfce 100644
--- a/plugins/paintops/spray/kis_spray_paintop_settings_widget.cpp
+++ b/plugins/paintops/spray/kis_spray_paintop_settings_widget.cpp
@@ -65,16 +65,3 @@ KisPropertiesConfiguration* KisSprayPaintOpSettingsWidget::configuration() cons
writeConfiguration(config);
return config;
}
-
-void KisSprayPaintOpSettingsWidget::changePaintOpSize(qreal x, qreal y)
-{
- Q_UNUSED(y);
- m_sprayArea->setDiameter(m_sprayArea->diameter() + qRound(x));
-}
-
-QSizeF KisSprayPaintOpSettingsWidget::paintOpSize() const
-{
- qreal width = m_sprayArea->diameter();
- qreal height = width * m_sprayArea->brushAspect();
- return QSizeF(width, height);
-}
diff --git a/plugins/paintops/spray/kis_spray_paintop_settings_widget.h b/plugins/paintops/spray/kis_spray_paintop_settings_widget.h
index 9f3fef7..601c7a1 100644
--- a/plugins/paintops/spray/kis_spray_paintop_settings_widget.h
+++ b/plugins/paintops/spray/kis_spray_paintop_settings_widget.h
@@ -31,9 +31,6 @@ public:
KisSprayPaintOpSettingsWidget(QWidget* parent = 0);
virtual ~KisSprayPaintOpSettingsWidget();
-
- virtual void changePaintOpSize(qreal x, qreal y);
- virtual QSizeF paintOpSize() const;
KisPropertiesConfiguration* configuration() const;
public:
More information about the kimageshop
mailing list