Un-attached reel UI.
authorCarl Hetherington <cth@carlh.net>
Thu, 17 Sep 2015 14:22:57 +0000 (15:22 +0100)
committerCarl Hetherington <cth@carlh.net>
Mon, 12 Oct 2015 10:05:26 +0000 (11:05 +0100)
src/lib/film.cc
src/lib/film.h
src/lib/types.h
src/wx/dcp_panel.cc
src/wx/dcp_panel.h

index 77e1be872b3b981b3391665d224454e1f9226efe..c0060b0400d9b4676bd86b783ef141b32e30e6b6 100644 (file)
@@ -126,6 +126,8 @@ Film::Film (boost::filesystem::path dir, bool log)
        , _sequence_video (true)
        , _interop (Config::instance()->default_interop ())
        , _audio_processor (0)
+       , _reel_type (REELTYPE_SINGLE)
+       , _reel_length (2000000000)
        , _state_version (current_state_version)
        , _dirty (false)
 {
@@ -344,6 +346,8 @@ Film::metadata () const
        if (_audio_processor) {
                root->add_child("AudioProcessor")->add_child_text (_audio_processor->id ());
        }
+       root->add_child("ReelType")->add_child_text (raw_convert<string> (_reel_type));
+       root->add_child("ReelLength")->add_child_text (raw_convert<string> (_reel_length));
        _playlist->as_xml (root->add_child ("Playlist"));
 
        return doc;
@@ -427,6 +431,9 @@ Film::read_metadata ()
                _audio_processor = 0;
        }
 
+       _reel_type = static_cast<ReelType> (f.optional_number_child<int>("ReelType").get_value_or (static_cast<int>(REELTYPE_SINGLE)));
+       _reel_length = f.optional_number_child<int64_t>("ReelLength").get_value_or (2000000000);
+
        list<string> notes;
        /* This method is the only one that can return notes (so far) */
        _playlist->set_from_xml (shared_from_this(), f.node_child ("Playlist"), _state_version, notes);
@@ -816,6 +823,20 @@ Film::set_audio_processor (AudioProcessor const * processor)
        signal_changed (AUDIO_CHANNELS);
 }
 
+void
+Film::set_reel_type (ReelType t)
+{
+       _reel_type = t;
+       signal_changed (REEL_TYPE);
+}
+
+void
+Film::set_reel_length (int64_t r)
+{
+       _reel_length = r;
+       signal_changed (REEL_LENGTH);
+}
+
 void
 Film::signal_changed (Property p)
 {
index 937ab99e8355a4394102f5bd23b4cd881302a701..76068136a47ce2d45c027182a4d39cb657361761 100644 (file)
@@ -177,6 +177,8 @@ public:
                SEQUENCE_VIDEO,
                INTEROP,
                AUDIO_PROCESSOR,
+               REEL_TYPE,
+               REEL_LENGTH
        };
 
 
@@ -252,6 +254,13 @@ public:
                return _audio_processor;
        }
 
+       ReelType reel_type () const {
+               return _reel_type;
+       }
+
+       int64_t reel_length () const {
+               return _reel_length;
+       }
 
        /* SET */
 
@@ -280,6 +289,8 @@ public:
        void set_sequence_video (bool);
        void set_interop (bool);
        void set_audio_processor (AudioProcessor const * processor);
+       void set_reel_type (ReelType);
+       void set_reel_length (int64_t);
 
        /** Emitted when some property has of the Film has changed */
        mutable boost::signals2::signal<void (Property)> Changed;
@@ -340,6 +351,8 @@ private:
        bool _sequence_video;
        bool _interop;
        AudioProcessor const * _audio_processor;
+       ReelType _reel_type;
+       int64_t _reel_length;
 
        int _state_version;
 
index d0f4ec1f8955d20421aecabda5a1b720849be6eb..5486f8612279c5a310be54ad2b85020f3d588008 100644 (file)
@@ -84,6 +84,13 @@ enum Part
        PART_WHOLE
 };
 
