diff --git a/AppKit/CPWindow/CPWindow.j b/AppKit/CPWindow/CPWindow.j index ffd7de7e6..69b283da6 100644 --- a/AppKit/CPWindow/CPWindow.j +++ b/AppKit/CPWindow/CPWindow.j @@ -186,6 +186,11 @@ CPWindowShadowStyleStandard = 0; CPWindowShadowStyleMenu = 1; CPWindowShadowStylePanel = 2; +CPWindowResizeStyleModern = 0; +CPWindowResizeStyleLegacy = 1; +CPWindowResizeStyle = CPWindowResizeStyleModern; +CPWindowResizeSlop = 5; + var SHADOW_MARGIN_LEFT = 20.0, SHADOW_MARGIN_RIGHT = 19.0, SHADOW_MARGIN_TOP = 10.0, @@ -197,7 +202,8 @@ var SHADOW_MARGIN_LEFT = 20.0, var CPWindowSaveImage = nil, CPWindowSavingImage = nil, - CPWindowResizeTime = 0.2; + CPWindowResizeTime = 0.2, + CPWindowResizeStyleGlobalChangeNotification = @"CPWindowResizeStyleGlobalChangeNotification"; /* Keys for which action messages will be sent by default when unhandled, e.g. complete:. @@ -477,6 +483,11 @@ CPTexturedBackgroundWindowMask _keyViewLoopIsDirty = YES; [self setShowsResizeIndicator:_styleMask & CPResizableWindowMask]; + + [[CPNotificationCenter defaultCenter] addObserver:self + selector:@selector(_didReceiveResizeStyleChange:) + name:CPWindowResizeStyleGlobalChangeNotification + object:nil]; } return self; @@ -996,6 +1007,33 @@ CPTexturedBackgroundWindowMask return _isVisible; } +/*! + Globally sets whether windows resize following the legacy style (using a resize thumb + in the bottom right corner), or the modern style (no resize thumb, resizing + can be done on all edges). +*/ ++ (void)setGlobalResizeStyle:(int)aStyle +{ + if (CPWindowResizeStyle === aStyle) + return; + + CPWindowResizeStyle = aStyle; + [[CPNotificationCenter defaultCenter] postNotificationName:CPWindowResizeStyleGlobalChangeNotification object:nil]; +} + +- (void)_didReceiveResizeStyleChange:(CPNotification)aNotification +{ + [_windowView setShowsResizeIndicator:_styleMask & CPResizableWindowMask]; +} + +/*! + Returns the global window resizing style. +*/ ++ (int)globalResizeStyle +{ + return CPWindowResizeStyle; +} + /*! Returns \c YES if the window's resize indicator is showing. \c NO otherwise. */ @@ -1642,6 +1680,7 @@ CPTexturedBackgroundWindowMask // CPLeftMouseDown is needed for window moving and resizing to work. // CPMouseMoved is needed for rollover effects on title bar buttons. var sheet = [self attachedSheet]; + if (sheet) { switch (type) @@ -1663,162 +1702,173 @@ CPTexturedBackgroundWindowMask switch (type) { - case CPFlagsChanged: return [[self firstResponder] flagsChanged:anEvent]; + case CPFlagsChanged: + return [[self firstResponder] flagsChanged:anEvent]; - case CPKeyUp: return [[self firstResponder] keyUp:anEvent]; + case CPKeyUp: + return [[self firstResponder] keyUp:anEvent]; - case CPKeyDown: if ([anEvent charactersIgnoringModifiers] === CPTabCharacter) - { - if ([anEvent modifierFlags] & CPShiftKeyMask) - [self selectPreviousKeyView:self]; - else - [self selectNextKeyView:self]; + case CPKeyDown: + if ([anEvent charactersIgnoringModifiers] === CPTabCharacter) + { + if ([anEvent modifierFlags] & CPShiftKeyMask) + [self selectPreviousKeyView:self]; + else + [self selectNextKeyView:self]; #if PLATFORM(DOM) - // Make sure the browser doesn't try to do its own tab handling. - // This is important or the browser might blur the shared text field or token field input field, - // even that we just moved it to a new first responder. - [[[anEvent window] platformWindow] _propagateCurrentDOMEvent:NO] + // Make sure the browser doesn't try to do its own tab handling. + // This is important or the browser might blur the shared text field or token field input field, + // even that we just moved it to a new first responder. + [[[anEvent window] platformWindow] _propagateCurrentDOMEvent:NO] #endif - return; - } - else if ([anEvent charactersIgnoringModifiers] === CPBackTabCharacter) - { - var didTabBack = [self selectPreviousKeyView:self]; - if (didTabBack) - { + return; + } + else if ([anEvent charactersIgnoringModifiers] === CPBackTabCharacter) + { + var didTabBack = [self selectPreviousKeyView:self]; + + if (didTabBack) + { #if PLATFORM(DOM) - // Make sure the browser doesn't try to do its own tab handling. - // This is important or the browser might blur the shared text field or token field input field, - // even that we just moved it to a new first responder. - [[[anEvent window] platformWindow] _propagateCurrentDOMEvent:NO] + // Make sure the browser doesn't try to do its own tab handling. + // This is important or the browser might blur the shared text field or token field input field, + // even that we just moved it to a new first responder. + [[[anEvent window] platformWindow] _propagateCurrentDOMEvent:NO] #endif - } + } - return didTabBack; - } + return didTabBack; + } - [[self firstResponder] keyDown:anEvent]; + [[self firstResponder] keyDown:anEvent]; - // Trigger the default button if needed - // FIXME: Is this only applicable in a sheet? See isse: #722. - if (![self disableKeyEquivalentForDefaultButton]) - { - var defaultButton = [self defaultButton], - keyEquivalent = [defaultButton keyEquivalent], - modifierMask = [defaultButton keyEquivalentModifierMask]; + // Trigger the default button if needed + // FIXME: Is this only applicable in a sheet? See isse: #722. + if (![self disableKeyEquivalentForDefaultButton]) + { + var defaultButton = [self defaultButton], + keyEquivalent = [defaultButton keyEquivalent], + modifierMask = [defaultButton keyEquivalentModifierMask]; - if ([anEvent _triggersKeyEquivalent:keyEquivalent withModifierMask:modifierMask]) - [[self defaultButton] performClick:self]; - } + if ([anEvent _triggersKeyEquivalent:keyEquivalent withModifierMask:modifierMask]) + [[self defaultButton] performClick:self]; + } - return; + return; - case CPScrollWheel: return [[_windowView hitTest:point] scrollWheel:anEvent]; + case CPScrollWheel: + return [[_windowView hitTest:point] scrollWheel:anEvent]; case CPLeftMouseUp: - case CPRightMouseUp: var hitTestedView = _leftMouseDownView, - selector = type == CPRightMouseUp ? @selector(rightMouseUp:) : @selector(mouseUp:); + case CPRightMouseUp: + var hitTestedView = _leftMouseDownView, + selector = type == CPRightMouseUp ? @selector(rightMouseUp:) : @selector(mouseUp:); - if (!hitTestedView) - hitTestedView = [_windowView hitTest:point]; + if (!hitTestedView) + hitTestedView = [_windowView hitTest:point]; - [hitTestedView performSelector:selector withObject:anEvent]; + [hitTestedView performSelector:selector withObject:anEvent]; - _leftMouseDownView = nil; + _leftMouseDownView = nil; + + return; - return; case CPLeftMouseDown: - case CPRightMouseDown: _leftMouseDownView = [_windowView hitTest:point]; + case CPRightMouseDown: + _leftMouseDownView = [_windowView hitTest:point] || _windowView; - if (_leftMouseDownView != _firstResponder && [_leftMouseDownView acceptsFirstResponder]) - [self makeFirstResponder:_leftMouseDownView]; + if (_leftMouseDownView != _firstResponder && [_leftMouseDownView acceptsFirstResponder]) + [self makeFirstResponder:_leftMouseDownView]; - [CPApp activateIgnoringOtherApps:YES]; + [CPApp activateIgnoringOtherApps:YES]; - var theWindow = [anEvent window], - selector = type == CPRightMouseDown ? @selector(rightMouseDown:) : @selector(mouseDown:); + var theWindow = [anEvent window], + selector = type == CPRightMouseDown ? @selector(rightMouseDown:) : @selector(mouseDown:); - if ([theWindow isKeyWindow] || [theWindow becomesKeyOnlyIfNeeded] && ![_leftMouseDownView needsPanelToBecomeKey]) - return [_leftMouseDownView performSelector:selector withObject:anEvent]; - else - { - // FIXME: delayed ordering? - [self makeKeyAndOrderFront:self]; + if ([theWindow isKeyWindow] || [theWindow becomesKeyOnlyIfNeeded] && ![_leftMouseDownView needsPanelToBecomeKey]) + return [_leftMouseDownView performSelector:selector withObject:anEvent]; + else + { + // FIXME: delayed ordering? + [self makeKeyAndOrderFront:self]; - if ([_leftMouseDownView acceptsFirstMouse:anEvent]) - return [_leftMouseDownView performSelector:selector withObject:anEvent]; - } - break; + if ([_leftMouseDownView acceptsFirstMouse:anEvent]) + return [_leftMouseDownView performSelector:selector withObject:anEvent]; + } + break; case CPLeftMouseDragged: - case CPRightMouseDragged: if (!_leftMouseDownView) - return [[_windowView hitTest:point] mouseDragged:anEvent]; + case CPRightMouseDragged: + if (!_leftMouseDownView) + return [[_windowView hitTest:point] mouseDragged:anEvent]; - var selector; - if (type == CPRightMouseDragged) - { - selector = @selector(rightMouseDragged:) - if (![_leftMouseDownView respondsToSelector:selector]) - selector = nil; - } + var selector; - if (!selector) - selector = @selector(mouseDragged:) + if (type == CPRightMouseDragged) + { + selector = @selector(rightMouseDragged:) + if (![_leftMouseDownView respondsToSelector:selector]) + selector = nil; + } - return [_leftMouseDownView performSelector:selector withObject:anEvent]; + if (!selector) + selector = @selector(mouseDragged:) - case CPMouseMoved: if (!_acceptsMouseMovedEvents) - return; + return [_leftMouseDownView performSelector:selector withObject:anEvent]; - if (!_mouseEnteredStack) - _mouseEnteredStack = []; + case CPMouseMoved: + if (!_acceptsMouseMovedEvents) + return; - var hitTestView = [_windowView hitTest:point]; + if (!_mouseEnteredStack) + _mouseEnteredStack = []; - if ([_mouseEnteredStack count] && [_mouseEnteredStack lastObject] === hitTestView) - return [hitTestView mouseMoved:anEvent]; + var hitTestView = [_windowView hitTest:point]; - var view = hitTestView, - mouseEnteredStack = []; + if ([_mouseEnteredStack count] && [_mouseEnteredStack lastObject] === hitTestView) + return [hitTestView mouseMoved:anEvent]; - while (view) - { - mouseEnteredStack.unshift(view); + var view = hitTestView, + mouseEnteredStack = []; - view = [view superview]; - } + while (view) + { + mouseEnteredStack.unshift(view); - var deviation = MIN(_mouseEnteredStack.length, mouseEnteredStack.length); + view = [view superview]; + } - while (deviation--) - if (_mouseEnteredStack[deviation] === mouseEnteredStack[deviation]) - break; + var deviation = MIN(_mouseEnteredStack.length, mouseEnteredStack.length); - var index = deviation + 1, - count = _mouseEnteredStack.length; + while (deviation--) + if (_mouseEnteredStack[deviation] === mouseEnteredStack[deviation]) + break; - if (index < count) - { - var event = [CPEvent mouseEventWithType:CPMouseExited location:point modifierFlags:[anEvent modifierFlags] timestamp:[anEvent timestamp] windowNumber:_windowNumber context:nil eventNumber:-1 clickCount:1 pressure:0]; + var index = deviation + 1, + count = _mouseEnteredStack.length; - for (; index < count; ++index) - [_mouseEnteredStack[index] mouseExited:event]; - } + if (index < count) + { + var event = [CPEvent mouseEventWithType:CPMouseExited location:point modifierFlags:[anEvent modifierFlags] timestamp:[anEvent timestamp] windowNumber:_windowNumber context:nil eventNumber:-1 clickCount:1 pressure:0]; - index = deviation + 1; - count = mouseEnteredStack.length; + for (; index < count; ++index) + [_mouseEnteredStack[index] mouseExited:event]; + } - if (index < count) - { - var event = [CPEvent mouseEventWithType:CPMouseEntered location:point modifierFlags:[anEvent modifierFlags] timestamp:[anEvent timestamp] windowNumber:_windowNumber context:nil eventNumber:-1 clickCount:1 pressure:0]; + index = deviation + 1; + count = mouseEnteredStack.length; - for (; index < count; ++index) - [mouseEnteredStack[index] mouseEntered:event]; - } + if (index < count) + { + var event = [CPEvent mouseEventWithType:CPMouseEntered location:point modifierFlags:[anEvent modifierFlags] timestamp:[anEvent timestamp] windowNumber:_windowNumber context:nil eventNumber:-1 clickCount:1 pressure:0]; - _mouseEnteredStack = mouseEnteredStack; + for (; index < count; ++index) + [mouseEnteredStack[index] mouseEntered:event]; + } - [hitTestView mouseMoved:anEvent]; + _mouseEnteredStack = mouseEnteredStack; + + [hitTestView mouseMoved:anEvent]; } } @@ -2158,6 +2208,7 @@ CPTexturedBackgroundWindowMask return; var documents = [_windowController documents]; + if ([documents count]) { var index = [documents indexOfObject:[_windowController document]]; @@ -3229,6 +3280,15 @@ var keyViewComparator = function(lhs, rhs, context) return CGRectContainsPoint(_frame, aPoint); } +- (BOOL)_isValidMousePoint:(CGPoint)aPoint +{ + // If we are using the new resizing mode, mouse events are valid + // outside the window's frame. + var mouseFrame = ((_styleMask & CPResizableWindowMask) && (CPWindowResizeStyle === CPWindowResizeStyleModern)) ? _CGRectInset(_frame, -CPWindowResizeSlop, -CPWindowResizeSlop) : _frame; + + return CGRectContainsPoint(mouseFrame, aPoint); +} + @end @implementation CPWindow (Deprecated) diff --git a/AppKit/CPWindow/_CPStandardWindowView.j b/AppKit/CPWindow/_CPStandardWindowView.j index 3b4b13908..d07f6fe54 100644 --- a/AppKit/CPWindow/_CPStandardWindowView.j +++ b/AppKit/CPWindow/_CPStandardWindowView.j @@ -334,13 +334,13 @@ var STANDARD_GRADIENT_HEIGHT = 41.0; [self _updateCloseButton]; } -- (void)mouseDown:(CPEvent)anEvent +- (BOOL)couldBeMoveEvent:(CPEvent)anEvent { if (![_headView isHidden]) if (CGRectContainsPoint([_headView frame], [self convertPoint:[anEvent locationInWindow] fromView:nil])) - return [self trackMoveWithEvent:anEvent]; + return YES; - [super mouseDown:anEvent]; + return [super couldBeMoveEvent:anEvent]; } - (void)_enableSheet:(BOOL)enable diff --git a/AppKit/CPWindow/_CPWindowView.j b/AppKit/CPWindow/_CPWindowView.j index 207a3456e..6bd147150 100644 --- a/AppKit/CPWindow/_CPWindowView.j +++ b/AppKit/CPWindow/_CPWindowView.j @@ -24,7 +24,18 @@ @import "CPView.j" -var _CPWindowViewResizeIndicatorImage = nil; +var _CPWindowViewResizeIndicatorImage = nil, + _CPWindowViewCornerResizeRectWidth = 10, + + _CPWindowViewResizeRegionNone = -1, + _CPWindowViewResizeRegionTopLeft = 0, + _CPWindowViewResizeRegionTop = 1, + _CPWindowViewResizeRegionTopRight = 2, + _CPWindowViewResizeRegionRight = 3, + _CPWindowViewResizeRegionBottomRight = 4, + _CPWindowViewResizeRegionBottom = 5, + _CPWindowViewResizeRegionBottomLeft = 6, + _CPWindowViewResizeRegionLeft = 7; @implementation _CPWindowView : CPView { @@ -38,6 +49,7 @@ var _CPWindowViewResizeIndicatorImage = nil; // BOOL _isAnimatingToolbar; CGRect _resizeFrame; + int _resizeRegion; CGPoint _mouseDraggedPoint; CGRect _cachedScreenFrame; @@ -50,17 +62,17 @@ var _CPWindowViewResizeIndicatorImage = nil; if (self !== [_CPWindowView class]) return; - _CPWindowViewResizeIndicatorImage = [[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:[CPWindow class]] pathForResource:@"_CPWindowView/_CPWindowViewResizeIndicator.png"] size:CGSizeMake(12.0, 12.0)]; + _CPWindowViewResizeIndicatorImage = [[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:[CPWindow class]] pathForResource:@"_CPWindowView/_CPWindowViewResizeIndicator.png"] size:_CGSizeMake(12.0, 12.0)]; } + (CGRect)contentRectForFrameRect:(CGRect)aFrameRect { - return CGRectMakeCopy(aFrameRect); + return _CGRectMakeCopy(aFrameRect); } + (CGRect)frameRectForContentRect:(CGRect)aContentRect { - return CGRectMakeCopy(aContentRect); + return _CGRectMakeCopy(aContentRect); } + (CPString)defaultThemeClass @@ -81,7 +93,7 @@ var _CPWindowViewResizeIndicatorImage = nil; if ([theToolbar isVisible]) { - var toolbarHeight = CGRectGetHeight([[theToolbar _toolbarView] frame]); + var toolbarHeight = _CGRectGetHeight([[theToolbar _toolbarView] frame]); contentRect.origin.y += toolbarHeight; contentRect.size.height -= toolbarHeight; @@ -97,7 +109,7 @@ var _CPWindowViewResizeIndicatorImage = nil; if ([theToolbar isVisible]) { - var toolbarHeight = CGRectGetHeight([[theToolbar _toolbarView] frame]); + var toolbarHeight = _CGRectGetHeight([[theToolbar _toolbarView] frame]); frameRect.origin.y -= toolbarHeight; frameRect.size.height += toolbarHeight; @@ -113,8 +125,8 @@ var _CPWindowViewResizeIndicatorImage = nil; if (self) { _styleMask = aStyleMask; - _resizeIndicatorOffset = CGSizeMakeZero(); - _toolbarOffset = CGSizeMakeZero(); + _resizeIndicatorOffset = _CGSizeMakeZero(); + _toolbarOffset = _CGSizeMakeZero(); } return self; @@ -135,48 +147,186 @@ var _CPWindowViewResizeIndicatorImage = nil; - (void)mouseDown:(CPEvent)anEvent { - var theWindow = [self window]; + var theWindow = [self window], + couldResize = _styleMask & CPResizableWindowMask; - if ((_styleMask & CPResizableWindowMask) && _resizeIndicator) + couldResize = couldResize && ( + (CPWindowResizeStyle === CPWindowResizeStyleModern) || + ((CPWindowResizeStyle === CPWindowResizeStyleLegacy) && _resizeIndicator)); + + if (couldResize) { - // FIXME: This should be better - var frame = [_resizeIndicator frame]; + var theWindow = [self window], + windowFrame = [theWindow frame], + shouldResize = NO; - if (CGRectContainsPoint(frame, [self convertPoint:[anEvent locationInWindow] fromView:nil])) + if (CPWindowResizeStyle === CPWindowResizeStyleModern) + { + var globalPoint = [theWindow convertBaseToGlobal:[anEvent locationInWindow]]; + + _resizeRegion = [self resizeRegionForPoint:globalPoint inFrame:windowFrame]; + shouldResize = _resizeRegion !== _CPWindowViewResizeRegionNone; + } + else + { + // Extend the resize frame to the edge of the window frame + var resizeFrame = [_resizeIndicator frame]; + resizeFrame.size.width = _CGRectGetWidth(windowFrame) - _CGRectGetMinX(resizeFrame); + resizeFrame.size.height = _CGRectGetHeight(windowFrame) - _CGRectGetMinY(resizeFrame); + + var localPoint = [self convertPoint:[anEvent locationInWindow] fromView:nil]; + shouldResize = CGRectContainsPoint(resizeFrame, localPoint); + + // When in legacy mode, the only possible resize region is lower right + _resizeRegion = shouldResize ? _CPWindowViewResizeRegionBottomRight : _CPWindowViewResizeRegionNone; + } + + if (shouldResize) return [self trackResizeWithEvent:anEvent]; } - if ([theWindow isMovable] && [theWindow isMovableByWindowBackground]) + if ([self couldBeMoveEvent:anEvent]) [self trackMoveWithEvent:anEvent]; else [super mouseDown:anEvent]; } +- (BOOL)couldBeMoveEvent:(CPEvent)anEvent +{ + var theWindow = [self window]; + + return [theWindow isMovable] && [theWindow isMovableByWindowBackground]; +} + +/* + aPoint should be in global coordinates +*/ +- (int)resizeRegionForPoint:(CGPoint)aPoint inFrame:(CGRect)aFrame +{ + /* + There are 8 possible resize rects, 1 for each side and 1 for each corner. + The four corner rects are the same size, and the top/bottom and left/right + rects are the same size. So to save calculations, we can just create + 3 rects and move them around to do hit testing. Start with the corners + and then do left/right and top/bottom. + */ + var rect = _CGRectMake(aFrame.origin.x - CPWindowResizeSlop, + aFrame.origin.y - CPWindowResizeSlop, + _CPWindowViewCornerResizeRectWidth + CPWindowResizeSlop, + _CPWindowViewCornerResizeRectWidth + CPWindowResizeSlop); + + if (_CGRectContainsPoint(rect, aPoint)) + return _CPWindowViewResizeRegionTopLeft; + + rect.origin.x = _CGRectGetMaxX(aFrame) - _CPWindowViewCornerResizeRectWidth; + + if (_CGRectContainsPoint(rect, aPoint)) + return _CPWindowViewResizeRegionTopRight; + + rect.origin.y = _CGRectGetMaxY(aFrame) - _CPWindowViewCornerResizeRectWidth; + + if (_CGRectContainsPoint(rect, aPoint)) + return _CPWindowViewResizeRegionBottomRight; + + rect.origin.x = aFrame.origin.x - CPWindowResizeSlop; + + if (_CGRectContainsPoint(rect, aPoint)) + return _CPWindowViewResizeRegionBottomLeft; + + rect = _CGRectMake(rect.origin.x, + aFrame.origin.y + _CPWindowViewCornerResizeRectWidth, + CPWindowResizeSlop * 2, + _CGRectGetHeight(aFrame) - (_CPWindowViewCornerResizeRectWidth * 2)); + + if (_CGRectContainsPoint(rect, aPoint)) + return _CPWindowViewResizeRegionLeft; + + rect.origin.x = _CGRectGetMaxX(aFrame) - CPWindowResizeSlop; + + if (_CGRectContainsPoint(rect, aPoint)) + return _CPWindowViewResizeRegionRight; + + rect = _CGRectMake(aFrame.origin.x + _CPWindowViewCornerResizeRectWidth, + aFrame.origin.y - CPWindowResizeSlop, + _CGRectGetWidth(aFrame) - (_CPWindowViewCornerResizeRectWidth * 2), + CPWindowResizeSlop * 2); + + if (_CGRectContainsPoint(rect, aPoint)) + return _CPWindowViewResizeRegionTop; + + rect.origin.y = _CGRectGetMaxY(aFrame) - CPWindowResizeSlop; + + if (_CGRectContainsPoint(rect, aPoint)) + return _CPWindowViewResizeRegionBottom; + + return _CPWindowViewResizeRegionNone; +} + - (void)trackResizeWithEvent:(CPEvent)anEvent { - var location = [anEvent locationInWindow], - type = [anEvent type]; + var type = [anEvent type]; if (type === CPLeftMouseUp) return; - var theWindow = [self window]; + var location = [anEvent locationInWindow], + theWindow = [self window], + globalLocation = [theWindow convertBaseToGlobal:location], + frame = [theWindow frame]; if (type === CPLeftMouseDown) { - var frame = [theWindow frame]; - - _resizeFrame = CGRectMake(location.x, location.y, CGRectGetWidth(frame), CGRectGetHeight(frame)); + _mouseDraggedPoint = _CGPointMakeCopy(globalLocation); + _resizeFrame = _CGRectMakeCopy(frame); } else if (type === CPLeftMouseDragged) { - var newSize = CGSizeMake(CGRectGetWidth(_resizeFrame) + location.x - CGRectGetMinX(_resizeFrame), CGRectGetHeight(_resizeFrame) + location.y - CGRectGetMinY(_resizeFrame)); + var diffX = globalLocation.x - _mouseDraggedPoint.x, + diffY = globalLocation.y - _mouseDraggedPoint.y, + newX = _CGRectGetMinX(_resizeFrame), + newY = _CGRectGetMinY(_resizeFrame), + newWidth = _CGRectGetWidth(_resizeFrame), + newHeight = _CGRectGetHeight(_resizeFrame); - if (theWindow._isSheet && theWindow._parentView && (theWindow._frame.size.width !== newSize.width)) + // Calculate x and width first + switch (_resizeRegion) + { + case _CPWindowViewResizeRegionTopLeft: + case _CPWindowViewResizeRegionLeft: + case _CPWindowViewResizeRegionBottomLeft: + newX += diffX, + newWidth -= diffX; + break; + + case _CPWindowViewResizeRegionTopRight: + case _CPWindowViewResizeRegionRight: + case _CPWindowViewResizeRegionBottomRight: + newWidth += diffX; + break; + } + + // Now calculate y and height + switch (_resizeRegion) + { + case _CPWindowViewResizeRegionTopLeft: + case _CPWindowViewResizeRegionTop: + case _CPWindowViewResizeRegionTopRight: + newY += diffY, + newHeight -= diffY; + break; + + case _CPWindowViewResizeRegionBottomLeft: + case _CPWindowViewResizeRegionBottom: + case _CPWindowViewResizeRegionBottomRight: + newHeight += diffY; + break; + } + + if (theWindow._isSheet && theWindow._parentView && (frame.size.width !== newWidth)) [theWindow._parentView _setAttachedSheetFrameOrigin]; - [theWindow setFrameSize:newSize]; + [theWindow setFrame:_CGRectMake(newX, newY, newWidth, newHeight)]; } [CPApp setTarget:self selector:@selector(trackResizeWithEvent:) forNextEventMatchingMask:CPLeftMouseDraggedMask | CPLeftMouseUpMask untilDate:nil inMode:nil dequeue:YES]; @@ -200,8 +350,8 @@ var _CPWindowViewResizeIndicatorImage = nil; var restrictedPoint = CGPointMake(0, 0); - restrictedPoint.x = MIN(MAX(aPoint.x, -_frame.size.width + 4.0), CGRectGetMaxX(visibleFrame) - 4.0); - restrictedPoint.y = MIN(MAX(aPoint.y, minPointY), CGRectGetMaxY(visibleFrame) - 8.0); + restrictedPoint.x = MIN(MAX(aPoint.x, -_frame.size.width + 4.0), _CGRectGetMaxX(visibleFrame) - 4.0); + restrictedPoint.y = MIN(MAX(aPoint.y, minPointY), _CGRectGetMaxY(visibleFrame) - 8.0); return restrictedPoint; } @@ -251,12 +401,12 @@ var _CPWindowViewResizeIndicatorImage = nil; - (void)setShowsResizeIndicator:(BOOL)shouldShowResizeIndicator { - if (shouldShowResizeIndicator) + if (shouldShowResizeIndicator && CPWindowResizeStyle === CPWindowResizeStyleLegacy) { var size = [_CPWindowViewResizeIndicatorImage size], boundsSize = [self frame].size; - _resizeIndicator = [[CPImageView alloc] initWithFrame:CGRectMake(boundsSize.width - size.width - _resizeIndicatorOffset.width, boundsSize.height - size.height - _resizeIndicatorOffset.height, size.width, size.height)]; + _resizeIndicator = [[CPImageView alloc] initWithFrame:_CGRectMake(boundsSize.width - size.width - _resizeIndicatorOffset.width, boundsSize.height - size.height - _resizeIndicatorOffset.height, size.width, size.height)]; [_resizeIndicator setImage:_CPWindowViewResizeIndicatorImage]; [_resizeIndicator setAutoresizingMask:CPViewMinXMargin | CPViewMinYMargin]; @@ -325,7 +475,7 @@ var _CPWindowViewResizeIndicatorImage = nil; if (!_toolbarView || [_toolbarView isHidden]) return [self toolbarOffset].height; - return CGRectGetMaxY([_toolbarView frame]); + return _CGRectGetMaxY([_toolbarView frame]); } - (_CPToolbarView)toolbarView @@ -337,14 +487,14 @@ var _CPWindowViewResizeIndicatorImage = nil; { var theWindow = [self window], bounds = [self bounds], - width = CGRectGetWidth(bounds); + width = _CGRectGetWidth(bounds); if ([[theWindow toolbar] isVisible]) { var toolbarView = [self toolbarView], toolbarOffset = [self toolbarOffset]; - [toolbarView setFrame:CGRectMake(toolbarOffset.width, toolbarOffset.height, width, CGRectGetHeight([toolbarView frame]))]; + [toolbarView setFrame:_CGRectMake(toolbarOffset.width, toolbarOffset.height, width, _CGRectGetHeight([toolbarView frame]))]; } if ([self showsResizeIndicator]) diff --git a/AppKit/Platform/DOM/CPPlatformWindow+DOM.j b/AppKit/Platform/DOM/CPPlatformWindow+DOM.j index 77494eb2c..85e2186cb 100644 --- a/AppKit/Platform/DOM/CPPlatformWindow+DOM.j +++ b/AppKit/Platform/DOM/CPPlatformWindow+DOM.j @@ -1208,7 +1208,7 @@ var resizeTimer = nil; windowNumber = [_mouseDownWindow windowNumber]; else { - var theWindow = [self hitTest:location]; + var theWindow = [self _mouseHitTest:location]; if ((aDOMEvent.type === CPDOMEventMouseDown) && theWindow) _mouseDownWindow = theWindow; @@ -1486,7 +1486,17 @@ var resizeTimer = nil; return StopContextMenuDOMEventPropagation; } +- (CPWindow)_mouseHitTest:(CPPoint)location +{ + return [self _hitTest:location withTest:@selector(_isValidMousePoint:)] +} + - (CPWindow)hitTest:(CPPoint)location +{ + return [self _hitTest:location withTest:@selector(containsPoint:)] +} + +- (CPWindow)_hitTest:(CPPoint)location withTest:(SEL)aTest { if (self._only) return self._only; @@ -1505,7 +1515,7 @@ var resizeTimer = nil; { var candidateWindow = windows[windowCount]; - if (!candidateWindow._ignoresMouseEvents && [candidateWindow containsPoint:location]) + if (!candidateWindow._ignoresMouseEvents && [candidateWindow performSelector:aTest withObject:location]) theWindow = candidateWindow; } } diff --git a/Tests/Manual/CPWindowResizeStyle/AppController.j b/Tests/Manual/CPWindowResizeStyle/AppController.j new file mode 100644 index 000000000..77118f7d1 --- /dev/null +++ b/Tests/Manual/CPWindowResizeStyle/AppController.j @@ -0,0 +1,31 @@ +/* + * AppController.j + * resize + * + * Created by You on December 24, 2012. + * Copyright 2012, Your Company All rights reserved. + */ + +@import + + +@implementation AppController : CPObject +{ + @outlet CPWindow theWindow; +} + +- (void)applicationDidFinishLaunching:(CPNotification)aNotification +{ + // This is called when the application is done loading. +} + +- (void)awakeFromCib +{ +} + +- (@action)resizeStyleDidChange:(id)sender +{ + [CPWindow setGlobalResizeStyle:[[sender selectedRadio] tag]]; +} + +@end diff --git a/Tests/Manual/CPWindowResizeStyle/Info.plist b/Tests/Manual/CPWindowResizeStyle/Info.plist new file mode 100644 index 000000000..f603c0e49 --- /dev/null +++ b/Tests/Manual/CPWindowResizeStyle/Info.plist @@ -0,0 +1,10 @@ + + + + + Main cib file base name + MainMenu.cib + CPBundleName + resize + + diff --git a/Tests/Manual/CPWindowResizeStyle/Jakefile b/Tests/Manual/CPWindowResizeStyle/Jakefile new file mode 100644 index 000000000..d6db79e43 --- /dev/null +++ b/Tests/Manual/CPWindowResizeStyle/Jakefile @@ -0,0 +1,94 @@ +/* + * Jakefile + * resize + * + * Created by You on December 24, 2012. + * Copyright 2012, Your Company All rights reserved. + */ + +var ENV = require("system").env, + FILE = require("file"), + JAKE = require("jake"), + task = JAKE.task, + FileList = JAKE.FileList, + app = require("cappuccino/jake").app, + configuration = ENV["CONFIG"] || ENV["CONFIGURATION"] || ENV["c"] || "Debug", + OS = require("os"); + +app ("resize", function(task) +{ + task.setBuildIntermediatesPath(FILE.join("Build", "resize.build", configuration)); + task.setBuildPath(FILE.join("Build", configuration)); + + task.setProductName("resize"); + task.setIdentifier("com.yourcompany.resize"); + task.setVersion("1.0"); + task.setAuthor("Your Company"); + task.setEmail("feedback @nospam@ yourcompany.com"); + task.setSummary("resize"); + task.setSources((new FileList("**/*.j")).exclude(FILE.join("Build", "**"))); + task.setResources(new FileList("Resources/**")); + task.setIndexFilePath("index.html"); + task.setInfoPlistPath("Info.plist"); + task.setNib2CibFlags("-R Resources/"); + + if (configuration === "Debug") + task.setCompilerFlags("-DDEBUG -g"); + else + task.setCompilerFlags("-O"); +}); + +task ("default", ["resize"], function() +{ + printResults(configuration); +}); + +task ("build", ["default"]); + +task ("debug", function() +{ + ENV["CONFIGURATION"] = "Debug"; + JAKE.subjake(["."], "build", ENV); +}); + +task ("release", function() +{ + ENV["CONFIGURATION"] = "Release"; + JAKE.subjake(["."], "build", ENV); +}); + +task ("run", ["debug"], function() +{ + OS.system(["open", FILE.join("Build", "Debug", "resize", "index.html")]); +}); + +task ("run-release", ["release"], function() +{ + OS.system(["open", FILE.join("Build", "Release", "resize", "index.html")]); +}); + +task ("deploy", ["release"], function() +{ + FILE.mkdirs(FILE.join("Build", "Deployment", "resize")); + OS.system(["press", "-f", FILE.join("Build", "Release", "resize"), FILE.join("Build", "Deployment", "resize")]); + printResults("Deployment") +}); + +task ("desktop", ["release"], function() +{ + FILE.mkdirs(FILE.join("Build", "Desktop", "resize")); + require("cappuccino/nativehost").buildNativeHost(FILE.join("Build", "Release", "resize"), FILE.join("Build", "Desktop", "resize", "resize.app")); + printResults("Desktop") +}); + +task ("run-desktop", ["desktop"], function() +{ + OS.system([FILE.join("Build", "Desktop", "resize", "resize.app", "Contents", "MacOS", "NativeHost"), "-i"]); +}); + +function printResults(configuration) +{ + print("----------------------------"); + print(configuration+" app built at path: "+FILE.join("Build", configuration, "resize")); + print("----------------------------"); +} diff --git a/Tests/Manual/CPWindowResizeStyle/Resources/MainMenu.cib b/Tests/Manual/CPWindowResizeStyle/Resources/MainMenu.cib new file mode 100644 index 000000000..22c0eec41 --- /dev/null +++ b/Tests/Manual/CPWindowResizeStyle/Resources/MainMenu.cib @@ -0,0 +1 @@ +280NPLIST;1.0;D;K;4;$topD;K;18;CPCibObjectDataKeyD;K;6;CP$UIDd;1;2E;E;K;8;$objectsA;S;5;$nullD;K;10;$classnameS;16;_CPCibObjectDataK;8;$classesA;S;16;_CPCibObjectDataS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;1;1E;K;28;_CPCibObjectDataNamesKeysKeyD;K;6;CP$UIDd;1;0E;K;30;_CPCibObjectDataNamesValuesKeyD;K;6;CP$UIDd;1;0E;K;30;_CPCibObjectDataClassesKeysKeyD;K;6;CP$UIDd;1;0E;K;32;_CPCibObjectDataClassesValuesKeyD;K;6;CP$UIDd;1;0E;K;30;_CPCibObjectDataConnectionsKeyD;K;6;CP$UIDd;1;4E;K;28;_CPCibObjectDataFrameworkKeyD;K;6;CP$UIDd;1;0E;K;26;_CPCibObjectDataNextOidKeyD;K;6;CP$UIDd;1;5E;K;30;_CPCibObjectDataObjectsKeysKeyD;K;6;CP$UIDd;1;6E;K;32;_CPCibObjectDataObjectsValuesKeyD;K;6;CP$UIDd;1;7E;K;26;_CPCibObjectDataOidKeysKeyD;K;6;CP$UIDd;1;8E;K;28;_CPCibObjectDataOidValuesKeyD;K;6;CP$UIDd;1;9E;K;28;_CPCibObjectDataFileOwnerKeyD;K;6;CP$UIDd;2;11E;K;33;_CPCibObjectDataVisibleWindowsKeyD;K;6;CP$UIDd;2;13E;E;D;K;10;$classnameS;7;CPArrayK;8;$classesA;S;7;CPArrayS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;D;K;6;CP$UIDd;2;15E;D;K;6;CP$UIDd;2;16E;D;K;6;CP$UIDd;2;17E;D;K;6;CP$UIDd;2;18E;D;K;6;CP$UIDd;2;20E;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;D;K;6;CP$UIDd;2;21E;D;K;6;CP$UIDd;2;23E;D;K;6;CP$UIDd;2;25E;D;K;6;CP$UIDd;2;26E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;27E;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;D;K;6;CP$UIDd;2;11E;D;K;6;CP$UIDd;2;11E;D;K;6;CP$UIDd;2;23E;D;K;6;CP$UIDd;2;25E;D;K;6;CP$UIDd;2;26E;D;K;6;CP$UIDd;2;26E;D;K;6;CP$UIDd;2;26E;D;K;6;CP$UIDd;2;11E;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;E;E;D;K;10;$classnameS;18;_CPCibCustomObjectK;8;$classesA;S;18;_CPCibCustomObjectS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;2;10E;K;27;_CPCibCustomObjectClassNameD;K;6;CP$UIDd;2;28E;E;D;K;10;$classnameS;5;CPSetK;8;$classesA;S;5;CPSetS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;2;12E;K;15;CPSetObjectsKeyD;K;6;CP$UIDd;2;29E;E;D;K;10;$classnameS;20;CPCibOutletConnectorK;8;$classesA;S;20;CPCibOutletConnectorS;14;CPCibConnectorS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;2;14E;K;24;_CPCibConnectorSourceKeyD;K;6;CP$UIDd;2;11E;K;29;_CPCibConnectorDestinationKeyD;K;6;CP$UIDd;2;27E;K;23;_CPCibConnectorLabelKeyD;K;6;CP$UIDd;2;30E;E;D;K;6;$classD;K;6;CP$UIDd;2;14E;K;24;_CPCibConnectorSourceKeyD;K;6;CP$UIDd;2;27E;K;29;_CPCibConnectorDestinationKeyD;K;6;CP$UIDd;1;0E;K;23;_CPCibConnectorLabelKeyD;K;6;CP$UIDd;2;31E;E;D;K;6;$classD;K;6;CP$UIDd;2;14E;K;24;_CPCibConnectorSourceKeyD;K;6;CP$UIDd;2;27E;K;29;_CPCibConnectorDestinationKeyD;K;6;CP$UIDd;1;0E;K;23;_CPCibConnectorLabelKeyD;K;6;CP$UIDd;2;32E;E;D;K;6;$classD;K;6;CP$UIDd;2;14E;K;24;_CPCibConnectorSourceKeyD;K;6;CP$UIDd;2;27E;K;29;_CPCibConnectorDestinationKeyD;K;6;CP$UIDd;2;23E;K;23;_CPCibConnectorLabelKeyD;K;6;CP$UIDd;2;33E;E;D;K;10;$classnameS;21;CPCibControlConnectorK;8;$classesA;S;21;CPCibControlConnectorS;14;CPCibConnectorS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;2;19E;K;24;_CPCibConnectorSourceKeyD;K;6;CP$UIDd;2;35E;K;29;_CPCibConnectorDestinationKeyD;K;6;CP$UIDd;2;27E;K;23;_CPCibConnectorLabelKeyD;K;6;CP$UIDd;2;36E;E;D;K;6;$classD;K;6;CP$UIDd;2;10E;K;27;_CPCibCustomObjectClassNameD;K;6;CP$UIDd;2;28E;E;D;K;10;$classnameS;20;_CPCibWindowTemplateK;8;$classesA;S;20;_CPCibWindowTemplateS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;2;22E;K;30;_CPCibWindowTemplateMaxSizeKeyD;K;6;CP$UIDd;2;37E;K;32;_CPCibWindowTemplateViewClassKeyD;K;6;CP$UIDd;1;0E;K;34;_CPCibWindowTemplateWindowClassKeyD;K;6;CP$UIDd;2;38E;K;30;_CPCibWindowTemplateWTFlagsKeyD;K;6;CP$UIDd;2;39E;K;33;_CPCibWindowTemplateWindowRectKeyD;K;6;CP$UIDd;2;40E;K;33;_CPCibWindowTemplateScreenRectKeyD;K;6;CP$UIDd;2;41E;K;30;_CPCibWindowTempatStyleMaskKeyD;K;6;CP$UIDd;2;42E;K;34;_CPCibWindowTemplateWindowTitleKeyD;K;6;CP$UIDd;2;43E;K;33;_CPCibWindowTemplateWindowViewKeyD;K;6;CP$UIDd;2;25E;E;D;K;10;$classnameS;6;CPViewK;8;$classesA;S;6;CPViewS;11;CPResponderS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;2;24E;K;18;CPResponderMenuKeyD;K;6;CP$UIDd;1;0E;K;12;CPViewTagKeyD;K;6;CP$UIDd;2;44E;K;14;CPViewFrameKeyD;K;6;CP$UIDd;2;45E;K;15;CPViewBoundsKeyD;K;6;CP$UIDd;2;45E;K;17;CPViewSubviewsKeyD;K;6;CP$UIDd;2;46E;K;19;CPViewThemeClassKeyD;K;6;CP$UIDd;1;0E;K;19;CPViewThemeStateKeyD;K;6;CP$UIDd;2;47E;E;D;K;6;$classD;K;6;CP$UIDd;2;24E;K;27;CPResponderNextResponderKeyD;K;6;CP$UIDd;2;25E;K;18;CPResponderMenuKeyD;K;6;CP$UIDd;1;0E;K;12;CPViewTagKeyD;K;6;CP$UIDd;2;44E;K;14;CPViewFrameKeyD;K;6;CP$UIDd;2;48E;K;15;CPViewBoundsKeyD;K;6;CP$UIDd;2;49E;K;17;CPViewSubviewsKeyD;K;6;CP$UIDd;2;50E;K;18;CPViewSuperviewKeyD;K;6;CP$UIDd;2;25E;K;22;CPViewAutoresizingMaskD;K;6;CP$UIDd;2;51E;K;19;CPViewThemeClassKeyD;K;6;CP$UIDd;1;0E;K;19;CPViewThemeStateKeyD;K;6;CP$UIDd;2;47E;E;D;K;6;$classD;K;6;CP$UIDd;2;10E;K;27;_CPCibCustomObjectClassNameD;K;6;CP$UIDd;2;52E;E;S;13;CPApplicationD;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;D;K;6;CP$UIDd;2;23E;E;E;S;8;delegateS;11;legacyRadioS;11;modernRadioS;9;theWindowD;K;10;$classnameS;12;CPRadioGroupK;8;$classesA;S;12;CPRadioGroupS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;2;34E;K;21;CPRadioGroupRadiosKeyD;K;6;CP$UIDd;2;53E;K;28;CPRadioGroupSelectedRadioKeyD;K;6;CP$UIDd;2;55E;E;S;21;resizeStyleDidChange:S;32;{10000000000000, 10000000000000}S;8;CPWindowd;10;1946158080S;24;{{112, 106}, {322, 211}}S;21;{{0, 0}, {1440, 878}}d;2;15S;12;Resize Styled;1;0S;20;{{0, 0}, {322, 211}}D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;D;K;6;CP$UIDd;2;26E;E;E;S;6;normalS;21;{{80, 87}, {163, 38}}S;19;{{0, 0}, {163, 38}}D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;D;K;6;CP$UIDd;2;55E;D;K;6;CP$UIDd;2;56E;E;E;d;2;45S;13;AppControllerD;K;6;$classD;K;6;CP$UIDd;2;12E;K;15;CPSetObjectsKeyD;K;6;CP$UIDd;2;57E;E;D;K;10;$classnameS;7;CPRadioK;8;$classesA;S;7;CPRadioS;8;CPButtonS;9;CPControlS;6;CPViewS;11;CPResponderS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;2;54E;K;27;CPResponderNextResponderKeyD;K;6;CP$UIDd;2;26E;K;18;CPResponderMenuKeyD;K;6;CP$UIDd;1;0E;K;12;CPViewTagKeyD;K;6;CP$UIDd;2;44E;K;14;CPViewFrameKeyD;K;6;CP$UIDd;2;58E;K;15;CPViewBoundsKeyD;K;6;CP$UIDd;2;58E;K;18;CPViewSuperviewKeyD;K;6;CP$UIDd;2;26E;K;22;CPViewAutoresizingMaskD;K;6;CP$UIDd;2;59E;K;21;CPViewBackgroundColorD;K;6;CP$UIDd;2;61E;K;19;CPViewThemeClassKeyD;K;6;CP$UIDd;2;62E;K;19;CPViewThemeStateKeyD;K;6;CP$UIDd;2;63E;K;15;$aimage-scalingD;K;6;CP$UIDd;2;64E;K;16;$aimage-positionD;K;6;CP$UIDd;2;64E;K;6;$afontD;K;6;CP$UIDd;2;66E;K;17;$aline-break-modeD;K;6;CP$UIDd;2;44E;K;20;$avertical-alignmentD;K;6;CP$UIDd;2;64E;K;11;$aalignmentD;K;6;CP$UIDd;2;44E;K;17;CPControlValueKeyD;K;6;CP$UIDd;2;67E;K;24;CPControlSendActionOnKeyD;K;6;CP$UIDd;2;68E;K;16;CPButtonTitleKeyD;K;6;CP$UIDd;2;69E;K;25;CPButtonAlternateTitleKeyD;K;6;CP$UIDd;1;0E;K;27;CPButtonAllowsMixedStateKeyD;K;6;CP$UIDd;2;70E;K;23;CPButtonHighlightsByKeyD;K;6;CP$UIDd;2;67E;K;23;CPButtonShowsStateByKeyD;K;6;CP$UIDd;2;67E;K;32;CPButtonImageDimsWhenDisabledKeyD;K;6;CP$UIDd;2;71E;K;24;CPButtonImagePositionKeyD;K;6;CP$UIDd;2;64E;K;28;CPButtonKeyEquivalentMaskKeyD;K;6;CP$UIDd;2;44E;K;24;CPButtonPeriodicDelayKeyD;K;6;CP$UIDd;2;72E;K;27;CPButtonPeriodicIntervalKeyD;K;6;CP$UIDd;2;73E;K;20;CPRadioRadioGroupKeyD;K;6;CP$UIDd;2;35E;E;D;K;6;$classD;K;6;CP$UIDd;2;54E;K;27;CPResponderNextResponderKeyD;K;6;CP$UIDd;2;26E;K;18;CPResponderMenuKeyD;K;6;CP$UIDd;1;0E;K;12;CPViewTagKeyD;K;6;CP$UIDd;2;67E;K;14;CPViewFrameKeyD;K;6;CP$UIDd;2;74E;K;15;CPViewBoundsKeyD;K;6;CP$UIDd;2;58E;K;18;CPViewSuperviewKeyD;K;6;CP$UIDd;2;26E;K;22;CPViewAutoresizingMaskD;K;6;CP$UIDd;2;59E;K;21;CPViewBackgroundColorD;K;6;CP$UIDd;2;61E;K;19;CPViewThemeClassKeyD;K;6;CP$UIDd;2;62E;K;19;CPViewThemeStateKeyD;K;6;CP$UIDd;2;75E;K;15;$aimage-scalingD;K;6;CP$UIDd;2;64E;K;16;$aimage-positionD;K;6;CP$UIDd;2;64E;K;6;$afontD;K;6;CP$UIDd;2;66E;K;17;$aline-break-modeD;K;6;CP$UIDd;2;44E;K;20;$avertical-alignmentD;K;6;CP$UIDd;2;64E;K;11;$aalignmentD;K;6;CP$UIDd;2;44E;K;17;CPControlValueKeyD;K;6;CP$UIDd;2;44E;K;24;CPControlSendActionOnKeyD;K;6;CP$UIDd;2;68E;K;16;CPButtonTitleKeyD;K;6;CP$UIDd;2;76E;K;25;CPButtonAlternateTitleKeyD;K;6;CP$UIDd;1;0E;K;27;CPButtonAllowsMixedStateKeyD;K;6;CP$UIDd;2;70E;K;23;CPButtonHighlightsByKeyD;K;6;CP$UIDd;2;67E;K;23;CPButtonShowsStateByKeyD;K;6;CP$UIDd;2;67E;K;32;CPButtonImageDimsWhenDisabledKeyD;K;6;CP$UIDd;2;71E;K;24;CPButtonImagePositionKeyD;K;6;CP$UIDd;2;64E;K;28;CPButtonKeyEquivalentMaskKeyD;K;6;CP$UIDd;2;44E;K;24;CPButtonPeriodicDelayKeyD;K;6;CP$UIDd;2;72E;K;27;CPButtonPeriodicIntervalKeyD;K;6;CP$UIDd;2;73E;K;20;CPRadioRadioGroupKeyD;K;6;CP$UIDd;2;35E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;D;K;6;CP$UIDd;2;55E;D;K;6;CP$UIDd;2;56E;E;E;S;19;{{0, 0}, {163, 18}}d;2;18D;K;10;$classnameS;7;CPColorK;8;$classesA;S;7;CPColorS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;2;60E;K;20;CPColorComponentsKeyD;K;6;CP$UIDd;2;77E;E;S;5;radioS;17;selected+borderedd;1;2D;K;10;$classnameS;6;CPFontK;8;$classesA;S;6;CPFontS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;2;65E;K;13;CPFontNameKeyD;K;6;CP$UIDd;2;78E;K;13;CPFontSizeKeyD;K;6;CP$UIDd;2;79E;K;15;CPFontIsBoldKeyD;K;6;CP$UIDd;2;70E;K;17;CPFontIsItalicKeyD;K;6;CP$UIDd;2;70E;K;17;CPFontIsSystemKeyD;K;6;CP$UIDd;2;71E;E;d;1;1d;1;4S;19;Modern resize styleF;T;f;3;0.5f;4;0.05S;20;{{0, 20}, {163, 18}}S;8;borderedS;19;Legacy resize styleD;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;D;K;6;CP$UIDd;2;44E;D;K;6;CP$UIDd;2;44E;D;K;6;CP$UIDd;2;44E;D;K;6;CP$UIDd;2;44E;E;E;S;28;_CPFontSystemFacePlaceholderd;2;-1E;K;9;$archiverS;15;CPKeyedArchiverK;8;$versionS;6;100000E; \ No newline at end of file diff --git a/Tests/Manual/CPWindowResizeStyle/Resources/MainMenu.xib b/Tests/Manual/CPWindowResizeStyle/Resources/MainMenu.xib new file mode 100644 index 000000000..a9970da61 --- /dev/null +++ b/Tests/Manual/CPWindowResizeStyle/Resources/MainMenu.xib @@ -0,0 +1,480 @@ + + + + 1050 + 12C3012 + 2844 + 1187.34 + 625.00 + + com.apple.InterfaceBuilder.CocoaPlugin + 2844 + + + YES + NSButtonCell + NSCustomObject + NSMatrix + NSView + NSWindowTemplate + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + + + PluginDependencyRecalculationVersion + + + + YES + + NSApplication + + + FirstResponder + + + NSApplication + + + 15 + 2 + {{112, 561}, {322, 211}} + 1946158080 + Resize Style + NSWindow + + + + + 256 + + YES + + + 301 + {{80, 86}, {163, 38}} + + + + _NS:9 + YES + NO + 2 + 1 + + YES + + -2080374784 + 0 + Modern resize style + + LucidaGrande + 13 + 1044 + + + 1211912448 + 0 + + NSRadioButton + + + + 200 + 25 + + + 67108864 + 0 + Legacy resize style + + + 1 + 1211912448 + 0 + + 549453824 + {18, 18} + + YES + + YES + + + + TU0AKgAABRgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAADwRERGLJycnySsrK/A1NTXw +IyMjyRwcHIsJCQk8AAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFFRUVdVBQUOCoqKj/ +29vb//n5+f/6+vr/2tra/6qqqv9UVFTgHx8fdQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUZGRl5 +dXV198PDw//8/Pz////////////////////////////U1NT/fHx89yUlJXkAAAAFAAAAAAAAAAAAAAAA +AAAAAxEREUZqamrmtbW1/+3t7f/+/v7//v7+//7+/v/9/f3//f39//39/f/39/f/xMTE/3d3d+YZGRlG +AAAAAwAAAAAAAAAAAAAACkJCQqGtra3/xsbG/+vr6//y8vL/9fX1//X19f/z8/P/9fX1//Ly8v/u7u7/ +0tLS/6+vr/9KSkqhAAAACgAAAAAAAAAAAAAAF3h4eN2/v7//z8/P/93d3f/q6ur/7+/v/+/v7//w8PD/ +7e3t/+3t7f/i4uL/zs7O/8XFxf98fHzdAAAAFwAAAAAAAAADAAAAJKSkpPjOzs7/2dnZ/+Dg4P/i4uL/ +5eXl/+bm5v/n5+f/5eXl/+Li4v/e3t7/2tra/9DQ0P+srKz4AAAAJAAAAAMAAAADAAAALrCwsPrW1tb/ +3t7e/+Tk5P/p6en/6+vr/+zs7P/p6en/6+vr/+fn5//k5OT/4ODg/9nZ2f+zs7P6AAAALgAAAAMAAAAD +AAAALp2dnezg4OD/5eXl/+rq6v/u7u7/8PDw//Dw8P/x8fH/8PDw/+7u7v/q6ur/5ubm/+Hh4f+ZmZns +AAAALgAAAAMAAAADAAAAJG5ubs/l5eX/6enp/+/v7//y8vL/9vb2//r6+v/5+fn/9/f3//b29v/x8fH/ +6+vr/+Tk5P9ra2vPAAAAJAAAAAMAAAAAAAAAFy4uLpPCwsL67Ozs//Pz8//5+fn//v7+//7+/v/+/v7/ +/v7+//v7+//19fX/8PDw/8LCwvosLCyTAAAAFwAAAAAAAAAAAAAACgAAAENfX1/S5OTk/vn5+f/+/v7/ +///////////////////////////8/Pz/5ubm/l9fX9IAAABDAAAACgAAAAAAAAAAAAAAAwAAABcAAABl +YmJi3NLS0v3////////////////////////////////V1dX9ZGRk3AAAAGUAAAAXAAAAAwAAAAAAAAAA +AAAAAAAAAAUAAAAfAAAAZTMzM8KAgIDwv7+//O3t7f/t7e3/v7+//ICAgPAzMzPCAAAAZQAAAB8AAAAF +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAFwAAAEMAAAB3AAAAnwAAALMAAACzAAAAnwAAAHcAAABD +AAAAFwAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAoAAAAXAAAAJAAAAC4AAAAu +AAAAJAAAABcAAAAKAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAwAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADQEAAAMAAAABABIAAAEB +AAMAAAABABIAAAECAAMAAAAEAAAFugEDAAMAAAABAAEAAAEGAAMAAAABAAIAAAERAAQAAAABAAAACAES +AAMAAAABAAEAAAEVAAMAAAABAAQAAAEWAAMAAAABABIAAAEXAAQAAAABAAAFEAEcAAMAAAABAAEAAAFS +AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA + + + + + + 3 + MCAwAA + + + + 400 + 75 + + + {163, 18} + {4, 2} + 1151868928 + NSActionCell + + 67108864 + 0 + Radio + + 1211912448 + 0 + + 549453824 + {18, 18} + + YES + + YES + + + + TU0AKgAABRgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAMAAAADAAAAAwAAAAAAAAAA +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAADwRERGLJycnySsrK/A1NTXw +IyMjyRwcHIsJCQk8AAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFFRUVdVBQUOCoqKj/ +29vb//n5+f/6+vr/2tra/6qqqv9UVFTgHx8fdQAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUZGRl5 +dXV198PDw//8/Pz////////////////////////////U1NT/fHx89yUlJXkAAAAFAAAAAAAAAAAAAAAA +AAAAAxEREUZqamrmtbW1/+3t7f/+/v7//v7+//7+/v/9/f3//f39//39/f/39/f/xMTE/3d3d+YZGRlG +AAAAAwAAAAAAAAAAAAAACkJCQqGtra3/xsbG/+vr6//y8vL/9fX1//X19f/z8/P/9fX1//Ly8v/u7u7/ +0tLS/6+vr/9KSkqhAAAACgAAAAAAAAAAAAAAF3h4eN2/v7//z8/P/93d3f/q6ur/7+/v/+/v7//w8PD/ +7e3t/+3t7f/i4uL/zs7O/8XFxf98fHzdAAAAFwAAAAAAAAADAAAAJKSkpPjOzs7/2dnZ/+Dg4P/i4uL/ +5eXl/+bm5v/n5+f/5eXl/+Li4v/e3t7/2tra/9DQ0P+srKz4AAAAJAAAAAMAAAADAAAALrCwsPrW1tb/ +3t7e/+Tk5P/p6en/6+vr/+zs7P/p6en/6+vr/+fn5//k5OT/4ODg/9nZ2f+zs7P6AAAALgAAAAMAAAAD +AAAALp2dnezg4OD/5eXl/+rq6v/u7u7/8PDw//Dw8P/x8fH/8PDw/+7u7v/q6ur/5ubm/+Hh4f+ZmZns +AAAALgAAAAMAAAADAAAAJG5ubs/l5eX/6enp/+/v7//y8vL/9vb2//r6+v/5+fn/9/f3//b29v/x8fH/ +6+vr/+Tk5P9ra2vPAAAAJAAAAAMAAAAAAAAAFy4uLpPCwsL67Ozs//Pz8//5+fn//v7+//7+/v/+/v7/ +/v7+//v7+//19fX/8PDw/8LCwvosLCyTAAAAFwAAAAAAAAAAAAAACgAAAENfX1/S5OTk/vn5+f/+/v7/ +///////////////////////////8/Pz/5ubm/l9fX9IAAABDAAAACgAAAAAAAAAAAAAAAwAAABcAAABl +YmJi3NLS0v3////////////////////////////////V1dX9ZGRk3AAAAGUAAAAXAAAAAwAAAAAAAAAA +AAAAAAAAAAUAAAAfAAAAZTMzM8KAgIDwv7+//O3t7f/t7e3/v7+//ICAgPAzMzPCAAAAZQAAAB8AAAAF +AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFAAAAFwAAAEMAAAB3AAAAnwAAALMAAACzAAAAnwAAAHcAAABD +AAAAFwAAAAUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAoAAAAXAAAAJAAAAC4AAAAu +AAAAJAAAABcAAAAKAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA +AAAAAwAAAAMAAAADAAAAAwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADQEAAAMAAAABABIAAAEB +AAMAAAABABIAAAECAAMAAAAEAAAFugEDAAMAAAABAAEAAAEGAAMAAAABAAIAAAERAAQAAAABAAAACAES +AAMAAAABAAEAAAEVAAMAAAABAAQAAAEWAAMAAAABABIAAAEXAAQAAAABAAAFEAEcAAMAAAABAAEAAAFS +AAMAAAABAAEAAAFTAAMAAAAEAAAFwgAAAAAACAAIAAgACAABAAEAAQABA + + + + + + + + 400 + 75 + + + + 6 + System + controlColor + + 3 + MC42NjY2NjY2NjY3AA + + + + 3 + MQA + + + YES + + + {322, 211} + + + + + {{0, 0}, {1440, 878}} + {10000000000000, 10000000000000} + YES + + + AppController + + + + + YES + + + delegate + + + + 451 + + + + theWindow + + + + 467 + + + + modernRadio + + + + 468 + + + + legacyRadio + + + + 469 + + + + resizeStyleDidChange: + + + + 470 + + + + + YES + + 0 + + YES + + + + + + -2 + + + File's Owner + + + -1 + + + First Responder + + + -3 + + + Application + + + 371 + + + YES + + + + + + 372 + + + YES + + + + + + 450 + + + + + 460 + + + YES + + + + + + + + 461 + + + + + 462 + + + + + 463 + + + + + + + YES + + YES + -1.IBPluginDependency + -2.IBPluginDependency + -3.IBPluginDependency + 371.IBPluginDependency + 371.IBWindowTemplateEditedContentRect + 371.NSWindowTemplate.visibleAtLaunch + 372.IBPluginDependency + 450.IBPluginDependency + 460.IBPluginDependency + 461.IBPluginDependency + 462.IBPluginDependency + 463.IBPluginDependency + + + YES + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + {{303, 221}, {480, 360}} + + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + + + + YES + + + + + + YES + + + + + 470 + + + + YES + + AppController + NSObject + + resizeStyleDidChange: + id + + + resizeStyleDidChange: + + resizeStyleDidChange: + id + + + + YES + + YES + legacyRadio + modernRadio + theWindow + + + YES + CPRadioButton + CPRadioButton + NSWindow + + + + YES + + YES + legacyRadio + modernRadio + theWindow + + + YES + + legacyRadio + CPRadioButton + + + modernRadio + CPRadioButton + + + theWindow + NSWindow + + + + + IBProjectSource + ./Classes/AppController.h + + + + + 0 + IBCocoaFramework + + com.apple.InterfaceBuilder.CocoaPlugin.macosx + + + + com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3 + + + YES + 3 + + diff --git a/Tests/Manual/CPWindowResizeStyle/Resources/spinner.gif b/Tests/Manual/CPWindowResizeStyle/Resources/spinner.gif new file mode 100644 index 000000000..77b36416b Binary files /dev/null and b/Tests/Manual/CPWindowResizeStyle/Resources/spinner.gif differ diff --git a/Tests/Manual/CPWindowResizeStyle/index-debug.html b/Tests/Manual/CPWindowResizeStyle/index-debug.html new file mode 100644 index 000000000..514cce3db --- /dev/null +++ b/Tests/Manual/CPWindowResizeStyle/index-debug.html @@ -0,0 +1,107 @@ + + + + + + + + + + + + + + + CPWindowResizeStyle + + + + + + + + + + + + + + +
+
+ + + +
+
+ + + diff --git a/Tests/Manual/CPWindowResizeStyle/index.html b/Tests/Manual/CPWindowResizeStyle/index.html new file mode 100644 index 000000000..4ac50e53a --- /dev/null +++ b/Tests/Manual/CPWindowResizeStyle/index.html @@ -0,0 +1,77 @@ + + + + + + + + + + + + + + + CPWindowResizeStyle + + + + + + + + + + + + +
+
+ + + +
+
+ + + diff --git a/Tests/Manual/CPWindowResizeStyle/main.j b/Tests/Manual/CPWindowResizeStyle/main.j new file mode 100644 index 000000000..ae5b22b20 --- /dev/null +++ b/Tests/Manual/CPWindowResizeStyle/main.j @@ -0,0 +1,18 @@ +/* + * AppController.j + * resize + * + * Created by You on December 24, 2012. + * Copyright 2012, Your Company All rights reserved. + */ + +@import +@import + +@import "AppController.j" + + +function main(args, namedArgs) +{ + CPApplicationMain(args, namedArgs); +}