diff --git a/plugins/paintops/libpaintop/forms/wdgcurveoption.ui b/plugins/paintops/libpaintop/forms/wdgcurveoption.ui
index 12798f93a2..c90610f93f 100644
--- a/plugins/paintops/libpaintop/forms/wdgcurveoption.ui
+++ b/plugins/paintops/libpaintop/forms/wdgcurveoption.ui
@@ -1,255 +1,262 @@
WdgCurveOption
0
0
1110
658
-
15
-
0
0
Strength:
-
0
0
20
20
16777215
16777215
-
-
-
-
+
-
-
-
-
-
-
- 1
- 0
-
-
-
-
- 0
- 230
-
-
-
-
-
-
0
0
TextLabel
-
Qt::Horizontal
40
20
-
0
0
TextLabel
+ -
+
+
+
+ 1
+ 0
+
+
+
+
+ 0
+ 230
+
+
+
+
-
-
0
0
TextLabel
-
Qt::Vertical
20
40
-
0
0
TextLabel
-
Share curve across all settings
true
+ -
+
+
+ Reset
+
+
+
- -
+
-
Qt::Horizontal
40
20
- -
+
-
Qt::Vertical
20
40
-
Enable Pen Settings
KisDoubleSliderSpinBox
QWidget
1
KisMultiSensorsSelector
QWidget
kis_multi_sensors_selector.h
1
KisCurveWidget
QWidget
widgets/kis_curve_widget.h
1
diff --git a/plugins/paintops/libpaintop/kis_curve_option_widget.cpp b/plugins/paintops/libpaintop/kis_curve_option_widget.cpp
index 9490ca4a1b..53a6e1e349 100644
--- a/plugins/paintops/libpaintop/kis_curve_option_widget.cpp
+++ b/plugins/paintops/libpaintop/kis_curve_option_widget.cpp
@@ -1,188 +1,194 @@
/* This file is part of the KDE project
* Copyright (C) 2008 Boudewijn Rempt
* Copyright (C) 2009 Sven Langkamp
* Copyright (C) 2011 Silvio Heinrich
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include "kis_curve_option_widget.h"
#include "ui_wdgcurveoption.h"
#include "widgets/kis_curve_widget.h"
#include "kis_dynamic_sensor.h"
#include "kis_global.h"
#include "kis_curve_option.h"
#include "kis_signals_blocker.h"
inline void setLabel(QLabel* label, const KisCurveLabel& curve_label)
{
if (curve_label.icon().isNull()) {
label->setText(curve_label.name());
}
else {
label->setPixmap(QPixmap::fromImage(curve_label.icon()));
}
}
KisCurveOptionWidget::KisCurveOptionWidget(KisCurveOption* curveOption, const QString &minLabel, const QString &maxLabel, bool hideSlider)
: KisPaintOpOption(curveOption->category(), curveOption->isChecked())
, m_widget(new QWidget)
, m_curveOptionWidget(new Ui_WdgCurveOption())
, m_curveOption(curveOption)
{
setObjectName("KisCurveOptionWidget");
m_curveOptionWidget->setupUi(m_widget);
setConfigurationPage(m_widget);
m_curveOptionWidget->sensorSelector->setCurveOption(curveOption);
updateSensorCurveLabels(m_curveOptionWidget->sensorSelector->currentHighlighted());
updateCurve(m_curveOptionWidget->sensorSelector->currentHighlighted());
connect(m_curveOptionWidget->curveWidget, SIGNAL(modified()), this, SLOT(transferCurve()));
connect(m_curveOptionWidget->sensorSelector, SIGNAL(parametersChanged()), SLOT(emitSettingChanged()));
connect(m_curveOptionWidget->sensorSelector, SIGNAL(parametersChanged()), SLOT(updateLabelsOfCurrentSensor()));
connect(m_curveOptionWidget->sensorSelector, SIGNAL(highlightedSensorChanged(KisDynamicSensorSP )), SLOT(updateSensorCurveLabels(KisDynamicSensorSP )));
connect(m_curveOptionWidget->sensorSelector, SIGNAL(highlightedSensorChanged(KisDynamicSensorSP )), SLOT(updateCurve(KisDynamicSensorSP )));
connect(m_curveOptionWidget->checkBoxUseSameCurve, SIGNAL(stateChanged(int)), SLOT(transferCurve()));
+ connect(m_curveOptionWidget->CurveResetButton, SIGNAL(clicked(bool)), this, SLOT(resetCurve()));
m_curveOptionWidget->label_ymin->setText(minLabel);
m_curveOptionWidget->label_ymax->setText(maxLabel);
m_curveOptionWidget->slider->setRange(curveOption->minValue(), curveOption->maxValue(), 2);
m_curveOptionWidget->slider->setValue(curveOption->value());
if (hideSlider) {
m_curveOptionWidget->slider->hide();
m_curveOptionWidget->strengthLabel->hide();
}
connect(m_curveOptionWidget->checkBoxUseCurve, SIGNAL(stateChanged(int)) , SLOT(updateValues()));
connect(m_curveOptionWidget->slider, SIGNAL(valueChanged(qreal)), SLOT(updateValues()));
}
KisCurveOptionWidget::~KisCurveOptionWidget()
{
delete m_curveOption;
delete m_curveOptionWidget;
}
void KisCurveOptionWidget::writeOptionSetting(KisPropertiesConfigurationSP setting) const
{
m_curveOption->writeOptionSetting(setting);
}
void KisCurveOptionWidget::readOptionSetting(const KisPropertiesConfigurationSP setting)
{
setting->dump();
m_curveOption->readOptionSetting(setting);
m_curveOptionWidget->checkBoxUseCurve->setChecked(m_curveOption->isCurveUsed());
m_curveOptionWidget->slider->setValue(m_curveOption->value());
m_curveOptionWidget->checkBoxUseSameCurve->setChecked(m_curveOption->isSameCurveUsed());
disableWidgets(!m_curveOption->isCurveUsed());
m_curveOptionWidget->sensorSelector->reload();
m_curveOptionWidget->sensorSelector->setCurrent(m_curveOption->activeSensors().first());
updateSensorCurveLabels(m_curveOptionWidget->sensorSelector->currentHighlighted());
updateCurve(m_curveOptionWidget->sensorSelector->currentHighlighted());
}
void KisCurveOptionWidget::lodLimitations(KisPaintopLodLimitations *l) const
{
m_curveOption->lodLimitations(l);
}
bool KisCurveOptionWidget::isCheckable() const
{
return m_curveOption->isCheckable();
}
bool KisCurveOptionWidget::isChecked() const
{
return m_curveOption->isChecked();
}
void KisCurveOptionWidget::setChecked(bool checked)
{
m_curveOption->setChecked(checked);
}
KisCurveOption* KisCurveOptionWidget::curveOption()
{
return m_curveOption;
}
QWidget* KisCurveOptionWidget::curveWidget()
{
return m_widget;
}
void KisCurveOptionWidget::transferCurve()
{
m_curveOptionWidget->sensorSelector->setCurrentCurve(m_curveOptionWidget->curveWidget->curve(), m_curveOptionWidget->checkBoxUseSameCurve->isChecked());
emitSettingChanged();
}
void KisCurveOptionWidget::updateSensorCurveLabels(KisDynamicSensorSP sensor)
{
if (sensor) {
m_curveOptionWidget->label_xmin->setText(KisDynamicSensor::minimumLabel(sensor->sensorType()));
m_curveOptionWidget->label_xmax->setText(KisDynamicSensor::maximumLabel(sensor->sensorType(), sensor->length()));
}
}
void KisCurveOptionWidget::updateCurve(KisDynamicSensorSP sensor)
{
if (sensor) {
bool blockSignal = m_curveOptionWidget->curveWidget->blockSignals(true);
m_curveOptionWidget->curveWidget->setCurve(sensor->curve());
m_curveOptionWidget->curveWidget->blockSignals(blockSignal);
}
}
void KisCurveOptionWidget::updateLabelsOfCurrentSensor()
{
updateSensorCurveLabels(m_curveOptionWidget->sensorSelector->currentHighlighted());
updateCurve(m_curveOptionWidget->sensorSelector->currentHighlighted());
}
void KisCurveOptionWidget::updateValues()
{
m_curveOption->setValue(m_curveOptionWidget->slider->value());
m_curveOption->setCurveUsed(m_curveOptionWidget->checkBoxUseCurve->isChecked());
disableWidgets(!m_curveOptionWidget->checkBoxUseCurve->isChecked());
emitSettingChanged();
}
+void KisCurveOptionWidget::resetCurve()
+{
+ m_curveOptionWidget->curveWidget->setCurve(KisCubicCurve());
+}
+
void KisCurveOptionWidget::disableWidgets(bool disable)
{
m_curveOptionWidget->checkBoxUseSameCurve->setDisabled(disable);
m_curveOptionWidget->curveWidget->setDisabled(disable);
m_curveOptionWidget->sensorSelector->setDisabled(disable);
m_curveOptionWidget->label_xmax->setDisabled(disable);
m_curveOptionWidget->label_xmin->setDisabled(disable);
m_curveOptionWidget->label_ymax->setDisabled(disable);
m_curveOptionWidget->label_ymin->setDisabled(disable);
}
diff --git a/plugins/paintops/libpaintop/kis_curve_option_widget.h b/plugins/paintops/libpaintop/kis_curve_option_widget.h
index ef575d5027..b7ec993bd0 100644
--- a/plugins/paintops/libpaintop/kis_curve_option_widget.h
+++ b/plugins/paintops/libpaintop/kis_curve_option_widget.h
@@ -1,70 +1,68 @@
/* This file is part of the KDE project
* Copyright (C) 2008 Boudewijn Rempt
* Copyright (C) 2009 Sven Langkamp
* Copyright (C) 2011 Silvio Heinrich
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public License
* along with this library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef KIS_CURVE_OPTION_WIDGET_H
#define KIS_CURVE_OPTION_WIDGET_H
#include
class Ui_WdgCurveOption;
class KisCurveOption;
#include
-/**
- * XXX; Add a reset button!
- */
class PAINTOP_EXPORT KisCurveOptionWidget : public KisPaintOpOption
{
Q_OBJECT
public:
KisCurveOptionWidget(KisCurveOption* curveOption, const QString &minLabel, const QString &maxLabel, bool hideSlider = false);
~KisCurveOptionWidget();
virtual void writeOptionSetting(KisPropertiesConfigurationSP setting) const;
virtual void readOptionSetting(const KisPropertiesConfigurationSP setting);
virtual void lodLimitations(KisPaintopLodLimitations *l) const;
bool isCheckable() const;
bool isChecked() const;
void setChecked(bool checked);
protected:
KisCurveOption* curveOption();
QWidget* curveWidget();
private Q_SLOTS:
void transferCurve();
void updateSensorCurveLabels(KisDynamicSensorSP sensor);
void updateCurve(KisDynamicSensorSP sensor);
void updateValues();
+ void resetCurve();
void updateLabelsOfCurrentSensor();
void disableWidgets(bool disable);
private:
QWidget* m_widget;
Ui_WdgCurveOption* m_curveOptionWidget;
KisCurveOption* m_curveOption;
};
#endif // KIS_CURVE_OPTION_WIDGET_H