Hide warnings triggered by Ubuntu 20.04's gcc.
[dcpomatic.git] / src / wx / controls.h
1 /*
2     Copyright (C) 2018 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 #ifndef DCPOMATIC_CONTROLS_H
22 #define DCPOMATIC_CONTROLS_H
23
24 #include "lib/dcpomatic_time.h"
25 #include "lib/types.h"
26 #include "lib/film.h"
27 #include "lib/warnings.h"
28 DCPOMATIC_DISABLE_WARNINGS
29 #include <wx/wx.h>
30 DCPOMATIC_ENABLE_WARNINGS
31 #include <boost/shared_ptr.hpp>
32 #include <boost/signals2.hpp>
33
34 class FilmViewer;
35 class Film;
36 class ClosedCaptionsDialog;
37 class Content;
38 class PlayerVideo;
39 class wxToggleButton;
40 class wxListCtrl;
41 class ContentView;
42
43 namespace dcp {
44         class CPL;
45 }
46
47 class Controls : public wxPanel
48 {
49 public:
50         Controls (
51                 wxWindow* parent,
52                 boost::shared_ptr<FilmViewer>,
53                 bool editor_controls = true
54                 );
55
56         virtual void log (wxString) {}
57         virtual void set_film (boost::shared_ptr<Film> film);
58
59         virtual void play () {};
60         virtual void stop () {};
61         void seek (int slider);
62
63         boost::shared_ptr<Film> film () const;
64         void back_frame ();
65         void forward_frame ();
66
67 protected:
68         virtual void started ();
69         virtual void stopped ();
70         virtual void setup_sensitivity ();
71         virtual void config_changed (int property);
72
73         wxSizer* _v_sizer;
74         wxBoxSizer* _button_sizer;
75         boost::shared_ptr<Film> _film;
76         wxSlider* _slider;
77         boost::shared_ptr<FilmViewer> _viewer;
78         boost::optional<std::string> _active_job;
79
80 private:
81
82         void update_position_label ();
83         void update_position_slider ();
84         void rewind_clicked (wxMouseEvent &);
85         void back_clicked (wxKeyboardState& s);
86         void forward_clicked (wxKeyboardState &);
87         void slider_moved (bool page);
88         void slider_released ();
89         void frame_number_clicked ();
90         void jump_to_selected_clicked ();
91         void timecode_clicked ();
92         void active_jobs_changed (boost::optional<std::string>);
93         dcpomatic::DCPTime nudge_amount (wxKeyboardState& ev);
94         void image_changed (boost::weak_ptr<PlayerVideo>);
95         void outline_content_changed ();
96         void eye_changed ();
97         void update_position ();
98         void film_change (ChangeType, Film::Property);
99
100         typedef std::pair<boost::shared_ptr<dcp::CPL>, boost::filesystem::path> CPL;
101
102         bool _slider_being_moved;
103
104         wxCheckBox* _outline_content;
105         wxChoice* _eye;
106         wxCheckBox* _jump_to_selected;
107         wxButton* _rewind_button;
108         wxButton* _back_button;
109         wxButton* _forward_button;
110         wxStaticText* _frame_number;
111         wxStaticText* _timecode;
112
113         ClosedCaptionsDialog* _closed_captions_dialog;
114
115         wxTimer _timer;
116
117         boost::signals2::scoped_connection _film_change_connection;
118         boost::signals2::scoped_connection _config_changed_connection;
119 };
120
121 #endif