+
+
+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>());
+ }
+}
+
+
+void
+VideoPanel::scale_custom_clicked ()
+{
+ if (!scale_custom_edit_clicked()) {
+ _scale_fit->SetValue (true);
+ }
+}
+
+
+bool
+VideoPanel::scale_custom_edit_clicked ()
+{
+ auto vc = _parent->selected_video().front()->video;
+ auto d = new CustomScaleDialog (this, vc->size(), _parent->film()->frame_size(), vc->custom_ratio(), vc->custom_size());
+ int const r = d->ShowModal ();
+ if (r == wxID_OK) {
+ for (auto i: _parent->selected_video()) {
+ i->video->set_custom_ratio (d->custom_ratio());
+ i->video->set_custom_size (d->custom_size());
+ }
+ }
+ d->Destroy ();
+ return r == wxID_OK;
+}
+
+
+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->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->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->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->bottom_crop());
+ }
+ }
+}
+
+
+