]> git.sesse.net Git - kdenlive/blob - src/customruler.h
Make timeline's ruler time labels obey to frame <-> timecode setting
[kdenlive] / src / customruler.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 CustomRuler
22  * @author Jean-Baptiste Mardelle
23  * @brief Manages the timeline ruler.
24  */
25
26 #ifndef CUSTOMRULER_H
27 #define CUSTOMRULER_H
28
29 #include <QWidget>
30
31 #include "customtrackview.h"
32 #include "timecode.h"
33
34 enum RULER_MOVE { RULER_CURSOR = 0, RULER_START = 1, RULER_MIDDLE = 2, RULER_END = 3 };
35 enum MOUSE_MOVE { NO_MOVE = 0, HORIZONTAL_MOVE = 1, VERTICAL_MOVE = 2 };
36
37 class CustomRuler : public QWidget
38 {
39     Q_OBJECT
40
41 public:
42     CustomRuler(Timecode tc, CustomTrackView *parent);
43     void setPixelPerMark(int rate);
44     static const int comboScale[];
45     int outPoint() const;
46     int inPoint() const;
47     void setDuration(int d);
48     void setZone(QPoint p);
49     int offset() const;
50     void updateProjectFps(Timecode t);
51
52 protected:
53     virtual void paintEvent(QPaintEvent * /*e*/);
54     virtual void wheelEvent(QWheelEvent * e);
55     virtual void mousePressEvent(QMouseEvent * event);
56     virtual void mouseReleaseEvent(QMouseEvent * event);
57     virtual void mouseMoveEvent(QMouseEvent * event);
58
59 private:
60     Timecode m_timecode;
61     CustomTrackView *m_view;
62     int m_zoneStart;
63     int m_zoneEnd;
64     int m_duration;
65     QColor m_bgColor;
66     QColor m_cursorColor;
67     QColor m_zoneColor;
68     double m_textSpacing;
69     double m_factor;
70     double m_scale;
71     int m_offset;
72     RULER_MOVE m_moveCursor;
73     QMenu *m_contextMenu;
74     QAction *m_editGuide;
75     QAction *m_deleteGuide;
76     int m_clickedGuide;
77     /** Used for zooming through vertical move */
78     QPoint m_clickPoint;
79     int m_rate;
80     int m_startRate;
81     MOUSE_MOVE m_mouseMove;
82     QMenu *m_goMenu;
83
84
85 public slots:
86     void slotMoveRuler(int newPos);
87     void slotCursorMoved(int oldpos, int newpos);
88
89 private slots:
90     void slotEditGuide();
91     void slotDeleteGuide();
92     void slotGoToGuide(QAction *act);
93
94 signals:
95     void zoneMoved(int, int);
96     void adjustZoom(int);
97 };
98
99 #endif