+enum ReelType
+{
+       REELTYPE_SINGLE,
+       REELTYPE_ONE_PER_VIDEO,
+       REELTYPE_BY_LENGTH
+};
+
 /** @struct Crop
  *  @brief A description of the crop of an image or video.
  */
index 65bf908a799448be8f9521c46a7c4c7d75f56c9f..463b11c169b1585d1900633202806a9855edd61b 100644 (file)
@@ -132,26 +132,50 @@ DCPPanel::DCPPanel (wxNotebook* n, boost::shared_ptr<Film> film)
                ++r;
        }
 
+       add_label_to_grid_bag_sizer (grid, _panel, _("Reels"), true, wxGBPosition (r, 0));
+       _reel_type = new wxChoice (_panel, wxID_ANY);
+       grid->Add (_reel_type, wxGBPosition (r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
+       ++r;
+
+       add_label_to_grid_bag_sizer (grid, _panel, _("Reel length"), true, wxGBPosition (r, 0));
+
+       {
+               wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
+               _reel_length = new wxSpinCtrl (_panel, wxID_ANY);
+               s->Add (_reel_length);
+               add_label_to_sizer (s, _panel, _("GB"), false);
+               grid->Add (s, wxGBPosition (r, 1));
+               ++r;
+       }
+
        add_label_to_grid_bag_sizer (grid, _panel, _("Standard"), true, wxGBPosition (r, 0));
        _standard = new wxChoice (_panel, wxID_ANY);
        grid->Add (_standard, wxGBPosition (r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
        ++r;
 
-       _name->Bind              (wxEVT_COMMAND_TEXT_UPDATED,         boost::bind (&DCPPanel::name_changed, this));
-       _use_isdcf_name->Bind    (wxEVT_COMMAND_CHECKBOX_CLICKED,     boost::bind (&DCPPanel::use_isdcf_name_toggled, this));
-       _edit_isdcf_button->Bind (wxEVT_COMMAND_BUTTON_CLICKED,       boost::bind (&DCPPanel::edit_isdcf_button_clicked, this));
-       _copy_isdcf_name_button->Bind(wxEVT_COMMAND_BUTTON_CLICKED,   boost::bind (&DCPPanel::copy_isdcf_name_button_clicked, this));
-       _dcp_content_type->Bind  (wxEVT_COMMAND_CHOICE_SELECTED,      boost::bind (&DCPPanel::dcp_content_type_changed, this));
-       _signed->Bind            (wxEVT_COMMAND_CHECKBOX_CLICKED,     boost::bind (&DCPPanel::signed_toggled, this));
-       _encrypted->Bind         (wxEVT_COMMAND_CHECKBOX_CLICKED,     boost::bind (&DCPPanel::encrypted_toggled, this));
-       _edit_key->Bind          (wxEVT_COMMAND_BUTTON_CLICKED,       boost::bind (&DCPPanel::edit_key_clicked, this));
-       _standard->Bind          (wxEVT_COMMAND_CHOICE_SELECTED,      boost::bind (&DCPPanel::standard_changed, this));
+       _name->Bind              (wxEVT_COMMAND_TEXT_UPDATED,       boost::bind (&DCPPanel::name_changed, this));
+       _use_isdcf_name->Bind    (wxEVT_COMMAND_CHECKBOX_CLICKED,   boost::bind (&DCPPanel::use_isdcf_name_toggled, this));
+       _edit_isdcf_button->Bind (wxEVT_COMMAND_BUTTON_CLICKED,     boost::bind (&DCPPanel::edit_isdcf_button_clicked, this));
+       _copy_isdcf_name_button->Bind(wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&DCPPanel::copy_isdcf_name_button_clicked, this));
+       _dcp_content_type->Bind  (wxEVT_COMMAND_CHOICE_SELECTED,    boost::bind (&DCPPanel::dcp_content_type_changed, this));
+       _signed->Bind            (wxEVT_COMMAND_CHECKBOX_CLICKED,   boost::bind (&DCPPanel::signed_toggled, this));
+       _encrypted->Bind         (wxEVT_COMMAND_CHECKBOX_CLICKED,   boost::bind (&DCPPanel::encrypted_toggled, this));
+       _edit_key->Bind          (wxEVT_COMMAND_BUTTON_CLICKED,     boost::bind (&DCPPanel::edit_key_clicked, this));
+       _reel_type->Bind         (wxEVT_COMMAND_CHOICE_SELECTED,    boost::bind (&DCPPanel::reel_type_changed, this));
+       _reel_length->Bind       (wxEVT_COMMAND_SPINCTRL_UPDATED,   boost::bind (&DCPPanel::reel_length_changed, this));
+       _standard->Bind          (wxEVT_COMMAND_CHOICE_SELECTED,    boost::bind (&DCPPanel::standard_changed, this));
 
        vector<DCPContentType const *> const ct = DCPContentType::all ();
        for (vector<DCPContentType const *>::const_iterator i = ct.begin(); i != ct.end(); ++i) {
                _dcp_content_type->Append (std_to_wx ((*i)->pretty_name ()));
        }
 
+       _reel_type->Append (_("Single reel"));
+       _reel_type->Append (_("One per video content"));
+       _reel_type->Append (_("Custom"));
+
+       _reel_length->SetRange (1, 64);
+
        _standard->Append (_("SMPTE"));
        _standard->Append (_("Interop"));
 
@@ -363,6 +387,13 @@ DCPPanel::film_changed (int p)
                setup_audio_channels_choice ();
                film_changed (Film::AUDIO_CHANNELS);
                break;
+       case Film::REEL_TYPE:
+               checked_set (_reel_type, _film->reel_type ());
+               _reel_length->Enable (_film->reel_type() == REELTYPE_BY_LENGTH);
+               break;
+       case Film::REEL_LENGTH:
+               checked_set (_reel_length, _film->reel_length() / 1000000000LL);
+               break;
        default:
                break;
        }
@@ -457,6 +488,8 @@ DCPPanel::set_film (shared_ptr<Film> film)
        film_changed (Film::THREE_D);
        film_changed (Film::INTEROP);
        film_changed (Film::AUDIO_PROCESSOR);
+       film_changed (Film::REEL_TYPE);
+       film_changed (Film::REEL_LENGTH);
 }
 
 void
@@ -477,6 +510,8 @@ DCPPanel::set_general_sensitivity (bool s)
        _encrypted->Enable (s);
        _key->Enable (s && _film && _film->encrypted ());
        _edit_key->Enable (s && _film && _film->encrypted ());
+       _reel_type->Enable (s);
+       _reel_length->Enable (s);
        _frame_rate_choice->Enable (s);
        _frame_rate_spin->Enable (s);
        _audio_channels->Enable (s);
@@ -739,3 +774,23 @@ DCPPanel::show_audio_clicked ()
        AudioDialog* d = new AudioDialog (_panel, _film);
        d->Show ();
 }
+
+void
+DCPPanel::reel_type_changed ()
+{
+       if (!_film) {
+               return;
+       }
+
+       _film->set_reel_type (static_cast<ReelType> (_reel_type->GetSelection ()));
+}
+
+void
+DCPPanel::reel_length_changed ()
+{
+       if (!_film) {
+               return;
+       }
+
+       _film->set_reel_length (_reel_length->GetValue() * 1000000000LL);
+}
index a81af4f454d77fa366540d5eaebbfae5d084d90e..da93e752a473abb1ef6c91d17d9b1cc23e9333fe 100644 (file)
@@ -71,6 +71,8 @@ private:
        void edit_key_clicked ();
        void audio_processor_changed ();
        void show_audio_clicked ();
+       void reel_type_changed ();
+       void reel_length_changed ();
 
        void setup_frame_rate_widget ();
        void setup_container ();
@@ -112,6 +114,8 @@ private:
        wxCheckBox* _encrypted;
        wxStaticText* _key;
        wxButton* _edit_key;
+       wxChoice* _reel_type;
+       wxSpinCtrl* _reel_length;
 
        AudioDialog* _audio_dialog;