2 Copyright (C) 2012-2021 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/>.
22 #include "check_box.h"
23 #include "content_colour_conversion_dialog.h"
24 #include "content_panel.h"
25 #include "content_widget.h"
26 #include "custom_scale_dialog.h"
27 #include "dcpomatic_button.h"
28 #include "filter_dialog.h"
29 #include "static_text.h"
30 #include "video_panel.h"
32 #include "lib/colour_conversion.h"
33 #include "lib/config.h"
34 #include "lib/dcp_content.h"
35 #include "lib/ffmpeg_content.h"
37 #include "lib/filter.h"
38 #include "lib/frame_rate_change.h"
39 #include "lib/ratio.h"
41 #include "lib/video_content.h"
42 #include <dcp/warnings.h>
43 LIBDCP_DISABLE_WARNINGS
44 #include <wx/spinctrl.h>
45 #include <wx/tglbtn.h>
46 LIBDCP_ENABLE_WARNINGS
47 #include <boost/functional/hash.hpp>
48 #include <boost/unordered_set.hpp>
59 using std::shared_ptr;
60 using std::dynamic_pointer_cast;
62 using boost::optional;
63 using namespace dcpomatic;
64 #if BOOST_VERSION >= 106100
65 using namespace boost::placeholders;
69 VideoPanel::VideoPanel (ContentPanel* p)
70 : ContentSubPanel (p, _("Video"))
79 _reference = new CheckBox (this, _("Use this DCP's video as OV and make VF"));
80 _reference_note = new StaticText (this, wxT(""));
81 _reference_note->Wrap (200);
82 auto font = _reference_note->GetFont();
83 font.SetStyle(wxFONTSTYLE_ITALIC);
84 font.SetPointSize(font.GetPointSize() - 1);
85 _reference_note->SetFont(font);
87 _type_label = create_label (this, _("Type"), true);
88 _frame_type = new ContentChoice<VideoContent, VideoFrameType> (
90 new wxChoice (this, wxID_ANY),
91 VideoContentProperty::FRAME_TYPE,
93 boost::mem_fn (&VideoContent::frame_type),
94 boost::mem_fn (&VideoContent::set_frame_type),
95 &caster<int, VideoFrameType>,
96 &caster<VideoFrameType, int>
99 _crop_label = create_label (this, _("Crop"), true);
101 #if defined(__WXGTK3__)
102 int const crop_width = 128;
103 int const link_width = 32;
104 int const link_height = 64;
105 #elif defined(__WXGTK20__)
106 int const crop_width = 56;
107 int const link_width = 24;
108 int const link_height = 32;
109 #elif defined(DCPOMATIC_OSX)
110 int const crop_width = 56;
111 int const link_width = 23;
112 int const link_height = 28;
114 int const crop_width = 56;
115 int const link_width = 22;
116 int const link_height = 28;
119 _left_crop_label = create_label (this, _("Left"), true);
120 _left_crop = new ContentSpinCtrl<VideoContent> (
122 new wxSpinCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(crop_width, -1)),
123 VideoContentProperty::CROP,
125 boost::mem_fn (&VideoContent::requested_left_crop),
126 boost::mem_fn (&VideoContent::set_left_crop),
127 boost::bind (&VideoPanel::left_crop_changed, this)
130 _left_right_link = new wxToggleButton (this, wxID_ANY, wxT(""), wxDefaultPosition, wxSize(link_width, link_height));
131 _left_right_link->SetBitmap (wxBitmap(bitmap_path("link.png"), wxBITMAP_TYPE_PNG));
133 _right_crop_label = create_label (this, _("Right"), true);
134 _right_crop = new ContentSpinCtrl<VideoContent> (
136 new wxSpinCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(crop_width, -1)),
137 VideoContentProperty::CROP,
139 boost::mem_fn (&VideoContent::requested_right_crop),
140 boost::mem_fn (&VideoContent::set_right_crop),
141 boost::bind (&VideoPanel::right_crop_changed, this)
144 _top_crop_label = create_label (this, _("Top"), true);
145 _top_crop = new ContentSpinCtrl<VideoContent> (
147 new wxSpinCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(crop_width, -1)),
148 VideoContentProperty::CROP,
150 boost::mem_fn (&VideoContent::requested_top_crop),
151 boost::mem_fn (&VideoContent::set_top_crop),
152 boost::bind (&VideoPanel::top_crop_changed, this)
155 _top_bottom_link = new wxToggleButton (this, wxID_ANY, wxT(""), wxDefaultPosition, wxSize(link_width, link_height));
156 _top_bottom_link->SetBitmap (wxBitmap(bitmap_path("link.png"), wxBITMAP_TYPE_PNG));
158 _bottom_crop_label = create_label (this, _("Bottom"), true);
159 _bottom_crop = new ContentSpinCtrl<VideoContent> (
161 new wxSpinCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(crop_width, -1)),
162 VideoContentProperty::CROP,
164 boost::mem_fn (&VideoContent::requested_bottom_crop),
165 boost::mem_fn (&VideoContent::set_bottom_crop),
166 boost::bind (&VideoPanel::bottom_crop_changed, this)
169 _fade_in_label = create_label (this, _("Fade in"), true);
170 _fade_in = new Timecode<ContentTime> (this);
172 _fade_out_label = create_label (this, _("Fade out"), true);
173 _fade_out = new Timecode<ContentTime> (this);
175 wxClientDC dc (this);
176 auto size = dc.GetTextExtent (wxT ("A quite long name"));
178 size.SetWidth (size.GetWidth() + 64);
182 _scale_label = create_label (this, _("Scale"), true);
183 _scale_fit = new wxRadioButton (this, wxID_ANY, _("to fit DCP"));
184 _scale_custom = new wxRadioButton (this, wxID_ANY, _("custom"));
185 _scale_custom_edit = new Button (this, _("Edit..."), wxDefaultPosition, small_button_size(this, _("Edit...")));
187 _colour_conversion_label = create_label (this, _("Colour"), true);
188 _colour_conversion = new wxChoice (this, wxID_ANY, wxDefaultPosition, size);
189 _colour_conversion->Append (_("None"));
190 for (auto const& i: PresetColourConversion::all()) {
191 _colour_conversion->Append (std_to_wx (i.name));
194 /// TRANSLATORS: translate the word "Custom" here; do not include the "Colour|" prefix
195 _colour_conversion->Append (S_("Colour|Custom"));
196 _edit_colour_conversion_button = new Button (this, _("Edit..."), wxDefaultPosition, small_button_size(this, _("Edit...")));
198 _range_label = create_label (this, _("Range"), true);
199 _range = new wxChoice (this, wxID_ANY);
200 _range->Append (_("Full (JPEG, 0-255)"));
201 _range->Append (_("Video (MPEG, 16-235)"));
203 _description = new StaticText (this, wxT ("\n \n \n \n \n"), wxDefaultPosition, wxDefaultSize);
204 _description->SetFont(font);
206 _left_crop->wrapped()->SetRange (0, 4096);
207 _top_crop->wrapped()->SetRange (0, 4096);
208 _right_crop->wrapped()->SetRange (0, 4096);
209 _bottom_crop->wrapped()->SetRange (0, 4096);
211 _frame_type->wrapped()->Append (_("2D"));
212 _frame_type->wrapped()->Append (_("3D"));
213 _frame_type->wrapped()->Append (_("3D left/right"));
214 _frame_type->wrapped()->Append (_("3D top/bottom"));
215 _frame_type->wrapped()->Append (_("3D alternate"));
216 _frame_type->wrapped()->Append (_("3D left only"));
217 _frame_type->wrapped()->Append (_("3D right only"));
219 content_selection_changed ();
221 _fade_in->Changed.connect (boost::bind (&VideoPanel::fade_in_changed, this));
222 _fade_out->Changed.connect (boost::bind (&VideoPanel::fade_out_changed, this));
224 _reference->bind(&VideoPanel::reference_clicked, this);
225 _scale_fit->Bind (wxEVT_RADIOBUTTON, boost::bind (&VideoPanel::scale_fit_clicked, this));
226 _scale_custom->Bind (wxEVT_RADIOBUTTON, boost::bind (&VideoPanel::scale_custom_clicked, this));
227 _scale_custom_edit->Bind (wxEVT_BUTTON, boost::bind (&VideoPanel::scale_custom_edit_clicked, this));
228 _colour_conversion->Bind (wxEVT_CHOICE, boost::bind (&VideoPanel::colour_conversion_changed, this));
229 _range->Bind (wxEVT_CHOICE, boost::bind (&VideoPanel::range_changed, this));
230 _edit_colour_conversion_button->Bind (wxEVT_BUTTON, boost::bind (&VideoPanel::edit_colour_conversion_clicked, this));
231 _left_right_link->Bind (wxEVT_TOGGLEBUTTON, boost::bind(&VideoPanel::left_right_link_clicked, this));
232 _top_bottom_link->Bind (wxEVT_TOGGLEBUTTON, boost::bind(&VideoPanel::top_bottom_link_clicked, this));
241 VideoPanel::add_to_grid ()
245 auto reference_sizer = new wxBoxSizer (wxVERTICAL);
246 reference_sizer->Add (_reference, 0);
247 reference_sizer->Add (_reference_note, 0);
248 _grid->Add (reference_sizer, wxGBPosition(r, 0), wxGBSpan(1, 3));
251 add_label_to_sizer (_grid, _type_label, true, wxGBPosition(r, 0));
252 _frame_type->add (_grid, wxGBPosition(r, 1), wxGBSpan(1, 2));
256 auto crop = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
258 add_label_to_sizer (crop, _left_crop_label, true, wxGBPosition (cr, 0));
259 _left_crop->add (crop, wxGBPosition(cr, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
261 crop->Add (_left_right_link, wxGBPosition(cr, 2), wxGBSpan(2, 1));
263 add_label_to_sizer (crop, _right_crop_label, true, wxGBPosition(cr, 0));
264 _right_crop->add (crop, wxGBPosition(cr, 1));
266 crop->Add (_left_right_link, wxGBPosition(cr, 2), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
267 add_label_to_sizer (crop, _right_crop_label, true, wxGBPosition (cr, 3));
268 _right_crop->add (crop, wxGBPosition (cr, 4), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
271 add_label_to_sizer (crop, _top_crop_label, true, wxGBPosition (cr, 0));
272 _top_crop->add (crop, wxGBPosition (cr, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
274 crop->Add (_top_bottom_link, wxGBPosition(cr, 2), wxGBSpan(2, 1));
276 add_label_to_sizer (crop, _bottom_crop_label, true, wxGBPosition(cr, 0));
277 _bottom_crop->add (crop, wxGBPosition(cr, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
279 crop->Add (_top_bottom_link, wxGBPosition(cr, 2), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
280 add_label_to_sizer (crop, _bottom_crop_label, true, wxGBPosition (cr, 3));
281 _bottom_crop->add (crop, wxGBPosition (cr, 4), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
283 add_label_to_sizer (_grid, _crop_label, true, wxGBPosition(r, 0));
284 _grid->Add (crop, wxGBPosition(r, 1));
287 add_label_to_sizer (_grid, _fade_in_label, true, wxGBPosition (r, 0));
288 _grid->Add (_fade_in, wxGBPosition (r, 1), wxGBSpan (1, 3));
291 add_label_to_sizer (_grid, _fade_out_label, true, wxGBPosition (r, 0));
292 _grid->Add (_fade_out, wxGBPosition (r, 1), wxGBSpan (1, 3));
295 add_label_to_sizer (_grid, _scale_label, true, wxGBPosition (r, 0));
297 auto v = new wxBoxSizer (wxVERTICAL);
298 v->Add (_scale_fit, 0, wxBOTTOM, 4);
299 auto h = new wxBoxSizer (wxHORIZONTAL);
300 h->Add (_scale_custom, 1, wxRIGHT | wxALIGN_CENTER_VERTICAL, 6);
301 h->Add (_scale_custom_edit, 0, wxALIGN_CENTER_VERTICAL);
303 _grid->Add (v, wxGBPosition(r, 1));
307 add_label_to_sizer (_grid, _colour_conversion_label, true, wxGBPosition(r, 0));
309 auto s = new wxBoxSizer (wxHORIZONTAL);
310 s->Add (_colour_conversion, 1, wxALIGN_CENTER_VERTICAL | wxTOP | wxBOTTOM | wxRIGHT, 6);
311 s->Add (_edit_colour_conversion_button, 0, wxALIGN_CENTER_VERTICAL);
312 _grid->Add (s, wxGBPosition (r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
316 add_label_to_sizer (_grid, _range_label, true, wxGBPosition(r, 0));
317 _grid->Add (_range, wxGBPosition(r, 1), wxGBSpan(1, 2), wxALIGN_CENTER_VERTICAL);
320 _grid->Add (_description, wxGBPosition (r, 0), wxGBSpan (1, 4), wxEXPAND | wxALIGN_CENTER_VERTICAL, 6);
326 VideoPanel::range_changed ()
328 auto vc = _parent->selected_video ();
329 if (vc.size() != 1) {
333 switch (_range->GetSelection()) {
335 vc.front()->video->set_range (VideoRange::FULL);
338 vc.front()->video->set_range (VideoRange::VIDEO);
341 DCPOMATIC_ASSERT (false);
347 VideoPanel::film_changed(FilmProperty property)
350 case FilmProperty::VIDEO_FRAME_RATE:
351 case FilmProperty::CONTAINER:
352 case FilmProperty::RESOLUTION:
353 setup_description ();
354 setup_sensitivity ();
356 case FilmProperty::REEL_TYPE:
357 case FilmProperty::INTEROP:
358 setup_sensitivity ();
367 hash_value (boost::optional<ColourConversion> const & c)
369 boost::hash<string> hasher;
371 return hasher ("none");
373 return hasher (c->identifier());
378 VideoPanel::film_content_changed (int property)
380 auto vc = _parent->selected_video ();
381 shared_ptr<Content> vcs;
382 shared_ptr<FFmpegContent> fcs;
385 fcs = dynamic_pointer_cast<FFmpegContent> (vcs);
388 if (property == ContentProperty::VIDEO_FRAME_RATE ||
389 property == VideoContentProperty::FRAME_TYPE ||
390 property == VideoContentProperty::CROP ||
391 property == VideoContentProperty::CUSTOM_RATIO ||
392 property == VideoContentProperty::CUSTOM_SIZE) {
393 setup_description ();
394 } else if (property == VideoContentProperty::COLOUR_CONVERSION) {
395 boost::unordered_set<optional<ColourConversion>> check;
397 check.insert (i->video->colour_conversion());
400 /* Remove any "Many" entry that we might have added previously. There should
401 * be entries for each preset plus one for "None" and one for "Custom".
403 auto cc = PresetColourConversion::all ();
404 if (_colour_conversion->GetCount() > cc.size() + 2) {
405 _colour_conversion->Delete (_colour_conversion->GetCount() - 1);
408 if (check.size() == 1) {
409 if (vcs && vcs->video->colour_conversion ()) {
410 auto preset = vcs->video->colour_conversion().get().preset();
412 checked_set (_colour_conversion, preset.get() + 1);
414 checked_set (_colour_conversion, cc.size() + 1);
417 checked_set (_colour_conversion, 0);
419 } else if (check.size() > 1) {
420 /* Add a "many" entry and select it as an indication that multiple different
421 * colour conversions are present in the selection.
423 _colour_conversion->Append (_("Many"));
424 checked_set (_colour_conversion, _colour_conversion->GetCount() - 1);
427 setup_sensitivity ();
429 } else if (property == VideoContentProperty::USE) {
430 setup_sensitivity ();
431 } else if (property == VideoContentProperty::FADE_IN) {
434 check.insert (i->video->fade_in ());
437 if (check.size() == 1) {
439 ContentTime::from_frames (vc.front()->video->fade_in(), vc.front()->active_video_frame_rate(_parent->film())),
440 vc.front()->active_video_frame_rate(_parent->film())
445 } else if (property == VideoContentProperty::FADE_OUT) {
448 check.insert (i->video->fade_out ());
451 if (check.size() == 1) {
453 ContentTime::from_frames (vc.front()->video->fade_out(), vc.front()->active_video_frame_rate(_parent->film())),
454 vc.front()->active_video_frame_rate(_parent->film())
459 } else if (property == DCPContentProperty::REFERENCE_VIDEO) {
460 if (vc.size() == 1) {
461 shared_ptr<DCPContent> dcp = dynamic_pointer_cast<DCPContent> (vc.front ());
462 checked_set (_reference, dcp ? dcp->reference_video () : false);
464 checked_set (_reference, false);
467 setup_sensitivity ();
468 } else if (property == VideoContentProperty::RANGE) {
470 checked_set (_range, vcs->video->range() == VideoRange::FULL ? 0 : 1);
472 checked_set (_range, 0);
475 setup_sensitivity ();
476 } else if (property == VideoContentProperty::CUSTOM_RATIO || property == VideoContentProperty::CUSTOM_SIZE) {
479 check.insert (i->video->custom_ratio() || i->video->custom_size());
482 if (check.size() == 1) {
483 checked_set (_scale_fit, !vc.front()->video->custom_ratio() && !vc.front()->video->custom_size());
484 checked_set (_scale_custom, vc.front()->video->custom_ratio() || vc.front()->video->custom_size());
486 checked_set (_scale_fit, true);
487 checked_set (_scale_custom, false);
489 setup_sensitivity ();
495 VideoPanel::setup_description ()
497 auto vc = _parent->selected_video ();
499 checked_set (_description, wxT (""));
501 } else if (vc.size() > 1) {
502 checked_set (_description, _("Multiple content selected"));
506 auto d = vc.front()->video->processing_description(_parent->film());
507 size_t lines = count (d.begin(), d.end(), '\n');
509 for (int i = lines; i < 6; ++i) {
513 checked_set (_description, d);
519 VideoPanel::colour_conversion_changed ()
521 auto vc = _parent->selected_video ();
523 int const s = _colour_conversion->GetSelection ();
524 auto all = PresetColourConversion::all ();
526 if (s == int(all.size() + 1)) {
527 edit_colour_conversion_clicked ();
529 for (auto i: _parent->selected_video()) {
531 i->video->unset_colour_conversion ();
532 } else if (s != int(all.size() + 2)) {
533 i->video->set_colour_conversion (all[s - 1].conversion);
541 VideoPanel::edit_colour_conversion_clicked ()
543 auto vc = _parent->selected_video ();
545 ContentColourConversionDialog dialog(this, vc.front()->video->yuv());
546 dialog.set(vc.front()->video->colour_conversion().get_value_or(PresetColourConversion::all().front().conversion));
547 if (dialog.ShowModal() == wxID_OK) {
549 i->video->set_colour_conversion(dialog.get());
552 /* Reset the colour conversion choice */
553 film_content_changed (VideoContentProperty::COLOUR_CONVERSION);
559 VideoPanel::content_selection_changed ()
561 auto video_sel = _parent->selected_video ();
563 _frame_type->set_content (video_sel);
564 _left_crop->set_content (video_sel);
565 _right_crop->set_content (video_sel);
566 _top_crop->set_content (video_sel);
567 _bottom_crop->set_content (video_sel);
569 film_content_changed (ContentProperty::VIDEO_FRAME_RATE);
570 film_content_changed (VideoContentProperty::CROP);
571 film_content_changed (VideoContentProperty::COLOUR_CONVERSION);
572 film_content_changed (VideoContentProperty::FADE_IN);
573 film_content_changed (VideoContentProperty::FADE_OUT);
574 film_content_changed (VideoContentProperty::RANGE);
575 film_content_changed (VideoContentProperty::USE);
576 film_content_changed (VideoContentProperty::CUSTOM_RATIO);
577 film_content_changed (VideoContentProperty::CUSTOM_SIZE);
578 film_content_changed (FFmpegContentProperty::FILTERS);
579 film_content_changed (DCPContentProperty::REFERENCE_VIDEO);
581 setup_sensitivity ();
586 VideoPanel::setup_sensitivity ()
588 auto sel = _parent->selected ();
590 shared_ptr<DCPContent> dcp;
591 if (sel.size() == 1) {
592 dcp = dynamic_pointer_cast<DCPContent> (sel.front ());
596 bool const can_reference = dcp && dcp->can_reference_video (_parent->film(), why_not);
598 if (why_not.empty()) {
599 cannot = _("Cannot reference this DCP's video.");
601 cannot = _("Cannot reference this DCP's video: ") + std_to_wx(why_not);
603 setup_refer_button (_reference, _reference_note, dcp, can_reference, cannot);
605 bool any_use = false;
606 for (auto i: _parent->selected_video()) {
607 if (i->video && i->video->use()) {
612 bool const enable = !_reference->GetValue() && any_use;
615 _frame_type->wrapped()->Enable (false);
616 _left_crop->wrapped()->Enable (false);
617 _right_crop->wrapped()->Enable (false);
618 _top_crop->wrapped()->Enable (false);
619 _bottom_crop->wrapped()->Enable (false);
620 _fade_in->Enable (false);
621 _fade_out->Enable (false);
622 _scale_fit->Enable (false);
623 _scale_custom->Enable (false);
624 _scale_custom_edit->Enable (false);
625 _description->Enable (false);
626 _colour_conversion->Enable (false);
627 _range->Enable (false);
629 auto video_sel = _parent->selected_video ();
630 auto ffmpeg_sel = _parent->selected_ffmpeg ();
631 bool const single = video_sel.size() == 1;
633 _frame_type->wrapped()->Enable (true);
634 _left_crop->wrapped()->Enable (true);
635 _right_crop->wrapped()->Enable (true);
636 _top_crop->wrapped()->Enable (true);
637 _bottom_crop->wrapped()->Enable (true);
638 _fade_in->Enable (!video_sel.empty ());
639 _fade_out->Enable (!video_sel.empty ());
640 _scale_fit->Enable (true);
641 _scale_custom->Enable (true);
642 _scale_custom_edit->Enable (_scale_custom->GetValue());
643 _description->Enable (true);
644 _colour_conversion->Enable (!video_sel.empty());
645 _range->Enable (single && !video_sel.empty() && !dcp);
648 auto vc = _parent->selected_video ();
649 shared_ptr<Content> vcs;
654 if (vcs && vcs->video->colour_conversion ()) {
655 _edit_colour_conversion_button->Enable (!vcs->video->colour_conversion().get().preset());
657 _edit_colour_conversion_button->Enable (false);
663 VideoPanel::fade_in_changed ()
665 auto const hmsf = _fade_in->get();
666 for (auto i: _parent->selected_video()) {
667 auto const vfr = i->active_video_frame_rate(_parent->film());
668 i->video->set_fade_in (dcpomatic::ContentTime(hmsf, vfr).frames_round(vfr));
674 VideoPanel::fade_out_changed ()
676 auto const hmsf = _fade_out->get();
677 for (auto i: _parent->selected_video()) {
678 auto const vfr = i->active_video_frame_rate (_parent->film());
679 i->video->set_fade_out (dcpomatic::ContentTime(hmsf, vfr).frames_round(vfr));
685 VideoPanel::reference_clicked ()
687 auto c = _parent->selected ();
692 auto d = dynamic_pointer_cast<DCPContent> (c.front ());
697 d->set_reference_video (_reference->GetValue ());
702 VideoPanel::scale_fit_clicked ()
704 for (auto i: _parent->selected_video()) {
705 i->video->set_custom_ratio (optional<float>());
706 i->video->set_custom_size (optional<dcp::Size>());
709 setup_sensitivity ();
714 VideoPanel::scale_custom_clicked ()
716 if (!scale_custom_edit_clicked()) {
717 _scale_fit->SetValue (true);
720 setup_sensitivity ();
725 VideoPanel::scale_custom_edit_clicked ()
727 auto vc = _parent->selected_video().front()->video;
728 CustomScaleDialog dialog(this, vc->size(), _parent->film()->frame_size(), vc->custom_ratio(), vc->custom_size());
729 if (dialog.ShowModal() != wxID_OK) {
733 for (auto i: _parent->selected_video()) {
734 i->video->set_custom_ratio(dialog.custom_ratio());
735 i->video->set_custom_size(dialog.custom_size());
743 VideoPanel::left_right_link_clicked ()
745 if (_left_changed_last) {
746 left_crop_changed ();
748 right_crop_changed ();
754 VideoPanel::top_bottom_link_clicked ()
756 if (_top_changed_last) {
759 bottom_crop_changed ();
765 VideoPanel::left_crop_changed ()
767 _left_changed_last = true;
768 if (_left_right_link->GetValue()) {
769 for (auto const& i: _parent->selected_video()) {
770 i->video->set_right_crop (i->video->requested_left_crop());
777 VideoPanel::right_crop_changed ()
779 _left_changed_last = false;
780 if (_left_right_link->GetValue()) {
781 for (auto const& i: _parent->selected_video()) {
782 i->video->set_left_crop (i->video->requested_right_crop());
789 VideoPanel::top_crop_changed ()
791 _top_changed_last = true;
792 if (_top_bottom_link->GetValue()) {
793 for (auto i: _parent->selected_video()) {
794 i->video->set_bottom_crop (i->video->requested_top_crop());
801 VideoPanel::bottom_crop_changed ()
803 _top_changed_last = false;
804 if (_top_bottom_link->GetValue()) {
805 for (auto i: _parent->selected_video()) {
806 i->video->set_top_crop (i->video->requested_bottom_crop());