]> git.sesse.net Git - kdenlive/blob - src/abstractclipitem.h
Fix various speed related issues
[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 class QGraphicsSceneMouseEvent;
30
31 class AbstractClipItem : public QObject , public QGraphicsRectItem
32 {
33     Q_OBJECT
34 public:
35     AbstractClipItem(const ItemInfo info, const QRectF& rect, double fps);
36     void updateSelectedKeyFrame();
37     void updateKeyFramePos(const GenTime pos, const double value);
38     void addKeyFrame(const GenTime pos, const double value);
39     bool hasKeyFrames() const;
40     int selectedKeyFramePos() const;
41     double selectedKeyFrameValue() const;
42     double keyFrameFactor() const;
43     ItemInfo info() const;
44     CustomTrackScene* projectScene();
45     void updateRectGeometry();
46     void updateItem();
47     void setItemLocked(bool locked);
48     bool isItemLocked() const;
49
50     virtual  OPERATIONTYPE operationMode(QPointF pos) = 0;
51     virtual GenTime startPos() const ;
52     virtual void setTrack(int track);
53     virtual GenTime endPos() const ;
54     virtual int track() const ;
55     virtual GenTime cropStart() const ;
56     virtual GenTime cropDuration() const ;
57     virtual void resizeStart(int posx, double speed = 1.0);
58     virtual void resizeEnd(int posx, double speed = 1.0);
59     virtual double fps() const;
60     virtual void updateFps(double fps);
61     virtual GenTime maxDuration() const;
62     virtual void setCropStart(GenTime pos);
63
64 protected:    
65     ItemInfo m_info;
66 //    int m_track;
67     int m_editedKeyframe;
68     int m_selectedKeyframe;
69 /*    GenTime m_cropStart;
70     GenTime m_cropDuration;
71     GenTime m_startPos;*/
72     GenTime m_maxDuration;
73     QMap <int, int> m_keyframes;
74     double m_keyframeFactor;
75     double m_keyframeDefault;
76     double m_fps;
77     //QRect visibleRect();
78     void drawKeyFrames(QPainter *painter, QRectF exposedRect);
79     int mouseOverKeyFrames(QPointF pos, double maxOffset);
80     virtual void mousePressEvent(QGraphicsSceneMouseEvent * event);
81 };
82
83 #endif