Copy current ISDCF name into the film name when 'Use ISDCF name' is un-ticked.
[dcpomatic.git] / src / wx / film_editor.h
1 /*
2     Copyright (C) 2012-2014 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 wxGridBagSizer;
36 class Film;
37 class TimelineDialog;
38 class Ratio;
39 class Timecode;
40 class FilmEditorPanel;
41 class SubtitleContent;
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 (wxWindow *);
50
51         void set_film (boost::shared_ptr<Film>);
52         void set_selection (boost::weak_ptr<Content>);
53
54         boost::signals2::signal<void (boost::filesystem::path)> 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         ContentList selected_content ();
67         VideoContentList selected_video_content ();
68         AudioContentList selected_audio_content ();
69         SubtitleContentList selected_subtitle_content ();
70         FFmpegContentList selected_ffmpeg_content ();
71         
72 private:
73         void make_dcp_panel ();
74         void make_content_panel ();
75         void connect_to_widgets ();
76         
77         /* Handle changes to the view */
78         void name_changed ();
79         void use_isdcf_name_toggled ();
80         void edit_isdcf_button_clicked ();
81         void content_selection_changed ();
82         void content_add_file_clicked ();
83         void content_add_folder_clicked ();
84         void content_remove_clicked ();
85         void content_earlier_clicked ();
86         void content_later_clicked ();
87         void content_files_dropped (wxDropFilesEvent& event);
88         void container_changed ();
89         void dcp_content_type_changed ();
90         void scaler_changed ();
91         void j2k_bandwidth_changed ();
92         void frame_rate_choice_changed ();
93         void frame_rate_spin_changed ();
94         void best_frame_rate_clicked ();
95         void content_timeline_clicked ();
96         void audio_channels_changed ();
97         void resolution_changed ();
98         void sequence_video_changed ();
99         void content_right_click (wxListEvent &);
100         void three_d_changed ();
101         void standard_changed ();
102         void signed_toggled ();
103         void encrypted_toggled ();
104
105         /* Handle changes to the model */
106         void film_changed (Film::Property);
107         void film_content_changed (int);
108         void use_isdcf_name_changed ();
109
110         void set_general_sensitivity (bool);
111         void setup_dcp_name ();
112         void setup_content ();
113         void setup_container ();
114         void setup_content_sensitivity ();
115         void setup_frame_rate_widget ();
116         
117         void active_jobs_changed (bool);
118         void config_changed ();
119
120         FilmEditorPanel* _video_panel;
121         FilmEditorPanel* _audio_panel;
122         FilmEditorPanel* _subtitle_panel;
123         FilmEditorPanel* _timing_panel;
124         std::list<FilmEditorPanel *> _panels;
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
133         /** The film we are editing */
134         boost::shared_ptr<Film> _film;
135         wxTextCtrl* _name;
136         wxStaticText* _dcp_name;
137         wxCheckBox* _use_isdcf_name;
138         wxChoice* _container;
139         wxListCtrl* _content;
140         wxButton* _content_add_file;
141         wxButton* _content_add_folder;
142         wxButton* _content_remove;
143         wxButton* _content_earlier;
144         wxButton* _content_later;
145         wxButton* _content_timeline;
146         wxCheckBox* _sequence_video;
147         wxButton* _edit_isdcf_button;
148         wxChoice* _scaler;
149         wxSpinCtrl* _j2k_bandwidth;
150         wxChoice* _dcp_content_type;
151         wxChoice* _frame_rate_choice;
152         wxSpinCtrl* _frame_rate_spin;
153         wxSizer* _frame_rate_sizer;
154         wxSpinCtrl* _audio_channels;
155         wxButton* _best_frame_rate;
156         wxCheckBox* _three_d;
157         wxChoice* _resolution;
158         wxChoice* _standard;
159         wxCheckBox* _signed;
160         wxCheckBox* _encrypted;
161
162         ContentMenu _menu;
163
164         std::vector<Ratio const *> _ratios;
165
166         bool _generally_sensitive;
167         TimelineDialog* _timeline_dialog;
168 };