daaccf08f86aa4251429ac318d89bf9e66c99cc4
[dcpomatic.git] / src / wx / subtitle_appearance_dialog.h
1 /*
2     Copyright (C) 2015-2018 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 "timecode.h"
22 #include "lib/change_signaller.h"
23 #include "lib/rgba.h"
24 #include "lib/warnings.h"
25 DCPOMATIC_DISABLE_WARNINGS
26 #include <wx/wx.h>
27 DCPOMATIC_ENABLE_WARNINGS
28 #include <boost/signals2.hpp>
29
30 class wxRadioButton;
31 class wxColourPickerCtrl;
32 class wxGridBagSizer;
33 class Content;
34 class RGBAColourPicker;
35 class FFmpegSubtitleStream;
36 class wxCheckBox;
37 class wxWidget;
38 class Film;
39 class Job;
40
41 class SubtitleAppearanceDialog : public wxDialog
42 {
43 public:
44         SubtitleAppearanceDialog (wxWindow* parent, std::shared_ptr<const Film> film, std::shared_ptr<Content> content, std::shared_ptr<TextContent> caption);
45
46         void apply ();
47
48 private:
49         void setup_sensitivity ();
50         void restore ();
51         wxCheckBox* set_to (wxWindow* w, int& r);
52         void content_change (ChangeType type);
53         void active_jobs_changed (boost::optional<std::string> last);
54         void add_colours ();
55
56         std::weak_ptr<const Film> _film;
57         wxCheckBox* _force_colour;
58         wxColourPickerCtrl* _colour;
59         wxCheckBox* _force_effect;
60         wxChoice* _effect;
61         wxCheckBox* _force_effect_colour;
62         wxColourPickerCtrl* _effect_colour;
63         wxCheckBox* _force_fade_in;
64         Timecode<dcpomatic::ContentTime>* _fade_in;
65         wxCheckBox* _force_fade_out;
66         Timecode<dcpomatic::ContentTime>* _fade_out;
67         wxSpinCtrl* _outline_width;
68         wxGridBagSizer* _table;
69         std::map<RGBA, RGBAColourPicker*> _pickers;
70
71         wxBoxSizer* _overall_sizer;
72         wxScrolled<wxPanel>* _colours_panel;
73         wxStaticText* _finding;
74         wxFlexGridSizer* _colour_table;
75
76         std::shared_ptr<Content> _content;
77         std::shared_ptr<TextContent> _caption;
78         std::shared_ptr<FFmpegSubtitleStream> _stream;
79
80         boost::signals2::scoped_connection _content_connection;
81         boost::signals2::scoped_connection _job_manager_connection;
82
83         std::weak_ptr<Job> _job;
84
85         static int const NONE;
86         static int const OUTLINE;
87         static int const SHADOW;
88 };