Supporters update.
[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/change_signaller.h"
27 #include "lib/dcpomatic_time.h"
28 #include "lib/film_property.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 CheckBox;
37 class ClosedCaptionsDialog;
38 class Content;
39 class ContentView;
40 class Film;
41 class FilmViewer;
42 class MarkersPanel;
43 class PlayerVideo;
44
45 class wxListCtrl;
46 class wxToggleButton;
47
48
49 namespace dcp {
50         class CPL;
51 }
52
53
54 class Controls : public wxPanel
55 {
56 public:
57         Controls (
58                 wxWindow* parent,
59                 FilmViewer &,
60                 bool editor_controls = true
61                 );
62
63         void set_film (std::shared_ptr<Film> film);
64
65         virtual void play () {};
66         virtual void stop () {};
67         void seek (int slider);
68
69         std::shared_ptr<Film> film () const;
70         void back_frame ();
71         void forward_frame ();
72
73 protected:
74
75         virtual void started ();
76         virtual void stopped ();
77         virtual void setup_sensitivity ();
78         virtual void config_changed (int property);
79
80         wxSizer* _v_sizer;
81         wxBoxSizer* _button_sizer;
82         std::shared_ptr<Film> _film;
83         MarkersPanel* _markers;
84         wxSlider* _slider;
85         FilmViewer& _viewer;
86         boost::optional<std::string> _active_job;
87
88 private:
89
90         void update_position_label ();
91         void update_position_slider ();
92         void rewind_clicked (wxMouseEvent &);
93         void back_clicked (wxKeyboardState& s);
94         void forward_clicked (wxKeyboardState &);
95         void slider_moved (bool page);
96         void slider_released ();
97         void frame_number_clicked ();
98         void jump_to_selected_clicked ();
99         void timecode_clicked ();
100         void active_jobs_changed (boost::optional<std::string>);
101         dcpomatic::DCPTime nudge_amount (wxKeyboardState& ev);
102         void image_changed (std::weak_ptr<PlayerVideo>);
103         void outline_content_changed ();
104         void eye_changed ();
105         void update_position ();
106         void film_change(ChangeType, FilmProperty);
107
108         typedef std::pair<std::shared_ptr<dcp::CPL>, boost::filesystem::path> CPL;
109
110         bool _slider_being_moved = false;
111
112         CheckBox* _outline_content = nullptr;
113         wxChoice* _eye = nullptr;
114         CheckBox* _jump_to_selected = nullptr;
115         wxButton* _rewind_button;
116         wxButton* _back_button;
117         wxButton* _forward_button;
118         wxStaticText* _frame_number;
119         wxStaticText* _timecode;
120
121         ClosedCaptionsDialog* _closed_captions_dialog;
122
123         wxTimer _timer;
124
125         boost::signals2::scoped_connection _film_change_connection;
126         boost::signals2::scoped_connection _config_changed_connection;
127 };
128
129
130 #endif