Merge master.
[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 wxListCtrl;
33 class wxListEvent;
34 class Film;
35 class AudioDialog;
36 class TimelineDialog;
37 class AudioMappingView;
38 class Ratio;
39 class Timecode;
40
41 /** @class FilmEditor
42  *  @brief A wx widget to edit a film's metadata, and perform various functions.
43  */
44 class FilmEditor : public wxPanel
45 {
46 public:
47         FilmEditor (boost::shared_ptr<Film>, wxWindow *);
48
49         void set_film (boost::shared_ptr<Film>);
50         void set_selection (boost::weak_ptr<Content>);
51
52         boost::signals2::signal<void (std::string)> FileChanged;
53
54 private:
55         void make_dcp_panel ();
56         void make_content_panel ();
57         void make_video_panel ();
58         void make_audio_panel ();
59         void make_subtitle_panel ();
60         void make_timing_panel ();
61         void connect_to_widgets ();
62         
63         /* Handle changes to the view */
64         void name_changed (wxCommandEvent &);
65         void use_dci_name_toggled (wxCommandEvent &);
66         void edit_dci_button_clicked (wxCommandEvent &);
67         void left_crop_changed (wxCommandEvent &);
68         void right_crop_changed (wxCommandEvent &);
69         void top_crop_changed (wxCommandEvent &);
70         void bottom_crop_changed (wxCommandEvent &);
71         void trust_content_headers_changed (wxCommandEvent &);
72         void content_selection_changed (wxListEvent &);
73         void content_add_clicked (wxCommandEvent &);
74         void content_remove_clicked (wxCommandEvent &);
75         void imagemagick_video_length_changed (wxCommandEvent &);
76         void container_changed (wxCommandEvent &);
77         void dcp_content_type_changed (wxCommandEvent &);
78         void scaler_changed (wxCommandEvent &);
79         void audio_gain_changed (wxCommandEvent &);
80         void audio_gain_calculate_button_clicked (wxCommandEvent &);
81         void show_audio_clicked (wxCommandEvent &);
82         void audio_delay_changed (wxCommandEvent &);
83         void with_subtitles_toggled (wxCommandEvent &);
84         void subtitle_offset_changed (wxCommandEvent &);
85         void subtitle_scale_changed (wxCommandEvent &);
86         void colour_lut_changed (wxCommandEvent &);
87         void j2k_bandwidth_changed (wxCommandEvent &);
88         void dcp_frame_rate_changed (wxCommandEvent &);
89         void best_dcp_frame_rate_clicked (wxCommandEvent &);
90         void edit_filters_clicked (wxCommandEvent &);
91         void loop_content_toggled (wxCommandEvent &);
92         void loop_count_changed (wxCommandEvent &);
93         void content_timeline_clicked (wxCommandEvent &);
94         void audio_stream_changed (wxCommandEvent &);
95         void subtitle_stream_changed (wxCommandEvent &);
96         void audio_mapping_changed (AudioMapping);
97         void start_changed ();
98         void length_changed ();
99         void ratio_changed (wxCommandEvent &);
100         void pad_with_silence_toggled (wxCommandEvent &);
101         void minimum_audio_channels_changed (wxCommandEvent &);
102
103         /* Handle changes to the model */
104         void film_changed (Film::Property);
105         void film_content_changed (boost::weak_ptr<Content>, int);
106
107         void set_things_sensitive (bool);
108         void setup_ratios ();
109         void setup_subtitle_control_sensitivity ();
110         void setup_dcp_name ();
111         void setup_show_audio_sensitivity ();
112         void setup_scaling_description ();
113         void setup_main_notebook_size ();
114         void setup_content ();
115         void setup_container ();
116         void setup_content_sensitivity ();
117         void setup_loop_sensitivity ();
118         void setup_minimum_audio_channels ();
119         
120         void active_jobs_changed (bool);
121         boost::shared_ptr<Content> selected_content ();
122         boost::shared_ptr<VideoContent> selected_video_content ();
123         boost::shared_ptr<AudioContent> selected_audio_content ();
124
125         wxNotebook* _main_notebook;
126         wxNotebook* _content_notebook;
127         wxPanel* _dcp_panel;
128         wxSizer* _dcp_sizer;
129         wxPanel* _content_panel;
130         wxSizer* _content_sizer;
131         wxPanel* _video_panel;
132         wxPanel* _audio_panel;
133         wxPanel* _subtitle_panel;
134         wxPanel* _timing_panel;
135
136         /** The film we are editing */
137         boost::shared_ptr<Film> _film;
138         wxTextCtrl* _name;
139         wxStaticText* _dcp_name;
140         wxCheckBox* _use_dci_name;
141         wxChoice* _container;
142         wxListCtrl* _content;
143         wxButton* _content_add;
144         wxButton* _content_remove;
145         wxButton* _content_earlier;
146         wxButton* _content_later;
147         wxButton* _content_timeline;
148         wxCheckBox* _loop_content;
149         wxSpinCtrl* _loop_count;
150         wxButton* _edit_dci_button;
151         wxChoice* _ratio;
152         wxStaticText* _ratio_description;
153         wxStaticText* _scaling_description;
154         wxSpinCtrl* _left_crop;
155         wxSpinCtrl* _right_crop;
156         wxSpinCtrl* _top_crop;
157         wxSpinCtrl* _bottom_crop;
158         wxStaticText* _filters;
159         wxButton* _filters_button;
160         wxChoice* _scaler;
161         wxSpinCtrl* _audio_gain;
162         wxButton* _audio_gain_calculate_button;
163         wxButton* _show_audio;
164         wxSpinCtrl* _audio_delay;
165         wxCheckBox* _with_subtitles;
166         wxSpinCtrl* _subtitle_offset;
167         wxSpinCtrl* _subtitle_scale;
168         wxChoice* _colour_lut;
169         wxSpinCtrl* _j2k_bandwidth;
170         wxChoice* _dcp_content_type;
171         wxChoice* _dcp_frame_rate;
172         wxButton* _best_dcp_frame_rate;
173         wxCheckBox* _pad_with_silence;
174         wxSpinCtrl* _minimum_audio_channels;
175         wxChoice* _audio_stream;
176         wxStaticText* _audio_description;
177         wxChoice* _subtitle_stream;
178         AudioMappingView* _audio_mapping;
179         Timecode* _start;
180         Timecode* _length;
181
182         std::vector<Ratio const *> _ratios;
183
184         bool _generally_sensitive;
185         AudioDialog* _audio_dialog;
186         TimelineDialog* _timeline_dialog;
187 };