Commit 136439d6 authored by Dmitry Kazakov's avatar Dmitry Kazakov

Renamed KCurve to KisCurveWidget according to our coding style conventions


svn path=/trunk/koffice/; revision=960052
parent d3445884
......@@ -46,7 +46,7 @@
#include "kis_paint_device.h"
#include "kis_iterators_pixel.h"
#include "kis_iterator.h"
#include "widgets/kcurve.h"
#include "widgets/kis_curve_widget.h"
#include "kis_histogram.h"
#include "kis_painter.h"
......@@ -192,7 +192,7 @@ KisBrightnessContrastConfigWidget::KisBrightnessContrastConfigWidget(QWidget * p
l->addWidget(m_page, 0, Qt::AlignTop);
height = 256;
connect(m_page->kCurve, SIGNAL(modified()), SIGNAL(sigConfigChanged()));
connect(m_page->curveWidget, SIGNAL(modified()), SIGNAL(sigConfigChanged()));
// Create the horizontal gradient label
QPixmap hgradientpix(256, 1);
......@@ -236,7 +236,7 @@ KisBrightnessContrastConfigWidget::KisBrightnessContrastConfigWidget(QWidget * p
}
}
m_page->kCurve->setPixmap(pix);
m_page->curveWidget->setPixmap(pix);
}
......@@ -246,7 +246,7 @@ KisBrightnessContrastFilterConfiguration * KisBrightnessContrastConfigWidget::co
for (int i = 0; i < 256; i++) {
qint32 val;
val = int(0xFFFF * m_page->kCurve->getCurveValue(i / 255.0));
val = int(0xFFFF * m_page->curveWidget->getCurveValue(i / 255.0));
if (val > 0xFFFF)
val = 0xFFFF;
if (val < 0)
......@@ -254,7 +254,7 @@ KisBrightnessContrastFilterConfiguration * KisBrightnessContrastConfigWidget::co
cfg->transfer[i] = val;
}
cfg->curve = m_page->kCurve->getCurve();
cfg->curve = m_page->curveWidget->getCurve();
return cfg;
}
......@@ -262,7 +262,7 @@ void KisBrightnessContrastConfigWidget::setConfiguration(const KisPropertiesConf
{
const KisBrightnessContrastFilterConfiguration * cfg = dynamic_cast<const KisBrightnessContrastFilterConfiguration *>(config);
Q_ASSERT(cfg);
m_page->kCurve->setCurve(cfg->curve);
m_page->curveWidget->setCurve(cfg->curve);
}
#include "kis_brightness_contrast_filter.moc"
......
......@@ -45,9 +45,10 @@
#include <kis_processing_information.h>
#include "kis_iterators_pixel.h"
#include "widgets/kcurve.h"
#include "kis_histogram.h"
#include "kis_painter.h"
#include "widgets/kis_curve_widget.h"
#define bounds(x,a,b) (x<a ? a : (x>b ? b :x))
......@@ -85,10 +86,10 @@ KisPerChannelConfigWidget::KisPerChannelConfigWidget(QWidget * parent, KisPaintD
hpf = KoHistogramProducerFactoryRegistry::instance()->get(keys.at(0).id());
m_histogram = new KisHistogram(m_dev, hpf->generate(), LINEAR);
connect(m_page->kCurve, SIGNAL(modified()), this, SIGNAL(sigConfigChanged()));
connect(m_page->curveWidget, SIGNAL(modified()), this, SIGNAL(sigConfigChanged()));
connect(m_page->cbPreview, SIGNAL(stateChanged(int)), this, SLOT(setPreview(int)));
m_page->kCurve->setupInOutControls(m_page->intIn, m_page->intOut, 0, 100);
m_page->curveWidget->setupInOutControls(m_page->intIn, m_page->intOut, 0, 100);
setActiveChannel(0);
}
......@@ -96,11 +97,11 @@ KisPerChannelConfigWidget::KisPerChannelConfigWidget(QWidget * parent, KisPaintD
void KisPerChannelConfigWidget::setPreview(int state)
{
if(state) {
connect(m_page->kCurve, SIGNAL(modified()), this, SIGNAL(sigConfigChanged()));
connect(m_page->curveWidget, SIGNAL(modified()), this, SIGNAL(sigConfigChanged()));
emit sigConfigChanged();
}
else
disconnect(m_page->kCurve, SIGNAL(modified()), this, SIGNAL(sigConfigChanged()));
disconnect(m_page->curveWidget, SIGNAL(modified()), this, SIGNAL(sigConfigChanged()));
}
......@@ -163,10 +164,10 @@ inline QPixmap KisPerChannelConfigWidget::getHistogram()
void KisPerChannelConfigWidget::setActiveChannel(int ch)
{
m_curves[m_activeCh] = m_page->kCurve->getCurve();
m_curves[m_activeCh] = m_page->curveWidget->getCurve();
m_activeCh = ch;
m_page->kCurve->setCurve(m_curves[m_activeCh]);
m_page->kCurve->setPixmap(getHistogram());
m_page->curveWidget->setCurve(m_curves[m_activeCh]);
m_page->curveWidget->setPixmap(getHistogram());
m_page->cmbChannel->setCurrentIndex(ch);
// Getting range accepted by chahhel
......@@ -176,7 +177,7 @@ void KisPerChannelConfigWidget::setActiveChannel(int ch)
int min;
int max;
m_page->kCurve->dropInOutControls();
m_page->curveWidget->dropInOutControls();
switch(channel->channelValueType())
{
......@@ -207,7 +208,7 @@ void KisPerChannelConfigWidget::setActiveChannel(int ch)
break;
}
m_page->kCurve->setupInOutControls(m_page->intIn, m_page->intOut, min, max);
m_page->curveWidget->setupInOutControls(m_page->intIn, m_page->intOut, min, max);
}
......@@ -217,12 +218,12 @@ KisPropertiesConfiguration * KisPerChannelConfigWidget::configuration() const
KisPerChannelFilterConfiguration * cfg = new KisPerChannelFilterConfiguration(nCh);
// updating current state
m_curves[m_activeCh] = m_page->kCurve->getCurve();
m_curves[m_activeCh] = m_page->curveWidget->getCurve();
cfg->setCurves(m_curves);
/* Cached version */
cfg->updateTransfersCached(*m_page->kCurve);
cfg->updateTransfersCached(*m_page->curveWidget);
//cfg->updateTransfers();
return cfg;
......@@ -250,7 +251,7 @@ void KisPerChannelConfigWidget::setConfiguration(const KisPropertiesConfiguratio
m_curves[ch] = cfg->m_curves[ch];
}
m_page->kCurve->setCurve(m_curves[m_activeCh]);
m_page->curveWidget->setCurve(m_curves[m_activeCh]);
setActiveChannel(0);
}
......@@ -320,7 +321,7 @@ void KisPerChannelFilterConfiguration::updateTransfers()
qint32 val;
for (int i = 0; i < 256; ++i) {
/* Direct uncached version */
val = int(0xFFFF * KCurve::getCurveValue(m_curves[ch], i / 255.0));
val = int(0xFFFF * KisCurveWidget::getCurveValue(m_curves[ch], i / 255.0));
val = bounds(val, 0, 0xFFFF);
m_transfers[ch][i] = val;
}
......@@ -328,7 +329,7 @@ void KisPerChannelFilterConfiguration::updateTransfers()
}
}
void KisPerChannelFilterConfiguration::updateTransfersCached(KCurve &cacheKCurve)
void KisPerChannelFilterConfiguration::updateTransfersCached(KisCurveWidget &cacheCurveWidget)
{
for (int ch = 0; ch < m_nTransfers; ++ch) {
if (!m_transfers[ch])
......@@ -337,7 +338,7 @@ void KisPerChannelFilterConfiguration::updateTransfersCached(KCurve &cacheKCurve
qint32 val;
for (int i = 0; i < 256; ++i) {
/* Cached version of the cycle */
val = int(0xFFFF * cacheKCurve.getCurveValue(i / 255.0));
val = int(0xFFFF * cacheCurveWidget.getCurveValue(i / 255.0));
val = bounds(val, 0, 0xFFFF);
m_transfers[ch][i] = val;
}
......
......@@ -63,7 +63,7 @@ public:
void setCurves(QList<KisCurve> &curves);
static inline void initDefaultCurves(QList<KisCurve> &curves, int nCh);
void updateTransfers();
void updateTransfersCached(KCurve &cacheKCurve);
void updateTransfersCached(KisCurveWidget &cacheCurveWidget);
bool isCompatible(const KisPaintDeviceSP) const;
public:
......
......@@ -107,7 +107,7 @@
<number>6</number>
</property>
<item>
<widget class="KCurve" name="kCurve" >
<widget class="KisCurveWidget" name="curveWidget" >
<property name="minimumSize" >
<size>
<width>250</width>
......@@ -252,9 +252,9 @@
<pixmapfunction></pixmapfunction>
<customwidgets>
<customwidget>
<class>KCurve</class>
<class>KisCurveWidget</class>
<extends></extends>
<header>widgets/kcurve.h</header>
<header>widgets/kis_curve_widget.h</header>
<container>0</container>
<pixmap></pixmap>
</customwidget>
......
......@@ -100,7 +100,7 @@
<number>0</number>
</property>
<item>
<widget class="KCurve" native="1" name="kCurve" />
<widget class="KisCurveWidget" native="1" name="curveWidget" />
</item>
</layout>
</widget>
......@@ -274,9 +274,9 @@
<layoutdefault spacing="6" margin="11" />
<customwidgets>
<customwidget>
<class>KCurve</class>
<class>KisCurveWidget</class>
<extends></extends>
<header>widgets/kcurve.h</header>
<header>widgets/kis_curve_widget.h</header>
</customwidget>
</customwidgets>
<resources/>
......
......@@ -41,7 +41,7 @@
#include <KoColor.h>
#include <KoInputDevice.h>
#include <widgets/kcurve.h>
#include <widgets/kis_curve_widget.h>
#include <kis_brush.h>
#include <kis_datamanager.h>
#include <kis_global.h>
......
......@@ -37,8 +37,7 @@ class KisComplexOpSettingsWidget;
class QWidget;
class QPointF;
class KisPainter;
class KCurve;
class KisCurveWidget;
class KisComplexOp : public KisBrushBasedPaintOp
{
......
......@@ -22,7 +22,7 @@
#include "kis_complexop_settings_widget.h"
#include "kis_complexop_settings.h"
#include <widgets/kcurve.h>
#include <widgets/kis_curve_widget.h>
#include <kis_properties_configuration.h>
#include <kis_brush_option.h>
#include <kis_paintop_options_widget.h>
......
......@@ -42,7 +42,7 @@
</widget>
</item>
<item>
<widget class="KCurve" name="sizeCurve" >
<widget class="KisCurveWidget" name="sizeCurve" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
......@@ -78,7 +78,7 @@
</widget>
</item>
<item>
<widget class="KCurve" name="opacityCurve" >
<widget class="KisCurveWidget" name="opacityCurve" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
......@@ -114,7 +114,7 @@
</widget>
</item>
<item>
<widget class="KCurve" name="darkenCurve" >
<widget class="KisCurveWidget" name="darkenCurve" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
......@@ -191,8 +191,8 @@
<layoutdefault spacing="6" margin="11" />
<customwidgets>
<customwidget>
<class>KCurve</class>
<header location="local" >widgets/kcurve.h</header>
<class>KisCurveWidget</class>
<header location="local" >widgets/kis_curve_widget.h</header>
<sizehint>
<width>-1</width>
<height>-1</height>
......@@ -211,9 +211,9 @@
</image>
</images>
<includes>
<include location="local" >widgets/kcurve.h</include>
<include location="local" >widgets/kcurve.h</include>
<include location="local" >widgets/kcurve.h</include>
<include location="local" >widgets/kis_curve_widget.h</include>
<include location="local" >widgets/kis_curve_widget.h</include>
<include location="local" >widgets/kis_curve_widget.h</include>
</includes>
<connections>
<connection>
......
......@@ -22,7 +22,6 @@
#include "kis_airbrushop_settings_widget.h"
#include "kis_airbrushop_settings.h"
#include <widgets/kcurve.h>
#include <kis_properties_configuration.h>
#include <kis_brush_option.h>
#include <kis_paintop_options_widget.h>
......
......@@ -40,7 +40,6 @@
#include <KoColor.h>
#include <KoInputDevice.h>
#include <widgets/kcurve.h>
#include <kis_brush.h>
#include <kis_datamanager.h>
#include <kis_global.h>
......
......@@ -36,7 +36,6 @@ class KisBrushOpSettingsWidget;
class QWidget;
class QPointF;
class KisPainter;
class KCurve;
class KisBrushOp : public KisBrushBasedPaintOp
......
......@@ -22,7 +22,6 @@
#include "kis_brushop_settings_widget.h"
#include "kis_brushop_settings.h"
#include <widgets/kcurve.h>
#include <kis_properties_configuration.h>
#include <kis_brush_option.h>
#include <kis_paintop_options_widget.h>
......
......@@ -42,7 +42,6 @@
#include <KoCompositeOp.h>
#include <KoInputDevice.h>
#include <widgets/kcurve.h>
#include <kis_brush.h>
#include <kis_datamanager.h>
#include <kis_global.h>
......
......@@ -37,7 +37,6 @@ class KisDuplicateOpSettingsWidget;
class QPointF;
class KisPainter;
class KCurve;
class KisDuplicateOp : public KisBrushBasedPaintOp
......
......@@ -24,8 +24,6 @@
#include "kis_duplicateop_settings.h"
#include "kis_duplicateop_option.h"
#include <widgets/kcurve.h>
#include <kis_image.h>
#include <kis_properties_configuration.h>
#include <kis_brush_option.h>
......
......@@ -41,7 +41,6 @@
#include <KoCompositeOp.h>
#include <KoInputDevice.h>
#include <widgets/kcurve.h>
#include <kis_brush.h>
#include <kis_datamanager.h>
#include <kis_global.h>
......
......@@ -43,7 +43,6 @@ class KisEraseOpSettingsWidget;
class QWidget;
class QPointF;
class KisPainter;
class KCurve;
class KisEraseOp : public KisBrushBasedPaintOp
......
......@@ -22,7 +22,6 @@
#include "kis_eraseop_settings_widget.h"
#include "kis_eraseop_settings.h"
#include <widgets/kcurve.h>
#include <kis_properties_configuration.h>
#include <kis_brush_option.h>
#include <kis_paintop_options_widget.h>
......
......@@ -40,7 +40,6 @@
#include <KoColor.h>
#include <KoInputDevice.h>
#include <widgets/kcurve.h>
#include <kis_brush.h>
#include <kis_datamanager.h>
#include <kis_global.h>
......
......@@ -43,7 +43,6 @@ class KisPenOpSettingsWidget;
class QWidget;
class QPointF;
class KisPainter;
class KCurve;
class KisPenOp : public KisBrushBasedPaintOp
......
......@@ -22,7 +22,6 @@
#include "kis_penop_settings_widget.h"
#include "kis_penop_settings.h"
#include <widgets/kcurve.h>
#include <kis_properties_configuration.h>
#include <kis_brush_option.h>
#include <kis_paintop_options_widget.h>
......
......@@ -41,7 +41,6 @@
#include <KoCompositeOp.h>
#include <KoInputDevice.h>
#include <widgets/kcurve.h>
#include <kis_brush.h>
#include <kis_datamanager.h>
#include <kis_global.h>
......
......@@ -45,7 +45,6 @@ class KisSmudgeOpSettingsWidget;
class QWidget;
class QPointF;
class KisPainter;
class KCurve;
class KisSmudgeOp : public KisBrushBasedPaintOp
......
......@@ -22,7 +22,6 @@
#include "kis_smudgeop_settings_widget.h"
#include "kis_smudgeop_settings.h"
#include <widgets/kcurve.h>
#include <kis_properties_configuration.h>
#include <kis_brush_option.h>
#include <kis_paintop_options_widget.h>
......
......@@ -44,7 +44,6 @@
#include <filter/kis_filter_registry.h>
#include <filter/kis_filter.h>
#include <filter/kis_filter_configuration.h>
#include <widgets/kcurve.h>
#include <kis_brush.h>
#include <kis_datamanager.h>
#include <kis_global.h>
......
......@@ -23,7 +23,6 @@
#include "kis_filterop_settings_widget.h"
#include "kis_filterop_settings.h"
#include <widgets/kcurve.h>
#include <kis_properties_configuration.h>
#include <kis_brush_option.h>
#include <filter/kis_filter.h>
......
......@@ -17,12 +17,12 @@
* Boston, MA 02110-1301, USA.
*/
#include "kis_curve_option.h"
#include "widgets/kcurve.h"
#include "widgets/kis_curve_widget.h"
KisCurveOption::KisCurveOption(const QString & label, const QString& name, bool checked)
: KisPaintOpOption(label, checked)
, m_customCurve(false)
, m_curveWidget( new KCurve() )
, m_curveWidget( new KisCurveWidget() )
, m_name( name )
{
setConfigurationPage(m_curveWidget);
......
......@@ -27,7 +27,7 @@
#include "kis_paintop_option.h"
#include "krita_export.h"
class KCurve;
class KisCurveWidget;
/**
* KisCurveOption is the base class for paintop options that are
......@@ -71,7 +71,7 @@ private slots:
protected:
bool m_customCurve;
KCurve * m_curveWidget;
KisCurveWidget * m_curveWidget;
QVector<double> m_curve;
QString m_name;
};
......
......@@ -29,7 +29,7 @@
#include <klocale.h>
#include <kis_paint_device.h>
#include <widgets/kcurve.h>
#include <widgets/kis_curve_widget.h>
#include <KoColor.h>
#include <KoColorSpace.h>
......
......@@ -30,7 +30,7 @@
#include <QList>
#include "kis_random_accessor.h"
#include "widgets/kcurve.h"
#include "widgets/kis_curve_widget.h"
#include <cmath>
#include <ctime>
......
......@@ -313,7 +313,7 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout_3" >
<item>
<widget class="KCurve" native="1" name="inkCurve" />
<widget class="KisCurveWidget" native="1" name="inkCurve" />
</item>
</layout>
</widget>
......@@ -454,9 +454,9 @@
</widget>
<customwidgets>
<customwidget>
<class>KCurve</class>
<class>KisCurveWidget</class>
<extends>QWidget</extends>
<header>widgets/kcurve.h</header>
<header>widgets/kis_curve_widget.h</header>
<container>1</container>
</customwidget>
</customwidgets>
......
......@@ -103,11 +103,11 @@ set(kritaui_LIB_SRCS
tool/kis_tool_freehand_p.cpp
tool/kis_tool_paint.cc
tool/kis_tool_shape.cc
widgets/kcurve.cc
widgets/kis_channelflags_widget.cpp
widgets/kis_cmb_composite.cc
widgets/kis_cmb_idlist.cc
widgets/kis_color_space_selector.cc
widgets/kis_curve_widget.cpp
widgets/kis_custom_image_widget.cc
widgets/kis_double_widget.cc
widgets/kis_filter_selector_widget.cc
......
......@@ -17,7 +17,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include "widgets/kcurve.h"
// C++ includes.
......@@ -49,23 +48,25 @@
// Local includes.
#include "widgets/kis_curve_widget.h"
#define bounds(x,a,b) (x<a ? a : (x>b ? b :x))
#define MOUSE_AWAY_THRES 15
#define POINT_AREA 1E-4
#define CURVE_AREA 1E-4
#include "kis_curve_widget_p.h"
static
bool pointLessThan(const QPointF &a, const QPointF &b);
#include "kcurve_p.h"
KCurve::KCurve(QWidget *parent, Qt::WFlags f)
: QWidget(parent, f), d(new KCurve::Private(this))
KisCurveWidget::KisCurveWidget(QWidget *parent, Qt::WFlags f)
: QWidget(parent, f), d(new KisCurveWidget::Private(this))
{
setObjectName("KCurve");
setObjectName("KisCurveWidget");
d->m_grab_point_index = -1;
d->m_readOnlyMode = false;
d->m_guideVisible = false;
......@@ -92,14 +93,14 @@ KCurve::KCurve(QWidget *parent, Qt::WFlags f)
setFocusPolicy(Qt::StrongFocus);
}
KCurve::~KCurve()
KisCurveWidget::~KisCurveWidget()
{
if(d->m_pixmapCache)
delete d->m_pixmapCache;
delete d;
}
void KCurve::setupInOutControls(QSpinBox *in, QSpinBox *out, int min, int max)
void KisCurveWidget::setupInOutControls(QSpinBox *in, QSpinBox *out, int min, int max)
{
d->m_intIn=in;
d->m_intOut=out;
......@@ -119,7 +120,7 @@ void KCurve::setupInOutControls(QSpinBox *in, QSpinBox *out, int min, int max)
d->syncIOControls();
}
void KCurve::dropInOutControls()
void KisCurveWidget::dropInOutControls()
{
if(!d->m_intIn || !d->m_intOut)
return;
......@@ -131,7 +132,7 @@ void KCurve::dropInOutControls()
}
void KCurve::inOutChanged(int)
void KisCurveWidget::inOutChanged(int)
{
QPointF pt;
......@@ -162,7 +163,7 @@ void KCurve::inOutChanged(int)
}
void KCurve::reset(void)
void KisCurveWidget::reset(void)
{
d->m_grab_point_index = -1;
d->m_guideVisible = false;
......@@ -170,21 +171,21 @@ void KCurve::reset(void)
d->setCurveModified();
}