Olive
timelinewidget.h
1 /***
2 
3  Olive - Non-Linear Video Editor
4  Copyright (C) 2019 Olive Team
5 
6  This program is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with this program. If not, see <http://www.gnu.org/licenses/>.
18 
19 ***/
20 
21 #ifndef TIMELINEWIDGET_H
22 #define TIMELINEWIDGET_H
23 
24 #include <QTimer>
25 #include <QWidget>
26 #include "timelinetools.h"
27 
28 #define GHOST_THICKNESS 2 // thiccccc
29 #define CLIP_TEXT_PADDING 3
30 
31 #define TRACK_MIN_HEIGHT 30
32 #define TRACK_HEIGHT_INCREMENT 10
33 
34 struct Sequence;
35 class Clip;
36 struct FootageStream;
37 class Timeline;
38 class TimelineAction;
39 class QScrollBar;
41 class QPainter;
42 class Media;
43 
44 bool same_sign(int a, int b);
45 void draw_waveform(Clip* clip, const FootageStream *ms, long media_length, QPainter* p, const QRect& clip_rect, int waveform_start, int waveform_limit, double zoom);
46 
47 class TimelineWidget : public QWidget {
48  Q_OBJECT
49 public:
50  explicit TimelineWidget(QWidget *parent = 0);
51  QScrollBar* scrollBar;
52  bool bottom_align;
53 protected:
54  void paintEvent(QPaintEvent*);
55 
56  void resizeEvent(QResizeEvent *event);
57 
58  void mouseDoubleClickEvent(QMouseEvent *event);
59  void mousePressEvent(QMouseEvent *event);
60  void mouseReleaseEvent(QMouseEvent *event);
61  void mouseMoveEvent(QMouseEvent *event);
62  void leaveEvent(QEvent *event);
63 
64  void dragEnterEvent(QDragEnterEvent *event);
65  void dragLeaveEvent(QDragLeaveEvent *event);
66  void dropEvent(QDropEvent* event);
67  void dragMoveEvent(QDragMoveEvent *event);
68 
69  void wheelEvent(QWheelEvent *event);
70 private:
71  void init_ghosts();
72  void update_ghosts(const QPoint& mouse_pos, bool lock_frame);
73  bool is_track_visible(int track);
74  int getTrackFromScreenPoint(int y);
75  int getScreenPointFromTrack(int track);
76  int getClipIndexFromCoords(long frame, int track);
77 
78  int track_resize_mouse_cache;
79  int track_resize_old_value;
80  bool track_resizing;
81  int track_target;
82 
83  QVector<Clip*> pre_clips;
84  QVector<Clip*> post_clips;
85 
86  Media* rc_reveal_media;
87 
88  Sequence* self_created_sequence;
89 
90  QTimer tooltip_timer;
91  int tooltip_clip;
92 
93  int scroll;
94 
95  SetSelectionsCommand* selection_command;
96 signals:
97 
98 public slots:
99  void setScroll(int);
100 
101 private slots:
102  void reveal_media();
103  void show_context_menu(const QPoint& pos);
104  void toggle_autoscale();
105  void tooltip_timer_timeout();
106  void rename_clip();
107  void show_stabilizer_diag();
108  void open_sequence_properties();
109 };
110 
111 #endif // TIMELINEWIDGET_H
Definition: sequence.h:33
Definition: timelinewidget.h:47
Definition: timeline.h:91
Definition: media.h:40
Definition: undo.h:459
Definition: footage.h:45
Definition: clip.h:53