Olive
timelinewidget.h
1 #ifndef TIMELINEWIDGET_H
2 #define TIMELINEWIDGET_H
3 
4 #include <QTimer>
5 #include <QWidget>
6 #include "timelinetools.h"
7 
8 #define GHOST_THICKNESS 2 // thiccccc
9 #define CLIP_TEXT_PADDING 3
10 
11 #define TRACK_MIN_HEIGHT 30
12 #define TRACK_HEIGHT_INCREMENT 10
13 
14 struct Sequence;
15 class Clip;
16 struct FootageStream;
17 class Timeline;
18 class TimelineAction;
19 class QScrollBar;
21 class QPainter;
22 class Media;
23 
24 bool same_sign(int a, int b);
25 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);
26 
27 class TimelineWidget : public QWidget {
28  Q_OBJECT
29 public:
30  explicit TimelineWidget(QWidget *parent = 0);
31  QScrollBar* scrollBar;
32  bool bottom_align;
33 protected:
34  void paintEvent(QPaintEvent*);
35 
36  void resizeEvent(QResizeEvent *event);
37 
38  void mouseDoubleClickEvent(QMouseEvent *event);
39  void mousePressEvent(QMouseEvent *event);
40  void mouseReleaseEvent(QMouseEvent *event);
41  void mouseMoveEvent(QMouseEvent *event);
42  void leaveEvent(QEvent *event);
43 
44  void dragEnterEvent(QDragEnterEvent *event);
45  void dragLeaveEvent(QDragLeaveEvent *event);
46  void dropEvent(QDropEvent* event);
47  void dragMoveEvent(QDragMoveEvent *event);
48 
49  void wheelEvent(QWheelEvent *event);
50 private:
51  void init_ghosts();
52  void update_ghosts(const QPoint& mouse_pos, bool lock_frame);
53  bool is_track_visible(int track);
54  int getTrackFromScreenPoint(int y);
55  int getScreenPointFromTrack(int track);
56  int getClipIndexFromCoords(long frame, int track);
57 
58  int track_resize_mouse_cache;
59  int track_resize_old_value;
60  bool track_resizing;
61  int track_target;
62 
63  QVector<Clip*> pre_clips;
64  QVector<Clip*> post_clips;
65 
66  Media* rc_reveal_media;
67 
68  Sequence* self_created_sequence;
69 
70  QTimer tooltip_timer;
71  int tooltip_clip;
72 
73  int scroll;
74 
75  SetSelectionsCommand* selection_command;
76 signals:
77 
78 public slots:
79  void setScroll(int);
80 
81 private slots:
82  void reveal_media();
83  void show_context_menu(const QPoint& pos);
84  void toggle_autoscale();
85  void tooltip_timer_timeout();
86  void rename_clip();
87  void show_stabilizer_diag();
88  void open_sequence_properties();
89 };
90 
91 #endif // TIMELINEWIDGET_H
Definition: sequence.h:13
Definition: timelinewidget.h:27
Definition: timeline.h:71
Definition: media.h:20
Definition: undo.h:439
Definition: footage.h:25
Definition: clip.h:33