No-op; fix GPL address and use the explicit-program-name version.
[dcpomatic.git] / src / wx / image_subtitle_colour_dialog.cc
1 /*
2     Copyright (C) 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 "image_subtitle_colour_dialog.h"
22 #include "rgba_colour_picker.h"
23 #include "lib/ffmpeg_subtitle_stream.h"
24 #include "lib/ffmpeg_content.h"
25
26 using std::map;
27 using std::cout;
28 using boost::shared_ptr;
29
30 ImageSubtitleColourDialog::ImageSubtitleColourDialog (wxWindow* parent, shared_ptr<FFmpegContent> content, shared_ptr<FFmpegSubtitleStream> stream)
31         : TableDialog (parent, _("Subtitle colours"), 2, 1, true)
32         , _content (content)
33         , _stream (stream)
34 {
35         map<RGBA, RGBA> colours = _stream->colours ();
36
37         wxStaticText* t = new wxStaticText (this, wxID_ANY, "");
38         t->SetLabelMarkup (_("<b>Original colour</b>"));
39         add (t);
40         t = new wxStaticText (this, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE_HORIZONTAL);
41         t->SetLabelMarkup (_("<b>New colour</b>"));
42         add (t, 1, wxALIGN_CENTER);
43
44         for (map<RGBA, RGBA>::const_iterator i = colours.begin(); i != colours.end(); ++i) {
45                 wxPanel* from = new wxPanel (this, wxID_ANY);
46                 from->SetBackgroundColour (wxColour (i->first.r, i->first.g, i->first.b, i->first.a));
47                 add (from);
48                 RGBAColourPicker* to = new RGBAColourPicker (this, i->second);
49                 add (to);
50                 _pickers[i->first] = to;
51         }
52
53         layout ();
54 }
55
56 void
57 ImageSubtitleColourDialog::apply ()
58 {
59         for (map<RGBA, RGBAColourPicker*>::const_iterator i = _pickers.begin(); i != _pickers.end(); ++i) {
60                 _stream->set_colour (i->first, i->second->colour ());
61         }
62
63         _content->signal_subtitle_stream_changed ();
64 }