Merge branch 'master' of github.com:cappuccino/cappuccino

This commit is contained in:
Alexander Ljungberg
2012-04-26 15:25:59 +01:00
31 changed files with 326 additions and 198 deletions
+1
View File
@@ -39,6 +39,7 @@
@import "CPCibLoading.j"
@import "CPCibOutletConnector.j"
@import "CPCibRuntimeAttributesConnector.j"
@import "CPCibHelpConnector.j"
@import "CPClipView.j"
@import "CPCollectionView.j"
@import "CPCollectionViewItem.j"
+1 -3
View File
@@ -802,9 +802,7 @@ var CPButtonImageKey = @"CPButtonImageKey",
_title = [aCoder decodeObjectForKey:CPButtonTitleKey];
_alternateTitle = [aCoder decodeObjectForKey:CPButtonAlternateTitleKey];
if ([aCoder containsValueForKey:CPButtonAllowsMixedStateKey])
_allowsMixedState = [aCoder decodeBoolForKey:CPButtonAllowsMixedStateKey];
_allowsMixedState = [aCoder decodeBoolForKey:CPButtonAllowsMixedStateKey];
[self setImageDimsWhenDisabled:[aCoder decodeObjectForKey:CPButtonImageDimsWhenDisabledKey]];
+4 -4
View File
@@ -1008,11 +1008,11 @@ var CPCollectionViewMinItemSizeKey = @"CPCollectionViewMinItemSizeK
_itemSize = CGSizeMakeZero();
_minItemSize = [aCoder decodeSizeForKey:CPCollectionViewMinItemSizeKey] || CGSizeMakeZero();
_maxItemSize = [aCoder decodeSizeForKey:CPCollectionViewMaxItemSizeKey] || CGSizeMakeZero();
_minItemSize = [aCoder decodeSizeForKey:CPCollectionViewMinItemSizeKey];
_maxItemSize = [aCoder decodeSizeForKey:CPCollectionViewMaxItemSizeKey];
_maxNumberOfRows = [aCoder decodeIntForKey:CPCollectionViewMaxNumberOfRowsKey] || 0;
_maxNumberOfColumns = [aCoder decodeIntForKey:CPCollectionViewMaxNumberOfColumnsKey] || 0;
_maxNumberOfRows = [aCoder decodeIntForKey:CPCollectionViewMaxNumberOfRowsKey];
_maxNumberOfColumns = [aCoder decodeIntForKey:CPCollectionViewMaxNumberOfColumnsKey];
_verticalMargin = [aCoder decodeFloatForKey:CPCollectionViewVerticalMarginKey];
+1 -1
View File
@@ -516,7 +516,7 @@ var CPImageViewImageKey = @"CPImageViewImageKey",
[self setHasShadow:[aCoder decodeBoolForKey:CPImageViewHasShadowKey]];
[self setImageAlignment:[aCoder decodeIntForKey:CPImageViewImageAlignmentKey]];
if ([aCoder decodeBoolForKey:CPImageViewIsEditableKey] || NO)
if ([aCoder decodeBoolForKey:CPImageViewIsEditableKey])
[self setEditable:YES];
[self setNeedsLayout];
+11 -12
View File
@@ -932,34 +932,33 @@ var CPMenuItemIsSeparatorKey = @"CPMenuItemIsSeparatorKey",
_action = [aCoder decodeObjectForKey:CPMenuItemActionKey];
_isEnabled = DEFAULT_VALUE(CPMenuItemIsEnabledKey, YES);
_isHidden = DEFAULT_VALUE(CPMenuItemIsHiddenKey, NO);
_tag = DEFAULT_VALUE(CPMenuItemTagKey, 0);
_state = DEFAULT_VALUE(CPMenuItemStateKey, CPOffState);
_isHidden = [aCoder decodeBoolForKey:CPMenuItemIsHiddenKey];
_tag = [aCoder decodeIntForKey:CPMenuItemTagKey];
_state = [aCoder decodeIntForKey:CPMenuItemStateKey];
_image = DEFAULT_VALUE(CPMenuItemImageKey, nil);
_alternateImage = DEFAULT_VALUE(CPMenuItemAlternateImageKey, nil);
_image = [aCoder decodeObjectForKey:CPMenuItemImageKey];
_alternateImage = [aCoder decodeObjectForKey:CPMenuItemAlternateImageKey];
// CPImage _onStateImage;
// CPImage _offStateImage;
// CPImage _mixedStateImage;
// This order matters because setSubmenu: needs _menu to be around.
_menu = DEFAULT_VALUE(CPMenuItemMenuKey, nil);
[self setSubmenu:DEFAULT_VALUE(CPMenuItemSubmenuKey, nil)];
_menu = [aCoder decodeObjectForKey:CPMenuItemMenuKey];
[self setSubmenu:[aCoder decodeObjectForKey:CPMenuItemSubmenuKey]];
_keyEquivalent = [aCoder decodeObjectForKey:CPMenuItemKeyEquivalentKey] || @"";
_keyEquivalentModifierMask = [aCoder decodeObjectForKey:CPMenuItemKeyEquivalentModifierMaskKey] || 0;
_keyEquivalentModifierMask = [aCoder decodeIntForKey:CPMenuItemKeyEquivalentModifierMaskKey];
// int _mnemonicLocation;
// BOOL _isAlternate;
// Default is 0.
[self setIndentationLevel:[aCoder decodeIntForKey:CPMenuItemIndentationLevelKey] || 0];
[self setIndentationLevel:[aCoder decodeIntForKey:CPMenuItemIndentationLevelKey]];
// CPString _toolTip;
_representedObject = DEFAULT_VALUE(CPMenuItemRepresentedObjectKey, nil);
_view = DEFAULT_VALUE(CPMenuItemViewKey, nil);
_representedObject = [aCoder decodeObjectForKey:CPMenuItemRepresentedObjectKey];
_view = [aCoder decodeObjectForKey:CPMenuItemViewKey];
}
return self;
+1 -1
View File
@@ -371,7 +371,7 @@ var CPObjectControllerContentKey = @"CPObjectControllerCo
[self setObjectClass:objectClass || [CPMutableDictionary class]];
[self setEditable:[aCoder decodeBoolForKey:CPObjectControllerIsEditableKey]];
[self setAutomaticallyPreparesContent:[aCoder decodeBoolForKey:CPObjectControllerAutomaticallyPreparesContentKey] || NO];
[self setAutomaticallyPreparesContent:[aCoder decodeBoolForKey:CPObjectControllerAutomaticallyPreparesContentKey]];
[self setContent:[aCoder decodeObjectForKey:CPObjectControllerContentKey]];
_observedKeys = [[CPCountedSet alloc] init];
+6 -3
View File
@@ -374,12 +374,13 @@
if (rowType == CPRuleEditorRowTypeCompound)
{
var subrows = [rowItem valueForKey:_subrowsArrayKeyPath],
count = [subrows count];
count = [subrows count];
for (var i = 0; i < count; i++)
{
var subrow = [subrows objectAtIndex:i];
var predicate = [self _predicateFromRowItem:subrow];
var subrow = [subrows objectAtIndex:i],
predicate = [self _predicateFromRowItem:subrow];
[subpredicates addObject:predicate];
}
}
@@ -484,9 +485,11 @@ var CPPredicateTemplatesKey = @"CPPredicateTemplates";
- (id)initWithCoder:(id)aCoder
{
self = [super initWithCoder:aCoder];
if (self != nil)
{
var nibTemplates = [aCoder decodeObjectForKey:CPPredicateTemplatesKey];
if (nibTemplates != nil)
[self setRowTemplates:nibTemplates];
}
+2 -2
View File
@@ -1506,8 +1506,8 @@ var CPScrollViewContentViewKey = @"CPScrollViewContentView",
_scrollTimer = nil;
_implementedDelegateMethods = 0;
_scrollerStyle = [aCoder decodeIntForKey:CPScrollViewScrollerStyleKey] || CPScrollerStyleGlobal;
_scrollerKnobStyle = [aCoder decodeIntForKey:CPScrollViewScrollerKnobStyleKey] || CPScrollerKnobStyleDefault;
_scrollerStyle = [aCoder decodeObjectForKey:CPScrollViewScrollerStyleKey] || CPScrollerStyleGlobal;
_scrollerKnobStyle = [aCoder decodeObjectForKey:CPScrollViewScrollerKnobStyleKey] || CPScrollerKnobStyleDefault;
[[CPNotificationCenter defaultCenter] addObserver:self
selector:@selector(_didReceiveDefaultStyleChange:)
+4 -4
View File
@@ -263,10 +263,10 @@ var CPStepperMinValue = @"CPStepperMinValue",
if (self = [super initWithCoder:aCoder])
{
_increment = [aCoder decodeIntForKey:CPStepperIncrement];
_minValue = [aCoder decodeIntForKey:CPStepperMinValue] || 0;
_maxValue = [aCoder decodeIntForKey:CPStepperMaxValue] || 0;
_valueWraps = [aCoder decodeBoolForKey:CPStepperValueWraps] || NO;
_autorepeat = [aCoder decodeBoolForKey:CPStepperAutorepeat] || NO;
_minValue = [aCoder decodeIntForKey:CPStepperMinValue];
_maxValue = [aCoder decodeIntForKey:CPStepperMaxValue];
_valueWraps = [aCoder decodeBoolForKey:CPStepperValueWraps];
_autorepeat = [aCoder decodeBoolForKey:CPStepperAutorepeat];
[self _init];
}
+5 -6
View File
@@ -4782,15 +4782,14 @@ var CPTableViewDataSourceKey = @"CPTableViewDataSourceKey",
_tableColumns = [aCoder decodeObjectForKey:CPTableViewTableColumnsKey] || [];
[_tableColumns makeObjectsPerformSelector:@selector(setTableView:) withObject:self];
if ([aCoder containsValueForKey:CPTableViewRowHeightKey])
_rowHeight = [aCoder decodeFloatForKey:CPTableViewRowHeightKey];
else
_rowHeight = 23.0;
_rowHeight = [aCoder decodeFloatForKey:CPTableViewRowHeightKey] || 23.0;
_intercellSpacing = [aCoder decodeSizeForKey:CPTableViewIntercellSpacingKey];
_intercellSpacing = [aCoder decodeSizeForKey:CPTableViewIntercellSpacingKey] || _CGSizeMake(3.0, 2.0);
if (_CGSizeEqualToSize(_intercellSpacing, _CGSizeMakeZero()))
_intercellSpacing = _CGSizeMake(3.0, 2.0);
[self setGridColor:[aCoder decodeObjectForKey:CPTableViewGridColorKey]];
_gridStyleMask = [aCoder decodeIntForKey:CPTableViewGridStyleMaskKey] || CPTableViewGridNone;
_gridStyleMask = [aCoder decodeIntForKey:CPTableViewGridStyleMaskKey];
_usesAlternatingRowBackgroundColors = [aCoder decodeObjectForKey:CPTableViewUsesAlternatingBackgroundKey];
[self setAlternatingRowBackgroundColors:[aCoder decodeObjectForKey:CPTableViewAlternatingRowColorsKey]];
+144 -10
View File
@@ -98,6 +98,10 @@ var CPViewFlags = { },
CPViewHasCustomDrawRect = 1 << 0,
CPViewHasCustomLayoutSubviews = 1 << 1;
var CPCurrentToolTip,
CPCurrentToolTipTimer,
CPToolTipDelay = 1.0;
/*!
@ingroup appkit
@class CPView
@@ -189,7 +193,10 @@ var CPViewFlags = { },
unsigned _viewClassFlags;
// ToolTips
CPString _toolTip @accessors(property=toolTip);
CPString _toolTip @accessors(getter=toolTip);
Function _toolTipFunctionIn;
Function _toolTipFunctionOut;
BOOL _toolTipInstalled;
}
/*
@@ -215,7 +222,7 @@ var CPViewFlags = { },
CachedNotificationCenter = [CPNotificationCenter defaultCenter];
}
- (void)setupViewFlags
- (void)_setupViewFlags
{
var theClass = [self class],
classUID = [theClass UID];
@@ -236,6 +243,13 @@ var CPViewFlags = { },
_viewClassFlags = CPViewFlags[classUID];
}
- (void)_setupToolTipHandlers
{
_toolTipInstalled = NO;
_toolTipFunctionIn = function(e){[self _fireToolTip];}
_toolTipFunctionOut = function(e){[self _invalidateToolTip];};
}
+ (CPSet)keyPathsForValuesAffectingFrame
{
return [CPSet setWithObjects:@"frameOrigin", @"frameSize"];
@@ -302,7 +316,8 @@ var CPViewFlags = { },
_theme = [CPTheme defaultTheme];
_themeState = CPThemeStateNormal;
[self setupViewFlags];
[self _setupToolTipHandlers];
[self _setupViewFlags];
[self _loadThemeAttributes];
}
@@ -310,6 +325,118 @@ var CPViewFlags = { },
return self;
}
/*!
Sets the tooltip for the receiver.
@param aToolTip the tooltip
*/
- (void)setToolTip:(CPString)aToolTip
{
if (_toolTip == aToolTip)
return;
_toolTip = aToolTip;
if (_toolTip)
[self _installToolTipEventHandlers];
else
[self _uninstallToolTipEventHandlers];
}
/*! @ignore
Install the handlers for the tooltip
*/
- (void)_installToolTipEventHandlers
{
if (_toolTipInstalled)
return;
if (_DOMElement.addEventListener)
{
_DOMElement.addEventListener("mouseover", _toolTipFunctionIn, NO);
_DOMElement.addEventListener("keypress", _toolTipFunctionOut, NO);
_DOMElement.addEventListener("mouseout", _toolTipFunctionOut, NO);
}
else if (_DOMElement.attachEvent)
{
_DOMElement.attachEvent("onmouseover", _toolTipFunctionIn);
_DOMElement.attachEvent("onkeypress", _toolTipFunctionOut);
_DOMElement.attachEvent("onmouseout", _toolTipFunctionOut);
}
_toolTipInstalled = YES;
}
/*! @ignore
Uninstall the handlers for the tooltip
*/
- (void)_uninstallToolTipEventHandlers
{
if (!_toolTipInstalled)
return;
if (_DOMElement.removeEventListener)
{
_DOMElement.removeEventListener("mouseover", _toolTipFunctionIn, NO);
_DOMElement.removeEventListener("keypress", _toolTipFunctionOut, NO);
_DOMElement.removeEventListener("mouseout", _toolTipFunctionOut, NO);
}
else if (_DOMElement.detachEvent)
{
_DOMElement.detachEvent("onmouseover", _toolTipFunctionIn);
_DOMElement.detachEvent("onkeypress", _toolTipFunctionOut);
_DOMElement.detachEvent("onmouseout", _toolTipFunctionOut);
}
_toolTipInstalled = NO;
}
/*! @ignore
Starts the tooltip timer.
*/
- (void)_fireToolTip
{
if (CPCurrentToolTipTimer)
{
[CPCurrentToolTipTimer invalidate];
if (CPCurrentToolTip)
[CPCurrentToolTip close];
CPCurrentToolTip = nil;
}
if (_toolTip)
CPCurrentToolTipTimer = [CPTimer scheduledTimerWithTimeInterval:CPToolTipDelay target:self selector:@selector(_showToolTip:) userInfo:nil repeats:NO];
}
/*! @ignore
Stop the tooltip timer if any
*/
- (void)_invalidateToolTip
{
if (CPCurrentToolTipTimer)
{
[CPCurrentToolTipTimer invalidate];
CPCurrentToolTipTimer = nil;
}
if (CPCurrentToolTip)
{
[CPCurrentToolTip close];
CPCurrentToolTip = nil;
}
}
/*! @ignore
Actually shows the tooltip if any
*/
- (void)_showToolTip:(CPTimer)aTimer
{
if (CPCurrentToolTip)
[CPCurrentToolTip close];
CPCurrentToolTip = [_CPToolTip toolTipWithString:_toolTip];
}
/*!
Returns the container view of the receiver
@return the receiver's containing view
@@ -2707,6 +2834,7 @@ var CPViewAutoresizingMaskKey = @"CPViewAutoresizingMask",
CPViewBoundsKey = @"CPViewBoundsKey",
CPViewFrameKey = @"CPViewFrameKey",
CPViewHitTestsKey = @"CPViewHitTestsKey",
CPViewToolTipKey = @"CPViewToolTipKey",
CPViewIsHiddenKey = @"CPViewIsHiddenKey",
CPViewOpacityKey = @"CPViewOpacityKey",
CPViewSubviewsKey = @"CPViewSubviewsKey",
@@ -2761,7 +2889,12 @@ var CPViewAutoresizingMaskKey = @"CPViewAutoresizingMask",
_autoresizesSubviews = ![aCoder containsValueForKey:CPViewAutoresizesSubviewsKey] || [aCoder decodeBoolForKey:CPViewAutoresizesSubviewsKey];
_hitTests = ![aCoder containsValueForKey:CPViewHitTestsKey] || [aCoder decodeObjectForKey:CPViewHitTestsKey];
_hitTests = ![aCoder containsValueForKey:CPViewHitTestsKey] || [aCoder decodeBoolForKey:CPViewHitTestsKey];
[self _setupToolTipHandlers];
_toolTip = [aCoder decodeObjectForKey:CPViewToolTipKey];
if (_toolTip)
[self _installToolTipEventHandlers];
// DOM SETUP
#if PLATFORM(DOM)
@@ -2781,10 +2914,7 @@ var CPViewAutoresizingMaskKey = @"CPViewAutoresizingMask",
}
#endif
if ([aCoder containsValueForKey:CPViewIsHiddenKey])
[self setHidden:[aCoder decodeBoolForKey:CPViewIsHiddenKey]];
else
_isHidden = NO;
[self setHidden:[aCoder decodeBoolForKey:CPViewIsHiddenKey]];
if ([aCoder containsValueForKey:CPViewOpacityKey])
[self setAlphaValue:[aCoder decodeIntForKey:CPViewOpacityKey]];
@@ -2792,8 +2922,7 @@ var CPViewAutoresizingMaskKey = @"CPViewAutoresizingMask",
_opacity = 1.0;
[self setBackgroundColor:[aCoder decodeObjectForKey:CPViewBackgroundColorKey]];
[self setupViewFlags];
[self _setupViewFlags];
_theme = [CPTheme defaultTheme];
_themeClass = [aCoder decodeObjectForKey:CPViewThemeClassKey];
@@ -2874,6 +3003,9 @@ var CPViewAutoresizingMaskKey = @"CPViewAutoresizingMask",
if (_isHidden)
[aCoder encodeBool:_isHidden forKey:CPViewIsHiddenKey];
if (_toolTip)
[aCoder encodeObject:_toolTip forKey:CPViewToolTipKey];
var nextKeyView = [self nextKeyView];
if (nextKeyView !== nil && ![nextKeyView isEqual:self])
@@ -2997,3 +3129,5 @@ var _CPViewGetTransform = function(/*CPView*/ fromView, /*CPView */ toView)
return transform;
};
+59
View File
@@ -0,0 +1,59 @@
/*
* CPCibHelpConnector.j
* AppKit
*
* Created by Antoine Mercadal.
* Copyright 2012, The Cappuccino Project.
*
* 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 "CPCibConnector.j"
@implementation CPCibHelpConnector : CPCibConnector
{
id _destination;
id _file;
id _marker;
}
- (id)initWithCoder:(CPCoder)aCoder
{
if (self = [super initWithCoder:aCoder])
{
_destination = [aCoder decodeObjectForKey:@"_destination"];
_file = [aCoder decodeObjectForKey:@"_file"];
_marker = [aCoder decodeObjectForKey:@"_marker"];
}
return self;
}
- (void)encodeWithCoder:(CPCoder)aCoder
{
[super encodeWithCoder:aCoder];
[aCoder encodeObject:_destination forKey:@"_destination"];
[aCoder encodeObject:_file forKey:@"_file"];
[aCoder encodeObject:_marker forKey:@"_marker"];
}
- (void)establishConnection
{
[_destination setToolTip:_marker];
}
@end
+1
View File
@@ -30,6 +30,7 @@
@import "CPCibOutletConnector.j"
@import "CPCibBindingConnector.j"
@import "CPCibRuntimeAttributesConnector.j"
@import "CPCibHelpConnector.j"
@implementation _CPCibObjectData : CPObject
+2 -2
View File
@@ -77,8 +77,8 @@ var _CPCibWindowTemplateMinSizeKey = @"_CPCibWindowTemp
_windowTitle = [aCoder decodeObjectForKey:_CPCibWindowTemplateWindowTitleKey];
_windowView = [aCoder decodeObjectForKey:_CPCibWindowTemplateWindowViewKey];
_windowAutorecalculatesKeyViewLoop = !![aCoder decodeObjectForKey:_CPCibWindowTemplateWindowAutorecalculatesKeyViewLoop];
_windowIsFullPlatformWindow = !![aCoder decodeObjectForKey:_CPCibWindowTemplateWindowIsFullPlatformWindowKey];
_windowAutorecalculatesKeyViewLoop = [aCoder decodeBoolForKey:_CPCibWindowTemplateWindowAutorecalculatesKeyViewLoop];
_windowIsFullPlatformWindow = [aCoder decodeBoolForKey:_CPCibWindowTemplateWindowIsFullPlatformWindowKey];
}
return self;
+1 -118
View File
@@ -27,10 +27,7 @@
_CPToolTipWindowMask = 1 << 27;
var _CPToolTipHeight = 24.0,
_CPToolTipFontSize = 11.0,
_CPCurrentToolTip,
_CPCurrentToolTipTimer,
_CPToolTipDelay = 1.0;
_CPToolTipFontSize = 11.0;
/*! @ingroup appkit
This is a basic tooltip that behaves mostly like Cocoa ones.
@@ -178,118 +175,4 @@ var _CPToolTipHeight = 24.0,
/*! @ingroup appkit
Add tooltip support to CPView.
*/
@implementation CPView (toolTips)
/*!
Sets the tooltip for the receiver.
@param aToolTip the tooltip
*/
- (void)setToolTip:(CPString)aToolTip
{
if (_toolTip == aToolTip)
return;
_toolTip = aToolTip;
if (!_DOMElement)
return;
var fIn = function(e)
{
[self _fireToolTip];
},
fOut = function(e)
{
[self _invalidateToolTip];
};
if (_toolTip)
{
if (_DOMElement.addEventListener)
{
_DOMElement.addEventListener("mouseover", fIn, NO);
_DOMElement.addEventListener("keypress", fOut, NO);
_DOMElement.addEventListener("mouseout", fOut, NO);
}
else if (_DOMElement.attachEvent)
{
_DOMElement.attachEvent("onmouseover", fIn);
_DOMElement.attachEvent("onkeypress", fOut);
_DOMElement.attachEvent("onmouseout", fOut);
}
}
else
{
if (_DOMElement.removeEventListener)
{
_DOMElement.removeEventListener("mouseover", fIn, NO);
_DOMElement.removeEventListener("keypress", fOut, NO);
_DOMElement.removeEventListener("mouseout", fOut, NO);
}
else if (_DOMElement.detachEvent)
{
_DOMElement.detachEvent("onmouseover", fIn);
_DOMElement.detachEvent("onkeypress", fOut);
_DOMElement.detachEvent("onmouseout", fOut);
}
}
}
/*!
Returns the receiver's tooltip.
*/
- (CPString)toolTip
{
return _toolTip;
}
/*! @ignore
Starts the tooltip timer.
*/
- (void)_fireToolTip
{
if (_CPCurrentToolTipTimer)
{
[_CPCurrentToolTipTimer invalidate];
if (_CPCurrentToolTip)
[_CPCurrentToolTip close];
_CPCurrentToolTip = nil;
}
if (_toolTip)
_CPCurrentToolTipTimer = [CPTimer scheduledTimerWithTimeInterval:_CPToolTipDelay target:self selector:@selector(_showToolTip:) userInfo:nil repeats:NO];
}
/*! @ignore
Stop the tooltip timer if any
*/
- (void)_invalidateToolTip
{
if (_CPCurrentToolTipTimer)
{
[_CPCurrentToolTipTimer invalidate];
_CPCurrentToolTipTimer = nil;
}
if (_CPCurrentToolTip)
{
[_CPCurrentToolTip close];
_CPCurrentToolTip = nil;
}
}
/*! @ignore
Actually shows the tooltip if any
*/
- (void)_showToolTip:(CPTimer)aTimer
{
if (_CPCurrentToolTip)
[_CPCurrentToolTip close];
_CPCurrentToolTip = [_CPToolTip toolTipWithString:_toolTip];
}
@end
+16 -9
View File
@@ -251,7 +251,9 @@ var CPArrayClass = Ni
*/
- (float)decodeFloatForKey:(CPString)aKey
{
return [self decodeObjectForKey:aKey];
var f = [self decodeObjectForKey:aKey];
return f === nil ? 0.0 : f;
}
/*
@@ -261,7 +263,9 @@ var CPArrayClass = Ni
*/
- (double)decodeDoubleForKey:(CPString)aKey
{
return [self decodeObjectForKey:aKey];
var d = [self decodeObjectForKey:aKey];
return d === nil ? 0.0 : d;
}
/*
@@ -271,7 +275,9 @@ var CPArrayClass = Ni
*/
- (int)decodeIntForKey:(CPString)aKey
{
return [self decodeObjectForKey:aKey];
var i = [self decodeObjectForKey:aKey];
return i === nil ? 0 : i;
}
/*
@@ -284,9 +290,9 @@ var CPArrayClass = Ni
var object = [self decodeObjectForKey:aKey];
if (object)
return CPPointFromString(object);
return CGPointFromString(object);
else
return CPPointMake(0.0, 0.0);
return CGPointMakeZero();
}
/*
@@ -299,9 +305,9 @@ var CPArrayClass = Ni
var object = [self decodeObjectForKey:aKey];
if (object)
return CPRectFromString(object);
return CGRectFromString(object);
else
return CPRectMakeZero();
return CGRectMakeZero();
}
/*
@@ -314,9 +320,9 @@ var CPArrayClass = Ni
var object = [self decodeObjectForKey:aKey];
if (object)
return CPSizeFromString(object);
return CGSizeFromString(object);
else
return CPSizeMake(0.0, 0.0);
return CGSizeMakeZero();
}
/*
@@ -366,6 +372,7 @@ var CPArrayClass = Ni
return nil;
var objectClass = data.isa;
if (objectClass === CPDataClass)
return data.bytes();
@@ -24,6 +24,8 @@
02998CEB1369BF7D006C73DB /* Growl Registration Ticket.growlRegDict in Resources */ = {isa = PBXBuildFile; fileRef = 02998CEA1369BF7D006C73DB /* Growl Registration Ticket.growlRegDict */; };
02998CF71369C339006C73DB /* Growl.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 02998CF61369C339006C73DB /* Growl.framework */; };
02998CF91369C38A006C73DB /* Growl.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 02998CF61369C339006C73DB /* Growl.framework */; };
4E2D0D01154840B400475C01 /* help.rtfd in Resources */ = {isa = PBXBuildFile; fileRef = 4E2D0D00154840B400475C01 /* help.rtfd */; };
4E2D0D03154840BC00475C01 /* help.rtfd in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4E2D0D00154840B400475C01 /* help.rtfd */; };
651DAE1F13B0CAB900ECA3F0 /* PRHEmptyGrowlDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 651DAE1D13B0CAB900ECA3F0 /* PRHEmptyGrowlDelegate.m */; };
/* End PBXBuildFile section */
@@ -35,6 +37,7 @@
dstSubfolderSpec = 10;
files = (
02998CF91369C38A006C73DB /* Growl.framework in CopyFiles */,
4E2D0D03154840BC00475C01 /* help.rtfd in CopyFiles */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -62,6 +65,7 @@
29B97319FDCFA39411CA2CEA /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/MainMenu.nib; sourceTree = "<group>"; };
29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
4E2D0D00154840B400475C01 /* help.rtfd */ = {isa = PBXFileReference; lastKnownFileType = wrapper.rtfd; path = help.rtfd; sourceTree = "<group>"; };
651DAE1C13B0CAB900ECA3F0 /* PRHEmptyGrowlDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.objj.h; path = PRHEmptyGrowlDelegate.h; sourceTree = "<group>"; };
651DAE1D13B0CAB900ECA3F0 /* PRHEmptyGrowlDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PRHEmptyGrowlDelegate.m; sourceTree = "<group>"; };
8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
@@ -152,6 +156,7 @@
29B97317FDCFA39411CA2CEA /* Resources */ = {
isa = PBXGroup;
children = (
4E2D0D00154840B400475C01 /* help.rtfd */,
022BCEA61468632000B72910 /* project.pbxproj.sample */,
027FE4B91462F64E00B1AB92 /* xcodecapp-icon-working.png */,
026F3B6413866E7D00EE5B83 /* xcodecapp-icon-active.png */,
@@ -236,6 +241,7 @@
027FE4BA1462F64E00B1AB92 /* xcodecapp-icon-working.png in Resources */,
0289AC9414668CAF003CD975 /* XcodeCapp.icns in Resources */,
022BCEA71468632000B72910 /* project.pbxproj.sample in Resources */,
4E2D0D01154840B400475C01 /* help.rtfd in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
+3
View File
@@ -5,3 +5,6 @@ http://cappuccino.org/contribute/coding-style.php
To install capp_lint and its man page, execute install.sh in Terminal. You must have sudo access
to run the install script.
To run capp_lint automatically as a git pre-commit hook, copy "pre-commit" to
.git/hooks/ at the root level of a git repository.
+2 -1
View File
@@ -36,13 +36,14 @@
_borderColor = [aCoder decodeObjectForKey:@"NSBorderColor2"] || [CPColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.42];
_fillColor = [aCoder decodeObjectForKey:@"NSFillColor2"] || [CPColor clearColor];
_cornerRadius = [aCoder decodeFloatForKey:@"NSCornerRadius2"] || 0.0;
_cornerRadius = [aCoder decodeFloatForKey:@"NSCornerRadius2"];
_borderWidth = [aCoder decodeFloatForKey:@"NSBorderWidth2"] || 1.0;
_contentMargin = [aCoder decodeSizeForKey:@"NSOffsets"];
_title = [[aCoder decodeObjectForKey:@"NSTitleCell"] objectValue] || @"";
_titlePosition = [aCoder decodeObjectForKey:@"NSTitlePosition"];
if (_titlePosition === undefined)
_titlePosition = CPAtTop;
}
+5 -5
View File
@@ -102,17 +102,17 @@
{
_objectValue = [aCoder decodeDoubleForKey:@"NSValue"];
_minValue = [aCoder decodeDoubleForKey:@"NSMinValue"] || 0;
_minValue = [aCoder decodeDoubleForKey:@"NSMinValue"];
_maxValue = [aCoder decodeDoubleForKey:@"NSMaxValue"];
_warningValue = [aCoder decodeDoubleForKey:@"NSWarningValue"];
_criticalValue = [aCoder decodeDoubleForKey:@"NSCriticalValue"];
_levelIndicatorStyle = [aCoder decodeIntForKey:@"NSIndicatorStyle"] || 0;
_levelIndicatorStyle = [aCoder decodeIntForKey:@"NSIndicatorStyle"];
// None of these are included in the XIB if the defaults are used.
_tickMarkPosition = [aCoder decodeIntForKey:@"NSTickMarkPosition"] || 0;
_numberOfTickMarks = [aCoder decodeIntForKey:@"NSNumberOfTickMarks"] || 0;
_numberOfTickMarks = [aCoder decodeIntForKey:@"NSNumberOfMajorTickMarks"] || 0;
_tickMarkPosition = [aCoder decodeIntForKey:@"NSTickMarkPosition"];
_numberOfTickMarks = [aCoder decodeIntForKey:@"NSNumberOfTickMarks"];
_numberOfTickMarks = [aCoder decodeIntForKey:@"NSNumberOfMajorTickMarks"];
}
return self;
+2 -2
View File
@@ -34,7 +34,7 @@
if (self)
{
_isSeparator = [aCoder decodeObjectForKey:@"NSIsSeparator"] || NO;
_isSeparator = [aCoder decodeBoolForKey:@"NSIsSeparator"];
_title = [aCoder decodeObjectForKey:"NSTitle"];
@@ -109,4 +109,4 @@
{
}
@end
@end
+33
View File
@@ -24,6 +24,7 @@
@import <AppKit/CPCibControlConnector.j>
@import <AppKit/CPCibOutletConnector.j>
@import <AppKit/CPCibRuntimeAttributesConnector.j>
@import <AppKit/CPCibHelpConnector.j>
NIB_CONNECTION_EQUIVALENCY_TABLE = {};
@@ -213,3 +214,35 @@ var NSTransformers = [CPSet setWithObjects:
}
@end
@implementation CPCibHelpConnector (NSCoding)
- (id)NS_initWithCoder:(CPCoder)aCoder
{
self = [super NS_initWithCoder:aCoder];
if (self)
{
_destination = [aCoder decodeObjectForKey:@"NSDestination"];
_file = [aCoder decodeObjectForKey:@"NSFile"];
_marker = [aCoder decodeObjectForKey:@"NSMarker"];
}
return self;
}
@end
@implementation NSIBHelpConnector : CPCibHelpConnector
- (id)initWithCoder:(CPCoder)aCoder
{
return [self NS_initWithCoder:aCoder];
}
- (Class)classForKeyedArchiver
{
return [CPCibHelpConnector class];
}
@end
+1 -1
View File
@@ -34,7 +34,7 @@ var NSProgressIndicatorSpinningFlag = 1 << 12;
{
var NS_flags = [aCoder decodeIntForKey:@"NSpiFlags"];
_minValue = [aCoder decodeDoubleForKey:@"NSMinValue"] || 0;
_minValue = [aCoder decodeDoubleForKey:@"NSMinValue"];
_maxValue = [aCoder decodeDoubleForKey:@"NSMaxValue"];
_style = (NS_flags & NSProgressIndicatorSpinningFlag) ? CPProgressIndicatorSpinningStyle : CPProgressIndicatorBarStyle;
+2 -2
View File
@@ -84,10 +84,10 @@
{
_recentsAutosaveName = [aCoder decodeObjectForKey:@"NSRecentsAutosaveName"];
_maximumRecents = [aCoder decodeIntForKey:@"NSMaximumRecents"];
_sendsWholeSearchString = [aCoder decodeBoolForKey:@"NSSendsWholeSearchString"] ? YES : NO;
_sendsWholeSearchString = [aCoder decodeBoolForKey:@"NSSendsWholeSearchString"];
// These bytes don't seem to be used for anything else but the send immediately flag
_sendsSearchStringImmediately = [aCoder decodeBytesForKey:@"NSSearchFieldFlags"] ? YES: NO;
_sendsSearchStringImmediately = [aCoder decodeBytesForKey:@"NSSearchFieldFlags"] ? YES : NO;
}
return self;
+6 -2
View File
@@ -95,9 +95,13 @@
if (self = [super initWithCoder:aCoder])
{
_segments = [aCoder decodeObjectForKey:"NSSegmentImages"];
_selectedSegment = [aCoder decodeIntForKey:"NSSelectedSegment"] || -1;
_selectedSegment = [aCoder decodeObjectForKey:"NSSelectedSegment"];
if (_selectedSegment === nil)
_selectedSegment = -1;
_segmentStyle = [aCoder decodeIntForKey:"NSSegmentStyle"];
_trackingMode = [aCoder decodeIntForKey:"NSTrackingMode"] || CPSegmentSwitchTrackingSelectOne;
_trackingMode = [aCoder decodeIntForKey:"NSTrackingMode"];
if (_trackingMode == CPSegmentSwitchTrackingSelectOne && _selectedSegment == -1)
_selectedSegment = 0;
+1 -1
View File
@@ -91,7 +91,7 @@
_altIncrementValue = [aCoder decodeDoubleForKey:@"NSAltIncValue"];
_isVertical = [aCoder decodeBoolForKey:@"NSVertical"];
_sliderType = [aCoder decodeIntForKey:@"NSSliderType"] || 0;
_sliderType = [aCoder decodeIntForKey:@"NSSliderType"];
}
return self;
+1 -1
View File
@@ -30,7 +30,7 @@
if (self = [super NS_initWithCoder:aCoder])
{
_isVertical = [aCoder decodeBoolForKey:@"NSIsVertical"];
_isPaneSplitter = [aCoder decodeIntForKey:@"NSDividerStyle"] == 3 ? YES : NO;
_isPaneSplitter = [aCoder decodeIntForKey:@"NSDividerStyle"] == 3;
_autosaveName = [aCoder decodeObjectForKey:@"NSAutosaveName"];
}
+1 -1
View File
@@ -69,7 +69,7 @@
_usesAlternatingRowBackgroundColors = (flags & 0x00800000) ? YES : NO;
_alternatingRowBackgroundColors = [[CPColor whiteColor], [CPColor colorWithHexString:@"e4e7ff"]];
_selectionHighlightStyle = [aCoder decodeIntForKey:@"NSTableViewSelectionHighlightStyle"] || CPTableViewSelectionHighlightStyleRegular;
_selectionHighlightStyle = [aCoder decodeIntForKey:@"NSTableViewSelectionHighlightStyle"];
_columnAutoResizingStyle = [aCoder decodeIntForKey:@"NSColumnAutoresizingStyle"];
_allowsMultipleSelection = (flags & 0x08000000) ? YES : NO;
+1 -1
View File
@@ -83,7 +83,7 @@
if (self)
{
_tokenStyle = [aCoder decodeObjectForKey:@"NSTokenStyle"] || 0;
_tokenStyle = [aCoder decodeIntForKey:@"NSTokenStyle"];
}
return self;
+2 -2
View File
@@ -47,8 +47,8 @@ NS_CPToolbarItemIdentifierMap =
_itemIdentifier = NS_CPToolbarItemIdentifierMap[NS_itemIdentifier] || NS_itemIdentifier;
_minSize = [aCoder decodeSizeForKey:@"NSToolbarItemMinSize"] || CGSizeMakeZero();
_maxSize = [aCoder decodeSizeForKey:@"NSToolbarItemMaxSize"] || CGSizeMakeZero();
_minSize = [aCoder decodeSizeForKey:@"NSToolbarItemMinSize"];
_maxSize = [aCoder decodeSizeForKey:@"NSToolbarItemMaxSize"];
[self setLabel:[aCoder decodeObjectForKey:@"NSToolbarItemLabel"]];
[self setPaletteLabel:[aCoder decodeObjectForKey:@"NSToolbarItemPaletteLabel"]];
+1 -4
View File
@@ -45,10 +45,7 @@ var NSViewAutoresizingMask = 0x3F,
if (self)
{
_tag = 0;
if ([aCoder containsValueForKey:@"NSTag"])
_tag = [aCoder decodeIntForKey:@"NSTag"];
_tag = [aCoder decodeIntForKey:@"NSTag"];
_bounds = CGRectMake(0.0, 0.0, CGRectGetWidth(_frame), CGRectGetHeight(_frame));