From 84247e4126aaeb89d88a8e04bfcdcfb466431be4 Mon Sep 17 00:00:00 2001 From: Till Theato Date: Sat, 21 Aug 2010 20:48:34 +0000 Subject: [PATCH] Use RGB plane as Curve Widget background: http://kdenlive.org/mantis/view.php?id=1757 svn path=/trunk/kdenlive/; revision=4742 --- effects/frei0r_curves.xml | 2 +- src/colortools.h | 2 +- src/effectstackedit.cpp | 23 +++++++++++++++++++++++ src/effectstackedit.h | 12 +++++++++--- src/kis_curve_widget.cpp | 1 - 5 files changed, 34 insertions(+), 6 deletions(-) diff --git a/effects/frei0r_curves.xml b/effects/frei0r_curves.xml index 23aa124f..adb522c1 100644 --- a/effects/frei0r_curves.xml +++ b/effects/frei0r_curves.xml @@ -6,7 +6,7 @@ Channel - + Curve Widget diff --git a/src/colortools.h b/src/colortools.h index 1b2eb1a2..0afabe0b 100644 --- a/src/colortools.h +++ b/src/colortools.h @@ -51,7 +51,7 @@ public: color defines the color to modify on the y axis. The other two components will be increased in equal terms (linear as well) on the x axis. */ - QImage rgbCurvePlane(const QSize &size, const ColorTools::ColorsRGB &color); + static QImage rgbCurvePlane(const QSize &size, const ColorTools::ColorsRGB &color); /** @brief Draws a YPbPr plane with Pb on the x axis and Pr on the y axis. Y is the Y value to use. diff --git a/src/effectstackedit.cpp b/src/effectstackedit.cpp index 2c20c8fd..a95bcf6d 100644 --- a/src/effectstackedit.cpp +++ b/src/effectstackedit.cpp @@ -32,6 +32,7 @@ #include "kis_cubic_curve.h" #include "choosecolorwidget.h" #include "geometrywidget.h" +#include "colortools.h" #include #include @@ -142,6 +143,20 @@ void EffectStackEdit::updateTimecodeFormat() } } +void EffectStackEdit::meetDependency(const QString& name, QString type, QString value) +{ + if (type == "curve") { + KisCurveWidget *curve = (KisCurveWidget*)m_valueItems[name]; + if (curve) { + int color = value.toInt(); + if (color < 3) + curve->setPixmap(QPixmap::fromImage(ColorTools::rgbCurvePlane(curve->size(), (ColorTools::ColorsRGB)color))); + else + curve->setPixmap(QPixmap()); + } + } +} + void EffectStackEdit::updateProjectFormat(MltVideoProfile profile, Timecode t) { m_profile = profile; @@ -348,8 +363,13 @@ void EffectStackEdit::transferParamDesc(const QDomElement d, int pos, int in, in m_vbox->addWidget(curve); m_vbox->addWidget(spinin); m_vbox->addWidget(spinout); + connect(curve, SIGNAL(modified()), this, SLOT(collectAllParameters())); m_valueItems[paramName] = curve; + + QString depends = pa.attribute("depends"); + if (!depends.isEmpty()) + meetDependency(paramName, type, EffectsList::parameter(e, depends)); } else if (type == "wipe") { Wipeval *wpval = new Wipeval; wpval->setupUi(toFillin); @@ -601,6 +621,9 @@ void EffectStackEdit::collectAllParameters() EffectsList::setParameter(newparam, in, QString::number(points.at(j).x())); EffectsList::setParameter(newparam, out, QString::number(points.at(j).y())); } + QString depends = pa.attributes().namedItem("depends").nodeValue(); + if (!depends.isEmpty()) + meetDependency(paramName, type, EffectsList::parameter(newparam, depends)); } else if (type == "wipe") { Wipeval *wp = (Wipeval*)m_valueItems.value(paramName); wipeInfo info; diff --git a/src/effectstackedit.h b/src/effectstackedit.h index fa1f1f44..a737616c 100644 --- a/src/effectstackedit.h +++ b/src/effectstackedit.h @@ -55,14 +55,20 @@ public: private: void clearAllItems(); + void createSliderItem(const QString& name, int val , int min, int max, const QString); + wipeInfo getWipeInfo(QString value); + QString getWipeString(wipeInfo info); + /** @brief Updates parameter @param name according to new value of dependency. + * @param name Name of the parameter which will be updated + * @param type Type of the parameter which will be updated + * @param value Value of the dependency parameter */ + void meetDependency(const QString& name, QString type, QString value); + QVBoxLayout *m_vbox; QList m_uiItems; QWidget *m_baseWidget; QDomElement m_params; QMap m_valueItems; - void createSliderItem(const QString& name, int val , int min, int max, const QString); - wipeInfo getWipeInfo(QString value); - QString getWipeString(wipeInfo info); MltVideoProfile m_profile; Timecode m_timecode; int m_in; diff --git a/src/kis_curve_widget.cpp b/src/kis_curve_widget.cpp index 228373c0..230271e5 100644 --- a/src/kis_curve_widget.cpp +++ b/src/kis_curve_widget.cpp @@ -168,7 +168,6 @@ void KisCurveWidget::setCurveGuide(const QColor & color) { d->m_guideVisible = true; d->m_colorGuide = color; - } void KisCurveWidget::setPixmap(const QPixmap & pix) -- 2.39.2