More choose-dcp-rate stuff.
[dcpomatic.git] / src / wx / film_editor.h
1 /*
2     Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
3
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.
8
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
13
14     You should have received a copy of the GNU General Public License
15     along with this program; if not, write to the Free Software
16     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 */
19
20 /** @file src/film_editor.h
21  *  @brief A wx widget to edit a film's metadata, and perform various functions.
22  */
23
24 #include <wx/wx.h>
25 #include <wx/spinctrl.h>
26 #include <wx/filepicker.h>
27 #include <wx/collpane.h>
28 #include <boost/signals2.hpp>
29 #include "lib/film.h"
30
31 class wxNotebook;
32 class Film;
33 class AudioDialog;
34
35 /** @class FilmEditor
36  *  @brief A wx widget to edit a film's metadata, and perform various functions.
37  */
38 class FilmEditor : public wxPanel
39 {
40 public:
41         FilmEditor (boost::shared_ptr<Film>, wxWindow *);
42
43         void set_film (boost::shared_ptr<Film>);
44         void setup_visibility ();
45
46         boost::signals2::signal<void (std::string)> FileChanged;
47
48 private:
49         void make_film_panel ();
50         void make_video_panel ();
51         void make_audio_panel ();
52         void make_subtitle_panel ();
53         void connect_to_widgets ();
54         
55         /* Handle changes to the view */
56         void name_changed (wxCommandEvent &);
57         void use_dci_name_toggled (wxCommandEvent &);
58         void edit_dci_button_clicked (wxCommandEvent &);
59         void left_crop_changed (wxCommandEvent &);
60         void right_crop_changed (wxCommandEvent &);
61         void top_crop_changed (wxCommandEvent &);
62         void bottom_crop_changed (wxCommandEvent &);
63         void content_changed (wxCommandEvent &);
64         void trust_content_header_changed (wxCommandEvent &);
65         void format_changed (wxCommandEvent &);
66         void trim_start_changed (wxCommandEvent &);
67         void trim_end_changed (wxCommandEvent &);
68         void dcp_content_type_changed (wxCommandEvent &);
69         void dcp_ab_toggled (wxCommandEvent &);
70         void scaler_changed (wxCommandEvent &);
71         void audio_gain_changed (wxCommandEvent &);
72         void audio_gain_calculate_button_clicked (wxCommandEvent &);
73         void show_audio_clicked (wxCommandEvent &);
74         void audio_delay_changed (wxCommandEvent &);
75         void with_subtitles_toggled (wxCommandEvent &);
76         void subtitle_offset_changed (wxCommandEvent &);
77         void subtitle_scale_changed (wxCommandEvent &);
78         void colour_lut_changed (wxCommandEvent &);
79         void j2k_bandwidth_changed (wxCommandEvent &);
80         void still_duration_changed (wxCommandEvent &);
81         void audio_stream_changed (wxCommandEvent &);
82         void subtitle_stream_changed (wxCommandEvent &);
83         void use_audio_changed (wxCommandEvent &);
84         void external_audio_changed (wxCommandEvent &);
85         void dcp_frame_rate_changed (wxCommandEvent &);
86         void best_dcp_frame_rate_clicked (wxCommandEvent &);
87
88         /* Handle changes to the model */
89         void film_changed (Film::Property);
90
91         /* Button clicks */
92         void edit_filters_clicked (wxCommandEvent &);
93
94         void set_things_sensitive (bool);
95         void setup_formats ();
96         void setup_subtitle_control_sensitivity ();
97         void setup_audio_control_sensitivity ();
98         void setup_streams ();
99         void setup_audio_details ();
100         void setup_dcp_name ();
101         
102         wxControl* video_control (wxControl *);
103         wxControl* still_control (wxControl *);
104
105         void active_jobs_changed (bool);
106
107         wxNotebook* _notebook;
108         wxPanel* _film_panel;
109         wxSizer* _film_sizer;
110         wxPanel* _video_panel;
111         wxSizer* _video_sizer;
112         wxPanel* _audio_panel;
113         wxSizer* _audio_sizer;
114         wxPanel* _subtitle_panel;
115         wxSizer* _subtitle_sizer;
116
117         /** The film we are editing */
118         boost::shared_ptr<Film> _film;
119         /** The Film's name */
120         wxTextCtrl* _name;
121         wxStaticText* _dcp_name;
122         wxCheckBox* _use_dci_name;
123         wxButton* _edit_dci_button;
124         /** The Film's format */
125         wxChoice* _format;
126         /** The Film's content file */
127         wxFilePickerCtrl* _content;
128         wxCheckBox* _trust_content_header;
129         /** The Film's left crop */
130         wxSpinCtrl* _left_crop;
131         /** The Film's right crop */
132         wxSpinCtrl* _right_crop;
133         /** The Film's top crop */
134         wxSpinCtrl* _top_crop;
135         /** The Film's bottom crop */
136         wxSpinCtrl* _bottom_crop;
137         /** Currently-applied filters */
138         wxStaticText* _filters;
139         /** Button to open the filters dialogue */
140         wxButton* _filters_button;
141         /** The Film's scaler */
142         wxChoice* _scaler;
143         wxRadioButton* _use_content_audio;
144         wxChoice* _audio_stream;
145         wxRadioButton* _use_external_audio;
146         wxFilePickerCtrl* _external_audio[MAX_AUDIO_CHANNELS];
147         /** The Film's audio gain */
148         wxSpinCtrl* _audio_gain;
149         /** A button to open the gain calculation dialogue */
150         wxButton* _audio_gain_calculate_button;
151         wxButton* _show_audio;
152         /** The Film's audio delay */
153         wxSpinCtrl* _audio_delay;
154         wxCheckBox* _with_subtitles;
155         wxChoice* _subtitle_stream;
156         wxSpinCtrl* _subtitle_offset;
157         wxSpinCtrl* _subtitle_scale;
158         wxChoice* _colour_lut;
159         wxSpinCtrl* _j2k_bandwidth;
160         /** The Film's DCP content type */
161         wxChoice* _dcp_content_type;
162         /** The Film's source frame rate */
163         wxStaticText* _source_frame_rate;
164         wxChoice* _dcp_frame_rate;
165         wxButton* _best_dcp_frame_rate;
166         /** The Film's original size */
167         wxStaticText* _original_size;
168         /** The Film's length */
169         wxStaticText* _length;
170         /** The Film's audio details */
171         wxStaticText* _audio;
172         /** The Film's duration for still sources */
173         wxSpinCtrl* _still_duration;
174
175         wxSpinCtrl* _trim_start;
176         wxSpinCtrl* _trim_end;
177         /** Selector to generate an A/B comparison DCP */
178         wxCheckBox* _dcp_ab;
179
180         std::list<wxControl*> _video_controls;
181         std::list<wxControl*> _still_controls;
182
183         std::vector<Format const *> _formats;
184
185         bool _generally_sensitive;
186         AudioDialog* _audio_dialog;
187 };