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