]> git.sesse.net Git - kdenlive/blob - src/trackview.h
Progress on track effects
[kdenlive] / src / trackview.h
1 /***************************************************************************
2  *   Copyright (C) 2007 by Jean-Baptiste Mardelle (jb@kdenlive.org)        *
3  *                                                                         *
4  *   This program is free software; you can redistribute it and/or modify  *
5  *   it under the terms of the GNU General Public License as published by  *
6  *   the Free Software Foundation; either version 2 of the License, or     *
7  *   (at your option) any later version.                                   *
8  *                                                                         *
9  *   This program is distributed in the hope that it will be useful,       *
10  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
11  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
12  *   GNU General Public License for more details.                          *
13  *                                                                         *
14  *   You should have received a copy of the GNU General Public License     *
15  *   along with this program; if not, write to the                         *
16  *   Free Software Foundation, Inc.,                                       *
17  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
18  ***************************************************************************/
19
20 /**
21 * @class TrackView
22 * @brief Manages the timline
23 * @author Jean-Baptiste Mardelle
24 */
25
26 #ifndef TRACKVIEW_H
27 #define TRACKVIEW_H
28
29 #include <QScrollArea>
30 #include <QGroupBox>
31 #include <QGraphicsScene>
32 #include <QGraphicsLineItem>
33 #include <QDomElement>
34
35 #include <KRuler>
36
37 #include "customtrackscene.h"
38 #include "effectslist.h"
39 #include "ui_timeline_ui.h"
40
41 class ClipItem;
42 class Transition;
43 class CustomTrackView;
44 class KdenliveDoc;
45 class CustomRuler;
46 class DocClipBase;
47
48 class TrackView : public QWidget, public Ui::TimeLine_UI
49 {
50     Q_OBJECT
51
52 public:
53     explicit TrackView(KdenliveDoc *doc, bool *ok, QWidget *parent = 0);
54     virtual ~ TrackView();
55     void setEditMode(const QString & editMode);
56     const QString & editMode() const;
57     QGraphicsScene *projectScene();
58     CustomTrackView *projectView();
59     int duration() const;
60     int tracksNumber() const;
61     KdenliveDoc *document();
62     void refresh() ;
63     void updateProjectFps();
64     int outPoint() const;
65     int inPoint() const;
66     int fitZoom() const;
67
68     /** @brief Updates (redraws) the ruler.
69     *
70     * Used to change from displaying frames to timecode or vice versa. */
71     void updateRuler();
72
73     /** @brief Parse tracks to see if project has audio in it.
74     *
75     * Parses all tracks to check if there is audio data. */
76     bool checkProjectAudio() const;
77
78 protected:
79     virtual void keyPressEvent(QKeyEvent * event);
80
81 public slots:
82     void slotDeleteClip(const QString &clipId);
83     void slotChangeZoom(int horizontal, int vertical = -1);
84     void setDuration(int dur);
85     void slotSetZone(QPoint p);
86
87 private:
88     CustomRuler *m_ruler;
89     CustomTrackView *m_trackview;
90     QList <QString> m_invalidProducers;
91     double m_scale;
92     int m_projectTracks;
93     QString m_editMode;
94     CustomTrackScene *m_scene;
95
96     KdenliveDoc *m_doc;
97     int m_verticalZoom;
98     QString m_documentErrors;
99     void parseDocument(QDomDocument doc);
100     int slotAddProjectTrack(int ix, QDomElement xml, bool locked);
101     DocClipBase *getMissingProducer(const QString id) const;
102     void adjustTrackHeaders();
103
104 private slots:
105     void setCursorPos(int pos);
106     void moveCursorPos(int pos);
107     /** @brief Rebuilds the track headers */
108     void slotRebuildTrackHeaders();
109     /** @brief The tracks count or a track name changed, rebuild and notify */
110     void slotReloadTracks();
111     void slotChangeTrackLock(int ix, bool lock);
112     void slotVerticalZoomDown();
113     void slotVerticalZoomUp();
114
115     /** @brief Changes the name of a track.
116     * @param ix Number of the track
117     * @param name New name */
118     void slotRenameTrack(int ix, QString name);
119     void slotRepaintTracks();
120
121     /** @brief Adjusts the margins of the header area.
122      *
123      * Avoid a shift between header area and trackview if
124      * the horizontal scrollbar is visible and the position
125      * of the vertical scrollbar is maximal */
126     void slotUpdateVerticalScroll(int min, int max);
127     void slotShowTrackEffects(int);
128
129 signals:
130     void mousePosition(int);
131     void cursorMoved();
132     void zoneMoved(int, int);
133     void insertTrack(int);
134     void deleteTrack(int);
135     void configTrack(int);
136     void updateTracksInfo();
137     void setZoom(int);
138     void showTrackEffects(int, EffectsList);
139 };
140
141 #endif