Merge remote-tracking branch 'origin/master' into 1.0
authorCarl Hetherington <cth@carlh.net>
Wed, 16 Jul 2014 16:02:25 +0000 (17:02 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 16 Jul 2014 16:02:25 +0000 (17:02 +0100)
ChangeLog
src/lib/config.cc
src/lib/config.h
src/lib/video_content.cc
src/wx/config_dialog.cc

index 5265423fc06ef30e6e858a922562412046982c30..a15a44fe2b47595196af0f9a5b1db90a7bc7c49a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -14,6 +14,8 @@
 
 2014-07-16  Carl Hetherington  <cth@carlh.net>
 
+       * Add default scaling setting to preferences (#384).
+
        * Version 1.72.3 released.
 
 2014-07-16  Carl Hetherington  <cth@carlh.net>
index 71431ec0db63e18b172b7693bfc95398f128091d..f2f25efe90af3930b817c88f9f2291fbe40921db 100644 (file)
@@ -63,6 +63,7 @@ Config::Config ()
        , _cinema_sound_processor (CinemaSoundProcessor::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)
@@ -136,6 +137,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 ());
@@ -280,6 +286,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 ());
        }
index 66ff662142133b6e4258b49c745b93759430252f..03dd9c0feb68ac050bd9f0efa5e59b3b295e3974 100644 (file)
@@ -132,6 +132,10 @@ public:
                return _default_still_length;
        }
 
+       Ratio const * default_scale () const {
+               return _default_scale;
+       }
+
        Ratio const * default_container () const {
                return _default_container;
        }
@@ -281,6 +285,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 ();
@@ -411,6 +420,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;
        dcp::XMLMetadata _dcp_metadata;
index a2a4e6c6b3b46c452290975d5eccb2952fbaab89..a8590ce55b4a70f23c3d6ec7519e59f3f9ee5219 100644 (file)
@@ -63,7 +63,7 @@ VideoContent::VideoContent (shared_ptr<const Film> f)
        , _video_length (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 ();
 }
@@ -73,7 +73,7 @@ VideoContent::VideoContent (shared_ptr<const Film> f, DCPTime s, ContentTime len
        , _video_length (len)
        , _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)
        , _video_length (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 ();
 }
index 360e805725b753f20b42ee8f3cd339bab39b9066..306e1f208ca7874ae883d4a24e3dce9af11548e5 100644 (file)
@@ -267,6 +267,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);
@@ -316,6 +320,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);
@@ -323,6 +331,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 ();
@@ -381,6 +390,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 ()
        {
@@ -417,6 +432,7 @@ private:
 #else
        wxDirPickerCtrl* _directory;
 #endif
+       wxChoice* _scale;
        wxChoice* _container;
        wxChoice* _dcp_content_type;
        wxTextCtrl* _issuer;