Basics of content dialogs.
[dcpomatic.git] / src / wx / sndfile_content_dialog.cc
1 /*
2     Copyright (C) 2013 Carl Hetherington <cth@carlh.net>
3
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.
8
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
13
14     You should have received a copy of the GNU General Public License
15     along with this program; if not, write to the Free Software
16     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 */
19
20 #include "lib/util.h"
21 #include "lib/sndfile_content.h"
22 #include "sndfile_content_dialog.h"
23 #include "wx_util.h"
24
25 using boost::shared_ptr;
26
27 SndfileContentDialog::SndfileContentDialog (wxWindow* parent, shared_ptr<SndfileContent> content)
28         : wxDialog (parent, wxID_ANY, _("Sound file"))
29 {
30         wxFlexGridSizer* grid = new wxFlexGridSizer (7, 6, 0);
31
32         add_label_to_sizer (grid, this, wxT (""));
33         add_label_to_sizer (grid, this, _("L"));
34         add_label_to_sizer (grid, this, _("R"));
35         add_label_to_sizer (grid, this, _("C"));
36         add_label_to_sizer (grid, this, _("Lfe"));
37         add_label_to_sizer (grid, this, _("Ls"));
38         add_label_to_sizer (grid, this, _("Rs"));
39
40         _buttons.resize (content->audio_channels ());
41         for (int i = 0; i < content->audio_channels(); ++i) {
42
43                 if (content->audio_channels() == 1) {
44                         add_label_to_sizer (grid, this, _("Source"));
45                 } else {
46                         add_label_to_sizer (grid, this, wxString::Format (_("Source %d"), i + 1));
47                 }
48                 
49                 for (int j = 0; j < MAX_AUDIO_CHANNELS; ++j) {
50                         wxRadioButton* b = new wxRadioButton (this, wxID_ANY, wxT (""), wxDefaultPosition, wxDefaultSize, j ? 0 : wxRB_GROUP);
51                         _buttons[i].push_back (b);
52                         grid->Add (b, wxSHRINK);
53                 }
54         }
55
56         wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL);
57         overall_sizer->Add (grid, 1, wxEXPAND | wxALL, 6);
58
59         wxSizer* buttons = CreateSeparatedButtonSizer (wxOK);
60         if (buttons) {
61                 overall_sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder());
62         }
63
64         SetSizer (overall_sizer);
65         overall_sizer->Layout ();
66         overall_sizer->SetSizeHints (this);
67 }