From 2e93e4abf73fc35b0776fc8c9c36e53ea9de081b Mon Sep 17 00:00:00 2001 From: Alexandre Wilhelm Date: Mon, 29 Apr 2013 16:16:29 -0700 Subject: [PATCH 1/3] Fixed: Sheet window under the toolbar Previously when using a sheet window in a fullPlatform window, the sheet window started the animation under (the layout) the toolbar. Now, the sheet animation starts below the toolbar as in cocoa. It also fixed that only a CPBordelessWindow/CPTitleWindow/HUD can have a toolbar. --- AppKit/CPWindow/CPWindow.j | 9 +++++++++ AppKit/CPWindow/_CPWindowView.j | 4 +++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/AppKit/CPWindow/CPWindow.j b/AppKit/CPWindow/CPWindow.j index ccac5bf02..f43c34ba7 100644 --- a/AppKit/CPWindow/CPWindow.j +++ b/AppKit/CPWindow/CPWindow.j @@ -2763,6 +2763,15 @@ CPTexturedBackgroundWindowMask endY = [_windowView bodyOffset] - [[self contentView] frame].origin.y, endFrame = CGRectMake(originX, endY, sheetFrame.size.width, sheetFrame.size.height); + if (_toolbar && [_windowView showsToolbar] && [self isFullPlatformWindow]) + { + originX += [[_toolbar _toolbarView] frameSize].height; + endY += [[_toolbar _toolbarView] frameSize].height; + + startFrame = CGRectMake(originX, -sheetShadowFrame.size.height, sheetFrame.size.width, sheetFrame.size.height); + endFrame = CGRectMake(originX, endY, sheetFrame.size.width, sheetFrame.size.height); + } + // Move the sheet offscreen before ordering front so it doesn't appear briefly [sheet setFrameOrigin:CGPointMake(0, -13000)]; diff --git a/AppKit/CPWindow/_CPWindowView.j b/AppKit/CPWindow/_CPWindowView.j index 8cd74b0e3..11660eaf3 100644 --- a/AppKit/CPWindow/_CPWindowView.j +++ b/AppKit/CPWindow/_CPWindowView.j @@ -742,7 +742,9 @@ _CPWindowViewResizeSlop = 3; - (BOOL)showsToolbar { - return YES; + var styleMaskWindow = [[self window] styleMask]; + + return styleMaskWindow & CPBorderlessWindowMask || styleMaskWindow & CPTitledWindowMask || styleMaskWindow & CPHUDBackgroundWindowMask; } - (CGSize)toolbarOffset From 3357162660755f0f3d5ed62c37a634f2c4a19f09 Mon Sep 17 00:00:00 2001 From: Alexandre Wilhelm Date: Mon, 29 Apr 2013 16:21:56 -0700 Subject: [PATCH 2/3] Added CPBorderlessBridgeWindowMask for the ToolBar --- AppKit/CPWindow/_CPWindowView.j | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AppKit/CPWindow/_CPWindowView.j b/AppKit/CPWindow/_CPWindowView.j index 11660eaf3..0c8335494 100644 --- a/AppKit/CPWindow/_CPWindowView.j +++ b/AppKit/CPWindow/_CPWindowView.j @@ -744,7 +744,7 @@ _CPWindowViewResizeSlop = 3; { var styleMaskWindow = [[self window] styleMask]; - return styleMaskWindow & CPBorderlessWindowMask || styleMaskWindow & CPTitledWindowMask || styleMaskWindow & CPHUDBackgroundWindowMask; + return styleMaskWindow & CPBorderlessWindowMask || styleMaskWindow & CPTitledWindowMask || styleMaskWindow & CPHUDBackgroundWindowMask || styleMaskWindow & CPBorderlessBridgeWindowMask; } - (CGSize)toolbarOffset From e22d6e0217f5f179e1e3413378bab757bf10bc59 Mon Sep 17 00:00:00 2001 From: Alexandre Wilhelm Date: Mon, 6 May 2013 15:28:49 -0700 Subject: [PATCH 3/3] Removed on pixel at the top of a sheet window --- AppKit/CPWindow/CPWindow.j | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/AppKit/CPWindow/CPWindow.j b/AppKit/CPWindow/CPWindow.j index f43c34ba7..109645608 100644 --- a/AppKit/CPWindow/CPWindow.j +++ b/AppKit/CPWindow/CPWindow.j @@ -2755,20 +2755,18 @@ CPTexturedBackgroundWindowMask } // The sheet starts hidden just above the top of a clip rect + // TODO : Make properly for the -1 in endY var sheetFrame = [sheet frame], sheetShadowFrame = sheet._hasShadow ? [sheet._shadowView frame] : sheetFrame, frame = [self frame], originX = frame.origin.x + FLOOR((frame.size.width - sheetFrame.size.width) / 2), startFrame = CGRectMake(originX, -sheetShadowFrame.size.height, sheetFrame.size.width, sheetFrame.size.height), - endY = [_windowView bodyOffset] - [[self contentView] frame].origin.y, + endY = -1 + [_windowView bodyOffset] - [[self contentView] frame].origin.y, endFrame = CGRectMake(originX, endY, sheetFrame.size.width, sheetFrame.size.height); if (_toolbar && [_windowView showsToolbar] && [self isFullPlatformWindow]) { - originX += [[_toolbar _toolbarView] frameSize].height; endY += [[_toolbar _toolbarView] frameSize].height; - - startFrame = CGRectMake(originX, -sheetShadowFrame.size.height, sheetFrame.size.width, sheetFrame.size.height); endFrame = CGRectMake(originX, endY, sheetFrame.size.width, sheetFrame.size.height); }