mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-08-25 04:57:03 +00:00
Merge remote-tracking branch 'upstream/master' into CPTableView-enumerateRows
This commit is contained in:
@@ -216,6 +216,9 @@ CPEraDatePickerElementFlag = 0x0100;
|
||||
[_datePickerCalendar setHidden:YES];
|
||||
[self addSubview:_datePickerCalendar];
|
||||
|
||||
// We might have been unarchived in a disabled state.
|
||||
[_datePickerTextfield setEnabled:[self isEnabled]];
|
||||
|
||||
[self setNeedsDisplay:YES];
|
||||
[self setNeedsLayout];
|
||||
}
|
||||
@@ -529,11 +532,15 @@ CPEraDatePickerElementFlag = 0x0100;
|
||||
- (BOOL)becomeFirstResponder
|
||||
{
|
||||
if (_datePickerStyle == CPTextFieldAndStepperDatePickerStyle || _datePickerStyle == CPTextFieldDatePickerStyle)
|
||||
[_datePickerTextfield _selecteTextFieldWithFlags:[[CPApp currentEvent] modifierFlags]];
|
||||
else
|
||||
return NO;
|
||||
{
|
||||
if ([super becomeFirstResponder])
|
||||
return NO;
|
||||
|
||||
return YES;
|
||||
[_datePickerTextfield _selecteTextFieldWithFlags:[[CPApp currentEvent] modifierFlags]];
|
||||
return YES;
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
/*! Return YES
|
||||
@@ -651,7 +658,9 @@ var CPDatePickerModeKey = @"CPDatePickerModeKey",
|
||||
|
||||
- (void)encodeWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
// FIXME Do we need to encode _datePickerTextfield and _datePickerCalendar? As subviews they'll be encoded, but when we decode we recreate them anyhow.
|
||||
[super encodeWithCoder:aCoder];
|
||||
|
||||
[aCoder encodeDouble:_timeInterval forKey:CPIntervalKey];
|
||||
[aCoder encodeInt:_datePickerMode forKey:CPDatePickerModeKey];
|
||||
[aCoder encodeInt:_datePickerStyle forKey:CPDatePickerStyleKey];
|
||||
@@ -664,6 +673,7 @@ var CPDatePickerModeKey = @"CPDatePickerModeKey",
|
||||
[aCoder encodeObject:_backgroundColor forKey:CPBackgroundColorKey];
|
||||
[aCoder encodeObject:_drawsBackground forKey:CPDrawsBackgroundKey];
|
||||
[aCoder encodeObject:_isBordered forKey:CPBorderedKey];
|
||||
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -118,11 +118,6 @@ var CPShortWeekDayNameArrayEn = [@"Mo", @"Tu", @"We", @"Th", @"Fr", @"Sa", @"Su"
|
||||
#pragma mark -
|
||||
#pragma mark Responder methods
|
||||
|
||||
- (BOOL)becomeFirstResponder
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL)acceptsFirstResponder
|
||||
{
|
||||
return YES;
|
||||
|
||||
@@ -105,10 +105,21 @@ CPRatingLevelIndicatorStyle = 3;
|
||||
var filledColor = [self valueForThemeAttribute:@"color-normal"],
|
||||
value = [self doubleValue];
|
||||
|
||||
if (value <= _criticalValue)
|
||||
filledColor = [self valueForThemeAttribute:@"color-critical"];
|
||||
else if (value <= _warningValue)
|
||||
filledColor = [self valueForThemeAttribute:@"color-warning"];
|
||||
if (_warningValue < _criticalValue)
|
||||
{
|
||||
if (value >= _criticalValue)
|
||||
filledColor = [self valueForThemeAttribute:@"color-critical"];
|
||||
else if (value >= _warningValue)
|
||||
filledColor = [self valueForThemeAttribute:@"color-warning"];
|
||||
}
|
||||
else
|
||||
{
|
||||
if (value <= _criticalValue)
|
||||
filledColor = [self valueForThemeAttribute:@"color-critical"];
|
||||
else if (value <= _warningValue)
|
||||
filledColor = [self valueForThemeAttribute:@"color-warning"];
|
||||
}
|
||||
|
||||
|
||||
for (var i = 0; i < segmentCount; i++)
|
||||
{
|
||||
|
||||
+8
-9
@@ -137,9 +137,6 @@ var CPPopoverDelegate_popover_willShow_ = 1 << 0,
|
||||
*/
|
||||
- (CGSize)contentSize
|
||||
{
|
||||
if (![_popoverWindow isVisible])
|
||||
return CGRectMakeZero();
|
||||
|
||||
return [[_contentViewController view] frameSize];
|
||||
}
|
||||
|
||||
@@ -150,7 +147,10 @@ var CPPopoverDelegate_popover_willShow_ = 1 << 0,
|
||||
*/
|
||||
- (void)setContentSize:(CGSize)aSize
|
||||
{
|
||||
[[_contentViewController view] setFrameSize:aSize];
|
||||
if (!_popoverWindow)
|
||||
[[_contentViewController view] setFrameSize:aSize];
|
||||
else
|
||||
[_popoverWindow updateFrameWithSize:aSize];
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -240,13 +240,8 @@ Set the behavior of the CPPopover. It can be:
|
||||
if ([_popoverWindow isClosing])
|
||||
return;
|
||||
|
||||
if (_implementedDelegateMethods & CPPopoverDelegate_popover_willShow_)
|
||||
[_delegate popoverWillShow:self];
|
||||
|
||||
if (!_popoverWindow)
|
||||
{
|
||||
_popoverWindow = [[_CPPopoverWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:[self styleMaskForBehavior]];
|
||||
}
|
||||
|
||||
[_popoverWindow setPlatformWindow:[[positioningView window] platformWindow]];
|
||||
[_popoverWindow setAppearance:_appearance];
|
||||
@@ -255,6 +250,10 @@ Set the behavior of the CPPopover. It can be:
|
||||
[_popoverWindow setMovableByWindowBackground:NO];
|
||||
[_popoverWindow setFrame:[_popoverWindow frameRectForContentRect:[[_contentViewController view] frame]]];
|
||||
[_popoverWindow setContentView:[_contentViewController view]];
|
||||
|
||||
if (_implementedDelegateMethods & CPPopoverDelegate_popover_willShow_)
|
||||
[_delegate popoverWillShow:self];
|
||||
|
||||
[_popoverWindow positionRelativeToRect:positioningRect ofView:positioningView preferredEdge:preferredEdge];
|
||||
|
||||
if (!_animates && _implementedDelegateMethods & CPPopoverDelegate_popover_didShow_)
|
||||
|
||||
@@ -679,7 +679,7 @@ CPSegmentSwitchTrackingMomentary = 2;
|
||||
|
||||
var segment = _segments[aSegment],
|
||||
segmentWidth = [segment width],
|
||||
themeState = _themeState.hasThemeState(CPThemeStateDisabled) ? _themeStates[aSegment].and(CPThemeStateDisabled) : _themeStates[aSegment];
|
||||
themeState = _themeState.hasThemeState(CPThemeStateDisabled) ? _themeStates[aSegment].and(CPThemeStateDisabled) : _themeStates[aSegment],
|
||||
contentInset = [self valueForThemeAttribute:@"content-inset" inState:themeState],
|
||||
font = [self font];
|
||||
|
||||
|
||||
+5
-21
@@ -117,7 +117,9 @@ CPTableViewLastColumnOnlyAutoresizingStyle = 4;
|
||||
CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
|
||||
#define NUMBER_OF_COLUMNS() (_tableColumns.length)
|
||||
#define UPDATE_COLUMN_RANGES_IF_NECESSARY() if (_dirtyTableColumnRangeIndex !== CPNotFound) [self _recalculateTableColumnRanges];
|
||||
#define UPDATE_COLUMN_RANGES_IF_NECESSARY() \
|
||||
if (_dirtyTableColumnRangeIndex !== CPNotFound) \
|
||||
[self _recalculateTableColumnRanges];
|
||||
#define FULL_ROW_HEIGHT() (_rowHeight + _intercellSpacing.height)
|
||||
#define ROW_BOTTOM(__heightInfo) (__heightInfo.y + __heightInfo.height + _intercellSpacing.height)
|
||||
#define HAS_VARIABLE_ROW_HEIGHTS() (_implementedDelegateMethods & CPTableViewDelegate_tableView_heightOfRow_)
|
||||
@@ -5003,24 +5005,6 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
||||
[self setNeedsDisplay:YES];
|
||||
}
|
||||
|
||||
/*!
|
||||
@ignore
|
||||
*/
|
||||
- (BOOL)becomeFirstResponder
|
||||
{
|
||||
[self setNeedsDisplay:YES];
|
||||
return YES;
|
||||
}
|
||||
|
||||
/*!
|
||||
@ignore
|
||||
*/
|
||||
- (BOOL)resignFirstResponder
|
||||
{
|
||||
[self setNeedsDisplay:YES];
|
||||
return YES;
|
||||
}
|
||||
|
||||
/*!
|
||||
@ignore
|
||||
*/
|
||||
@@ -6287,7 +6271,7 @@ var CPTableViewDataSourceKey = @"CPTableViewDataSourceKey",
|
||||
|
||||
- (BOOL)setThemeState:(ThemeState)aState
|
||||
{
|
||||
if (aState.isa && [aState isKindOfClass:CPArray])
|
||||
if (aState.isa && [aState isKindOfClass:CPArray])
|
||||
aState = CPThemeState.apply(null, aState);
|
||||
|
||||
[super setThemeState:aState];
|
||||
@@ -6296,7 +6280,7 @@ var CPTableViewDataSourceKey = @"CPTableViewDataSourceKey",
|
||||
|
||||
- (BOOL)unsetThemeState:(ThemeState)aState
|
||||
{
|
||||
if (aState.isa && [aState isKindOfClass:CPArray])
|
||||
if (aState.isa && [aState isKindOfClass:CPArray])
|
||||
aState = CPThemeState.apply(null, aState);
|
||||
|
||||
[super unsetThemeState:aState];
|
||||
|
||||
@@ -546,7 +546,7 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
||||
/*! @ignore */
|
||||
- (BOOL)becomeFirstResponder
|
||||
{
|
||||
if (![self isEnabled])
|
||||
if (![self isEnabled] || ![super becomeFirstResponder])
|
||||
return NO;
|
||||
|
||||
// As long as we are the first responder we need to monitor the key status of our window.
|
||||
|
||||
@@ -515,6 +515,7 @@ CPThemeStateVertical = CPThemeState("vertical");
|
||||
CPThemeStateDefault = CPThemeState("default");
|
||||
CPThemeStateCircular = CPThemeState("circular");
|
||||
CPThemeStateAutocompleting = CPThemeState("autocompleting");
|
||||
CPThemeStateFirstResponder = CPThemeState("firstResponder");
|
||||
CPThemeStateMainWindow = CPThemeState("mainWindow");
|
||||
CPThemeStateKeyWindow = CPThemeState("keyWindow");
|
||||
|
||||
|
||||
@@ -381,6 +381,9 @@ CPTokenFieldDeleteButtonType = 1;
|
||||
|
||||
- (BOOL)becomeFirstResponder
|
||||
{
|
||||
if (![super becomeFirstResponder])
|
||||
return NO;
|
||||
|
||||
#if PLATFORM(DOM)
|
||||
if (CPTokenFieldInputOwner && [CPTokenFieldInputOwner window] !== [self window])
|
||||
[[CPTokenFieldInputOwner window] makeFirstResponder:nil];
|
||||
|
||||
@@ -843,7 +843,6 @@ var _CPToolbarItemInfoMake = function(anIndex, aView, aLabel, aMinWidth)
|
||||
var index = 0,
|
||||
count = _visibleItems.length,
|
||||
x = contentInset.left,
|
||||
contentInset = [self valueForThemeAttribute:@"content-inset"],
|
||||
y = contentInset.top;
|
||||
|
||||
for (; index < count; ++index)
|
||||
|
||||
+78
-3
@@ -343,6 +343,9 @@ var CPViewFlags = { },
|
||||
_scaleSize = CGSizeMake(1.0, 1.0);
|
||||
_isScaled = NO;
|
||||
|
||||
_theme = [CPTheme defaultTheme];
|
||||
_themeState = CPThemeStateNormal;
|
||||
|
||||
#if PLATFORM(DOM)
|
||||
_DOMElement = DOMElementPrototype.cloneNode(false);
|
||||
AppKitTagDOMElement(self, _DOMElement);
|
||||
@@ -354,9 +357,6 @@ var CPViewFlags = { },
|
||||
_DOMImageSizes = [];
|
||||
#endif
|
||||
|
||||
_theme = [CPTheme defaultTheme];
|
||||
_themeState = CPThemeStateNormal;
|
||||
|
||||
[self _setupToolTipHandlers];
|
||||
[self _setupViewFlags];
|
||||
|
||||
@@ -577,6 +577,21 @@ var CPViewFlags = { },
|
||||
if (![aSubview isHidden] && [self isHiddenOrHasHiddenAncestor])
|
||||
[aSubview _notifyViewDidHide];
|
||||
|
||||
// This method might be called before we are fully unarchived, in which case the theme state isn't set up yet
|
||||
// and none of the below matters anyhow.
|
||||
if (_themeState)
|
||||
{
|
||||
if ([self hasThemeState:CPThemeStateFirstResponder])
|
||||
[aSubview _notifyViewDidBecomeFirstResponder];
|
||||
else
|
||||
[aSubview _notifyViewDidResignFirstResponder];
|
||||
|
||||
if ([self hasThemeState:CPThemeStateKeyWindow])
|
||||
[aSubview _notifyWindowDidBecomeKey];
|
||||
else
|
||||
[aSubview _notifyWindowDidResignKey];
|
||||
}
|
||||
|
||||
[aSubview viewDidMoveToSuperview];
|
||||
|
||||
[self didAddSubview:aSubview];
|
||||
@@ -615,6 +630,9 @@ var CPViewFlags = { },
|
||||
if (!_isHidden && [_superview isHiddenOrHasHiddenAncestor])
|
||||
[self _notifyViewDidUnhide];
|
||||
|
||||
[self _notifyWindowDidResignKey];
|
||||
[self _notifyViewDidResignFirstResponder];
|
||||
|
||||
_superview = nil;
|
||||
|
||||
[self _setWindow:nil];
|
||||
@@ -736,6 +754,11 @@ var CPViewFlags = { },
|
||||
while (count--)
|
||||
[_subviews[count] _setWindow:aWindow];
|
||||
|
||||
if ([_window isKeyWindow])
|
||||
[self setThemeState:CPThemeStateKeyWindow];
|
||||
else
|
||||
[self unsetThemeState:CPThemeStateKeyWindow];
|
||||
|
||||
[self viewDidMoveToWindow];
|
||||
|
||||
[[self window] _dirtyKeyViewLoop];
|
||||
@@ -2928,6 +2951,58 @@ setBoundsOrigin:
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL)becomeFirstResponder
|
||||
{
|
||||
var r = [super becomeFirstResponder];
|
||||
if (r)
|
||||
[self _notifyViewDidBecomeFirstResponder];
|
||||
return r;
|
||||
}
|
||||
|
||||
- (void)_notifyViewDidBecomeFirstResponder
|
||||
{
|
||||
[self setThemeState:CPThemeStateFirstResponder];
|
||||
|
||||
var count = [_subviews count];
|
||||
while (count--)
|
||||
[_subviews[count] _notifyViewDidBecomeFirstResponder];
|
||||
}
|
||||
|
||||
- (BOOL)resignFirstResponder
|
||||
{
|
||||
var r = [super resignFirstResponder];
|
||||
if (r)
|
||||
[self _notifyViewDidResignFirstResponder];
|
||||
return r;
|
||||
}
|
||||
|
||||
- (void)_notifyViewDidResignFirstResponder
|
||||
{
|
||||
[self unsetThemeState:CPThemeStateFirstResponder];
|
||||
|
||||
var count = [_subviews count];
|
||||
while (count--)
|
||||
[_subviews[count] _notifyViewDidResignFirstResponder];
|
||||
}
|
||||
|
||||
- (void)_notifyWindowDidBecomeKey
|
||||
{
|
||||
[self setThemeState:CPThemeStateKeyWindow];
|
||||
|
||||
var count = [_subviews count];
|
||||
while (count--)
|
||||
[_subviews[count] _notifyWindowDidBecomeKey];
|
||||
}
|
||||
|
||||
- (void)_notifyWindowDidResignKey
|
||||
{
|
||||
[self unsetThemeState:CPThemeStateKeyWindow];
|
||||
|
||||
var count = [_subviews count];
|
||||
while (count--)
|
||||
[_subviews[count] _notifyWindowDidResignKey];
|
||||
}
|
||||
|
||||
#pragma mark Theme Attributes
|
||||
|
||||
+ (CPString)defaultThemeClass
|
||||
|
||||
@@ -1965,6 +1965,7 @@ CPTexturedBackgroundWindowMask
|
||||
_hasBecomeKeyWindow = YES;
|
||||
|
||||
[_windowView noteKeyWindowStateChanged];
|
||||
[_contentView _notifyWindowDidBecomeKey];
|
||||
|
||||
[[CPNotificationCenter defaultCenter]
|
||||
postNotificationName:CPWindowDidBecomeKeyNotification
|
||||
@@ -2033,6 +2034,7 @@ CPTexturedBackgroundWindowMask
|
||||
CPApp._keyWindow = nil;
|
||||
|
||||
[_windowView noteKeyWindowStateChanged];
|
||||
[_contentView _notifyWindowDidResignKey];
|
||||
|
||||
[[CPNotificationCenter defaultCenter]
|
||||
postNotificationName:CPWindowDidResignKeyNotification
|
||||
|
||||
@@ -498,6 +498,7 @@ var CALayerRegisteredRunLoopUpdates = nil;
|
||||
{
|
||||
_context = CGBitmapGraphicsContextCreate();
|
||||
|
||||
#if PLATFORM(DOM)
|
||||
_DOMContentsElement = _context.DOMElement;
|
||||
|
||||
_DOMContentsElement.style.zIndex = -100;
|
||||
@@ -515,6 +516,7 @@ var CALayerRegisteredRunLoopUpdates = nil;
|
||||
_DOMContentsElement.style.height = ROUND(CGRectGetHeight(_backingStoreFrame)) + "px";
|
||||
|
||||
_DOMElement.appendChild(_DOMContentsElement);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (USE_BUFFER)
|
||||
@@ -1036,6 +1038,7 @@ function _CALayerUpdateSublayerTransformForSublayers(aLayer)
|
||||
|
||||
function _CALayerUpdateDOM(aLayer, aMask)
|
||||
{
|
||||
#if PLATFORM(DOM)
|
||||
var DOMElementStyle = aLayer._DOMElement.style;
|
||||
|
||||
if (aMask & CALayerZPositionUpdateMask)
|
||||
@@ -1066,6 +1069,7 @@ function _CALayerUpdateDOM(aLayer, aMask)
|
||||
DOMContentsElement.style.height = height + "px";
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
function _CALayerRecalculateGeometry(aLayer, aGeometryChange)
|
||||
|
||||
@@ -987,7 +987,7 @@ var themedButtonValues = nil,
|
||||
[@"content-inset", CGInsetMake(3.0, 3.0, 3.0, 5.0), CPThemeStateTableDataView],
|
||||
|
||||
[@"text-color", [CPColor colorWithCalibratedWhite:51.0 / 255.0 alpha:1.0], CPThemeStateTableDataView],
|
||||
[@"text-color", [CPColor whiteColor], [CPThemeStateTableDataView, CPThemeStateSelectedDataView]],
|
||||
[@"text-color", [CPColor whiteColor], [CPThemeStateTableDataView, CPThemeStateSelectedDataView, CPThemeStateFirstResponder, CPThemeStateKeyWindow]],
|
||||
[@"font", [CPFont systemFontOfSize:CPFontCurrentSystemSize], [CPThemeStateTableDataView, CPThemeStateSelectedDataView]],
|
||||
[@"text-color", [CPColor blackColor], [CPThemeStateTableDataView, CPThemeStateEditable]],
|
||||
[@"text-color", [CPColor blackColor], [CPThemeStateTableDataView, CPThemeStateSelectedDataView, CPThemeStateEditing]],
|
||||
|
||||
@@ -559,19 +559,19 @@ var themedButtonValues = nil,
|
||||
[@"content-inset", CGInsetMake(0.0, 0.0, 0.0, 5.0), CPThemeStateTableDataView],
|
||||
|
||||
[@"text-color", [CPColor colorWithCalibratedWhite:51.0 / 255.0 alpha:1.0], CPThemeStateTableDataView],
|
||||
[@"text-color", [CPColor whiteColor], [CPThemeStateTableDataView, CPThemeStateSelectedDataView]],
|
||||
[@"text-color", [CPColor whiteColor], [CPThemeStateTableDataView, CPThemeStateSelectedDataView, CPThemeStateFirstResponder, CPThemeStateKeyWindow]],
|
||||
[@"font", [CPFont systemFontOfSize:CPFontCurrentSystemSize], [CPThemeStateTableDataView, CPThemeStateSelectedDataView]],
|
||||
[@"text-color", [CPColor blackColor], [CPThemeStateTableDataView, CPThemeStateEditing]],
|
||||
[@"text-color", [CPColor blackColor], [CPThemeStateTableDataView, CPThemeStateSelectedDataView, CPThemeStateEditable]],
|
||||
[@"text-color", [CPColor blackColor], [CPThemeStateTableDataView, CPThemeStateEditing, CPThemeStateFirstResponder, CPThemeStateKeyWindow]],
|
||||
[@"text-color", [CPColor blackColor], [CPThemeStateTableDataView, CPThemeStateSelectedDataView, CPThemeStateEditable, CPThemeStateFirstResponder, CPThemeStateKeyWindow]],
|
||||
[@"content-inset", CGInsetMake(7.0, 7.0, 5.0, 10.0), [CPThemeStateTableDataView, CPThemeStateEditable]],
|
||||
[@"font", [CPFont systemFontOfSize:CPFontCurrentSystemSize], [CPThemeStateTableDataView, CPThemeStateEditing]],
|
||||
[@"bezel-inset", CGInsetMake(-2.0, -2.0, -2.0, -2.0), [CPThemeStateTableDataView, CPThemeStateEditing]],
|
||||
|
||||
[@"text-color", [CPColor colorWithCalibratedWhite:125.0 / 255.0 alpha:1.0], [CPThemeStateTableDataView, CPThemeStateGroupRow]],
|
||||
[@"text-color", [CPColor colorWithCalibratedWhite:1.0 alpha:1.0], [CPThemeStateTableDataView, CPThemeStateGroupRow, CPThemeStateSelectedDataView]],
|
||||
[@"text-shadow-color", [CPColor whiteColor], [CPThemeStateTableDataView, CPThemeStateGroupRow]],
|
||||
[@"text-color", [CPColor whiteColor], [CPThemeStateTableDataView, CPThemeStateGroupRow, CPThemeStateSelectedDataView, CPThemeStateFirstResponder, CPThemeStateKeyWindow]],
|
||||
[@"text-shadow-color", [CPColor whiteColor], [CPThemeStateTableDataView, CPThemeStateGroupRow]],
|
||||
[@"text-shadow-offset", CGSizeMake(0, 1), [CPThemeStateTableDataView, CPThemeStateGroupRow]],
|
||||
[@"text-shadow-color", [CPColor colorWithCalibratedWhite:0.0 alpha:0.6], [CPThemeStateTableDataView, CPThemeStateGroupRow, CPThemeStateSelectedDataView]],
|
||||
[@"text-shadow-color", [CPColor colorWithCalibratedWhite:0.0 alpha:0.6], [CPThemeStateTableDataView, CPThemeStateGroupRow, CPThemeStateSelectedDataView, CPThemeStateFirstResponder, CPThemeStateKeyWindow]],
|
||||
[@"font", [CPFont boldSystemFontOfSize:CPFontCurrentSystemSize], [CPThemeStateTableDataView, CPThemeStateGroupRow]]
|
||||
];
|
||||
|
||||
@@ -2121,6 +2121,11 @@ var themedButtonValues = nil,
|
||||
orientation: PatternIsHorizontal
|
||||
}),
|
||||
|
||||
/*solidColor = CustomDrawView(function(drawView) {
|
||||
var gradient = [[CPGradient alloc] initWithStartingColor:[CPColor colorWithCalibratedRed:0.902 green:0.902 blue:0.902 alpha:1] endingColor:[CPColor colorWithCalibratedRed:0.878 green:0.878 blue:0.878 alpha:1]];
|
||||
[gradient drawInRect:[drawView bounds] angle:90];
|
||||
}),*/
|
||||
|
||||
solidColor = PatternColor(
|
||||
"window-standard-head-solid{position}.png",
|
||||
{
|
||||
|
||||
@@ -35,9 +35,11 @@ CPClosableOnBlurWindowMask = 1 << 4;
|
||||
CPPopoverAppearanceMinimal = 0;
|
||||
CPPopoverAppearanceHUD = 1;
|
||||
|
||||
var _CPPopoverWindow_shouldClose_ = 1 << 0,
|
||||
_CPPopoverWindow_didClose_ = 1 << 1,
|
||||
_CPPopoverWindow_didShow_ = 1 << 2;
|
||||
// we don't start from 1 because CPWindow and so CPPanel already
|
||||
// has this delegate bitmask identifier for 1, 2 and 3.
|
||||
var _CPPopoverWindow_shouldClose_ = 1 << 4,
|
||||
_CPPopoverWindow_didClose_ = 1 << 5,
|
||||
_CPPopoverWindow_didShow_ = 1 << 6;
|
||||
|
||||
|
||||
/*!
|
||||
@@ -364,6 +366,24 @@ var _CPPopoverWindow_shouldClose_ = 1 << 0,
|
||||
return CPBrowserStyleProperty('transition') && CPBrowserStyleProperty('transitionend');
|
||||
}
|
||||
|
||||
/*!
|
||||
@ignore
|
||||
*/
|
||||
- (void)updateFrameWithSize:(CGSize)aSize
|
||||
{
|
||||
var rect = CGRectMakeZero();
|
||||
rect.size = aSize;
|
||||
rect.origin = [[self contentView] frameOrigin];
|
||||
|
||||
[self setFrame:[self frameRectForContentRect:rect]];
|
||||
|
||||
if ([self isVisible])
|
||||
{
|
||||
var point = [self computeOriginFromRect:[_targetView bounds] ofView:_targetView preferredEdge:[_windowView preferredEdge]];
|
||||
[self setFrameOrigin:point];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Actions
|
||||
|
||||
|
||||
+14
-7
@@ -40,6 +40,7 @@ var _CPToolTipHeight = 24.0,
|
||||
*/
|
||||
@implementation _CPToolTip : CPWindow
|
||||
{
|
||||
CPWindow _toolTipWindow;
|
||||
CPTextField _content;
|
||||
}
|
||||
|
||||
@@ -78,8 +79,7 @@ var _CPToolTipHeight = 24.0,
|
||||
|
||||
var callbackFunction = function() {
|
||||
[_CPToolTip invalidateCurrentToolTipIfNeeded];
|
||||
_CPToolTipCurrentToolTip = [_CPToolTip toolTipWithString:[aView toolTip]];
|
||||
[_CPToolTipCurrentToolTip setPlatformWindow:[[aView window] platformWindow]];
|
||||
_CPToolTipCurrentToolTip = [_CPToolTip toolTipWithString:[aView toolTip] toolTipWindow:[aView window]];
|
||||
};
|
||||
|
||||
_CPToolTipCurrentToolTipTimer = [CPTimer scheduledTimerWithTimeInterval:_CPToolTipDelay
|
||||
@@ -91,9 +91,14 @@ var _CPToolTipHeight = 24.0,
|
||||
/*! Returns an initialized _CPToolTip with the given text and attach it to given view.
|
||||
@param aString the content of the tooltip
|
||||
*/
|
||||
+ (_CPToolTip)toolTipWithString:(CPString)aString
|
||||
+ (_CPToolTip)toolTipWithString:(CPString)aString toolTipWindow:(CPWindow)aWindow
|
||||
{
|
||||
var tooltip = [[_CPToolTip alloc] initWithString:aString styleMask:_CPToolTipWindowMask];
|
||||
// the window might be gone during the timer interval. If so, just ignore as
|
||||
// we don't want to show the tooltip anyway
|
||||
if (!aWindow)
|
||||
return nil;
|
||||
|
||||
var tooltip = [[_CPToolTip alloc] initWithString:aString styleMask:_CPToolTipWindowMask toolTipWindow:aWindow];
|
||||
|
||||
[tooltip showToolTip];
|
||||
|
||||
@@ -158,7 +163,7 @@ var _CPToolTipHeight = 24.0,
|
||||
@param aString the content of the tooltip
|
||||
@param aStyleMask the tooltip's style mask
|
||||
*/
|
||||
- (id)initWithString:(CPString)aString styleMask:(unsigned)aStyleMask
|
||||
- (id)initWithString:(CPString)aString styleMask:(unsigned)aStyleMask toolTipWindow:(CPWindow)aWindow
|
||||
{
|
||||
var toolTipFrame = CGRectMake(0.0, 0.0, 250.0, _CPToolTipHeight),
|
||||
layout = [_CPToolTip computeCorrectSize:toolTipFrame.size text:aString],
|
||||
@@ -168,6 +173,7 @@ var _CPToolTipHeight = 24.0,
|
||||
|
||||
if (self = [super initWithContentRect:toolTipFrame styleMask:aStyleMask])
|
||||
{
|
||||
_toolTipWindow = aWindow;
|
||||
_constrainsToUsableScreen = NO;
|
||||
|
||||
textFrameSize.height += 4;
|
||||
@@ -203,7 +209,7 @@ var _CPToolTipHeight = 24.0,
|
||||
- (void)showToolTip
|
||||
{
|
||||
var mousePosition = [[CPApp currentEvent] globalLocation],
|
||||
nativeRect = [[self platformWindow] nativeContentRect];
|
||||
nativeRect = [[_toolTipWindow platformWindow] nativeContentRect];
|
||||
|
||||
mousePosition.y += 20;
|
||||
|
||||
@@ -217,7 +223,8 @@ var _CPToolTipHeight = 24.0,
|
||||
mousePosition.y = mousePosition.y - CGRectGetHeight([self frame]) - 40;
|
||||
|
||||
[self setFrameOrigin:mousePosition];
|
||||
[self orderFront:nil];
|
||||
|
||||
[_toolTipWindow addChildWindow:self ordered:CPWindowAbove];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
@import <AppKit/CPLevelIndicator.j>
|
||||
|
||||
// You should never do this. This is only for testing purposes.
|
||||
#define GET_LEVEL_INDICATOR_SEGMENT(levelIndicator, i) [(levelIndicator) layoutEphemeralSubviewNamed:@"segment-bezel-" + (i) positioned:CPWindowAbove relativeToEphemeralSubviewNamed:"bezel"]
|
||||
|
||||
@implementation CPLevelIndicatorTest : OJTestCase
|
||||
{
|
||||
}
|
||||
|
||||
+ (CPLevelIndicator)indicatorWithLowWarning
|
||||
{
|
||||
var levelIndicator = [[CPLevelIndicator alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
|
||||
[levelIndicator setMinValue:0];
|
||||
[levelIndicator setMaxValue:10];
|
||||
[levelIndicator setWarningValue:4];
|
||||
[levelIndicator setCriticalValue:2];
|
||||
[levelIndicator setValue:[CPColor greenColor] forThemeAttribute:@"color-normal"];
|
||||
[levelIndicator setValue:[CPColor yellowColor] forThemeAttribute:@"color-warning"];
|
||||
[levelIndicator setValue:[CPColor redColor] forThemeAttribute:@"color-critical"];
|
||||
return levelIndicator;
|
||||
}
|
||||
|
||||
+ (CPLevelIndicator)indicatorWithHighWarning
|
||||
{
|
||||
var levelIndicator = [self indicatorWithLowWarning];
|
||||
[levelIndicator setWarningValue:6];
|
||||
[levelIndicator setCriticalValue:8];
|
||||
return levelIndicator;
|
||||
}
|
||||
|
||||
- (void)testLevelIndicatorWithLowWarningAndCriticalShouldShowNormalColor
|
||||
{
|
||||
var levelIndicator = [CPLevelIndicatorTest indicatorWithLowWarning];
|
||||
|
||||
[levelIndicator setObjectValue:5];
|
||||
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
|
||||
|
||||
[self assert:[CPColor greenColor] equals:[GET_LEVEL_INDICATOR_SEGMENT(levelIndicator, 0) backgroundColor]];
|
||||
}
|
||||
|
||||
- (void)testLevelIndicatorWithLowWarningAndCriticalShouldShowWarningColor
|
||||
{
|
||||
var levelIndicator = [CPLevelIndicatorTest indicatorWithLowWarning];
|
||||
|
||||
[levelIndicator setObjectValue:4];
|
||||
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
|
||||
|
||||
[self assert:[CPColor yellowColor] equals:[GET_LEVEL_INDICATOR_SEGMENT(levelIndicator, 0) backgroundColor]];
|
||||
}
|
||||
|
||||
- (void)testLevelIndicatorWithLowWarningAndCriticalShouldShowCriticalColor
|
||||
{
|
||||
var levelIndicator = [CPLevelIndicatorTest indicatorWithLowWarning];
|
||||
|
||||
[levelIndicator setObjectValue:2];
|
||||
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
|
||||
|
||||
[self assert:[CPColor redColor] equals:[GET_LEVEL_INDICATOR_SEGMENT(levelIndicator, 0) backgroundColor]];
|
||||
}
|
||||
|
||||
- (void)testLevelIndicatorWithHighWarningAndCriticalShouldShowNormalColor
|
||||
{
|
||||
var levelIndicator = [CPLevelIndicatorTest indicatorWithHighWarning];
|
||||
|
||||
[levelIndicator setObjectValue:5];
|
||||
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
|
||||
|
||||
[self assert:[CPColor greenColor] equals:[GET_LEVEL_INDICATOR_SEGMENT(levelIndicator, 0) backgroundColor]];
|
||||
}
|
||||
|
||||
- (void)testLevelIndicatorWithHighWarningAndCriticalShouldShowWarningColor
|
||||
{
|
||||
var levelIndicator = [CPLevelIndicatorTest indicatorWithHighWarning];
|
||||
|
||||
[levelIndicator setObjectValue:6];
|
||||
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
|
||||
|
||||
[self assert:[CPColor yellowColor] equals:[GET_LEVEL_INDICATOR_SEGMENT(levelIndicator, 0) backgroundColor]];
|
||||
}
|
||||
|
||||
- (void)testLevelIndicatorWithHighWarningAndCriticalShouldShowCriticalColor
|
||||
{
|
||||
var levelIndicator = [CPLevelIndicatorTest indicatorWithHighWarning];
|
||||
|
||||
[levelIndicator setObjectValue:8];
|
||||
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
|
||||
|
||||
[self assert:[CPColor redColor] equals:[GET_LEVEL_INDICATOR_SEGMENT(levelIndicator, 0) backgroundColor]];
|
||||
}
|
||||
@end
|
||||
@@ -245,4 +245,214 @@
|
||||
[self assertTrue:CGPointEqualToPoint(CGPointMake(4, 6), [subView0 convertPoint:CGPointMake(7, 11) fromView:tView0])]
|
||||
}
|
||||
|
||||
+ (CPArray)createResponderView:(/*@ref */CPView)viewOut siblingView:(/*@ref */CPView)siblingViewOut inWindow:(/*@ref */CPWindow)windowOut
|
||||
{
|
||||
var aView = [CPResponderView new],
|
||||
siblingView = [CPResponderView new],
|
||||
aWindow = [CPWindow new];
|
||||
|
||||
[[aWindow contentView] addSubview:aView];
|
||||
[[aWindow contentView] addSubview:siblingView];
|
||||
|
||||
if (viewOut)
|
||||
@deref(viewOut) = aView;
|
||||
if (siblingViewOut)
|
||||
@deref(siblingViewOut) = siblingView;
|
||||
if (windowOut)
|
||||
@deref(windowOut) = aWindow;
|
||||
|
||||
return aView;
|
||||
}
|
||||
|
||||
- (void)testWhenFirstResponderShouldHaveThemeStateFirstResponder
|
||||
{
|
||||
var aView, siblingView, aWindow;
|
||||
[CPViewTest createResponderView:@ref(aView) siblingView:@ref(siblingView) inWindow:@ref(aWindow)];
|
||||
|
||||
[self assertFalse:[aView hasThemeState:CPThemeStateFirstResponder]];
|
||||
[self assertFalse:[siblingView hasThemeState:CPThemeStateFirstResponder]];
|
||||
|
||||
[aWindow makeFirstResponder:aView];
|
||||
[self assertTrue:[aView hasThemeState:CPThemeStateFirstResponder]];
|
||||
|
||||
[aWindow makeFirstResponder:siblingView];
|
||||
[self assertTrue:[siblingView hasThemeState:CPThemeStateFirstResponder]];
|
||||
}
|
||||
|
||||
- (void)testWhenChildOfFirstResponderShouldHaveThemeStateFirstResponder
|
||||
{
|
||||
var aView, siblingView, aWindow;
|
||||
[CPViewTest createResponderView:@ref(aView) siblingView:@ref(siblingView) inWindow:@ref(aWindow)];
|
||||
var subview = [CPView new];
|
||||
[aView addSubview:subview];
|
||||
|
||||
[aWindow makeFirstResponder:aView];
|
||||
[self assertTrue:[aView hasThemeState:CPThemeStateFirstResponder]];
|
||||
[self assertTrue:[subview hasThemeState:CPThemeStateFirstResponder]];
|
||||
}
|
||||
|
||||
- (void)testWhenNotFirstResponderShouldLoseThemeStateFirstResponder
|
||||
{
|
||||
var aView, siblingView, aWindow;
|
||||
[CPViewTest createResponderView:@ref(aView) siblingView:@ref(siblingView) inWindow:@ref(aWindow)];
|
||||
|
||||
[aWindow makeFirstResponder:aView];
|
||||
[self assertFalse:[siblingView hasThemeState:CPThemeStateFirstResponder]];
|
||||
|
||||
[aWindow makeFirstResponder:siblingView];
|
||||
[self assertFalse:[aView hasThemeState:CPThemeStateFirstResponder]];
|
||||
}
|
||||
|
||||
- (void)testWhenNotChildOfFirstResponderShouldLoseThemeStateFirstResponder
|
||||
{
|
||||
var aView, siblingView, aWindow;
|
||||
[CPViewTest createResponderView:@ref(aView) siblingView:@ref(siblingView) inWindow:@ref(aWindow)];
|
||||
var subview = [CPView new];
|
||||
[aView addSubview:subview];
|
||||
|
||||
[aWindow makeFirstResponder:aView];
|
||||
[self assertTrue:[aView hasThemeState:CPThemeStateFirstResponder]];
|
||||
[self assertTrue:[subview hasThemeState:CPThemeStateFirstResponder]];
|
||||
|
||||
[aWindow makeFirstResponder:siblingView];
|
||||
[self assertFalse:[aView hasThemeState:CPThemeStateFirstResponder]];
|
||||
[self assertFalse:[subview hasThemeState:CPThemeStateFirstResponder]];
|
||||
}
|
||||
|
||||
- (void)testWhenFirstResponderButNotKeyWindowShouldStillHaveThemeStateFirstResponder
|
||||
{
|
||||
var aView, siblingView, aWindow;
|
||||
[CPViewTest createResponderView:@ref(aView) siblingView:@ref(siblingView) inWindow:@ref(aWindow)];
|
||||
|
||||
var aView2, siblingView2, aWindow2;
|
||||
[CPViewTest createResponderView:@ref(aView2) siblingView:@ref(siblingView2) inWindow:@ref(aWindow2)];
|
||||
|
||||
[aWindow makeKeyWindow];
|
||||
[aWindow makeFirstResponder:aView];
|
||||
[self assertTrue:[aView hasThemeState:CPThemeStateFirstResponder]];
|
||||
|
||||
[aWindow2 makeFirstResponder:siblingView];
|
||||
[aWindow2 makeKeyWindow];
|
||||
|
||||
[self assertTrue:[aView hasThemeState:CPThemeStateFirstResponder]];
|
||||
[self assertTrue:[siblingView hasThemeState:CPThemeStateFirstResponder]];
|
||||
}
|
||||
|
||||
- (void)testWhenChildOfFirstResponderButNotKeyWindowShouldStillHaveThemeStateFirstResponder
|
||||
{
|
||||
var aView, siblingView, aWindow;
|
||||
[CPViewTest createResponderView:@ref(aView) siblingView:@ref(siblingView) inWindow:@ref(aWindow)];
|
||||
|
||||
var subview = [CPView new];
|
||||
[aView addSubview:subview];
|
||||
|
||||
var aView2, siblingView2, aWindow2;
|
||||
[CPViewTest createResponderView:@ref(aView2) siblingView:@ref(siblingView2) inWindow:@ref(aWindow2)];
|
||||
|
||||
[aWindow makeKeyWindow];
|
||||
[aWindow makeFirstResponder:aView];
|
||||
[aWindow2 makeFirstResponder:siblingView];
|
||||
[aWindow2 makeKeyWindow];
|
||||
[self assertTrue:[subview hasThemeState:CPThemeStateFirstResponder]];
|
||||
}
|
||||
|
||||
- (void)testWhenNotFirstResponderButNotKeyWindowShouldStillLoseThemeStateFirstResponder
|
||||
{
|
||||
var aView, siblingView, aWindow;
|
||||
[CPViewTest createResponderView:@ref(aView) siblingView:@ref(siblingView) inWindow:@ref(aWindow)];
|
||||
|
||||
var aView2, siblingView2, aWindow2;
|
||||
[CPViewTest createResponderView:@ref(aView2) siblingView:@ref(siblingView2) inWindow:@ref(aWindow2)];
|
||||
|
||||
[aWindow makeKeyWindow];
|
||||
[aWindow makeFirstResponder:aView];
|
||||
[aWindow2 makeFirstResponder:siblingView];
|
||||
[aWindow2 makeKeyWindow];
|
||||
[aWindow makeFirstResponder:siblingView];
|
||||
|
||||
[self assertFalse:[aView hasThemeState:CPThemeStateFirstResponder]];
|
||||
}
|
||||
|
||||
- (void)testWhenNotChildOfFirstResponderButNotKeyWindowShouldShouldStillLoseThemeStateFirstResponder
|
||||
{
|
||||
var aView, siblingView, aWindow;
|
||||
[CPViewTest createResponderView:@ref(aView) siblingView:@ref(siblingView) inWindow:@ref(aWindow)];
|
||||
|
||||
var subview = [CPView new];
|
||||
[aView addSubview:subview];
|
||||
|
||||
var aView2, siblingView2, aWindow2;
|
||||
[CPViewTest createResponderView:@ref(aView2) siblingView:@ref(siblingView2) inWindow:@ref(aWindow2)];
|
||||
|
||||
[aWindow makeKeyWindow];
|
||||
[aWindow makeFirstResponder:aView];
|
||||
[aWindow2 makeFirstResponder:siblingView];
|
||||
[aWindow2 makeKeyWindow];
|
||||
[aWindow makeFirstResponder:siblingView];
|
||||
|
||||
[self assertFalse:[subview hasThemeState:CPThemeStateFirstResponder]];
|
||||
}
|
||||
|
||||
- (void)testWhenAndOnlyWhenWindowIsKeyEveryViewShouldHaveThemeStateKeyWindow
|
||||
{
|
||||
var aView, siblingView, aWindow;
|
||||
[CPViewTest createResponderView:@ref(aView) siblingView:@ref(siblingView) inWindow:@ref(aWindow)];
|
||||
|
||||
var subview = [CPView new];
|
||||
[aView addSubview:subview];
|
||||
|
||||
var aView2, siblingView2, aWindow2;
|
||||
[CPViewTest createResponderView:@ref(aView2) siblingView:@ref(siblingView2) inWindow:@ref(aWindow2)];
|
||||
|
||||
[aWindow makeKeyWindow];
|
||||
[self assertTrue:[aView hasThemeState:CPThemeStateKeyWindow]];
|
||||
[self assertTrue:[siblingView hasThemeState:CPThemeStateKeyWindow]];
|
||||
[self assertTrue:[subview hasThemeState:CPThemeStateKeyWindow]];
|
||||
[self assertFalse:[aView2 hasThemeState:CPThemeStateKeyWindow]];
|
||||
[self assertFalse:[siblingView2 hasThemeState:CPThemeStateKeyWindow]];
|
||||
|
||||
[aWindow2 makeKeyWindow];
|
||||
[self assertFalse:[aView hasThemeState:CPThemeStateKeyWindow]];
|
||||
[self assertFalse:[siblingView hasThemeState:CPThemeStateKeyWindow]];
|
||||
[self assertFalse:[subview hasThemeState:CPThemeStateKeyWindow]];
|
||||
[self assertTrue:[aView2 hasThemeState:CPThemeStateKeyWindow]];
|
||||
[self assertTrue:[siblingView2 hasThemeState:CPThemeStateKeyWindow]];
|
||||
}
|
||||
|
||||
- (void)testWhenFirstResponderBeforeBeingAddedSubviewShouldHaveThemeStateFirstResponder
|
||||
{
|
||||
var aView, siblingView, aWindow;
|
||||
[CPViewTest createResponderView:@ref(aView) siblingView:@ref(siblingView) inWindow:@ref(aWindow)];
|
||||
|
||||
[self assertFalse:[aView hasThemeState:CPThemeStateFirstResponder]];
|
||||
[self assertFalse:[siblingView hasThemeState:CPThemeStateFirstResponder]];
|
||||
|
||||
[aWindow makeFirstResponder:aView];
|
||||
|
||||
var subview = [CPView new];
|
||||
[aView addSubview:subview];
|
||||
[self assertTrue:[subview hasThemeState:CPThemeStateFirstResponder]];
|
||||
}
|
||||
|
||||
- (void)testWhenRemovedSubviewShouldLoseThemeStateFirstResponder
|
||||
{
|
||||
var aView, siblingView, aWindow;
|
||||
[CPViewTest createResponderView:@ref(aView) siblingView:@ref(siblingView) inWindow:@ref(aWindow)];
|
||||
|
||||
[aWindow makeFirstResponder:aView];
|
||||
var subview = [CPView new];
|
||||
[aView addSubview:subview];
|
||||
[subview removeFromSuperview];
|
||||
[self assertFalse:[subview hasThemeState:CPThemeStateFirstResponder]];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation CPResponderView : CPView
|
||||
|
||||
- (BOOL)acceptsFirstResponder
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
@end
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* AppController.j
|
||||
* ThemeKitchenSink
|
||||
*
|
||||
* Created by Alexander Ljungberg on May 11, 2014.
|
||||
* Copyright 2014, SlevenBits, Ltd. All rights reserved.
|
||||
*/
|
||||
|
||||
@import <Foundation/Foundation.j>
|
||||
@import <AppKit/AppKit.j>
|
||||
|
||||
|
||||
@implementation AppController : CPObject
|
||||
{
|
||||
@outlet CPWindow window1;
|
||||
@outlet CPWindow window2;
|
||||
@outlet CPTableView tableView;
|
||||
@outlet CPOutlineView outlineView;
|
||||
@outlet CPTokenField tokenField;
|
||||
@outlet CPArrayController arrayController1;
|
||||
}
|
||||
|
||||
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
|
||||
{
|
||||
// This is called when the application is done loading.
|
||||
}
|
||||
|
||||
- (void)awakeFromCib
|
||||
{
|
||||
// This is called when the cib is done loading.
|
||||
// You can implement this method on any object instantiated from a Cib.
|
||||
// It's a useful hook for setting up current UI values, and other things.
|
||||
[arrayController1 setContent:@[
|
||||
@{'animal': 'cat', 'legs': 4},
|
||||
@{'animal': 'duck', 'legs': 2},
|
||||
@{'animal': 'centipede', 'legs': 100},
|
||||
]];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>Main cib file base name</key>
|
||||
<string>MainMenu.cib</string>
|
||||
<key>CPBundleName</key>
|
||||
<string>ThemeKitchenSink</string>
|
||||
<key>CPDefaultTheme</key>
|
||||
<string>Aristo2</string>
|
||||
<key>CPBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>CPHumanReadableCopyright</key>
|
||||
<string>Copyright © 2014, SlevenBits, Ltd. All rights reserved.</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,184 @@
|
||||
/*
|
||||
* Jakefile
|
||||
* ThemeKitchenSink
|
||||
*
|
||||
* Created by Alexander Ljungberg on May 11, 2014.
|
||||
* Copyright 2014, SlevenBits, Ltd. All rights reserved.
|
||||
*/
|
||||
|
||||
var ENV = require("system").env,
|
||||
FILE = require("file"),
|
||||
JAKE = require("jake"),
|
||||
task = JAKE.task,
|
||||
FileList = JAKE.FileList,
|
||||
app = require("cappuccino/jake").app,
|
||||
configuration = ENV["CONFIG"] || ENV["CONFIGURATION"] || ENV["c"] || "Debug",
|
||||
OS = require("os"),
|
||||
projectName = "ThemeKitchenSink";
|
||||
|
||||
app (projectName, function(task)
|
||||
{
|
||||
ENV["OBJJ_INCLUDE_PATHS"] = "Frameworks";
|
||||
|
||||
if (configuration === "Debug")
|
||||
ENV["OBJJ_INCLUDE_PATHS"] = FILE.join(ENV["OBJJ_INCLUDE_PATHS"], configuration);
|
||||
|
||||
task.setBuildIntermediatesPath(FILE.join("Build", "ThemeKitchenSink.build", configuration));
|
||||
task.setBuildPath(FILE.join("Build", configuration));
|
||||
|
||||
task.setProductName("ThemeKitchenSink");
|
||||
task.setIdentifier("com.yourcompany.ThemeKitchenSink");
|
||||
task.setVersion("1.0");
|
||||
task.setAuthor("SlevenBits, Ltd.");
|
||||
task.setEmail("feedback @nospam@ yourcompany.com");
|
||||
task.setSummary("ThemeKitchenSink");
|
||||
task.setSources(new FileList("**/*.j").exclude(FILE.join("Build", "**")).exclude(FILE.join("Frameworks", "Source", "**")));
|
||||
task.setResources(new FileList("Resources/**"));
|
||||
task.setIndexFilePath("index.html");
|
||||
task.setInfoPlistPath("Info.plist");
|
||||
|
||||
if (configuration === "Debug")
|
||||
task.setCompilerFlags("-DDEBUG -g");
|
||||
else
|
||||
task.setCompilerFlags("-O");
|
||||
});
|
||||
|
||||
task ("default", [projectName], function()
|
||||
{
|
||||
printResults(configuration);
|
||||
});
|
||||
|
||||
task ("build", ["default"], function()
|
||||
{
|
||||
updateApplicationSize();
|
||||
});
|
||||
|
||||
task ("debug", function()
|
||||
{
|
||||
ENV["CONFIGURATION"] = "Debug";
|
||||
JAKE.subjake(["."], "build", ENV);
|
||||
});
|
||||
|
||||
task ("release", function()
|
||||
{
|
||||
ENV["CONFIGURATION"] = "Release";
|
||||
JAKE.subjake(["."], "build", ENV);
|
||||
});
|
||||
|
||||
task ("run", ["debug"], function()
|
||||
{
|
||||
OS.system(["open", FILE.join("Build", "Debug", projectName, "index.html")]);
|
||||
});
|
||||
|
||||
task ("run-release", ["release"], function()
|
||||
{
|
||||
OS.system(["open", FILE.join("Build", "Release", projectName, "index.html")]);
|
||||
});
|
||||
|
||||
task ("deploy", ["release"], function()
|
||||
{
|
||||
FILE.mkdirs(FILE.join("Build", "Deployment", projectName));
|
||||
OS.system(["press", "-f", FILE.join("Build", "Release", projectName), FILE.join("Build", "Deployment", projectName)]);
|
||||
printResults("Deployment")
|
||||
});
|
||||
|
||||
task ("desktop", ["release"], function()
|
||||
{
|
||||
FILE.mkdirs(FILE.join("Build", "Desktop", projectName));
|
||||
require("cappuccino/nativehost").buildNativeHost(FILE.join("Build", "Release", projectName), FILE.join("Build", "Desktop", projectName, "ThemeKitchenSink.app"));
|
||||
printResults("Desktop")
|
||||
});
|
||||
|
||||
task ("run-desktop", ["desktop"], function()
|
||||
{
|
||||
OS.system([FILE.join("Build", "Desktop", projectName, "ThemeKitchenSink.app", "Contents", "MacOS", "NativeHost"), "-i"]);
|
||||
});
|
||||
|
||||
function printResults(configuration)
|
||||
{
|
||||
print("----------------------------");
|
||||
print(configuration+" app built at path: "+FILE.join("Build", configuration, projectName));
|
||||
print("----------------------------");
|
||||
}
|
||||
|
||||
function updateApplicationSize()
|
||||
{
|
||||
print("Calculating application file sizes...");
|
||||
|
||||
var contents = FILE.read(FILE.join("Build", ENV["CONFIGURATION"], projectName, "Info.plist"), { charset:"UTF-8" }),
|
||||
format = CFPropertyList.sniffedFormatOfString(contents),
|
||||
plist = CFPropertyList.propertyListFromString(contents),
|
||||
totalBytes = {executable:0, data:0, mhtml:0};
|
||||
|
||||
// Get the size of all framework executables and sprite data
|
||||
var frameworksDir = "Frameworks";
|
||||
|
||||
if (ENV["CONFIGURATION"] === "Debug")
|
||||
frameworksDir = FILE.join(frameworksDir, "Debug");
|
||||
|
||||
var frameworks = FILE.list(frameworksDir);
|
||||
|
||||
frameworks.forEach(function(framework)
|
||||
{
|
||||
if (framework !== "Source")
|
||||
addBundleFileSizes(FILE.join(frameworksDir, framework), totalBytes);
|
||||
});
|
||||
|
||||
// Read in the default theme name, and attempt to get its size
|
||||
var themeName = plist.valueForKey("CPDefaultTheme") || "Aristo2",
|
||||
themePath = nil;
|
||||
|
||||
if (themeName === "Aristo" || themeName === "Aristo2")
|
||||
themePath = FILE.join(frameworksDir, "AppKit", "Resources", themeName + ".blend");
|
||||
else
|
||||
themePath = FILE.join("Frameworks", "Resources", themeName + ".blend");
|
||||
|
||||
if (FILE.isDirectory(themePath))
|
||||
addBundleFileSizes(themePath, totalBytes);
|
||||
|
||||
// Add sizes for the app
|
||||
addBundleFileSizes(FILE.join("Build", ENV["CONFIGURATION"], projectName), totalBytes);
|
||||
|
||||
print("Executables: " + totalBytes.executable + ", sprite data: " + totalBytes.data + ", total: " + (totalBytes.executable + totalBytes.data));
|
||||
|
||||
var dict = new CFMutableDictionary();
|
||||
|
||||
dict.setValueForKey("executable", totalBytes.executable);
|
||||
dict.setValueForKey("data", totalBytes.data);
|
||||
dict.setValueForKey("mhtml", totalBytes.mhtml);
|
||||
|
||||
plist.setValueForKey("CPApplicationSize", dict);
|
||||
|
||||
FILE.write(FILE.join("Build", ENV["CONFIGURATION"], projectName, "Info.plist"), CFPropertyList.stringFromPropertyList(plist, format), { charset:"UTF-8" });
|
||||
}
|
||||
|
||||
function addBundleFileSizes(bundlePath, totalBytes)
|
||||
{
|
||||
var bundleName = FILE.basename(bundlePath),
|
||||
environment = bundleName === "Foundation" ? "Objj" : "Browser",
|
||||
bundlePath = FILE.join(bundlePath, environment + ".environment");
|
||||
|
||||
if (FILE.isDirectory(bundlePath))
|
||||
{
|
||||
var filename = bundleName + ".sj",
|
||||
filePath = new FILE.Path(FILE.join(bundlePath, filename));
|
||||
|
||||
if (filePath.exists())
|
||||
totalBytes.executable += filePath.size();
|
||||
|
||||
filePath = new FILE.Path(FILE.join(bundlePath, "dataURLs.txt"));
|
||||
|
||||
if (filePath.exists())
|
||||
totalBytes.data += filePath.size();
|
||||
|
||||
filePath = new FILE.Path(FILE.join(bundlePath, "MHTMLData.txt"));
|
||||
|
||||
if (filePath.exists())
|
||||
totalBytes.mhtml += filePath.size();
|
||||
|
||||
filePath = new FILE.Path(FILE.join(bundlePath, "MHTMLPaths.txt"));
|
||||
|
||||
if (filePath.exists())
|
||||
totalBytes.mhtml += filePath.size();
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,191 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<!--
|
||||
index-debug.html
|
||||
ThemeKitchenSink
|
||||
|
||||
Created by Alexander Ljungberg on May 11, 2014.
|
||||
Copyright 2014, SlevenBits, Ltd. All rights reserved.
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<!--[if lte IE 8]>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7, chrome=1">
|
||||
<![endif]-->
|
||||
<!--[if gte IE 9]>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
|
||||
<![endif]-->
|
||||
|
||||
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
|
||||
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
|
||||
<link rel="apple-touch-icon" href="Resources/icon.png">
|
||||
<link rel="apple-touch-startup-image" href="Resources/default.png">
|
||||
|
||||
<title>ThemeKitchenSink</title>
|
||||
|
||||
<!-- Custom javascript goes here -->
|
||||
<!-- End custom javascript -->
|
||||
|
||||
<script type="text/javascript">
|
||||
OBJJ_MAIN_FILE = "main.j";
|
||||
OBJJ_INCLUDE_PATHS = ["Frameworks/Debug", "Frameworks"];
|
||||
|
||||
var progressBar = null;
|
||||
|
||||
OBJJ_PROGRESS_CALLBACK = function(percent, appSize, path)
|
||||
{
|
||||
percent = percent * 100;
|
||||
|
||||
if (!progressBar)
|
||||
progressBar = document.getElementById("progress-bar");
|
||||
|
||||
if (progressBar)
|
||||
progressBar.style.width = Math.min(percent, 100) + "%";
|
||||
}
|
||||
|
||||
var loadingHTML =
|
||||
'<div id="loading">' +
|
||||
' <div id="loading-text">Loading...</div>' +
|
||||
' <div id="progress-indicator">' +
|
||||
' <span id="progress-bar" style="width:0%"></span>' +
|
||||
' </div>' +
|
||||
'</div>';
|
||||
</script>
|
||||
|
||||
<script type="text/javascript" src="Frameworks/Debug/Objective-J/Objective-J.js" charset="UTF-8"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
objj_msgSend_reset();
|
||||
|
||||
// DEBUG OPTIONS:
|
||||
|
||||
// Uncomment to enable printing of backtraces on exceptions:
|
||||
//objj_msgSend_decorate(objj_backtrace_decorator);
|
||||
|
||||
// Uncomment to supress exceptions that take place inside a message
|
||||
//objj_msgSend_decorate(objj_supress_exceptions_decorator)
|
||||
|
||||
// Uncomment to enable runtime type checking:
|
||||
//objj_msgSend_decorate(objj_typecheck_decorator);
|
||||
|
||||
// Uncomment (along with both above) to print backtraces on type check errors:
|
||||
//objj_typecheck_prints_backtrace = true;
|
||||
|
||||
// Uncomment to disable the default logger (CPLogConsole if window.console exists, CPLogPopup otherwise):
|
||||
//CPLogUnregister(CPLogDefault);
|
||||
|
||||
// Uncomment to enable a specific logger:
|
||||
//CPLogRegister(CPLogConsole);
|
||||
//CPLogRegister(CPLogPopup);
|
||||
|
||||
// Tag view DOM elements with a "data-cappuccino-view" attribute that contains
|
||||
// the class name of the view that created them. Comment this or set to false to disable.
|
||||
appkit_tag_dom_elements = true;
|
||||
</script>
|
||||
|
||||
<style type="text/css">
|
||||
html, body, h1, p {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* We need a body wrapper because Cappuccino is unhappy if we change the body element */
|
||||
#cappuccino-body {
|
||||
/* Position it absolutely so it will fill the height without content */
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
|
||||
/* Put it at the bottom of the stack so it doesn't interfere with UI */
|
||||
z-index: -1000;
|
||||
}
|
||||
|
||||
#cappuccino-body .container {
|
||||
display: table;
|
||||
margin: 0 auto;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
#cappuccino-body .content {
|
||||
display: table-cell;
|
||||
height: 100%;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
#loading {
|
||||
position: relative;
|
||||
top: 35%;
|
||||
}
|
||||
|
||||
#loading-text {
|
||||
height: 1.5em;
|
||||
color: #555;
|
||||
font: normal bold 36px/36px Arial, sans-serif;
|
||||
}
|
||||
|
||||
#progress-indicator {
|
||||
padding: 0px;
|
||||
height: 16px;
|
||||
border: 5px solid #555;
|
||||
border-radius: 18px;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
#progress-bar {
|
||||
position: relative;
|
||||
top: -1px;
|
||||
left: -1px;
|
||||
display: block;
|
||||
height: 18px;
|
||||
|
||||
/* Compensate for moving the bar left 1px to overlap the indicator border */
|
||||
border-right: 1px solid #555;
|
||||
background-color: #555;
|
||||
}
|
||||
|
||||
#noscript {
|
||||
position: relative;
|
||||
top: 35%;
|
||||
padding: 1em 1.5em;
|
||||
border: 5px solid #555;
|
||||
border-radius: 16px;
|
||||
background-color: white;
|
||||
color: #555;
|
||||
text-align: center;
|
||||
font: bold 24px Arial, sans-serif;
|
||||
}
|
||||
|
||||
#noscript a {
|
||||
color: #98c0ff;
|
||||
text-decoration: none;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="cappuccino-body">
|
||||
<div class="container">
|
||||
<div class="content">
|
||||
<script type="text/javascript">
|
||||
document.write(loadingHTML);
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
<noscript style="position:absolute; top:0; left:0; width:100%; height:100%">
|
||||
<div class="container">
|
||||
<div class="content">
|
||||
<div id="noscript">
|
||||
<p style="font-size:120%; margin-bottom:.75em">JavaScript is required for this site.</p>
|
||||
<p><a href="http://www.enable-javascript.com" target="_blank">Enable JavaScript</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</noscript>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,161 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<!--
|
||||
index.html
|
||||
ThemeKitchenSink
|
||||
|
||||
Created by Alexander Ljungberg on May 11, 2014.
|
||||
Copyright 2014, SlevenBits, Ltd. All rights reserved.
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<!--[if lte IE 8]>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7, chrome=1">
|
||||
<![endif]-->
|
||||
<!--[if gte IE 9]>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
|
||||
<![endif]-->
|
||||
|
||||
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
|
||||
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
||||
|
||||
<link rel="apple-touch-icon" href="Resources/icon.png">
|
||||
<link rel="apple-touch-startup-image" href="Resources/default.png">
|
||||
|
||||
<title>ThemeKitchenSink</title>
|
||||
|
||||
<!-- Custom javascript goes here -->
|
||||
<!-- End custom javascript -->
|
||||
|
||||
<script type="text/javascript">
|
||||
OBJJ_MAIN_FILE = "main.j";
|
||||
|
||||
var progressBar = null;
|
||||
|
||||
OBJJ_PROGRESS_CALLBACK = function(percent, appSize, path)
|
||||
{
|
||||
percent = percent * 100;
|
||||
|
||||
if (!progressBar)
|
||||
progressBar = document.getElementById("progress-bar");
|
||||
|
||||
if (progressBar)
|
||||
progressBar.style.width = Math.min(percent, 100) + "%";
|
||||
}
|
||||
|
||||
var loadingHTML =
|
||||
'<div id="loading">' +
|
||||
' <div id="loading-text">Loading...</div>' +
|
||||
' <div id="progress-indicator">' +
|
||||
' <span id="progress-bar" style="width:0%"></span>' +
|
||||
' </div>' +
|
||||
'</div>';
|
||||
</script>
|
||||
|
||||
<script type="text/javascript" src="Frameworks/Objective-J/Objective-J.js" charset="UTF-8"></script>
|
||||
|
||||
<style type="text/css">
|
||||
html, body, h1, p {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* We need a body wrapper because Cappuccino is unhappy if we change the body element */
|
||||
#cappuccino-body {
|
||||
/* Position it absolutely so it will fill the height without content */
|
||||
position: absolute;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
width: 100%;
|
||||
|
||||
/* Put it at the bottom of the stack so it doesn't interfere with UI */
|
||||
z-index: -1000;
|
||||
}
|
||||
|
||||
#cappuccino-body .container {
|
||||
display: table;
|
||||
margin: 0 auto;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
#cappuccino-body .content {
|
||||
display: table-cell;
|
||||
height: 100%;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
#loading {
|
||||
position: relative;
|
||||
top: 35%;
|
||||
}
|
||||
|
||||
#loading-text {
|
||||
height: 1.5em;
|
||||
color: #555;
|
||||
font: normal bold 36px/36px Arial, sans-serif;
|
||||
}
|
||||
|
||||
#progress-indicator {
|
||||
padding: 0px;
|
||||
height: 16px;
|
||||
border: 5px solid #555;
|
||||
border-radius: 18px;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
#progress-bar {
|
||||
position: relative;
|
||||
top: -1px;
|
||||
left: -1px;
|
||||
display: block;
|
||||
height: 18px;
|
||||
|
||||
/* Compensate for moving the bar left 1px to overlap the indicator border */
|
||||
border-right: 1px solid #555;
|
||||
background-color: #555;
|
||||
}
|
||||
|
||||
#noscript {
|
||||
position: relative;
|
||||
top: 35%;
|
||||
padding: 1em 1.5em;
|
||||
border: 5px solid #555;
|
||||
border-radius: 16px;
|
||||
background-color: white;
|
||||
color: #555;
|
||||
text-align: center;
|
||||
font: bold 24px Arial, sans-serif;
|
||||
}
|
||||
|
||||
#noscript a {
|
||||
color: #98c0ff;
|
||||
text-decoration: none;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="cappuccino-body">
|
||||
<div class="container">
|
||||
<div class="content">
|
||||
<script type="text/javascript">
|
||||
document.write(loadingHTML);
|
||||
</script>
|
||||
</div>
|
||||
</div>
|
||||
<noscript style="position:absolute; top:0; left:0; width:100%; height:100%">
|
||||
<div class="container">
|
||||
<div class="content">
|
||||
<div id="noscript">
|
||||
<p style="font-size:120%; margin-bottom:.75em">JavaScript is required for this site.</p>
|
||||
<p><a href="http://www.enable-javascript.com" target="_blank">Enable JavaScript</a></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</noscript>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,18 @@
|
||||
/*
|
||||
* AppController.j
|
||||
* ThemeKitchenSink
|
||||
*
|
||||
* Created by Alexander Ljungberg on May 11, 2014.
|
||||
* Copyright 2014, SlevenBits, Ltd. All rights reserved.
|
||||
*/
|
||||
|
||||
@import <Foundation/Foundation.j>
|
||||
@import <AppKit/AppKit.j>
|
||||
|
||||
@import "AppController.j"
|
||||
|
||||
|
||||
function main(args, namedArgs)
|
||||
{
|
||||
CPApplicationMain(args, namedArgs);
|
||||
}
|
||||
@@ -31,7 +31,7 @@ PROJECT_NAME = " API"
|
||||
# This could be handy for archiving the generated documentation or
|
||||
# if some version control system is used.
|
||||
|
||||
PROJECT_NUMBER = 0.9.7
|
||||
PROJECT_NUMBER = 0.9.7-1
|
||||
|
||||
PROJECT_LOGO = ./Tools/Documentation/logo.png
|
||||
|
||||
|
||||
+1
-1
@@ -2,6 +2,6 @@
|
||||
require("../common.jake");
|
||||
|
||||
// nib2cib uses fontinfo and imagesize and capp uses nib2cib
|
||||
subtasks(["fontinfo", "imagesize", "nib2cib", "capp", "dump_theme", "NativeHost", "XcodeCapp"], ["build"/*, "clean", "clobber"*/]);
|
||||
subtasks(["fontinfo", "imagesize", "nib2cib", "capp", "capp_lint", "dump_theme", "NativeHost", "XcodeCapp"], ["build"/*, "clean", "clobber"*/]);
|
||||
|
||||
subtasks(["fontinfo", "imagesize"], ["clean", "clobber"]);
|
||||
|
||||
@@ -111,7 +111,7 @@ AppController *SharedAppControllerInstance = nil;
|
||||
[[NSApplication sharedApplication] terminate:self];
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// If we were opened from the command line, self.pathToOpenAtLaunch will be set.
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
@@ -144,13 +144,14 @@ AppController *SharedAppControllerInstance = nil;
|
||||
kDefaultXCCAPIMode: [NSNumber numberWithInt:kXCCAPIModeAuto],
|
||||
kDefaultXCCReactToInodeMod: @YES,
|
||||
kDefaultXCCReopenLastProject: @YES,
|
||||
kDefaultXCCAutoOpenErrorsPanelOnWarnings: @YES,
|
||||
kDefaultXCCAutoOpenErrorsPanelOnErrors: @YES,
|
||||
kDefaultXCCAutoOpenErrorsPanelOnCappLint: @YES,
|
||||
kDefaultXCCAutoShowNotificationOnErrors: @YES,
|
||||
kDefaultXCCAutoShowNotificationOnCappLint: @NO,
|
||||
kDefaultXCCProjectHistory: [NSArray new],
|
||||
kDefaultMaxRecentProjects: @20,
|
||||
kDefaultLogLevel: [NSNumber numberWithInt:LOG_LEVEL_WARN],
|
||||
kDefaultAutoOpenXcodeProject: @YES,
|
||||
kDefaultShowProcessingNotices: @YES,
|
||||
kDefaultUseSymlinkWhenCreatingProject: @YES
|
||||
};
|
||||
|
||||
|
||||
@@ -152,12 +152,24 @@
|
||||
[self postErrorNotificationForPath:self.sourcePath line:0 message:response status:status];
|
||||
}
|
||||
}
|
||||
|
||||
[self notifyUserWithTitle:notificationTitle message:notificationMessage];
|
||||
|
||||
if ([self.xcc shouldShowErrorNotification])
|
||||
[self notifyUserWithTitle:notificationTitle message:notificationMessage];
|
||||
}
|
||||
else if (!self.xcc.isLoadingProject)
|
||||
{
|
||||
[self notifyUserWithTitle:notificationTitle message:notificationMessage];
|
||||
BOOL showFinalNotification = YES;
|
||||
|
||||
if ([self.xcc shouldProcessWithCappLint])
|
||||
{
|
||||
showFinalNotification = [self.xcc checkCappLintForPath:[NSArray arrayWithObject:self.sourcePath]];
|
||||
|
||||
if (!showFinalNotification)
|
||||
[self.xcc showCappLintErrors];
|
||||
}
|
||||
|
||||
if (showFinalNotification)
|
||||
[self notifyUserWithTitle:notificationTitle message:notificationMessage];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,7 +190,7 @@
|
||||
nil];
|
||||
|
||||
info[@"projectId"] = self.projectId;
|
||||
info[@"message"] = [NSString stringWithFormat:@"%@, line %d\n%@", [self.sourcePath lastPathComponent], 0, message];
|
||||
info[@"message"] = [NSString stringWithFormat:@"Compilation issue: %@, line %d\n%@", [self.sourcePath lastPathComponent], 0, message];
|
||||
|
||||
if (self.isCancelled)
|
||||
return;
|
||||
|
||||
@@ -17,15 +17,16 @@ extern NSString * const kDefaultFirstLaunchVersion;
|
||||
extern NSString * const kDefaultXCCAPIMode;
|
||||
extern NSString * const kDefaultXCCReactToInodeMod;
|
||||
extern NSString * const kDefaultXCCReopenLastProject;
|
||||
extern NSString * const kDefaultXCCAutoOpenErrorsPanelOnWarnings;
|
||||
extern NSString * const kDefaultXCCAutoOpenErrorsPanelOnErrors;
|
||||
extern NSString * const kDefaultXCCAutoOpenErrorsPanelOnCappLint;
|
||||
extern NSString * const kDefaultXCCAutoShowNotificationOnErrors;
|
||||
extern NSString * const kDefaultXCCAutoShowNotificationOnCappLint;
|
||||
extern NSString * const kDefaultXCCProjectHistory;
|
||||
extern NSString * const kDefaultLastOpenedPath;
|
||||
extern NSString * const kDefaultPathModificationDates;
|
||||
extern NSString * const kDefaultMaxRecentProjects;
|
||||
extern NSString * const kDefaultLogLevel;
|
||||
extern NSString * const kDefaultAutoOpenXcodeProject;
|
||||
extern NSString * const kDefaultShowProcessingNotices;
|
||||
extern NSString * const kDefaultUseSymlinkWhenCreatingProject;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -15,13 +15,14 @@ NSString * const kDefaultFirstLaunchVersion = @"firstLaunchVersion";
|
||||
NSString * const kDefaultXCCAPIMode = @"XCCAPIMode";
|
||||
NSString * const kDefaultXCCReactToInodeMod = @"XCCReactMode";
|
||||
NSString * const kDefaultXCCReopenLastProject = @"XCCReopenLastProject";
|
||||
NSString * const kDefaultXCCAutoOpenErrorsPanelOnWarnings = @"XCCAutoOpenErrorsPanelOnWarnings";
|
||||
NSString * const kDefaultXCCAutoOpenErrorsPanelOnErrors = @"XCCAutoOpenErrorsPanelOnErrors";
|
||||
NSString * const kDefaultXCCAutoOpenErrorsPanelOnCappLint = @"XCCAutoOpenErrorsPanelOnCappLint";
|
||||
NSString * const kDefaultXCCAutoShowNotificationOnErrors = @"XCCAutoOpenShowNotificationErrors";
|
||||
NSString * const kDefaultXCCAutoShowNotificationOnCappLint = @"XCCAutoShowNotificationOnCappLint";
|
||||
NSString * const kDefaultXCCProjectHistory = @"XCCProjectHistory";
|
||||
NSString * const kDefaultLastOpenedPath = @"LastOpenedPath";
|
||||
NSString * const kDefaultPathModificationDates = @"pathModificationDates";
|
||||
NSString * const kDefaultMaxRecentProjects = @"maxRecentProjects";
|
||||
NSString * const kDefaultLogLevel = @"logLevel";
|
||||
NSString * const kDefaultAutoOpenXcodeProject = @"autoOpenXcodeProject";
|
||||
NSString * const kDefaultShowProcessingNotices = @"showProcessingNotices";
|
||||
NSString * const kDefaultUseSymlinkWhenCreatingProject = @"useSymlinkWhenCreatingProject";
|
||||
|
||||
@@ -45,7 +45,8 @@ enum {
|
||||
extern NSString * const XCCConversionDidStartNotification;
|
||||
extern NSString * const XCCConversionDidEndNotification;
|
||||
extern NSString * const XCCProjectDidFinishLoadingNotification;
|
||||
|
||||
extern NSString * const XCCCappLintDidStartNotification;
|
||||
extern NSString * const XCCCappLintDidEndNotification;
|
||||
|
||||
@interface XcodeCapp : NSObject <NSTableViewDelegate, NSUserNotificationCenterDelegate, GrowlApplicationBridgeDelegate>
|
||||
|
||||
@@ -109,6 +110,9 @@ extern NSString * const XCCProjectDidFinishLoadingNotification;
|
||||
// A list of errors generated from the current batch of source processing
|
||||
@property NSMutableArray *errorList;
|
||||
|
||||
// A list of files name who can be processed, based on xcapp-ignore and path pf the project
|
||||
@property NSMutableArray *xCodeCappTargetedFiles;
|
||||
|
||||
// Panel, table and controller used to display errors
|
||||
@property (strong) IBOutlet NSPanel *errorsPanel;
|
||||
@property (unsafe_unretained) IBOutlet NSTableView *errorTable;
|
||||
@@ -119,6 +123,7 @@ extern NSString * const XCCProjectDidFinishLoadingNotification;
|
||||
- (IBAction)openErrorInEditor:(id)sender;
|
||||
- (IBAction)openXcodeProject:(id)aSender;
|
||||
- (IBAction)synchronizeProject:(id)aSender;
|
||||
- (IBAction)checkProjectWithCappLint:(id)aSender;
|
||||
|
||||
- (BOOL)executablesAreAccessible;
|
||||
- (void)stop;
|
||||
@@ -131,6 +136,8 @@ extern NSString * const XCCProjectDidFinishLoadingNotification;
|
||||
- (BOOL)isXibFile:(NSString *)path;
|
||||
- (BOOL)isXCCIgnoreFile:(NSString *)path;
|
||||
|
||||
- (BOOL)shouldShowErrorNotification;
|
||||
|
||||
- (NSString *)shadowBasePathForProjectSourcePath:(NSString *)path;
|
||||
- (BOOL)hasErrors;
|
||||
|
||||
@@ -142,6 +149,10 @@ extern NSString * const XCCProjectDidFinishLoadingNotification;
|
||||
|
||||
- (NSDictionary*)createProject:(NSString*)aPath;
|
||||
|
||||
- (BOOL)shouldProcessWithCappLint;
|
||||
- (BOOL)checkCappLintForPath:(NSArray*)paths;
|
||||
- (void)showCappLintErrors;
|
||||
|
||||
@end
|
||||
|
||||
@interface XcodeCapp (SnowLeopard)
|
||||
|
||||
@@ -74,6 +74,8 @@ static NSPredicate * XCCDirectoriesToIgnorePredicate = nil;
|
||||
// An array of the default predicates used to ignore paths.
|
||||
static NSArray *XCCDefaultIgnoredPathPredicates = nil;
|
||||
|
||||
NSString * const XCCCappLintDidStartNotification = @"XCCCappLintDidStartNotification";
|
||||
NSString * const XCCCappLintDidEndNotification = @"XCCCappLintDidEndNotification";
|
||||
|
||||
@interface XcodeCapp ()
|
||||
|
||||
@@ -241,7 +243,7 @@ void fsevents_callback(ConstFSEventStreamRef streamRef,
|
||||
// Make sure we are using jsc as the narwhal engine!
|
||||
self.environment[@"NARWHAL_ENGINE"] = @"jsc";
|
||||
|
||||
self.executables = @[@"python", @"narwhal-jsc", @"objj", @"nib2cib", @"capp"];
|
||||
self.executables = @[@"python", @"narwhal-jsc", @"objj", @"nib2cib", @"capp", @"capp_lint"];
|
||||
|
||||
// This is used to get the env var of $CAPP_BUILD
|
||||
NSDictionary *processEnvironment = [[NSProcessInfo processInfo] environment];
|
||||
@@ -317,9 +319,10 @@ void fsevents_callback(ConstFSEventStreamRef streamRef,
|
||||
|
||||
[self clearErrors:self];
|
||||
[self computeIgnoredPaths];
|
||||
|
||||
|
||||
[self prepareXcodeSupport];
|
||||
[self populateXcodeProject];
|
||||
[self populatexCodeCappTargetedFiles];
|
||||
[self waitForOperationQueueToFinishWithSelector:@selector(projectDidFinishLoading)];
|
||||
}
|
||||
|
||||
@@ -372,6 +375,25 @@ void fsevents_callback(ConstFSEventStreamRef streamRef,
|
||||
return projectCompatibilityVersion.doubleValue >= appCompatibilityVersion;
|
||||
}
|
||||
|
||||
- (void)populatexCodeCappTargetedFiles
|
||||
{
|
||||
NSFileManager *fm = [NSFileManager defaultManager];
|
||||
NSDirectoryEnumerator *filesOfProject = [fm enumeratorAtPath:self.projectPath];
|
||||
NSString *filename;
|
||||
|
||||
self.xCodeCappTargetedFiles = [NSMutableArray array];
|
||||
|
||||
while ((filename = [filesOfProject nextObject] )) {
|
||||
|
||||
NSString *fullPath = [self.projectPath stringByAppendingPathComponent:filename];
|
||||
|
||||
if (![self isSourceFile:fullPath])
|
||||
continue;
|
||||
|
||||
[self.xCodeCappTargetedFiles addObject:fullPath];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)createXcodeProject
|
||||
{
|
||||
if ([self.fm fileExistsAtPath:self.xcodeProjectPath])
|
||||
@@ -729,7 +751,7 @@ void fsevents_callback(ConstFSEventStreamRef streamRef,
|
||||
self.pbxOperations[@"add"] = addPaths;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
DDLogVerbose(@"%@ %@", NSStringFromSelector(_cmd), path);
|
||||
}
|
||||
|
||||
@@ -1359,6 +1381,7 @@ void fsevents_callback(ConstFSEventStreamRef streamRef,
|
||||
return [path substringFromIndex:self.projectPath.length + 1];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Shadow Files Management
|
||||
|
||||
- (NSString *)shadowBasePathForProjectSourcePath:(NSString *)path
|
||||
@@ -1636,17 +1659,56 @@ void fsevents_callback(ConstFSEventStreamRef streamRef,
|
||||
[self runTaskWithLaunchPath:executablePath arguments:args returnType:kTaskReturnTypeNone];
|
||||
}
|
||||
|
||||
- (BOOL)shouldShowErrorNotification
|
||||
{
|
||||
return [[NSUserDefaults standardUserDefaults] boolForKey:kDefaultXCCAutoShowNotificationOnErrors];
|
||||
}
|
||||
|
||||
- (BOOL)shouldProcessWithCappLint
|
||||
{
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
return [defaults boolForKey:kDefaultXCCAutoOpenErrorsPanelOnCappLint]
|
||||
|| [defaults boolForKey:kDefaultXCCAutoShowNotificationOnCappLint];
|
||||
}
|
||||
|
||||
- (void)showErrors
|
||||
{
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
if (([defaults boolForKey:kDefaultXCCAutoOpenErrorsPanelOnErrors] && self.hasErrors) ||
|
||||
([defaults boolForKey:kDefaultXCCAutoOpenErrorsPanelOnWarnings] && self.errorList.count))
|
||||
if ([defaults boolForKey:kDefaultXCCAutoOpenErrorsPanelOnErrors] && self.errorList.count)
|
||||
{
|
||||
[self openErrorsPanel:self];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)showCappLintErrors
|
||||
{
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
if ([defaults boolForKey:kDefaultXCCAutoOpenErrorsPanelOnCappLint] && self.errorList.count)
|
||||
[self openErrorsPanel:self];
|
||||
|
||||
if ([defaults boolForKey:kDefaultXCCAutoShowNotificationOnCappLint])
|
||||
{
|
||||
NSUInteger numberError = [self.errorList count];
|
||||
|
||||
if (numberError)
|
||||
{
|
||||
NSDictionary *error = [self.errorList objectAtIndex:0];
|
||||
NSString *filename = [error objectForKey:@"path"];
|
||||
|
||||
NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithObjectsAndKeys:
|
||||
[NSNumber numberWithInteger:self.projectId] , @"projectId",
|
||||
@"Code Style Issues", @"title",
|
||||
filename.lastPathComponent , @"message",
|
||||
nil];
|
||||
|
||||
[self wantUserNotificationWithInfo:dict];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void)pruneProcessingErrorsForProjectPath:(NSString *)path
|
||||
{
|
||||
// Remove all errors for the path being processed
|
||||
@@ -1674,6 +1736,113 @@ void fsevents_callback(ConstFSEventStreamRef streamRef,
|
||||
return index != NSNotFound;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - capp_lint
|
||||
|
||||
- (IBAction)checkProjectWithCappLint:(id)aSender
|
||||
{
|
||||
[self clearErrors:self];
|
||||
|
||||
NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
|
||||
[center addObserver:self selector:@selector(cappLintDidEndNotification:) name:XCCCappLintDidEndNotification object:nil];
|
||||
|
||||
[self performSelectorInBackground:@selector(checkCappLintForPath:) withObject:self.xCodeCappTargetedFiles];
|
||||
}
|
||||
|
||||
- (void)cappLintDidEndNotification:(NSNotification*)aNotification
|
||||
{
|
||||
[self showCappLintErrors];
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self name:XCCCappLintDidEndNotification object:nil];
|
||||
}
|
||||
|
||||
- (BOOL)checkCappLintForPath:(NSArray*)paths
|
||||
{
|
||||
DDLogVerbose(@"Checking path %@ with capp_lint", paths);
|
||||
|
||||
NSUInteger numberOfFiles = [paths count];
|
||||
|
||||
if (!numberOfFiles)
|
||||
return YES;
|
||||
|
||||
self.isProcessing = YES;
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:XCCBatchDidStartNotification object:self];
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:XCCCappLintDidStartNotification object:self];
|
||||
|
||||
NSString *baseDirectory = [NSString stringWithFormat:@"--basedir='%@'", self.projectPath];
|
||||
NSMutableArray *arguments = [NSMutableArray arrayWithObjects:baseDirectory, nil];
|
||||
[arguments addObjectsFromArray:paths];
|
||||
|
||||
NSDictionary *taskResult = [self runTaskWithLaunchPath:self.executablePaths[@"capp_lint"]
|
||||
arguments:arguments
|
||||
returnType:kTaskReturnTypeStdOut];
|
||||
|
||||
NSInteger status = [taskResult[@"status"] intValue];
|
||||
|
||||
if (status == 0)
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:XCCBatchDidEndNotification object:self];
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:XCCCappLintDidEndNotification object:self];
|
||||
return YES;
|
||||
}
|
||||
|
||||
NSString *response = taskResult[@"response"];
|
||||
NSMutableArray *errors = [NSMutableArray arrayWithArray:[response componentsSeparatedByString:@"\n\n"]];
|
||||
|
||||
// We need to remove the first object who is the number of errors and the last object who is an empty line
|
||||
[errors removeLastObject];
|
||||
[errors removeObjectAtIndex:0];
|
||||
|
||||
NSInteger numberOfErrors = [errors count];
|
||||
NSInteger i = 0;
|
||||
NSString *path;
|
||||
NSMutableArray *dicts = [NSMutableArray array];
|
||||
|
||||
if (numberOfFiles == 1)
|
||||
path = [paths objectAtIndex:0];
|
||||
|
||||
for (i = 0; i < numberOfErrors; i++)
|
||||
{
|
||||
NSMutableString *error = (NSMutableString*)[errors objectAtIndex:i];
|
||||
NSString *line;
|
||||
NSString *firstCaract = [NSString stringWithFormat:@"%c" ,[error characterAtIndex:0]];
|
||||
|
||||
if ([[NSScanner scannerWithString:firstCaract] scanInt:nil])
|
||||
error = (NSMutableString*)[NSString stringWithFormat:@"%@:%@", path, error];
|
||||
|
||||
NSInteger positionOfFirstColon = [error rangeOfString:@":"].location;
|
||||
|
||||
if (numberOfFiles > 1)
|
||||
path = [error substringToIndex:positionOfFirstColon];
|
||||
|
||||
NSString *errorWithoutPath = [error substringFromIndex:(positionOfFirstColon + 1)];
|
||||
NSInteger positionOfSecondColon = [errorWithoutPath rangeOfString:@":"].location;
|
||||
line = [errorWithoutPath substringToIndex:positionOfSecondColon];
|
||||
|
||||
NSString *messageError = [NSString stringWithFormat:@"Code style issue: %@ \n%@", path.lastPathComponent, errorWithoutPath];
|
||||
|
||||
NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithObjectsAndKeys:
|
||||
[NSNumber numberWithInt:[line intValue]], @"line",
|
||||
messageError , @"message",
|
||||
path, @"path",
|
||||
nil];
|
||||
|
||||
[dicts addObject:dict];
|
||||
}
|
||||
|
||||
[self performSelectorOnMainThread:@selector(cappLintConversionDidGenerateError:) withObject:dicts waitUntilDone:NO];
|
||||
|
||||
self.isProcessing = NO;
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:XCCBatchDidEndNotification object:self];
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:XCCCappLintDidEndNotification object:self];
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void)cappLintConversionDidGenerateError:(NSArray*)errors
|
||||
{
|
||||
[self.errorListController addObjects:errors];
|
||||
}
|
||||
|
||||
#pragma mark - User notifications
|
||||
|
||||
- (NSString *)applicationNameForGrowl
|
||||
@@ -1713,8 +1882,7 @@ void fsevents_callback(ConstFSEventStreamRef streamRef,
|
||||
if ([info[@"projectId"] intValue] != self.projectId)
|
||||
return;
|
||||
|
||||
if ([[NSUserDefaults standardUserDefaults] boolForKey:kDefaultShowProcessingNotices])
|
||||
[self notifyUserWithTitle:info[@"title"] message:info[@"message"]];
|
||||
[self notifyUserWithTitle:info[@"title"] message:info[@"message"]];
|
||||
}
|
||||
|
||||
- (BOOL)userNotificationCenter:(NSUserNotificationCenter *)center shouldPresentNotification:(NSUserNotification *)notification
|
||||
@@ -1723,6 +1891,14 @@ void fsevents_callback(ConstFSEventStreamRef streamRef,
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)userNotificationCenter:(NSUserNotificationCenter *)center didActivateNotification:(NSUserNotification *)notification
|
||||
{
|
||||
if ([self.errorList count])
|
||||
[self openErrorsPanel:self];
|
||||
|
||||
[center removeDeliveredNotification:notification];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,12 @@
|
||||
|
||||
require ("../../common.jake");
|
||||
|
||||
var OS = require("os"),
|
||||
task = require("jake").task;
|
||||
|
||||
task ("build", function()
|
||||
{
|
||||
sudo(["./install.sh"]);
|
||||
});
|
||||
|
||||
task ("default", ["build"]);
|
||||
@@ -281,7 +281,7 @@ class LintChecker(object):
|
||||
},
|
||||
{
|
||||
# Filter out possible = within @accessors
|
||||
'filter': {'regex': re.compile(ur'^\s*(?:@outlet\s+)?[a-zA-Z_$]\w*\s+[a-zA-Z_$]\w*\s+@accessors\b'), 'pass': False},
|
||||
'filter': {'regex': re.compile(ur'^\s*(?:@outlet\s+)?[a-zA-Z_$]\w*\s+(<\s*[a-zA-Z_$]*\s*>\s+)?[a-zA-Z_$]\w*\s+@accessors\b'), 'pass': False},
|
||||
|
||||
'preprocess': STD_IGNORES,
|
||||
'regex': re.compile(ur'(?<=[\w)\]"\']|([ ]))(=|[-+*/%^&|]=|<<=|>>>?=)(?=[\w({\["\']|(?(1)\b\b|[ ]))'),
|
||||
@@ -291,7 +291,7 @@ class LintChecker(object):
|
||||
},
|
||||
{
|
||||
# Filter out @import statements and @implementation/method declarations
|
||||
'filter': {'regex': re.compile(ur'^(@import\b|@implementation\b|\s*' + METHOD_RE + ')'), 'pass': False},
|
||||
'filter': {'regex': re.compile(ur'^(@import\b|@implementation\b|@protocol\b|\s*' + METHOD_RE + ')|([a-zA-Z_$]*\s+<\s*[a-zA-Z_$]*\s*>)'), 'pass': False},
|
||||
|
||||
'preprocess': STD_IGNORES,
|
||||
'regex': re.compile(ur'(?<=[\w)\]"\']|([ ]))(===?|!==?|[<>]=?)(?=[\w({\["\']|(?(1)\b\b|[ ]))'),
|
||||
@@ -299,6 +299,13 @@ class LintChecker(object):
|
||||
'showPositionForGroup': 2,
|
||||
'type': ERROR_TYPE_WARNING
|
||||
},
|
||||
{
|
||||
'preprocess': STD_IGNORES,
|
||||
'regex': re.compile(ur'^(.*<\s+[a-zA-Z_$]*>.*)|(.*<[a-zA-Z_$]*\s+>.*)|(.*<\s+[a-zA-Z_$]*\s+>.*)'),
|
||||
'error': 'bracket operator with extra spaces',
|
||||
'showPositionForGroup': 0,
|
||||
'type': ERROR_TYPE_WARNING
|
||||
},
|
||||
{
|
||||
'regex': re.compile(ur'^(\s+)' + METHOD_RE + '|^\s*[-+](\()[a-zA-Z_$][\w]*\)\s*[a-zA-Z_$]\w*|^\s*[-+]\s*\([a-zA-Z_$][\w]*\)(\s+)[a-zA-Z_$]\w*'),
|
||||
'error': 'extra or missing space in a method declaration',
|
||||
|
||||
@@ -2,14 +2,14 @@
|
||||
|
||||
chmod +x capp_lint
|
||||
|
||||
if [[ ! -d /usr/local/bin ]]; then
|
||||
sudo mkdir -p /usr/local/bin
|
||||
if [[ ! -d /usr/local/narwhal/bin ]]; then
|
||||
mkdir -p /usr/local/narwhal/bin
|
||||
fi
|
||||
|
||||
sudo cp capp_lint /usr/local/bin
|
||||
cp capp_lint /usr/local/narwhal/bin
|
||||
|
||||
if [[ ! -d /usr/local/share/man/man1 ]]; then
|
||||
sudo mkdir -p /usr/local/share/man/man1
|
||||
mkdir -p /usr/local/share/man/man1
|
||||
fi
|
||||
|
||||
sudo cp capp_lint.1 /usr/local/share/man/man1
|
||||
cp capp_lint.1 /usr/local/share/man/man1
|
||||
|
||||
@@ -172,7 +172,7 @@
|
||||
);
|
||||
PREBINDING = NO;
|
||||
PRODUCT_NAME = fontinfo;
|
||||
SDKROOT = macosx10.5;
|
||||
SDKROOT = macosx;
|
||||
SYMROOT = "$(CAPP_BUILD)/Debug/CommonJS/cappuccino/bin";
|
||||
};
|
||||
name = Debug;
|
||||
@@ -186,7 +186,7 @@
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
ONLY_ACTIVE_ARCH = NO;
|
||||
PRODUCT_NAME = fontinfo;
|
||||
SDKROOT = macosx10.5;
|
||||
SDKROOT = macosx;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
@@ -199,7 +199,6 @@
|
||||
E1D3CF6E12AFEE3900CBB79E /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.5;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
||||
@@ -170,7 +170,6 @@
|
||||
);
|
||||
PREBINDING = NO;
|
||||
PRODUCT_NAME = imagesize;
|
||||
SDKROOT = macosx10.5;
|
||||
SYMROOT = "$(CAPP_BUILD)/Debug/CommonJS/cappuccino/bin";
|
||||
};
|
||||
name = Debug;
|
||||
@@ -187,7 +186,6 @@
|
||||
ONLY_ACTIVE_ARCH = NO;
|
||||
PREBINDING = NO;
|
||||
PRODUCT_NAME = imagesize;
|
||||
SDKROOT = macosx10.5;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
@@ -201,7 +199,6 @@
|
||||
E1D3CF6E12AFEE3900CBB79E /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.5;
|
||||
PRODUCT_NAME = imagesize;
|
||||
};
|
||||
name = Release;
|
||||
|
||||
@@ -31,10 +31,11 @@
|
||||
|
||||
var FILE = require("file"),
|
||||
imageSize = require("cappuccino/imagesize").imagesize,
|
||||
supportedTemplateImages = [
|
||||
"NSAddTemplate",
|
||||
"NSRemoveTemplate"
|
||||
];
|
||||
supportedTemplateImages = {
|
||||
"NSAddTemplate": "CPAddTemplate",
|
||||
"NSRemoveTemplate": "CPRemoveTemplate",
|
||||
"NSToolbarShowColors": "CPImageNameColorPanel"
|
||||
};
|
||||
|
||||
@implementation _CPCibCustomResource (NSCoding)
|
||||
|
||||
@@ -51,14 +52,14 @@ var FILE = require("file"),
|
||||
framework = @"",
|
||||
bundleIdentifier = @"";
|
||||
|
||||
if (_resourceName == "NSSwitch")
|
||||
if (_resourceName == "NSSwitch" || _resourceName == "NSRadioButton")
|
||||
return nil;
|
||||
else if (/^NS[A-Z][A-Za-z]+$/.test(_resourceName))
|
||||
{
|
||||
if (supportedTemplateImages.indexOf(_resourceName) >= 0)
|
||||
if (supportedTemplateImages[_resourceName])
|
||||
{
|
||||
// Defer resolving this path until runtime.
|
||||
_resourceName = _resourceName.replace("NS", "CP");
|
||||
_resourceName = supportedTemplateImages[_resourceName];
|
||||
}
|
||||
else
|
||||
[CPException raise:Nib2CibException format:@"The built in image “%@” is not supported.", _resourceName];
|
||||
|
||||
@@ -58,6 +58,7 @@ var NSDatePickerDefaultSize = 22,
|
||||
|
||||
[self setBezeled:[cell isBezeled]];
|
||||
[self setBordered:[cell isBordered]];
|
||||
[self setEnabled:[cell isEnabled]];
|
||||
|
||||
var theme = [Nib2Cib defaultTheme];
|
||||
|
||||
|
||||
@@ -72,6 +72,7 @@
|
||||
frame.size.height += 1;
|
||||
|
||||
frame.size.width = originalWidth;
|
||||
[self setEnabled:[cell isEnabled]];
|
||||
[self setFrame:frame];
|
||||
}
|
||||
|
||||
|
||||
+4
-3
@@ -168,7 +168,7 @@ tmp_zip="/tmp/cappuccino.zip"
|
||||
local_distrib=""
|
||||
|
||||
github_user="cappuccino"
|
||||
github_ref="v0.9.7"
|
||||
github_ref="v0.9.7-1"
|
||||
|
||||
noprompt=""
|
||||
install_capp=""
|
||||
@@ -206,6 +206,7 @@ done
|
||||
|
||||
github_project="$github_user-cappuccino-base"
|
||||
github_path="$github_user/cappuccino-base"
|
||||
local_project="cappuccino-base"
|
||||
|
||||
# The purpose of bootstrap is to install Cappuccino.
|
||||
install_cappuccino="yes"
|
||||
@@ -317,9 +318,9 @@ if [ "$install_cappuccino" ]; then
|
||||
unzip $quiet_arg "$local_distrib" -d "$install_directory"
|
||||
check_and_exit
|
||||
|
||||
mv "$install_directory/$github_project-"*/* "$install_directory/."
|
||||
mv "$install_directory/$local_project-"*/* "$install_directory/."
|
||||
check_and_exit
|
||||
rm -rf "$install_directory/$github_project-"*
|
||||
rm -rf "$install_directory/$local_project-"*
|
||||
check_and_exit
|
||||
else
|
||||
zip_ball="https://github.com/$github_path/zipball/$github_ref"
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
{
|
||||
"version": "0.9.7"
|
||||
"version": "0.9.7-1"
|
||||
}
|
||||
Reference in New Issue
Block a user