From 33e609c7383ee9a2a5993f019a7dfa1ccfe1138d Mon Sep 17 00:00:00 2001 From: Till Theato Date: Fri, 18 Mar 2011 19:35:42 +0000 Subject: [PATCH] Bezier color curves: obey to DragValue's direct update setting svn path=/trunk/kdenlive/; revision=5502 --- src/beziercurve/beziersplineeditor.cpp | 8 +++++-- src/beziercurve/beziersplineeditor.h | 5 +++-- src/beziercurve/beziersplinewidget.cpp | 30 +++++++++++++++----------- src/beziercurve/beziersplinewidget.h | 18 ++++++++++------ 4 files changed, 39 insertions(+), 22 deletions(-) diff --git a/src/beziercurve/beziersplineeditor.cpp b/src/beziercurve/beziersplineeditor.cpp index 626ffd97..3eedaf88 100644 --- a/src/beziercurve/beziersplineeditor.cpp +++ b/src/beziercurve/beziersplineeditor.cpp @@ -17,6 +17,7 @@ ***************************************************************************/ #include "beziersplineeditor.h" +#include "kdenlivesettings.h" #include #include @@ -68,13 +69,14 @@ BPoint BezierSplineEditor::getCurrentPoint() return BPoint(); } -void BezierSplineEditor::updateCurrentPoint(const BPoint& p) +void BezierSplineEditor::updateCurrentPoint(const BPoint& p, bool final) { if (m_currentPointIndex >= 0) { m_spline.setPoint(m_currentPointIndex, p); // during validation the point might have changed emit currentPoint(m_spline.getPoint(m_currentPointIndex)); - emit modified(); + if (final) + emit modified(); update(); } } @@ -436,6 +438,8 @@ void BezierSplineEditor::mouseMoveEvent(QMouseEvent* event) } emit currentPoint(point); + if (KdenliveSettings::dragvalue_directupdate()) + emit modified(); update(); } } diff --git a/src/beziercurve/beziersplineeditor.h b/src/beziercurve/beziersplineeditor.h index 4660fca8..19b09127 100644 --- a/src/beziercurve/beziersplineeditor.h +++ b/src/beziercurve/beziersplineeditor.h @@ -38,8 +38,9 @@ public: /** @brief Returns the selected point or else BPoint. */ BPoint getCurrentPoint(); - /** @brief Replaces current point with @param p (index stays the same). */ - void updateCurrentPoint(const BPoint &p); + /** @brief Replaces current point with @param p (index stays the same). + * @param final (default = true) emit signal modified? */ + void updateCurrentPoint(const BPoint &p, bool final = true); /** @brief Number of lines used in grid. */ int gridLines(); diff --git a/src/beziercurve/beziersplinewidget.cpp b/src/beziercurve/beziersplinewidget.cpp index 1e286441..d29c9d8f 100644 --- a/src/beziercurve/beziersplinewidget.cpp +++ b/src/beziercurve/beziersplinewidget.cpp @@ -82,12 +82,12 @@ BezierSplineWidget::BezierSplineWidget(const QString& spline, QWidget* parent) : connect(&m_edit, SIGNAL(modified()), this, SIGNAL(modified())); connect(&m_edit, SIGNAL(currentPoint(const BPoint&)), this, SLOT(slotUpdatePointEntries(const BPoint&))); - connect(m_pX, SIGNAL(valueChanged(double, bool)), this, SLOT(slotUpdatePointP())); - connect(m_pY, SIGNAL(valueChanged(double,bool)), this, SLOT(slotUpdatePointP())); - connect(m_h1X, SIGNAL(valueChanged(double,bool)), this, SLOT(slotUpdatePointH1())); - connect(m_h1Y, SIGNAL(valueChanged(double,bool)), this, SLOT(slotUpdatePointH1())); - connect(m_h2X, SIGNAL(valueChanged(double,bool)), this, SLOT(slotUpdatePointH2())); - connect(m_h2Y, SIGNAL(valueChanged(double,bool)), this, SLOT(slotUpdatePointH2())); + connect(m_pX, SIGNAL(valueChanged(double, bool)), this, SLOT(slotUpdatePointP(double, bool))); + connect(m_pY, SIGNAL(valueChanged(double,bool)), this, SLOT(slotUpdatePointP(double, bool))); + connect(m_h1X, SIGNAL(valueChanged(double,bool)), this, SLOT(slotUpdatePointH1(double, bool))); + connect(m_h1Y, SIGNAL(valueChanged(double,bool)), this, SLOT(slotUpdatePointH1(double, bool))); + connect(m_h2X, SIGNAL(valueChanged(double,bool)), this, SLOT(slotUpdatePointH2(double, bool))); + connect(m_h2Y, SIGNAL(valueChanged(double,bool)), this, SLOT(slotUpdatePointH2(double, bool))); connect(m_ui.buttonLinkHandles, SIGNAL(toggled(bool)), this, SLOT(slotSetHandlesLinked(bool))); connect(m_ui.buttonZoomIn, SIGNAL(clicked()), &m_edit, SLOT(slotZoomIn())); @@ -165,31 +165,37 @@ void BezierSplineWidget::slotUpdatePointEntries(const BPoint &p) blockSignals(false); } -void BezierSplineWidget::slotUpdatePointP() +void BezierSplineWidget::slotUpdatePointP(double value, bool final) { + Q_UNUSED(value) + BPoint p = m_edit.getCurrentPoint(); p.setP(QPointF(m_pX->value(), m_pY->value())); - m_edit.updateCurrentPoint(p); + m_edit.updateCurrentPoint(p, final); } -void BezierSplineWidget::slotUpdatePointH1() +void BezierSplineWidget::slotUpdatePointH1(double value, bool final) { + Q_UNUSED(value) + BPoint p = m_edit.getCurrentPoint(); p.setH1(QPointF(m_h1X->value(), m_h1Y->value())); - m_edit.updateCurrentPoint(p); + m_edit.updateCurrentPoint(p, final); } -void BezierSplineWidget::slotUpdatePointH2() +void BezierSplineWidget::slotUpdatePointH2(double value, bool final) { + Q_UNUSED(value) + BPoint p = m_edit.getCurrentPoint(); p.setH2(QPointF(m_h2X->value(), m_h2Y->value())); - m_edit.updateCurrentPoint(p); + m_edit.updateCurrentPoint(p, final); } void BezierSplineWidget::slotSetHandlesLinked(bool linked) diff --git a/src/beziercurve/beziersplinewidget.h b/src/beziercurve/beziersplinewidget.h index ee8935fc..a847cfd8 100644 --- a/src/beziercurve/beziersplinewidget.h +++ b/src/beziercurve/beziersplinewidget.h @@ -50,12 +50,18 @@ private slots: /** @brief Sets the spinboxes for modifing the selected point to @param p. */ void slotUpdatePointEntries(const BPoint &p); - /** @brief Updates the editor and thus the spline if the current point's p was modified using the spinboxes. */ - void slotUpdatePointP(); - /** @brief Updates the editor and thus the spline if the current point's h1 was modified using the spinboxes. */ - void slotUpdatePointH1(); - /** @brief Updates the editor and thus the spline if the current point's h2 was modified using the spinboxes. */ - void slotUpdatePointH2(); + /** @brief Updates the spline if the current point's p was modified using the spinboxes. + * @param value (optional) not used, neccessary to be able to connect to DragValue's valueChanged. + * @param final (default = true) emit signal modified? */ + void slotUpdatePointP(double value = 1, bool final = true); + /** @brief Updates the spline if the current point's h1 was modified using the spinboxes. + * @param value (optional) not used, neccessary to be able to connect to DragValue's valueChanged. + * @param final (default = true) emit signal modified? */ + void slotUpdatePointH1(double value = 1, bool final = true); + /** @brief Updates the spline if the current point's h2 was modified using the spinboxes. + * @param value (optional) not used, neccessary to be able to connect to DragValue's valueChanged. + * @param final (default = true) emit signal modified? */ + void slotUpdatePointH2(double value = 1, bool final = true); /** @brief Increases the number of lines in the editor's grid. If there are already 8 lines the number is set to 0. */ void slotGridChange(); -- 2.39.2