From: Carl Hetherington Date: Wed, 10 Jul 2013 12:09:52 +0000 (+0100) Subject: Make scaling description work again. X-Git-Tag: v2.0.48~1337^2~281 X-Git-Url: https://git.carlh.net/gitweb/?a=commitdiff_plain;h=adb9882ec12fecb0bbb1925a46c8e63368f9e2b5;p=dcpomatic.git Make scaling description work again. --- diff --git a/src/wx/film_editor.cc b/src/wx/film_editor.cc index 9947c90a7..315951168 100644 --- a/src/wx/film_editor.cc +++ b/src/wx/film_editor.cc @@ -724,6 +724,7 @@ FilmEditor::film_content_changed (weak_ptr weak_content, int property) } else { checked_set (_ratio, -1); } + setup_scaling_description (); } else if (property == AudioContentProperty::AUDIO_GAIN) { checked_set (_audio_gain, audio_content ? audio_content->audio_gain() : 0); } else if (property == AudioContentProperty::AUDIO_DELAY) { @@ -1272,24 +1273,30 @@ FilmEditor::selected_audio_content () void FilmEditor::setup_scaling_description () { + shared_ptr vc = selected_video_content (); + if (!vc) { + _scaling_description->SetLabel (""); + return; + } + wxString d; -#if 0 -XXX int lines = 0; - if (_film->video_size().width && _film->video_size().height) { + if (vc->video_size().width && vc->video_size().height) { d << wxString::Format ( _("Original video is %dx%d (%.2f:1)\n"), - _film->video_size().width, _film->video_size().height, - float (_film->video_size().width) / _film->video_size().height + vc->video_size().width, vc->video_size().height, + float (vc->video_size().width) / vc->video_size().height ); ++lines; } - Crop const crop = _film->crop (); - if ((crop.left || crop.right || crop.top || crop.bottom) && _film->size() != libdcp::Size (0, 0)) { - libdcp::Size const cropped = _film->cropped_size (_film->size ()); + Crop const crop = vc->crop (); + if ((crop.left || crop.right || crop.top || crop.bottom) && vc->video_size() != libdcp::Size (0, 0)) { + libdcp::Size cropped = vc->video_size (); + cropped.width -= crop.left + crop.right; + cropped.height -= crop.top + crop.bottom; d << wxString::Format ( _("Cropped to %dx%d (%.2f:1)\n"), cropped.width, cropped.height, @@ -1298,11 +1305,11 @@ XXX ++lines; } - Format const * format = _film->format (); - if (format) { - int const padding = format->dcp_padding (_film); - libdcp::Size scaled = format->dcp_size (); - scaled.width -= padding * 2; + Ratio const * ratio = vc->ratio (); + if (ratio) { + libdcp::Size container_size = _film->container()->size (_film->full_frame ()); + + libdcp::Size const scaled = ratio->size (container_size); d << wxString::Format ( _("Scaled to %dx%d (%.2f:1)\n"), scaled.width, scaled.height, @@ -1310,11 +1317,11 @@ XXX ); ++lines; - if (padding) { + if (scaled != container_size) { d << wxString::Format ( _("Padded with black to %dx%d (%.2f:1)\n"), - format->dcp_size().width, format->dcp_size().height, - float (format->dcp_size().width) / format->dcp_size().height + container_size.width, container_size.height, + float (container_size.width) / container_size.height ); ++lines; } @@ -1324,7 +1331,6 @@ XXX d << wxT ("\n "); } -#endif _scaling_description->SetLabel (d); }