Partial split of film viewer.
[dcpomatic.git] / src / wx / content_panel.h
1 /*
2     Copyright (C) 2012-2018 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 TextPanel;
36 class VideoPanel;
37 class AudioPanel;
38 class TimingPanel;
39 class Film;
40 class ControlFilmViewer;
41
42 class ContentPanel : public boost::noncopyable
43 {
44 public:
45         ContentPanel (wxNotebook *, boost::shared_ptr<Film>, ControlFilmViewer* viewer);
46
47         boost::shared_ptr<Film> film () const {
48                 return _film;
49         }
50
51         void set_film (boost::shared_ptr<Film>);
52         void set_general_sensitivity (bool s);
53         void set_selection (boost::weak_ptr<Content>);
54         void set_selection (ContentList cl);
55
56         void film_changed (Film::Property p);
57         void film_content_changed (int p);
58
59         wxPanel* panel () const {
60                 return _panel;
61         }
62
63         wxNotebook* notebook () const {
64                 return _notebook;
65         }
66
67         ContentList selected ();
68         ContentList selected_video ();
69         ContentList selected_audio ();
70         ContentList selected_text ();
71         FFmpegContentList selected_ffmpeg ();
72
73         void add_file_clicked ();
74         bool remove_clicked (bool hotkey);
75         void timeline_clicked ();
76
77         ControlFilmViewer* film_viewer () const {
78                 return _film_viewer;
79         }
80
81         boost::signals2::signal<void (void)> SelectionChanged;
82
83 private:
84         void item_selected ();
85         void item_deselected ();
86         void item_deselected_idle ();
87         void check_selection ();
88         void add_folder_clicked ();
89         void add_dcp_clicked ();
90         void earlier_clicked ();
91         void later_clicked ();
92         void right_click (wxListEvent &);
93         void files_dropped (wxDropFilesEvent &);
94
95         void setup ();
96         void setup_sensitivity ();
97
98         void add_files (std::list<boost::filesystem::path>);
99         std::list<ContentSubPanel *> panels () const;
100
101         wxPanel* _panel;
102         wxSizer* _sizer;
103         wxNotebook* _notebook;
104         wxListCtrl* _content;
105         wxButton* _add_file;
106         wxButton* _add_folder;
107         wxButton* _add_dcp;
108         wxButton* _remove;
109         wxButton* _earlier;
110         wxButton* _later;
111         wxButton* _timeline;
112         VideoPanel* _video_panel;
113         AudioPanel* _audio_panel;
114         TextPanel* _text_panel[TEXT_COUNT];
115         TimingPanel* _timing_panel;
116         ContentMenu* _menu;
117         TimelineDialog* _timeline_dialog;
118         wxNotebook* _parent;
119         ContentList _last_selected;
120         wxWindow* _last_selected_tab;
121
122         boost::shared_ptr<Film> _film;
123         ControlFilmViewer* _film_viewer;
124         bool _generally_sensitive;
125         bool _ignore_deselect;
126 };