]> git.sesse.net Git - kdenlive/blob - src/rotoscoping/rotowidget.h
dc385f673e062c4cc7fedf0b9f3b14a03726b15d
[kdenlive] / src / rotoscoping / rotowidget.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 ROTOWIDGET_H
20 #define ROTOWIDGET_H
21
22 #include "bpoint.h"
23 #include "timecode.h"
24
25 #include <QWidget>
26
27 class Monitor;
28 class MonitorScene;
29 class SplineItem;
30 class SimpleKeyframeWidget;
31
32 class RotoWidget : public QWidget
33 {
34     Q_OBJECT
35
36 public:
37     RotoWidget(QString data, Monitor *monitor, int in, int out, Timecode t, QWidget* parent = 0);
38     virtual ~RotoWidget();
39
40     QString getSpline();
41     void updateTimecodeFormat();
42
43 public slots:
44     /** @brief Switches from normal monitor to monitor scene according to @param show. */
45     void slotShowScene(bool show = true);
46     /** @brief Updates the on-monitor item.  */
47     void slotSyncPosition(int relTimelinePos);
48
49 signals:
50     void valueChanged();
51     void checkMonitorPosition(int);
52     void seekToPos(int pos);
53
54
55 private:
56     SimpleKeyframeWidget *m_keyframeWidget;
57     Monitor *m_monitor;
58     MonitorScene *m_scene;
59     bool m_showScene;
60     QVariant m_data;
61     SplineItem *m_item;
62     int m_in;
63     int m_out;
64
65     QList <BPoint> getPoints(int keyframe);
66
67 private slots:
68     /** @brief Makes sure the monitor effect scene is only visible if the clip this geometry belongs to is visible.
69     * @param renderPos Postion of the Monitor / Timeline cursor */
70     void slotCheckMonitorPosition(int renderPos);
71
72     void slotUpdateData(int pos = -1, bool editing = false);
73     void slotUpdateData(bool editing);
74
75     void slotPositionChanged(int pos, bool seek = true);
76
77     void slotAddKeyframe(int pos = -1);
78     void slotRemoveKeyframe(int pos = -1);
79     void slotMoveKeyframe(int oldPos, int newPos);
80 };
81
82 #endif