]> git.sesse.net Git - kdenlive/blob - src/customruler.h
Fix label
[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(const 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(const QPoint &p);
49     int offset() const;
50     void updateProjectFps(const Timecode &t);
51     void updateFrameSize();
52     void updatePalette();
53     
54 protected:
55     void paintEvent(QPaintEvent * /*e*/);
56     void wheelEvent(QWheelEvent * e);
57     void mousePressEvent(QMouseEvent * event);
58     void mouseReleaseEvent(QMouseEvent * event);
59     void mouseMoveEvent(QMouseEvent * event);
60     void leaveEvent(QEvent * event);
61
62 private:
63     Timecode m_timecode;
64     CustomTrackView *m_view;
65     int m_zoneStart;
66     int m_zoneEnd;
67     int m_duration;
68     QColor m_zoneColor;
69     double m_textSpacing;
70     double m_factor;
71     double m_scale;
72     int m_offset;
73     int m_lastSeekPosition;
74     RULER_MOVE m_moveCursor;
75     QMenu *m_contextMenu;
76     QAction *m_editGuide;
77     QAction *m_deleteGuide;
78     int m_clickedGuide;
79     /** Used for zooming through vertical move */
80     QPoint m_clickPoint;
81     int m_rate;
82     int m_startRate;
83     MOUSE_MOVE m_mouseMove;
84     QMenu *m_goMenu;
85     QBrush m_cursorColor;
86
87
88 public slots:
89     void slotMoveRuler(int newPos);
90     void slotCursorMoved(int oldpos, int newpos);
91     void updateRuler();
92
93 private slots:
94     void slotEditGuide();
95     void slotDeleteGuide();
96     void slotGoToGuide(QAction *act);
97
98 signals:
99     void zoneMoved(int, int);
100     void adjustZoom(int);
101     void mousePosition(int);
102 };
103
104 #endif