No-op; fix GPL address and use the explicit-program-name version.
[dcpomatic.git] / src / wx / kdm_output_panel.cc
1 /*
2     Copyright (C) 2015 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 "kdm_output_panel.h"
22 #include "wx_util.h"
23 #include <dcp/types.h>
24 #ifdef DCPOMATIC_USE_OWN_PICKER
25 #include "dir_picker_ctrl.h"
26 #else
27 #include <wx/filepicker.h>
28 #endif
29 #include <wx/stdpaths.h>
30
31 KDMOutputPanel::KDMOutputPanel (wxWindow* parent, bool interop)
32         : wxPanel (parent, wxID_ANY)
33 {
34         wxFlexGridSizer* table = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, 0);
35
36         add_label_to_sizer (table, this, _("KDM type"), true);
37         _type = new wxChoice (this, wxID_ANY);
38         _type->Append ("Modified Transitional 1", ((void *) dcp::MODIFIED_TRANSITIONAL_1));
39         if (!interop) {
40                 _type->Append ("DCI Any", ((void *) dcp::DCI_ANY));
41                 _type->Append ("DCI Specific", ((void *) dcp::DCI_SPECIFIC));
42         }
43         table->Add (_type, 1, wxEXPAND);
44         _type->SetSelection (0);
45
46         _write_to = new wxRadioButton (this, wxID_ANY, _("Write to"));
47         table->Add (_write_to, 1, wxEXPAND);
48
49 #ifdef DCPOMATIC_USE_OWN_PICKER
50         _folder = new DirPickerCtrl (this);
51 #else
52         _folder = new wxDirPickerCtrl (this, wxID_ANY, wxEmptyString, wxDirSelectorPromptStr, wxDefaultPosition, wxSize (300, -1));
53 #endif
54
55         _folder->SetPath (wxStandardPaths::Get().GetDocumentsDir());
56
57         table->Add (_folder, 1, wxEXPAND);
58
59         _email = new wxRadioButton (this, wxID_ANY, _("Send by email"));
60         table->Add (_email, 1, wxEXPAND);
61         table->AddSpacer (0);
62
63         _write_to->SetValue (true);
64
65         _write_to->Bind (wxEVT_COMMAND_RADIOBUTTON_SELECTED, boost::bind (&KDMOutputPanel::setup_sensitivity, this));
66         _email->Bind    (wxEVT_COMMAND_RADIOBUTTON_SELECTED, boost::bind (&KDMOutputPanel::setup_sensitivity, this));
67
68         SetSizer (table);
69 }
70
71 void
72 KDMOutputPanel::setup_sensitivity ()
73 {
74         _folder->Enable (_write_to->GetValue ());
75 }
76
77 boost::filesystem::path
78 KDMOutputPanel::directory () const
79 {
80         return wx_to_std (_folder->GetPath ());
81 }
82
83 bool
84 KDMOutputPanel::write_to () const
85 {
86         return _write_to->GetValue ();
87 }
88
89 dcp::Formulation
90 KDMOutputPanel::formulation () const
91 {
92         return (dcp::Formulation) reinterpret_cast<intptr_t> (_type->GetClientData (_type->GetSelection()));
93 }