]> git.sesse.net Git - kdenlive/blobdiff - src/onmonitoritems/onmonitorcornersitem.h
Affine / composite transition path can now be edited on the monitor
[kdenlive] / src / onmonitoritems / onmonitorcornersitem.h
index 8d7caceeeb505773072eba18b251be7021457dca..1e09069b38d29d764eea8abaef6f901715ae7ae0 100644 (file)
 #ifndef ONMONITORCORNERSITEM_H
 #define ONMONITORCORNERSITEM_H
 
-#include "abstractonmonitoritem.h"
 
 #include <QtCore>
 #include <QGraphicsPolygonItem>
 
-class OnMonitorCornersItem : public AbstractOnMonitorItem, public QGraphicsPolygonItem
+class QGraphicsView;
+
+class OnMonitorCornersItem : public QObject, public QGraphicsPolygonItem
 {
     Q_OBJECT
 public:
-    OnMonitorCornersItem(MonitorScene *scene, QGraphicsItem *parent = 0);
+    OnMonitorCornersItem(QGraphicsItem *parent = 0);
 
-    enum cornersActions { Corner1, Corner2, Corner3, Corner4, Move, NoAction };
+    enum cornersActions { Corner, Move, MoveSide, NoAction };
     /** @brief Gets The action mode for the area @param pos +- 4. */
-    cornersActions getMode(QPointF pos);
+    cornersActions getMode(QPointF pos, int *corner);
 
     /** @brief Reimplemented to draw the handles. */
     virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0 );
 
-public slots:
-    /** @brief Saves current mouse position and mode. */
-    void slotMousePressed(QGraphicsSceneMouseEvent *event);
-    /** @brief Modifies item according to mouse position and mode. */
-    void slotMouseMoved(QGraphicsSceneMouseEvent *event);
+protected:
+    virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
+    virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
+    virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
+    virtual void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
 
 private:
     /** @brief Returns the centroid (= 'center of mass') of this polygon. */
@@ -52,8 +53,19 @@ private:
     /** @brief Returns the points of this polygon but sorted clockwise. */
     QList <QPointF> sortedClockwise();
 
+    /** @brief Tries to get the view of the scene. */
+    bool getView();
+
     cornersActions m_mode;
+    /** Number of the selected corner or if in MoveSide mode number of the first corner on this side */
+    int m_selectedCorner;
     QPointF m_lastPoint;
+    bool m_modified;
+
+    QGraphicsView *m_view;
+
+signals:
+    void changed();
 };
 
 #endif