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