Fix layout bug where the stuff in the content panel would be completely
[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         void first_shown ();
62
63         wxWindow* window () const {
64                 return _splitter;
65         }
66
67         wxNotebook* notebook () const {
68                 return _notebook;
69         }
70
71         ContentList selected ();
72         ContentList selected_video ();
73         ContentList selected_audio ();
74         ContentList selected_text ();
75         FFmpegContentList selected_ffmpeg ();
76
77         void add_file_clicked ();
78         bool remove_clicked (bool hotkey);
79         void timeline_clicked ();
80
81         boost::weak_ptr<FilmViewer> film_viewer () const {
82                 return _film_viewer;
83         }
84
85         boost::signals2::signal<void (void)> SelectionChanged;
86
87 private:
88         void item_selected ();
89         void item_deselected ();
90         void item_deselected_idle ();
91         void check_selection ();
92         void add_folder_clicked ();
93         void add_dcp_clicked ();
94         void earlier_clicked ();
95         void later_clicked ();
96         void right_click (wxListEvent &);
97         void files_dropped (wxDropFilesEvent &);
98
99         void setup ();
100         void setup_sensitivity ();
101
102         void add_files (std::list<boost::filesystem::path>);
103         std::list<ContentSubPanel *> panels () const;
104
105         wxSplitterWindow* _splitter;
106         wxPanel* _top_panel;
107         wxNotebook* _notebook;
108         wxListCtrl* _content;
109         wxButton* _add_file;
110         wxButton* _add_folder;
111         wxButton* _add_dcp;
112         wxButton* _remove;
113         wxButton* _earlier;
114         wxButton* _later;
115         wxButton* _timeline;
116         VideoPanel* _video_panel;
117         AudioPanel* _audio_panel;
118         TextPanel* _text_panel[TEXT_COUNT];
119         TimingPanel* _timing_panel;
120         ContentMenu* _menu;
121         TimelineDialog* _timeline_dialog;
122         wxNotebook* _parent;
123         wxWindow* _last_selected_tab;
124
125         boost::shared_ptr<Film> _film;
126         boost::weak_ptr<FilmViewer> _film_viewer;
127         bool _generally_sensitive;
128         bool _ignore_deselect;
129         bool _no_check_selection;
130 };