]> git.sesse.net Git - kdenlive/blob - src/onmonitoritems/rotoscoping/splineitem.h
Fix includes
[kdenlive] / src / onmonitoritems / rotoscoping / splineitem.h
1 /***************************************************************************
2  *   Copyright (C) 2011 by Till Theato (root@ttill.de)                     *
3  *   This file is part of Kdenlive (www.kdenlive.org).                     *
4  *                                                                         *
5  *   Kdenlive is free software: you can redistribute it and/or modify      *
6  *   it under the terms of the GNU General Public License as published by  *
7  *   the Free Software Foundation, either version 2 of the License, or     *
8  *   (at your option) any later version.                                   *
9  *                                                                         *
10  *   Kdenlive is distributed in the hope that it will be useful,           *
11  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
12  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
13  *   GNU General Public License for more details.                          *
14  *                                                                         *
15  *   You should have received a copy of the GNU General Public License     *
16  *   along with Kdenlive.  If not, see <http://www.gnu.org/licenses/>.     *
17  ***************************************************************************/
18
19 #ifndef SPLINEITEM_H
20 #define SPLINEITEM_H
21
22 #include <QGraphicsPathItem>
23
24 class BPoint;
25 class QGraphicsView;
26
27 class SplineItem : public QObject, public QGraphicsPathItem
28 {
29     Q_OBJECT
30
31 public:
32     explicit SplineItem(const QList <BPoint> &points, QGraphicsItem* parent = 0, QGraphicsScene *scene = 0);
33
34     enum { Type = UserType + 10 };
35
36     virtual int type() const;
37
38     bool editing() const;
39
40     void updateSpline(bool editing = false);
41     QList <BPoint> getPoints() const;
42     void setPoints(const QList <BPoint> &points);
43
44     void removeChild(QGraphicsItem *child);
45
46 protected:
47     void mousePressEvent(QGraphicsSceneMouseEvent *event);
48     void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
49     void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
50     void hoverMoveEvent(QGraphicsSceneHoverEvent *event);
51
52 private:
53     int getClosestPointOnCurve(const QPointF &point, double *tFinal);
54
55     bool m_closed;
56     bool m_editing;
57     QGraphicsView *m_view;
58
59 signals:
60     void changed(bool editing);
61 };
62
63 #endif