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