diff options
| author | Carl Hetherington <cth@carlh.net> | 2016-08-16 08:41:25 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2016-08-16 16:56:32 +0100 |
| commit | 94b3924ed3cbf4fbfa2445ca1007f25c53dc8b60 (patch) | |
| tree | 40abbdf14043edf4d6592b82acf3eccb960ea71f /src/wx | |
| parent | 03c5a8155043613c01e0e151735a7fcf8ab84415 (diff) | |
Basic support for fading subtitles in and out (#923).
Diffstat (limited to 'src/wx')
| -rw-r--r-- | src/wx/subtitle_panel.cc | 2 | ||||
| -rw-r--r-- | src/wx/text_subtitle_appearance_dialog.cc | 30 | ||||
| -rw-r--r-- | src/wx/text_subtitle_appearance_dialog.h | 9 |
3 files changed, 28 insertions, 13 deletions
diff --git a/src/wx/subtitle_panel.cc b/src/wx/subtitle_panel.cc index 3db50104f..e4db3560e 100644 --- a/src/wx/subtitle_panel.cc +++ b/src/wx/subtitle_panel.cc @@ -477,7 +477,7 @@ SubtitlePanel::appearance_dialog_clicked () } if (text) { - TextSubtitleAppearanceDialog* d = new TextSubtitleAppearanceDialog (this, c.front()->subtitle); + TextSubtitleAppearanceDialog* d = new TextSubtitleAppearanceDialog (this, c.front()); if (d->ShowModal () == wxID_OK) { d->apply (); } diff --git a/src/wx/text_subtitle_appearance_dialog.cc b/src/wx/text_subtitle_appearance_dialog.cc index a826cbc66..49c8920f6 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<SubtitleContent> content) +TextSubtitleAppearanceDialog::TextSubtitleAppearanceDialog (wxWindow* parent, shared_ptr<Content> content) : TableDialog (parent, _("Subtitle appearance"), 2, 1, true) , _content (content) { @@ -50,23 +50,35 @@ TextSubtitleAppearanceDialog::TextSubtitleAppearanceDialog (wxWindow* parent, sh _effect_colour = new wxColourPickerCtrl (this, wxID_ANY); add (_effect_colour); + add (_("Fade in time"), true); + _fade_in = new Timecode<ContentTime> (this); + add (_fade_in); + + add (_("Fade out time"), true); + _fade_out = new Timecode<ContentTime> (this); + add (_fade_out); + layout (); - _colour->SetColour (wxColour (_content->colour().r, _content->colour().g, _content->colour().b)); - _outline->SetValue (_content->outline ()); - _shadow->SetValue (_content->shadow ()); + _colour->SetColour (wxColour (_content->subtitle->colour().r, _content->subtitle->colour().g, _content->subtitle->colour().b)); + _outline->SetValue (_content->subtitle->outline ()); + _shadow->SetValue (_content->subtitle->shadow ()); _effect_colour->SetColour ( - wxColour (_content->effect_colour().r, _content->effect_colour().g, _content->effect_colour().b) + wxColour (_content->subtitle->effect_colour().r, _content->subtitle->effect_colour().g, _content->subtitle->effect_colour().b) ); + _fade_in->set (_content->subtitle->fade_in(), _content->active_video_frame_rate ()); + _fade_out->set (_content->subtitle->fade_out(), _content->active_video_frame_rate ()); } void TextSubtitleAppearanceDialog::apply () { wxColour const c = _colour->GetColour (); - _content->set_colour (dcp::Colour (c.Red(), c.Green(), c.Blue())); - _content->set_outline (_outline->GetValue ()); - _content->set_shadow (_shadow->GetValue ()); + _content->subtitle->set_colour (dcp::Colour (c.Red(), c.Green(), c.Blue())); + _content->subtitle->set_outline (_outline->GetValue ()); + _content->subtitle->set_shadow (_shadow->GetValue ()); wxColour const ec = _effect_colour->GetColour (); - _content->set_effect_colour (dcp::Colour (ec.Red(), ec.Green(), ec.Blue())); + _content->subtitle->set_effect_colour (dcp::Colour (ec.Red(), ec.Green(), ec.Blue())); + _content->subtitle->set_fade_in (_fade_in->get (_content->active_video_frame_rate ())); + _content->subtitle->set_fade_out (_fade_out->get (_content->active_video_frame_rate ())); } diff --git a/src/wx/text_subtitle_appearance_dialog.h b/src/wx/text_subtitle_appearance_dialog.h index c67ec8756..55fe51066 100644 --- a/src/wx/text_subtitle_appearance_dialog.h +++ b/src/wx/text_subtitle_appearance_dialog.h @@ -19,16 +19,17 @@ */ #include "table_dialog.h" +#include "timecode.h" #include <boost/shared_ptr.hpp> class wxRadioButton; class wxColourPickerCtrl; -class SubtitleContent; +class Content; class TextSubtitleAppearanceDialog : public TableDialog { public: - TextSubtitleAppearanceDialog (wxWindow* parent, boost::shared_ptr<SubtitleContent> content); + TextSubtitleAppearanceDialog (wxWindow* parent, boost::shared_ptr<Content> content); void apply (); @@ -37,6 +38,8 @@ private: wxRadioButton* _outline; wxRadioButton* _shadow; wxColourPickerCtrl* _effect_colour; + Timecode<ContentTime>* _fade_in; + Timecode<ContentTime>* _fade_out; - boost::shared_ptr<SubtitleContent> _content; + boost::shared_ptr<Content> _content; }; |
