]> git.sesse.net Git - kdenlive/blob - src/trackview.h
Reindent all source files
[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 #ifndef TRACKVIEW_H
22 #define TRACKVIEW_H
23
24 #include <QScrollArea>
25 #include <QVBoxLayout>
26 #include <KRuler>
27 #include <QGroupBox>
28 #include <QGraphicsScene>
29 #include <QGraphicsLineItem>
30
31 #define FRAME_SIZE 90
32
33 #include "ui_timeline_ui.h"
34 #include "customruler.h"
35 #include "kdenlivedoc.h"
36 #include "documenttrack.h"
37 #include "trackpanelfunctionfactory.h"
38 #include "trackpanelfunction.h"
39 #include "customtrackview.h"
40 class ClipItem;
41
42 class TrackView : public QWidget {
43     Q_OBJECT
44
45 public:
46     TrackView(KdenliveDoc *doc, QWidget *parent = 0);
47
48     /** This event occurs when the mouse has been moved. */
49     void mouseMoveEvent(QMouseEvent * event);
50
51     const double zoomFactor() const;
52     DocumentTrack *panelAt(int y);
53     const int mapLocalToValue(int x) const;
54     void setEditMode(const QString & editMode);
55     const QString & editMode() const;
56     QGraphicsScene *projectScene();
57     CustomTrackView *projectView();
58     int duration();
59     int tracksNumber();
60     KdenliveDoc *document();
61
62 public slots:
63     void slotDeleteClip(int clipId);
64
65 private:
66     Ui::TimeLine_UI *view;
67     CustomRuler *m_ruler;
68     CustomTrackView *m_trackview;
69     double m_scale;
70     QList <DocumentTrack*> documentTracks;
71     int m_projectDuration;
72     int m_projectTracks;
73     TrackPanelFunctionFactory m_factory;
74     DocumentTrack *m_panelUnderMouse;
75     /** The currently applied function. This lasts from mousePressed until mouseRelease. */
76     TrackPanelFunction *m_function;
77     QString m_editMode;
78     QGraphicsScene *m_scene;
79     uint m_currentZoom;
80
81
82     KdenliveDoc *m_doc;
83     QVBoxLayout *m_tracksLayout;
84     QVBoxLayout *m_headersLayout;
85     QScrollArea *m_scrollArea;
86     QFrame *m_scrollBox;
87     QVBoxLayout *m_tracksAreaLayout;
88     void parseDocument(QDomDocument doc);
89     int slotAddAudioTrack(int ix, QDomElement xml);
90     int slotAddVideoTrack(int ix, QDomElement xml);
91     void registerFunction(const QString & name, TrackPanelFunction * function);
92     TrackPanelFunction *getApplicableFunction(DocumentTrack * panel, const QString & editMode, QMouseEvent * event);
93
94 private slots:
95     void slotChangeZoom(int factor);
96     void slotCursorMoved(int pos, bool slotCursorMoved = false);
97     void slotZoomIn();
98     void slotZoomOut();
99     void setCursorPos(int pos);
100     void moveCursorPos(int pos);
101     void slotClipItemSelected(ClipItem*);
102 signals:
103     void mousePosition(int);
104     void cursorMoved();
105     void clipItemSelected(ClipItem*);
106 };
107
108 #endif