2 Copyright (C) 2012-2021 Carl Hetherington <cth@carlh.net>
4 This file is part of DCP-o-matic.
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.
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.
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/>.
22 #include "content_menu.h"
23 #include "lib/enum_indexed_vector.h"
25 #include "lib/types.h"
26 #include <dcp/warnings.h>
27 LIBDCP_DISABLE_WARNINGS
28 #include <wx/splitter.h>
29 LIBDCP_ENABLE_WARNINGS
34 class ContentSubPanel;
47 class wxSplitterWindow;
50 class LimitedSplitter : public wxSplitterWindow
53 LimitedSplitter (wxWindow* parent);
55 bool OnSashPositionChange (int new_position) override
57 /* Try to stop the top bit of the splitter getting so small that buttons disappear */
58 return new_position > 220;
61 void first_shown (wxWindow* top, wxWindow* bottom);
64 void sized (wxSizeEvent& ev);
67 int const _top_panel_minimum_size;
74 ContentPanel (wxNotebook *, std::shared_ptr<Film>, std::weak_ptr<FilmViewer> viewer);
76 ContentPanel (ContentPanel const&) = delete;
77 ContentPanel& operator= (ContentPanel const&) = delete;
79 std::shared_ptr<Film> film () const {
83 void set_film (std::shared_ptr<Film>);
84 void set_general_sensitivity (bool s);
85 void set_selection (std::weak_ptr<Content>);
86 void set_selection (ContentList cl);
89 void film_changed (Film::Property p);
90 void film_content_changed (int p);
94 wxWindow* window () const {
98 wxNotebook* notebook () const {
102 ContentList selected ();
103 ContentList selected_video ();
104 ContentList selected_audio ();
105 ContentList selected_text ();
106 FFmpegContentList selected_ffmpeg ();
108 void add_file_clicked ();
109 bool remove_clicked (bool hotkey);
110 void timeline_clicked ();
112 std::weak_ptr<FilmViewer> film_viewer () const {
116 void add_files(std::vector<boost::filesystem::path> files);
117 void add_dcp(boost::filesystem::path dcp);
118 void add_folder(boost::filesystem::path folder);
120 boost::signals2::signal<void (void)> SelectionChanged;
123 void item_selected ();
124 void item_deselected ();
125 void item_deselected_idle ();
126 void check_selection ();
127 void add_folder_clicked ();
128 void add_dcp_clicked ();
129 void earlier_clicked ();
130 void later_clicked ();
131 void right_click (wxListEvent &);
132 void files_dropped (wxDropFilesEvent &);
135 void setup_sensitivity ();
136 void set_selected_state(int item, bool state);
138 std::list<ContentSubPanel *> panels () const;
140 LimitedSplitter* _splitter;
142 wxNotebook* _notebook;
143 wxListCtrl* _content;
145 wxButton* _add_folder;
151 VideoPanel* _video_panel = nullptr;
152 AudioPanel* _audio_panel = nullptr;
153 EnumIndexedVector<TextPanel*, TextType> _text_panel;
154 TimingPanel* _timing_panel;
156 TimelineDialog* _timeline_dialog = nullptr;
158 wxWindow* _last_selected_tab = nullptr;
160 std::shared_ptr<Film> _film;
161 std::weak_ptr<FilmViewer> _film_viewer;
162 bool _generally_sensitive;
163 bool _ignore_deselect;
164 bool _no_check_selection;