2 Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
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.
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.
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.
20 /** @file src/film_editor.h
21 * @brief A wx widget to edit a film's metadata, and perform various functions.
25 #include <wx/spinctrl.h>
26 #include <wx/filepicker.h>
27 #include <wx/collpane.h>
28 #include <boost/signals2.hpp>
36 * @brief A wx widget to edit a film's metadata, and perform various functions.
38 class FilmEditor : public wxPanel
41 FilmEditor (boost::shared_ptr<Film>, wxWindow *);
43 void set_film (boost::shared_ptr<Film>);
44 void setup_visibility ();
46 boost::signals2::signal<void (std::string)> FileChanged;
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 ();
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 trim_type_changed (wxCommandEvent &);
69 void dcp_content_type_changed (wxCommandEvent &);
70 void dcp_ab_toggled (wxCommandEvent &);
71 void scaler_changed (wxCommandEvent &);
72 void audio_gain_changed (wxCommandEvent &);
73 void audio_gain_calculate_button_clicked (wxCommandEvent &);
74 void show_audio_clicked (wxCommandEvent &);
75 void audio_delay_changed (wxCommandEvent &);
76 void with_subtitles_toggled (wxCommandEvent &);
77 void subtitle_offset_changed (wxCommandEvent &);
78 void subtitle_scale_changed (wxCommandEvent &);
79 void colour_lut_changed (wxCommandEvent &);
80 void j2k_bandwidth_changed (wxCommandEvent &);
81 void still_duration_changed (wxCommandEvent &);
82 void audio_stream_changed (wxCommandEvent &);
83 void subtitle_stream_changed (wxCommandEvent &);
84 void use_audio_changed (wxCommandEvent &);
85 void external_audio_changed (wxCommandEvent &);
86 void dcp_frame_rate_changed (wxCommandEvent &);
87 void best_dcp_frame_rate_clicked (wxCommandEvent &);
88 void pad_with_silence_toggled (wxCommandEvent &);
89 void minimum_audio_channels_changed (wxCommandEvent &);
91 /* Handle changes to the model */
92 void film_changed (Film::Property);
95 void edit_filters_clicked (wxCommandEvent &);
97 void set_things_sensitive (bool);
98 void setup_formats ();
99 void setup_subtitle_control_sensitivity ();
100 void setup_audio_control_sensitivity ();
101 void setup_streams ();
102 void setup_audio_details ();
103 void setup_dcp_name ();
104 void setup_show_audio_sensitivity ();
105 void setup_scaling_description ();
106 void setup_notebook_size ();
107 void setup_frame_rate_description ();
108 void setup_minimum_audio_channels ();
110 wxControl* video_control (wxControl *);
111 wxControl* still_control (wxControl *);
113 void active_jobs_changed (bool);
115 wxNotebook* _notebook;
116 wxPanel* _film_panel;
117 wxSizer* _film_sizer;
118 wxPanel* _video_panel;
119 wxSizer* _video_sizer;
120 wxPanel* _audio_panel;
121 wxSizer* _audio_sizer;
122 wxPanel* _subtitle_panel;
123 wxSizer* _subtitle_sizer;
125 /** The film we are editing */
126 boost::shared_ptr<Film> _film;
127 /** The Film's name */
129 wxStaticText* _dcp_name;
130 wxCheckBox* _use_dci_name;
131 wxButton* _edit_dci_button;
132 /** The Film's format */
134 wxStaticText* _scaling_description;
135 /** The Film's content file */
136 wxFilePickerCtrl* _content;
137 wxCheckBox* _trust_content_header;
138 /** The Film's left crop */
139 wxSpinCtrl* _left_crop;
140 /** The Film's right crop */
141 wxSpinCtrl* _right_crop;
142 /** The Film's top crop */
143 wxSpinCtrl* _top_crop;
144 /** The Film's bottom crop */
145 wxSpinCtrl* _bottom_crop;
146 /** Currently-applied filters */
147 wxStaticText* _filters;
148 /** Button to open the filters dialogue */
149 wxButton* _filters_button;
150 /** The Film's scaler */
152 wxRadioButton* _use_content_audio;
153 wxChoice* _audio_stream;
154 wxRadioButton* _use_external_audio;
155 wxFilePickerCtrl* _external_audio[MAX_AUDIO_CHANNELS];
156 /** The Film's audio gain */
157 wxSpinCtrl* _audio_gain;
158 /** A button to open the gain calculation dialogue */
159 wxButton* _audio_gain_calculate_button;
160 wxButton* _show_audio;
161 /** The Film's audio delay */
162 wxSpinCtrl* _audio_delay;
163 wxCheckBox* _with_subtitles;
164 wxChoice* _subtitle_stream;
165 wxSpinCtrl* _subtitle_offset;
166 wxSpinCtrl* _subtitle_scale;
167 wxChoice* _colour_lut;
168 wxSpinCtrl* _j2k_bandwidth;
169 /** The Film's DCP content type */
170 wxChoice* _dcp_content_type;
171 /** The Film's source frame rate */
172 wxStaticText* _source_frame_rate;
173 wxChoice* _dcp_frame_rate;
174 wxButton* _best_dcp_frame_rate;
175 wxCheckBox* _pad_with_silence;
176 wxSpinCtrl* _minimum_audio_channels;
177 wxStaticText* _frame_rate_description;
178 /** The Film's length */
179 wxStaticText* _length;
180 /** The Film's audio details */
181 wxStaticText* _audio;
182 /** The Film's duration for still sources */
183 wxSpinCtrl* _still_duration;
185 wxSpinCtrl* _trim_start;
186 wxSpinCtrl* _trim_end;
187 wxChoice* _trim_type;
188 /** Selector to generate an A/B comparison DCP */
191 std::list<wxControl*> _video_controls;
192 std::list<wxControl*> _still_controls;
194 std::vector<Format const *> _formats;
196 bool _generally_sensitive;
197 AudioDialog* _audio_dialog;