]> git.sesse.net Git - kdenlive/blobdiff - src/beziercurve/beziersplineeditor.h
Integrate with the required MLT hooks for getting Movit to work.
[kdenlive] / src / beziercurve / beziersplineeditor.h
index b4dfe7aeafafdef0fcd8d37212032abc3790f7d8..d0f267ca9c66fc7cc8527b645d0c97c5325d9c78 100644 (file)
@@ -29,25 +29,43 @@ class BezierSplineEditor : public QWidget
     Q_OBJECT
 
 public:
-    BezierSplineEditor(QWidget* parent = 0);
+    explicit BezierSplineEditor(QWidget* parent = 0);
+    ~BezierSplineEditor();
 
-    CubicBezierSpline spline();
+    CubicBezierSpline spline() const;
     void setSpline(const CubicBezierSpline &spline);
 
+    /** @brief Returns the selected point or else BPoint. */
     BPoint getCurrentPoint();
-    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() const;
+
+    /** @brief Sets the number of grid lines to draw (in one direction) to @param lines. */
+    void setGridLines(int lines);
+
+    /** @brief Sets the background pixmap to @param pixmap. */
+    void setPixmap(const QPixmap &pixmap);
+
+    /** @brief Sets the property showAllHandles to @param show.
+     *
+     * showAllHandles: Whether to show only handles for the selected point for all points. */
+    void setShowAllHandles(bool show);
 
 public slots:
     void slotZoomIn();
     void slotZoomOut();
-    void slotGridChange();
 
 protected:
-    //void keyPressEvent(QKeyEvent *event);
     void paintEvent(QPaintEvent *event);
     void mousePressEvent(QMouseEvent *event);
     void mouseReleaseEvent(QMouseEvent * event);
     void mouseMoveEvent(QMouseEvent * event);
+    void mouseDoubleClickEvent(QMouseEvent *event);
     void leaveEvent(QEvent *event);
     void resizeEvent(QResizeEvent *event);
 
@@ -58,17 +76,31 @@ private:
     modes m_mode;
     int m_zoomLevel;
     int m_gridLines;
+    /** Whether to show handles for all points or only for the selected one. */
+    bool m_showAllHandles;
+    /** Background */
+    QPixmap m_pixmap;
+    /** A copy of m_pixmap but scaled to fit the size of the edit region */
+    QPixmap *m_pixmapCache;
+    /** Whether we have to regenerate the pixmap cache because the pixmap or the size of the edit region changed. */
+    bool m_pixmapIsDirty;
+
     int m_currentPointIndex;
     point_types m_currentPointType;
     double m_grabOffsetX;
     double m_grabOffsetY;
-    double m_grabOriginalX;
-    double m_grabOriginalY;
-    //QPointF m_draggedAwayPoint;
-    //int m_draggedAwayPointIndex;
+    /** selected point before it was modified by dragging (at the time of the mouse press) */
+    BPoint m_grabPOriginal;
+    /** point with the index currentPointIndex + 1 at the time of the mouse press */
+    BPoint m_grabPNext;
+    /** point with the index currentPointIndex - 1 at the time of the mouse press */
+    BPoint m_grabPPrevious;
 
-    //inline void drawGrid(QPainter &p, int width, int height);
-    int nearestPointInRange(QPointF p, int wWidth, int wHeight, point_types *sel);
+    /** @brief Finds the point nearest to @param p and returns it's index.
+     * @param sel Is filled with the type of the closest point (h1, p, h2)
+     *
+     * If no point is near enough -1 is returned. */
+    int nearestPointInRange(const QPointF &p, int wWidth, int wHeight, point_types *sel);
 
 signals:
     void modified();