diff options
| author | Carl Hetherington <cth@carlh.net> | 2016-05-26 16:38:06 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2016-05-26 16:38:06 +0100 |
| commit | 56287eb5f3c7fe1ddaf69bdf7b941648b132096f (patch) | |
| tree | 9cf7e5c529ec1ba1f1603578faa96a60dd65f375 /src | |
| parent | cd30cdbaf4188425ab0610b088dba81496144ccd (diff) | |
Fix subtitle appearance configuration with FFmpeg-text subs.
Diffstat (limited to 'src')
| -rw-r--r-- | src/wx/subtitle_panel.cc | 28 | ||||
| -rw-r--r-- | src/wx/text_subtitle_appearance_dialog.cc | 14 | ||||
| -rw-r--r-- | src/wx/text_subtitle_appearance_dialog.h | 6 |
3 files changed, 33 insertions, 15 deletions
diff --git a/src/wx/subtitle_panel.cc b/src/wx/subtitle_panel.cc index 31ee2c477..852d754d5 100644 --- a/src/wx/subtitle_panel.cc +++ b/src/wx/subtitle_panel.cc @@ -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) { diff --git a/src/wx/text_subtitle_appearance_dialog.cc b/src/wx/text_subtitle_appearance_dialog.cc index c2dd70c75..30402a63f 100644 --- a/src/wx/text_subtitle_appearance_dialog.cc +++ b/src/wx/text_subtitle_appearance_dialog.cc @@ -26,7 +26,7 @@ using boost::shared_ptr; -TextSubtitleAppearanceDialog::TextSubtitleAppearanceDialog (wxWindow* parent, shared_ptr<TextSubtitleContent> content) +TextSubtitleAppearanceDialog::TextSubtitleAppearanceDialog (wxWindow* parent, shared_ptr<SubtitleContent> content) : TableDialog (parent, _("Subtitle appearance"), 2, 1, true) , _content (content) { @@ -44,10 +44,10 @@ TextSubtitleAppearanceDialog::TextSubtitleAppearanceDialog (wxWindow* parent, sh layout (); - _colour->SetColour (wxColour (_content->subtitle->colour().r, _content->subtitle->colour().g, _content->subtitle->colour().b)); - _outline->SetValue (_content->subtitle->outline ()); + _colour->SetColour (wxColour (_content->colour().r, _content->colour().g, _content->colour().b)); + _outline->SetValue (_content->outline ()); _outline_colour->SetColour ( - wxColour (_content->subtitle->outline_colour().r, _content->subtitle->outline_colour().g, _content->subtitle->outline_colour().b) + wxColour (_content->outline_colour().r, _content->outline_colour().g, _content->outline_colour().b) ); } @@ -55,8 +55,8 @@ void TextSubtitleAppearanceDialog::apply () { wxColour const c = _colour->GetColour (); - _content->subtitle->set_colour (dcp::Colour (c.Red(), c.Green(), c.Blue())); - _content->subtitle->set_outline (_outline->GetValue ()); + _content->set_colour (dcp::Colour (c.Red(), c.Green(), c.Blue())); + _content->set_outline (_outline->GetValue ()); wxColour const oc = _outline_colour->GetColour (); - _content->subtitle->set_outline_colour (dcp::Colour (oc.Red(), oc.Green(), oc.Blue())); + _content->set_outline_colour (dcp::Colour (oc.Red(), oc.Green(), oc.Blue())); } diff --git a/src/wx/text_subtitle_appearance_dialog.h b/src/wx/text_subtitle_appearance_dialog.h index a6e4b8dc0..feecae543 100644 --- a/src/wx/text_subtitle_appearance_dialog.h +++ b/src/wx/text_subtitle_appearance_dialog.h @@ -23,12 +23,12 @@ class wxCheckBox; class wxColourPickerCtrl; -class TextSubtitleContent; +class SubtitleContent; class TextSubtitleAppearanceDialog : public TableDialog { public: - TextSubtitleAppearanceDialog (wxWindow* parent, boost::shared_ptr<TextSubtitleContent> content); + TextSubtitleAppearanceDialog (wxWindow* parent, boost::shared_ptr<SubtitleContent> content); void apply (); @@ -37,5 +37,5 @@ private: wxCheckBox* _outline; wxColourPickerCtrl* _outline_colour; - boost::shared_ptr<TextSubtitleContent> _content; + boost::shared_ptr<SubtitleContent> _content; }; |
