X-Git-Url: http://git.osdn.jp/view?a=blobdiff_plain;f=macosx%2FHBPreviewController.m;h=764da459d7deed8381f2063ab74b7b1a47f70e63;hb=640252b369ae9159ee6c4de63e22e8e6755f2bdc;hp=750a68c4eee327f637748c13f8a1a7f32547a31b;hpb=4c6ed6bcc7a7d8a1fe9384f0e9717b071545660e;p=handbrake-jp%2Fhandbrake-jp-git.git diff --git a/macosx/HBPreviewController.m b/macosx/HBPreviewController.m index 750a68c4..764da459 100644 --- a/macosx/HBPreviewController.m +++ b/macosx/HBPreviewController.m @@ -83,7 +83,6 @@ //[self pictureSliderChanged:nil]; [self startReceivingLibhbNotifications]; - isFullScreen = NO; hudTimerSeconds = 0; /* we set the progress indicator to not use threaded animation * as it causes a conflict with the qtmovieview's controllerbar @@ -134,7 +133,6 @@ [fMovieView setHidden:YES]; [fMovieView setMovie:nil]; - isFullScreen = NO; hudTimerSeconds = 0; [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"PreviewWindowIsOpen"]; } @@ -161,6 +159,8 @@ [fPicturePreviews release]; [fFullScreenWindow release]; + + hb_close(&fPreviewLibhb); [super dealloc]; } @@ -211,14 +211,22 @@ fPicture = 0; MaxOutputWidth = title->width - job->crop[2] - job->crop[3]; MaxOutputHeight = title->height - job->crop[0] - job->crop[1]; + [self SettingsChanged: nil]; + + /* set the top of the hud controller boxes centered vertically with the origin of our window */ + NSPoint hudControlBoxOrigin = [fPictureControlBox frame].origin; + hudControlBoxOrigin.y = ([[self window] frame].size.height / 2) - [fPictureControlBox frame].size.height; + [fPictureControlBox setFrameOrigin:hudControlBoxOrigin]; + [fEncodingControlBox setFrameOrigin:hudControlBoxOrigin]; + } // Adjusts the window to draw the current picture (fPicture) adjusting its size as // necessary to display as much of the picture as possible. -- (void) displayPreview +- (void) displayPreview { hb_job_t * job = fTitle->job; /* lets make sure that the still picture view is not hidden and that @@ -232,8 +240,6 @@ [fPictureView setHidden:NO]; - //[fHBController writeToActivityLog: "displayPreview called"]; - NSImage *fPreviewImage = [self imageForPicture: fPicture]; NSSize imageScaledSize = [fPreviewImage size]; [fPictureView setImage: fPreviewImage]; @@ -276,7 +282,7 @@ @"Source: %dx%d, Output: %dx%d, Anamorphic: %dx%d Custom", fTitle->width, fTitle->height, output_width, output_height, fTitle->job->anamorphic.dar_width, fTitle->job->anamorphic.dar_height]; - displaySize.width = fTitle->job->anamorphic.dar_width + fTitle->job->crop[2] + fTitle->job->crop[3]; + displaySize.width = fTitle->job->anamorphic.dar_width + fTitle->job->crop[2] + fTitle->job->crop[3] ; displaySize.height = fTitle->job->anamorphic.dar_height + fTitle->job->crop[0] + fTitle->job->crop[1]; imageScaledSize.width = (int)fTitle->job->anamorphic.dar_width; imageScaledSize.height = (int)fTitle->job->height; @@ -286,74 +292,109 @@ sizeInfoString = [NSString stringWithFormat: @"Source: %dx%d, Output: %dx%d", fTitle->width, fTitle->height, fTitle->job->width, fTitle->job->height]; - + displaySize.width = fTitle->width; displaySize.height = fTitle->height; imageScaledSize.width = fTitle->job->width; imageScaledSize.height = fTitle->job->height; } + + NSSize viewSize = [self optimalViewSizeForImageSize:displaySize]; + [self resizeSheetForViewSize:viewSize]; + + NSSize windowSize = [[self window] frame].size; - /* Initially set our preview image here */ - /* if (scaleToScreen == YES) { - viewSize.width = viewSize.width - (viewSize.width - imageScaledSize.width); - viewSize.height = viewSize.height - (viewSize.height - imageScaledSize.height); - [fPreviewImage setSize: viewSize]; - //[fPictureView setFrameSize: viewSize]; + /* Note: this should probably become a utility function */ + /* We are in Scale To Screen mode so, we have to get the ratio for height and width against the window + *size so we can scale from there. + */ + CGFloat deltaWidth = imageScaledSize.width / displaySize.width; + CGFloat deltaHeight = imageScaledSize.height /displaySize.height; + NSSize windowSize = [[self window] frame].size; + CGFloat pictureAspectRatio = imageScaledSize.width / imageScaledSize.height; + + /* Set our min size to the storage size */ + NSSize minSize; + minSize.width = fTitle->width; + minSize.height = fTitle->height; + + /* Set delta's based on minimum size */ + if (imageScaledSize.width < minSize.width) + { + deltaWidth = imageScaledSize.width / minSize.width; + } + else + { + deltaWidth = 1.0; + } + + if (imageScaledSize.height < minSize.height) + { + deltaHeight = imageScaledSize.height / minSize.height; + } + else + { + deltaHeight = 1.0; + } + + /* Now apply our deltas to the full screen view */ + if (pictureAspectRatio > 1.0) // we are wider than taller, so expand the width to fill the area and scale the height + { + viewSize.width = windowSize.width * deltaWidth; + viewSize.height = viewSize.width / pictureAspectRatio; + + } + else + { + viewSize.height = windowSize.height * deltaHeight; + viewSize.width = viewSize.height * pictureAspectRatio; + } + } - else { - [fPreviewImage setSize: imageScaledSize]; - [fPictureView setFrameSize: imageScaledSize]; - } - [fPictureView setImage: fPreviewImage]; - // 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; - [fPictureView setFrameOrigin:origin]; - */ - /* we also need to take into account scaling to full screen to activate switching the view size */ - if( [self viewNeedsToResizeToSize:viewSize]) - { - if (fTitle->job->anamorphic.mode != 2 || (fTitle->job->anamorphic.mode == 2 && fTitle->width == fTitle->job->width)) + viewSize.width = viewSize.width - (viewSize.width - imageScaledSize.width); + viewSize.height = viewSize.height - (viewSize.height - imageScaledSize.height); + + if (fTitle->width > windowSize.width || fTitle->height > windowSize.height) { - [self resizeSheetForViewSize:viewSize]; - //[self setViewSize:viewSize]; - + 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 = viewSize.width * (windowSize.width / fTitle->width) ; + viewSize.height = viewSize.width / viewSizeAspect; + } + else + { + viewSize.height = viewSize.height * (windowSize.height / fTitle->height); + viewSize.width = viewSize.height * viewSizeAspect; + } } - } - - viewSize.width = viewSize.width - (viewSize.width - imageScaledSize.width); - viewSize.height = viewSize.height - (viewSize.height - imageScaledSize.height); - [self setViewSize:viewSize]; - - /* special case for scaleToScreen */ - if (scaleToScreen == YES) - { - [fPreviewImage setSize: viewSize]; - [fPictureView setImage: fPreviewImage]; + } + [self setViewSize:viewSize]; + NSString *scaleString; - - if( imageScaledSize.height > [fPictureView frame].size.height) + CGFloat scale = ( ( CGFloat )[fPictureView frame].size.width) / ( ( CGFloat )imageScaledSize.width); + if (scale * 100.0 != 100) { - CGFloat scale = ( ( CGFloat )[fPictureView frame].size.width) / ( ( CGFloat )imageScaledSize.width); scaleString = [NSString stringWithFormat: - NSLocalizedString( @" (Scaled to %.0f%% actual size)", + NSLocalizedString( @" (%.0f%% actual size)", @"String shown when a preview is scaled" ), scale * 100.0]; } else { - scaleString = @""; + scaleString = @"(Actual size)"; + } + + if (scaleToScreen == YES) + { + scaleString = [scaleString stringByAppendingString:@" Scaled To Screen"]; } /* Set the info fields in the hud controller */ [fInfoField setStringValue: [NSString stringWithFormat: @@ -409,7 +450,6 @@ [self showWindow:sender]; [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"PreviewWindowIsOpen"]; [fPreviewWindow setAcceptsMouseMovedEvents:YES]; - isFullScreen = NO; scaleToScreen = NO; [self pictureSliderChanged:nil]; } @@ -479,19 +519,7 @@ } } -#pragma mark Fullscreen Mode -- (IBAction)toggleScreenMode:(id)sender -{ - if (!isFullScreen) - { - [self goFullScreen:nil]; - } - else - { - [self goWindowedScreen:nil]; - } -} - (IBAction)toggleScaleToScreen:(id)sender { @@ -500,116 +528,19 @@ scaleToScreen = NO; /* make sure we are set to a still preview */ [self pictureSliderChanged:nil]; - [fScaleToScreenToggleButton setTitle:@"<->"]; + [fScaleToScreenToggleButton setTitle:@"Scale To Screen"]; } else { scaleToScreen = YES; /* make sure we are set to a still preview */ [self pictureSliderChanged:nil]; - [fScaleToScreenToggleButton setTitle:@">-<"]; + [fScaleToScreenToggleButton setTitle:@"Actual Scale"]; } + } -- (BOOL)fullScreen -{ - return isFullScreen; -} -- (IBAction)goFullScreen:(id)sender -{ - // Get the screen information. - NSScreen* mainScreen = [fPreviewWindow screen]; - NSDictionary* screenInfo = [mainScreen deviceDescription]; - NSNumber* screenID = [screenInfo objectForKey:@"NSScreenNumber"]; - // Capture the screen. - CGDirectDisplayID displayID = (CGDirectDisplayID)[screenID longValue]; - CGDisplayErr err = CGDisplayCapture(displayID); - - if (err == CGDisplayNoErr) - { - - /* make sure we are set to a still preview and not scaled to screen */ - scaleToScreen = NO; - [self pictureSliderChanged:nil]; - - // Create the full-screen window. - //NSRect winRect = [mainScreen frame]; - //fPictureViewArea - NSRect winRect = [fPictureViewArea frame]; - - fFullScreenWindow = [[NSWindow alloc] initWithContentRect:winRect - styleMask:NSBorderlessWindowMask - backing:NSBackingStoreBuffered - defer:NO - screen:mainScreen]; - - // Establish the window attributes. - [fFullScreenWindow setReleasedWhenClosed:NO]; - [fFullScreenWindow setDisplaysWhenScreenProfileChanges:YES]; - [fFullScreenWindow setDelegate:self]; - - /* insert a view into the new window */ - [fFullScreenWindow setContentView:fPictureViewArea]; - [fPictureViewArea setNeedsDisplay:YES]; - - /* Better to center the window using the screen's frame - * and the windows origin. Note that we should take into - * account the auto sizing and alignment that occurs in - * setViewSize each time the preview changes. - * Note: by using [fFullScreenWindow screen] (instead of - * [NSScreen mainScreen]) in referencing the screen - * coordinates, the full screen window will show up on - * whichever display was being used in windowed mode - * on multi-display systems - */ - - NSSize screenSize = [[fFullScreenWindow screen] frame].size; - NSSize windowSize = [fFullScreenWindow frame].size; - NSPoint windowOrigin = [fFullScreenWindow frame].origin; - - /* Adjust our origin y (vertical) based on the screen height */ - windowOrigin.y += (screenSize.height - windowSize.height) / 2.0; - windowOrigin.x += (screenSize.width - windowSize.width) / 2.0; - - [fFullScreenWindow setFrameOrigin:windowOrigin]; - - /* lets kill the timer for now */ - [self stopReceivingLibhbNotifications]; - - /* We need to retain the fPreviewWindow */ - [fPreviewWindow retain]; - - [self setWindow:fFullScreenWindow]; - - // The window has to be above the level of the shield window. - int32_t shieldLevel = CGShieldingWindowLevel(); - - [fFullScreenWindow setLevel:shieldLevel]; - - // Show the window. - [fFullScreenWindow makeKeyAndOrderFront:self]; - - - /* Change the name of fFullScreenToggleButton appropriately */ - [fFullScreenToggleButton setTitle: @"Windowed"]; - - /* Lets fire the timer back up for the hud controls, etc. */ - [self startReceivingLibhbNotifications]; - - isFullScreen = YES; - [fScaleToScreenToggleButton setHidden:NO]; - - /* make sure we are set to a still preview */ - [self pictureSliderChanged:nil]; - - [fFullScreenWindow setAcceptsMouseMovedEvents:YES]; - - - hudTimerSeconds = 0; - [self startHudTimer]; - } -} // Title-less windows normally don't receive key presses, override this - (BOOL)canBecomeKeyWindow @@ -655,14 +586,14 @@ [fPreviewWindow setLevel:NSNormalWindowLevel]; /* Set the isFullScreen flag back to NO */ - isFullScreen = NO; + //isFullScreen = NO; scaleToScreen = NO; /* make sure we are set to a still preview */ [self pictureSliderChanged:nil]; [self showPreviewWindow:nil]; /* Change the name of fFullScreenToggleButton appropriately */ - [fFullScreenToggleButton setTitle: @"Full Screen"]; + //[fFullScreenToggleButton setTitle: @"Full Screen"]; // [fScaleToScreenToggleButton setHidden:YES]; /* set the picture settings pallete back to normal level */ [fHBController picturePanelWindowed]; @@ -993,8 +924,6 @@ [fMovieCreationProgressIndicator setHidden: YES]; [fEncodingControlBox setHidden: YES]; isEncoding = NO; - /* we make sure the picture slider and preview match */ - [self pictureSliderChanged:nil]; // Show the movie view [self showMoviePreview:fPreviewMoviePath]; @@ -1013,9 +942,10 @@ * we retain the gray cropping border we have already established * with the still previews */ - + /* Load the new movie into fMovieView */ - if (path) { + if (path) + { QTMovie * aMovie; NSError *outError; NSURL *movieUrl = [NSURL fileURLWithPath:path]; @@ -1027,76 +957,74 @@ [NSNumber numberWithBool:NO], @"QTMovieOpenAsyncOKAttribute", QTMovieApertureModeClean, QTMovieApertureModeAttribute, nil]; - + aMovie = [[[QTMovie alloc] initWithAttributes:movieAttributes error:&outError] autorelease]; - - if (!aMovie) { + + if (!aMovie) + { NSLog(@"Unable to open movie"); } - else { + else + { NSRect movieBounds; /* we get some size information from the preview movie */ NSSize movieSize= [[aMovie attributeForKey:QTMovieNaturalSizeAttribute] sizeValue]; movieBounds = [fMovieView movieBounds]; movieBounds.size.height = movieSize.height; - - if ([fMovieView isControllerVisible]) { + /* We also get our view size to use for scaling fMovieView's size */ + NSSize scaledMovieViewSize = [fPictureView frame].size; + if ([fMovieView isControllerVisible]) + { CGFloat controllerBarHeight = [fMovieView controllerBarHeight]; if ( controllerBarHeight != 0 ) //Check if QTKit return a real value or not. + { movieBounds.size.height += controllerBarHeight; + scaledMovieViewSize.height += controllerBarHeight; + } else + { movieBounds.size.height += 15; + scaledMovieViewSize.height += 15; + } } movieBounds.size.width = movieSize.width; - /* We need to find out if the preview movie needs to be scaled down so - * that it doesn't overflow our available viewing container (just like for image - * in -displayPreview) for HD sources, etc. [fPictureViewArea frame].size.height*/ - if( (movieBounds.size.height) > [fPictureViewArea frame].size.height || scaleToScreen == YES ) + /* we need to account for an issue where the scaledMovieViewSize > the window size */ + if (scaledMovieViewSize.height > [[self window] frame].size.height) { - /* The preview movie would be larger than the available viewing area - * in the preview movie, so we go ahead and scale it down to the same size - * as the still preview or we readjust our window to allow for the added height if need be + [fHBController writeToActivityLog: "showMoviePreview: Our window is not tall enough to show the controller bar ..."]; + /*we need to scale the movie down vertically by 15 px to allow for the controller bar + * and scale the width accordingly. */ - NSSize displaySize = NSMakeSize( ( CGFloat ) movieBounds.size.width, ( CGFloat ) movieBounds.size.height ); - NSSize viewSize = [self optimalViewSizeForImageSize:displaySize]; - if( [self viewNeedsToResizeToSize:viewSize] ) { - [self resizeSheetForViewSize:viewSize]; - [self setViewSize:viewSize]; - } - [fMovieView setFrameSize:viewSize]; - } - else - { - /* Since the preview movie is smaller than the available viewing area - * we can go ahead and use the preview movies native size */ - [fMovieView setFrameSize:movieBounds.size]; + + // FIX ME: currently trying to scale everything to show the controller bar does not work right. + // Commented out til fixed, resulting issue when the movie is the full size of the window is no + // controller bar is visible. Live Preview still plays fine though. + /* + CGFloat pictureAspectRatio = scaledMovieViewSize.width / scaledMovieViewSize.height; + scaledMovieViewSize.height = [[self window] frame].size.height - 15; + scaledMovieViewSize.width = scaledMovieViewSize.height * pictureAspectRatio; + NSRect windowFrame = [[self window] frame]; + windowFrame.size.width = scaledMovieViewSize.width; + windowFrame.size.height = scaledMovieViewSize.height + 15; + [[self window] setFrame:windowFrame display:YES animate:YES]; + [fPictureView setFrameSize:scaledMovieViewSize]; + */ } - //lets reposition the movie if need be - NSPoint origin = [fPictureViewArea frame].origin; - origin.x += trunc( ( [fPictureViewArea frame].size.width - + + /* Scale the fMovieView to scaledMovieViewSize */ + [fMovieView setFrameSize:scaledMovieViewSize]; + + /*set our origin try using fPictureViewArea or fPictureView */ + NSPoint origin = [fPictureView frame].origin; + origin.x += trunc( ( [fPictureView frame].size.width - [fMovieView frame].size.width ) / 2.0 ); - /* We need to detect whether or not we are currently less than the available height.*/ - if( movieBounds.size.height < [fPictureView frame].size.height ) - { - /* If we are, we are adding 15 to the height to allow for the controller bar so - * we need to subtract half of that for the origin.y to get the controller bar - * below the movie to it lines up vertically with where our still preview was - */ - origin.y += trunc( ( ( [fPictureViewArea frame].size.height - + origin.y += trunc( ( ( [fPictureView frame].size.height - [fMovieView frame].size.height ) / 2.0 ) - 7.5 ); - } - else - { - /* if we are >= to the height of the picture view area, the controller bar - * gets taken care of with picture resizing, so we do not want to offset the height - */ - origin.y += trunc( ( [fPictureViewArea frame].size.height - - [fMovieView frame].size.height ) / 2.0 ); - } + [fMovieView setFrameOrigin:origin]; [fMovieView setMovie:aMovie]; [fMovieView setHidden:NO]; @@ -1119,31 +1047,37 @@ // - (NSSize)optimalViewSizeForImageSize: (NSSize)imageSize { - // The min size is 320x240 + // The min size is 480x360 CGFloat minWidth = 480.0; CGFloat minHeight = 360.0; - NSSize screenSize = [[NSScreen mainScreen] frame].size; + NSSize screenSize = [[[self window] screen] visibleFrame].size; NSSize sheetSize = [[self window] frame].size; NSSize viewAreaSize = [fPictureViewArea frame].size; - CGFloat paddingX = sheetSize.width - viewAreaSize.width; - CGFloat paddingY = sheetSize.height - viewAreaSize.height; - CGFloat maxWidth; - CGFloat maxHeight; + CGFloat paddingX = 0.00; + CGFloat paddingY = 0.00; - if (isFullScreen) - { - /* We are in full screen mode so lets use the full screen if we need to */ - maxWidth = screenSize.width - paddingX; - maxHeight = screenSize.height - paddingY; - } - else + if (fTitle->width > screenSize.width || fTitle->height > screenSize.height) { - // The max size of the view is when the sheet is taking up 85% of the screen. - maxWidth = (0.85 * screenSize.width) - paddingX; - maxHeight = (0.85 * screenSize.height) - paddingY; + if (scaleToScreen == YES) + { + paddingX = screenSize.width - imageSize.width; + paddingY = screenSize.height - imageSize.height; + } + + else + { + paddingX = sheetSize.width - viewAreaSize.width; + paddingY = sheetSize.height - viewAreaSize.height; + } + } + CGFloat maxWidth; + CGFloat maxHeight; + maxWidth = screenSize.width - paddingX; + maxHeight = screenSize.height - paddingY; + NSSize resultSize = imageSize; CGFloat resultPar = resultSize.width / resultSize.height; @@ -1151,7 +1085,7 @@ CGFloat screenAspect = screenSize.width / screenSize.height; // Note, a standard dvd will use 720 x 480 which is a 1.5 CGFloat viewAreaAspect = viewAreaSize.width / viewAreaSize.height; - + if (scaleToScreen == YES) { @@ -1193,8 +1127,8 @@ { resultSize.height = minHeight; } - - return resultSize; + + return resultSize; } @@ -1213,8 +1147,19 @@ // Now resize the whole panel by those same deltas, but don't exceed the min NSRect frame = [[self window] frame]; - NSSize maxSize = [[self window] maxSize]; - NSSize minSize = [[self window] minSize]; + NSSize maxSize = [[[self window] screen] visibleFrame].size; + /* if we are not Scale To Screen, put an 85% of visible screen on the window */ + if (scaleToScreen == NO ) + { + maxSize.width = maxSize.width * 0.85; + maxSize.height = maxSize.height * 0.85; + } + + /* Set our min size to the storage size */ + NSSize minSize; + minSize.width = fTitle->width; + minSize.height = fTitle->height; + frame.size.width += deltaX; frame.size.height += deltaY; if( frame.size.width < minSize.width ) @@ -1226,37 +1171,46 @@ { frame.size.height = minSize.height; } + /* compare frame to max size of screen */ + + if( frame.size.width > maxSize.width ) + { + frame.size.width = maxSize.width; + } + + if( frame.size.height > maxSize.height ) + { + frame.size.height = maxSize.height; + } + + + // But now the sheet is off-center, so also shift the origin to center it and // keep the top aligned. if( frame.size.width != [[self window] frame].size.width ) frame.origin.x -= (deltaX / 2.0); - if (isFullScreen) - { - if( frame.size.height != [[self window] frame].size.height ) - { - frame.origin.y -= (deltaY / 2.0); - } - else - { - if( frame.size.height != [[self window] frame].size.height ) - frame.origin.y -= deltaY; - } - [[self window] setFrame:frame display:YES animate:NO]; - } - else - { /* Since upon launch we can open up the preview window if it was open * the last time we quit (and at the size it was) we want to make * sure that upon resize we do not have the window off the screen * So check the origin against the screen origin and adjust if * necessary. */ - NSSize screenSize = [[[self window] screen] frame].size; + NSSize screenSize = [[[self window] screen] visibleFrame].size; NSPoint screenOrigin = [[[self window] screen] frame].origin; + if (screenSize.height < frame.size.height) + { + frame.size.height = screenSize.height; + } + if (screenSize.width < frame.size.width) + { + frame.size.width = screenSize.width; + } + + /* our origin is off the screen to the left*/ if (frame.origin.x < screenOrigin.x) { @@ -1270,7 +1224,7 @@ } [[self window] setFrame:frame display:YES animate:YES]; - } + } @@ -1282,12 +1236,16 @@ // - (void)setViewSize: (NSSize)viewSize { + /* special case for scaleToScreen */ - if (scaleToScreen == YES) + NSSize screenSize = [[[self window] screen] visibleFrame].size; + NSSize areaSize = [fPictureViewArea frame].size; + NSSize pictureSize = [fPictureView frame].size; + CGFloat viewSizeAspect = viewSize.width / viewSize.height; + + if (viewSize.width > areaSize.width || viewSize.height > areaSize.height) { - /* 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; @@ -1300,9 +1258,11 @@ } } - + [fPictureView setFrameSize:viewSize]; - + NSSize newAreaSize = [fPictureViewArea frame].size; + + // center it vertically and horizontally NSPoint origin = [fPictureViewArea frame].origin; origin.y += ([fPictureViewArea frame].size.height - @@ -1315,6 +1275,7 @@ origin.y = floor( origin.y ); [fPictureView setFrameOrigin:origin]; + }