More Controls API tweaks.
[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 <wx/wx.h>
25 #include <boost/shared_ptr.hpp>
26 #include <boost/signals2.hpp>
27
28 class FilmViewer;
29 class Film;
30 class ClosedCaptionsDialog;
31 class Content;
32 class PlayerVideo;
33 class wxToggleButton;
34 class wxListCtrl;
35
36 class Controls : public wxPanel
37 {
38 public:
39         Controls (
40                 wxWindow* parent,
41                 boost::shared_ptr<FilmViewer>,
42                 bool editor_controls = true
43                 );
44
45         boost::shared_ptr<Film> film () const;
46         void back_frame ();
47         void forward_frame ();
48
49         void show_extended_player_controls (bool s);
50
51         boost::signals2::signal<void (boost::filesystem::path)> DCPDirectorySelected;
52         boost::signals2::signal<void ()> DCPEjected;
53
54 private:
55         void update_position_label ();
56         void update_position_slider ();
57         void rewind_clicked (wxMouseEvent &);
58         void back_clicked (wxKeyboardState& s);
59         void forward_clicked (wxKeyboardState &);
60         void slider_moved (bool page);
61         void slider_released ();
62         void play_clicked ();
63         void frame_number_clicked ();
64         void jump_to_selected_clicked ();
65         void setup_sensitivity ();
66         void timecode_clicked ();
67 #ifndef DCPOMATIC_PLAYER_SWAROOP
68         void check_play_state ();
69 #endif
70         void active_jobs_changed (boost::optional<std::string>);
71         DCPTime nudge_amount (wxKeyboardState& ev);
72         void image_changed (boost::weak_ptr<PlayerVideo>);
73         void film_change (ChangeType type, Film::Property p);
74         void outline_content_changed ();
75         void eye_changed ();
76         void position_changed ();
77         void started ();
78         void stopped ();
79         void film_changed ();
80         void update_dcp_directory ();
81         void dcp_directory_changed ();
82         void dcp_directory_selected ();
83         void config_changed (int property);
84 #ifdef DCPOMATIC_VARIANT_SWAROOP
85         void pause_clicked ();
86         void stop_clicked ();
87 #endif
88
89         boost::shared_ptr<Film> _film;
90         boost::shared_ptr<FilmViewer> _viewer;
91
92         wxSizer* _v_sizer;
93         bool _slider_being_moved;
94         bool _was_running_before_slider;
95
96         wxCheckBox* _outline_content;
97         wxChoice* _eye;
98         wxCheckBox* _jump_to_selected;
99         wxListCtrl* _dcp_directory;
100         std::vector<boost::filesystem::path> _dcp_directories;
101         wxSlider* _slider;
102         wxButton* _rewind_button;
103         wxButton* _back_button;
104         wxButton* _forward_button;
105         wxStaticText* _frame_number;
106         wxStaticText* _timecode;
107 #ifdef DCPOMATIC_VARIANT_SWAROOP
108         wxButton* _play_button;
109         wxButton* _pause_button;
110         wxButton* _stop_button;
111 #else
112         wxToggleButton* _play_button;
113 #endif
114         boost::optional<std::string> _active_job;
115
116         ClosedCaptionsDialog* _closed_captions_dialog;
117
118         boost::signals2::scoped_connection _config_changed_connection;
119 };