1 /***************************************************************************
2 * Copyright (C) 2008 by Marco Gittler (g.marco@freenet.de) *
3 * Copyright (C) 2008 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
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. *
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. *
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 ***************************************************************************/
21 #ifndef ABSTRACTCLIPITEM
22 #define ABSTRACTCLIPITEM
24 #include <QGraphicsRectItem>
25 #include "definitions.h"
28 class AbstractClipItem : public QObject , public QGraphicsRectItem {
31 AbstractClipItem(const ItemInfo info, const QRectF& rect, double fps);
32 void updateSelectedKeyFrame();
33 void updateKeyFramePos(const GenTime pos, const int value);
34 void addKeyFrame(const GenTime pos, const int value);
35 bool hasKeyFrames() const;
37 virtual OPERATIONTYPE operationMode(QPointF pos, double scale) = 0;
38 virtual GenTime startPos() const ;
39 virtual void setTrack(int track);
40 virtual GenTime endPos() const ;
41 virtual int track() const ;
42 virtual void moveTo(int x, double scale, int offset, int newTrack);
43 virtual GenTime cropStart() const ;
44 virtual void resizeStart(int posx, double scale);
45 virtual void resizeEnd(int posx, double scale);
46 virtual GenTime duration() const;
47 virtual double fps() const;
48 virtual GenTime maxDuration() const;
49 virtual void setCropStart(GenTime pos);
54 int m_selectedKeyframe;
56 GenTime m_cropDuration;
58 GenTime m_maxDuration;
59 QMap <int, double> m_keyframes;
60 double m_keyframeFactor;
61 double m_keyframeDefault;
63 QPainterPath upperRectPart(QRectF);
64 QPainterPath lowerRectPart(QRectF);
66 void drawKeyFrames(QPainter *painter, QRectF exposedRect);
67 int mouseOverKeyFrames(QPointF pos);