+
+
+void
+VideoPanel::scale_fit_clicked ()
+{
+ for (auto i: _parent->selected_video()) {
+ i->video->set_custom_ratio (optional<float>());
+ i->video->set_custom_size (optional<dcp::Size>());
+ }
+
+ setup_sensitivity ();
+}
+
+
+void
+VideoPanel::scale_custom_clicked ()
+{
+ if (!scale_custom_edit_clicked()) {
+ _scale_fit->SetValue (true);
+ }
+
+ setup_sensitivity ();
+}
+
+
+bool
+VideoPanel::scale_custom_edit_clicked ()
+{
+ auto vc = _parent->selected_video().front()->video;
+ CustomScaleDialog dialog(this, vc->size(), _parent->film()->frame_size(), vc->custom_ratio(), vc->custom_size());
+ if (dialog.ShowModal() != wxID_OK) {
+ return false;
+ }
+
+ for (auto i: _parent->selected_video()) {
+ i->video->set_custom_ratio(dialog.custom_ratio());
+ i->video->set_custom_size(dialog.custom_size());
+ }
+
+ return true;
+}
+
+
+void
+VideoPanel::left_right_link_clicked ()
+{
+ if (_left_changed_last) {
+ left_crop_changed ();
+ } else {
+ right_crop_changed ();
+ }
+}
+
+
+void
+VideoPanel::top_bottom_link_clicked ()
+{
+ if (_top_changed_last) {
+ top_crop_changed ();
+ } else {
+ bottom_crop_changed ();
+ }
+}
+
+
+void
+VideoPanel::left_crop_changed ()
+{
+ _left_changed_last = true;
+ if (_left_right_link->GetValue()) {
+ for (auto i: _parent->selected_video()) {
+ i->video->set_right_crop (i->video->requested_left_crop());
+ }
+ }
+}
+
+
+void
+VideoPanel::right_crop_changed ()
+{
+ _left_changed_last = false;
+ if (_left_right_link->GetValue()) {
+ for (auto i: _parent->selected_video()) {
+ i->video->set_left_crop (i->video->requested_right_crop());
+ }
+ }
+}
+
+
+void
+VideoPanel::top_crop_changed ()
+{
+ _top_changed_last = true;
+ if (_top_bottom_link->GetValue()) {
+ for (auto i: _parent->selected_video()) {
+ i->video->set_bottom_crop (i->video->requested_top_crop());
+ }
+ }
+}
+
+
+void
+VideoPanel::bottom_crop_changed ()
+{
+ _top_changed_last = false;
+ if (_top_bottom_link->GetValue()) {
+ for (auto i: _parent->selected_video()) {
+ i->video->set_top_crop (i->video->requested_bottom_crop());
+ }
+ }
+}
+
+