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