Fix shared_ptr for Film.
[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/trim_action.h"
30 #include "lib/film.h"
31
32 class Film;
33
34 /** @class FilmEditor
35  *  @brief A wx widget to edit a film's metadata, and perform various functions.
36  */
37 class FilmEditor : public wxPanel
38 {
39 public:
40         FilmEditor (boost::shared_ptr<Film>, wxWindow *);
41
42         void set_film (boost::shared_ptr<Film>);
43         void setup_visibility ();
44
45         boost::signals2::signal<void (std::string)> FileChanged;
46
47 private:
48         /* Handle changes to the view */
49         void name_changed (wxCommandEvent &);
50         void use_dci_name_toggled (wxCommandEvent &);
51         void edit_dci_button_clicked (wxCommandEvent &);
52         void left_crop_changed (wxCommandEvent &);
53         void right_crop_changed (wxCommandEvent &);
54         void top_crop_changed (wxCommandEvent &);
55         void bottom_crop_changed (wxCommandEvent &);
56         void content_changed (wxCommandEvent &);
57         void format_changed (wxCommandEvent &);
58         void dcp_range_changed (int, TrimAction);
59         void dcp_content_type_changed (wxCommandEvent &);
60         void dcp_ab_toggled (wxCommandEvent &);
61         void scaler_changed (wxCommandEvent &);
62         void audio_gain_changed (wxCommandEvent &);
63         void audio_gain_calculate_button_clicked (wxCommandEvent &);
64         void audio_delay_changed (wxCommandEvent &);
65         void with_subtitles_toggled (wxCommandEvent &);
66         void subtitle_offset_changed (wxCommandEvent &);
67         void subtitle_scale_changed (wxCommandEvent &);
68         void still_duration_changed (wxCommandEvent &);
69         void audio_stream_changed (wxCommandEvent &);
70         void subtitle_stream_changed (wxCommandEvent &);
71
72         /* Handle changes to the model */
73         void film_changed (Film::Property);
74
75         /* Button clicks */
76         void edit_filters_clicked (wxCommandEvent &);
77         void change_dcp_range_clicked (wxCommandEvent &);
78
79         void set_things_sensitive (bool);
80         void setup_formats ();
81         void setup_subtitle_button ();
82         void setup_streams ();
83         void setup_audio_details ();
84         
85         wxControl* video_control (wxControl *);
86         wxControl* still_control (wxControl *);
87
88         void active_jobs_changed (bool);
89
90         Film::Property _ignore_changes;
91
92         /** The film we are editing */
93         boost::shared_ptr<Film> _film;
94         /** The Film's name */
95         wxTextCtrl* _name;
96         wxStaticText* _dcp_name;
97         wxCheckBox* _use_dci_name;
98         wxButton* _edit_dci_button;
99         /** The Film's format */
100         wxComboBox* _format;
101         /** The Film's content file */
102         wxFilePickerCtrl* _content;
103         /** The Film's left crop */
104         wxSpinCtrl* _left_crop;
105         /** The Film's right crop */
106         wxSpinCtrl* _right_crop;
107         /** The Film's top crop */
108         wxSpinCtrl* _top_crop;
109         /** The Film's bottom crop */
110         wxSpinCtrl* _bottom_crop;
111         /** Currently-applied filters */
112         wxStaticText* _filters;
113         /** Button to open the filters dialogue */
114         wxButton* _filters_button;
115         /** The Film's scaler */
116         wxComboBox* _scaler;
117         wxComboBox* _audio_stream;
118         /** The Film's audio gain */
119         wxSpinCtrl* _audio_gain;
120         /** A button to open the gain calculation dialogue */
121         wxButton* _audio_gain_calculate_button;
122         /** The Film's audio delay */
123         wxSpinCtrl* _audio_delay;
124         wxCheckBox* _with_subtitles;
125         wxComboBox* _subtitle_stream;
126         wxSpinCtrl* _subtitle_offset;
127         wxSpinCtrl* _subtitle_scale;
128         /** The Film's DCP content type */
129         wxComboBox* _dcp_content_type;
130         /** The Film's frames per second */
131         wxStaticText* _frames_per_second;
132         /** The Film's original size */
133         wxStaticText* _original_size;
134         /** The Film's length */
135         wxStaticText* _length;
136         /** The Film's audio details */
137         wxStaticText* _audio;
138         /** The Film's duration for still sources */
139         wxSpinCtrl* _still_duration;
140
141         /** Display of the range of frames that will be used */
142         wxStaticText* _dcp_range;
143         /** Button to change the range */
144         wxButton* _change_dcp_range_button;
145         /** Selector to generate an A/B comparison DCP */
146         wxCheckBox* _dcp_ab;
147
148         std::list<wxControl*> _video_controls;
149         std::list<wxControl*> _still_controls;
150
151         std::vector<Format const *> _formats;
152
153         wxSizer* _sizer;
154 };