2 Copyright (C) 2021 Carl Hetherington <cth@carlh.net>
4 This file is part of DCP-o-matic.
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.
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.
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/>.
22 #include "metadata_dialog.h"
25 #include <boost/bind.hpp>
26 #include <boost/weak_ptr.hpp>
27 #include <wx/notebook.h>
34 MetadataDialog::MetadataDialog (wxWindow* parent, weak_ptr<Film> weak_film)
35 : wxDialog (parent, wxID_ANY, _("Metadata"))
36 , WeakFilm (weak_film)
43 MetadataDialog::setup ()
45 auto notebook = new wxNotebook (this, wxID_ANY);
47 auto prepare = [notebook](std::function<void (wxPanel*, wxSizer*)> setup, wxString name) {
48 auto panel = new wxPanel (notebook, wxID_ANY);
49 auto sizer = new wxFlexGridSizer (2, DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
50 sizer->AddGrowableCol (1, 1);
52 auto overall_sizer = new wxBoxSizer (wxVERTICAL);
53 overall_sizer->Add (sizer, 1, wxEXPAND | wxALL, DCPOMATIC_DIALOG_BORDER);
54 panel->SetSizer (overall_sizer);
55 notebook->AddPage (panel, name);
58 prepare (boost::bind(&MetadataDialog::setup_standard, this, _1, _2), _("Standard"));
59 prepare (boost::bind(&MetadataDialog::setup_advanced, this, _1, _2), _("Advanced"));
61 auto overall_sizer = new wxBoxSizer (wxVERTICAL);
62 overall_sizer->Add (notebook, 1, wxEXPAND | wxALL, DCPOMATIC_DIALOG_BORDER);
64 auto buttons = CreateSeparatedButtonSizer (wxCLOSE);
66 overall_sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder());
69 SetSizer (overall_sizer);
70 overall_sizer->Layout ();
71 overall_sizer->SetSizeHints (this);