swaroop: Disable play/stop/pause and slider during ad content.
[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 #include "lib/dcpomatic_time.h"
22 #include "lib/types.h"
23 #include "lib/film.h"
24 #include "lib/spl_entry.h"
25 #include <wx/wx.h>
26 #include <boost/shared_ptr.hpp>
27 #include <boost/signals2.hpp>
28
29 class FilmViewer;
30 class Film;
31 class ClosedCaptionsDialog;
32 class Content;
33 class PlayerVideo;
34 class wxToggleButton;
35 class wxListCtrl;
36
37 namespace dcp {
38         class CPL;
39 }
40
41 class Controls : public wxPanel
42 {
43 public:
44         Controls (
45                 wxWindow* parent,
46                 boost::shared_ptr<FilmViewer>,
47                 bool editor_controls = true
48                 );
49
50         boost::shared_ptr<Film> film () const;
51         void back_frame ();
52         void forward_frame ();
53
54         void show_extended_player_controls (bool s);
55         void log (wxString s);
56
57         boost::signals2::signal<void (std::list<SPLEntry>)> SPLChanged;
58
59 private:
60         void update_position_label ();
61         void update_position_slider ();
62         void rewind_clicked (wxMouseEvent &);
63         void back_clicked (wxKeyboardState& s);
64         void forward_clicked (wxKeyboardState &);
65         void slider_moved (bool page);
66         void slider_released ();
67         void play_clicked ();
68         void frame_number_clicked ();
69         void jump_to_selected_clicked ();
70         void setup_sensitivity ();
71         void timecode_clicked ();
72 #ifndef DCPOMATIC_PLAYER_SWAROOP
73         void check_play_state ();
74 #endif
75         void active_jobs_changed (boost::optional<std::string>);
76         DCPTime nudge_amount (wxKeyboardState& ev);
77         void image_changed (boost::weak_ptr<PlayerVideo>);
78         void film_change (ChangeType type, Film::Property p);
79         void outline_content_changed ();
80         void eye_changed ();
81         void position_changed ();
82         void started ();
83         void stopped ();
84         void film_changed ();
85         void update_dcp_directory ();
86         void dcp_directory_changed ();
87         void config_changed (int property);
88
89         typedef std::pair<boost::shared_ptr<dcp::CPL>, boost::filesystem::path> CPL;
90
91         boost::optional<CPL> selected_cpl () const;
92 #ifdef DCPOMATIC_VARIANT_SWAROOP
93         void pause_clicked ();
94         void stop_clicked ();
95 #endif
96         void add_clicked ();
97         void add_cpl_to_list (boost::shared_ptr<dcp::CPL> cpl, wxListCtrl* list);
98
99         boost::shared_ptr<Film> _film;
100         boost::shared_ptr<FilmViewer> _viewer;
101
102         wxSizer* _v_sizer;
103         bool _slider_being_moved;
104         bool _was_running_before_slider;
105
106         wxCheckBox* _outline_content;
107         wxChoice* _eye;
108         wxCheckBox* _jump_to_selected;
109         wxListCtrl* _cpl;
110         wxListCtrl* _spl_view;
111         wxTextCtrl* _log;
112         wxButton* _add_button;
113         std::vector<CPL> _cpls;
114         wxSlider* _slider;
115         wxButton* _rewind_button;
116         wxButton* _back_button;
117         wxButton* _forward_button;
118         wxStaticText* _frame_number;
119         wxStaticText* _timecode;
120 #ifdef DCPOMATIC_VARIANT_SWAROOP
121         wxButton* _play_button;
122         wxButton* _pause_button;
123         wxButton* _stop_button;
124 #else
125         wxToggleButton* _play_button;
126 #endif
127         boost::optional<std::string> _active_job;
128         std::list<SPLEntry> _spl;
129
130         ClosedCaptionsDialog* _closed_captions_dialog;
131
132 #ifdef DCPOMATIC_VARIANT_SWAROOP
133         boost::optional<dcp::ContentKind> _current_kind;
134 #endif
135
136         boost::signals2::scoped_connection _config_changed_connection;
137 };