]> git.sesse.net Git - kdenlive/commitdiff
Bezier color curves: obey to DragValue's direct update setting
authorTill Theato <root@ttill.de>
Fri, 18 Mar 2011 19:35:42 +0000 (19:35 +0000)
committerTill Theato <root@ttill.de>
Fri, 18 Mar 2011 19:35:42 +0000 (19:35 +0000)
svn path=/trunk/kdenlive/; revision=5502

src/beziercurve/beziersplineeditor.cpp
src/beziercurve/beziersplineeditor.h
src/beziercurve/beziersplinewidget.cpp
src/beziercurve/beziersplinewidget.h

index 626ffd9734d07811d366eedb5e501b942c2121f8..3eedaf8848ed6b7eba5949fbbc4f50ab623188a1 100644 (file)
@@ -17,6 +17,7 @@
  ***************************************************************************/
 
 #include "beziersplineeditor.h"
+#include "kdenlivesettings.h"
 
 #include <QPainter>
 #include <QMouseEvent>
@@ -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();
     }
 }
index 4660fca894cd39551ed1dede97609b7d85a5d6ae..19b091277a001f5cc9ec7f490f81c920e4e0986f 100644 (file)
@@ -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();
index 1e286441ecd5309709a51d2a99c5796f1fdf890b..d29c9d8fac508678d08e98fa241afee14584d3e0 100644 (file)
@@ -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)
index ee8935fcd51d8059ba38c2b5ef2dfdd61ced08bf..a847cfd86567c4f15d9f933564e7cee2486e9f27 100644 (file)
@@ -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();