No-op; fix GPL address and use the explicit-program-name version.
[dcpomatic.git] / src / wx / self_dkdm_dialog.cc
1 /*
2     Copyright (C) 2012-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 "self_dkdm_dialog.h"
22 #include "wx_util.h"
23 #include "kdm_output_panel.h"
24 #include "kdm_cpl_panel.h"
25 #include "lib/film.h"
26 #include "lib/screen.h"
27 #include <libcxml/cxml.h>
28 #include <wx/treectrl.h>
29 #include <wx/listctrl.h>
30 #include <wx/stdpaths.h>
31 #include <iostream>
32
33 using std::string;
34 using std::map;
35 using std::list;
36 using std::pair;
37 using std::cout;
38 using std::vector;
39 using std::make_pair;
40 using boost::shared_ptr;
41
42 SelfDKDMDialog::SelfDKDMDialog (wxWindow* parent, boost::shared_ptr<const Film> film)
43         : wxDialog (parent, wxID_ANY, _("Make DKDM for DCP-o-matic"))
44 {
45         /* Main sizer */
46         wxBoxSizer* vertical = new wxBoxSizer (wxVERTICAL);
47
48         /* Font for sub-headings */
49         wxFont subheading_font (*wxNORMAL_FONT);
50         subheading_font.SetWeight (wxFONTWEIGHT_BOLD);
51
52         /* Sub-heading: CPL */
53         wxStaticText* h = new wxStaticText (this, wxID_ANY, _("CPL"));
54         h->SetFont (subheading_font);
55         vertical->Add (h, 0, wxALIGN_CENTER_VERTICAL, DCPOMATIC_SIZER_Y_GAP * 2);
56         _cpl = new KDMCPLPanel (this, film->cpls ());
57         vertical->Add (_cpl);
58
59         /* Make an overall sizer to get a nice border, and put some buttons in */
60
61         wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL);
62         overall_sizer->Add (vertical, 0, wxEXPAND | wxTOP | wxLEFT | wxRIGHT, DCPOMATIC_DIALOG_BORDER);
63
64         wxSizer* buttons = CreateSeparatedButtonSizer (wxOK | wxCANCEL);
65         if (buttons) {
66                 overall_sizer->Add (buttons, 0, wxEXPAND | wxALL, DCPOMATIC_SIZER_Y_GAP);
67         }
68
69         setup_sensitivity ();
70
71         SetSizer (overall_sizer);
72         overall_sizer->Layout ();
73         overall_sizer->SetSizeHints (this);
74 }
75
76 void
77 SelfDKDMDialog::setup_sensitivity ()
78 {
79         wxButton* ok = dynamic_cast<wxButton *> (FindWindowById (wxID_OK, this));
80         if (ok) {
81                 ok->Enable (_cpl->has_selected ());
82         }
83 }
84
85 boost::filesystem::path
86 SelfDKDMDialog::cpl () const
87 {
88         return _cpl->cpl ();
89 }