+ DCPRangeDialog* d = new DCPRangeDialog (this, _film);
+ d->Changed.connect (bind (&FilmEditor::dcp_range_changed, this, _1, _2));
+ d->ShowModal ();
+}
+
+void
+FilmEditor::dcp_range_changed (int start, int end)
+{
+ _film->set_dcp_trim_start (start);
+ _film->set_dcp_trim_end (end);
+}
+
+void
+FilmEditor::audio_gain_calculate_button_clicked (wxCommandEvent &)
+{
+ GainCalculatorDialog* d = new GainCalculatorDialog (this);
+ d->ShowModal ();
+
+ if (d->wanted_fader() == 0 || d->actual_fader() == 0) {
+ d->Destroy ();
+ return;
+ }
+
+ _audio_gain->SetValue (
+ Config::instance()->sound_processor()->db_for_fader_change (
+ d->wanted_fader (),
+ d->actual_fader ()
+ )
+ );
+
+ /* This appears to be necessary, as the change is not signalled,
+ I think.
+ */
+ wxCommandEvent dummy;
+ audio_gain_changed (dummy);
+
+ d->Destroy ();
+}
+
+void
+FilmEditor::setup_formats ()
+{
+ ContentType c = VIDEO;
+
+ if (_film) {
+ c = _film->content_type ();
+ }
+
+ _formats.clear ();
+
+ vector<Format const *> fmt = Format::all ();
+ for (vector<Format const *>::iterator i = fmt.begin(); i != fmt.end(); ++i) {
+ if (c == VIDEO && dynamic_cast<FixedFormat const *> (*i)) {
+ _formats.push_back (*i);
+ } else if (c == STILL && dynamic_cast<VariableFormat const *> (*i)) {
+ _formats.push_back (*i);
+ }
+ }
+
+ _format->Clear ();
+ for (vector<Format const *>::iterator i = _formats.begin(); i != _formats.end(); ++i) {
+ _format->Append (std_to_wx ((*i)->name ()));
+ }
+
+ _sizer->Layout ();
+}
+
+void
+FilmEditor::with_subtitles_toggled (wxCommandEvent &)
+{
+ if (!_film) {
+ return;
+ }
+
+ _ignore_changes = Film::WITH_SUBTITLES;
+ _film->set_with_subtitles (_with_subtitles->GetValue ());
+ _ignore_changes = Film::NONE;
+
+ _subtitle_scale->Enable (_film->with_subtitles ());
+ _subtitle_offset->Enable (_film->with_subtitles ());
+}
+
+void
+FilmEditor::setup_subtitle_button ()
+{
+ _with_subtitles->Enable (_film->has_subtitles ());
+ if (!_film->has_subtitles ()) {
+ _with_subtitles->SetValue (false);
+ }
+}
+
+void
+FilmEditor::use_dci_name_toggled (wxCommandEvent &)
+{
+ if (!_film) {
+ return;
+ }
+
+ _ignore_changes = Film::USE_DCI_NAME;
+ _film->set_use_dci_name (_use_dci_name->GetValue ());
+ _ignore_changes = Film::NONE;
+
+ _dcp_name->SetLabel (std_to_wx (_film->dcp_name ()));
+}
+
+void
+FilmEditor::edit_dci_button_clicked (wxCommandEvent &)
+{
+ if (!_film) {
+ return;
+ }
+
+ DCINameDialog* d = new DCINameDialog (this, _film);
+ d->ShowModal ();
+ d->Destroy ();
+}
+
+void
+FilmEditor::setup_streams ()
+{
+ _audio_stream->Clear ();
+ vector<AudioStream> a = _film->audio_streams ();
+ for (vector<AudioStream>::iterator i = a.begin(); i != a.end(); ++i) {
+ _audio_stream->Append (std_to_wx (i->name()));
+ }
+ _audio_stream->SetSelection (_film->audio_stream_index ());
+
+ _subtitle_stream->Clear ();
+ vector<SubtitleStream> s = _film->subtitle_streams ();
+ for (vector<SubtitleStream>::iterator i = s.begin(); i != s.end(); ++i) {
+ _subtitle_stream->Append (std_to_wx (i->name()));
+ }
+ _subtitle_stream->SetSelection (_film->subtitle_stream_index ());
+}
+
+void
+FilmEditor::audio_stream_changed (wxCommandEvent &)
+{
+ if (!_film) {
+ return;
+ }
+
+ _ignore_changes = Film::AUDIO_STREAM;
+ _film->set_audio_stream (_audio_stream->GetSelection ());
+ _ignore_changes = Film::NONE;
+
+ _dcp_name->SetLabel (std_to_wx (_film->dcp_name ()));
+ setup_audio_details ();
+}
+
+void
+FilmEditor::subtitle_stream_changed (wxCommandEvent &)
+{
+ if (!_film) {
+ return;
+ }
+
+ _ignore_changes = Film::SUBTITLE_STREAM;
+ _film->set_subtitle_stream (_subtitle_stream->GetSelection ());
+ _ignore_changes = Film::NONE;
+}
+
+void
+FilmEditor::setup_audio_details ()
+{
+ if (_film->audio_channels() == 0 && _film->audio_sample_rate() == 0) {
+ _audio->SetLabel (wxT (""));
+ } else {
+ stringstream s;
+ s << _film->audio_channels () << " channels, " << _film->audio_sample_rate() << "Hz";
+ _audio->SetLabel (std_to_wx (s.str ()));
+ }