Merge branch 'master' into slevenbits

This commit is contained in:
Alexander Ljungberg committed 2012-08-15 02:09:40 +01:00
commit 0150271e67
9 files changed
+259 -142

No files matched your search

+51 -13
View File
@@ -474,13 +474,31 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
[[CPTextFieldInputOwner window] makeFirstResponder:nil];
#endif
// As long as we are the first responder we need to monitor the key status of our window.
[[CPNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidResignKey:) name:CPWindowDidResignKeyNotification object:[self window]];
[[CPNotificationCenter defaultCenter] addObserver:self selector:@selector(_windowDidBecomeKey:) name:CPWindowDidBecomeKeyNotification object:[self window]];
_isEditing = NO;
if ([[self window] isKeyWindow])
[self _becomeFirstKeyResponder];
return YES;
}
/*!
A text field can be the first responder without necessarily being the focus of keyboard input. For example, it might be the first responder of window A but window B is the main and key window. It's important we don't put a focused input field into a text field in a non key window, even if that field is the first responder, because the key window might also have a first responder text field which the user will expect to receive keyboard input.
Since a first responder but non-key window text field can't receive input it should not even look like an active text field (Cocoa has a "slightly active" text field look it uses when another window is the key window, but Cappuccino doesn't today.)
*/
- (void)_becomeFirstKeyResponder
{
[self setThemeState:CPThemeStateEditing];
[self _updatePlaceholderState];
[self setNeedsLayout];
_isEditing = NO;
_stringValue = [self stringValue];
#if PLATFORM(DOM)
@@ -559,14 +577,14 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
[[self window] platformWindow]._DOMBodyElement.onselectstart = function () {};
}
#endif
return YES;
}
/* @ignore */
- (BOOL)resignFirstResponder
{
[self unsetThemeState:CPThemeStateEditing];
// When we are no longer the first responder we don't worry about the key status of our window anymore.
[[CPNotificationCenter defaultCenter] removeObserver:self name:CPWindowDidResignKeyNotification object:[self window]];
[[CPNotificationCenter defaultCenter] removeObserver:self name:CPWindowDidBecomeKeyNotification object:[self window]];
#if PLATFORM(DOM)
@@ -583,13 +601,29 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
// even if the value has not changed.
if ([self _valueIsValid:newValue] === NO)
{
[self setThemeState:CPThemeStateEditing];
element.focus();
return NO;
}
#endif
[self _resignFirstKeyResponder];
_isEditing = NO;
[self textDidEndEditing:[CPNotification notificationWithName:CPControlTextDidEndEditingNotification object:self userInfo:nil]];
if ([self sendsActionOnEndEditing])
[self sendAction:[self action] to:[self target]];
[self textDidBlur:[CPNotification notificationWithName:CPTextFieldDidBlurNotification object:self userInfo:nil]];
return YES;
}
- (void)_resignFirstKeyResponder
{
[self unsetThemeState:CPThemeStateEditing];
// Cache the formatted string
_stringValue = [self stringValue];
@@ -601,6 +635,8 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
#if PLATFORM(DOM)
var element = [self _inputElement];
CPTextFieldInputResigning = YES;
if (CPTextFieldInputIsActive)
@@ -627,16 +663,18 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
}
#endif
}
_isEditing = NO;
[self textDidEndEditing:[CPNotification notificationWithName:CPControlTextDidEndEditingNotification object:self userInfo:nil]];
- (void)_windowDidResignKey:(CPNotification)aNotification
{
if (![[self window] isKeyWindow])
[self _resignFirstKeyResponder];
}
if ([self sendsActionOnEndEditing])
[self sendAction:[self action] to:[self target]];
[self textDidBlur:[CPNotification notificationWithName:CPTextFieldDidBlurNotification object:self userInfo:nil]];
return YES;
- (void)_windowDidBecomeKey:(CPNotification)aNotification
{
if ([[self window] isKeyWindow] && [[self window] firstResponder] === self)
[self _becomeFirstKeyResponder];
}
- (BOOL)_valueIsValid:(CPString)aValue
+2 -1
View File
@@ -419,7 +419,8 @@ CPThemeStateVertical = CPThemeState("vertical");
CPThemeStateDefault = CPThemeState("default");
CPThemeStateCircular = CPThemeState("circular");
CPThemeStateAutocompleting = CPThemeState("autocompleting");
CPThemeStateMainWindow = CPThemeState("mainWindow");
CPThemeStateKeyWindow = CPThemeState("keyWindow");
@implementation _CPThemeAttribute : CPObject
{
+4 -5
View File
@@ -857,12 +857,12 @@ CPTexturedBackgroundWindowMask
[_platformWindow order:CPWindowAbove window:self relativeTo:nil];
#endif
if (_firstResponder === self || !_firstResponder)
[self makeFirstResponder:_initialFirstResponder];
if (!CPApp._keyWindow)
[self makeKeyWindow];
if ([self isKeyWindow] && (_firstResponder === self || !_firstResponder))
[self makeFirstResponder:_initialFirstResponder];
if (!CPApp._mainWindow)
[self makeMainWindow];
}
@@ -1605,7 +1605,6 @@ CPTexturedBackgroundWindowMask
// -dw- if the window is clicked, the sheet should come to front, and become key,
// and the window should be immediately behind
[self orderFront:self];
[sheet makeKeyAndOrderFront:self];
break;
case CPMouseMoved:
@@ -2545,7 +2544,7 @@ CPTexturedBackgroundWindowMask
// NOTE: cocoa doesn't make window key until animation is done, but a
// keypress while animating eventually gets to the window. Therefore,
// there must be a runloop specifically designed for sheets?
[sheet becomeKeyWindow];
[sheet makeKeyWindow];
}
/* @ignore */
+26 -53
View File
@@ -21,18 +21,18 @@
*/
@import "CPTextField.j"
@import "_CPTitleableWindowView.j"
var _CPHUDWindowViewBackgroundColor = nil,
_CPHUDWindowViewThemeValues = nil,
CPHUDCloseButtonImage = nil;
var HUD_TITLEBAR_HEIGHT = 26.0;
@implementation _CPHUDWindowView : _CPWindowView
@implementation _CPHUDWindowView : _CPTitleableWindowView
{
CPView _toolbarView;
CPTextField _titleField;
CPButton _closeButton;
}
@@ -60,28 +60,23 @@ var HUD_TITLEBAR_HEIGHT = 26.0;
_CPHUDWindowViewCloseImage = [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"HUDTheme/WindowClose.png"] size:CPSizeMake(18.0, 18.0)];
_CPHUDWindowViewCloseActiveImage = [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"HUDTheme/WindowCloseActive.png"] size:CPSizeMake(18.0, 18.0)];
_CPHUDWindowViewThemeValues = [
[@"title-font", [CPFont systemFontOfSize:[CPFont systemFontSize] - 1]],
[@"title-text-color", [CPColor colorWithWhite:255.0 / 255.0 alpha:0.75]],
[@"title-text-color", [CPColor colorWithWhite:255.0 / 255.0 alpha:1], CPThemeStateKeyWindow],
[@"title-text-shadow-color", [CPColor blackColor]],
[@"title-text-shadow-offset", CGSizeMake(0.0, 1.0)],
[@"title-alignment", CPCenterTextAlignment],
// FIXME: Make this to CPLineBreakByTruncatingMiddle once it's implemented.
[@"title-line-break-mode", CPLineBreakByTruncatingTail],
[@"title-vertical-alignment", CPCenterVerticalTextAlignment]
];
}
+ (CGRect)contentRectForFrameRect:(CGRect)aFrameRect
+ (int)titleBarHeight
{
var contentRect = CGRectMakeCopy(aFrameRect),
titleBarHeight = HUD_TITLEBAR_HEIGHT;
contentRect.origin.y += titleBarHeight;
contentRect.size.height -= titleBarHeight;
return contentRect;
}
+ (CGRect)frameRectForContentRect:(CGRect)aContentRect
{
var frameRect = CGRectMakeCopy(aContentRect),
titleBarHeight = HUD_TITLEBAR_HEIGHT;
frameRect.origin.y -= titleBarHeight;
frameRect.size.height += titleBarHeight;
return frameRect;
return HUD_TITLEBAR_HEIGHT;
}
- (CGRect)contentRectForFrameRect:(CGRect)aFrameRect
@@ -120,37 +115,18 @@ var HUD_TITLEBAR_HEIGHT = 26.0;
if (self)
{
// Until windows become properly themable, just set these values here in the subclass.
[self registerThemeValues:_CPHUDWindowViewThemeValues];
var bounds = [self bounds];
[self setBackgroundColor:_CPHUDWindowViewBackgroundColor];
_titleField = [[CPTextField alloc] initWithFrame:CGRectMakeZero()];
[_titleField setHitTests:NO];
[_titleField setFont:[CPFont systemFontOfSize:[CPFont systemFontSize] - 1]];
[_titleField setTextColor:[CPColor whiteColor]];
[_titleField setTextShadowColor:[CPColor blackColor]];
[_titleField setTextShadowOffset:CGSizeMake(0.0, 1.0)];
[_titleField setAutoresizingMask:CPViewWidthSizable];
// FIXME: Make this to CPLineBreakByTruncatingMiddle once it's implemented.
[_titleField setLineBreakMode:CPLineBreakByTruncatingTail];
[_titleField setAlignment:CPCenterTextAlignment];
[_titleField setStringValue:@"Untitled"];
[_titleField sizeToFit];
[_titleField setAutoresizingMask:CPViewWidthSizable];
[_titleField setStringValue:@""];
[_titleField setFrame:CGRectMake(20.0, 3.0, CGRectGetWidth([self bounds]) - 40.0, CGRectGetHeight([_titleField frame]))];
[self addSubview:_titleField];
if (_styleMask & CPClosableWindowMask)
{
var closeSize = [_CPHUDWindowViewCloseImage size];
_closeButton = [[CPButton alloc] initWithFrame:CGRectMake(8.0, 5.0, closeSize.width, closeSize.height)];
_closeButton = [[CPButton alloc] initWithFrame:CGRectMake(8.0, 4.0, closeSize.width, closeSize.height)];
[_closeButton setBordered:NO];
@@ -161,6 +137,8 @@ var HUD_TITLEBAR_HEIGHT = 26.0;
}
[self setResizeIndicatorOffset:CGSizeMake(5.0, 5.0)];
[self tile];
}
return self;
@@ -172,11 +150,6 @@ var HUD_TITLEBAR_HEIGHT = 26.0;
[_closeButton setAction:@selector(performClose:)];
}
- (void)setTitle:(CPString)aTitle
{
[_titleField setStringValue:aTitle];
}
- (_CPToolbarView)toolbarView
{
return _toolbarView;
@@ -194,7 +167,7 @@ var HUD_TITLEBAR_HEIGHT = 26.0;
- (CGSize)toolbarOffset
{
return CGSizeMake(0.0, HUD_TITLEBAR_HEIGHT);
return _CGSizeMake(0.0, [[self class] titleBarHeight]);
}
- (void)tile
@@ -203,9 +176,9 @@ var HUD_TITLEBAR_HEIGHT = 26.0;
var theWindow = [self window],
bounds = [self bounds],
width = CGRectGetWidth(bounds);
width = _CGRectGetWidth(bounds);
[_titleField setFrame:_CGRectMake(20.0, 3.0, width - 40.0, _CGRectGetHeight([_titleField frame]))];
[_titleField setFrame:_CGRectMake(20.0, 0, width - 40.0, [self toolbarOffset].height)];
var maxY = [self toolbarMaxY];
if ([_titleField isHidden])
+31 -69
View File
@@ -21,7 +21,7 @@
*/
@import "CPTextField.j"
@import "_CPWindowView.j"
@import "_CPTitleableWindowView.j"
var GRADIENT_HEIGHT = 41.0;
@@ -98,31 +98,44 @@ var _CPTexturedWindowHeadGradientColor = nil,
var _CPStandardWindowViewBodyBackgroundColor = nil,
_CPStandardWindowViewDividerBackgroundColor = nil,
_CPStandardWindowViewTitleBackgroundColor = nil,
_CPStandardWindowViewCloseButtonImage = nil,
_CPStandardWindowViewCloseButtonHighlightedImage = nil,
_CPStandardWindowViewCloseButtonUnsavedImage = nil,
_CPStandardWindowViewCloseButtonUnsavedHighlightedImage = nil,
_CPStandardWindowViewMinimizeButtonImage = nil,
_CPStandardWindowViewMinimizeButtonHighlightedImage = nil;
_CPStandardWindowViewMinimizeButtonHighlightedImage = nil,
_CPStandardWindowViewThemeValues = nil;
var STANDARD_GRADIENT_HEIGHT = 41.0,
STANDARD_TITLEBAR_HEIGHT = 25.0;
var STANDARD_GRADIENT_HEIGHT = 41.0;
@implementation _CPStandardWindowView : _CPWindowView
@implementation _CPStandardWindowView : _CPTitleableWindowView
{
_CPTexturedWindowHeadView _headView;
CPView _dividerView;
CPView _bodyView;
CPView _toolbarView;
CPTextField _titleField;
CPButton _closeButton;
CPButton _minimizeButton;
BOOL _isDocumentEdited;
}
+ (void)initialize
{
_CPStandardWindowViewThemeValues = [
[@"title-font", [CPFont boldSystemFontOfSize:CPFontCurrentSystemSize]],
[@"title-text-color", [CPColor colorWithWhite:22.0 / 255.0 alpha:0.75]],
[@"title-text-color", [CPColor colorWithWhite:22.0 / 255.0 alpha:1], CPThemeStateKeyWindow],
[@"title-text-shadow-color", [CPColor whiteColor]],
[@"title-text-shadow-offset", CGSizeMake(0.0, 1.0)],
[@"title-alignment", CPCenterTextAlignment],
// FIXME: Make this to CPLineBreakByTruncatingMiddle once it's implemented.
[@"title-line-break-mode", CPLineBreakByTruncatingTail],
[@"title-vertical-alignment", CPCenterVerticalTextAlignment]
];
}
+ (CPColor)bodyBackgroundColor
{
if (!_CPStandardWindowViewBodyBackgroundColor)
@@ -139,41 +152,6 @@ var STANDARD_GRADIENT_HEIGHT = 41.0,
return _CPStandardWindowViewDividerBackgroundColor;
}
+ (CPColor)titleColor
{
if (!_CPStandardWindowViewTitleBackgroundColor)
_CPStandardWindowViewTitleBackgroundColor = [CPColor colorWithCalibratedRed:44.0 / 255.0 green:44.0 / 255.0 blue:44.0 / 255.0 alpha:1.0];
return _CPStandardWindowViewTitleBackgroundColor;
}
+ (CGRect)contentRectForFrameRect:(CGRect)aFrameRect
{
var contentRect = CGRectMakeCopy(aFrameRect),
titleBarHeight = [self titleBarHeight] + 1.0;
contentRect.origin.y += titleBarHeight;
contentRect.size.height -= titleBarHeight;
return contentRect;
}
+ (CGRect)frameRectForContentRect:(CGRect)aContentRect
{
var frameRect = CGRectMakeCopy(aContentRect),
titleBarHeight = [self titleBarHeight] + 1.0;
frameRect.origin.y -= titleBarHeight;
frameRect.size.height += titleBarHeight;
return frameRect;
}
+ (float)titleBarHeight
{
return STANDARD_TITLEBAR_HEIGHT;
}
- (CGRect)contentRectForFrameRect:(CGRect)aFrameRect
{
var contentRect = [[self class] contentRectForFrameRect:aFrameRect],
@@ -212,6 +190,9 @@ var STANDARD_GRADIENT_HEIGHT = 41.0,
if (self)
{
// Until windows become properly themable, just set these values here in the subclass.
[self registerThemeValues:_CPStandardWindowViewThemeValues];
var theClass = [self class],
bounds = [self bounds];
@@ -220,7 +201,7 @@ var STANDARD_GRADIENT_HEIGHT = 41.0,
[_headView setAutoresizingMask:CPViewWidthSizable];;
[_headView setHitTests:NO];
[self addSubview:_headView];
[self addSubview:_headView positioned:CPWindowBelow relativeTo:_titleField];
_dividerView = [[CPView alloc] initWithFrame:CGRectMake(0.0, CGRectGetMaxY([_headView frame]), CGRectGetWidth(bounds), 1.0)];
@@ -242,24 +223,6 @@ var STANDARD_GRADIENT_HEIGHT = 41.0,
[self setResizeIndicatorOffset:CGSizeMake(2.0, 2.0)];
_titleField = [[CPTextField alloc] initWithFrame:CGRectMakeZero()];
[_titleField setFont:[CPFont boldSystemFontOfSize:CPFontCurrentSystemSize]];
[_titleField setAutoresizingMask:CPViewWidthSizable];
// FIXME: Make this to CPLineBreakByTruncatingMiddle once it's implemented.
[_titleField setLineBreakMode:CPLineBreakByTruncatingTail];
[_titleField setAlignment:CPCenterTextAlignment];
[_titleField setTextShadowColor:[CPColor whiteColor]];
[_titleField setTextShadowOffset:CGSizeMake(0.0, 1.0)];
[_titleField setStringValue:@"Untitled"];
[_titleField sizeToFit];
[_titleField setAutoresizingMask:CPViewWidthSizable];
[_titleField setStringValue:@""];
[self addSubview:_titleField];
if (_styleMask & CPClosableWindowMask)
{
if (!_CPStandardWindowViewCloseButtonImage)
@@ -272,7 +235,7 @@ var STANDARD_GRADIENT_HEIGHT = 41.0,
_CPStandardWindowViewCloseButtonUnsavedHighlightedImage = [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"CPWindow/Standard/CPWindowStandardCloseButtonUnsavedHighlighted.png"] size:CGSizeMake(16.0, 16.0)];
}
_closeButton = [[CPButton alloc] initWithFrame:CGRectMake(8.0, 7.0, 16.0, 16.0)];
_closeButton = [[CPButton alloc] initWithFrame:CGRectMake(8.0, 6.0, 16.0, 16.0)];
[_closeButton setBordered:NO];
[self _updateCloseButton];
@@ -331,9 +294,13 @@ var STANDARD_GRADIENT_HEIGHT = 41.0,
[_headView setFrameSize:_CGSizeMake(width, [self toolbarMaxY])];
[_dividerView setFrame:_CGRectMake(0.0, _CGRectGetMaxY([_headView frame]), width, 1.0)];
var dividerMaxY = 0;
var dividerMaxY = 0,
dividerMinY = 0;
if (![_dividerView isHidden])
{
dividerMinY = _CGRectGetMinY([_dividerView frame]);
dividerMaxY = _CGRectGetMaxY([_dividerView frame]);
}
[_bodyView setFrame:_CGRectMake(0.0, dividerMaxY, width, _CGRectGetHeight(bounds) - dividerMaxY)];
@@ -344,7 +311,7 @@ var STANDARD_GRADIENT_HEIGHT = 41.0,
if (_minimizeButton)
leftOffset += 19.0;
[_titleField setFrame:_CGRectMake(leftOffset, 5.0, width - leftOffset * 2.0, _CGRectGetHeight([_titleField frame]))];
[_titleField setFrame:_CGRectMake(leftOffset, 0, width - leftOffset * 2.0, [[self class] titleBarHeight])];
var contentRect = _CGRectMake(0.0, dividerMaxY, width, _CGRectGetHeight([_bodyView frame]));
@@ -399,11 +366,6 @@ var STANDARD_GRADIENT_HEIGHT = 41.0,
[self _updateCloseButton];
}
- (void)setTitle:(CPString)aTitle
{
[_titleField setStringValue:aTitle];
}
- (void)mouseDown:(CPEvent)anEvent
{
if (![_headView isHidden])
+114
View File
@@ -0,0 +1,114 @@
/*
* _CPTitleableWindowView.j
* AppKit
*
* Created by Alexander Ljungberg.
* Copyright 2012, SlevenBits Ltd.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@import "_CPWindowView.j"
var STANDARD_TITLEBAR_HEIGHT = 25.0;
@implementation _CPTitleableWindowView : _CPWindowView
{
CPTextField _titleField;
}
+ (int)titleBarHeight
{
return STANDARD_TITLEBAR_HEIGHT;
}
+ (CGRect)contentRectForFrameRect:(CGRect)aFrameRect
{
var contentRect = CGRectMakeCopy(aFrameRect),
titleBarHeight = [[self class] titleBarHeight];
contentRect.origin.y += titleBarHeight;
contentRect.size.height -= titleBarHeight;
return contentRect;
}
+ (CGRect)frameRectForContentRect:(CGRect)aContentRect
{
var frameRect = CGRectMakeCopy(aContentRect),
titleBarHeight = [[self class] titleBarHeight];
frameRect.origin.y -= titleBarHeight;
frameRect.size.height += titleBarHeight;
return frameRect;
}
- (id)initWithFrame:(CPRect)aFrame styleMask:(unsigned)aStyleMask
{
self = [super initWithFrame:aFrame styleMask:aStyleMask];
if (self)
{
_titleField = [[CPTextField alloc] initWithFrame:CGRectMakeZero()];
[_titleField setHitTests:NO];
[_titleField setStringValue:@"Untitled"];
[_titleField sizeToFit];
[_titleField setAutoresizingMask:CPViewWidthSizable];
[_titleField setStringValue:@""];
[_titleField setFrame:CGRectMake(20.0, 3.0, CGRectGetWidth([self bounds]) - 40.0, CGRectGetHeight([_titleField frame]))];
[self addSubview:_titleField];
[self setNeedsLayout];
}
return self;
}
- (void)setTitle:(CPString)aTitle
{
[_titleField setStringValue:aTitle];
}
- (void)tile
{
[super tile];
var theWindow = [self window],
bounds = [self bounds],
width = CGRectGetWidth(bounds);
// The vertical alignment of the title is set by the theme, so just give it all available space. By default
// the title will vertically centre within.
[_titleField setFrame:_CGRectMake(20.0, 0, width - 40.0, [[self class] titleBarHeight])];
}
- (void)layoutSubviews
{
[super layoutSubviews];
[_titleField setTextColor:[self currentValueForThemeAttribute:@"title-text-color"]];
[_titleField setFont:[self currentValueForThemeAttribute:@"title-font"]];
[_titleField setAlignment:[self currentValueForThemeAttribute:@"title-alignment"]];
[_titleField setVerticalAlignment:[self currentValueForThemeAttribute:@"title-vertical-alignment"]];
[_titleField setLineBreakMode:[self currentValueForThemeAttribute:@"title-line-break-mode"]];
[_titleField setTextShadowColor:[self currentValueForThemeAttribute:@"title-text-shadow-color"]];
[_titleField setTextShadowOffset:[self currentValueForThemeAttribute:@"title-text-shadow-offset"]];
}
@end
+28
View File
@@ -63,6 +63,17 @@ var _CPWindowViewResizeIndicatorImage = nil;
return CGRectMakeCopy(aContentRect);
}
+ (CPString)defaultThemeClass
{
return "window";
}
+ (id)themeAttributes
{
return [CPDictionary dictionaryWithObjects:[[CPColor blackColor], [CPFont systemFontOfSize:CPFontCurrentSystemSize], [CPNull null], _CGSizeMakeZero(), CPCenterTextAlignment, CPLineBreakByTruncatingTail, CPTopVerticalTextAlignment]
forKeys:[@"title-text-color", @"title-font", @"title-text-shadow-color", @"title-text-shadow-offset", @"title-alignment", @"title-line-break-mode", @"title-vertical-alignment"]];
}
- (CGRect)contentRectForFrameRect:(CGRect)aFrameRect
{
return [[self class] contentRectForFrameRect:aFrameRect];
@@ -359,6 +370,23 @@ var _CPWindowViewResizeIndicatorImage = nil;
[self tile];
}
- (void)noteKeyWindowStateChanged
{
if ([[self window] isKeyWindow])
[self setThemeState:CPThemeStateKeyWindow];
else
[self unsetThemeState:CPThemeStateKeyWindow];
}
- (void)noteMainWindowStateChanged
{
if ([[self window] isMainWindow])
[self setThemeState:CPThemeStateMainWindow];
else
[self unsetThemeState:CPThemeStateMainWindow];
}
/*
- (void)setAnimatingToolbar:(BOOL)isAnimatingToolbar
{
+2 -1
View File
@@ -697,7 +697,8 @@ var _CPimageAndTextViewFrameSizeChangedFlag = 1 << 0,
if (_verticalAlignment === CPCenterVerticalTextAlignment)
{
textRectY = textRectY + (textRectHeight - _textSize.height) / 2.0;
// Since we added +1 px height above to show fractional pixels on the bottom, we have to remove that when calculating vertical centre.
textRectY = textRectY + (textRectHeight - _textSize.height + 1.0) / 2.0;
textRectHeight = _textSize.height;
}
+1
View File
@@ -81,6 +81,7 @@
- (void)modalAction:(id)sender
{
[CPApp endSheet:aWindow returnCode:0];
[aWindow orderOut:sender];
}
- (void)textAction:(id)sender