]> git.sesse.net Git - kdenlive/blob - src/abstractclipitem.h
Krazy fixes: cleanup all headers
[kdenlive] / src / abstractclipitem.h
1 /***************************************************************************
2  *   Copyright (C) 2008 by Marco Gittler (g.marco@freenet.de)              *
3  *   Copyright (C) 2008 by Jean-Baptiste Mardelle (jb@kdenlive.org)        *
4  *                                                                         *
5  *   This program 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  *   This program 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 this program; if not, write to the                         *
17  *   Free Software Foundation, Inc.,                                       *
18  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
19  ***************************************************************************/
20
21 #ifndef ABSTRACTCLIPITEM
22 #define ABSTRACTCLIPITEM
23
24 #include <QGraphicsRectItem>
25 #include "definitions.h"
26 #include "gentime.h"
27
28 class CustomTrackScene;
29
30 class AbstractClipItem : public QObject , public QGraphicsRectItem {
31     Q_OBJECT
32 public:
33     AbstractClipItem(const ItemInfo info, const QRectF& rect, double fps);
34     void updateSelectedKeyFrame();
35     void updateKeyFramePos(const GenTime pos, const double value);
36     void addKeyFrame(const GenTime pos, const double value);
37     bool hasKeyFrames() const;
38     int selectedKeyFramePos() const;
39     double selectedKeyFrameValue() const;
40     double keyFrameFactor() const;
41     ItemInfo info() const;
42     CustomTrackScene* projectScene();
43     void updateRectGeometry();
44     void updateItem();
45     void setItemLocked(bool locked);
46     bool isItemLocked() const;
47
48     virtual  OPERATIONTYPE operationMode(QPointF pos) = 0;
49     virtual GenTime startPos() const ;
50     virtual void setTrack(int track);
51     virtual GenTime endPos() const ;
52     virtual int track() const ;
53     virtual GenTime cropStart() const ;
54     virtual GenTime cropDuration() const ;
55     virtual void resizeStart(int posx, double speed = 1.0);
56     virtual void resizeEnd(int posx, double speed = 1.0, bool updateKeyFrames = true);
57     virtual GenTime duration() const;
58     virtual double fps() const;
59     virtual GenTime maxDuration() const;
60     virtual void setCropStart(GenTime pos);
61     virtual void setMaxDuration(const GenTime &max);
62
63 protected:
64     int m_track;
65     int m_editedKeyframe;
66     int m_selectedKeyframe;
67     GenTime m_cropStart;
68     GenTime m_cropDuration;
69     GenTime m_startPos;
70     GenTime m_maxDuration;
71     QMap <int, double> m_keyframes;
72     double m_keyframeFactor;
73     double m_keyframeDefault;
74     double m_fps;
75     QPainterPath upperRectPart(QRectF);
76     QPainterPath lowerRectPart(QRectF);
77     //QRect visibleRect();
78     void drawKeyFrames(QPainter *painter, QRectF exposedRect);
79     int mouseOverKeyFrames(QPointF pos);
80 };
81
82 #endif