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