Olive
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
timelineheader.h
Go to the documentation of this file.
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 
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 
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 
85  QVector<int> selected_markers;
87 
89  int getHeaderScreenPointFromFrame(long frame);
90 
91  int scroll;
92 
95 
96 signals:
97 };
98 
99 #endif // TIMELINEHEADER_H
int drag_start
Definition: timelineheader.h:83
void set_scrollbar_max(QScrollBar *bar, long sequence_end_frame, int offset)
Definition: timelineheader.cpp:136
void paintEvent(QPaintEvent *)
Definition: timelineheader.cpp:355
Viewer * viewer
Definition: timelineheader.h:39
void set_out_point(long p)
Definition: timelineheader.cpp:124
long temp_workarea_in
Definition: timelineheader.h:69
void set_visible_in(long i)
Definition: timelineheader.cpp:107
bool snapping
Definition: timelineheader.h:41
void set_in_point(long p)
Definition: timelineheader.cpp:112
void resized_scroll_listener(double d)
Definition: timelineheader.cpp:494
int scroll
Definition: timelineheader.h:91
double get_zoom()
Definition: timelineheader.cpp:325
void mouseReleaseEvent(QMouseEvent *)
Definition: timelineheader.cpp:281
double zoom
Definition: timelineheader.h:73
bool resizing_workarea_in
Definition: timelineheader.h:68
Definition: viewer.h:44
int getHeaderScreenPointFromFrame(long frame)
Definition: timelineheader.cpp:91
QVector< long > selected_marker_original_times
Definition: timelineheader.h:86
QVector< int > selected_markers
Definition: timelineheader.h:85
void set_playhead(int mouse_x)
Definition: timelineheader.cpp:95
bool resizing_workarea
Definition: timelineheader.h:67
void delete_markers()
Definition: timelineheader.cpp:329
void mousePressEvent(QMouseEvent *)
Definition: timelineheader.cpp:150
long temp_workarea_out
Definition: timelineheader.h:70
long in_visible
Definition: timelineheader.h:75
QFontMetrics fm
Definition: timelineheader.h:81
void show_text(bool enable)
Definition: timelineheader.cpp:140
bool dragging_markers
Definition: timelineheader.h:84
bool text_enabled
Definition: timelineheader.h:94
void show_context_menu(const QPoint &pos)
Definition: timelineheader.cpp:478
TimelineHeader(QWidget *parent=0)
Definition: timelineheader.cpp:61
void set_scroll(int)
Definition: timelineheader.cpp:82
bool dragging
Definition: timelineheader.h:65
int height_actual
Definition: timelineheader.h:93
bool center_scroll_to_playhead(QScrollBar *bar, double zoom, long playhead)
Definition: timelineheader.cpp:51
void mouseMoveEvent(QMouseEvent *)
Definition: timelineheader.cpp:214
void focusOutEvent(QFocusEvent *)
Definition: timelineheader.cpp:311
long sequence_end
Definition: timelineheader.h:71
int get_marker_offset()
Definition: timelineheader.cpp:103
void update_parents()
Definition: timelineheader.cpp:316
Definition: timelineheader.h:31
long getHeaderFrameFromScreenPoint(int x)
Definition: timelineheader.cpp:87
void update_zoom(double z)
Definition: timelineheader.cpp:320