Basics of multiple captions per content so that DCPContent can
[dcpomatic.git] / src / wx / dcp_panel.cc
index 91ffe365f3b674004078b03f09d44ab14921ce52..51881030fca2e550905d73eaf696f530b81cb72b 100644 (file)
@@ -23,6 +23,7 @@
 #include "key_dialog.h"
 #include "isdcf_metadata_dialog.h"
 #include "audio_dialog.h"
+#include "focus_manager.h"
 #include "lib/ratio.h"
 #include "lib/config.h"
 #include "lib/dcp_content_type.h"
@@ -31,7 +32,7 @@
 #include "lib/ffmpeg_content.h"
 #include "lib/audio_processor.h"
 #include "lib/video_content.h"
-#include "lib/subtitle_content.h"
+#include "lib/caption_content.h"
 #include "lib/dcp_content.h"
 #include "lib/audio_content.h"
 #include <dcp/locale_convert.h>
@@ -74,6 +75,8 @@ DCPPanel::DCPPanel (wxNotebook* n, boost::shared_ptr<Film> film)
        grid->Add (_name, wxGBPosition(r, 1), wxDefaultSpan, wxEXPAND | wxLEFT | wxRIGHT);
        ++r;
 
+       FocusManager::instance()->add(_name);
+
        int flags = wxALIGN_CENTER_VERTICAL;
 #ifdef __WXOSX__
        flags |= wxALIGN_RIGHT;
@@ -380,6 +383,7 @@ DCPPanel::film_changed (int p)
                checked_set (_frame_rate_spin, _film->video_frame_rate ());
 
                _best_frame_rate->Enable (_film->best_video_frame_rate () != _film->video_frame_rate ());
+               setup_dcp_name ();
                break;
        }
        case Film::AUDIO_CHANNELS:
@@ -429,13 +433,14 @@ void
 DCPPanel::film_content_changed (int property)
 {
        if (property == AudioContentProperty::STREAMS ||
-           property == SubtitleContentProperty::USE ||
-           property == SubtitleContentProperty::BURN ||
+           property == CaptionContentProperty::USE ||
+           property == CaptionContentProperty::BURN ||
            property == VideoContentProperty::SCALE ||
            property == DCPContentProperty::REFERENCE_VIDEO ||
            property == DCPContentProperty::REFERENCE_AUDIO ||
-           property == DCPContentProperty::REFERENCE_SUBTITLE) {
+           property == DCPContentProperty::REFERENCE_CAPTION) {
                setup_dcp_name ();
+               setup_sensitivity ();
        }
 }
 
@@ -524,39 +529,48 @@ DCPPanel::set_film (shared_ptr<Film> film)
        film_changed (Film::REEL_TYPE);
        film_changed (Film::REEL_LENGTH);
        film_changed (Film::UPLOAD_AFTER_MAKE_DCP);
+
+       set_general_sensitivity(static_cast<bool>(_film));
 }
 
 void
 DCPPanel::set_general_sensitivity (bool s)
 {
-       _name->Enable (s);
-       _use_isdcf_name->Enable (s);
-       _edit_isdcf_button->Enable (s);
-       _dcp_content_type->Enable (s);
-       _copy_isdcf_name_button->Enable (s);
+       _generally_sensitive = s;
+       setup_sensitivity ();
+}
+
+void
+DCPPanel::setup_sensitivity ()
+{
+       _name->Enable                   (_generally_sensitive);
+       _use_isdcf_name->Enable         (_generally_sensitive);
+       _edit_isdcf_button->Enable      (_generally_sensitive);
+       _dcp_content_type->Enable       (_generally_sensitive);
+       _copy_isdcf_name_button->Enable (_generally_sensitive);
 
-       bool si = s;
+       bool si = _generally_sensitive;
        if (_film && _film->encrypted ()) {
                si = false;
        }
        _signed->Enable (si);
 
-       _encrypted->Enable (s);
-       _key->Enable (s && _film && _film->encrypted ());
-       _edit_key->Enable (s && _film && _film->encrypted ());
-       _reel_type->Enable (s);
-       _reel_length->Enable (s && _film && _film->reel_type() == REELTYPE_BY_LENGTH);
-       _upload_after_make_dcp->Enable (s);
-       _frame_rate_choice->Enable (s);
-       _frame_rate_spin->Enable (s);
-       _audio_channels->Enable (s);
-       _audio_processor->Enable (s);
-       _j2k_bandwidth->Enable (s);
-       _container->Enable (s);
-       _best_frame_rate->Enable (s && _film && _film->best_video_frame_rate () != _film->video_frame_rate ());
-       _resolution->Enable (s);
-       _three_d->Enable (s);
-       _standard->Enable (s);
+       _encrypted->Enable              (_generally_sensitive);
+       _key->Enable                    (_generally_sensitive && _film && _film->encrypted ());
+       _edit_key->Enable               (_generally_sensitive && _film && _film->encrypted ());
+       _reel_type->Enable              (_generally_sensitive && _film && !_film->references_dcp_video() && !_film->references_dcp_audio());
+       _reel_length->Enable            (_generally_sensitive && _film && _film->reel_type() == REELTYPE_BY_LENGTH);
+       _upload_after_make_dcp->Enable  (_generally_sensitive);
+       _frame_rate_choice->Enable      (_generally_sensitive && _film && !_film->references_dcp_video());
+       _frame_rate_spin->Enable        (_generally_sensitive && _film && !_film->references_dcp_video());
+       _audio_channels->Enable         (_generally_sensitive && _film && !_film->references_dcp_audio());
+       _audio_processor->Enable        (_generally_sensitive && _film && !_film->references_dcp_audio());
+       _j2k_bandwidth->Enable          (_generally_sensitive && _film && !_film->references_dcp_video());
+       _container->Enable              (_generally_sensitive && _film && !_film->references_dcp_video());
+       _best_frame_rate->Enable        (_generally_sensitive && _film && _film->best_video_frame_rate () != _film->video_frame_rate ());
+       _resolution->Enable             (_generally_sensitive && _film && !_film->references_dcp_video());
+       _three_d->Enable                (_generally_sensitive && _film && !_film->references_dcp_video());
+       _standard->Enable               (_generally_sensitive && _film && !_film->references_dcp_video() && !_film->references_dcp_audio());
 }
 
 void
@@ -692,7 +706,7 @@ DCPPanel::make_video_panel ()
        _j2k_bandwidth->Bind    (wxEVT_SPINCTRL,      boost::bind (&DCPPanel::j2k_bandwidth_changed, this));
        /* Also listen to wxEVT_TEXT so that typing numbers directly in is always noticed */
        _j2k_bandwidth->Bind    (wxEVT_TEXT,          boost::bind (&DCPPanel::j2k_bandwidth_changed, this));
-       _resolution->Bind       (wxEVT_CHOICE,       boost::bind (&DCPPanel::resolution_changed, this));
+       _resolution->Bind       (wxEVT_CHOICE,        boost::bind (&DCPPanel::resolution_changed, this));
        _three_d->Bind          (wxEVT_CHECKBOX,      boost::bind (&DCPPanel::three_d_changed, this));
 
        BOOST_FOREACH (Ratio const * i, Ratio::containers()) {