From dedf3cd90fc8885c829904bb6395593de8877ef2 Mon Sep 17 00:00:00 2001 From: Alexander Ljungberg Date: Mon, 28 Feb 2011 23:55:29 -0300 Subject: [PATCH] More AppKit coding standards. --- AppKit/CPMenu/CPMenu.j | 4 +- AppKit/CPMenu/_CPMenuBarWindow.j | 132 +++++++++--------- AppKit/CPMenu/_CPMenuManager.j | 20 +-- AppKit/CPMenu/_CPMenuWindow.j | 78 +++++------ AppKit/CPMenuItem/_CPMenuItemMenuBarView.j | 16 +-- AppKit/CPMenuItem/_CPMenuItemSeparatorView.j | 4 +- AppKit/CPMenuItem/_CPMenuItemView.j | 34 ++--- .../CPWindow/_CPBorderlessBridgeWindowView.j | 18 +-- AppKit/CPWindow/_CPDocModalWindowView.j | 14 +- AppKit/CPWindow/_CPStandardWindowView.j | 2 +- AppKit/CPWindow/_CPWindowView.j | 2 +- AppKit/Cib/CPCibLoading.j | 2 +- AppKit/CoreGraphics/CGAffineTransform.j | 4 +- AppKit/CoreGraphics/CGContextVML.j | 2 +- AppKit/Platform/CPPlatformWindow.j | 2 +- AppKit/Platform/DOM/CPDOMWindowLayer.j | 20 +-- AppKit/Platform/DOM/CPPlatformWindow+DOM.j | 6 +- .../Platform/DOM/CPPlatformWindow+DOMKeys.j | 10 +- AppKit/Themes/Aristo/ThemeDescriptors.j | 4 +- AppKit/Themes/BlendKit/BKThemeTemplate.j | 4 +- .../Themes/BlendKit/BKThemedObjectTemplate.j | 4 +- AppKit/Themes/Default/AppController.j | 60 ++++---- 22 files changed, 221 insertions(+), 221 deletions(-) diff --git a/AppKit/CPMenu/CPMenu.j b/AppKit/CPMenu/CPMenu.j index f3efea4ec..d9651c0b3 100644 --- a/AppKit/CPMenu/CPMenu.j +++ b/AppKit/CPMenu/CPMenu.j @@ -195,7 +195,7 @@ var _CPMenuBarVisible = NO, } if (!highlightColor) - [_CPMenuBarAttributes setObject:[CPColor colorWithCalibratedRed:94.0/255.0 green:130.0/255.0 blue:186.0/255.0 alpha:1.0] forKey:@"CPMenuBarHighlightColor"]; + [_CPMenuBarAttributes setObject:[CPColor colorWithCalibratedRed:94.0 / 255.0 green:130.0 / 255.0 blue:186.0 / 255.0 alpha:1.0] forKey:@"CPMenuBarHighlightColor"]; if (!highlightTextColor) [_CPMenuBarAttributes setObject:[CPColor whiteColor] forKey:@"CPMenuBarHighlightTextColor"]; @@ -911,7 +911,7 @@ var _CPMenuBarVisible = NO, characters = [anEvent charactersIgnoringModifiers], modifierFlags = [anEvent modifierFlags]; - for(; index < count; ++index) + for (; index < count; ++index) { var item = _items[index], modifierMask = [item keyEquivalentModifierMask]; diff --git a/AppKit/CPMenu/_CPMenuBarWindow.j b/AppKit/CPMenu/_CPMenuBarWindow.j index 9b3b1221b..4eac7d17a 100644 --- a/AppKit/CPMenu/_CPMenuBarWindow.j +++ b/AppKit/CPMenu/_CPMenuBarWindow.j @@ -15,18 +15,18 @@ var _CPMenuBarWindowBackgroundColor = nil, CPMenu _menu; CPView _highlightView; CPArray _menuItemViews; - + CPMenuItem _trackingMenuItem; - + CPImageView _iconImageView; CPTextField _titleField; - + CPColor _textColor; CPColor _titleColor; - + CPColor _textShadowColor; CPColor _titleShadowColor; - + CPColor _highlightColor; CPColor _highlightTextColor; CPColor _highlightTextShadowColor; @@ -36,9 +36,9 @@ var _CPMenuBarWindowBackgroundColor = nil, { if (self != [_CPMenuBarWindow class]) return; - + var bundle = [CPBundle bundleForClass:self]; - + _CPMenuBarWindowFont = [CPFont boldSystemFontOfSize:12.0]; } @@ -60,27 +60,27 @@ var _CPMenuBarWindowBackgroundColor = nil, { [self setLevel:CPMainMenuWindowLevel]; [self setAutoresizingMask:CPWindowWidthSizable]; - + var contentView = [self contentView]; - + [contentView setAutoresizesSubviews:NO]; - + [self setBecomesKeyOnlyIfNeeded:YES]; - + // _iconImageView = [[CPImageView alloc] initWithFrame:CGRectMake(0.0, 0.0, 16.0, 16.0)]; - + [contentView addSubview:_iconImageView]; - + _titleField = [[CPTextField alloc] initWithFrame:CGRectMakeZero()]; [_titleField setFont:[CPFont boldSystemFontOfSize:13.0]]; [_titleField setAlignment:CPCenterTextAlignment]; [_titleField setTextShadowOffset:CGSizeMake(0, 1)]; - + [contentView addSubview:_titleField]; } - + return self; } @@ -99,7 +99,7 @@ var _CPMenuBarWindowBackgroundColor = nil, [_titleField setStringValue:aTitle]; [_titleField sizeToFit]; - + [self tile]; } @@ -122,7 +122,7 @@ var _CPMenuBarWindowBackgroundColor = nil, { if (!_CPMenuBarWindowBackgroundColor) _CPMenuBarWindowBackgroundColor = [CPColor colorWithPatternImage:[[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:[_CPMenuBarWindow class]] pathForResource:@"_CPMenuBarWindow/_CPMenuBarWindowBackground.png"] size:CGSizeMake(1.0, 28.0)]]; - + [[self contentView] setBackgroundColor:_CPMenuBarWindowBackgroundColor]; } else @@ -133,9 +133,9 @@ var _CPMenuBarWindowBackgroundColor = nil, { if (_textColor == aColor) return; - + _textColor = aColor; - + [_menuItemViews makeObjectsPerformSelector:@selector(setTextColor:) withObject:_textColor]; } @@ -143,9 +143,9 @@ var _CPMenuBarWindowBackgroundColor = nil, { if (_titleColor == aColor) return; - + _titleColor = aColor; - + [_titleField setTextColor:aColor ? aColor : [CPColor blackColor]]; } @@ -153,9 +153,9 @@ var _CPMenuBarWindowBackgroundColor = nil, { if (_textShadowColor == aColor) return; - + _textShadowColor = aColor; - + [_menuItemViews makeObjectsPerformSelector:@selector(setTextShadowColor:) withObject:_textShadowColor]; } @@ -163,9 +163,9 @@ var _CPMenuBarWindowBackgroundColor = nil, { if (_titleShadowColor == aColor) return; - + _titleShadowColor = aColor; - + [_titleField setTextShadowColor:aColor ? aColor : [CPColor whiteColor]]; } @@ -173,7 +173,7 @@ var _CPMenuBarWindowBackgroundColor = nil, { if (_highlightColor == aColor) return; - + _highlightColor = aColor; } @@ -181,7 +181,7 @@ var _CPMenuBarWindowBackgroundColor = nil, { if (_highlightTextColor == aColor) return; - + _highlightTextColor = aColor; // [_menuItemViews makeObjectsPerformSelector:@selector(setActivateColor:) withObject:_highlightTextColor]; @@ -191,9 +191,9 @@ var _CPMenuBarWindowBackgroundColor = nil, { if (_highlightTextShadowColor == aColor) return; - + _highlightTextShadowColor = aColor; - + // [_menuItemViews makeObjectsPerformSelector:@selector(setActivateShadowColor:) withObject:_highlightTextShadowColor]; } @@ -201,9 +201,9 @@ var _CPMenuBarWindowBackgroundColor = nil, { if (_menu == aMenu) return; - + var defaultCenter = [CPNotificationCenter defaultCenter]; - + if (_menu) { [defaultCenter @@ -220,16 +220,16 @@ var _CPMenuBarWindowBackgroundColor = nil, removeObserver:self name:CPMenuDidRemoveItemNotification object:_menu]; - + var items = [_menu itemArray], count = items.length; - + while (count--) [[items[count] _menuItemView] removeFromSuperview]; } _menu = aMenu; - + if (_menu) { [defaultCenter @@ -237,41 +237,41 @@ var _CPMenuBarWindowBackgroundColor = nil, selector:@selector(menuDidAddItem:) name:CPMenuDidAddItemNotification object:_menu]; - + [defaultCenter addObserver:self selector:@selector(menuDidChangeItem:) name:CPMenuDidChangeItemNotification object:_menu]; - + [defaultCenter addObserver:self selector:@selector(menuDidRemoveItem:) name:CPMenuDidRemoveItemNotification object:_menu]; } - + _menuItemViews = []; - + var contentView = [self contentView], items = [_menu itemArray], count = items.length; - + for (index = 0; index < count; ++index) { var item = items[index], menuItemView = [item _menuItemView]; - + _menuItemViews.push(menuItemView); [menuItemView setTextColor:_textColor]; [menuItemView setHidden:[item isHidden]]; - + [menuItemView synchronizeWithMenuItem]; - + [contentView addSubview:menuItemView]; } - + [self tile]; } @@ -282,7 +282,7 @@ var _CPMenuBarWindowBackgroundColor = nil, [menuItemView setHidden:[menuItem isHidden]]; [menuItemView synchronizeWithMenuItem]; - + [self tile]; } @@ -298,9 +298,9 @@ var _CPMenuBarWindowBackgroundColor = nil, [menuItemView setHidden:[menuItem isHidden]]; [menuItemView synchronizeWithMenuItem]; - + [[self contentView] addSubview:menuItemView]; - + [self tile]; } @@ -312,7 +312,7 @@ var _CPMenuBarWindowBackgroundColor = nil, [_menuItemViews removeObjectAtIndex:index]; [menuItemView removeFromSuperview]; - + [self tile]; } @@ -343,29 +343,29 @@ var _CPMenuBarWindowBackgroundColor = nil, var items = [_menu itemArray], index = 0, count = items.length, - + x = MENUBAR_LEFT_MARGIN, y = 0.0, isLeftAligned = YES; - + for (; index < count; ++index) { var item = items[index]; - + if ([item isSeparatorItem]) { x = CGRectGetWidth([self frame]) - MENUBAR_RIGHT_MARGIN; isLeftAligned = NO; - + continue; } - + if ([item isHidden]) continue; var menuItemView = [item _menuItemView], frame = [menuItemView frame]; - + if (isLeftAligned) { [menuItemView setFrame:CGRectMake(x, 0.0, CGRectGetWidth(frame), MENUBAR_HEIGHT)]; @@ -375,14 +375,14 @@ var _CPMenuBarWindowBackgroundColor = nil, else { [menuItemView setFrame:CGRectMake(x - CGRectGetWidth(frame), 0.0, CGRectGetWidth(frame), MENUBAR_HEIGHT)]; - + x = CGRectGetMinX([menuItemView frame]); } } - + var bounds = [[self contentView] bounds], titleFrame = [_titleField frame]; - + if ([_iconImageView isHidden]) [_titleField setFrameOrigin:CGPointMake((CGRectGetWidth(bounds) - CGRectGetWidth(titleFrame)) / 2.0, (CGRectGetHeight(bounds) - CGRectGetHeight(titleFrame)) / 2.0)]; else @@ -390,7 +390,7 @@ var _CPMenuBarWindowBackgroundColor = nil, var iconFrame = [_iconImageView frame], iconWidth = CGRectGetWidth(iconFrame), totalWidth = iconWidth + CGRectGetWidth(titleFrame); - + [_iconImageView setFrameOrigin:CGPointMake((CGRectGetWidth(bounds) - totalWidth) / 2.0, (CGRectGetHeight(bounds) - CGRectGetHeight(iconFrame)) / 2.0)]; [_titleField setFrameOrigin:CGPointMake((CGRectGetWidth(bounds) - totalWidth) / 2.0 + iconWidth, (CGRectGetHeight(bounds) - CGRectGetHeight(titleFrame)) / 2.0)]; } @@ -505,38 +505,38 @@ var _CPMenuBarWindowBackgroundColor = nil, for (; index < count; ++index) { var item = items[index]; - + if ([item isSeparatorItem]) { x = CGRectGetWidth([self frame]) - MENUBAR_RIGHT_MARGIN; isLeftAligned = NO; - + continue; } - + if ([item isHidden]) continue; var menuItemView = [item _menuItemView], frame = [menuItemView frame]; - + if (isLeftAligned) { [menuItemView setFrameOrigin:CGPointMake(x, (MENUBAR_HEIGHT - 1.0 - CGRectGetHeight(frame)) / 2.0)]; - + x += CGRectGetWidth([menuItemView frame]) + MENUBAR_MARGIN; } else { [menuItemView setFrameOrigin:CGPointMake(x - CGRectGetWidth(frame), (MENUBAR_HEIGHT - 1.0 - CGRectGetHeight(frame)) / 2.0)]; - + x = CGRectGetMinX([menuItemView frame]) - MENUBAR_MARGIN; } } - + var bounds = [[self contentView] bounds], titleFrame = [_titleField frame]; - + if ([_iconImageView isHidden]) [_titleField setFrameOrigin:CGPointMake((CGRectGetWidth(bounds) - CGRectGetWidth(titleFrame)) / 2.0, (CGRectGetHeight(bounds) - CGRectGetHeight(titleFrame)) / 2.0)]; else @@ -544,7 +544,7 @@ var _CPMenuBarWindowBackgroundColor = nil, var iconFrame = [_iconImageView frame], iconWidth = CGRectGetWidth(iconFrame), totalWidth = iconWidth + CGRectGetWidth(titleFrame); - + [_iconImageView setFrameOrigin:CGPointMake((CGRectGetWidth(bounds) - totalWidth) / 2.0, (CGRectGetHeight(bounds) - CGRectGetHeight(iconFrame)) / 2.0)]; [_titleField setFrameOrigin:CGPointMake((CGRectGetWidth(bounds) - totalWidth) / 2.0 + iconWidth, (CGRectGetHeight(bounds) - CGRectGetHeight(titleFrame)) / 2.0)]; } diff --git a/AppKit/CPMenu/_CPMenuManager.j b/AppKit/CPMenu/_CPMenuManager.j index bfe082cea..9f33485bc 100644 --- a/AppKit/CPMenu/_CPMenuManager.j +++ b/AppKit/CPMenu/_CPMenuManager.j @@ -7,7 +7,7 @@ _CPMenuManagerScrollingStateNone = 0; var STICKY_TIME_INTERVAL = 500; -var SharedMenuManager = nil; +var SharedMenuManager = nil; @implementation _CPMenuManager: CPObject { @@ -36,7 +36,7 @@ var SharedMenuManager = nil; if (SharedMenuManager) return SharedMenuManager; - return [super init]; + return [super init]; } - (id)trackingMenuContainer @@ -135,13 +135,13 @@ var SharedMenuManager = nil; { if (!_lastMouseOverMenuView) [activeMenu _highlightItemAtIndex:CPNotFound]; - + if (_lastMouseOverMenuView != mouseOverMenuView) { [mouseOverMenuView mouseExited:anEvent]; // FIXME: Possibly multiple of these? [_lastMouseOverMenuView mouseEntered:anEvent]; - + _lastMouseOverMenuView = mouseOverMenuView; } @@ -166,9 +166,9 @@ var SharedMenuManager = nil; [_lastMouseOverMenuView mouseExited:anEvent]; _lastMouseOverMenuView = nil; } - + [activeMenu _highlightItemAtIndex:activeItemIndex]; - + if (type === CPMouseMoved || type === CPLeftMouseDragged || type === CPLeftMouseDown) { var oldScrollingState = _scrollingState; @@ -179,7 +179,7 @@ var SharedMenuManager = nil; { if (_scrollingState === _CPMenuManagerScrollingStateNone) [CPEvent stopPeriodicEvents]; - + else if (oldScrollingState === _CPMenuManagerScrollingStateNone) [CPEvent startPeriodicEventsAfterDelay:0.0 withPeriod:0.04]; } @@ -203,7 +203,7 @@ var SharedMenuManager = nil; [self showMenu:[activeItem submenu] fromMenu:[activeItem menu] atPoint:newMenuOrigin]; } - // This handles both the case where we've moved away from the menu, and where + // This handles both the case where we've moved away from the menu, and where // we've moved to an item without a submenu. else [self showMenu:nil fromMenu:activeMenu atPoint:CGPointMakeZero()]; @@ -358,8 +358,8 @@ var SharedMenuManager = nil; if (baseMenu === [self trackingMenu] && [[self trackingMenuContainer] isMenuBar]) [menuWindow setBackgroundStyle:_CPMenuWindowMenuBarBackgroundStyle]; else - [menuWindow setBackgroundStyle:_CPMenuWindowPopUpBackgroundStyle]; - + [menuWindow setBackgroundStyle:_CPMenuWindowPopUpBackgroundStyle]; + [menuWindow setFrameOrigin:aGlobalLocation]; [menuWindow orderFront:self]; } diff --git a/AppKit/CPMenu/_CPMenuWindow.j b/AppKit/CPMenu/_CPMenuWindow.j index c51d329a3..6aebeca3d 100644 --- a/AppKit/CPMenu/_CPMenuWindow.j +++ b/AppKit/CPMenu/_CPMenuWindow.j @@ -3,9 +3,9 @@ var _CPMenuWindowPool = [], _CPMenuWindowPoolCapacity = 5, - + _CPMenuWindowBackgroundColors = []; - + _CPMenuWindowMenuBarBackgroundStyle = 0; _CPMenuWindowPopUpBackgroundStyle = 1; _CPMenuWindowAttachedMenuBackgroundStyle = 2; @@ -16,7 +16,7 @@ var STICKY_TIME_INTERVAL = 500, LEFT_MARGIN = 1.0, RIGHT_MARGIN = 1.0, BOTTOM_MARGIN = 5.0, - + SCROLL_INDICATOR_HEIGHT = 16.0; /* @@ -26,10 +26,10 @@ var STICKY_TIME_INTERVAL = 500, { _CPMenuView _menuView; CPClipView _menuClipView; - + CPImageView _moreAboveView; CPImageView _moreBelowView; - + CGRect _unconstrainedFrame; CGRect _constraintRect; } @@ -67,9 +67,9 @@ var STICKY_TIME_INTERVAL = 500, { if (self != [_CPMenuWindow class]) return; - + var bundle = [CPBundle bundleForClass:self]; - + _CPMenuWindowMoreAboveImage = [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"_CPMenuWindow/_CPMenuWindowMoreAbove.png"] size:CGSizeMake(38.0, 18.0)]; _CPMenuWindowMoreBelowImage = [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"_CPMenuWindow/_CPMenuWindowMoreBelow.png"] size:CGSizeMake(38.0, 18.0)]; } @@ -89,31 +89,31 @@ var STICKY_TIME_INTERVAL = 500, [self setAcceptsMouseMovedEvents:YES]; var contentView = [self contentView]; - + _menuView = [[_CPMenuView alloc] initWithFrame:CGRectMakeZero()]; - + _menuClipView = [[CPClipView alloc] initWithFrame:CGRectMake(LEFT_MARGIN, TOP_MARGIN, 0.0, 0.0)]; [_menuClipView setDocumentView:_menuView]; - + [contentView addSubview:_menuClipView]; - + _moreAboveView = [[CPImageView alloc] initWithFrame:CGRectMakeZero()]; - + [_moreAboveView setImage:_CPMenuWindowMoreAboveImage]; [_moreAboveView setFrameSize:[_CPMenuWindowMoreAboveImage size]]; - + [contentView addSubview:_moreAboveView]; - + _moreBelowView = [[CPImageView alloc] initWithFrame:CGRectMakeZero()]; - + [_moreBelowView setImage:_CPMenuWindowMoreBelowImage]; [_moreBelowView setFrameSize:[_CPMenuWindowMoreBelowImage size]]; - + [contentView addSubview:_moreBelowView]; [self setShadowStyle:CPWindowShadowStyleMenu]; } - + return self; } @@ -135,7 +135,7 @@ var STICKY_TIME_INTERVAL = 500, + (CPColor)backgroundColorForBackgroundStyle:(_CPMenuWindowBackgroundStyle)aBackgroundStyle { var color = _CPMenuWindowBackgroundColors[aBackgroundStyle]; - + if (!color) { var bundle = [CPBundle bundleForClass:[self class]]; @@ -146,32 +146,32 @@ var STICKY_TIME_INTERVAL = 500, [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"_CPMenuWindow/_CPMenuWindowRounded0.png"] size:CGSizeMake(4.0, 4.0)], [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"_CPMenuWindow/_CPMenuWindow1.png"] size:CGSizeMake(1.0, 4.0)], [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"_CPMenuWindow/_CPMenuWindowRounded2.png"] size:CGSizeMake(4.0, 4.0)], - + [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"_CPMenuWindow/_CPMenuWindow3.png"] size:CGSizeMake(4.0, 1.0)], [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"_CPMenuWindow/_CPMenuWindow4.png"] size:CGSizeMake(1.0, 1.0)], [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"_CPMenuWindow/_CPMenuWindow5.png"] size:CGSizeMake(4.0, 1.0)], - + [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"_CPMenuWindow/_CPMenuWindowRounded6.png"] size:CGSizeMake(4.0, 4.0)], [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"_CPMenuWindow/_CPMenuWindow7.png"] size:CGSizeMake(1.0, 4.0)], [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"_CPMenuWindow/_CPMenuWindowRounded8.png"] size:CGSizeMake(4.0, 4.0)] ]]]; - + else if (aBackgroundStyle == _CPMenuWindowMenuBarBackgroundStyle) color = [CPColor colorWithPatternImage:[[CPNinePartImage alloc] initWithImageSlices: [ [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"_CPMenuWindow/_CPMenuWindow3.png"] size:CGSizeMake(4.0, 0.0)], [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"_CPMenuWindow/_CPMenuWindow4.png"] size:CGSizeMake(1.0, 0.0)], [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"_CPMenuWindow/_CPMenuWindow5.png"] size:CGSizeMake(4.0, 0.0)], - + [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"_CPMenuWindow/_CPMenuWindow3.png"] size:CGSizeMake(4.0, 1.0)], [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"_CPMenuWindow/_CPMenuWindow4.png"] size:CGSizeMake(1.0, 1.0)], [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"_CPMenuWindow/_CPMenuWindow5.png"] size:CGSizeMake(4.0, 1.0)], - + [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"_CPMenuWindow/_CPMenuWindowRounded6.png"] size:CGSizeMake(4.0, 4.0)], [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"_CPMenuWindow/_CPMenuWindow7.png"] size:CGSizeMake(1.0, 4.0)], [[CPImage alloc] initWithContentsOfFile:[bundle pathForResource:@"_CPMenuWindow/_CPMenuWindowRounded8.png"] size:CGSizeMake(4.0, 4.0)] ]]]; - + _CPMenuWindowBackgroundColors[aBackgroundStyle] = color; } @@ -187,11 +187,11 @@ var STICKY_TIME_INTERVAL = 500, { [aMenu _setMenuWindow:self]; [_menuView setMenu:aMenu]; - + var menuViewSize = [_menuView frame].size; - + [self setFrameSize:CGSizeMake(LEFT_MARGIN + menuViewSize.width + RIGHT_MARGIN, TOP_MARGIN + menuViewSize.height + BOTTOM_MARGIN)]; - + [_menuView scrollPoint:CGPointMake(0.0, 0.0)]; [_menuClipView setFrame:CGRectMake(LEFT_MARGIN, TOP_MARGIN, menuViewSize.width, menuViewSize.height)]; } @@ -211,7 +211,7 @@ var STICKY_TIME_INTERVAL = 500, - (void)orderFront:(id)aSender { [self setFrame:_unconstrainedFrame]; - + [super orderFront:aSender]; } @@ -270,16 +270,16 @@ var STICKY_TIME_INTERVAL = 500, topMargin = TOP_MARGIN, bottomMargin = BOTTOM_MARGIN, - + contentView = [self contentView], bounds = [contentView bounds]; if (moreAbove) { topMargin += SCROLL_INDICATOR_HEIGHT; - + var frame = [_moreAboveView frame]; - + [_moreAboveView setFrameOrigin:CGPointMake((CGRectGetWidth(bounds) - CGRectGetWidth(frame)) / 2.0, (TOP_MARGIN + SCROLL_INDICATOR_HEIGHT - CGRectGetHeight(frame)) / 2.0)]; } @@ -288,10 +288,10 @@ var STICKY_TIME_INTERVAL = 500, if (moreBelow) { bottomMargin += SCROLL_INDICATOR_HEIGHT; - + [_moreBelowView setFrameOrigin:CGPointMake((CGRectGetWidth(bounds) - CGRectGetWidth([_moreBelowView frame])) / 2.0, CGRectGetHeight(bounds) - SCROLL_INDICATOR_HEIGHT - BOTTOM_MARGIN)]; } - + [_moreBelowView setHidden:!moreBelow]; var clipFrame = CGRectMake(LEFT_MARGIN, topMargin, CGRectGetWidth(constrainedFrame) - LEFT_MARGIN - RIGHT_MARGIN, CGRectGetHeight(constrainedFrame) - topMargin - bottomMargin) @@ -428,7 +428,7 @@ var STICKY_TIME_INTERVAL = 500, { CPArray _menuItemViews; CPArray _visibleMenuItemInfos; - + CPFont _font @accessors(property=font); } @@ -480,7 +480,7 @@ var STICKY_TIME_INTERVAL = 500, - (void)tile { - [_menuItemViews makeObjectsPerformSelector:@selector(removeFromSuperview)]; + [_menuItemViews makeObjectsPerformSelector:@selector(removeFromSuperview)]; _menuItemViews = []; _visibleMenuItemInfos = []; @@ -500,15 +500,15 @@ var STICKY_TIME_INTERVAL = 500, for (; index < count; ++index) { var item = items[index], - view = [item _menuItemView]; - + view = [item _menuItemView]; + _menuItemViews.push(view); - + if ([item isHidden]) continue; _visibleMenuItemInfos.push({ view:view, index:index }); - + [view setFont:_font]; [view setShowsStateColumn:showsStateColumn]; [view synchronizeWithMenuItem]; diff --git a/AppKit/CPMenuItem/_CPMenuItemMenuBarView.j b/AppKit/CPMenuItem/_CPMenuItemMenuBarView.j index 8ba3b1ec5..06ee3eb29 100644 --- a/AppKit/CPMenuItem/_CPMenuItemMenuBarView.j +++ b/AppKit/CPMenuItem/_CPMenuItemMenuBarView.j @@ -9,7 +9,7 @@ var SelectionColor = nil, SUBMENU_INDICATOR_COLOR = nil, _CPMenuItemSelectionColor = nil, _CPMenuItemTextShadowColor = nil, - + _CPMenuItemDefaultStateImages = [], _CPMenuItemDefaultStateHighlightedImages = []; @@ -40,7 +40,7 @@ var SelectionColor = nil, _CPMenuItemSelectionColor = [CPColor colorWithCalibratedRed:95.0 / 255.0 green:131.0 / 255.0 blue:185.0 / 255.0 alpha:1.0]; _CPMenuItemTextShadowColor = [CPColor colorWithCalibratedRed:26.0 / 255.0 green: 73.0 / 255.0 blue:109.0 / 255.0 alpha:1.0]; - + _CPMenuItemDefaultStateImages[CPOffState] = nil; _CPMenuItemDefaultStateHighlightedImages[CPOffState] = nil; @@ -141,7 +141,7 @@ var SelectionColor = nil, imageAndTextViewFrame.origin.y = FLOOR((height - CGRectGetHeight(imageAndTextViewFrame)) / 2.0); [_imageAndTextView setFrame:imageAndTextViewFrame]; - + if (hasSubmenuIndicator) { submenuViewFrame.origin.y = FLOOR((height - CGRectGetHeight(submenuViewFrame)) / 2.0) + 1.0; @@ -149,7 +149,7 @@ var SelectionColor = nil, } _minSize = CGSizeMake(x + HORIZONTAL_MARGIN, height); - + [self setAutoresizesSubviews:NO]; [self setFrameSize:_minSize]; [self setAutoresizesSubviews:YES]; @@ -218,19 +218,19 @@ var SelectionColor = nil, { var context = [[CPGraphicsContext currentContext] graphicsPort], bounds = [self bounds]; - + bounds.size.height -= 1.0; bounds.size.width -= 2.0; bounds.origin.x += 1.0; CGContextBeginPath(context); - + CGContextMoveToPoint(context, CGRectGetMinX(bounds), CGRectGetMinY(bounds)); CGContextAddLineToPoint(context, CGRectGetMaxX(bounds), CGRectGetMinY(bounds)); CGContextAddLineToPoint(context, CGRectGetMidX(bounds), CGRectGetMaxY(bounds)); - + CGContextClosePath(context); - + CGContextSetShadowWithColor(context, CGSizeMake(0.0, 1.0), 1.1, _shadowColor || [CPColor whiteColor]); CGContextSetFillColor(context, _color || [CPColor blackColor]); CGContextFillPath(context); diff --git a/AppKit/CPMenuItem/_CPMenuItemSeparatorView.j b/AppKit/CPMenuItem/_CPMenuItemSeparatorView.j index 95a930f06..66857ef29 100644 --- a/AppKit/CPMenuItem/_CPMenuItemSeparatorView.j +++ b/AppKit/CPMenuItem/_CPMenuItemSeparatorView.j @@ -27,10 +27,10 @@ bounds = [self bounds]; CGContextBeginPath(context); - + CGContextMoveToPoint(context, CGRectGetMinX(bounds), FLOOR(CGRectGetMidY(bounds)) - 0.5); CGContextAddLineToPoint(context, CGRectGetMaxX(bounds), FLOOR(CGRectGetMidY(bounds)) - 0.5); - + CGContextSetStrokeColor(context, [CPColor lightGrayColor]); CGContextStrokePath(context); } diff --git a/AppKit/CPMenuItem/_CPMenuItemView.j b/AppKit/CPMenuItem/_CPMenuItemView.j index ad25e138f..695b9d8e7 100644 --- a/AppKit/CPMenuItem/_CPMenuItemView.j +++ b/AppKit/CPMenuItem/_CPMenuItemView.j @@ -11,10 +11,10 @@ var LEFT_MARGIN = 3.0, STATE_COLUMN_WIDTH = 14.0, INDENTATION_WIDTH = 17.0, VERTICAL_MARGIN = 4.0; - + var _CPMenuItemSelectionColor = nil, _CPMenuItemTextShadowColor = nil, - + _CPMenuItemDefaultStateImages = [], _CPMenuItemDefaultStateHighlightedImages = []; @@ -42,12 +42,12 @@ var _CPMenuItemSelectionColor = nil, { if (self != [_CPMenuItemView class]) return; - + _CPMenuItemSelectionColor = [CPColor colorWithCalibratedRed:95.0 / 255.0 green:131.0 / 255.0 blue:185.0 / 255.0 alpha:1.0]; _CPMenuItemTextShadowColor = [CPColor colorWithCalibratedRed:26.0 / 255.0 green: 73.0 / 255.0 blue:109.0 / 255.0 alpha:1.0]; - + var bundle = [CPBundle bundleForClass:self]; - + _CPMenuItemDefaultStateImages[CPOffState] = nil; _CPMenuItemDefaultStateHighlightedImages[CPOffState] = nil; @@ -72,12 +72,12 @@ var _CPMenuItemSelectionColor = nil, _menuItem = aMenuItem; _showsStateColumn = YES; _isDirty = YES; - + [self setAutoresizingMask:CPViewWidthSizable]; [self synchronizeWithMenuItem]; } - + return self; } @@ -111,7 +111,7 @@ var _CPMenuItemSelectionColor = nil, _view = menuItemView; } } - + else if ([_menuItem menu] == [CPApp mainMenu]) { if (![_view isKindOfClass:[_CPMenuItemMenuBarView class]]) @@ -129,7 +129,7 @@ var _CPMenuItemSelectionColor = nil, [_view removeFromSuperview]; _view = [_CPMenuItemStandardView view]; } - + [_view setMenuItem:_menuItem]; } @@ -160,7 +160,7 @@ var _CPMenuItemSelectionColor = nil, { if (![_menuItem hasSubmenu]) return NO; - + return CGRectContainsPoint([_submenuView frame], [self convertPoint:[anEvent locationInWindow] fromView:nil]); } @@ -191,7 +191,7 @@ var _CPMenuItemSelectionColor = nil, { if (_textColor == aColor) return; - + _textColor = aColor; [_imageAndTextView setTextColor:[self textColor]]; @@ -207,7 +207,7 @@ var _CPMenuItemSelectionColor = nil, { if (_textShadowColor == aColor) return; - + _textShadowColor = aColor; [_imageAndTextView setTextShadowColor:[self textShadowColor]]; @@ -232,23 +232,23 @@ var _CPMenuItemSelectionColor = nil, return; _color = aColor; - + [self setNeedsDisplay:YES]; } - (void)drawRect:(CGRect)aRect { var context = [[CPGraphicsContext currentContext] graphicsPort]; - + CGContextBeginPath(context); - + CGContextMoveToPoint(context, 1.0, 4.0); CGContextAddLineToPoint(context, 9.0, 4.0); CGContextAddLineToPoint(context, 5.0, 8.0); CGContextAddLineToPoint(context, 1.0, 4.0); - + CGContextClosePath(context); - + CGContextSetFillColor(context, _color); CGContextFillPath(context); } diff --git a/AppKit/CPWindow/_CPBorderlessBridgeWindowView.j b/AppKit/CPWindow/_CPBorderlessBridgeWindowView.j index 9cecd5f96..26293bf4b 100644 --- a/AppKit/CPWindow/_CPBorderlessBridgeWindowView.j +++ b/AppKit/CPWindow/_CPBorderlessBridgeWindowView.j @@ -46,31 +46,31 @@ var _CPToolbarViewBackgroundColor = nil; - (void)tile { [super tile]; - + var theWindow = [self window], bounds = [self bounds]; - + [[theWindow contentView] setFrame:CGRectMake(0.0, [self toolbarMaxY], CGRectGetWidth(bounds), CGRectGetHeight(bounds) - [self toolbarMaxY])]; - + if (![[theWindow toolbar] isVisible]) { [_toolbarBackgroundView removeFromSuperview]; - + _toolbarBackgroundView = nil; - + return; } - + if (!_toolbarBackgroundView) { _toolbarBackgroundView = [[CPView alloc] initWithFrame:CGRectMakeZero()]; - + [_toolbarBackgroundView setBackgroundColor:[[self class] toolbarBackgroundColor]]; [_toolbarBackgroundView setAutoresizingMask:CPViewWidthSizable]; - + [self addSubview:_toolbarBackgroundView positioned:CPWindowBelow relativeTo:nil]; } - + var frame = CGRectMakeZero(), toolbarOffset = [self toolbarOffset]; diff --git a/AppKit/CPWindow/_CPDocModalWindowView.j b/AppKit/CPWindow/_CPDocModalWindowView.j index a23b78bbc..ae691300d 100644 --- a/AppKit/CPWindow/_CPDocModalWindowView.j +++ b/AppKit/CPWindow/_CPDocModalWindowView.j @@ -13,25 +13,25 @@ var _CPStandardWindowViewBodyBackgroundColor = nil; { if (!_CPStandardWindowViewBodyBackgroundColor) _CPStandardWindowViewBodyBackgroundColor = [CPColor colorWithWhite:0.96 alpha:0.9]; - - return _CPStandardWindowViewBodyBackgroundColor; + + return _CPStandardWindowViewBodyBackgroundColor; } - (id)initWithFrame:(CPRect)aFrame styleMask:(unsigned)aStyleMask { self = [super initWithFrame:aFrame styleMask:aStyleMask]; - + if (self) { var theClass = [self class], bounds = [self bounds]; - + _bodyView = [[CPView alloc] initWithFrame:_CGRectMake(0.0, 0.0, _CGRectGetWidth(bounds), _CGRectGetHeight(bounds))]; - + [_bodyView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable]; [_bodyView setBackgroundColor:[theClass bodyBackgroundColor]]; [_bodyView setHitTests:NO]; - + [self addSubview:_bodyView]; var bundle = [CPBundle bundleForClass:[CPWindow class]]; @@ -41,7 +41,7 @@ var _CPStandardWindowViewBodyBackgroundColor = nil; [self addSubview:_shadowView]; } - return self; + return self; } - (CGRect)contentRectForFrameRect:(CGRect)aFrameRect diff --git a/AppKit/CPWindow/_CPStandardWindowView.j b/AppKit/CPWindow/_CPStandardWindowView.j index 9ffe3fa40..0c2574ffa 100644 --- a/AppKit/CPWindow/_CPStandardWindowView.j +++ b/AppKit/CPWindow/_CPStandardWindowView.j @@ -342,7 +342,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, 5.0, width - leftOffset * 2.0, CGRectGetHeight([_titleField frame]))]; [[theWindow contentView] setFrameOrigin:CGPointMake(0.0, CGRectGetMaxY([_dividerView frame]))]; } diff --git a/AppKit/CPWindow/_CPWindowView.j b/AppKit/CPWindow/_CPWindowView.j index 6746567bf..6a9f62894 100644 --- a/AppKit/CPWindow/_CPWindowView.j +++ b/AppKit/CPWindow/_CPWindowView.j @@ -161,7 +161,7 @@ var _CPWindowViewResizeIndicatorImage = nil; var minPointY = 0; - if([CPMenu menuBarVisible]) + if ([CPMenu menuBarVisible]) minPointY = [[CPApp mainMenu] menuBarHeight]; var restrictedPoint = CGPointMake(0, 0); diff --git a/AppKit/Cib/CPCibLoading.j b/AppKit/Cib/CPCibLoading.j index 22543eddc..12fe13e9e 100644 --- a/AppKit/Cib/CPCibLoading.j +++ b/AppKit/Cib/CPCibLoading.j @@ -76,7 +76,7 @@ var CPCibOwner = @"CPCibOwner"; // Path is based solely on anOwner: var bundle = anOwner ? [CPBundle bundleForClass:[anOwner class]] : [CPBundle mainBundle], path = [bundle pathForResource:aName]; - + return [self loadCibFile:path externalNameTable:[CPDictionary dictionaryWithObject:anOwner forKey:CPCibOwner] loadDelegate:aDelegate]; } diff --git a/AppKit/CoreGraphics/CGAffineTransform.j b/AppKit/CoreGraphics/CGAffineTransform.j index 6b7dc4880..e55fbb24f 100644 --- a/AppKit/CoreGraphics/CGAffineTransform.j +++ b/AppKit/CoreGraphics/CGAffineTransform.j @@ -65,7 +65,7 @@ function CGAffineTransformMakeRotation(anAngle) { var sin = SIN(anAngle), cos = COS(anAngle); - + return _CGAffineTransformMake(cos, sin, -sin, cos, 0.0, 0.0); } @@ -133,7 +133,7 @@ function CGRectApplyAffineTransform(aRect, anAffineTransform) maxX = MAX(topLeft.x, topRight.x, bottomLeft.x, bottomRight.x), minY = MIN(topLeft.y, topRight.y, bottomLeft.y, bottomRight.y), maxY = MAX(topLeft.y, topRight.y, bottomLeft.y, bottomRight.y); - + return _CGRectMake(minX, minY, (maxX - minX), (maxY - minY)); } diff --git a/AppKit/CoreGraphics/CGContextVML.j b/AppKit/CoreGraphics/CGContextVML.j index 28f62cbae..0b45115fe 100644 --- a/AppKit/CoreGraphics/CGContextVML.j +++ b/AppKit/CoreGraphics/CGContextVML.j @@ -304,7 +304,7 @@ function CGContextDrawLinearGradient(aContext, aGradient, aStartPoint, anEndPoin vml.push("colors=\""); for (var i = 0; i < count; i++) - vml.push((aGradient.locations[i]*100).toFixed(0)+"% "+to_string(colors[i])+(i"); } diff --git a/AppKit/Platform/CPPlatformWindow.j b/AppKit/Platform/CPPlatformWindow.j index 32a4478fe..fb4864128 100644 --- a/AppKit/Platform/CPPlatformWindow.j +++ b/AppKit/Platform/CPPlatformWindow.j @@ -103,7 +103,7 @@ var PrimaryPlatformWindow = NULL; #if PLATFORM(DOM) _windowLevels = []; _windowLayers = [CPDictionary dictionary]; - + _charCodes = {}; #endif } diff --git a/AppKit/Platform/DOM/CPDOMWindowLayer.j b/AppKit/Platform/DOM/CPDOMWindowLayer.j index 6478153e7..a919dcff6 100644 --- a/AppKit/Platform/DOM/CPDOMWindowLayer.j +++ b/AppKit/Platform/DOM/CPDOMWindowLayer.j @@ -34,13 +34,13 @@ - (id)initWithLevel:(int)aLevel { self = [super init]; - + if (self) { _level = aLevel; - + _windows = []; - + _DOMElement = document.createElement("div"); _DOMElement.style.position = "absolute"; _DOMElement.style.top = "0px"; @@ -48,7 +48,7 @@ _DOMElement.style.width = "1px"; _DOMElement.style.height = "1px"; } - + return self; } @@ -74,7 +74,7 @@ _windows[index]._index = index; _windows[index]._DOMElement.style.zIndex = index; } - + aWindow._isVisible = NO; } @@ -84,8 +84,8 @@ var count = [_windows count], zIndex = (anIndex == CPNotFound ? count : anIndex), isVisible = aWindow._isVisible; - - // If the window is already a resident of this layer, remove it. + + // If the window is already a resident of this layer, remove it. if (isVisible) { zIndex = MIN(zIndex, aWindow._index); @@ -93,12 +93,12 @@ } else ++count; - + if (anIndex == CPNotFound || anIndex >= count) [_windows addObject:aWindow]; else [_windows insertObject:aWindow atIndex:anIndex]; - + // Adjust all the affected z-indexes. for (; zIndex < count; ++zIndex) { @@ -112,7 +112,7 @@ CPDOMDisplayServerAppendChild(_DOMElement, aWindow._DOMElement); aWindow._isVisible = YES; - + if ([aWindow isFullBridge]) [aWindow setFrame:[aWindow._platformWindow usableContentFrame]]; } diff --git a/AppKit/Platform/DOM/CPPlatformWindow+DOM.j b/AppKit/Platform/DOM/CPPlatformWindow+DOM.j index f942e3978..cd95510ae 100644 --- a/AppKit/Platform/DOM/CPPlatformWindow+DOM.j +++ b/AppKit/Platform/DOM/CPPlatformWindow+DOM.j @@ -1114,7 +1114,7 @@ var supportsNativeDragAndDrop = [CPPlatform supportsDragAndDrop]; { var newEvent = {}; - switch(aDOMEvent.type) + switch (aDOMEvent.type) { case CPDOMEventTouchStart: newEvent.type = CPDOMEventMouseDown; break; @@ -1282,7 +1282,7 @@ var supportsNativeDragAndDrop = [CPPlatform supportsDragAndDrop]; // if there are any tracking event listeners then show the event guard so we don't lose events to iframes // TODO Actually check for tracking event listeners, not just any listener but _CPRunModalLoop. var hasTrackingEventListener = NO; - for (var i=0; i < CPApp._eventListeners.length; i++) + for (var i = 0; i < CPApp._eventListeners.length; i++) { if (CPApp._eventListeners[i]._callback !== _CPRunModalLoop) { @@ -1522,7 +1522,7 @@ var supportsNativeDragAndDrop = [CPPlatform supportsDragAndDrop]; + (void)preventKeyCodesFromPropagating:(CPArray)keyCodes { for (var i = keyCodes.length; i > 0; i--) - KeyCodesToPrevent[keyCodes[i-1]] = YES; + KeyCodesToPrevent[keyCodes[i - 1]] = YES; } /*! diff --git a/AppKit/Platform/DOM/CPPlatformWindow+DOMKeys.j b/AppKit/Platform/DOM/CPPlatformWindow+DOMKeys.j index 88d93d84f..dc9909bde 100644 --- a/AppKit/Platform/DOM/CPPlatformWindow+DOMKeys.j +++ b/AppKit/Platform/DOM/CPPlatformWindow+DOMKeys.j @@ -19,7 +19,7 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ - + // Keycodes taken and modified from Google Closure, available under Apache 2 License CPKeyCodes = { @@ -156,12 +156,12 @@ CPKeyCodes = { * @param opt_altKey Whether the alt key is held down. * @return Returns YES if it's a key that fires a keypress event. */ -CPKeyCodes.firesKeyPressEvent = function(keyCode, opt_heldKeyCode, opt_shiftKey, opt_ctrlKey, opt_altKey) +CPKeyCodes.firesKeyPressEvent = function(keyCode, opt_heldKeyCode, opt_shiftKey, opt_ctrlKey, opt_altKey) { if (!CPFeatureIsCompatible(CPJavascriptRemedialKeySupport)) return true; - if (CPBrowserIsOperatingSystem(CPMacOperatingSystem) && opt_altKey) + if (CPBrowserIsOperatingSystem(CPMacOperatingSystem) && opt_altKey) return CPKeyCodes.isCharacterKey(keyCode); // Alt but not AltGr which is represented as Alt+Ctrl. @@ -193,7 +193,7 @@ CPKeyCodes.firesKeyPressEvent = function(keyCode, opt_heldKeyCode, opt_shiftKey, * @param keyCode A key code. * @return Returns YES if the keyCode is a character key. */ -CPKeyCodes.isCharacterKey = function(keyCode) +CPKeyCodes.isCharacterKey = function(keyCode) { if (keyCode >= CPKeyCodes.ZERO && keyCode <= CPKeyCodes.NINE) return true; @@ -204,7 +204,7 @@ CPKeyCodes.isCharacterKey = function(keyCode) if (keyCode >= CPKeyCodes.A && keyCode <= CPKeyCodes.Z) return true; - switch (keyCode) + switch (keyCode) { case CPKeyCodes.SPACE: case CPKeyCodes.QUESTION_MARK: diff --git a/AppKit/Themes/Aristo/ThemeDescriptors.j b/AppKit/Themes/Aristo/ThemeDescriptors.j index b102919ce..48b10d3a8 100755 --- a/AppKit/Themes/Aristo/ThemeDescriptors.j +++ b/AppKit/Themes/Aristo/ThemeDescriptors.j @@ -1456,8 +1456,8 @@ var themedButtonValues = nil, gridColor = [CPColor colorWithHexString:@"dce0e2"], selectionColor = [CPColor colorWithHexString:@"5f83b9"], sourceListSelectionColor = [CPDictionary dictionaryWithObjects: [CGGradientCreateWithColorComponents(CGColorSpaceCreateDeviceRGB(), [98.0 / 255.0, 143.0 / 210.0, 209.0 / 255.0, 1.0, 46.0 / 255.0, 88.0 / 176.0, 208.0 / 255.0,1.0], [0,1], 2), - [CPColor colorWithCalibratedRed:81.0/255.0 green:127.0/255.0 blue:200.0/255.0 alpha:1.0], - [CPColor colorWithCalibratedRed:34.0/255.0 green:63.0/255.0 blue:123.0/255.0 alpha:1.0] + [CPColor colorWithCalibratedRed:81.0 / 255.0 green:127.0 / 255.0 blue:200.0 / 255.0 alpha:1.0], + [CPColor colorWithCalibratedRed:34.0 / 255.0 green:63.0 / 255.0 blue:123.0 / 255.0 alpha:1.0] ] forKeys: [CPSourceListGradient, CPSourceListTopLineColor, CPSourceListBottomLineColor]], diff --git a/AppKit/Themes/BlendKit/BKThemeTemplate.j b/AppKit/Themes/BlendKit/BKThemeTemplate.j index ed5fd7226..d5aacbf31 100644 --- a/AppKit/Themes/BlendKit/BKThemeTemplate.j +++ b/AppKit/Themes/BlendKit/BKThemeTemplate.j @@ -32,13 +32,13 @@ - (id)initWithCoder:(CPCoder)aCoder { self = [super init]; - + if (self) { _name = [aCoder decodeObjectForKey:@"BKThemeTemplateName"]; _description = [aCoder decodeObjectForKey:@"BKThemeTemplateDescription"]; } - + return self; } diff --git a/AppKit/Themes/BlendKit/BKThemedObjectTemplate.j b/AppKit/Themes/BlendKit/BKThemedObjectTemplate.j index 46797a525..73982d583 100644 --- a/AppKit/Themes/BlendKit/BKThemedObjectTemplate.j +++ b/AppKit/Themes/BlendKit/BKThemedObjectTemplate.j @@ -32,13 +32,13 @@ - (id)initWithCoder:(CPCoder)aCoder { self = [super init]; - + if (self) { _label = [aCoder decodeObjectForKey:@"BKThemedObjectTemplateLabel"]; _themedObject = [aCoder decodeObjectForKey:@"BKThemedObjectTemplateThemedObject"]; } - + return self; } diff --git a/AppKit/Themes/Default/AppController.j b/AppKit/Themes/Default/AppController.j index 54448b351..8a421e4c3 100644 --- a/AppKit/Themes/Default/AppController.j +++ b/AppKit/Themes/Default/AppController.j @@ -24,7 +24,7 @@ bundle = [CPBundle mainBundle]; // Horizontal Slider - + var horizontalTrackColor = [CPColor colorWithPatternImage:[[CPThreePartImage alloc] initWithImageSlices: [ [_CPCibCustomResource imageResourceWithName:"horizontal-track-left.png" size:CPSizeMake(2.0, 4.0)], @@ -34,21 +34,21 @@ isVertical:NO]]; var horizontalSlider = [[CPSlider alloc] initWithFrame:CGRectMake(0.0, 0.0, 50.0, 24.0)]; - + [horizontalSlider setTrackWidth:4.0]; [horizontalSlider setHorizontalTrackColor:horizontalTrackColor]; - var knobColor = [CPColor colorWithPatternImage:[_CPCibCustomResource imageResourceWithName:"knob.png" size:CPSizeMake(11.0, 11.0)]]; + var knobColor = [CPColor colorWithPatternImage:[_CPCibCustomResource imageResourceWithName:"knob.png" size:CPSizeMake(11.0, 11.0)]], knobHighlightedColor = [CPColor colorWithPatternImage:[_CPCibCustomResource imageResourceWithName:"knob-highlighted.png" size:CPSizeMake(12.0, 12.0)]]; [horizontalSlider setKnobSize:CGSizeMake(12.0, 12.0)]; [horizontalSlider setKnobColor:knobColor]; - [horizontalSlider setKnobColor:knobHighlightedColor forControlState:CPControlStateHighlighted]; + [horizontalSlider setKnobColor:knobHighlightedColor forControlState:CPControlStateHighlighted]; views.push(horizontalSlider); - + // Vertical Slider - + var verticalTrackColor = [CPColor colorWithPatternImage:[[CPThreePartImage alloc] initWithImageSlices: [ [_CPCibCustomResource imageResourceWithName:"vertical-track-top.png" size:CPSizeMake(4.0, 2.0)], @@ -56,7 +56,7 @@ [_CPCibCustomResource imageResourceWithName:"vertical-track-bottom.png" size:CPSizeMake(4.0, 2.0)] ] isVertical:YES]]; - + var verticalSlider = [[CPSlider alloc] initWithFrame:CGRectMake(0.0, 0.0, 24.0, 50.0)]; [verticalSlider setTrackWidth:4]; @@ -64,10 +64,10 @@ [verticalSlider setKnobSize:CGSizeMake(12.0, 12.0)]; [verticalSlider setKnobColor:knobColor]; - [verticalSlider setKnobColor:knobHighlightedColor forControlState:CPControlStateHighlighted]; - + [verticalSlider setKnobColor:knobHighlightedColor forControlState:CPControlStateHighlighted]; + views.push(verticalSlider); - + return views; } @@ -79,13 +79,13 @@ themeNames = [self themeNames], index = 0, count = themeNames.length; - + var tabView = [[CPTabView alloc] initWithFrame:bounds]; - + [tabView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable]; - + [contentView addSubview:tabView]; - + for (; index < count; ++index) { var item = [[CPTabViewItem alloc] initWithIdentifier:themeNames[index]], @@ -93,24 +93,24 @@ views = [self performSelector:selectorName], viewsCount = [views count], itemSize = CGSizeMake(0.0, 0.0); - + while (viewsCount--) { var size = [views[viewsCount] frame].size; - + if (size.width > itemSize.width) itemSize.width = size.width; - + if (size.height > itemSize.height) itemSize.height = size.height; } - + itemSize.height += 30; itemSize.width += 40; - + var collectionView = [[CPCollectionView alloc] initWithFrame:CGRectMakeZero()], collectionViewItem = [[CPCollectionViewItem alloc] init]; - + [collectionViewItem setView:[[ThemedView alloc] init]]; [collectionView setItemPrototype:collectionViewItem]; @@ -118,7 +118,7 @@ [collectionView setMaxItemSize:itemSize]; [collectionView setVerticalMargin:5.0]; [collectionView setContent:views]; - + [item setLabel:themeNames[index]]; [item setView:collectionView]; @@ -141,28 +141,28 @@ if (!_label) { _label = [[CPTextField alloc] initWithFrame:CGRectMakeZero()]; - + [_label setAlignment:CPCenterTextAlignment]; [_label setAutoresizingMask:CPViewMinYMargin | CPViewWidthSizable]; [_label setFont:[CPFont boldSystemFontOfSize:12.0]]; - + [self addSubview:_label]; } - + [_label setStringValue:[anObject className]]; [_label sizeToFit]; - - [_label setFrame:CGRectMake(0.0, CGRectGetHeight([self bounds]) - CGRectGetHeight([_label frame]), + + [_label setFrame:CGRectMake(0.0, CGRectGetHeight([self bounds]) - CGRectGetHeight([_label frame]), CGRectGetWidth([self bounds]), CGRectGetHeight([_label frame]))]; - + if (_view) [_view removeFromSuperview]; - + _view = anObject; - + [_view setAutoresizingMask:CPViewMinXMargin | CPViewMaxXMargin | CPViewMinYMargin | CPViewMaxYMargin]; [_view setFrameOrigin:CGPointMake((CGRectGetWidth([self bounds]) - CGRectGetWidth([_view frame])) / 2.0, (CGRectGetMinY([_label frame]) - CGRectGetHeight([_view frame])) / 2.0)]; - + [self addSubview:_view]; }