Olive
timelineheader.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 TIMELINEHEADER_H
22 #define TIMELINEHEADER_H
23 
24 #include <QWidget>
25 #include <QFontMetrics>
26 class Viewer;
27 class QScrollBar;
28 
29 bool center_scroll_to_playhead(QScrollBar* bar, double zoom, long playhead);
30 
31 class TimelineHeader : public QWidget
32 {
33  Q_OBJECT
34 public:
35  explicit TimelineHeader(QWidget *parent = 0);
36  void set_in_point(long p);
37  void set_out_point(long p);
38 
39  Viewer* viewer;
40 
41  bool snapping;
42 
43  void show_text(bool enable);
44  double get_zoom();
45  void delete_markers();
46  void set_scrollbar_max(QScrollBar* bar, long sequence_end_frame, int offset);
47 
48 public slots:
49  void update_zoom(double z);
50  void set_scroll(int);
51  void set_visible_in(long i);
52  void show_context_menu(const QPoint &pos);
53  void resized_scroll_listener(double d);
54 
55 protected:
56  void paintEvent(QPaintEvent*);
57  void mousePressEvent(QMouseEvent*);
58  void mouseMoveEvent(QMouseEvent*);
59  void mouseReleaseEvent(QMouseEvent*);
60  void focusOutEvent(QFocusEvent*);
61 
62 private:
63  void update_parents();
64 
65  bool dragging;
66 
67  bool resizing_workarea;
68  bool resizing_workarea_in;
69  long temp_workarea_in;
70  long temp_workarea_out;
71  long sequence_end;
72 
73  double zoom;
74 
75  long in_visible;
76 
77  void set_playhead(int mouse_x);
78 
79  int get_marker_offset();
80 
81  QFontMetrics fm;
82 
83  int drag_start;
84  bool dragging_markers;
85  QVector<int> selected_markers;
86  QVector<long> selected_marker_original_times;
87 
88  long getHeaderFrameFromScreenPoint(int x);
89  int getHeaderScreenPointFromFrame(long frame);
90 
91  int scroll;
92 
93  int height_actual;
94  bool text_enabled;
95 
96 signals:
97 };
98 
99 #endif // TIMELINEHEADER_H
Definition: timelineheader.h:31
Definition: viewer.h:45