No-op; fix GPL address and use the explicit-program-name version.
[dcpomatic.git] / src / wx / preset_colour_conversion_dialog.cc
1 /*
2     Copyright (C) 2013 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 <wx/statline.h>
22 #include "lib/colour_conversion.h"
23 #include "wx_util.h"
24 #include "preset_colour_conversion_dialog.h"
25 #include "colour_conversion_editor.h"
26 #include <iostream>
27
28 using std::string;
29 using std::cout;
30
31 PresetColourConversionDialog::PresetColourConversionDialog (wxWindow* parent)
32         : wxDialog (parent, wxID_ANY, _("Colour conversion"))
33         , _editor (new ColourConversionEditor (this, true))
34 {
35         wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL);
36         SetSizer (overall_sizer);
37
38         wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
39         table->AddGrowableCol (1, 1);
40         add_label_to_sizer (table, this, _("Name"), true);
41         _name = new wxTextCtrl (this, wxID_ANY, wxT (""));
42         table->Add (_name, 1, wxEXPAND | wxALL);
43
44         overall_sizer->Add (table, 1, wxEXPAND | wxALL, DCPOMATIC_DIALOG_BORDER);
45         overall_sizer->Add (new wxStaticLine (this, wxID_ANY), 0, wxEXPAND);
46         overall_sizer->Add (_editor);
47
48         wxSizer* buttons = CreateSeparatedButtonSizer (wxOK);
49         if (buttons) {
50                 overall_sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder());
51         }
52
53         overall_sizer->Layout ();
54         overall_sizer->SetSizeHints (this);
55 }
56
57 PresetColourConversion
58 PresetColourConversionDialog::get () const
59 {
60         PresetColourConversion pc;
61         pc.name = wx_to_std (_name->GetValue ());
62         pc.conversion = _editor->get ();
63         return pc;
64 }
65
66 void
67 PresetColourConversionDialog::set (PresetColourConversion c)
68 {
69         _name->SetValue (std_to_wx (c.name));
70         _editor->set (c.conversion);
71 }