2 Copyright (C) 2012-2020 Carl Hetherington <cth@carlh.net>
4 This file is part of DCP-o-matic.
6 DCP-o-matic is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
11 DCP-o-matic is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with DCP-o-matic. If not, see <http://www.gnu.org/licenses/>.
21 #include "filter_dialog.h"
22 #include "video_panel.h"
24 #include "content_colour_conversion_dialog.h"
25 #include "content_widget.h"
26 #include "content_panel.h"
27 #include "static_text.h"
28 #include "check_box.h"
29 #include "custom_scale_dialog.h"
30 #include "dcpomatic_button.h"
31 #include "lib/filter.h"
32 #include "lib/ffmpeg_content.h"
33 #include "lib/colour_conversion.h"
34 #include "lib/config.h"
36 #include "lib/ratio.h"
37 #include "lib/frame_rate_change.h"
38 #include "lib/dcp_content.h"
39 #include "lib/video_content.h"
40 #include <wx/spinctrl.h>
41 #include <wx/tglbtn.h>
42 #include <boost/foreach.hpp>
43 #include <boost/unordered_set.hpp>
44 #include <boost/functional/hash.hpp>
54 using boost::shared_ptr;
55 using boost::dynamic_pointer_cast;
57 using boost::optional;
58 using namespace dcpomatic;
61 VideoPanel::VideoPanel (ContentPanel* p)
62 : ContentSubPanel (p, _("Video"))
64 _reference = new CheckBox (this, _("Use this DCP's video as OV and make VF"));
65 _reference_note = new StaticText (this, wxT(""));
66 _reference_note->Wrap (200);
67 wxFont font = _reference_note->GetFont();
68 font.SetStyle(wxFONTSTYLE_ITALIC);
69 font.SetPointSize(font.GetPointSize() - 1);
70 _reference_note->SetFont(font);
72 _type_label = create_label (this, _("Type"), true);
73 _frame_type = new ContentChoice<VideoContent, VideoFrameType> (
75 new wxChoice (this, wxID_ANY),
76 VideoContentProperty::FRAME_TYPE,
78 boost::mem_fn (&VideoContent::frame_type),
79 boost::mem_fn (&VideoContent::set_frame_type),
80 &caster<int, VideoFrameType>,
81 &caster<VideoFrameType, int>
84 _crop_label = create_label (this, _("Crop"), true);
86 int const crop_width = 56;
87 int const link_height = 28;
89 _left_crop_label = create_label (this, _("Left"), true);
90 _left_crop = new ContentSpinCtrl<VideoContent> (
92 new wxSpinCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(crop_width, -1)),
93 VideoContentProperty::CROP,
95 boost::mem_fn (&VideoContent::left_crop),
96 boost::mem_fn (&VideoContent::set_left_crop),
97 boost::bind (&VideoPanel::left_crop_changed, this)
100 _left_right_link = new wxToggleButton (this, wxID_ANY, wxT(""), wxDefaultPosition, wxSize(22, link_height));
101 _left_right_link->SetBitmap (wxBitmap(bitmap_path("link"), wxBITMAP_TYPE_PNG));
103 _right_crop_label = create_label (this, _("Right"), true);
104 _right_crop = new ContentSpinCtrl<VideoContent> (
106 new wxSpinCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(crop_width, -1)),
107 VideoContentProperty::CROP,
109 boost::mem_fn (&VideoContent::right_crop),
110 boost::mem_fn (&VideoContent::set_right_crop),
111 boost::bind (&VideoPanel::right_crop_changed, this)
114 _top_crop_label = create_label (this, _("Top"), true);
115 _top_crop = new ContentSpinCtrl<VideoContent> (
117 new wxSpinCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(crop_width, -1)),
118 VideoContentProperty::CROP,
120 boost::mem_fn (&VideoContent::top_crop),
121 boost::mem_fn (&VideoContent::set_top_crop),
122 boost::bind (&VideoPanel::top_crop_changed, this)
125 _top_bottom_link = new wxToggleButton (this, wxID_ANY, wxT(""), wxDefaultPosition, wxSize(22, link_height));
126 _top_bottom_link->SetBitmap (wxBitmap(bitmap_path("link"), wxBITMAP_TYPE_PNG));
128 _bottom_crop_label = create_label (this, _("Bottom"), true);
129 _bottom_crop = new ContentSpinCtrl<VideoContent> (
131 new wxSpinCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(crop_width, -1)),
132 VideoContentProperty::CROP,
134 boost::mem_fn (&VideoContent::bottom_crop),
135 boost::mem_fn (&VideoContent::set_bottom_crop),
136 boost::bind (&VideoPanel::bottom_crop_changed, this)
139 _fade_in_label = create_label (this, _("Fade in"), true);
140 _fade_in = new Timecode<ContentTime> (this);
142 _fade_out_label = create_label (this, _("Fade out"), true);
143 _fade_out = new Timecode<ContentTime> (this);
145 wxClientDC dc (this);
146 wxSize size = dc.GetTextExtent (wxT ("A quite long name"));
149 _scale_label = create_label (this, _("Scale"), true);
150 _scale_fit = new wxRadioButton (this, wxID_ANY, _("to fit DCP"));
151 _scale_custom = new wxRadioButton (this, wxID_ANY, _("custom"), wxDefaultPosition, size);
152 _scale_custom_edit = new Button (this, _("Edit..."));
154 _filters_label = create_label (this, _("Filters"), true);
155 _filters = new StaticText (this, _("None"), wxDefaultPosition, size);
156 _filters_button = new Button (this, _("Edit..."));
158 _colour_conversion_label = create_label (this, _("Colour conversion"), true);
159 _colour_conversion = new wxChoice (this, wxID_ANY, wxDefaultPosition, size);
160 _colour_conversion->Append (_("None"));
161 BOOST_FOREACH (PresetColourConversion const & i, PresetColourConversion::all()) {
162 _colour_conversion->Append (std_to_wx (i.name));
165 /// TRANSLATORS: translate the word "Custom" here; do not include the "Colour|" prefix
166 _colour_conversion->Append (S_("Colour|Custom"));
167 _edit_colour_conversion_button = new Button (this, _("Edit..."));
169 _range_label = create_label (this, _("Range"), true);
170 _range = new wxChoice (this, wxID_ANY);
171 _range->Append (_("Full (JPEG, 0-255)"));
172 _range->Append (_("Video (MPEG, 16-235)"));
174 _description = new StaticText (this, wxT ("\n \n \n \n \n"), wxDefaultPosition, wxDefaultSize);
175 _description->SetFont(font);
177 _left_crop->wrapped()->SetRange (0, 4096);
178 _top_crop->wrapped()->SetRange (0, 4096);
179 _right_crop->wrapped()->SetRange (0, 4096);
180 _bottom_crop->wrapped()->SetRange (0, 4096);
182 _frame_type->wrapped()->Append (_("2D"));
183 _frame_type->wrapped()->Append (_("3D"));
184 _frame_type->wrapped()->Append (_("3D left/right"));
185 _frame_type->wrapped()->Append (_("3D top/bottom"));
186 _frame_type->wrapped()->Append (_("3D alternate"));
187 _frame_type->wrapped()->Append (_("3D left only"));
188 _frame_type->wrapped()->Append (_("3D right only"));
190 content_selection_changed ();
192 _fade_in->Changed.connect (boost::bind (&VideoPanel::fade_in_changed, this));
193 _fade_out->Changed.connect (boost::bind (&VideoPanel::fade_out_changed, this));
195 _reference->Bind (wxEVT_CHECKBOX, boost::bind (&VideoPanel::reference_clicked, this));
196 _filters_button->Bind (wxEVT_BUTTON, boost::bind (&VideoPanel::edit_filters_clicked, this));
197 _scale_fit->Bind (wxEVT_RADIOBUTTON, boost::bind (&VideoPanel::scale_fit_clicked, this));
198 _scale_custom->Bind (wxEVT_RADIOBUTTON, boost::bind (&VideoPanel::scale_custom_clicked, this));
199 _scale_custom_edit->Bind (wxEVT_BUTTON, boost::bind (&VideoPanel::scale_custom_edit_clicked, this));
200 _colour_conversion->Bind (wxEVT_CHOICE, boost::bind (&VideoPanel::colour_conversion_changed, this));
201 _range->Bind (wxEVT_CHOICE, boost::bind (&VideoPanel::range_changed, this));
202 _edit_colour_conversion_button->Bind (wxEVT_BUTTON, boost::bind (&VideoPanel::edit_colour_conversion_clicked, this));
203 _left_right_link->Bind (wxEVT_TOGGLEBUTTON, boost::bind(&VideoPanel::left_right_link_clicked, this));
204 _top_bottom_link->Bind (wxEVT_TOGGLEBUTTON, boost::bind(&VideoPanel::top_bottom_link_clicked, this));
210 VideoPanel::add_to_grid ()
212 bool const full = Config::instance()->interface_complexity() == Config::INTERFACE_FULL;
216 _reference->Show (full);
217 _reference_note->Show (full && !_reference_note->GetLabel().IsEmpty());
220 wxBoxSizer* reference_sizer = new wxBoxSizer (wxVERTICAL);
221 reference_sizer->Add (_reference, 0);
222 reference_sizer->Add (_reference_note, 0);
223 _grid->Add (reference_sizer, wxGBPosition(r, 0), wxGBSpan(1, 3));
227 add_label_to_sizer (_grid, _type_label, true, wxGBPosition(r, 0));
228 _frame_type->add (_grid, wxGBPosition(r, 1), wxGBSpan(1, 2));
232 wxGridBagSizer* crop = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
233 add_label_to_sizer (crop, _left_crop_label, true, wxGBPosition (cr, 0));
234 _left_crop->add (crop, wxGBPosition (cr, 1));
235 crop->Add (_left_right_link, wxGBPosition(cr, 2));
236 add_label_to_sizer (crop, _right_crop_label, true, wxGBPosition (cr, 3));
237 _right_crop->add (crop, wxGBPosition (cr, 4));
239 add_label_to_sizer (crop, _top_crop_label, true, wxGBPosition (cr, 0));
240 _top_crop->add (crop, wxGBPosition (cr, 1));
241 crop->Add (_top_bottom_link, wxGBPosition(cr, 2));
242 add_label_to_sizer (crop, _bottom_crop_label, true, wxGBPosition (cr, 3));
243 _bottom_crop->add (crop, wxGBPosition (cr, 4));
244 add_label_to_sizer (_grid, _crop_label, true, wxGBPosition(r, 0));
245 _grid->Add (crop, wxGBPosition(r, 1));
248 _scale_label->Show (full);
249 _scale_fit->Show (full);
250 _scale_custom->Show (full);
251 _scale_custom_edit->Show (full);
252 _filters_label->Show (full);
253 _filters->Show (full);
254 _filters_button->Show (full);
255 _colour_conversion_label->Show (full);
256 _colour_conversion->Show (full);
257 _edit_colour_conversion_button->Show (full);
258 _range_label->Show (full);
261 add_label_to_sizer (_grid, _fade_in_label, true, wxGBPosition (r, 0));
262 _grid->Add (_fade_in, wxGBPosition (r, 1), wxGBSpan (1, 3));
265 add_label_to_sizer (_grid, _fade_out_label, true, wxGBPosition (r, 0));
266 _grid->Add (_fade_out, wxGBPosition (r, 1), wxGBSpan (1, 3));
270 add_label_to_sizer (_grid, _scale_label, true, wxGBPosition (r, 0));
272 wxSizer* v = new wxBoxSizer (wxVERTICAL);
273 v->Add (_scale_fit, 0, wxBOTTOM, 4);
274 wxSizer* h = new wxBoxSizer (wxHORIZONTAL);
275 h->Add (_scale_custom, 1, wxRIGHT, 6);
276 h->Add (_scale_custom_edit, 0);
278 _grid->Add (v, wxGBPosition(r, 1));
282 add_label_to_sizer (_grid, _filters_label, true, wxGBPosition (r, 0));
284 wxSizer* s = new wxBoxSizer (wxHORIZONTAL);
285 s->Add (_filters, 1, wxALIGN_CENTER_VERTICAL | wxTOP | wxBOTTOM | wxRIGHT, 6);
286 s->Add (_filters_button, 0, wxALIGN_CENTER_VERTICAL);
287 _grid->Add (s, wxGBPosition (r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
291 add_label_to_sizer (_grid, _colour_conversion_label, true, wxGBPosition(r, 0));
293 wxSizer* s = new wxBoxSizer (wxHORIZONTAL);
294 s->Add (_colour_conversion, 1, wxALIGN_CENTER_VERTICAL | wxTOP | wxBOTTOM | wxRIGHT, 6);
295 s->Add (_edit_colour_conversion_button, 0, wxALIGN_CENTER_VERTICAL);
296 _grid->Add (s, wxGBPosition (r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
300 add_label_to_sizer (_grid, _range_label, true, wxGBPosition(r, 0));
301 _grid->Add (_range, wxGBPosition(r, 1), wxGBSpan(1, 2), wxALIGN_CENTER_VERTICAL);
305 _grid->Add (_description, wxGBPosition (r, 0), wxGBSpan (1, 4), wxEXPAND | wxALIGN_CENTER_VERTICAL, 6);
310 VideoPanel::range_changed ()
312 ContentList vc = _parent->selected_video ();
313 if (vc.size() != 1) {
317 switch (_range->GetSelection()) {
319 vc.front()->video->set_range (VIDEO_RANGE_FULL);
322 vc.front()->video->set_range (VIDEO_RANGE_VIDEO);
325 DCPOMATIC_ASSERT (false);
331 VideoPanel::film_changed (Film::Property property)
334 case Film::VIDEO_FRAME_RATE:
335 case Film::CONTAINER:
336 case Film::RESOLUTION:
337 setup_description ();
338 setup_sensitivity ();
340 case Film::REEL_TYPE:
342 setup_sensitivity ();
350 hash_value (boost::optional<ColourConversion> const & c)
352 boost::hash<string> hasher;
354 return hasher ("none");
356 return hasher (c->identifier());
361 VideoPanel::film_content_changed (int property)
363 ContentList vc = _parent->selected_video ();
364 shared_ptr<Content> vcs;
365 shared_ptr<FFmpegContent> fcs;
368 fcs = dynamic_pointer_cast<FFmpegContent> (vcs);
371 if (property == ContentProperty::VIDEO_FRAME_RATE ||
372 property == VideoContentProperty::FRAME_TYPE ||
373 property == VideoContentProperty::CROP ||
374 property == VideoContentProperty::SCALE) {
375 setup_description ();
376 } else if (property == VideoContentProperty::COLOUR_CONVERSION) {
377 boost::unordered_set<optional<ColourConversion> > check;
378 BOOST_FOREACH (shared_ptr<const Content> i, vc) {
379 check.insert (i->video->colour_conversion());
382 /* Remove any "Many" entry that we might have added previously. There should
383 * be entries for each preset plus one for "None" and one for "Custom".
385 vector<PresetColourConversion> cc = PresetColourConversion::all ();
386 if (_colour_conversion->GetCount() > cc.size() + 2) {
387 _colour_conversion->Delete (_colour_conversion->GetCount() - 1);
390 if (check.size() == 1) {
391 if (vcs && vcs->video->colour_conversion ()) {
392 optional<size_t> preset = vcs->video->colour_conversion().get().preset ();
394 checked_set (_colour_conversion, preset.get() + 1);
396 checked_set (_colour_conversion, cc.size() + 1);
399 checked_set (_colour_conversion, 0);
401 setup_description ();
402 } else if (check.size() > 1) {
403 /* Add a "many" entry and select it as an indication that multiple different
404 * colour conversions are present in the selection.
406 _colour_conversion->Append (_("Many"));
407 checked_set (_colour_conversion, _colour_conversion->GetCount() - 1);
410 setup_sensitivity ();
412 } else if (property == FFmpegContentProperty::FILTERS) {
414 string p = Filter::ffmpeg_string (fcs->filters ());
416 checked_set (_filters, _("None"));
418 if (p.length() > 25) {
419 p = p.substr (0, 25) + "...";
421 checked_set (_filters, p);
424 } else if (property == VideoContentProperty::USE) {
425 setup_sensitivity ();
426 } else if (property == VideoContentProperty::FADE_IN) {
428 BOOST_FOREACH (shared_ptr<const Content> i, vc) {
429 check.insert (i->video->fade_in ());
432 if (check.size() == 1) {
434 ContentTime::from_frames (vc.front()->video->fade_in(), vc.front()->active_video_frame_rate(_parent->film())),
435 vc.front()->active_video_frame_rate(_parent->film())
440 setup_description ();
441 } else if (property == VideoContentProperty::FADE_OUT) {
443 BOOST_FOREACH (shared_ptr<const Content> i, vc) {
444 check.insert (i->video->fade_out ());
447 if (check.size() == 1) {
449 ContentTime::from_frames (vc.front()->video->fade_out(), vc.front()->active_video_frame_rate(_parent->film())),
450 vc.front()->active_video_frame_rate(_parent->film())
455 setup_description ();
456 } else if (property == DCPContentProperty::REFERENCE_VIDEO) {
457 if (vc.size() == 1) {
458 shared_ptr<DCPContent> dcp = dynamic_pointer_cast<DCPContent> (vc.front ());
459 checked_set (_reference, dcp ? dcp->reference_video () : false);
461 checked_set (_reference, false);
464 setup_sensitivity ();
465 } else if (property == VideoContentProperty::RANGE) {
467 checked_set (_range, vcs->video->range() == VIDEO_RANGE_FULL ? 0 : 1);
469 checked_set (_range, 0);
472 setup_sensitivity ();
473 } else if (property == VideoContentProperty::CUSTOM_RATIO || property == VideoContentProperty::CUSTOM_SIZE) {
475 BOOST_FOREACH (shared_ptr<const Content> i, vc) {
476 check.insert (i->video->custom_ratio() || i->video->custom_size());
479 if (check.size() == 1) {
480 checked_set (_scale_fit, !vc.front()->video->custom_ratio() && !vc.front()->video->custom_size());
481 checked_set (_scale_custom, vc.front()->video->custom_ratio() || vc.front()->video->custom_size());
483 checked_set (_scale_fit, true);
484 checked_set (_scale_custom, false);
486 setup_sensitivity ();
490 /** Called when the `Edit filters' button has been clicked */
492 VideoPanel::edit_filters_clicked ()
494 FFmpegContentList c = _parent->selected_ffmpeg ();
499 FilterDialog* d = new FilterDialog (this, c.front()->filters());
500 d->ActiveChanged.connect (bind (&FFmpegContent::set_filters, c.front(), _1));
506 VideoPanel::setup_description ()
508 ContentList vc = _parent->selected_video ();
510 checked_set (_description, wxT (""));
512 } else if (vc.size() > 1) {
513 checked_set (_description, _("Multiple content selected"));
517 string d = vc.front()->video_processing_description (_parent->film());
518 size_t lines = count (d.begin(), d.end(), '\n');
520 for (int i = lines; i < 6; ++i) {
524 checked_set (_description, d);
529 VideoPanel::colour_conversion_changed ()
531 ContentList vc = _parent->selected_video ();
533 int const s = _colour_conversion->GetSelection ();
534 vector<PresetColourConversion> all = PresetColourConversion::all ();
536 if (s == int(all.size() + 1)) {
537 edit_colour_conversion_clicked ();
539 BOOST_FOREACH (shared_ptr<Content> i, _parent->selected_video()) {
541 i->video->unset_colour_conversion ();
542 } else if (s != int(all.size() + 2)) {
543 i->video->set_colour_conversion (all[s - 1].conversion);
550 VideoPanel::edit_colour_conversion_clicked ()
552 ContentList vc = _parent->selected_video ();
554 ContentColourConversionDialog* d = new ContentColourConversionDialog (this, vc.front()->video->yuv ());
555 d->set (vc.front()->video->colour_conversion().get_value_or (PresetColourConversion::all().front().conversion));
556 if (d->ShowModal() == wxID_OK) {
557 BOOST_FOREACH (shared_ptr<Content> i, vc) {
558 i->video->set_colour_conversion (d->get ());
561 /* Reset the colour conversion choice */
562 film_content_changed (VideoContentProperty::COLOUR_CONVERSION);
568 VideoPanel::content_selection_changed ()
570 ContentList video_sel = _parent->selected_video ();
572 _frame_type->set_content (video_sel);
573 _left_crop->set_content (video_sel);
574 _right_crop->set_content (video_sel);
575 _top_crop->set_content (video_sel);
576 _bottom_crop->set_content (video_sel);
578 film_content_changed (ContentProperty::VIDEO_FRAME_RATE);
579 film_content_changed (VideoContentProperty::CROP);
580 film_content_changed (VideoContentProperty::COLOUR_CONVERSION);
581 film_content_changed (VideoContentProperty::FADE_IN);
582 film_content_changed (VideoContentProperty::FADE_OUT);
583 film_content_changed (VideoContentProperty::RANGE);
584 film_content_changed (VideoContentProperty::USE);
585 film_content_changed (VideoContentProperty::CUSTOM_RATIO);
586 film_content_changed (VideoContentProperty::CUSTOM_SIZE);
587 film_content_changed (FFmpegContentProperty::FILTERS);
588 film_content_changed (DCPContentProperty::REFERENCE_VIDEO);
590 setup_sensitivity ();
594 VideoPanel::setup_sensitivity ()
596 ContentList sel = _parent->selected ();
598 shared_ptr<DCPContent> dcp;
599 if (sel.size() == 1) {
600 dcp = dynamic_pointer_cast<DCPContent> (sel.front ());
604 bool const can_reference = dcp && dcp->can_reference_video (_parent->film(), why_not);
606 if (why_not.empty()) {
607 cannot = _("Cannot reference this DCP's video.");
609 cannot = _("Cannot reference this DCP's video: ") + std_to_wx(why_not);
611 setup_refer_button (_reference, _reference_note, dcp, can_reference, cannot);
613 bool any_use = false;
614 BOOST_FOREACH (shared_ptr<Content> i, _parent->selected_video()) {
615 if (i->video && i->video->use()) {
620 bool const enable = !_reference->GetValue() && any_use;
623 _frame_type->wrapped()->Enable (false);
624 _left_crop->wrapped()->Enable (false);
625 _right_crop->wrapped()->Enable (false);
626 _top_crop->wrapped()->Enable (false);
627 _bottom_crop->wrapped()->Enable (false);
628 _fade_in->Enable (false);
629 _fade_out->Enable (false);
630 _scale_fit->Enable (false);
631 _scale_custom->Enable (false);
632 _scale_custom_edit->Enable (false);
633 _description->Enable (false);
634 _filters->Enable (false);
635 _filters_button->Enable (false);
636 _colour_conversion->Enable (false);
637 _range->Enable (false);
639 ContentList video_sel = _parent->selected_video ();
640 FFmpegContentList ffmpeg_sel = _parent->selected_ffmpeg ();
641 bool const single = video_sel.size() == 1;
643 _frame_type->wrapped()->Enable (true);
644 _left_crop->wrapped()->Enable (true);
645 _right_crop->wrapped()->Enable (true);
646 _top_crop->wrapped()->Enable (true);
647 _bottom_crop->wrapped()->Enable (true);
648 _fade_in->Enable (!video_sel.empty ());
649 _fade_out->Enable (!video_sel.empty ());
650 _scale_fit->Enable (true);
651 _scale_custom->Enable (true);
652 _scale_custom_edit->Enable (_scale_custom->GetValue());
653 _description->Enable (true);
654 _filters->Enable (true);
655 _filters_button->Enable (single && !ffmpeg_sel.empty ());
656 _colour_conversion->Enable (!video_sel.empty());
657 _range->Enable (single && !video_sel.empty());
660 ContentList vc = _parent->selected_video ();
661 shared_ptr<Content> vcs;
666 if (vcs && vcs->video->colour_conversion ()) {
667 _edit_colour_conversion_button->Enable (!vcs->video->colour_conversion().get().preset());
669 _edit_colour_conversion_button->Enable (false);
674 VideoPanel::fade_in_changed ()
676 BOOST_FOREACH (shared_ptr<Content> i, _parent->selected_video ()) {
677 double const vfr = i->active_video_frame_rate (_parent->film());
678 i->video->set_fade_in (_fade_in->get(vfr).frames_round(vfr));
683 VideoPanel::fade_out_changed ()
685 BOOST_FOREACH (shared_ptr<Content> i, _parent->selected_video ()) {
686 double const vfr = i->active_video_frame_rate (_parent->film());
687 i->video->set_fade_out (_fade_out->get(vfr).frames_round(vfr));
693 VideoPanel::reference_clicked ()
695 ContentList c = _parent->selected ();
700 shared_ptr<DCPContent> d = dynamic_pointer_cast<DCPContent> (c.front ());
705 d->set_reference_video (_reference->GetValue ());
710 VideoPanel::scale_fit_clicked ()
712 BOOST_FOREACH (shared_ptr<Content> i, _parent->selected_video()) {
713 i->video->set_custom_ratio (optional<float>());
719 VideoPanel::scale_custom_clicked ()
721 if (!scale_custom_edit_clicked()) {
722 _scale_fit->SetValue (true);
728 VideoPanel::scale_custom_edit_clicked ()
730 shared_ptr<const VideoContent> vc = _parent->selected_video().front()->video;
731 CustomScaleDialog* d = new CustomScaleDialog (this, vc->size(), _parent->film()->frame_size(), vc->custom_ratio(), vc->custom_size());
732 int const r = d->ShowModal ();
734 BOOST_FOREACH (shared_ptr<Content> i, _parent->selected_video()) {
735 i->video->set_custom_ratio (d->custom_ratio());
736 i->video->set_custom_size (d->custom_size());
745 VideoPanel::left_right_link_clicked ()
747 right_crop_changed ();
752 VideoPanel::top_bottom_link_clicked ()
754 bottom_crop_changed ();
759 VideoPanel::left_crop_changed ()
761 if (_left_right_link->GetValue()) {
762 BOOST_FOREACH (shared_ptr<Content> i, _parent->selected_video()) {
763 i->video->set_right_crop (i->video->left_crop());
770 VideoPanel::right_crop_changed ()
772 if (_left_right_link->GetValue()) {
773 BOOST_FOREACH (shared_ptr<Content> i, _parent->selected_video()) {
774 i->video->set_left_crop (i->video->right_crop());
781 VideoPanel::top_crop_changed ()
783 if (_top_bottom_link->GetValue()) {
784 BOOST_FOREACH (shared_ptr<Content> i, _parent->selected_video()) {
785 i->video->set_bottom_crop (i->video->top_crop());
792 VideoPanel::bottom_crop_changed ()
794 if (_top_bottom_link->GetValue()) {
795 BOOST_FOREACH (shared_ptr<Content> i, _parent->selected_video()) {
796 i->video->set_top_crop (i->video->bottom_crop());