summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2014-07-16 17:01:46 +0100
committerCarl Hetherington <cth@carlh.net>2014-07-16 17:01:46 +0100
commitc37e655cd083a83c69215a1d3fa85db06a490102 (patch)
treeb4b6e1d42ad139bc671e4c842057ecc050eed5b5 /src
parent4861afbaab9c3710152d80f15c7a239c26deb74b (diff)
Add default scaling setting to preferences (#384).
Diffstat (limited to 'src')
-rw-r--r--src/lib/config.cc9
-rw-r--r--src/lib/config.h10
-rw-r--r--src/lib/video_content.cc6
-rw-r--r--src/wx/config_dialog.cc16
4 files changed, 38 insertions, 3 deletions
diff --git a/src/lib/config.cc b/src/lib/config.cc
index 24f9242ec..0588f01da 100644
--- a/src/lib/config.cc
+++ b/src/lib/config.cc
@@ -63,6 +63,7 @@ Config::Config ()
, _sound_processor (SoundProcessor::from_id (N_("dolby_cp750")))
, _allow_any_dcp_frame_rate (false)
, _default_still_length (10)
+ , _default_scale (Ratio::from_id ("185"))
, _default_container (Ratio::from_id ("185"))
, _default_dcp_content_type (DCPContentType::from_isdcf_name ("TST"))
, _default_j2k_bandwidth (100000000)
@@ -133,6 +134,11 @@ Config::read ()
_language = f.optional_string_child ("Language");
+ c = f.optional_string_child ("DefaultScale");
+ if (c) {
+ _default_scale = Ratio::from_id (c.get ());
+ }
+
c = f.optional_string_child ("DefaultContainer");
if (c) {
_default_container = Ratio::from_id (c.get ());
@@ -341,6 +347,9 @@ Config::write () const
if (_language) {
root->add_child("Language")->add_child_text (_language.get());
}
+ if (_default_scale) {
+ root->add_child("DefaultScale")->add_child_text (_default_scale->id ());
+ }
if (_default_container) {
root->add_child("DefaultContainer")->add_child_text (_default_container->id ());
}
diff --git a/src/lib/config.h b/src/lib/config.h
index 85e419a0a..44936172c 100644
--- a/src/lib/config.h
+++ b/src/lib/config.h
@@ -133,6 +133,10 @@ public:
return _default_still_length;
}
+ Ratio const * default_scale () const {
+ return _default_scale;
+ }
+
Ratio const * default_container () const {
return _default_container;
}
@@ -282,6 +286,11 @@ public:
changed ();
}
+ void set_default_scale (Ratio const * s) {
+ _default_scale = s;
+ changed ();
+ }
+
void set_default_container (Ratio const * c) {
_default_container = c;
changed ();
@@ -413,6 +422,7 @@ private:
ISDCFMetadata _default_isdcf_metadata;
boost::optional<std::string> _language;
int _default_still_length;
+ Ratio const * _default_scale;
Ratio const * _default_container;
DCPContentType const * _default_dcp_content_type;
libdcp::XMLMetadata _dcp_metadata;
diff --git a/src/lib/video_content.cc b/src/lib/video_content.cc
index 02cc1f810..15e1ca791 100644
--- a/src/lib/video_content.cc
+++ b/src/lib/video_content.cc
@@ -61,7 +61,7 @@ VideoContent::VideoContent (shared_ptr<const Film> f)
, _original_video_frame_rate (0)
, _video_frame_rate (0)
, _video_frame_type (VIDEO_FRAME_TYPE_2D)
- , _scale (Ratio::from_id ("185"))
+ , _scale (Config::instance()->default_scale ())
{
setup_default_colour_conversion ();
}
@@ -72,7 +72,7 @@ VideoContent::VideoContent (shared_ptr<const Film> f, Time s, VideoContent::Fram
, _original_video_frame_rate (0)
, _video_frame_rate (0)
, _video_frame_type (VIDEO_FRAME_TYPE_2D)
- , _scale (Ratio::from_id ("185"))
+ , _scale (Config::instance()->default_scale ())
{
setup_default_colour_conversion ();
}
@@ -83,7 +83,7 @@ VideoContent::VideoContent (shared_ptr<const Film> f, boost::filesystem::path p)
, _original_video_frame_rate (0)
, _video_frame_rate (0)
, _video_frame_type (VIDEO_FRAME_TYPE_2D)
- , _scale (Ratio::from_id ("185"))
+ , _scale (Config::instance()->default_scale ())
{
setup_default_colour_conversion ();
}
diff --git a/src/wx/config_dialog.cc b/src/wx/config_dialog.cc
index 5d1b32038..00f6a2668 100644
--- a/src/wx/config_dialog.cc
+++ b/src/wx/config_dialog.cc
@@ -266,6 +266,10 @@ public:
add_label_to_sizer (table, panel, _("Default ISDCF name details"), true);
_isdcf_metadata_button = new wxButton (panel, wxID_ANY, _("Edit..."));
table->Add (_isdcf_metadata_button);
+
+ add_label_to_sizer (table, panel, _("Default scale to"), true);
+ _scale = new wxChoice (panel, wxID_ANY);
+ table->Add (_scale);
add_label_to_sizer (table, panel, _("Default container"), true);
_container = new wxChoice (panel, wxID_ANY);
@@ -315,6 +319,10 @@ public:
vector<Ratio const *> ratio = Ratio::all ();
int n = 0;
for (vector<Ratio const *>::iterator i = ratio.begin(); i != ratio.end(); ++i) {
+ _scale->Append (std_to_wx ((*i)->nickname ()));
+ if (*i == config->default_scale ()) {
+ _scale->SetSelection (n);
+ }
_container->Append (std_to_wx ((*i)->nickname ()));
if (*i == config->default_container ()) {
_container->SetSelection (n);
@@ -322,6 +330,7 @@ public:
++n;
}
+ _scale->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&DefaultsPage::scale_changed, this));
_container->Bind (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&DefaultsPage::container_changed, this));
vector<DCPContentType const *> const ct = DCPContentType::all ();
@@ -380,6 +389,12 @@ private:
{
Config::instance()->set_default_still_length (_still_length->GetValue ());
}
+
+ void scale_changed ()
+ {
+ vector<Ratio const *> ratio = Ratio::all ();
+ Config::instance()->set_default_scale (ratio[_scale->GetSelection()]);
+ }
void container_changed ()
{
@@ -416,6 +431,7 @@ private:
#else
wxDirPickerCtrl* _directory;
#endif
+ wxChoice* _scale;
wxChoice* _container;
wxChoice* _dcp_content_type;
wxTextCtrl* _issuer;