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