Basic display of markers above the playback timeline (#1921).
[dcpomatic.git] / src / wx / controls.h
1 /*
2     Copyright (C) 2018-2021 Carl Hetherington <cth@carlh.net>
3
4     This file is part of DCP-o-matic.
5
6     DCP-o-matic 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 2 of the License, or
9     (at your option) any later version.
10
11     DCP-o-matic 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 DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.
18
19 */
20
21
22 #ifndef DCPOMATIC_CONTROLS_H
23 #define DCPOMATIC_CONTROLS_H
24
25
26 #include "lib/dcpomatic_time.h"
27 #include "lib/film.h"
28 #include "lib/types.h"
29 #include <dcp/warnings.h>
30 LIBDCP_DISABLE_WARNINGS
31 #include <wx/wx.h>
32 LIBDCP_ENABLE_WARNINGS
33 #include <boost/signals2.hpp>
34
35
36 class ClosedCaptionsDialog;
37 class Content;
38 class ContentView;
39 class Film;
40 class FilmViewer;
41 class MarkersPanel;
42 class PlayerVideo;
43
44 class wxListCtrl;
45 class wxToggleButton;
46
47
48 namespace dcp {
49         class CPL;
50 }
51
52
53 class Controls : public wxPanel
54 {
55 public:
56         Controls (
57                 wxWindow* parent,
58                 std::shared_ptr<FilmViewer>,
59                 bool editor_controls = true
60                 );
61
62         virtual void set_film (std::shared_ptr<Film> film);
63
64         virtual void play () {};
65         virtual void stop () {};
66         void seek (int slider);
67
68         std::shared_ptr<Film> film () const;
69         void back_frame ();
70         void forward_frame ();
71
72 protected:
73
74         virtual void started ();
75         virtual void stopped ();
76         virtual void setup_sensitivity ();
77         virtual void config_changed (int property);
78
79         wxSizer* _v_sizer;
80         wxBoxSizer* _button_sizer;
81         std::shared_ptr<Film> _film;
82         MarkersPanel* _markers;
83         wxSlider* _slider;
84         std::weak_ptr<FilmViewer> _viewer;
85         boost::optional<std::string> _active_job;
86
87 private:
88
89         void update_position_label ();
90         void update_position_slider ();
91         void rewind_clicked (wxMouseEvent &);
92         void back_clicked (wxKeyboardState& s);
93         void forward_clicked (wxKeyboardState &);
94         void slider_moved (bool page);
95         void slider_released ();
96         void frame_number_clicked ();
97         void jump_to_selected_clicked ();
98         void timecode_clicked ();
99         void active_jobs_changed (boost::optional<std::string>);
100         dcpomatic::DCPTime nudge_amount (wxKeyboardState& ev);
101         void image_changed (std::weak_ptr<PlayerVideo>);
102         void outline_content_changed ();
103         void eye_changed ();
104         void update_position ();
105         void film_change (ChangeType, Film::Property);
106
107         typedef std::pair<std::shared_ptr<dcp::CPL>, boost::filesystem::path> CPL;
108
109         bool _slider_being_moved;
110
111         wxCheckBox* _outline_content;
112         wxChoice* _eye;
113         wxCheckBox* _jump_to_selected;
114         wxButton* _rewind_button;
115         wxButton* _back_button;
116         wxButton* _forward_button;
117         wxStaticText* _frame_number;
118         wxStaticText* _timecode;
119
120         ClosedCaptionsDialog* _closed_captions_dialog;
121
122         wxTimer _timer;
123
124         boost::signals2::scoped_connection _film_change_connection;
125         boost::signals2::scoped_connection _config_changed_connection;
126 };
127
128
129 #endif