Cocoa Port:

- The main window now remembers if the status bar is shown or hidden.
- Fix a bug with the status bar where if the status bar was to be shown when the main window was larger than the desktop's content area, then the status bar wouldn't show properly until the user resized or rotated the DS display. Now, the main window shrinks in size as necessary to accommodate the status bar.
This commit is contained in:
rogerman 2012-08-16 00:36:22 +00:00
parent fa17fa0554
commit d960b4c061
3 changed files with 38 additions and 11 deletions

View File

@ -199,6 +199,8 @@
- (IBAction) change3DRenderThreads:(id)sender;
- (IBAction) change3DRenderLineHack:(id)sender;
- (void) setShowStatusBar:(BOOL)showStatusBar;
- (IBAction) closeMigrationSheet:(id)sender;
- (void) didEndFileMigrationSheet:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo;
- (void) didEndSaveStateSheet:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo;

View File

@ -985,24 +985,46 @@
- (IBAction) toggleStatusBar:(id)sender
{
NSRect frameRect = [window frame];
if (isShowingStatusBar)
{
isShowingStatusBar = NO;
[self setShowStatusBar:NO];
}
else
{
[self setShowStatusBar:YES];
}
}
- (void) setShowStatusBar:(BOOL)showStatusBar
{
NSRect frameRect = [window frame];
if (showStatusBar)
{
statusBarHeight = WINDOW_STATUS_BAR_HEIGHT;
frameRect.origin.y -= WINDOW_STATUS_BAR_HEIGHT;
frameRect.size.height += WINDOW_STATUS_BAR_HEIGHT;
NSRect screenFrame = [[NSScreen mainScreen] visibleFrame];
if (frameRect.size.height > screenFrame.size.height)
{
NSRect windowContentRect = [[window contentView] bounds];
double widthToHeightRatio = windowContentRect.size.width / windowContentRect.size.height;
windowContentRect.size.height -= frameRect.size.height - screenFrame.size.height;
windowContentRect.size.width = windowContentRect.size.height * widthToHeightRatio;
frameRect.size.width = windowContentRect.size.width;
}
}
else
{
statusBarHeight = 0;
frameRect.origin.y += WINDOW_STATUS_BAR_HEIGHT;
frameRect.size.height -= WINDOW_STATUS_BAR_HEIGHT;
}
else
{
isShowingStatusBar = YES;
statusBarHeight = WINDOW_STATUS_BAR_HEIGHT;
frameRect.origin.y -= WINDOW_STATUS_BAR_HEIGHT;
frameRect.size.height += WINDOW_STATUS_BAR_HEIGHT;
}
[[self bindings] setValue:[NSNumber numberWithBool:isShowingStatusBar] forKey:@"isShowingStatusBar"];
isShowingStatusBar = showStatusBar;
[[self bindings] setValue:[NSNumber numberWithBool:showStatusBar] forKey:@"isShowingStatusBar"];
[[NSUserDefaults standardUserDefaults] setBool:showStatusBar forKey:@"DisplayView_ShowStatusBar"];
[window setFrame:frameRect display:YES animate:NO];
}
@ -1955,6 +1977,9 @@
- (void) setupUserDefaults
{
// Set the display window per user preferences.
[self setShowStatusBar:[[NSUserDefaults standardUserDefaults] boolForKey:@"DisplayView_ShowStatusBar"]];
// Set the display mode, sizing, and rotation.
double displayScalar = (double)([[NSUserDefaults standardUserDefaults] floatForKey:@"DisplayView_Size"] / 100.0);
double displayRotation = (double)[[NSUserDefaults standardUserDefaults] floatForKey:@"DisplayView_Rotation"];