9a9ba2906155b99c1d9703b321bc49ae5a7e8677
[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 FilmEditorPanel;
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         /* Stuff for panels */
55         
56         wxNotebook* content_notebook () const {
57                 return _content_notebook;
58         }
59
60         boost::shared_ptr<Film> film () const {
61                 return _film;
62         }
63
64         boost::shared_ptr<Content> selected_content ();
65         boost::shared_ptr<VideoContent> selected_video_content ();
66         boost::shared_ptr<AudioContent> selected_audio_content ();
67         boost::shared_ptr<SubtitleContent> selected_subtitle_content ();
68         
69 private:
70         void make_dcp_panel ();
71         void make_content_panel ();
72         void connect_to_widgets ();
73         
74         /* Handle changes to the view */
75         void name_changed (wxCommandEvent &);
76         void use_dci_name_toggled (wxCommandEvent &);
77         void edit_dci_button_clicked (wxCommandEvent &);
78         void content_selection_changed (wxListEvent &);
79         void content_add_clicked (wxCommandEvent &);
80         void content_remove_clicked (wxCommandEvent &);
81         void container_changed (wxCommandEvent &);
82         void dcp_content_type_changed (wxCommandEvent &);
83         void scaler_changed (wxCommandEvent &);
84         void j2k_bandwidth_changed (wxCommandEvent &);
85         void dcp_frame_rate_changed (wxCommandEvent &);
86         void best_dcp_frame_rate_clicked (wxCommandEvent &);
87         void content_timeline_clicked (wxCommandEvent &);
88         void dcp_audio_channels_changed (wxCommandEvent &);
89         void dcp_resolution_changed (wxCommandEvent &);
90         void sequence_video_changed (wxCommandEvent &);
91         void content_right_click (wxListEvent &);
92         void dcp_3d_changed ();
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_general_sensitivity (bool);
99         void setup_dcp_name ();
100         void setup_content ();
101         void setup_container ();
102         void setup_content_sensitivity ();
103         
104         void active_jobs_changed (bool);
105
106         FilmEditorPanel* _video_panel;
107         FilmEditorPanel* _audio_panel;
108         FilmEditorPanel* _subtitle_panel;
109         FilmEditorPanel* _timing_panel;
110         std::list<FilmEditorPanel *> _panels;
111
112         wxNotebook* _main_notebook;
113         wxNotebook* _content_notebook;
114         wxPanel* _dcp_panel;
115         wxSizer* _dcp_sizer;
116         wxPanel* _content_panel;
117         wxSizer* _content_sizer;
118
119         /** The film we are editing */
120         boost::shared_ptr<Film> _film;
121         wxTextCtrl* _name;
122         wxStaticText* _dcp_name;
123         wxCheckBox* _use_dci_name;
124         wxChoice* _container;
125         wxListCtrl* _content;
126         wxButton* _content_add;
127         wxButton* _content_remove;
128         wxButton* _content_earlier;
129         wxButton* _content_later;
130         wxButton* _content_timeline;
131         wxCheckBox* _sequence_video;
132         wxButton* _edit_dci_button;
133         wxChoice* _scaler;
134         wxSpinCtrl* _j2k_bandwidth;
135         wxChoice* _dcp_content_type;
136         wxChoice* _dcp_frame_rate;
137         wxSpinCtrl* _dcp_audio_channels;
138         wxButton* _best_dcp_frame_rate;
139         wxCheckBox* _dcp_3d;
140         wxChoice* _dcp_resolution;
141
142         ContentMenu _menu;
143
144         std::vector<Ratio const *> _ratios;
145
146         bool _generally_sensitive;
147         TimelineDialog* _timeline_dialog;
148 };