+ shared_ptr<DCPSubtitleContent> dc = dynamic_pointer_cast<DCPSubtitleContent> (c.front ());
+ if (dc) {
+ decoder.reset (new DCPSubtitleDecoder (dc));
+ }
+
+ if (decoder) {
+ _subtitle_view = new SubtitleView (this, _parent->film(), decoder, c.front()->position ());
+ _subtitle_view->Show ();
+ }
+}
+
+void
+SubtitlePanel::fonts_dialog_clicked ()
+{
+ if (_fonts_dialog) {
+ _fonts_dialog->Destroy ();
+ _fonts_dialog = 0;
+ }
+
+ ContentList c = _parent->selected_subtitle ();
+ DCPOMATIC_ASSERT (c.size() == 1);
+
+ _fonts_dialog = new FontsDialog (this, c.front ());
+ _fonts_dialog->Show ();
+}
+
+void
+SubtitlePanel::reference_clicked ()
+{
+ ContentList c = _parent->selected ();
+ if (c.size() != 1) {
+ return;
+ }
+
+ shared_ptr<DCPContent> d = dynamic_pointer_cast<DCPContent> (c.front ());
+ if (!d) {
+ return;
+ }
+
+ d->set_reference_subtitle (_reference->GetValue ());
+}
+
+void
+SubtitlePanel::appearance_dialog_clicked ()
+{
+ ContentList c = _parent->selected_subtitle ();
+ DCPOMATIC_ASSERT (c.size() == 1);
+
+ shared_ptr<TextSubtitleContent> sr = dynamic_pointer_cast<TextSubtitleContent> (c.front ());
+ if (sr) {
+ TextSubtitleAppearanceDialog* d = new TextSubtitleAppearanceDialog (this, sr);
+ if (d->ShowModal () == wxID_OK) {
+ d->apply ();
+ }
+ d->Destroy ();
+ } else {
+ shared_ptr<FFmpegContent> fc = dynamic_pointer_cast<FFmpegContent> (c.front ());
+ DCPOMATIC_ASSERT (fc);
+ ImageSubtitleColourDialog* d = new ImageSubtitleColourDialog (this, fc, fc->subtitle_stream ());
+ if (d->ShowModal() == wxID_OK) {
+ d->apply ();
+ }
+ d->Destroy ();
+ }