+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);
+
+ bool text = false;
+ bool image = false;
+
+ if (
+ dynamic_pointer_cast<TextSubtitleContent> (c.front()) ||
+ dynamic_pointer_cast<DCPContent> (c.front()) ||
+ dynamic_pointer_cast<DCPSubtitleContent> (c.front())) {
+
+ text = true;
+ }
+
+ shared_ptr<FFmpegContent> fc = dynamic_pointer_cast<FFmpegContent> (c.front());
+ if (fc) {
+ if (fc->subtitle_stream()->has_text()) {
+ text = true;
+ } else if (fc->subtitle_stream()->has_image()) {
+ image = true;
+ }
+ }
+
+ if (text) {
+ TextSubtitleAppearanceDialog* d = new TextSubtitleAppearanceDialog (this, c.front()->subtitle);
+ if (d->ShowModal () == wxID_OK) {
+ d->apply ();
+ }
+ d->Destroy ();
+ } else if (image) {
+ DCPOMATIC_ASSERT (fc);
+ ImageSubtitleColourDialog* d = new ImageSubtitleColourDialog (this, fc, fc->subtitle_stream ());
+ if (d->ShowModal() == wxID_OK) {
+ d->apply ();
+ }
+ d->Destroy ();
+ }