Basic implementation of a tree view for DKDMs (#1012).
[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         void set_selection (ContentList cl);
52
53         void film_changed (Film::Property p);
54         void film_content_changed (int p);
55
56         wxPanel* panel () const {
57                 return _panel;
58         }
59
60         wxNotebook* notebook () const {
61                 return _notebook;
62         }
63
64         ContentList selected ();
65         ContentList selected_video ();
66         ContentList selected_audio ();
67         ContentList selected_subtitle ();
68         FFmpegContentList selected_ffmpeg ();
69
70         void add_file_clicked ();
71         bool remove_clicked (bool hotkey);
72
73 private:
74         void selection_changed ();
75         void add_folder_clicked ();
76         void add_dcp_clicked ();
77         void earlier_clicked ();
78         void later_clicked ();
79         void right_click (wxListEvent &);
80         void files_dropped (wxDropFilesEvent &);
81         void timeline_clicked ();
82
83         void setup ();
84         void setup_sensitivity ();
85
86         void add_files (std::list<boost::filesystem::path>);
87
88         wxPanel* _panel;
89         wxSizer* _sizer;
90         wxNotebook* _notebook;
91         wxListCtrl* _content;
92         wxButton* _add_file;
93         wxButton* _add_folder;
94         wxButton* _add_dcp;
95         wxButton* _remove;
96         wxButton* _earlier;
97         wxButton* _later;
98         wxButton* _timeline;
99         ContentSubPanel* _video_panel;
100         AudioPanel* _audio_panel;
101         ContentSubPanel* _subtitle_panel;
102         ContentSubPanel* _timing_panel;
103         std::list<ContentSubPanel *> _panels;
104         ContentMenu* _menu;
105         TimelineDialog* _timeline_dialog;
106         wxNotebook* _parent;
107         ContentList _last_selected;
108
109         boost::shared_ptr<Film> _film;
110         FilmViewer* _film_viewer;
111         bool _generally_sensitive;
112 };