From 7ac273eca0039c148f82cb3812320377f4fb634d Mon Sep 17 00:00:00 2001 From: Thomas Goyne Date: Sun, 31 Jan 2010 18:49:37 +0000 Subject: [PATCH] Fix problems with how VideoDisplay's size was being set resulting in the border being subtracted from the video size and the video always taking up the full width of the box even at very low zoom levels. Updates #1137, #1140. Originally committed to SVN as r4077. --- aegisub/src/video_display.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/aegisub/src/video_display.cpp b/aegisub/src/video_display.cpp index 1fe10cdc4..6a9f29b04 100644 --- a/aegisub/src/video_display.cpp +++ b/aegisub/src/video_display.cpp @@ -387,11 +387,24 @@ void VideoDisplay::UpdateSize() { if (con->GetAspectRatioType() == 0) w = int(con->GetWidth() * zoomValue); else w = int(con->GetHeight() * zoomValue * con->GetAspectRatioValue()); h = int(con->GetHeight() * zoomValue); - SetSizeHints(w,h,w,h); + + // Sizers ignore SetClientSize/SetSize, so only use them to calculate + // what size is required after including the borders + SetClientSize(w,h); + GetSize(&w,&h); + wxSize size(w,h); + SetMinSize(size); + SetMaxSize(size); locked = true; box->VideoSizer->Fit(box); box->GetParent()->Layout(); + + // The sizer makes us use the full width, which at very low zoom levels + // results in stretched video, so after using the sizer to update the + // parent window sizes, reset our size to the correct value + SetSize(w,h); + locked = false; } Refresh(false);