Case fix to match tool name.
[dcpomatic.git] / src / wx / subtitle_panel.cc
index 31ee2c4777686f9a172c6d676516824510595716..933fcc6c171cba639432204926d4c6dcff3114cb 100644 (file)
@@ -245,6 +245,7 @@ SubtitlePanel::setup_sensitivity ()
                shared_ptr<const DCPSubtitleContent> dsc = boost::dynamic_pointer_cast<const DCPSubtitleContent> (i);
                if (fc) {
                        if (fc->subtitle) {
+                               DCPOMATIC_ASSERT (fc->subtitle_stream());
                                /* This content has some subtitles; check the selected stream to decide what type */
                                if (fc->subtitle_stream()->has_text()) {
                                        ++text_subs;
@@ -385,8 +386,7 @@ SubtitlePanel::subtitle_view_clicked ()
        ContentList c = _parent->selected_subtitle ();
        DCPOMATIC_ASSERT (c.size() == 1);
 
-       list<shared_ptr<ImageDecoder> > image_decoders;
-       shared_ptr<Decoder> decoder = decoder_factory (c.front(), image_decoders, _parent->film()->log(), false);
+       shared_ptr<Decoder> decoder = decoder_factory (c.front(), _parent->film()->log());
 
        if (decoder) {
                _subtitle_view = new SubtitleView (this, _parent->film(), decoder, c.front()->position ());
@@ -431,15 +431,33 @@ 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);
+       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 {
-               shared_ptr<FFmpegContent> fc = dynamic_pointer_cast<FFmpegContent> (c.front ());
+       } else if (image) {
                DCPOMATIC_ASSERT (fc);
                ImageSubtitleColourDialog* d = new ImageSubtitleColourDialog (this, fc, fc->subtitle_stream ());
                if (d->ShowModal() == wxID_OK) {