2 Copyright (C) 2015 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/>.
21 #include "content_properties_dialog.h"
23 #include "lib/raw_convert.h"
24 #include "lib/content.h"
25 #include "lib/video_content.h"
26 #include "lib/audio_content.h"
27 #include <boost/algorithm/string.hpp>
28 #include <boost/foreach.hpp>
34 using boost::shared_ptr;
35 using boost::dynamic_pointer_cast;
37 ContentPropertiesDialog::ContentPropertiesDialog (wxWindow* parent, shared_ptr<Content> content)
38 : TableDialog (parent, _("Content Properties"), 2, 1, false)
40 map<string, list<UserProperty> > grouped;
41 BOOST_FOREACH (UserProperty i, content->user_properties()) {
42 if (grouped.find(i.category) == grouped.end()) {
43 grouped[i.category] = list<UserProperty> ();
45 grouped[i.category].push_back (i);
48 maybe_add_group (grouped, wx_to_std (_("General")));
49 maybe_add_group (grouped, wx_to_std (_("Video")));
50 maybe_add_group (grouped, wx_to_std (_("Audio")));
51 maybe_add_group (grouped, wx_to_std (_("Length")));
57 ContentPropertiesDialog::maybe_add_group (map<string, list<UserProperty> > const & groups, string name)
59 map<string, list<UserProperty> >::const_iterator i = groups.find (name);
60 if (i == groups.end()) {
64 wxStaticText* m = new wxStaticText (this, wxID_ANY, std_to_wx (i->first));
65 wxFont font (*wxNORMAL_FONT);
66 font.SetWeight (wxFONTWEIGHT_BOLD);
74 BOOST_FOREACH (UserProperty j, i->second) {
75 add (std_to_wx (j.key), true);
76 add (new wxStaticText (this, wxID_ANY, std_to_wx (j.value + " " + j.unit)));