Potential fix for crash on loading a new film after starting an audio analysis.
[dcpomatic.git] / src / wx / content_panel.h
1 /*
2     Copyright (C) 2012-2016 Carl Hetherington <cth@carlh.net>
3
4     This file is part of DCP-o-matic.
5
6     DCP-o-matic is free software; you can redistribute it and/or modify
7     it under the terms of the GNU General Public License as published by
8     the Free Software Foundation; either version 2 of the License, or
9     (at your option) any later version.
10
11     DCP-o-matic is distributed in the hope that it will be useful,
12     but WITHOUT ANY WARRANTY; without even the implied warranty of
13     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14     GNU General Public License for more details.
15
16     You should have received a copy of the GNU General Public License
17     along with DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.
18
19 */
20
21 #include <list>
22 #include <boost/shared_ptr.hpp>
23 #include "lib/types.h"
24 #include "lib/film.h"
25 #include "content_menu.h"
26
27 class wxNotebook;
28 class wxPanel;
29 class wxSizer;
30 class wxListCtrl;
31 class wxListEvent;
32 class TimelineDialog;
33 class FilmEditor;
34 class ContentSubPanel;
35 class AudioPanel;
36 class Film;
37 class FilmViewer;
38
39 class ContentPanel : public boost::noncopyable
40 {
41 public:
42         ContentPanel (wxNotebook *, boost::shared_ptr<Film>, FilmViewer* viewer);
43
44         boost::shared_ptr<Film> film () const {
45                 return _film;
46         }
47
48         void set_film (boost::shared_ptr<Film>);
49         void set_general_sensitivity (bool s);
50         void set_selection (boost::weak_ptr<Content>);
51
52         void film_changed (Film::Property p);
53         void film_content_changed (int p);
54
55         wxPanel* panel () const {
56                 return _panel;
57         }
58
59         wxNotebook* notebook () const {
60                 return _notebook;
61         }
62
63         ContentList selected ();
64         ContentList selected_video ();
65         ContentList selected_audio ();
66         ContentList selected_subtitle ();
67         FFmpegContentList selected_ffmpeg ();
68
69         void add_file_clicked ();
70         bool remove_clicked (bool hotkey);
71
72 private:
73         void selection_changed ();
74         void add_folder_clicked ();
75         void earlier_clicked ();
76         void later_clicked ();
77         void right_click (wxListEvent &);
78         void files_dropped (wxDropFilesEvent &);
79         void timeline_clicked ();
80
81         void setup ();
82         void setup_sensitivity ();
83
84         void add_files (std::list<boost::filesystem::path>);
85
86         wxPanel* _panel;
87         wxSizer* _sizer;
88         wxNotebook* _notebook;
89         wxListCtrl* _content;
90         wxButton* _add_file;
91         wxButton* _add_folder;
92         wxButton* _remove;
93         wxButton* _earlier;
94         wxButton* _later;
95         wxButton* _timeline;
96         ContentSubPanel* _video_panel;
97         AudioPanel* _audio_panel;
98         ContentSubPanel* _subtitle_panel;
99         ContentSubPanel* _timing_panel;
100         std::list<ContentSubPanel *> _panels;
101         ContentMenu* _menu;
102         TimelineDialog* _timeline_dialog;
103         wxNotebook* _parent;
104         ContentList _last_selected;
105
106         boost::shared_ptr<Film> _film;
107         FilmViewer* _film_viewer;
108         bool _generally_sensitive;
109 };