Separate audio panel out.
[dcpomatic.git] / src / wx / film_editor.h
1 /*
2     Copyright (C) 2012-2013 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 #include "content_menu.h"
31
32 class wxNotebook;
33 class wxListCtrl;
34 class wxListEvent;
35 class Film;
36 class TimelineDialog;
37 class Ratio;
38 class Timecode;
39 class TimingPanel;
40 class SubtitlePanel;
41 class AudioPanel;
42
43 /** @class FilmEditor
44  *  @brief A wx widget to edit a film's metadata, and perform various functions.
45  */
46 class FilmEditor : public wxPanel
47 {
48 public:
49         FilmEditor (boost::shared_ptr<Film>, wxWindow *);
50
51         void set_film (boost::shared_ptr<Film>);
52         void set_selection (boost::weak_ptr<Content>);
53
54         boost::signals2::signal<void (std::string)> FileChanged;
55
56         /* Stuff for panels */
57         
58         wxNotebook* content_notebook () const {
59                 return _content_notebook;
60         }
61
62         boost::shared_ptr<Film> film () const {
63                 return _film;
64         }
65
66         boost::shared_ptr<Content> selected_content ();
67         boost::shared_ptr<VideoContent> selected_video_content ();
68         boost::shared_ptr<AudioContent> selected_audio_content ();
69         boost::shared_ptr<SubtitleContent> selected_subtitle_content ();
70         
71         bool generally_sensitive () const {
72                 return _generally_sensitive;
73         }
74
75 private:
76         void make_dcp_panel ();
77         void make_content_panel ();
78         void make_video_panel ();
79         void connect_to_widgets ();
80         
81         /* Handle changes to the view */
82         void name_changed (wxCommandEvent &);
83         void use_dci_name_toggled (wxCommandEvent &);
84         void edit_dci_button_clicked (wxCommandEvent &);
85         void left_crop_changed (wxCommandEvent &);
86         void right_crop_changed (wxCommandEvent &);
87         void top_crop_changed (wxCommandEvent &);
88         void bottom_crop_changed (wxCommandEvent &);
89         void trust_content_headers_changed (wxCommandEvent &);
90         void content_selection_changed (wxListEvent &);
91         void content_add_clicked (wxCommandEvent &);
92         void content_remove_clicked (wxCommandEvent &);
93         void imagemagick_video_length_changed (wxCommandEvent &);
94         void container_changed (wxCommandEvent &);
95         void dcp_content_type_changed (wxCommandEvent &);
96         void scaler_changed (wxCommandEvent &);
97         void j2k_bandwidth_changed (wxCommandEvent &);
98         void dcp_frame_rate_changed (wxCommandEvent &);
99         void best_dcp_frame_rate_clicked (wxCommandEvent &);
100         void edit_filters_clicked (wxCommandEvent &);
101         void content_timeline_clicked (wxCommandEvent &);
102         void ratio_changed (wxCommandEvent &);
103         void dcp_audio_channels_changed (wxCommandEvent &);
104         void dcp_resolution_changed (wxCommandEvent &);
105         void sequence_video_changed (wxCommandEvent &);
106         void content_right_click (wxListEvent &);
107
108         /* Handle changes to the model */
109         void film_changed (Film::Property);
110         void film_content_changed (boost::weak_ptr<Content>, int);
111
112         void set_things_sensitive (bool);
113         void setup_ratios ();
114         void setup_dcp_name ();
115         void setup_scaling_description ();
116         void setup_content ();
117         void setup_container ();
118         void setup_content_sensitivity ();
119         
120         void active_jobs_changed (bool);
121
122         AudioPanel* _audio_panel;
123         SubtitlePanel* _subtitle_panel;
124         TimingPanel* _timing_panel;
125
126         wxNotebook* _main_notebook;
127         wxNotebook* _content_notebook;
128         wxPanel* _dcp_panel;
129         wxSizer* _dcp_sizer;
130         wxPanel* _content_panel;
131         wxSizer* _content_sizer;
132         wxPanel* _video_panel;
133
134         /** The film we are editing */
135         boost::shared_ptr<Film> _film;
136         wxTextCtrl* _name;
137         wxStaticText* _dcp_name;
138         wxCheckBox* _use_dci_name;
139         wxChoice* _container;
140         wxListCtrl* _content;
141         wxButton* _content_add;
142         wxButton* _content_remove;
143         wxButton* _content_earlier;
144         wxButton* _content_later;
145         wxButton* _content_timeline;
146         wxCheckBox* _sequence_video;
147         wxButton* _edit_dci_button;
148         wxChoice* _ratio;
149         wxStaticText* _ratio_description;
150         wxStaticText* _scaling_description;
151         wxSpinCtrl* _left_crop;
152         wxSpinCtrl* _right_crop;
153         wxSpinCtrl* _top_crop;
154         wxSpinCtrl* _bottom_crop;
155         wxStaticText* _filters;
156         wxButton* _filters_button;
157         wxChoice* _scaler;
158         wxSpinCtrl* _j2k_bandwidth;
159         wxChoice* _dcp_content_type;
160         wxChoice* _dcp_frame_rate;
161         wxSpinCtrl* _dcp_audio_channels;
162         wxButton* _best_dcp_frame_rate;
163         wxChoice* _dcp_resolution;
164
165         ContentMenu _menu;
166
167         std::vector<Ratio const *> _ratios;
168
169         bool _generally_sensitive;
170         TimelineDialog* _timeline_dialog;
171 };