1 /***************************************************************************
2 * Copyright (C) 2007 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
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. *
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. *
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 ***************************************************************************/
24 #include <QScrollArea>
25 #include <QVBoxLayout>
28 #include <QGraphicsScene>
29 #include <QGraphicsLineItem>
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"
42 class TrackView : public QWidget
47 TrackView(KdenliveDoc *doc, QWidget *parent=0);
49 /** This event occurs when the mouse has been moved. */
50 void mouseMoveEvent(QMouseEvent * event);
52 const double zoomFactor() const;
53 DocumentTrack *panelAt(int y);
54 const int mapLocalToValue(int x) const;
55 void setEditMode(const QString & editMode);
56 const QString & editMode() const;
57 QGraphicsScene *projectScene();
58 CustomTrackView *projectView();
61 KdenliveDoc *document();
64 void slotDeleteClip(int clipId);
67 Ui::TimeLine_UI *view;
69 CustomTrackView *m_trackview;
71 QList <DocumentTrack*> documentTracks;
72 int m_projectDuration;
74 TrackPanelFunctionFactory m_factory;
75 DocumentTrack *m_panelUnderMouse;
76 /** The currently applied function. This lasts from mousePressed until mouseRelease. */
77 TrackPanelFunction *m_function;
79 QGraphicsScene *m_scene;
84 QVBoxLayout *m_tracksLayout;
85 QVBoxLayout *m_headersLayout;
86 QScrollArea *m_scrollArea;
88 QVBoxLayout *m_tracksAreaLayout;
89 void parseDocument(QDomDocument doc);
90 int slotAddAudioTrack(int ix, QDomElement xml);
91 int slotAddVideoTrack(int ix, QDomElement xml);
92 void registerFunction(const QString & name, TrackPanelFunction * function);
93 TrackPanelFunction *getApplicableFunction(DocumentTrack * panel, const QString & editMode, QMouseEvent * event);
96 void slotChangeZoom(int factor);
97 void slotCursorMoved(int pos, bool slotCursorMoved = false);
100 void setCursorPos(int pos);
101 void moveCursorPos(int pos);
102 void slotClipItemSelected(ClipItem*);
104 void mousePosition(int);
106 void clipItemSelected(ClipItem*);