DCPOMATIC_ASSERT (film);
return film->active_frame_rate_change(position()).source;
}
+
+void
+Content::add_properties (list<UserProperty>& p) const
+{
+ p.push_back (UserProperty (_("General"), _("Filename"), path(0).string ()));
+
+ if (_video_frame_rate) {
+ p.push_back (UserProperty (_("General"), _("Video frame rate"), raw_convert<string> (_video_frame_rate.get(), 5), _("frames per second")));
+ }
+}
/*
- Copyright (C) 2013-2015 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2013-2016 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
using std::string;
using std::cout;
+using std::list;
using boost::shared_ptr;
ImageContent::ImageContent (shared_ptr<const Film> film, boost::filesystem::path p)
video->set_colour_conversion (PresetColourConversion::from_id ("rec709").conversion);
}
}
+
+void
+ImageContent::add_properties (list<UserProperty>& p) const
+{
+ Content::add_properties (p);
+ video->add_properties (p);
+}
ContentPropertiesDialog::ContentPropertiesDialog (wxWindow* parent, shared_ptr<Content> content)
: TableDialog (parent, _("Content Properties"), 2, 1, false)
{
- string n = content->path(0).string();
- boost::algorithm::replace_all (n, "&", "&&");
- add (_("Filename"), true);
- add (new wxStaticText (this, wxID_ANY, std_to_wx (n)));
-
map<string, list<UserProperty> > grouped;
BOOST_FOREACH (UserProperty i, content->user_properties()) {
if (grouped.find(i.category) == grouped.end()) {
grouped[i.category].push_back (i);
}
- for (map<string, list<UserProperty> >::const_iterator i = grouped.begin(); i != grouped.end(); ++i) {
-
- wxStaticText* m = new wxStaticText (this, wxID_ANY, std_to_wx (i->first));
- wxFont font (*wxNORMAL_FONT);
- font.SetWeight (wxFONTWEIGHT_BOLD);
- m->SetFont (font);
+ maybe_add_group (grouped, wx_to_std (_("General")));
+ maybe_add_group (grouped, wx_to_std (_("Video")));
+ maybe_add_group (grouped, wx_to_std (_("Audio")));
+ maybe_add_group (grouped, wx_to_std (_("Length")));
- add_spacer ();
- add_spacer ();
- add (m, false);
- add_spacer ();
+ layout ();
+}
- BOOST_FOREACH (UserProperty j, i->second) {
- add (std_to_wx (j.key), true);
- add (new wxStaticText (this, wxID_ANY, std_to_wx (j.value + " " + j.unit)));
- }
+void
+ContentPropertiesDialog::maybe_add_group (map<string, list<UserProperty> > const & groups, string name)
+{
+ map<string, list<UserProperty> >::const_iterator i = groups.find (name);
+ if (i == groups.end()) {
+ return;
}
- layout ();
+ wxStaticText* m = new wxStaticText (this, wxID_ANY, std_to_wx (i->first));
+ wxFont font (*wxNORMAL_FONT);
+ font.SetWeight (wxFONTWEIGHT_BOLD);
+ m->SetFont (font);
+
+ add_spacer ();
+ add_spacer ();
+ add (m, false);
+ add_spacer ();
+
+ BOOST_FOREACH (UserProperty j, i->second) {
+ add (std_to_wx (j.key), true);
+ add (new wxStaticText (this, wxID_ANY, std_to_wx (j.value + " " + j.unit)));
+ }
}
/*
- Copyright (C) 2015 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2015-2016 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
#include "table_dialog.h"
#include <boost/shared_ptr.hpp>
+#include <list>
+#include <map>
class Content;
+class UserProperty;
class ContentPropertiesDialog : public TableDialog
{
public:
ContentPropertiesDialog (wxWindow* parent, boost::shared_ptr<Content> content);
+
+private:
+ void maybe_add_group (std::map<std::string, std::list<UserProperty> > const & groups, std::string name);
};