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