From ec55700a5b87ba7f954bb93675888923efa2aed8 Mon Sep 17 00:00:00 2001 From: dynaflash Date: Sat, 20 Jun 2009 03:55:17 +0000 Subject: [PATCH] MacGui: Fix Scale To Screen when in full screen mode. - Note: still a bit of a bug when switching sizes from the picture size inspector and in scale to screen. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2584 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- macosx/English.lproj/PicturePreview.xib | 4 +-- macosx/HBPreviewController.mm | 45 ++++++++++++++++++++----- 2 files changed, 38 insertions(+), 11 deletions(-) diff --git a/macosx/English.lproj/PicturePreview.xib b/macosx/English.lproj/PicturePreview.xib index 8c37f42e7..fc3a7cb4b 100644 --- a/macosx/English.lproj/PicturePreview.xib +++ b/macosx/English.lproj/PicturePreview.xib @@ -2,9 +2,9 @@ 1050 - 9G55 + 9J61 677 - 949.43 + 949.46 353.00 YES diff --git a/macosx/HBPreviewController.mm b/macosx/HBPreviewController.mm index f6ab2ac45..29beeb290 100644 --- a/macosx/HBPreviewController.mm +++ b/macosx/HBPreviewController.mm @@ -304,8 +304,9 @@ return YES; viewSize.width = viewSize.width - (viewSize.width - imageScaledSize.width); viewSize.height = viewSize.height - (viewSize.height - imageScaledSize.height); [fPreviewImage setSize: viewSize]; - [fPictureView setFrameSize: viewSize]; + //[fPictureView setFrameSize: viewSize]; } + else { [fPreviewImage setSize: imageScaledSize]; @@ -336,6 +337,13 @@ return YES; viewSize.height = viewSize.height - (viewSize.height - imageScaledSize.height); [self setViewSize:viewSize]; + /* special case for scaleToScreen */ + if (scaleToScreen == YES) + { + [fPreviewImage setSize: viewSize]; + [fPictureView setImage: fPreviewImage]; + } + NSString *scaleString; if( imageScaledSize.height > [fPictureView frame].size.height) @@ -533,6 +541,7 @@ return YES; else { [[fPictureControlBox animator] setHidden: YES]; + [self stopHudTimer]; } } @@ -662,7 +671,6 @@ return YES; /* make sure we are set to a still preview */ [self pictureSliderChanged:nil]; - //[fPreviewWindow setAcceptsMouseMovedEvents:NO]; [fFullScreenWindow setAcceptsMouseMovedEvents:YES]; @@ -1325,16 +1333,35 @@ return YES; // Assumes resizeSheetForViewSize: has already been called. // - (void)setViewSize: (NSSize)viewSize -{ +{ + /* special case for scaleToScreen */ + if (scaleToScreen == YES) + { + /* for scaleToScreen, we expand the fPictureView to fit the entire screen */ + NSSize areaSize = [fPictureViewArea frame].size; + CGFloat viewSizeAspect = viewSize.width / viewSize.height; + if (viewSizeAspect > 1.0) // we are wider than taller, so expand the width to fill the area and scale the height + { + viewSize.width = areaSize.width; + viewSize.height = viewSize.width / viewSizeAspect; + } + else + { + viewSize.height = areaSize.height; + viewSize.width = viewSize.height * viewSizeAspect; + } + + } + [fPictureView setFrameSize:viewSize]; - // center it vertically and horizontally + // center it vertically and horizontally NSPoint origin = [fPictureViewArea frame].origin; origin.y += ([fPictureViewArea frame].size.height - [fPictureView frame].size.height) / 2.0; - - origin.x += ([fPictureViewArea frame].size.width - - [fPictureView frame].size.width) / 2.0; + + origin.x += ([fPictureViewArea frame].size.width - + [fPictureView frame].size.width) / 2.0; [fPictureView setFrameOrigin:origin]; @@ -1344,8 +1371,8 @@ return YES; controlboxorigin.y += 100; controlboxorigin.x += ([fPictureViewArea frame].size.width - - [fPictureControlBox frame].size.width) / 2.0; - + [fPictureControlBox frame].size.width) / 2.0; + /* origin should be rounded to integer otherwise font/antialiasing * may be blurry. -- 2.40.0