Cocoa Port:

- Fix bugs with window resizing with certain configurations of display orientation and using a minimum display size of less than 1x.
This commit is contained in:
rogerman 2012-08-24 04:20:59 +00:00
parent 1a1f92877c
commit 1a48e36abb
2 changed files with 66 additions and 32 deletions

View File

@ -108,6 +108,7 @@
@property (assign) BOOL isSheetControllingExecution;
@property (assign) BOOL isShowingSaveStateSheet;
@property (assign) BOOL isShowingFileMigrationSheet;
@property (assign) BOOL isMinSizeNormal;
@property (assign) NSInteger selectedRomSaveTypeID;
@property (readonly) NSMutableDictionary *bindings;

View File

@ -60,6 +60,7 @@
@synthesize isSheetControllingExecution;
@synthesize isShowingSaveStateSheet;
@synthesize isShowingFileMigrationSheet;
@dynamic isMinSizeNormal;
@synthesize selectedRomSaveTypeID;
@synthesize bindings;
@ -292,6 +293,46 @@
return (NSString *)[bindings valueForKey:@"status"];
}
- (void) setIsMinSizeNormal:(BOOL)theState
{
isMinSizeNormal = theState;
if ([dispViewDelegate displayType] == DS_DISPLAY_TYPE_COMBO)
{
if ([dispViewDelegate displayOrientation] == DS_DISPLAY_ORIENTATION_HORIZONTAL)
{
minDisplayViewSize.width = GPU_DISPLAY_WIDTH * 2;
minDisplayViewSize.height = GPU_DISPLAY_HEIGHT;
}
else
{
minDisplayViewSize.width = GPU_DISPLAY_WIDTH;
minDisplayViewSize.height = GPU_DISPLAY_HEIGHT * 2;
}
}
else
{
minDisplayViewSize.width = GPU_DISPLAY_WIDTH;
minDisplayViewSize.height = GPU_DISPLAY_HEIGHT;
}
if (!isMinSizeNormal)
{
minDisplayViewSize.width /= 4;
minDisplayViewSize.height /= 4;
}
// Set the minimum content size, keeping the display rotation in mind.
NSSize transformedMinSize = GetTransformedBounds(minDisplayViewSize, 1.0, CLOCKWISE_DEGREES([dispViewDelegate rotation]));
transformedMinSize.height += statusBarHeight;
[window setContentMinSize:transformedMinSize];
}
- (BOOL) isMinSizeNormal
{
return isMinSizeNormal;
}
- (IBAction) openRom:(id)sender
{
if (isRomLoading)
@ -872,12 +913,9 @@
- (IBAction) changeDisplayOrientation:(id)sender
{
[dispViewDelegate setDisplayOrientation:[CocoaDSUtil getIBActionSenderTag:sender]];
if ([dispViewDelegate displayType] == DS_DISPLAY_TYPE_COMBO)
{
[self setIsMinSizeNormal:[self isMinSizeNormal]];
[self resizeWithTransform:[dispViewDelegate normalSize] scalar:[dispViewDelegate scale] rotation:[dispViewDelegate rotation]];
}
}
- (IBAction) changeDisplayOrder:(id)sender
{
@ -962,23 +1000,17 @@
- (IBAction) toggleKeepMinDisplaySizeAtNormal:(id)sender
{
if (isMinSizeNormal)
if ([self isMinSizeNormal])
{
minDisplayViewSize.width /= 4;
minDisplayViewSize.height /= 4;
isMinSizeNormal = NO;
[self setIsMinSizeNormal:NO];
}
else
{
minDisplayViewSize.width = GPU_DISPLAY_WIDTH;
minDisplayViewSize.height = GPU_DISPLAY_HEIGHT * 2;
isMinSizeNormal = YES;
}
[self setIsMinSizeNormal:YES];
// Set the minimum content size, keeping the display rotation in mind.
NSSize transformedMinSize = GetTransformedBounds(minDisplayViewSize, 1.0, CLOCKWISE_DEGREES([dispViewDelegate rotation]));
transformedMinSize.height += statusBarHeight;
[window setContentMinSize:transformedMinSize];
// Resize the window if it's smaller than the minimum content size.
NSRect windowContentRect = [window contentRectForFrameRect:[window frame]];
@ -997,6 +1029,7 @@
[window setFrame:newFrameRect display:YES animate:NO];
}
}
}
- (IBAction) toggleStatusBar:(id)sender
{