]> git.sesse.net Git - kdenlive/blob - src/abstractclipitem.h
keyframes can now be edited through double click
[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 AbstractClipItem : public QObject , public QGraphicsRectItem {
29     Q_OBJECT
30 public:
31     AbstractClipItem(const ItemInfo info, const QRectF& rect, double fps);
32     void updateSelectedKeyFrame();
33     void updateKeyFramePos(const GenTime pos, const double value);
34     void addKeyFrame(const GenTime pos, const double value);
35     bool hasKeyFrames() const;
36     int selectedKeyFramePos() const;
37     double selectedKeyFrameValue() const;
38     double keyFrameFactor() const;
39
40     virtual  OPERATIONTYPE operationMode(QPointF pos, double scale) = 0;
41     virtual GenTime startPos() const ;
42     virtual void setTrack(int track);
43     virtual GenTime endPos() const ;
44     virtual int track() const ;
45     virtual void moveTo(int x, double scale, int offset, int newTrack);
46     virtual GenTime cropStart() const ;
47     virtual void resizeStart(int posx, double scale);
48     virtual void resizeEnd(int posx, double scale);
49     virtual GenTime duration() const;
50     virtual double fps() const;
51     virtual GenTime maxDuration() const;
52     virtual void setCropStart(GenTime pos);
53
54 protected:
55     int m_track;
56     int m_editedKeyframe;
57     int m_selectedKeyframe;
58     GenTime m_cropStart;
59     GenTime m_cropDuration;
60     GenTime m_startPos;
61     GenTime m_maxDuration;
62     QMap <int, double> m_keyframes;
63     double m_keyframeFactor;
64     double m_keyframeDefault;
65     double m_fps;
66     QPainterPath upperRectPart(QRectF);
67     QPainterPath lowerRectPart(QRectF);
68     QRect visibleRect();
69     void drawKeyFrames(QPainter *painter, QRectF exposedRect);
70     int mouseOverKeyFrames(QPointF pos);
71 };
72
73 #endif