diff --git a/plugins/paintops/libpaintop/forms/wdgcurveoption.ui b/plugins/paintops/libpaintop/forms/wdgcurveoption.ui --- a/plugins/paintops/libpaintop/forms/wdgcurveoption.ui +++ b/plugins/paintops/libpaintop/forms/wdgcurveoption.ui @@ -289,8 +289,11 @@ - + + + + @@ -317,6 +320,49 @@ + + + + + + + 0 + 0 + + + + false + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + @@ -332,7 +378,7 @@ - + @@ -347,15 +393,52 @@ + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 9 + + + + true + + + Qt::Horizontal - 10 - 10 + 40 + 20 @@ -375,7 +458,7 @@ - + @@ -461,6 +544,12 @@ + + KisCurveWidget + +
widgets/kis_curve_widget.h
+ 1 +
KisDoubleSliderSpinBox QWidget @@ -473,12 +562,6 @@
kis_multi_sensors_selector.h
1
- - KisCurveWidget - QWidget -
widgets/kis_curve_widget.h
- 1 -
diff --git a/plugins/paintops/libpaintop/kis_curve_option.h b/plugins/paintops/libpaintop/kis_curve_option.h --- a/plugins/paintops/libpaintop/kis_curve_option.h +++ b/plugins/paintops/libpaintop/kis_curve_option.h @@ -60,6 +60,11 @@ virtual void readOptionSetting(KisPropertiesConfigurationSP setting); virtual void lodLimitations(KisPaintopLodLimitations *l) const; + //Please override for other values than 0-100 and % + virtual int intMinValue()const; + virtual int intMaxValue()const; + virtual QString valueSuffix()const; + const QString& name() const; KisPaintOpOption::PaintopCategory category() const; qreal minValue() const; diff --git a/plugins/paintops/libpaintop/kis_curve_option.cpp b/plugins/paintops/libpaintop/kis_curve_option.cpp --- a/plugins/paintops/libpaintop/kis_curve_option.cpp +++ b/plugins/paintops/libpaintop/kis_curve_option.cpp @@ -121,6 +121,21 @@ Q_UNUSED(l); } +int KisCurveOption::intMinValue() const +{ + return 0; +} + +int KisCurveOption::intMaxValue() const +{ + return 100; +} + +QString KisCurveOption::valueSuffix() const +{ + return i18n("%"); +} + void KisCurveOption::readNamedOptionSetting(const QString& prefix, const KisPropertiesConfigurationSP setting) { if (!setting) return; diff --git a/plugins/paintops/libpaintop/kis_curve_option_widget.cpp b/plugins/paintops/libpaintop/kis_curve_option_widget.cpp --- a/plugins/paintops/libpaintop/kis_curve_option_widget.cpp +++ b/plugins/paintops/libpaintop/kis_curve_option_widget.cpp @@ -167,6 +167,20 @@ if (sensor) { m_curveOptionWidget->label_xmin->setText(KisDynamicSensor::minimumLabel(sensor->sensorType())); m_curveOptionWidget->label_xmax->setText(KisDynamicSensor::maximumLabel(sensor->sensorType(), sensor->length())); + + int inMinValue = KisDynamicSensor::minimumValue(sensor->sensorType()); + int inMaxValue = KisDynamicSensor::maximumValue(sensor->sensorType(), sensor->length()); + QString inSuffix = KisDynamicSensor::valueSuffix(sensor->sensorType()); + + int outMinValue = m_curveOption->intMinValue(); + int outMaxValue = m_curveOption->intMaxValue(); + QString outSuffix = m_curveOption->valueSuffix(); + + m_curveOptionWidget->intIn->setSuffix(inSuffix); + m_curveOptionWidget->intOut->setSuffix(outSuffix); + + m_curveOptionWidget->curveWidget->setupInOutControls(m_curveOptionWidget->intIn,m_curveOptionWidget->intOut, + inMinValue,inMaxValue,outMinValue,outMaxValue); } } diff --git a/plugins/paintops/libpaintop/kis_dynamic_sensor.h b/plugins/paintops/libpaintop/kis_dynamic_sensor.h --- a/plugins/paintops/libpaintop/kis_dynamic_sensor.h +++ b/plugins/paintops/libpaintop/kis_dynamic_sensor.h @@ -145,6 +145,9 @@ static QString minimumLabel(DynamicSensorType sensorType); static QString maximumLabel(DynamicSensorType sensorType, int max = -1); + static int minimumValue(DynamicSensorType sensorType); + static int maximumValue(DynamicSensorType sensorType, int max = -1); + static QString valueSuffix(DynamicSensorType sensorType); static KisDynamicSensorSP createFromXML(const QString&, const QString &parentOptionName); static KisDynamicSensorSP createFromXML(const QDomElement&, const QString &parentOptionName); diff --git a/plugins/paintops/libpaintop/kis_dynamic_sensor.cc b/plugins/paintops/libpaintop/kis_dynamic_sensor.cc --- a/plugins/paintops/libpaintop/kis_dynamic_sensor.cc +++ b/plugins/paintops/libpaintop/kis_dynamic_sensor.cc @@ -282,6 +282,105 @@ }; } +int KisDynamicSensor::minimumValue(DynamicSensorType sensorType) +{ + switch (sensorType) { + case FUZZY_PER_DAB: + case FUZZY_PER_STROKE: + case FADE: + case DISTANCE: + case TIME: + case ANGLE: + case SPEED: + case ROTATION: + case PRESSURE: + case TILT_DIRECTION: + case PERSPECTIVE: + case PRESSURE_IN: + return 0; + case XTILT: + case YTILT: + return -30; + case TILT_ELEVATATION: + return 90; + case TANGENTIAL_PRESSURE: + default: + return 0; + } + +} + +int KisDynamicSensor::maximumValue(DynamicSensorType sensorType, int max) +{ + switch (sensorType) { + case FUZZY_PER_DAB: + case FUZZY_PER_STROKE: + case SPEED: + case PERSPECTIVE: + case TANGENTIAL_PRESSURE: + case PRESSURE_IN: + case PRESSURE: + return 100; + case FADE: + if (max < 0) { + return 1000; + } else { + return max; + } + case DISTANCE: + if (max < 0) { + return 30; + } else { + return max; + } + case TIME: + if (max < 0) { + return 3000; + } else { + return max; + } + case ANGLE: + case ROTATION: + case TILT_DIRECTION: + return 360; + case XTILT: + case YTILT: + return 30; + case TILT_ELEVATATION: + return 0; + default: + return 100; + }; +} + +QString KisDynamicSensor::valueSuffix(DynamicSensorType sensorType) +{ + switch (sensorType) { + case FUZZY_PER_DAB: + case FUZZY_PER_STROKE: + case SPEED: + case PRESSURE: + case PERSPECTIVE: + case TANGENTIAL_PRESSURE: + case PRESSURE_IN: + return i18n("%"); + case FADE: + return i18n(""); + case DISTANCE: + return i18n(" px"); + case TIME: + return i18n(" ms"); + case ANGLE: + case ROTATION: + case XTILT: + case YTILT: + case TILT_DIRECTION: + case TILT_ELEVATATION: + return i18n("°"); + default: + return i18n("%"); + }; +} KisDynamicSensorSP KisDynamicSensor::createFromXML(const QString& s, const QString &parentOptionName) { diff --git a/plugins/paintops/libpaintop/kis_pressure_hsv_option.h b/plugins/paintops/libpaintop/kis_pressure_hsv_option.h --- a/plugins/paintops/libpaintop/kis_pressure_hsv_option.h +++ b/plugins/paintops/libpaintop/kis_pressure_hsv_option.h @@ -51,6 +51,13 @@ ~KisPressureHSVOption() override; void apply(KoColorTransformation* hsvTransfo, const KisPaintInformation& info) const; + + // KisCurveOption interface +public: + int intMinValue() const override; + int intMaxValue() const override; + QString valueSuffix() const override; + private: struct Private; Private* const d; diff --git a/plugins/paintops/libpaintop/kis_pressure_hsv_option.cpp b/plugins/paintops/libpaintop/kis_pressure_hsv_option.cpp --- a/plugins/paintops/libpaintop/kis_pressure_hsv_option.cpp +++ b/plugins/paintops/libpaintop/kis_pressure_hsv_option.cpp @@ -145,3 +145,31 @@ transfo->setParameter(3, 0); //sets the type to HSV. transfo->setParameter(4, false); //sets the colorize to false. } + + +int KisPressureHSVOption::intMinValue() const +{ + if (name() == "h") { + return -180; + } else { + return -100; + } +} + +int KisPressureHSVOption::intMaxValue() const +{ + if (name() == "h") { + return 180; + } else { + return 100; + } +} + +QString KisPressureHSVOption::valueSuffix() const +{ + if (name() == "h") { + return i18n("°"); + } else { + return i18n("%"); + } +} diff --git a/plugins/paintops/libpaintop/kis_pressure_rotation_option.h b/plugins/paintops/libpaintop/kis_pressure_rotation_option.h --- a/plugins/paintops/libpaintop/kis_pressure_rotation_option.h +++ b/plugins/paintops/libpaintop/kis_pressure_rotation_option.h @@ -36,6 +36,12 @@ void readOptionSetting(const KisPropertiesConfigurationSP setting) override; void applyFanCornersInfo(KisPaintOp *op); + // KisCurveOption interface +public: + int intMinValue() const override; + int intMaxValue() const override; + QString valueSuffix() const override; + private: qreal m_defaultAngle; bool m_canvasAxisXMirrored; diff --git a/plugins/paintops/libpaintop/kis_pressure_rotation_option.cpp b/plugins/paintops/libpaintop/kis_pressure_rotation_option.cpp --- a/plugins/paintops/libpaintop/kis_pressure_rotation_option.cpp +++ b/plugins/paintops/libpaintop/kis_pressure_rotation_option.cpp @@ -69,3 +69,18 @@ op->setFanCornersInfo(sensor->fanCornersEnabled(), qreal(sensor->fanCornersStep()) * M_PI / 180.0); } } + +int KisPressureRotationOption::intMinValue() const +{ + return -180; +} + +int KisPressureRotationOption::intMaxValue() const +{ + return 180; +} + +QString KisPressureRotationOption::valueSuffix() const +{ + return i18n("°"); +}