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