mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-12-06 12:45:32 +00:00
Merge remote-tracking branch 'origin' into NEW--CPTextView
This commit is contained in:
commit
15d3e4023b
262 files changed
+10346
-10275
No files matched your search
+3
-1
@@ -26,6 +26,7 @@
|
||||
@import "CPAccordionView.j"
|
||||
@import "CPAlert.j"
|
||||
@import "CPAnimation.j"
|
||||
@import "CPAppearance.j"
|
||||
@import "CPApplication.j"
|
||||
@import "CPArrayController.j"
|
||||
@import "CPBezierPath.j"
|
||||
@@ -107,7 +108,8 @@
|
||||
@import "CPView.j"
|
||||
@import "CPViewAnimation.j"
|
||||
@import "CPViewController.j"
|
||||
@import "CPVisualEffectView.j"
|
||||
@import "CPWebView.j"
|
||||
@import "CPWindow.j"
|
||||
@import "CPWindowController.j"
|
||||
@import "CPWorkspace.j"
|
||||
@import "CPWorkspace.j"
|
||||
@@ -0,0 +1,162 @@
|
||||
/*
|
||||
* CPAppearance.j
|
||||
* AppKit
|
||||
*
|
||||
* Created by Antoine Mercadal.
|
||||
* Copyright 2015, 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 <Foundation/Foundation.j>
|
||||
@import "CPTheme.j"
|
||||
|
||||
CPAppearanceNameAqua = @"CPAppearanceNameAqua";
|
||||
CPAppearanceNameLightContent = @"CPAppearanceNameLightContent";
|
||||
CPAppearanceNameVibrantDark = @"CPAppearanceNameVibrantDark";
|
||||
CPAppearanceNameVibrantLight = @"CPAppearanceNameVibrantLight";
|
||||
|
||||
var _CPAppearanceCurrent = nil,
|
||||
_CPAppearancesRegistry = @{};
|
||||
|
||||
|
||||
@protocol CPAppearanceCustomization <CPObject>
|
||||
|
||||
@required
|
||||
- (CPAppearance)appearance;
|
||||
- (void)setAppearance:(CPAppearance)appearance;
|
||||
- (CPAppearance)effectiveAppearance;
|
||||
- (void)setEffectiveAppearance:(CPAppearance)appearance;
|
||||
|
||||
@end
|
||||
|
||||
CPThemeStateAppearanceAqua = CPThemeState("appearance-aqua");
|
||||
CPThemeStateAppearanceLightContent = CPThemeState("appearance-light-content");
|
||||
CPThemeStateAppearanceVibrantLight = CPThemeState("appearance-vibrant-light");
|
||||
CPThemeStateAppearanceVibrantDark = CPThemeState("appearance-vibrant-dark");
|
||||
|
||||
|
||||
/*!
|
||||
@ingroup appkit
|
||||
|
||||
A CPAppareance represents the appearance of an to a subset of UI elements.
|
||||
This is a very lightweight implementation of the NSAppearance system, but
|
||||
We are using it for compliance, and especially for the CPVisualEffectView
|
||||
*/
|
||||
@implementation CPAppearance : CPObject
|
||||
{
|
||||
BOOL _allowsVibrancy @accessors(property=allowsVibrancy);
|
||||
|
||||
CPString _name;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Class Methods
|
||||
|
||||
/*! Returns the current default CPAppearance
|
||||
*/
|
||||
+ (CPAppearance)currentAppearance
|
||||
{
|
||||
if (!_CPAppearanceCurrent)
|
||||
_CPAppearanceCurrent = [CPAppearance appearanceNamed:CPAppearanceNameAqua];
|
||||
|
||||
return _CPAppearanceCurrent;
|
||||
}
|
||||
|
||||
/*! Sets the current default CPAppearance
|
||||
@param appearance the new current appearance
|
||||
*/
|
||||
+ (void)setCurrentAppearance:(CPAppearance)anAppearance
|
||||
{
|
||||
_CPAppearanceCurrent = anAppearance;
|
||||
}
|
||||
|
||||
/*! Returns the CPAppearance object with the given name
|
||||
@param name the name of the appearance
|
||||
*/
|
||||
+ (CPAppearance)appearanceNamed:(CPString)aName
|
||||
{
|
||||
if (![_CPAppearancesRegistry containsKey:aName])
|
||||
{
|
||||
[_CPAppearancesRegistry setObject:[[CPAppearance alloc] initWithAppearanceNamed:aName bundle:nil]
|
||||
forKey:aName];
|
||||
}
|
||||
|
||||
return [_CPAppearancesRegistry objectForKey:aName];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Initialization
|
||||
|
||||
/*! Creates a CPAppearance object initialized to the specified appearance file in the specified bundle
|
||||
This method does actually nothing special. It just creates a default appearance object
|
||||
*/
|
||||
- (id)initWithAppearanceNamed:(CPString)aName bundle:(CPBundle)bundle
|
||||
{
|
||||
if (self = [super init])
|
||||
{
|
||||
_name = aName;
|
||||
_allowsVibrancy = YES;
|
||||
|
||||
if ([_CPAppearancesRegistry containsKey:aName])
|
||||
[CPException raise:CPInternalInconsistencyException reason:"Appearance with name '" + aName + "' is already declared."];
|
||||
|
||||
[_CPAppearancesRegistry setObject:self forKey:aName];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Implementation
|
||||
|
||||
- (BOOL)isEqual:(id)anObject
|
||||
{
|
||||
if (![anObject isKindOfClass:CPAppearance])
|
||||
return NO;
|
||||
|
||||
return self._name == anObject._name;
|
||||
}
|
||||
|
||||
- (CPString)description
|
||||
{
|
||||
return @"<CPAppearance @" + [self UID] + @" name: " + _name + ">";
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark CPCoding
|
||||
|
||||
- (id)initWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
if (self = [super init])
|
||||
{
|
||||
_name = [aCoder decodeObjectForKey:@"_name"];
|
||||
_allowsVibrancy = [aCoder decodeBoolForKey:@"_allowsVibrancy"];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)encodeWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
[aCoder encodeObject:_name forKey:@"_name"];
|
||||
[aCoder encodeBool:_allowsVibrancy forKey:@"_allowsVibrancy"];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -112,6 +112,8 @@
|
||||
|
||||
- (void)awakeFromCib
|
||||
{
|
||||
[super awakeFromCib];
|
||||
|
||||
var view = [self superview],
|
||||
subview = self;
|
||||
|
||||
|
||||
@@ -2121,7 +2121,7 @@ TODO: implement
|
||||
return;
|
||||
|
||||
var point = [self convertPoint:[event locationInWindow] fromView:nil],
|
||||
view = [_slices objectAtIndex:FLOOR(point.y / _sliceHeight)];
|
||||
view = [_slices objectAtIndex:FLOOR(MAX(0, point.y) / _sliceHeight)];
|
||||
|
||||
if ([self _dragShouldBeginFromMouseDown:view])
|
||||
[self _performDragForSlice:view withEvent:event];
|
||||
|
||||
@@ -1582,6 +1582,8 @@ var CPScrollViewContentViewKey = @"CPScrollViewContentView",
|
||||
*/
|
||||
- (void)awakeFromCib
|
||||
{
|
||||
[super awakeFromCib];
|
||||
|
||||
[self _updateScrollerStyle];
|
||||
[self _updateCornerAndHeaderView];
|
||||
}
|
||||
|
||||
+42
-2
@@ -34,6 +34,8 @@ CPNoTabsBezelBorder = 4; //Displays no tabs and has a bezeled border.
|
||||
CPNoTabsLineBorder = 5; //Has no tabs and displays a line border.
|
||||
CPNoTabsNoBorder = 6; //Displays no tabs and no border.
|
||||
|
||||
@class _CPTabViewBox
|
||||
|
||||
var CPTabViewDidSelectTabViewItemSelector = 1 << 1,
|
||||
CPTabViewShouldSelectTabViewItemSelector = 1 << 2,
|
||||
CPTabViewWillSelectTabViewItemSelector = 1 << 3,
|
||||
@@ -64,7 +66,7 @@ var CPTabViewDidSelectTabViewItemSelector = 1 << 1,
|
||||
CPArray _items;
|
||||
|
||||
CPSegmentedControl _tabs;
|
||||
CPBox _box;
|
||||
_CPTabViewBox _box;
|
||||
|
||||
CPNumber _selectedIndex;
|
||||
|
||||
@@ -98,7 +100,8 @@ var CPTabViewDidSelectTabViewItemSelector = 1 << 1,
|
||||
var height = [_tabs valueForThemeAttribute:@"min-size"].height;
|
||||
[_tabs setFrameSize:CGSizeMake(0, height)];
|
||||
|
||||
_box = [[CPBox alloc] initWithFrame:[self bounds]];
|
||||
_box = [[_CPTabViewBox alloc] initWithFrame:[self bounds]];
|
||||
[_box setTabView:self];
|
||||
[self setBackgroundColor:[CPColor colorWithCalibratedWhite:0.95 alpha:1.0]];
|
||||
|
||||
[self addSubview:_box];
|
||||
@@ -496,6 +499,18 @@ var CPTabViewDidSelectTabViewItemSelector = 1 << 1,
|
||||
[self selectFirstTabViewItem:self];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Override
|
||||
|
||||
/*!
|
||||
Enabled controls accept first mouse by default.
|
||||
*/
|
||||
- (BOOL)acceptsFirstMouse:(CPEvent)anEvent
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
var CPTabViewItemsKey = "CPTabViewItemsKey",
|
||||
@@ -529,6 +544,8 @@ var CPTabViewItemsKey = "CPTabViewItemsKey",
|
||||
|
||||
- (void)awakeFromCib
|
||||
{
|
||||
[super awakeFromCib];
|
||||
|
||||
// This cannot be run in initWithCoder because it might call selectTabViewItem:, which is
|
||||
// not safe to call before the views of the tab views items are fully decoded.
|
||||
[self _updateItems];
|
||||
@@ -569,3 +586,26 @@ var CPTabViewItemsKey = "CPTabViewItemsKey",
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation _CPTabViewBox : CPBox
|
||||
{
|
||||
CPTabView _tabView @accessors(property=tabView);
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Override
|
||||
|
||||
- (CPView)hitTest:(CGPoint)aPoint
|
||||
{
|
||||
// Here we check if we have clicked on the segmentedControl of the tabView or not
|
||||
// If YES, the CPBox should not handle the click
|
||||
var segmentIndex = [_tabView._tabs testSegment:[_tabView._tabs convertPoint:aPoint fromView:[self superview]]];
|
||||
|
||||
if (segmentIndex != CPNotFound)
|
||||
return nil;
|
||||
|
||||
return [super hitTest:aPoint];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -5199,7 +5199,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
||||
[self _notifyViewDidBecomeFirstResponder];
|
||||
|
||||
// This is for cell-based tables only. In view-based mode, we do not change the textfield apprearence during an edit.
|
||||
if (!_isViewBased && _editingRow !== CPNotFound && [responder isKindOfClass:[CPTextField class]] && [responder isEditable])
|
||||
if (!_isViewBased && _editingRow !== CPNotFound && [responder isKindOfClass:[CPTextField class]] && [responder isEditable] && [responder superview] == self)
|
||||
{
|
||||
[responder setBezeled:YES];
|
||||
[self _registerForEndEditingNote:responder];
|
||||
@@ -6394,6 +6394,7 @@ var CPTableViewDataSourceKey = @"CPTableViewDataSourceKey",
|
||||
|
||||
- (void)awakeFromCib
|
||||
{
|
||||
[super awakeFromCib];
|
||||
[self setThemeState:CPThemeStateTableDataView];
|
||||
}
|
||||
|
||||
|
||||
+26
-2
@@ -34,7 +34,6 @@
|
||||
@global CPStringPboardType
|
||||
@global CPCursor
|
||||
|
||||
|
||||
@protocol CPTextFieldDelegate <CPControlTextEditingDelegate>
|
||||
|
||||
@end
|
||||
@@ -66,7 +65,8 @@ var CPTextFieldDOMCurrentElement = nil,
|
||||
CPTextFieldCachedSelectStartFunction = nil,
|
||||
CPTextFieldCachedDragFunction = nil,
|
||||
CPTextFieldBlurHandler = nil,
|
||||
CPTextFieldInputFunction = nil;
|
||||
CPTextFieldInputFunction = nil,
|
||||
CPTexFieldCurrentCSSSelectableField = nil;
|
||||
|
||||
var CPSecureTextFieldCharacter = "\u2022";
|
||||
|
||||
@@ -700,6 +700,21 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
||||
return YES;
|
||||
}
|
||||
|
||||
/*!
|
||||
Set the selection css style for the DOM element of the textField
|
||||
@ignore
|
||||
*/
|
||||
- (void)_setEnableCSSSelection:(BOOL)shouldEnable
|
||||
{
|
||||
#if PLATFORM (DOM)
|
||||
if (CPTexFieldCurrentCSSSelectableField)
|
||||
CPTexFieldCurrentCSSSelectableField._DOMElement.style[CPBrowserStyleProperty(@"user-select")] = @"none";
|
||||
|
||||
CPTexFieldCurrentCSSSelectableField = self;
|
||||
_DOMElement.style[CPBrowserStyleProperty(@"user-select")] = shouldEnable ? @"text" : @"none";
|
||||
#endif
|
||||
}
|
||||
|
||||
/*!
|
||||
Set the css style for the input element of the textField
|
||||
@ignore
|
||||
@@ -993,6 +1008,7 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
||||
}
|
||||
else if ([self isSelectable])
|
||||
{
|
||||
[self _setEnableCSSSelection:YES];
|
||||
if (document.attachEvent)
|
||||
{
|
||||
CPTextFieldCachedSelectStartFunction = [[self window] platformWindow]._DOMBodyElement.onselectstart;
|
||||
@@ -1034,6 +1050,14 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
||||
}
|
||||
}
|
||||
|
||||
- (void)rightMouseDown:(CPEvent)anEvent
|
||||
{
|
||||
if ([self menuForEvent:anEvent] || [[self nextResponder] isKindOfClass:CPView])
|
||||
[super rightMouseDown:anEvent];
|
||||
else
|
||||
[[[anEvent window] platformWindow] _propagateContextMenuDOMEvent:YES];
|
||||
}
|
||||
|
||||
- (void)mouseDragged:(CPEvent)anEvent
|
||||
{
|
||||
if (![self isEnabled] || !([self isSelectable] || [self isEditable]))
|
||||
|
||||
+126
-30
@@ -26,6 +26,7 @@
|
||||
|
||||
@import "CGAffineTransform.j"
|
||||
@import "CGGeometry.j"
|
||||
@import "CPAppearance.j"
|
||||
@import "CPColor.j"
|
||||
@import "CPGraphicsContext.j"
|
||||
@import "CPResponder.j"
|
||||
@@ -131,7 +132,6 @@ var CPViewFlags = { },
|
||||
|
||||
var CPViewHighDPIDrawingEnabled = YES;
|
||||
|
||||
|
||||
/*!
|
||||
@ingroup appkit
|
||||
@class CPView
|
||||
@@ -240,6 +240,10 @@ var CPViewHighDPIDrawingEnabled = YES;
|
||||
BOOL _toolTipInstalled;
|
||||
|
||||
BOOL _isObserving;
|
||||
|
||||
BOOL _allowsVibrancy @accessors(property=allowsVibrancy);
|
||||
CPAppearance _appearance @accessors(getter=appearance);
|
||||
CPAppearance _effectiveAppearance;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -291,27 +295,6 @@ var CPViewHighDPIDrawingEnabled = YES;
|
||||
return CPViewHighDPIDrawingEnabled;
|
||||
}
|
||||
|
||||
- (void)_setupViewFlags
|
||||
{
|
||||
var theClass = [self class],
|
||||
classUID = [theClass UID];
|
||||
|
||||
if (CPViewFlags[classUID] === undefined)
|
||||
{
|
||||
var flags = 0;
|
||||
|
||||
if ([theClass instanceMethodForSelector:@selector(drawRect:)] !== [CPView instanceMethodForSelector:@selector(drawRect:)])
|
||||
flags |= CPViewHasCustomDrawRect;
|
||||
|
||||
if ([theClass instanceMethodForSelector:@selector(layoutSubviews)] !== [CPView instanceMethodForSelector:@selector(layoutSubviews)])
|
||||
flags |= CPViewHasCustomLayoutSubviews;
|
||||
|
||||
CPViewFlags[classUID] = flags;
|
||||
}
|
||||
|
||||
_viewClassFlags = CPViewFlags[classUID];
|
||||
}
|
||||
|
||||
+ (CPSet)keyPathsForValuesAffectingFrame
|
||||
{
|
||||
return [CPSet setWithObjects:@"frameOrigin", @"frameSize"];
|
||||
@@ -327,6 +310,25 @@ var CPViewHighDPIDrawingEnabled = YES;
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (void)_setupViewFlags
|
||||
{
|
||||
var theClass = [self class],
|
||||
classUID = [theClass UID];
|
||||
|
||||
if (CPViewFlags[classUID] === undefined)
|
||||
{
|
||||
var flags = 0;
|
||||
|
||||
if ([theClass instanceMethodForSelector:@selector(drawRect:)] !== [CPView instanceMethodForSelector:@selector(drawRect:)]
|
||||
|| [theClass instanceMethodForSelector:@selector(viewWillDraw)] !== [CPView instanceMethodForSelector:@selector(viewWillDraw)])
|
||||
flags |= CPViewHasCustomDrawRect;
|
||||
|
||||
CPViewFlags[classUID] = flags;
|
||||
}
|
||||
|
||||
_viewClassFlags = CPViewFlags[classUID];
|
||||
}
|
||||
|
||||
- (id)init
|
||||
{
|
||||
return [self initWithFrame:CGRectMakeZero()];
|
||||
@@ -381,7 +383,6 @@ var CPViewHighDPIDrawingEnabled = YES;
|
||||
#endif
|
||||
|
||||
[self _setupViewFlags];
|
||||
|
||||
[self _loadThemeAttributes];
|
||||
}
|
||||
|
||||
@@ -839,9 +840,8 @@ var CPViewHighDPIDrawingEnabled = YES;
|
||||
*/
|
||||
- (void)viewDidMoveToSuperview
|
||||
{
|
||||
// if (_graphicsContext)
|
||||
[self setNeedsDisplay:YES];
|
||||
|
||||
[self setNeedsLayout:YES];
|
||||
[self setNeedsDisplay:YES];
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -1820,7 +1820,7 @@ var CPViewHighDPIDrawingEnabled = YES;
|
||||
else if ([[self nextResponder] isKindOfClass:CPView])
|
||||
[super rightMouseDown:anEvent];
|
||||
else
|
||||
[[[anEvent window] platformWindow] _propagateContextMenuDOMEvent:YES];
|
||||
[[[anEvent window] platformWindow] _propagateContextMenuDOMEvent:NO];
|
||||
}
|
||||
|
||||
- (CPMenu)menuForEvent:(CPEvent)anEvent
|
||||
@@ -2594,7 +2594,7 @@ setBoundsOrigin:
|
||||
}
|
||||
|
||||
#if PLATFORM(DOM)
|
||||
if (_needToSetTransformMatrix)
|
||||
if (_needToSetTransformMatrix && _highDPIRatio !== 1)
|
||||
[_graphicsContext graphicsPort].setTransform(_highDPIRatio, 0, 0 , _highDPIRatio, 0, 0);
|
||||
#endif
|
||||
|
||||
@@ -2621,7 +2621,7 @@ setBoundsOrigin:
|
||||
|
||||
- (void)setNeedsLayout:(BOOL)needLayout
|
||||
{
|
||||
if (!(_viewClassFlags & CPViewHasCustomLayoutSubviews) || !needLayout)
|
||||
if (!needLayout)
|
||||
{
|
||||
_needsLayout = NO;
|
||||
return;
|
||||
@@ -2643,12 +2643,31 @@ setBoundsOrigin:
|
||||
{
|
||||
_needsLayout = NO;
|
||||
|
||||
[self viewWillLayout];
|
||||
[self layoutSubviews];
|
||||
[self viewDidLayout];
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
@ignore
|
||||
*/
|
||||
- (void)viewWillLayout
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/*!
|
||||
@ignore
|
||||
*/
|
||||
- (void)viewDidLayout
|
||||
{
|
||||
[self _recomputeAppearance];
|
||||
}
|
||||
|
||||
- (void)layoutSubviews
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -3509,6 +3528,79 @@ setBoundsOrigin:
|
||||
return (_ephemeralSubviewsForNames[aViewName] || nil);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation CPView (Appearance)
|
||||
|
||||
/*! Returns the receiver's appearance if any, or ask the superview and returns it.
|
||||
*/
|
||||
- (CPAppearance)effectiveAppearance
|
||||
{
|
||||
if (_appearance)
|
||||
return _appearance;
|
||||
|
||||
return [_superview effectiveAppearance];
|
||||
}
|
||||
|
||||
- (void)setAppearance:(CPAppearance)anAppearance
|
||||
{
|
||||
if ([_appearance isEqual:anAppearance])
|
||||
return;
|
||||
|
||||
[self willChangeValueForKey:@"appearance"];
|
||||
_appearance = anAppearance;
|
||||
[self didChangeValueForKey:@"appearance"];
|
||||
|
||||
[self setNeedsLayout:YES];
|
||||
}
|
||||
|
||||
/*! @ignore
|
||||
*/
|
||||
- (void)_recomputeAppearance
|
||||
{
|
||||
var effectiveAppearance = [self effectiveAppearance];
|
||||
|
||||
if ([effectiveAppearance isEqual:[CPAppearance appearanceNamed:CPAppearanceNameAqua]])
|
||||
{
|
||||
[self setThemeState:CPThemeStateAppearanceAqua];
|
||||
[self unsetThemeState:CPThemeStateAppearanceLightContent];
|
||||
[self unsetThemeState:CPThemeStateAppearanceVibrantLight];
|
||||
[self unsetThemeState:CPThemeStateAppearanceVibrantDark];
|
||||
}
|
||||
else if ([effectiveAppearance isEqual:[CPAppearance appearanceNamed:CPAppearanceNameLightContent]])
|
||||
{
|
||||
[self unsetThemeState:CPThemeStateAppearanceAqua];
|
||||
[self setThemeState:CPThemeStateAppearanceLightContent];
|
||||
[self unsetThemeState:CPThemeStateAppearanceVibrantLight];
|
||||
[self unsetThemeState:CPThemeStateAppearanceVibrantDark];
|
||||
}
|
||||
else if ([effectiveAppearance isEqual:[CPAppearance appearanceNamed:CPAppearanceNameVibrantLight]])
|
||||
{
|
||||
[self unsetThemeState:CPThemeStateAppearanceAqua];
|
||||
[self unsetThemeState:CPThemeStateAppearanceLightContent];
|
||||
[self setThemeState:CPThemeStateAppearanceVibrantLight];
|
||||
[self unsetThemeState:CPThemeStateAppearanceVibrantDark];
|
||||
}
|
||||
else if ([effectiveAppearance isEqual:[CPAppearance appearanceNamed:CPAppearanceNameVibrantDark]])
|
||||
{
|
||||
[self unsetThemeState:CPThemeStateAppearanceAqua];
|
||||
[self unsetThemeState:CPThemeStateAppearanceLightContent];
|
||||
[self unsetThemeState:CPThemeStateAppearanceVibrantLight];
|
||||
[self setThemeState:CPThemeStateAppearanceVibrantDark];
|
||||
}
|
||||
else
|
||||
{
|
||||
[self unsetThemeState:CPThemeStateAppearanceAqua];
|
||||
[self unsetThemeState:CPThemeStateAppearanceLightContent];
|
||||
[self unsetThemeState:CPThemeStateAppearanceVibrantLight];
|
||||
[self unsetThemeState:CPThemeStateAppearanceVibrantDark];
|
||||
}
|
||||
|
||||
[_subviews makeObjectsPerformSelector:@selector(_recomputeAppearance)];
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
||||
var CPViewAutoresizingMaskKey = @"CPViewAutoresizingMask",
|
||||
@@ -3531,7 +3623,8 @@ var CPViewAutoresizingMaskKey = @"CPViewAutoresizingMask",
|
||||
CPReuseIdentifierKey = @"CPReuseIdentifierKey",
|
||||
CPViewScaleKey = @"CPViewScaleKey",
|
||||
CPViewSizeScaleKey = @"CPViewSizeScaleKey",
|
||||
CPViewIsScaledKey = @"CPViewIsScaledKey";
|
||||
CPViewIsScaledKey = @"CPViewIsScaledKey",
|
||||
CPViewAppearanceKey = @"CPViewAppearanceKey";
|
||||
|
||||
@implementation CPView (CPCoding)
|
||||
|
||||
@@ -3646,6 +3739,8 @@ var CPViewAutoresizingMaskKey = @"CPViewAutoresizingMask",
|
||||
_themeAttributes[attributeName] = CPThemeAttributeDecode(aCoder, attributeName, attributes[count], _theme, themeClass);
|
||||
}
|
||||
|
||||
[self setAppearance:[aCoder decodeObjectForKey:CPViewAppearanceKey]];
|
||||
|
||||
[self setNeedsDisplay:YES];
|
||||
[self setNeedsLayout];
|
||||
}
|
||||
@@ -3734,6 +3829,7 @@ var CPViewAutoresizingMaskKey = @"CPViewAutoresizingMask",
|
||||
[aCoder encodeSize:[self scaleSize] forKey:CPViewScaleKey];
|
||||
[aCoder encodeSize:[self _hierarchyScaleSize] forKey:CPViewSizeScaleKey];
|
||||
[aCoder encodeBool:_isScaled forKey:CPViewIsScaledKey];
|
||||
[aCoder encodeObject:_appearance forKey:CPViewAppearanceKey];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -0,0 +1,186 @@
|
||||
/*
|
||||
* CPVisualEffectView.j
|
||||
* AppKit
|
||||
*
|
||||
* Created by Antoine Mercadal.
|
||||
* Copyright 2015, 280 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 <Foundation/Foundation.j>
|
||||
@import "CPAppearance.j"
|
||||
@import "CPView.j"
|
||||
|
||||
@typedef CPVisualEffectMaterial
|
||||
CPVisualEffectMaterialAppearanceBased = 0;
|
||||
CPVisualEffectMaterialLight = 1;
|
||||
CPVisualEffectMaterialDark = 2;
|
||||
CPVisualEffectMaterialTitlebar = 3;
|
||||
|
||||
@typedef CPVisualEffectBlendingMode
|
||||
CPVisualEffectBlendingModeBehindWindow = 0;
|
||||
CPVisualEffectBlendingModeWithinWindow = 1;
|
||||
|
||||
@typedef CPVisualEffectState
|
||||
CPVisualEffectStateFollowsWindowActiveState = 0;
|
||||
CPVisualEffectStateActive = 1;
|
||||
CPVisualEffectStateInactive = 2;
|
||||
|
||||
|
||||
/*! @ingroup appkit
|
||||
|
||||
Very naive implementation of CPVisualEffectView. This view allows
|
||||
to use vibrancy effect. This is only working with Safari 9+ and the
|
||||
support in Chrome/ium should come quite soon.
|
||||
Using this class with a browser that doesn't support backdrop-filter
|
||||
While still work, but you will not get the blurry effect.
|
||||
*/
|
||||
@implementation CPVisualEffectView : CPView
|
||||
{
|
||||
CPImage _maskImage @accessors(property=maskImage);
|
||||
CPVisualEffectBlendingMode _blendingMode @accessors(property=blendingMode);
|
||||
CPVisualEffectMaterial _material @accessors(property=material);
|
||||
CPVisualEffectState _state @accessors(property=state);
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Initialization
|
||||
|
||||
- (id)initWithFrame:(CGRect)aFrame
|
||||
{
|
||||
if (self = [super initWithFrame:aFrame])
|
||||
{
|
||||
_material = CPVisualEffectMaterialAppearanceBased;
|
||||
_blendingMode = CPVisualEffectBlendingModeWithinWindow;
|
||||
_state = CPVisualEffectStateFollowsWindowActiveState;
|
||||
_appearance = [CPAppearance appearanceNamed:CPAppearanceNameVibrantDark];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark CPVisualEffectView API
|
||||
|
||||
/*! Sets the appearance of the CPVisualEffectView.
|
||||
|
||||
Only CPAppearance named CPAppearanceNameVibrantDark or CPAppearanceNameVibrantLight are valid
|
||||
|
||||
@param anAppearance the CPAppearance.
|
||||
*/
|
||||
- (void)setAppearance:(CPAppearance)anAppearance
|
||||
{
|
||||
if (![self _validAppearance:anAppearance])
|
||||
[CPException raise:CPInvalidArgumentException reason:"Appearance can only be CPAppearanceNameVibrantDark or CPAppearanceNameVibrantLight in CPVisualEffectView, but is " + anAppearance];
|
||||
|
||||
[super setAppearance:anAppearance];
|
||||
|
||||
[self setNeedsLayout:YES];
|
||||
}
|
||||
|
||||
/*! Sets the received effect state.
|
||||
Possible values:
|
||||
<pre>
|
||||
CPVisualEffectStateFollowsWindowActiveState (default)
|
||||
CPVisualEffectStateActive
|
||||
CPVisualEffectStateInactive
|
||||
</pre>
|
||||
*/
|
||||
- (void)setState:(CPVisualEffectState)aState
|
||||
{
|
||||
if (_state == aState)
|
||||
return;
|
||||
|
||||
[self willChangeValueForKey:"state"];
|
||||
_state = aState;
|
||||
[self didChangeValueForKey:"state"];
|
||||
|
||||
[self setNeedsLayout:YES];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Utilities
|
||||
|
||||
- (void)_setEffectEnabled:(BOOL)shouldEnable
|
||||
{
|
||||
var dark = [[self appearance] isEqual:[CPAppearance appearanceNamed:CPAppearanceNameVibrantDark]],
|
||||
prop = CPBrowserStyleProperty("backdrop-filter"),
|
||||
color = (dark ? [CPColor colorWithHexString:@"1e1e1e"] : [CPColor whiteColor]),
|
||||
finalColor = shouldEnable ? [color colorWithAlphaComponent:0.6] : color;
|
||||
|
||||
[self setBackgroundColor:finalColor];
|
||||
|
||||
#if PLATFORM(DOM)
|
||||
self._DOMElement.style[prop] = shouldEnable ? "blur(30px)" : nil;
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
- (void)layoutSubviews
|
||||
{
|
||||
switch (_state)
|
||||
{
|
||||
case CPVisualEffectStateFollowsWindowActiveState:
|
||||
[self _setEffectEnabled:[self hasThemeState:CPThemeStateKeyWindow]];
|
||||
break;
|
||||
|
||||
case CPVisualEffectStateActive:
|
||||
[self _setEffectEnabled:YES];
|
||||
break;
|
||||
|
||||
case CPVisualEffectStateInactive:
|
||||
[self _setEffectEnabled:NO];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)_validAppearance:(CPAppearance)anAppearance
|
||||
{
|
||||
return [anAppearance isEqual:[CPAppearance appearanceNamed:CPAppearanceNameVibrantDark]] || [anAppearance isEqual:[CPAppearance appearanceNamed:CPAppearanceNameVibrantLight]];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark CPCoding
|
||||
|
||||
- (id)initWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
if (self = [super initWithCoder:aCoder])
|
||||
{
|
||||
_blendingMode = [aCoder decodeIntForKey:@"_blendingMode"] || CPVisualEffectBlendingModeWithinWindow;
|
||||
_maskImage = [aCoder decodeObjectForKey:@"_maskImage"];
|
||||
_material = [aCoder decodeIntForKey:@"_material"] || CPVisualEffectMaterialAppearanceBased;
|
||||
_state = [aCoder decodeIntForKey:@"_state"] || CPVisualEffectStateFollowsWindowActiveState;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)encodeWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
[super encodeWithCoder:aCoder];
|
||||
|
||||
[aCoder encodeObject:_maskImage forKey:@"_maskImage"];
|
||||
[aCoder encodeInt:_blendingMode forKey:@"_blendingMode"];
|
||||
[aCoder encodeInt:_material forKey:@"_material"];
|
||||
[aCoder encodeInt:_state forKey:@"_state"];
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
@@ -26,7 +26,6 @@
|
||||
@import "CGGradient.j"
|
||||
@import "_CPWindowView.j"
|
||||
|
||||
@global CPPopoverAppearanceMinimal
|
||||
|
||||
var _CPPopoverWindowViewDefaultCursorSize = CGSizeMake(16, 10);
|
||||
|
||||
@@ -39,7 +38,6 @@ var _CPPopoverWindowViewDefaultCursorSize = CGSizeMake(16, 10);
|
||||
{
|
||||
float _arrowOffsetX @accessors(property=arrowOffsetX);
|
||||
float _arrowOffsetY @accessors(property=arrowOffsetY);
|
||||
int _appearance @accessors(property=appearance);
|
||||
unsigned _preferredEdge @accessors(property=preferredEdge);
|
||||
|
||||
CGSize _cursorSize;
|
||||
@@ -123,7 +121,7 @@ var _CPPopoverWindowViewDefaultCursorSize = CGSizeMake(16, 10);
|
||||
{
|
||||
_arrowOffsetX = 0.0;
|
||||
_arrowOffsetY = 0.0;
|
||||
_appearance = CPPopoverAppearanceMinimal;
|
||||
_appearance = [CPAppearance appearanceNamed:CPAppearanceNameVibrantLight];
|
||||
_cursorSize = CGSizeMakeCopy(_CPPopoverWindowViewDefaultCursorSize);
|
||||
}
|
||||
|
||||
@@ -168,7 +166,7 @@ var _CPPopoverWindowViewDefaultCursorSize = CGSizeMake(16, 10);
|
||||
gradient,
|
||||
frame = [self bounds];
|
||||
|
||||
if (_appearance == CPPopoverAppearanceMinimal)
|
||||
if ([_appearance isEqual:[CPAppearance appearanceNamed:CPAppearanceNameVibrantLight]])
|
||||
{
|
||||
gradient = [self valueForThemeAttribute:@"background-gradient"];
|
||||
strokeColor = [self valueForThemeAttribute:@"stroke-color"];
|
||||
|
||||
@@ -365,6 +365,7 @@ _CPPlatformWindowWillCloseNotification = @"_CPPlatformWindowWillCloseNotificatio
|
||||
_DOMBodyElement.style["-khtml-user-select"] = "none";
|
||||
|
||||
_DOMBodyElement.webkitTouchCallout = "none";
|
||||
_DOMBodyElement.style[CPBrowserStyleProperty(@"user-select")] = @"none";
|
||||
|
||||
[self createDOMElements];
|
||||
[self _addLayers];
|
||||
|
||||
+27
-15
@@ -141,7 +141,12 @@ var _CPPopoverWindow_shouldClose_ = 1 << 4,
|
||||
if (_appearance === anAppearance)
|
||||
return;
|
||||
|
||||
[_windowView setAppearance:anAppearance];
|
||||
_appearance = anAppearance;
|
||||
|
||||
var appearanceName = _appearance == CPPopoverAppearanceMinimal ? CPAppearanceNameVibrantLight : CPAppearanceNameVibrantDark,
|
||||
viewAppearance = [CPAppearance appearanceNamed:appearanceName];
|
||||
|
||||
[_windowView setAppearance:viewAppearance];
|
||||
}
|
||||
|
||||
- (void)setStyleMask:(unsigned)aStyleMask
|
||||
@@ -548,29 +553,36 @@ var _CPPopoverWindow_shouldClose_ = 1 << 4,
|
||||
|
||||
// Now set up the pop-in to normal size transition.
|
||||
// Because we are watching the -webkit-transform, it will occur now.
|
||||
[self setCSS3Property:@"Transform" value:@"scale(1)"];
|
||||
[self setCSS3Property:@"Transition" value:CPBrowserCSSProperty('transform') + @" 50ms linear"];
|
||||
|
||||
_transitionCompleteFunction = function()
|
||||
window.setTimeout(function()
|
||||
{
|
||||
[self setCSS3Property:@"Transform" value:@"scale(1)"];
|
||||
[self setCSS3Property:@"Transition" value:CPBrowserCSSProperty('transform') + @" 50ms linear"];
|
||||
|
||||
_transitionCompleteFunction = function()
|
||||
{
|
||||
#if PLATFORM(DOM)
|
||||
_DOMElement.removeEventListener(CPBrowserStyleProperty('transitionend'), _transitionCompleteFunction, YES);
|
||||
_DOMElement.removeEventListener(CPBrowserStyleProperty('transitionend'), _transitionCompleteFunction, YES);
|
||||
|
||||
// Make sure to clear these properties when the animation is done. Without this,
|
||||
// the window becomes blurry in Chrome, presumably because the browser composits
|
||||
// a layer with a transform differently even when it's an identity transform.
|
||||
[self setCSS3Property:@"Transform" value:nil];
|
||||
[self setCSS3Property:@"TransformOrigin" value:nil];
|
||||
[self setCSS3Property:@"Transition" value:nil];
|
||||
// Make sure to clear these properties when the animation is done. Without this,
|
||||
// the window becomes blurry in Chrome, presumably because the browser composits
|
||||
// a layer with a transform differently even when it's an identity transform.
|
||||
[self setCSS3Property:@"Transform" value:nil];
|
||||
[self setCSS3Property:@"TransformOrigin" value:nil];
|
||||
[self setCSS3Property:@"Transition" value:nil];
|
||||
#endif
|
||||
_isOpening = NO;
|
||||
_isOpening = NO;
|
||||
|
||||
[_delegate _popoverWindowDidShow];
|
||||
}
|
||||
[_delegate _popoverWindowDidShow];
|
||||
}
|
||||
|
||||
#if PLATFORM(DOM)
|
||||
_DOMElement.addEventListener(CPBrowserStyleProperty('transitionend'), _transitionCompleteFunction, YES);
|
||||
_DOMElement.addEventListener(CPBrowserStyleProperty('transitionend'), _transitionCompleteFunction, YES);
|
||||
#endif
|
||||
}, 0); // There are some weird random conditions happening in Chrome 44. If we don't put a timeout to 0 for the end of
|
||||
// the transition, the popover is blinking. It happens on Opera as well...
|
||||
// When the condition is met, the popover will lag a bit when opening...nothing crazy ;)
|
||||
// An issue has been opened here : https://code.google.com/p/chromium/issues/detail?id=523044&thanks=523044&ts=1440095724
|
||||
};
|
||||
|
||||
#if PLATFORM(DOM)
|
||||
|
||||
@@ -176,6 +176,8 @@ var _CPToolTipHeight = 24.0,
|
||||
_toolTipWindow = aWindow;
|
||||
_constrainsToUsableScreen = NO;
|
||||
|
||||
[self setPlatformWindow:[_toolTipWindow platformWindow]];
|
||||
|
||||
textFrameSize.height += 4;
|
||||
|
||||
_content = [CPTextField labelWithTitle:aString];
|
||||
@@ -193,6 +195,7 @@ var _CPToolTipHeight = 24.0,
|
||||
[self setAlphaValue:0.9];
|
||||
|
||||
[_windowView setNeedsDisplay:YES];
|
||||
|
||||
}
|
||||
|
||||
return self;
|
||||
|
||||
@@ -91,7 +91,7 @@ var concat = Array.prototype.concat,
|
||||
- (id)initWithObjects:(CPArray)objects count:(CPUInteger)aCount
|
||||
{
|
||||
if ([objects isKindOfClass:_CPJavaScriptArray])
|
||||
return slice.call(objects, 0);
|
||||
return slice.call(objects, 0, aCount);
|
||||
|
||||
var array = [],
|
||||
index = 0;
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
@import "CPObject.j"
|
||||
@import "CPString.j"
|
||||
|
||||
@class CPString
|
||||
|
||||
CPInvalidArgumentException = @"CPInvalidArgumentException";
|
||||
CPUnsupportedMethodException = @"CPUnsupportedMethodException";
|
||||
CPRangeException = @"CPRangeException";
|
||||
|
||||
@@ -605,11 +605,11 @@
|
||||
}
|
||||
if ([self scanPredicateKeyword:@"TRUE"] || [self scanPredicateKeyword:@"YES"])
|
||||
{
|
||||
return [CPExpression expressionForConstantValue:[CPNumber numberWithBool:YES]];
|
||||
return [CPExpression expressionForConstantValue:YES];
|
||||
}
|
||||
if ([self scanPredicateKeyword:@"FALSE"] || [self scanPredicateKeyword:@"NO"])
|
||||
{
|
||||
return [CPExpression expressionForConstantValue:[CPNumber numberWithBool:NO]];
|
||||
return [CPExpression expressionForConstantValue:NO];
|
||||
}
|
||||
if ([self scanPredicateKeyword:@"SELF"])
|
||||
{
|
||||
|
||||
@@ -26,6 +26,16 @@
|
||||
@import "CPURLRequest.j"
|
||||
@import "CPURLResponse.j"
|
||||
|
||||
@protocol CPURLConnectionDelegate <CPObject>
|
||||
|
||||
- (void)connection:(CPURLConnection)anURLConnection didFailWithError:(CPException)anError;
|
||||
- (void)connection:(CPURLConnection)anURLConnection didReceiveData:(CPString)aData;
|
||||
- (void)connection:(CPURLConnection)anURLConnection didReceiveResponse:(CPString)aResponse;
|
||||
- (void)connectionDidFinishLoading:(CPURLConnection)anURLConnection;
|
||||
- (void)connectionDidReceiveAuthenticationChallenge:(CPURLConnection)anURLConnection;
|
||||
|
||||
@end
|
||||
|
||||
@typedef HTTPRequest
|
||||
|
||||
var CPURLConnectionDelegate = nil;
|
||||
@@ -76,16 +86,16 @@ var CPURLConnectionDelegate = nil;
|
||||
*/
|
||||
@implementation CPURLConnection : CPObject
|
||||
{
|
||||
CPURLRequest _originalRequest @accessors(readonly, getter=originalRequest);
|
||||
CPURLRequest _request @accessors(readonly, getter=currentRequest);
|
||||
id _delegate;
|
||||
BOOL _isCanceled;
|
||||
BOOL _isLocalFileConnection;
|
||||
CPURLRequest _originalRequest @accessors(readonly, getter=originalRequest);
|
||||
CPURLRequest _request @accessors(readonly, getter=currentRequest);
|
||||
id <CPURLConnectionDelegate> _delegate;
|
||||
BOOL _isCanceled;
|
||||
BOOL _isLocalFileConnection;
|
||||
|
||||
HTTPRequest _HTTPRequest;
|
||||
HTTPRequest _HTTPRequest;
|
||||
}
|
||||
|
||||
+ (void)setClassDelegate:(id)delegate
|
||||
+ (void)setClassDelegate:(id <CPURLConnectionDelegate>)delegate
|
||||
{
|
||||
CPURLConnectionDelegate = delegate;
|
||||
}
|
||||
@@ -145,7 +155,7 @@ var CPURLConnectionDelegate = nil;
|
||||
@param shouldStartImmediately whether the \c -start method should be called from here
|
||||
@return the initialized url connection
|
||||
*/
|
||||
- (id)initWithRequest:(CPURLRequest)aRequest delegate:(id)aDelegate startImmediately:(BOOL)shouldStartImmediately
|
||||
- (id)initWithRequest:(CPURLRequest)aRequest delegate:(id <CPURLConnectionDelegate>)aDelegate startImmediately:(BOOL)shouldStartImmediately
|
||||
{
|
||||
self = [super init];
|
||||
|
||||
@@ -166,6 +176,7 @@ var CPURLConnectionDelegate = nil;
|
||||
(window.location.protocol === "file:" || window.location.protocol === "app:"));
|
||||
|
||||
_HTTPRequest = new CFHTTPRequest();
|
||||
_HTTPRequest.setTimeout([aRequest timeoutInterval] * 1000);
|
||||
_HTTPRequest.setWithCredentials([aRequest withCredentials]);
|
||||
|
||||
if (shouldStartImmediately)
|
||||
@@ -175,7 +186,7 @@ var CPURLConnectionDelegate = nil;
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id)initWithRequest:(CPURLRequest)aRequest delegate:(id)aDelegate
|
||||
- (id)initWithRequest:(CPURLRequest)aRequest delegate:(id <CPURLConnectionDelegate>)aDelegate
|
||||
{
|
||||
return [self initWithRequest:aRequest delegate:aDelegate startImmediately:YES];
|
||||
}
|
||||
@@ -200,6 +211,7 @@ var CPURLConnectionDelegate = nil;
|
||||
_HTTPRequest.open([_request HTTPMethod], [[_request URL] absoluteString], YES);
|
||||
|
||||
_HTTPRequest.onreadystatechange = function() { [self _readyStateDidChange]; };
|
||||
_HTTPRequest.ontimeout = function() { [self _didTimeout]; };
|
||||
|
||||
var fields = [_request allHTTPHeaderFields],
|
||||
key = nil,
|
||||
@@ -212,11 +224,16 @@ var CPURLConnectionDelegate = nil;
|
||||
}
|
||||
catch (anException)
|
||||
{
|
||||
if ([_delegate respondsToSelector:@selector(connection:didFailWithError:)])
|
||||
[_delegate connection:self didFailWithError:anException];
|
||||
[self _sendDelegateDidFailWithError:anException];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)_sendDelegateDidFailWithError:(CPException)anException
|
||||
{
|
||||
if ([_delegate respondsToSelector:@selector(connection:didFailWithError:)])
|
||||
[_delegate connection:self didFailWithError:anException];
|
||||
}
|
||||
|
||||
/*
|
||||
Cancels the current request.
|
||||
*/
|
||||
@@ -239,10 +256,22 @@ var CPURLConnectionDelegate = nil;
|
||||
return _isLocalFileConnection;
|
||||
}
|
||||
|
||||
/*!
|
||||
@ignore
|
||||
*/
|
||||
- (void)_didTimeout
|
||||
{
|
||||
var exception = [CPException exceptionWithName:@"Timeout exception"
|
||||
reason:"The request timed out."
|
||||
userInfo:@{}];
|
||||
|
||||
[self _sendDelegateDidFailWithError:exception];
|
||||
}
|
||||
|
||||
/* @ignore */
|
||||
- (void)_readyStateDidChange
|
||||
{
|
||||
if (_HTTPRequest.readyState() === CFHTTPRequest.CompleteState)
|
||||
if (_HTTPRequest.readyState() === CFHTTPRequest.CompleteState && !_HTTPRequest.isTimeoutRequest())
|
||||
{
|
||||
var statusCode = _HTTPRequest.status(),
|
||||
URL = [_request URL];
|
||||
|
||||
@@ -25,6 +25,12 @@
|
||||
@import "CPString.j"
|
||||
@import "CPURL.j"
|
||||
|
||||
@typedef CPURLRequestCachePolicy
|
||||
CPURLRequestUseProtocolCachePolicy = 0;
|
||||
CPURLRequestReloadIgnoringLocalCacheData = 1;
|
||||
CPURLRequestReturnCacheDataElseLoad = 2;
|
||||
CPURLRequestReturnCacheDataDontLoad = 3;
|
||||
|
||||
/*!
|
||||
@class CPURLRequest
|
||||
@ingroup foundation
|
||||
@@ -35,14 +41,16 @@
|
||||
*/
|
||||
@implementation CPURLRequest : CPObject
|
||||
{
|
||||
CPURL _URL @accessors(property=URL);
|
||||
CPURL _URL @accessors(property=URL);
|
||||
|
||||
// FIXME: this should be CPData
|
||||
CPString _HTTPBody @accessors(property=HTTPBody);
|
||||
CPString _HTTPMethod @accessors(property=HTTPMethod);
|
||||
BOOL _withCredentials @accessors(property=withCredentials);
|
||||
CPString _HTTPBody @accessors(property=HTTPBody);
|
||||
CPString _HTTPMethod @accessors(property=HTTPMethod);
|
||||
BOOL _withCredentials @accessors(property=withCredentials);
|
||||
|
||||
CPDictionary _HTTPHeaderFields @accessors(readonly, getter=allHTTPHeaderFields);
|
||||
CPDictionary _HTTPHeaderFields @accessors(readonly, getter=allHTTPHeaderFields);
|
||||
CPTimeInterval _timeoutInterval @accessors(readonly, getter=timeoutInterval);
|
||||
CPURLRequestCachePolicy _cachePolicy @accessors(readonly, getter=cachePolicy);
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -55,6 +63,18 @@
|
||||
return [[CPURLRequest alloc] initWithURL:aURL];
|
||||
}
|
||||
|
||||
/*!
|
||||
Creates a request with a specified URL, cachePolicy and timeoutInterval
|
||||
@param aURL the URL of the request
|
||||
@param aCachePolicy the cache policy of the request
|
||||
@param aTimeoutInterval the timeoutInterval of the request
|
||||
@return a CPURLRequest
|
||||
*/
|
||||
+ (id)requestWithURL:(CPURL)anURL cachePolicy:(CPURLRequestCachePolicy)aCachePolicy timeoutInterval:(CPTimeInterval)aTimeoutInterval
|
||||
{
|
||||
return [[CPURLRequest alloc] initWithURL:anURL cachePolicy:aCachePolicy timeoutInterval:aTimeoutInterval];
|
||||
}
|
||||
|
||||
/*!
|
||||
Equal to `[receiver initWithURL:nil]`.
|
||||
*/
|
||||
@@ -63,6 +83,25 @@
|
||||
return [self initWithURL:nil];
|
||||
}
|
||||
|
||||
/*!
|
||||
Initializes the request with a URL. This is the designated initializer.
|
||||
|
||||
@param aURL the url to set
|
||||
@param aCachePolicy the cache policy of the request
|
||||
@param aTimeoutInterval the timeoutInterval of the request
|
||||
@return the initialized CPURLRequest
|
||||
*/
|
||||
- (id)initWithURL:(CPURL)anURL cachePolicy:(CPURLRequestCachePolicy)aCachePolicy timeoutInterval:(CPTimeInterval)aTimeoutInterval
|
||||
{
|
||||
if (self = [self initWithURL:anURL])
|
||||
{
|
||||
_cachePolicy = aCachePolicy;
|
||||
_timeoutInterval = aTimeoutInterval;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
/*!
|
||||
Initializes the request with a URL. This is the designated initializer.
|
||||
|
||||
@@ -71,9 +110,7 @@
|
||||
*/
|
||||
- (id)initWithURL:(CPURL)aURL
|
||||
{
|
||||
self = [super init];
|
||||
|
||||
if (self)
|
||||
if (self = [super init])
|
||||
{
|
||||
[self setURL:aURL];
|
||||
|
||||
@@ -81,9 +118,34 @@
|
||||
_HTTPMethod = @"GET";
|
||||
_HTTPHeaderFields = @{};
|
||||
_withCredentials = NO;
|
||||
_timeoutInterval = 60.0;
|
||||
_cachePolicy = CPURLRequestUseProtocolCachePolicy;
|
||||
|
||||
[self setValue:"Thu, 01 Jan 1970 00:00:00 GMT" forHTTPHeaderField:"If-Modified-Since"];
|
||||
[self setValue:"no-cache" forHTTPHeaderField:"Cache-Control"];
|
||||
|
||||
switch (_cachePolicy)
|
||||
{
|
||||
case CPURLRequestUseProtocolCachePolicy:
|
||||
// TODO: implement everything about cache...
|
||||
[self setValue:"no-cache" forHTTPHeaderField:"Cache-Control"];
|
||||
break;
|
||||
|
||||
case CPURLRequestReturnCacheDataElseLoad:
|
||||
[self setValue:"max-stale=31536000" forHTTPHeaderField:"Cache-Control"];
|
||||
break;
|
||||
|
||||
case CPURLRequestReturnCacheDataDontLoad:
|
||||
[self setValue:"only-if-cached" forHTTPHeaderField:"Cache-Control"];
|
||||
break;
|
||||
|
||||
case CPURLRequestReloadIgnoringLocalCacheData:
|
||||
[self setValue:"no-cache" forHTTPHeaderField:"Cache-Control"];
|
||||
break;
|
||||
|
||||
default:
|
||||
[self setValue:"no-cache" forHTTPHeaderField:"Cache-Control"];
|
||||
}
|
||||
|
||||
[self setValue:"XMLHttpRequest" forHTTPHeaderField:"X-Requested-With"];
|
||||
}
|
||||
|
||||
|
||||
@@ -112,7 +112,13 @@ GLOBAL(CFHTTPRequest) = function()
|
||||
determineAndDispatchHTTPRequestEvents(self);
|
||||
};
|
||||
|
||||
this._timeoutHandler = function()
|
||||
{
|
||||
dispatchTimeoutHTTPRequestEvents(self);
|
||||
};
|
||||
|
||||
this._nativeRequest.onreadystatechange = this._stateChangeHandler;
|
||||
this._nativeRequest.ontimeout = this._timeoutHandler;
|
||||
|
||||
if (CFHTTPRequest.AuthenticationDelegate !== nil)
|
||||
this._eventDispatcher.addEventListener("HTTP403", function()
|
||||
@@ -209,6 +215,16 @@ CFHTTPRequest.prototype.getResponseHeader = function(/*String*/ aHeader)
|
||||
return this._nativeRequest.getResponseHeader(aHeader);
|
||||
};
|
||||
|
||||
CFHTTPRequest.prototype.setTimeout = function(/*int*/ aTimeout)
|
||||
{
|
||||
this._nativeRequest.timeout = aTimeout;
|
||||
};
|
||||
|
||||
CFHTTPRequest.prototype.getTimeout = function(/*int*/ aTimeout)
|
||||
{
|
||||
return this._nativeRequest.timeout;
|
||||
};
|
||||
|
||||
CFHTTPRequest.prototype.getAllResponseHeaders = function()
|
||||
{
|
||||
return this._nativeRequest.getAllResponseHeaders();
|
||||
@@ -235,7 +251,10 @@ CFHTTPRequest.prototype.send = function(/*Object*/ aBody)
|
||||
if (!this._isOpen)
|
||||
{
|
||||
delete this._nativeRequest.onreadystatechange;
|
||||
delete this._nativeRequest.ontimeout;
|
||||
|
||||
this._nativeRequest.open(this._method, this._URL, this._async, this._user, this._password);
|
||||
this._nativeRequest.ontimeout = this._timeoutHandler;
|
||||
this._nativeRequest.onreadystatechange = this._stateChangeHandler;
|
||||
}
|
||||
|
||||
@@ -287,15 +306,25 @@ CFHTTPRequest.prototype.withCredentials = function()
|
||||
return this._nativeRequest.withCredentials;
|
||||
};
|
||||
|
||||
CFHTTPRequest.prototype.isTimeoutRequest = function()
|
||||
{
|
||||
// Can we consider that as a timeout ?
|
||||
return !this.success() && !this._nativeRequest.response && !this._nativeRequest.responseText && !this._nativeRequest.responseType && !this._nativeRequest.responseURL && !this._nativeRequest.responseXML;
|
||||
};
|
||||
|
||||
function dispatchTimeoutHTTPRequestEvents(/*CFHTTPRequest*/ aRequest)
|
||||
{
|
||||
aRequest._eventDispatcher.dispatchEvent({ type:"timeout", request:aRequest});
|
||||
}
|
||||
|
||||
function determineAndDispatchHTTPRequestEvents(/*CFHTTPRequest*/ aRequest)
|
||||
{
|
||||
var eventDispatcher = aRequest._eventDispatcher;
|
||||
var eventDispatcher = aRequest._eventDispatcher,
|
||||
nativeRequest = aRequest._nativeRequest,
|
||||
readyStates = ["uninitialized", "loading", "loaded", "interactive", "complete"];
|
||||
|
||||
eventDispatcher.dispatchEvent({ type:"readystatechange", request:aRequest});
|
||||
|
||||
var nativeRequest = aRequest._nativeRequest,
|
||||
readyStates = ["uninitialized", "loading", "loaded", "interactive", "complete"];
|
||||
|
||||
if (readyStates[aRequest.readyState()] === "complete")
|
||||
{
|
||||
var status = "HTTP" + aRequest.status();
|
||||
|
||||
+1
-1
@@ -73,7 +73,7 @@ If you need help with Cappuccino, you can get help from the following sources:
|
||||
- Mailing Lists:
|
||||
- [Objective-J](http://groups.google.com/group/objectivej)
|
||||
- [Objective-J Developers](http://groups.google.com/group/objectivej-dev)
|
||||
- IRC: irc://irc.freenode.net#cappuccino
|
||||
- [Gitter] (https://gitter.im/cappuccino/cappuccino)
|
||||
|
||||
If you discover any bugs, please file a ticket at:
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
{
|
||||
}
|
||||
|
||||
+ (void)setUp
|
||||
- (void)setUp
|
||||
{
|
||||
// This will init the global var CPApp which are used internally in the AppKit
|
||||
[[CPApplication alloc] init];
|
||||
|
||||
@@ -61,17 +61,11 @@ var globalResults = [];
|
||||
CPWindow aWindow;
|
||||
}
|
||||
|
||||
+ (void)setUp
|
||||
{
|
||||
// This will init the global var CPApp which are used internally in the AppKit
|
||||
[[CPApplication alloc] init];
|
||||
}
|
||||
|
||||
- (void)setUp
|
||||
{
|
||||
// This sets up the CPApp convenience variable, the unit tests fails
|
||||
// if this is not done, because the framework internally uses CPApp.
|
||||
app = [CPApplication sharedApplication];
|
||||
app = [[CPApplication alloc] init];
|
||||
|
||||
// fake the window.location.hash
|
||||
window.location = {hash: "#var1=1/var2=2"};
|
||||
|
||||
@@ -10,7 +10,7 @@ var ELEMENTS = 200,
|
||||
|
||||
}
|
||||
|
||||
+ (void)setUp
|
||||
- (void)setUp
|
||||
{
|
||||
// This will init the global var CPApp which are used internally in the AppKit
|
||||
[[CPApplication alloc] init];
|
||||
|
||||
@@ -18,12 +18,6 @@
|
||||
CPArray depValues @accessors;
|
||||
}
|
||||
|
||||
+ (void)setUp
|
||||
{
|
||||
// This will init the global var CPApp which are used internally in the AppKit
|
||||
[[CPApplication alloc] init];
|
||||
}
|
||||
|
||||
- (CPArray)makeTestArray
|
||||
{
|
||||
return [[Employee employeeWithName:@"Francisco" department:[Department departmentWithName:@"Cappuccino"]],
|
||||
@@ -62,6 +56,9 @@
|
||||
|
||||
- (void)setUp
|
||||
{
|
||||
// This will init the global var CPApp which are used internally in the AppKit
|
||||
[[CPApplication alloc] init];
|
||||
|
||||
_contentArray = [self makeTestArray];
|
||||
[self initControllerWithSimpleArray]
|
||||
}
|
||||
|
||||
@@ -7,14 +7,11 @@
|
||||
CPInteger RESIZES_COUNT;
|
||||
}
|
||||
|
||||
+ (void)setUp
|
||||
- (void)setUp
|
||||
{
|
||||
// This will init the global var CPApp which are used internally in the AppKit
|
||||
[[CPApplication alloc] init];
|
||||
}
|
||||
|
||||
- (void)setUp
|
||||
{
|
||||
NUMBER_OF_VIEWS = 50;
|
||||
RESIZES_COUNT = 250;
|
||||
}
|
||||
|
||||
@@ -8,14 +8,11 @@
|
||||
CPBrowserDelegate delegate;
|
||||
}
|
||||
|
||||
+ (void)setUp
|
||||
- (void)setUp
|
||||
{
|
||||
// This will init the global var CPApp which are used internally in the AppKit
|
||||
[[CPApplication alloc] init];
|
||||
}
|
||||
|
||||
- (void)setUp
|
||||
{
|
||||
browser = [[CPBrowser alloc] initWithFrame:CGRectMake(0, 0, 500, 300)];
|
||||
delegate = [CPBrowserDelegate new];
|
||||
[delegate setEntries:[".1", ".1.1", ".1.2", ".1.2.1", ".1.2.2", ".2", ".3", ".3.1"]];
|
||||
|
||||
@@ -8,14 +8,11 @@
|
||||
BOOL wasClicked;
|
||||
}
|
||||
|
||||
+ (void)setUp
|
||||
- (void)setUp
|
||||
{
|
||||
// This will init the global var CPApp which are used internally in the AppKit
|
||||
[[CPApplication alloc] init];
|
||||
}
|
||||
|
||||
- (void)setUp
|
||||
{
|
||||
button = [CPButton buttonWithTitle:"hello world"];
|
||||
wasClicked = NO;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
{
|
||||
}
|
||||
|
||||
+ (void)setUp
|
||||
- (void)setUp
|
||||
{
|
||||
// This will init the global var CPApp which are used internally in the AppKit
|
||||
[[CPApplication alloc] init];
|
||||
|
||||
@@ -7,14 +7,11 @@
|
||||
id _globalResults;
|
||||
}
|
||||
|
||||
+ (void)setUp
|
||||
- (void)setUp
|
||||
{
|
||||
// This will init the global var CPApp which are used internally in the AppKit
|
||||
[[CPApplication alloc] init];
|
||||
}
|
||||
|
||||
- (void)setUp
|
||||
{
|
||||
_collectionView = [[CPCollectionView alloc] initWithFrame:CGRectMakeZero()];
|
||||
_globalResults = nil;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
{
|
||||
}
|
||||
|
||||
+ (void)setUp
|
||||
- (void)setUp
|
||||
{
|
||||
// This will init the global var CPApp which are used internally in the AppKit
|
||||
[[CPApplication alloc] init];
|
||||
|
||||
@@ -6,14 +6,11 @@
|
||||
CPColorWell colorWell;
|
||||
}
|
||||
|
||||
+ (void)setUp
|
||||
- (void)setUp
|
||||
{
|
||||
// This will init the global var CPApp which are used internally in the AppKit
|
||||
[[CPApplication alloc] init];
|
||||
}
|
||||
|
||||
- (void)setUp
|
||||
{
|
||||
colorWell = [[CPColorWell alloc] initWithFrame:CGRectMakeZero()];
|
||||
}
|
||||
|
||||
|
||||
@@ -10,14 +10,11 @@
|
||||
BOOL wasClicked
|
||||
}
|
||||
|
||||
+ (void)setUp
|
||||
- (void)setUp
|
||||
{
|
||||
// This will init the global var CPApp which are used internally in the AppKit
|
||||
[[CPApplication alloc] init];
|
||||
}
|
||||
|
||||
- (void)setUp
|
||||
{
|
||||
comboBox = [[CPComboBox alloc] initWithFrame:CGRectMake(0, 0, 200, 30)];
|
||||
}
|
||||
|
||||
|
||||
@@ -8,14 +8,11 @@
|
||||
BOOL aTransform;
|
||||
}
|
||||
|
||||
+ (void)setUp
|
||||
- (void)setUp
|
||||
{
|
||||
// This will init the global var CPApp which are used internally in the AppKit
|
||||
[[CPApplication alloc] init];
|
||||
}
|
||||
|
||||
- (void)setUp
|
||||
{
|
||||
// set up a dummy DOM element.
|
||||
DOMElement = {
|
||||
style: {
|
||||
|
||||
@@ -10,14 +10,11 @@
|
||||
CPDatePicker datePicker;
|
||||
}
|
||||
|
||||
+ (void)setUp
|
||||
- (void)setUp
|
||||
{
|
||||
// This will init the global var CPApp which are used internally in the AppKit
|
||||
[[CPApplication alloc] init];
|
||||
}
|
||||
|
||||
- (void)setUp
|
||||
{
|
||||
datePicker = [[CPDatePicker alloc] initWithFrame:CGRectMake(200, 28, 0, 0)];
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
{
|
||||
}
|
||||
|
||||
+ (void)setUp
|
||||
- (void)setUp
|
||||
{
|
||||
// This will init the global var CPApp which are used internally in the AppKit
|
||||
[[CPApplication alloc] init];
|
||||
|
||||
@@ -10,14 +10,11 @@
|
||||
int tag @accessors;
|
||||
}
|
||||
|
||||
+ (void)setUp
|
||||
- (void)setUp
|
||||
{
|
||||
// This will init the global var CPApp which are used internally in the AppKit
|
||||
[[CPApplication alloc] init];
|
||||
}
|
||||
|
||||
- (void)setUp
|
||||
{
|
||||
fontA = [CPFont systemFontOfSize:8.0];
|
||||
}
|
||||
|
||||
|
||||
@@ -9,14 +9,11 @@
|
||||
CPFont _boldCustomFont;
|
||||
}
|
||||
|
||||
+ (void)setUp
|
||||
- (void)setUp
|
||||
{
|
||||
// This will init the global var CPApp which are used internally in the AppKit
|
||||
[[CPApplication alloc] init];
|
||||
}
|
||||
|
||||
- (void)setUp
|
||||
{
|
||||
_systemFont = [CPFont systemFontOfSize:15];
|
||||
_boldSystemFont = [CPFont boldSystemFontOfSize:15];
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
{
|
||||
}
|
||||
|
||||
+ (void)setUp
|
||||
- (void)setUp
|
||||
{
|
||||
// This will init the global var CPApp which are used internally in the AppKit
|
||||
[[CPApplication alloc] init];
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
}
|
||||
|
||||
+ (void)setUp
|
||||
- (void)setUp
|
||||
{
|
||||
// This will init the global var CPApp which are used internally in the AppKit
|
||||
[[CPApplication alloc] init];
|
||||
|
||||
@@ -18,14 +18,11 @@
|
||||
CPObjectController objectController @accessors;
|
||||
}
|
||||
|
||||
+ (void)setUp
|
||||
- (void)setUp
|
||||
{
|
||||
// This will init the global var CPApp which are used internally in the AppKit
|
||||
[[CPApplication alloc] init];
|
||||
}
|
||||
|
||||
- (void)setUp
|
||||
{
|
||||
track = [Track new];
|
||||
[track setVolume:5.0];
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
CPArrayController arrayController @accessors;
|
||||
}
|
||||
|
||||
+ (void)setUp
|
||||
- (void)setUp
|
||||
{
|
||||
// This will init the global var CPApp which are used internally in the AppKit
|
||||
[[CPApplication alloc] init];
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
{
|
||||
}
|
||||
|
||||
+ (void)setUp
|
||||
- (void)setUp
|
||||
{
|
||||
// This will init the global var CPApp which are used internally in the AppKit
|
||||
[[CPApplication alloc] init];
|
||||
|
||||
@@ -17,14 +17,11 @@
|
||||
CPMenuItem anInstantiatedMenuItem;
|
||||
}
|
||||
|
||||
+ (void)setUp
|
||||
- (void)setUp
|
||||
{
|
||||
// This will init the global var CPApp which are used internally in the AppKit
|
||||
[[CPApplication alloc] init];
|
||||
}
|
||||
|
||||
- (void)setUp
|
||||
{
|
||||
// Set up a fairly complete menu to have something to work with.
|
||||
menu = [[CPMenu alloc] initWithTitle:@"MainMenu"];
|
||||
|
||||
|
||||
@@ -9,14 +9,11 @@ var CPMenuValidatedUserInterfaceItemTestValidatedItems = [];
|
||||
MenuTarget _menuTarget @accessors(property=menuTarget);
|
||||
}
|
||||
|
||||
+ (void)setUp
|
||||
- (void)setUp
|
||||
{
|
||||
// This will init the global var CPApp which are used internally in the AppKit
|
||||
[[CPApplication alloc] init];
|
||||
}
|
||||
|
||||
- (void)setUp
|
||||
{
|
||||
_menuTarget = [[MenuTarget alloc] init];
|
||||
[[CPApplication sharedApplication] setDelegate:_menuTarget];
|
||||
|
||||
|
||||
@@ -9,14 +9,11 @@
|
||||
TestOutlineDataSource dataSource;
|
||||
}
|
||||
|
||||
+ (void)setUp
|
||||
- (void)setUp
|
||||
{
|
||||
// This will init the global var CPApp which are used internally in the AppKit
|
||||
[[CPApplication alloc] init];
|
||||
}
|
||||
|
||||
- (void)setUp
|
||||
{
|
||||
outlineView = [[CPOutlineView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
|
||||
|
||||
tableColumn = [[CPTableColumn alloc] initWithIdentifier:@"Foo"];
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
{
|
||||
}
|
||||
|
||||
+ (void)setUp
|
||||
- (void)setUp
|
||||
{
|
||||
// This will init the global var CPApp which are used internally in the AppKit
|
||||
[[CPApplication alloc] init];
|
||||
|
||||
@@ -9,14 +9,11 @@
|
||||
id objects @accessors;
|
||||
}
|
||||
|
||||
+ (void)setUp
|
||||
- (void)setUp
|
||||
{
|
||||
// This will init the global var CPApp which are used internally in the AppKit
|
||||
[[CPApplication alloc] init];
|
||||
}
|
||||
|
||||
- (void)setUp
|
||||
{
|
||||
button = [CPPopUpButton new];
|
||||
}
|
||||
|
||||
|
||||
@@ -6,14 +6,11 @@
|
||||
CPPredicateEditor _editor;
|
||||
}
|
||||
|
||||
+ (void)setUp
|
||||
- (void)setUp
|
||||
{
|
||||
// This will init the global var CPApp which are used internally in the AppKit
|
||||
[[CPApplication alloc] init];
|
||||
}
|
||||
|
||||
- (void)setUp
|
||||
{
|
||||
_editor = [[CPPredicateEditor alloc] initWithFrame:CGRectMakeZero()];
|
||||
}
|
||||
|
||||
|
||||
@@ -10,14 +10,11 @@
|
||||
CPResponder responder;
|
||||
}
|
||||
|
||||
+ (void)setUp
|
||||
- (void)setUp
|
||||
{
|
||||
// This will init the global var CPApp which are used internally in the AppKit
|
||||
[[CPApplication alloc] init];
|
||||
}
|
||||
|
||||
- (void)setUp
|
||||
{
|
||||
responder = [TestResponder new];
|
||||
responder.doCommandCalls = [];
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
{
|
||||
}
|
||||
|
||||
+ (void)setUp
|
||||
- (void)setUp
|
||||
{
|
||||
// This will init the global var CPApp which are used internally in the AppKit
|
||||
[[CPApplication alloc] init];
|
||||
|
||||
@@ -5,14 +5,11 @@
|
||||
CPSearchField _searchField;
|
||||
}
|
||||
|
||||
+ (void)setUp
|
||||
- (void)setUp
|
||||
{
|
||||
// This will init the global var CPApp which are used internally in the AppKit
|
||||
[[CPApplication alloc] init];
|
||||
}
|
||||
|
||||
- (void)setUp
|
||||
{
|
||||
_searchField = [[CPSearchField alloc] initWithFrame:CGRectMakeZero()];
|
||||
}
|
||||
|
||||
|
||||
@@ -6,14 +6,11 @@
|
||||
CPSegmentedControl _segmentedControl;
|
||||
}
|
||||
|
||||
+ (void)setUp
|
||||
- (void)setUp
|
||||
{
|
||||
// This will init the global var CPApp which are used internally in the AppKit
|
||||
[[CPApplication alloc] init];
|
||||
}
|
||||
|
||||
- (void)setUp
|
||||
{
|
||||
_segmentedControl = [[CPSegmentedControl alloc] initWithFrame:CGRectMakeZero()];
|
||||
[_segmentedControl setSegmentCount:3];
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
{
|
||||
}
|
||||
|
||||
+ (void)setUp
|
||||
- (void)setUp
|
||||
{
|
||||
// This will init the global var CPApp which are used internally in the AppKit
|
||||
[[CPApplication alloc] init];
|
||||
|
||||
@@ -8,14 +8,11 @@
|
||||
CPView viewB;
|
||||
}
|
||||
|
||||
+ (void)setUp
|
||||
- (void)setUp
|
||||
{
|
||||
// This will init the global var CPApp which are used internally in the AppKit
|
||||
[[CPApplication alloc] init];
|
||||
}
|
||||
|
||||
- (void)setUp
|
||||
{
|
||||
splitView = [[CPSplitView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
|
||||
viewA = [[CPView alloc] initWithFrame:CGRectMake(0, 0, 100, 50)];
|
||||
viewB = [[CPView alloc] initWithFrame:CGRectMake(0, 0, 100, 50)];
|
||||
|
||||
@@ -6,14 +6,11 @@
|
||||
CPStepper stepper;
|
||||
}
|
||||
|
||||
+ (void)setUp
|
||||
- (void)setUp
|
||||
{
|
||||
// This will init the global var CPApp which are used internally in the AppKit
|
||||
[[CPApplication alloc] init];
|
||||
}
|
||||
|
||||
- (void)setUp
|
||||
{
|
||||
stepper = [CPStepper stepper];
|
||||
[stepper setValueWraps:NO];
|
||||
}
|
||||
|
||||
@@ -23,14 +23,11 @@
|
||||
CPTabViewItem _tabItem2;
|
||||
}
|
||||
|
||||
+ (void)setUp
|
||||
- (void)setUp
|
||||
{
|
||||
// This will init the global var CPApp which are used internally in the AppKit
|
||||
[[CPApplication alloc] init];
|
||||
}
|
||||
|
||||
- (void)setUp
|
||||
{
|
||||
_tabView = [[CPTabView alloc] initWithFrame:CGRectMake(0, 0, 800, 600)];
|
||||
|
||||
_tabItem1 = [[CPTabViewItem alloc] initWithIdentifier:@"id1"];
|
||||
|
||||
@@ -7,14 +7,11 @@
|
||||
CPArray tableContent;
|
||||
}
|
||||
|
||||
+ (void)setUp
|
||||
- (void)setUp
|
||||
{
|
||||
// This will init the global var CPApp which are used internally in the AppKit
|
||||
[[CPApplication alloc] init];
|
||||
}
|
||||
|
||||
- (void)setUp
|
||||
{
|
||||
tableContent = [];
|
||||
// setup a reasonable table
|
||||
theWindow = [[CPWindow alloc] initWithContentRect:CGRectMake(0.0, 0.0, 1024.0, 768.0)
|
||||
|
||||
@@ -6,14 +6,11 @@
|
||||
CPTableView tableView;
|
||||
}
|
||||
|
||||
+ (void)setUp
|
||||
- (void)setUp
|
||||
{
|
||||
// This will init the global var CPApp which are used internally in the AppKit
|
||||
[[CPApplication alloc] init];
|
||||
}
|
||||
|
||||
- (void)setUp
|
||||
{
|
||||
// setup a reasonable table
|
||||
theWindow = [[CPWindow alloc] initWithContentRect:CGRectMake(0.0, 0.0, 1024.0, 768.0)
|
||||
styleMask:CPWindowNotSizable];
|
||||
|
||||
@@ -13,14 +13,11 @@
|
||||
int selectionDidChangeNotificationsReceived;
|
||||
}
|
||||
|
||||
+ (void)setUp
|
||||
- (void)setUp
|
||||
{
|
||||
// This will init the global var CPApp which are used internally in the AppKit
|
||||
[[CPApplication alloc] init];
|
||||
}
|
||||
|
||||
- (void)setUp
|
||||
{
|
||||
// setup a reasonable table
|
||||
theWindow = [[CPWindow alloc] initWithContentRect:CGRectMake(0.0, 0.0, 1024.0, 768.0) styleMask:CPWindowNotSizable];
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
{
|
||||
}
|
||||
|
||||
+ (void)setUp
|
||||
- (void)setUp
|
||||
{
|
||||
// This will init the global var CPApp which are used internally in the AppKit
|
||||
[[CPApplication alloc] init];
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
{
|
||||
}
|
||||
|
||||
+ (void)setUp
|
||||
- (void)setUp
|
||||
{
|
||||
// This will init the global var CPApp which are used internally in the AppKit
|
||||
[[CPApplication alloc] init];
|
||||
|
||||
@@ -10,14 +10,11 @@
|
||||
|
||||
}
|
||||
|
||||
+ (void)setUp
|
||||
- (void)setUp
|
||||
{
|
||||
// This will init the global var CPApp which are used internally in the AppKit
|
||||
[[CPApplication alloc] init];
|
||||
}
|
||||
|
||||
- (void)setUp
|
||||
{
|
||||
_theWindow = [[CPWindow alloc] initWithContentRect:CGRectMake(0.0, 0.0, 1024.0, 768.0)
|
||||
styleMask:CPWindowNotSizable];
|
||||
|
||||
|
||||
@@ -6,14 +6,11 @@
|
||||
CPTreeNode childNode;
|
||||
}
|
||||
|
||||
+ (void)setUp
|
||||
- (void)setUp
|
||||
{
|
||||
// This will init the global var CPApp which are used internally in the AppKit
|
||||
[[CPApplication alloc] init];
|
||||
}
|
||||
|
||||
- (void)setUp
|
||||
{
|
||||
treeNode = [CPTreeNode treeNodeWithRepresentedObject:nil];
|
||||
|
||||
childNode = [CPTreeNode treeNodeWithRepresentedObject:nil];
|
||||
|
||||
+116
-4
@@ -13,14 +13,11 @@ var methodCalled;
|
||||
CPWindow window;
|
||||
}
|
||||
|
||||
+ (void)setUp
|
||||
- (void)setUp
|
||||
{
|
||||
// This will init the global var CPApp which are used internally in the AppKit
|
||||
[[CPApplication alloc] init];
|
||||
}
|
||||
|
||||
- (void)setUp
|
||||
{
|
||||
window = [[CPWindow alloc] initWithContentRect:CGRectMake(0.0, 0.0, 1000.0, 1000.0) styleMask:CPWindowNotSizable];
|
||||
|
||||
view = [[CPView alloc] initWithFrame:CGRectMakeZero()];
|
||||
@@ -774,6 +771,121 @@ var methodCalled;
|
||||
[self assert:nil equals:view._toolTipFunctionOut];
|
||||
}
|
||||
|
||||
- (void)testAppearanceDefaultvalue
|
||||
{
|
||||
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
|
||||
|
||||
[self assert:nil equals:[view appearance]];
|
||||
[self assertFalse:[view hasThemeState:CPThemeStateAppearanceVibrantDark]];
|
||||
[self assertFalse:[view hasThemeState:CPThemeStateAppearanceVibrantLight]];
|
||||
[self assert:nil equals:[view effectiveAppearance]];
|
||||
}
|
||||
|
||||
- (void)testAppearanceWithVibrantDark
|
||||
{
|
||||
[view setAppearance:[CPAppearance appearanceNamed:CPAppearanceNameVibrantDark]];
|
||||
[self assert:[CPAppearance appearanceNamed:CPAppearanceNameVibrantDark] equals:[view appearance]];
|
||||
[self assert:[CPAppearance appearanceNamed:CPAppearanceNameVibrantDark] equals:[view effectiveAppearance]];
|
||||
|
||||
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
|
||||
[self assertTrue:[view hasThemeState:CPThemeStateAppearanceVibrantDark]];
|
||||
[self assertFalse:[view hasThemeState:CPThemeStateAppearanceVibrantLight]];
|
||||
}
|
||||
|
||||
- (void)testAppearanceWithVibrantLight
|
||||
{
|
||||
[view setAppearance:[CPAppearance appearanceNamed:CPAppearanceNameVibrantLight]];
|
||||
|
||||
[self assert:[CPAppearance appearanceNamed:CPAppearanceNameVibrantLight] equals:[view appearance]];
|
||||
[self assert:[CPAppearance appearanceNamed:CPAppearanceNameVibrantLight] equals:[view effectiveAppearance]];
|
||||
|
||||
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
|
||||
[self assertTrue:[view hasThemeState:CPThemeStateAppearanceVibrantLight]];
|
||||
[self assertFalse:[view hasThemeState:CPThemeStateAppearanceVibrantDark]];
|
||||
}
|
||||
|
||||
- (void)testAppearanceReset
|
||||
{
|
||||
[view setAppearance:[CPAppearance appearanceNamed:CPAppearanceNameVibrantLight]];
|
||||
[view setAppearance:nil];
|
||||
|
||||
[self assert:nil equals:[view appearance]];
|
||||
[self assert:nil equals:[view effectiveAppearance]];
|
||||
|
||||
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
|
||||
[self assertFalse:[view hasThemeState:CPThemeStateAppearanceVibrantLight]];
|
||||
[self assertFalse:[view hasThemeState:CPThemeStateAppearanceVibrantDark]];
|
||||
}
|
||||
|
||||
- (void)testEffectiveAppearance
|
||||
{
|
||||
var secondView = [[CPView alloc] initWithFrame:CGRectMakeZero()];
|
||||
|
||||
[view addSubview:secondView];
|
||||
|
||||
[self assert:nil equals:[secondView appearance]];
|
||||
|
||||
[view setAppearance:[CPAppearance appearanceNamed:CPAppearanceNameVibrantLight]];
|
||||
|
||||
[self assert:[CPAppearance appearanceNamed:CPAppearanceNameVibrantLight] equals:[secondView effectiveAppearance]];
|
||||
}
|
||||
|
||||
- (void)testEffectiveAppearanceWithMovingViews
|
||||
{
|
||||
var viewA = [[CPView alloc] initWithFrame:CGRectMakeZero()],
|
||||
viewB = [[CPView alloc] initWithFrame:CGRectMakeZero()];
|
||||
|
||||
[viewA setAppearance:[CPAppearance appearanceNamed:CPAppearanceNameVibrantLight]];
|
||||
[viewB setAppearance:[CPAppearance appearanceNamed:CPAppearanceNameVibrantDark]];
|
||||
|
||||
[viewA addSubview:view];
|
||||
|
||||
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
|
||||
[self assert:[CPAppearance appearanceNamed:CPAppearanceNameVibrantLight] equals:[view effectiveAppearance]];
|
||||
[self assertTrue:[view hasThemeState:CPThemeStateAppearanceVibrantLight]];
|
||||
[self assertFalse:[view hasThemeState:CPThemeStateAppearanceVibrantDark]];
|
||||
|
||||
[viewB addSubview:view];
|
||||
|
||||
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
|
||||
[self assert:[CPAppearance appearanceNamed:CPAppearanceNameVibrantDark] equals:[view effectiveAppearance]];
|
||||
[self assertFalse:[view hasThemeState:CPThemeStateAppearanceVibrantLight]];
|
||||
[self assertTrue:[view hasThemeState:CPThemeStateAppearanceVibrantDark]];
|
||||
}
|
||||
|
||||
- (void)testEffectiveAppearanceWithMovingViewHierarchy
|
||||
{
|
||||
var viewC = [[CPView alloc] initWithFrame:CGRectMakeZero()],
|
||||
viewA = [[CPView alloc] initWithFrame:CGRectMakeZero()],
|
||||
viewB = [[CPView alloc] initWithFrame:CGRectMakeZero()];
|
||||
|
||||
[view setAppearance:[CPAppearance appearanceNamed:CPAppearanceNameVibrantLight]];
|
||||
[viewC setAppearance:[CPAppearance appearanceNamed:CPAppearanceNameVibrantDark]];
|
||||
|
||||
[viewA addSubview:viewB];
|
||||
[view addSubview:viewA];
|
||||
|
||||
[self assert:[CPAppearance appearanceNamed:CPAppearanceNameVibrantLight] equals:[viewB effectiveAppearance]];
|
||||
|
||||
[viewC addSubview:viewA];
|
||||
[self assert:[CPAppearance appearanceNamed:CPAppearanceNameVibrantDark] equals:[viewB effectiveAppearance]];
|
||||
}
|
||||
|
||||
- (void)testEffectiveAppearanceReset
|
||||
{
|
||||
var viewA = [[CPView alloc] initWithFrame:CGRectMakeZero()],
|
||||
viewB = [[CPView alloc] initWithFrame:CGRectMakeZero()];
|
||||
|
||||
[viewA setAppearance:[CPAppearance appearanceNamed:CPAppearanceNameVibrantLight]];
|
||||
[viewB setAppearance:[CPAppearance appearanceNamed:CPAppearanceNameVibrantDark]];
|
||||
|
||||
[viewA addSubview:view];
|
||||
[self assert:[CPAppearance appearanceNamed:CPAppearanceNameVibrantLight] equals:[view effectiveAppearance]];
|
||||
|
||||
[view removeFromSuperview];
|
||||
[self assert:nil equals:[view effectiveAppearance]];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation CPLayoutView : CPView
|
||||
|
||||
@@ -7,14 +7,11 @@
|
||||
CPWindow _window @accessors(property=window);
|
||||
}
|
||||
|
||||
+ (void)setUp
|
||||
- (void)setUp
|
||||
{
|
||||
// This will init the global var CPApp which are used internally in the AppKit
|
||||
[[CPApplication alloc] init];
|
||||
}
|
||||
|
||||
- (void)setUp
|
||||
{
|
||||
_window = [[CPWindow alloc] initWithContentRect:CGRectMake(0.0, 0.0, 1024.0, 768.0)
|
||||
styleMask:CPWindowNotSizable];
|
||||
}
|
||||
|
||||
@@ -11,6 +11,16 @@
|
||||
return ConcreteArray;
|
||||
}
|
||||
|
||||
- (void)test_initWithObjects_count_
|
||||
{
|
||||
var arrayClass = [[self class] arrayClass],
|
||||
array = [[arrayClass alloc] initWithObjects:[@"hello", @"bye", @"goodnight", @"seeya"] count:2];
|
||||
|
||||
[self assert:[array count] equals:2];
|
||||
[self assert:[array objectAtIndex:0] equals:@"hello"];
|
||||
[self assert:[array objectAtIndex:1] equals:@"bye"];
|
||||
}
|
||||
|
||||
- (void)test_containsObject_
|
||||
{
|
||||
var arrayClass = [[self class] arrayClass],
|
||||
@@ -763,6 +773,21 @@
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id)initWithObjects:(CPArray)objects count:(CPUInteger)aCount
|
||||
{
|
||||
self = [super init];
|
||||
|
||||
if (self)
|
||||
{
|
||||
array = [];
|
||||
|
||||
for (var index = 0; index < aCount; ++index)
|
||||
array.push([objects objectAtIndex:index]);
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (CPUInteger)count
|
||||
{
|
||||
return array.length;
|
||||
|
||||
@@ -555,6 +555,21 @@
|
||||
return self;
|
||||
}
|
||||
|
||||
- (id)initWithObjects:(CPArray)objects count:(CPUInteger)aCount
|
||||
{
|
||||
self = [super init];
|
||||
|
||||
if (self)
|
||||
{
|
||||
array = [];
|
||||
|
||||
for (var index = 0; index < aCount; ++index)
|
||||
array.push([objects objectAtIndex:index]);
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (CPUInteger)count
|
||||
{
|
||||
return array.length;
|
||||
|
||||
@@ -526,6 +526,57 @@
|
||||
[self assertTrue:[result isEqual:data] message:"[1, 2, 3] filtered with '" + [ctpred description] + "' should return [1, 2, 3]"];
|
||||
}
|
||||
|
||||
- (void)testConstantValueExpressionWithBooleanValueIsBoolean
|
||||
{
|
||||
var right = [[CPPredicate predicateWithFormat:@"k = YES"] rightExpression];
|
||||
|
||||
[self assert:CPConstantValueExpressionType equals:[right expressionType]];
|
||||
[self assert:YES equals:[right constantValue]];
|
||||
[self assert:'boolean' equals:typeof [right constantValue]];
|
||||
|
||||
right = [[CPPredicate predicateWithFormat:@"k = NO"] rightExpression];
|
||||
|
||||
[self assert:CPConstantValueExpressionType equals:[right expressionType]];
|
||||
[self assert:NO equals:[right constantValue]];
|
||||
[self assert:'boolean' equals:typeof [right constantValue]];
|
||||
}
|
||||
|
||||
- (void)testEvaluateBooleanConstantValueExpressionWithDifferentObjects
|
||||
{
|
||||
var yesPredicate = [CPPredicate predicateWithFormat:@"self = YES"],
|
||||
noPredicate = [CPPredicate predicateWithFormat:@"self = NO"];
|
||||
|
||||
var evalYesPredicate = function(object) { return [yesPredicate evaluateWithObject:object]; },
|
||||
evalNoPredicate = function(object) { return [noPredicate evaluateWithObject:object]; };
|
||||
|
||||
var fixtures = [
|
||||
{
|
||||
message:@"booleans",
|
||||
values: [YES, NO],
|
||||
expected_yes: [YES, NO],
|
||||
expected_no: [ NO, YES]
|
||||
},
|
||||
{
|
||||
message:@"numbers",
|
||||
values: [ 0, 1, 2],
|
||||
expected_yes: [ NO, YES, NO],
|
||||
expected_no: [YES, NO, NO]
|
||||
},
|
||||
{
|
||||
message:@"strings",
|
||||
values: [@"1", @"2", @"true", @"false", @"", @"YES", @"NO"],
|
||||
expected_yes: [ NO , NO , NO , NO , NO, NO , NO ],
|
||||
expected_no: [ NO , NO , NO , NO , NO, NO , NO ]
|
||||
}];
|
||||
|
||||
for (var i = 0; i < [fixtures count]; i++)
|
||||
{
|
||||
var fixture = fixtures[i];
|
||||
[self assert:fixture.expected_yes equals:fixture.values.map(evalYesPredicate) message:fixture.message + " with YES-predicate"];
|
||||
[self assert:fixture.expected_no equals:fixture.values.map(evalNoPredicate) message:fixture.message + " with NO-predicate"];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation CPObject (PredicateTesting)
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
/*
|
||||
* AppController.j
|
||||
* CPVisualEffectViewTest
|
||||
*
|
||||
* Created by You on August 13, 2015.
|
||||
* Copyright 2015, Your Company All rights reserved.
|
||||
*/
|
||||
|
||||
@import <Foundation/Foundation.j>
|
||||
@import <AppKit/AppKit.j>
|
||||
|
||||
@implementation AppController : CPObject
|
||||
{
|
||||
@outlet CPWindow window;
|
||||
|
||||
@outlet CPVisualEffectView FXView1;
|
||||
@outlet CPVisualEffectView FXView2;
|
||||
@outlet CPVisualEffectView FXView3;
|
||||
@outlet CPVisualEffectView FXView4;
|
||||
@outlet CPVisualEffectView FXView5;
|
||||
@outlet CPVisualEffectView FXView6;
|
||||
|
||||
@outlet CPTextField field1;
|
||||
@outlet CPTextField field2;
|
||||
@outlet CPTextField field3;
|
||||
@outlet CPTextField field4;
|
||||
@outlet CPTextField field5;
|
||||
@outlet CPTextField field6;
|
||||
|
||||
@outlet CPButton button1;
|
||||
@outlet CPButton button2;
|
||||
@outlet CPButton button3;
|
||||
@outlet CPButton button4;
|
||||
@outlet CPButton button5;
|
||||
@outlet CPButton button6;
|
||||
|
||||
}
|
||||
|
||||
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
|
||||
{
|
||||
}
|
||||
|
||||
- (void)awakeFromCib
|
||||
{
|
||||
var fields = [field1, field2, field3, field4, field5, field6];
|
||||
|
||||
for (var i = [fields count] - 1; i >= 0; i--)
|
||||
[fields[i] setValue:[CPColor whiteColor] forThemeAttribute:@"text-color" inState:CPThemeStateAppearanceVibrantDark];
|
||||
|
||||
var buttons = [button1, button2, button3, button4, button5, button6];
|
||||
|
||||
for (var i = [buttons count] - 1; i >= 0; i--)
|
||||
{
|
||||
[buttons[i] setValue:[CPColor colorWithHexString:@"f3f3f3"] forThemeAttribute:@"bezel-color" inState:CPThemeStateAppearanceVibrantLight];
|
||||
[buttons[i] setValue:[CPColor colorWithHexString:@"333333"] forThemeAttribute:@"text-color" inState:CPThemeStateAppearanceVibrantLight];
|
||||
[buttons[i] setValue:[CPColor clearColor] forThemeAttribute:@"text-shadow-color" inState:CPThemeStateAppearanceVibrantLight];
|
||||
|
||||
[buttons[i] setValue:[CPColor colorWithHexString:@"333333"] forThemeAttribute:@"bezel-color" inState:CPThemeStateAppearanceVibrantDark];
|
||||
[buttons[i] setValue:[CPColor colorWithHexString:@"999"] forThemeAttribute:@"text-color" inState:CPThemeStateAppearanceVibrantDark];
|
||||
[buttons[i] setValue:[CPColor clearColor] forThemeAttribute:@"text-shadow-color" inState:CPThemeStateAppearanceVibrantDark];
|
||||
}
|
||||
}
|
||||
|
||||
- (IBAction)switch:(id)aSender
|
||||
{
|
||||
var dark = [CPAppearance appearanceNamed:CPAppearanceNameVibrantDark],
|
||||
light = [CPAppearance appearanceNamed:CPAppearanceNameVibrantLight],
|
||||
appearance = ([[aSender effectiveAppearance] isEqual:dark]) ? light : dark;
|
||||
|
||||
[[aSender superview] setAppearance:appearance];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,14 @@
|
||||
<?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>CPVisualEffectViewTest</string>
|
||||
<key>CPBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
<key>CPHumanReadableCopyright</key>
|
||||
<string>Copyright © 2015, Your Company All rights reserved.</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,184 @@
|
||||
/*
|
||||
* Jakefile
|
||||
* CPVisualEffectViewTest
|
||||
*
|
||||
* Created by You on August 13, 2015.
|
||||
* Copyright 2015, Your Company All rights reserved.
|
||||
*/
|
||||
|
||||
var ENV = require("system").env,
|
||||
FILE = require("file"),
|
||||
JAKE = require("jake"),
|
||||
task = JAKE.task,
|
||||
FileList = JAKE.FileList,
|
||||
app = require("cappuccino/jake").app,
|
||||
configuration = ENV["CONFIG"] || ENV["CONFIGURATION"] || ENV["c"] || "Debug",
|
||||
OS = require("os"),
|
||||
projectName = "CPVisualEffectViewTest";
|
||||
|
||||
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", "CPVisualEffectViewTest.build", configuration));
|
||||
task.setBuildPath(FILE.join("Build", configuration));
|
||||
|
||||
task.setProductName("CPVisualEffectViewTest");
|
||||
task.setIdentifier("com.yourcompany.CPVisualEffectViewTest");
|
||||
task.setVersion("1.0");
|
||||
task.setAuthor("Your Company");
|
||||
task.setEmail("feedback @nospam@ yourcompany.com");
|
||||
task.setSummary("CPVisualEffectViewTest");
|
||||
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()
|
||||
{
|
||||
configuration = ENV["CONFIGURATION"] = "Debug";
|
||||
JAKE.subjake(["."], "build", ENV);
|
||||
});
|
||||
|
||||
task ("release", function()
|
||||
{
|
||||
configuration = 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, "CPVisualEffectViewTest.app"));
|
||||
printResults("Desktop")
|
||||
});
|
||||
|
||||
task ("run-desktop", ["desktop"], function()
|
||||
{
|
||||
OS.system([FILE.join("Build", "Desktop", projectName, "CPVisualEffectViewTest.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", 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 (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", 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", 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();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
280NPLIST;1.0;D;K;4;$topD;K;18;CPCibObjectDataKeyD;K;6;CP$UIDd;1;2E;E;K;8;$objectsA;S;5;$nullD;K;10;$classnameS;16;_CPCibObjectDataK;8;$classesA;S;16;_CPCibObjectDataS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;1;1E;K;28;_CPCibObjectDataNamesKeysKeyD;K;6;CP$UIDd;1;0E;K;30;_CPCibObjectDataNamesValuesKeyD;K;6;CP$UIDd;1;0E;K;30;_CPCibObjectDataClassesKeysKeyD;K;6;CP$UIDd;1;0E;K;32;_CPCibObjectDataClassesValuesKeyD;K;6;CP$UIDd;1;0E;K;30;_CPCibObjectDataConnectionsKeyD;K;6;CP$UIDd;1;4E;K;28;_CPCibObjectDataFrameworkKeyD;K;6;CP$UIDd;1;0E;K;26;_CPCibObjectDataNextOidKeyD;K;6;CP$UIDd;1;5E;K;30;_CPCibObjectDataObjectsKeysKeyD;K;6;CP$UIDd;1;6E;K;32;_CPCibObjectDataObjectsValuesKeyD;K;6;CP$UIDd;1;7E;K;26;_CPCibObjectDataOidKeysKeyD;K;6;CP$UIDd;1;8E;K;28;_CPCibObjectDataOidValuesKeyD;K;6;CP$UIDd;1;9E;K;28;_CPCibObjectDataFileOwnerKeyD;K;6;CP$UIDd;2;11E;K;33;_CPCibObjectDataVisibleWindowsKeyD;K;6;CP$UIDd;2;13E;E;D;K;10;$classnameS;7;CPArrayK;8;$classesA;S;7;CPArrayS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;D;K;6;CP$UIDd;2;15E;D;K;6;CP$UIDd;2;16E;D;K;6;CP$UIDd;2;17E;D;K;6;CP$UIDd;2;18E;D;K;6;CP$UIDd;2;19E;D;K;6;CP$UIDd;2;20E;D;K;6;CP$UIDd;2;21E;D;K;6;CP$UIDd;2;22E;D;K;6;CP$UIDd;2;23E;D;K;6;CP$UIDd;2;24E;D;K;6;CP$UIDd;2;25E;D;K;6;CP$UIDd;2;26E;D;K;6;CP$UIDd;2;27E;D;K;6;CP$UIDd;2;28E;D;K;6;CP$UIDd;2;29E;D;K;6;CP$UIDd;2;30E;D;K;6;CP$UIDd;2;31E;D;K;6;CP$UIDd;2;32E;D;K;6;CP$UIDd;2;33E;D;K;6;CP$UIDd;2;34E;D;K;6;CP$UIDd;2;36E;D;K;6;CP$UIDd;2;37E;D;K;6;CP$UIDd;2;38E;D;K;6;CP$UIDd;2;39E;D;K;6;CP$UIDd;2;40E;D;K;6;CP$UIDd;2;41E;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;D;K;6;CP$UIDd;2;42E;D;K;6;CP$UIDd;2;43E;D;K;6;CP$UIDd;2;45E;D;K;6;CP$UIDd;2;47E;D;K;6;CP$UIDd;2;49E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;50E;D;K;6;CP$UIDd;2;51E;D;K;6;CP$UIDd;2;53E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;55E;D;K;6;CP$UIDd;2;56E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;58E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;59E;D;K;6;CP$UIDd;2;60E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;61E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;62E;D;K;6;CP$UIDd;2;63E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;64E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;65E;D;K;6;CP$UIDd;2;66E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;67E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;68E;D;K;6;CP$UIDd;2;69E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;70E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;71E;D;K;6;CP$UIDd;2;72E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;73E;D;K;6;CP$UIDd;1;0E;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;D;K;6;CP$UIDd;2;11E;D;K;6;CP$UIDd;2;11E;D;K;6;CP$UIDd;2;11E;D;K;6;CP$UIDd;2;45E;D;K;6;CP$UIDd;2;47E;D;K;6;CP$UIDd;2;49E;D;K;6;CP$UIDd;2;11E;D;K;6;CP$UIDd;2;50E;D;K;6;CP$UIDd;2;51E;D;K;6;CP$UIDd;2;53E;D;K;6;CP$UIDd;2;51E;D;K;6;CP$UIDd;2;55E;D;K;6;CP$UIDd;2;56E;D;K;6;CP$UIDd;2;55E;D;K;6;CP$UIDd;2;58E;D;K;6;CP$UIDd;2;51E;D;K;6;CP$UIDd;2;59E;D;K;6;CP$UIDd;2;60E;D;K;6;CP$UIDd;2;59E;D;K;6;CP$UIDd;2;61E;D;K;6;CP$UIDd;2;51E;D;K;6;CP$UIDd;2;62E;D;K;6;CP$UIDd;2;63E;D;K;6;CP$UIDd;2;62E;D;K;6;CP$UIDd;2;64E;D;K;6;CP$UIDd;2;51E;D;K;6;CP$UIDd;2;65E;D;K;6;CP$UIDd;2;66E;D;K;6;CP$UIDd;2;65E;D;K;6;CP$UIDd;2;67E;D;K;6;CP$UIDd;2;51E;D;K;6;CP$UIDd;2;68E;D;K;6;CP$UIDd;2;69E;D;K;6;CP$UIDd;2;68E;D;K;6;CP$UIDd;2;70E;D;K;6;CP$UIDd;2;51E;D;K;6;CP$UIDd;2;71E;D;K;6;CP$UIDd;2;72E;D;K;6;CP$UIDd;2;71E;D;K;6;CP$UIDd;2;73E;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;E;E;D;K;10;$classnameS;18;_CPCibCustomObjectK;8;$classesA;S;18;_CPCibCustomObjectS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;2;10E;K;27;_CPCibCustomObjectClassNameD;K;6;CP$UIDd;2;74E;E;D;K;10;$classnameS;5;CPSetK;8;$classesA;S;5;CPSetS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;2;12E;K;15;CPSetObjectsKeyD;K;6;CP$UIDd;2;75E;E;D;K;10;$classnameS;20;CPCibOutletConnectorK;8;$classesA;S;20;CPCibOutletConnectorS;14;CPCibConnectorS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;2;14E;K;24;_CPCibConnectorSourceKeyD;K;6;CP$UIDd;2;11E;K;29;_CPCibConnectorDestinationKeyD;K;6;CP$UIDd;2;43E;K;23;_CPCibConnectorLabelKeyD;K;6;CP$UIDd;2;76E;E;D;K;6;$classD;K;6;CP$UIDd;2;14E;K;24;_CPCibConnectorSourceKeyD;K;6;CP$UIDd;2;43E;K;29;_CPCibConnectorDestinationKeyD;K;6;CP$UIDd;2;55E;K;23;_CPCibConnectorLabelKeyD;K;6;CP$UIDd;2;77E;E;D;K;6;$classD;K;6;CP$UIDd;2;14E;K;24;_CPCibConnectorSourceKeyD;K;6;CP$UIDd;2;43E;K;29;_CPCibConnectorDestinationKeyD;K;6;CP$UIDd;2;59E;K;23;_CPCibConnectorLabelKeyD;K;6;CP$UIDd;2;78E;E;D;K;6;$classD;K;6;CP$UIDd;2;14E;K;24;_CPCibConnectorSourceKeyD;K;6;CP$UIDd;2;43E;K;29;_CPCibConnectorDestinationKeyD;K;6;CP$UIDd;2;65E;K;23;_CPCibConnectorLabelKeyD;K;6;CP$UIDd;2;79E;E;D;K;6;$classD;K;6;CP$UIDd;2;14E;K;24;_CPCibConnectorSourceKeyD;K;6;CP$UIDd;2;43E;K;29;_CPCibConnectorDestinationKeyD;K;6;CP$UIDd;2;71E;K;23;_CPCibConnectorLabelKeyD;K;6;CP$UIDd;2;80E;E;D;K;6;$classD;K;6;CP$UIDd;2;14E;K;24;_CPCibConnectorSourceKeyD;K;6;CP$UIDd;2;43E;K;29;_CPCibConnectorDestinationKeyD;K;6;CP$UIDd;2;62E;K;23;_CPCibConnectorLabelKeyD;K;6;CP$UIDd;2;81E;E;D;K;6;$classD;K;6;CP$UIDd;2;14E;K;24;_CPCibConnectorSourceLine truncated
|
||||
Follows Key WindowS;21;{{73, 213}, {69, 25}}S;18;{{0, 0}, {69, 25}}S;6;buttonS;27;bordered+controlSizeRegularD;K;6;$classD;K;6;CP$UIDd;3;118E;K;13;CPFontNameKeyD;K;6;CP$UIDd;3;180E;K;13;CPFontSizeKeyD;K;6;CP$UIDd;3;122E;K;15;CPFontIsBoldKeyD;K;6;CP$UIDd;3;120E;K;17;CPFontIsItalicKeyD;K;6;CP$UIDd;3;110E;K;17;CPFontIsSystemKeyD;K;6;CP$UIDd;3;120E;E;D;K;10;$classnameS;17;_CPThemeAttributeK;8;$classesA;S;17;_CPThemeAttributeS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;3;149E;K;4;nameD;K;6;CP$UIDd;3;187E;K;12;defaultValueD;K;6;CP$UIDd;1;0E;K;5;stateD;K;6;CP$UIDd;3;188E;K;5;valueD;K;6;CP$UIDd;3;189E;E;S;6;SwitchS;0;d;2;14S;23;{{310, 15}, {215, 254}}D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;D;K;6;CP$UIDd;2;60E;D;K;6;CP$UIDd;2;61E;E;E;S;20;Vibrant Light
|
||||
ActiveD;K;6;$classD;K;6;CP$UIDd;3;118E;K;13;CPFontNameKeyD;K;6;CP$UIDd;3;180E;K;13;CPFontSizeKeyD;K;6;CP$UIDd;3;122E;K;15;CPFontIsBoldKeyD;K;6;CP$UIDd;3;120E;K;17;CPFontIsItalicKeyD;K;6;CP$UIDd;3;110E;K;17;CPFontIsSystemKeyD;K;6;CP$UIDd;3;120E;E;D;K;6;$classD;K;6;CP$UIDd;3;149E;K;4;nameD;K;6;CP$UIDd;3;187E;K;12;defaultValueD;K;6;CP$UIDd;1;0E;K;5;stateD;K;6;CP$UIDd;3;188E;K;5;valueD;K;6;CP$UIDd;3;189E;E;S;24;{{310, 277}, {215, 254}}D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;D;K;6;CP$UIDd;2;63E;D;K;6;CP$UIDd;2;64E;E;E;D;K;6;$classD;K;6;CP$UIDd;3;137E;K;5;_nameD;K;6;CP$UIDd;3;190E;K;15;_allowsVibrancyD;K;6;CP$UIDd;1;0E;E;S;19;Vibrant Dark
|
||||
ActiveD;K;6;$classD;K;6;CP$UIDd;3;118E;K;13;CPFontNameKeyD;K;6;CP$UIDd;3;180E;K;13;CPFontSizeKeyD;K;6;CP$UIDd;3;122E;K;15;CPFontIsBoldKeyD;K;6;CP$UIDd;3;120E;K;17;CPFontIsItalicKeyD;K;6;CP$UIDd;3;110E;K;17;CPFontIsSystemKeyD;K;6;CP$UIDd;3;120E;E;D;K;6;$classD;K;6;CP$UIDd;3;149E;K;4;nameD;K;6;CP$UIDd;3;187E;K;12;defaultValueD;K;6;CP$UIDd;1;0E;K;5;stateD;K;6;CP$UIDd;3;188E;K;5;valueD;K;6;CP$UIDd;3;189E;E;S;23;{{533, 15}, {215, 254}}D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;D;K;6;CP$UIDd;2;66E;D;K;6;CP$UIDd;2;67E;E;E;S;22;Vibrant Light
|
||||
InactiveD;K;6;$classD;K;6;CP$UIDd;3;118E;K;13;CPFontNameKeyD;K;6;CP$UIDd;3;180E;K;13;CPFontSizeKeyD;K;6;CP$UIDd;3;122E;K;15;CPFontIsBoldKeyD;K;6;CP$UIDd;3;120E;K;17;CPFontIsItalicKeyD;K;6;CP$UIDd;3;110E;K;17;CPFontIsSystemKeyD;K;6;CP$UIDd;3;120E;E;D;K;6;$classD;K;6;CP$UIDd;3;149E;K;4;nameD;K;6;CP$UIDd;3;187E;K;12;defaultValueD;K;6;CP$UIDd;1;0E;K;5;stateD;K;6;CP$UIDd;3;188E;K;5;valueD;K;6;CP$UIDd;3;189E;E;S;24;{{533, 277}, {215, 254}}D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;D;K;6;CP$UIDd;2;69E;D;K;6;CP$UIDd;2;70E;E;E;S;21;Vibrant Dark
|
||||
InactiveD;K;6;$classD;K;6;CP$UIDd;3;118E;K;13;CPFontNameKeyD;K;6;CP$UIDd;3;180E;K;13;CPFontSizeKeyD;K;6;CP$UIDd;3;122E;K;15;CPFontIsBoldKeyD;K;6;CP$UIDd;3;120E;K;17;CPFontIsItalicKeyD;K;6;CP$UIDd;3;110E;K;17;CPFontIsSystemKeyD;K;6;CP$UIDd;3;120E;E;D;K;6;$classD;K;6;CP$UIDd;3;149E;K;4;nameD;K;6;CP$UIDd;3;187E;K;12;defaultValueD;K;6;CP$UIDd;1;0E;K;5;stateD;K;6;CP$UIDd;3;188E;K;5;valueD;K;6;CP$UIDd;3;189E;E;S;23;{{87, 277}, {215, 254}}D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;D;K;6;CP$UIDd;2;72E;D;K;6;CP$UIDd;2;73E;E;E;S;31;Vibrant Dark
|
||||
Follows Key WindowD;K;6;$classD;K;6;CP$UIDd;3;118E;K;13;CPFontNameKeyD;K;6;CP$UIDd;3;180E;K;13;CPFontSizeKeyD;K;6;CP$UIDd;3;122E;K;15;CPFontIsBoldKeyD;K;6;CP$UIDd;3;120E;K;17;CPFontIsItalicKeyD;K;6;CP$UIDd;3;110E;K;17;CPFontIsSystemKeyD;K;6;CP$UIDd;3;120E;E;D;K;6;$classD;K;6;CP$UIDd;3;149E;K;4;nameD;K;6;CP$UIDd;3;187E;K;12;defaultValueD;K;6;CP$UIDd;1;0E;K;5;stateD;K;6;CP$UIDd;3;188E;K;5;valueD;K;6;CP$UIDd;3;189E;E;S;28;_CPFontSystemFacePlaceholderD;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;D;K;6;CP$UIDd;3;191E;D;K;6;CP$UIDd;3;191E;D;K;6;CP$UIDd;3;191E;D;K;6;CP$UIDd;3;139E;E;E;S;7;CPImageS;14;background.jpgD;K;10;$classnameS;12;CPDictionaryK;8;$classesA;S;12;CPDictionaryS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;3;184E;K;10;CP.objectsD;K;4;sizeD;K;6;CP$UIDd;3;193E;K;16;bundleIdentifierD;K;6;CP$UIDd;3;152E;K;9;frameworkD;K;6;CP$UIDd;3;152E;E;E;S;28;CPAppearanceNameVibrantLightS;5;imageS;11;highlightedD;K;6;$classD;K;6;CP$UIDd;3;118E;K;13;CPFontNameKeyD;K;6;CP$UIDd;3;194E;K;13;CPFontSizeKeyD;K;6;CP$UIDd;3;195E;K;15;CPFontIsBoldKeyD;K;6;CP$UIDd;3;110E;K;17;CPFontIsItalicKeyD;K;6;CP$UIDd;3;110E;K;17;CPFontIsSystemKeyD;K;6;CP$UIDd;3;110E;E;S;27;CPAppearanceNameVibrantDarkf;18;0.6862745098039216D;K;10;$classnameS;21;_CPKeyedArchiverValueK;8;$classesA;S;21;_CPKeyedArchiverValueS;7;CPValueS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;3;192E;K;15;CPValueValueKeyD;K;6;CP$UIDd;3;196E;E;S;18;.AppleSystemUIFontd;2;13S;32;{"width":245.76,"height":160.32}E;K;9;$archiverS;15;CPKeyedArchiverK;8;$versionS;6;100000E;
|
||||
@@ -0,0 +1,271 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="8173.3" systemVersion="15A244d" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
|
||||
<dependencies>
|
||||
<deployment version="1050" identifier="macosx"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="8173.3"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
|
||||
<connections>
|
||||
<outlet property="delegate" destination="450" id="451"/>
|
||||
</connections>
|
||||
</customObject>
|
||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
||||
<customObject id="450" customClass="AppController">
|
||||
<connections>
|
||||
<outlet property="FXView1" destination="ESw-Mt-ZuS" id="9sp-kM-oA6"/>
|
||||
<outlet property="FXView2" destination="ofy-S7-rCf" id="B5s-ei-PSM"/>
|
||||
<outlet property="FXView3" destination="GcT-Xr-eCB" id="xb2-nI-t3Q"/>
|
||||
<outlet property="FXView4" destination="xEz-ym-SoC" id="65y-hT-xuH"/>
|
||||
<outlet property="FXView5" destination="X1I-rR-BOD" id="xRm-BO-MOM"/>
|
||||
<outlet property="FXView6" destination="kpQ-qE-hkl" id="7gx-CZ-I5a"/>
|
||||
<outlet property="button1" destination="8UZ-6M-ugH" id="HW6-M8-eVe"/>
|
||||
<outlet property="button2" destination="rsT-2n-bIX" id="2te-bR-PMa"/>
|
||||
<outlet property="button3" destination="22y-1h-QPQ" id="7ba-up-1UD"/>
|
||||
<outlet property="button4" destination="lT3-jQ-tgV" id="fW4-Gk-FbR"/>
|
||||
<outlet property="button5" destination="PbX-4k-5V8" id="Snb-TO-Hda"/>
|
||||
<outlet property="button6" destination="xCh-Ei-U1y" id="GR3-p9-foJ"/>
|
||||
<outlet property="field1" destination="drG-ES-sje" id="NGY-iR-BAD"/>
|
||||
<outlet property="field2" destination="YjR-CK-WeJ" id="e1I-sz-QB1"/>
|
||||
<outlet property="field3" destination="V0w-c6-mp4" id="jcP-xb-IVG"/>
|
||||
<outlet property="field4" destination="oRu-hV-Fpl" id="Ifr-Ft-x2d"/>
|
||||
<outlet property="field5" destination="eA4-la-pyn" id="O1i-2s-6tS"/>
|
||||
<outlet property="field6" destination="x9a-RT-bcS" id="YrX-y5-Fqc"/>
|
||||
<outlet property="window" destination="371" id="7nV-eB-gc9"/>
|
||||
</connections>
|
||||
</customObject>
|
||||
<window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" showsToolbarButton="NO" frameAutosaveName="" animationBehavior="default" id="Knp-iN-1Ch">
|
||||
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
|
||||
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
|
||||
<rect key="contentRect" x="100" y="722" width="181" height="67"/>
|
||||
<rect key="screenRect" x="0.0" y="0.0" width="1440" height="877"/>
|
||||
<view key="contentView" id="KQ2-1g-9W7">
|
||||
<rect key="frame" x="0.0" y="0.0" width="181" height="67"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="d7y-fN-bjP">
|
||||
<rect key="frame" x="18" y="25" width="145" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<animations/>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Click me to loose focus" id="eKf-xB-TJp">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
</subviews>
|
||||
<animations/>
|
||||
</view>
|
||||
<point key="canvasLocation" x="146.5" y="111.5"/>
|
||||
</window>
|
||||
<window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="371">
|
||||
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES"/>
|
||||
<rect key="contentRect" x="335" y="178" width="834" height="545"/>
|
||||
<rect key="screenRect" x="0.0" y="0.0" width="1440" height="877"/>
|
||||
<view key="contentView" id="372">
|
||||
<rect key="frame" x="0.0" y="0.0" width="834" height="545"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" id="WJS-cx-TuA">
|
||||
<rect key="frame" x="0.0" y="0.0" width="834" height="545"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<animations/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyUpOrDown" image="background" id="asL-vN-HqR"/>
|
||||
</imageView>
|
||||
<visualEffectView appearanceType="vibrantLight" blendingMode="behindWindow" state="followsWindowActiveState" id="ESw-Mt-ZuS">
|
||||
<rect key="frame" x="87" y="276" width="215" height="254"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<subviews>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="drG-ES-sje">
|
||||
<rect key="frame" x="18" y="110" width="179" height="34"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<animations/>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" id="f01-C4-Fhw">
|
||||
<font key="font" metaFont="systemBold"/>
|
||||
<string key="title">Vibrant Light
|
||||
Follows Key Window</string>
|
||||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<button verticalHuggingPriority="750" id="8UZ-6M-ugH">
|
||||
<rect key="frame" x="67" y="13" width="81" height="32"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<animations/>
|
||||
<buttonCell key="cell" type="push" title="Switch" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="71z-vZ-VTZ">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<action selector="switch:" target="450" id="gIr-5T-Rzf"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<animations/>
|
||||
</visualEffectView>
|
||||
<visualEffectView appearanceType="vibrantLight" blendingMode="behindWindow" state="active" id="ofy-S7-rCf">
|
||||
<rect key="frame" x="310" y="276" width="215" height="254"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<subviews>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="YjR-CK-WeJ">
|
||||
<rect key="frame" x="18" y="110" width="179" height="34"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<animations/>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" id="0ce-BE-k8L">
|
||||
<font key="font" metaFont="systemBold"/>
|
||||
<string key="title">Vibrant Light
|
||||
Active</string>
|
||||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<button verticalHuggingPriority="750" id="rsT-2n-bIX">
|
||||
<rect key="frame" x="67" y="13" width="81" height="32"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<animations/>
|
||||
<buttonCell key="cell" type="push" title="Switch" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="W6T-T4-5FW">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<action selector="switch:" target="450" id="Uaa-H7-ZYy"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<animations/>
|
||||
</visualEffectView>
|
||||
<visualEffectView appearanceType="vibrantDark" blendingMode="behindWindow" state="active" id="X1I-rR-BOD">
|
||||
<rect key="frame" x="310" y="14" width="215" height="254"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<subviews>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="eA4-la-pyn">
|
||||
<rect key="frame" x="18" y="110" width="179" height="34"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<animations/>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" id="16n-7u-pbb">
|
||||
<font key="font" metaFont="systemBold"/>
|
||||
<string key="title">Vibrant Dark
|
||||
Active</string>
|
||||
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<button verticalHuggingPriority="750" id="PbX-4k-5V8">
|
||||
<rect key="frame" x="67" y="13" width="81" height="32"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<animations/>
|
||||
<buttonCell key="cell" type="push" title="Switch" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="2is-6O-MxB">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<action selector="switch:" target="450" id="tSS-p5-usa"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<animations/>
|
||||
</visualEffectView>
|
||||
<visualEffectView appearanceType="vibrantLight" blendingMode="behindWindow" state="inactive" id="GcT-Xr-eCB">
|
||||
<rect key="frame" x="533" y="276" width="215" height="254"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<subviews>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="V0w-c6-mp4">
|
||||
<rect key="frame" x="18" y="110" width="179" height="34"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<animations/>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" id="Apx-Ho-9sT">
|
||||
<font key="font" metaFont="systemBold"/>
|
||||
<string key="title">Vibrant Light
|
||||
Inactive</string>
|
||||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<button verticalHuggingPriority="750" id="22y-1h-QPQ">
|
||||
<rect key="frame" x="67" y="13" width="81" height="32"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<animations/>
|
||||
<buttonCell key="cell" type="push" title="Switch" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="skm-xt-1Tf">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<action selector="switch:" target="450" id="h8T-E1-iI8"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<animations/>
|
||||
</visualEffectView>
|
||||
<visualEffectView appearanceType="vibrantDark" blendingMode="behindWindow" state="inactive" id="kpQ-qE-hkl">
|
||||
<rect key="frame" x="533" y="14" width="215" height="254"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<subviews>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="x9a-RT-bcS">
|
||||
<rect key="frame" x="18" y="110" width="179" height="34"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<animations/>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" id="b25-G9-HOg">
|
||||
<font key="font" metaFont="systemBold"/>
|
||||
<string key="title">Vibrant Dark
|
||||
Inactive</string>
|
||||
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<button verticalHuggingPriority="750" id="xCh-Ei-U1y">
|
||||
<rect key="frame" x="67" y="13" width="81" height="32"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<animations/>
|
||||
<buttonCell key="cell" type="push" title="Switch" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="GUB-yD-5Mr">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<action selector="switch:" target="450" id="SEg-XC-jHs"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<animations/>
|
||||
</visualEffectView>
|
||||
<visualEffectView appearanceType="vibrantDark" blendingMode="behindWindow" state="followsWindowActiveState" id="xEz-ym-SoC">
|
||||
<rect key="frame" x="87" y="14" width="215" height="254"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<subviews>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="oRu-hV-Fpl">
|
||||
<rect key="frame" x="18" y="110" width="179" height="34"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<animations/>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" id="ff0-As-8T5">
|
||||
<font key="font" metaFont="systemBold"/>
|
||||
<string key="title">Vibrant Dark
|
||||
Follows Key Window</string>
|
||||
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<button verticalHuggingPriority="750" id="lT3-jQ-tgV">
|
||||
<rect key="frame" x="67" y="13" width="81" height="32"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<animations/>
|
||||
<buttonCell key="cell" type="push" title="Switch" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="sNu-BP-dFg">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<action selector="switch:" target="450" id="nyO-Ie-Hgv"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<animations/>
|
||||
</visualEffectView>
|
||||
</subviews>
|
||||
<animations/>
|
||||
</view>
|
||||
<point key="canvasLocation" x="713" y="374.5"/>
|
||||
</window>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="background" width="245.75999450683594" height="160.32000732421875"/>
|
||||
</resources>
|
||||
</document>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 187 KiB |
@@ -0,0 +1,191 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<!--
|
||||
index-debug.html
|
||||
CPVisualEffectViewTest
|
||||
|
||||
Created by You on August 13, 2015.
|
||||
Copyright 2015, Your Company 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>CPVisualEffectViewTest</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: 0;
|
||||
}
|
||||
|
||||
#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
|
||||
CPVisualEffectViewTest
|
||||
|
||||
Created by You on August 13, 2015.
|
||||
Copyright 2015, Your Company 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>CPVisualEffectViewTest</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: 0;
|
||||
}
|
||||
|
||||
#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
|
||||
* CPVisualEffectViewTest
|
||||
*
|
||||
* Created by You on August 13, 2015.
|
||||
* Copyright 2015, Your Company All rights reserved.
|
||||
*/
|
||||
|
||||
@import <Foundation/Foundation.j>
|
||||
@import <AppKit/AppKit.j>
|
||||
|
||||
@import "AppController.j"
|
||||
|
||||
|
||||
function main(args, namedArgs)
|
||||
{
|
||||
CPApplicationMain(args, namedArgs);
|
||||
}
|
||||
@@ -52,18 +52,7 @@ task ("build", function()
|
||||
FILE.remove(installPath);
|
||||
|
||||
if (OS.system("xcodebuild " + args))
|
||||
OS.exit(1);
|
||||
|
||||
if (!executableExists("xcc"))
|
||||
{
|
||||
print("\nWould you like to install the xcc command line tool in /usr/local/bin? yes or no:");
|
||||
|
||||
if (system.stdin.readLine() == "yes\n")
|
||||
{
|
||||
sudo(["mkdir", "-p", "/usr/local/bin"]);
|
||||
sudo(["ln", "-s", "/Applications/XcodeCapp.app/Contents/MacOS/xcc", "/usr/local/bin/"]);
|
||||
}
|
||||
}
|
||||
colorPrint("Unable to build XcodeCapp. Skipping", "orange");
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -74,13 +63,13 @@ task ("build", function()
|
||||
task ("clean", function()
|
||||
{
|
||||
if (OS.system("xcodebuild clean"))
|
||||
OS.exit(1);
|
||||
colorPrint("Unable to clean XcodeCapp. Skipping", "orange");
|
||||
});
|
||||
|
||||
task ("clobber", function()
|
||||
{
|
||||
if (OS.system("xcodebuild clean"))
|
||||
OS.exit(1);
|
||||
colorPrint("Unable to clean XcodeCapp. Skipping", "orange");
|
||||
});
|
||||
|
||||
task ("default", ["build"]);
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,49 +0,0 @@
|
||||
/*
|
||||
* This file is a part of program XcodeCapp
|
||||
* Copyright (C) 2011 Antoine Mercadal (<primalmotion@archipelproject.org>)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import <CoreServices/CoreServices.h>
|
||||
#import <Quartz/Quartz.h>
|
||||
|
||||
@class XcodeCapp;
|
||||
|
||||
@interface AppController : NSObject <NSApplicationDelegate, NSMenuDelegate>
|
||||
|
||||
@property (strong) IBOutlet NSMenu *statusMenu;
|
||||
@property (unsafe_unretained) IBOutlet NSMenuItem *menuItemHistory;
|
||||
@property (unsafe_unretained) IBOutlet NSMenuItem *menuItemOpenProject;
|
||||
@property (unsafe_unretained) IBOutlet NSMenuItem *menuItemShowInFinder;
|
||||
|
||||
@property (strong) IBOutlet NSPanel *aboutWindow;
|
||||
@property (strong) IBOutlet NSWindow *preferencesWindow;
|
||||
|
||||
@property (strong) IBOutlet NSWindow *helpWindow;
|
||||
@property (unsafe_unretained) IBOutlet PDFView *helpView;
|
||||
|
||||
@property (strong) IBOutlet NSUserDefaultsController *preferencesController;
|
||||
@property (strong) IBOutlet XcodeCapp *xcc;
|
||||
|
||||
+ (AppController *)sharedAppController;
|
||||
|
||||
- (IBAction)createProject:(id)sender;
|
||||
- (IBAction)loadProject:(id)aSender;
|
||||
- (IBAction)openHelp:(id)aSender;
|
||||
- (IBAction)openAbout:(id)aSender;
|
||||
|
||||
@end
|
||||
|
||||
@@ -1,541 +0,0 @@
|
||||
/*
|
||||
* This file is a part of program XcodeCapp
|
||||
* Copyright (C) 2011 Antoine Mercadal (<primalmotion@archipelproject.org>)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program 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 General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#import <AppKit/NSApplication.h>
|
||||
|
||||
#import "AppController.h"
|
||||
#import "Notifications.h"
|
||||
#import "XcodeCapp.h"
|
||||
#import "UserDefaults.h"
|
||||
|
||||
|
||||
AppController *SharedAppControllerInstance = nil;
|
||||
|
||||
|
||||
@interface AppController ()
|
||||
|
||||
@property (nonatomic) NSImage *iconActive;
|
||||
@property (nonatomic) NSImage *iconInactive;
|
||||
@property (nonatomic) NSImage *iconWorking;
|
||||
@property (nonatomic) NSImage *iconError;
|
||||
@property (nonatomic) NSMenu *recentMenu;
|
||||
@property NSStatusItem *statusItem;
|
||||
@property NSString *finderName;
|
||||
@property BOOL appFinishedLaunching;
|
||||
@property NSString *pathToOpenAtLaunch;
|
||||
@property NSFileManager *fm;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation AppController
|
||||
|
||||
+ (AppController *)sharedAppController
|
||||
{
|
||||
return SharedAppControllerInstance;
|
||||
}
|
||||
|
||||
#pragma mark - Initialization
|
||||
|
||||
- (void)awakeFromNib
|
||||
{
|
||||
SharedAppControllerInstance = self;
|
||||
self.fm = [NSFileManager defaultManager];
|
||||
|
||||
[self registerDefaultPreferences];
|
||||
[self initLogging];
|
||||
|
||||
DDLogVerbose(@"\n******************************\n** XcodeCapp started **\n******************************\n");
|
||||
|
||||
self.aboutWindow.backgroundColor = [NSColor whiteColor];
|
||||
[self initStatusItem];
|
||||
[self initObservers];
|
||||
[self initShowInFinderItem];
|
||||
[self pruneProjectHistory];
|
||||
[self updateHistoryMenu];
|
||||
[self checkFirstLaunch];
|
||||
}
|
||||
|
||||
- (BOOL)application:(NSApplication *)sender openFile:(NSString *)filename
|
||||
{
|
||||
if (filename)
|
||||
{
|
||||
NSString *path = filename.stringByStandardizingPath;
|
||||
|
||||
if (self.appFinishedLaunching)
|
||||
return [self loadProjectAtPath:path reopening:YES];
|
||||
else
|
||||
self.pathToOpenAtLaunch = path;
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)applicationDidFinishLaunching:(NSNotification *)notification
|
||||
{
|
||||
self.appFinishedLaunching = YES;
|
||||
|
||||
if (![self.xcc executablesAreAccessible])
|
||||
{
|
||||
[[NSApplication sharedApplication] activateIgnoringOtherApps:YES];
|
||||
|
||||
NSRunAlertPanel(
|
||||
@"Executables are missing.",
|
||||
@"Please make sure that each one of these executables:\n\n"
|
||||
@"%@\n\n"
|
||||
@"(or a symlink to it) is within one these directories:\n\n"
|
||||
@"%@\n\n"
|
||||
@"They do not all have to be in the same directory.",
|
||||
@"Quit",
|
||||
nil,
|
||||
nil,
|
||||
[self.xcc.executables componentsJoinedByString:@"\n"],
|
||||
[self.xcc.environmentPaths componentsJoinedByString:@"\n"]);
|
||||
|
||||
[[NSApplication sharedApplication] terminate:self];
|
||||
return;
|
||||
}
|
||||
|
||||
// If we were opened from the command line, self.pathToOpenAtLaunch will be set.
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
if (!self.pathToOpenAtLaunch)
|
||||
{
|
||||
if (![defaults boolForKey:kDefaultXCCReopenLastProject])
|
||||
return;
|
||||
|
||||
self.pathToOpenAtLaunch = [defaults objectForKey:kDefaultLastOpenedPath];
|
||||
}
|
||||
|
||||
if (self.pathToOpenAtLaunch)
|
||||
{
|
||||
if ([[NSFileManager defaultManager] fileExistsAtPath:self.pathToOpenAtLaunch])
|
||||
[self loadProjectAtPath:self.pathToOpenAtLaunch reopening:YES];
|
||||
else
|
||||
[defaults removeObjectForKey:kDefaultLastOpenedPath];
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
Register default values for preferences
|
||||
*/
|
||||
- (void)registerDefaultPreferences
|
||||
{
|
||||
NSDictionary *appDefaults = @{
|
||||
kDefaultLastEventId: [NSNumber numberWithUnsignedLongLong:kFSEventStreamEventIdSinceNow],
|
||||
kDefaultFirstLaunch: @YES,
|
||||
kDefaultFirstLaunchVersion: @2.0,
|
||||
kDefaultXCCAPIMode: [NSNumber numberWithInt:kXCCAPIModeAuto],
|
||||
kDefaultXCCReactToInodeMod: @YES,
|
||||
kDefaultXCCReopenLastProject: @YES,
|
||||
kDefaultXCCAutoOpenErrorsPanelOnErrors: @YES,
|
||||
kDefaultXCCAutoOpenErrorsPanelOnCappLint: @YES,
|
||||
kDefaultXCCAutoShowNotificationOnErrors: @YES,
|
||||
kDefaultXCCAutoShowNotificationOnCappLint: @YES,
|
||||
kDefaultXCCProjectHistory: [NSArray new],
|
||||
kDefaultMaxRecentProjects: @20,
|
||||
kDefaultLogLevel: [NSNumber numberWithInt:LOG_LEVEL_WARN],
|
||||
kDefaultAutoOpenXcodeProject: @YES,
|
||||
kDefaultUseSymlinkWhenCreatingProject: @YES,
|
||||
kDefaultXCCUseDebugFrameworkWithObjj: @YES,
|
||||
kDefaultXCCShouldProcessObjj: @YES,
|
||||
kDefaultXCCPanelStyleUtility: @NO,
|
||||
kDefaultXCCPanelActiveAppWhenOpening: @NO
|
||||
};
|
||||
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
[defaults registerDefaults:appDefaults];
|
||||
[defaults synchronize];
|
||||
|
||||
[defaults addObserver:self
|
||||
forKeyPath:kDefaultMaxRecentProjects
|
||||
options:NSKeyValueObservingOptionNew
|
||||
context:NULL];
|
||||
}
|
||||
|
||||
- (void)initLogging
|
||||
{
|
||||
#if DEBUG
|
||||
[DDLog addLogger:[DDTTYLogger sharedInstance]];
|
||||
[[DDTTYLogger sharedInstance] setColorsEnabled:YES];
|
||||
[DDLogLevel setLogLevel:LOG_LEVEL_VERBOSE];
|
||||
#else
|
||||
[DDLog addLogger:[DDASLLogger sharedInstance]];
|
||||
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
int logLevel = (int)[defaults integerForKey:kDefaultLogLevel];
|
||||
NSUInteger modifiers = [NSEvent modifierFlags];
|
||||
|
||||
if (modifiers & NSAlternateKeyMask)
|
||||
logLevel = LOG_LEVEL_VERBOSE;
|
||||
|
||||
[DDLogLevel setLogLevel:logLevel];
|
||||
#endif
|
||||
}
|
||||
|
||||
- (void)initStatusItem
|
||||
{
|
||||
self.statusItem = [[NSStatusBar systemStatusBar] statusItemWithLength:NSVariableStatusItemLength];
|
||||
self.statusItem.menu = self.statusMenu;
|
||||
self.statusItem.image = self.iconInactive;
|
||||
self.statusItem.highlightMode = YES;
|
||||
self.statusItem.length = self.iconInactive.size.width + 12; // Add some space around the icon
|
||||
self.statusMenu.delegate = self;
|
||||
}
|
||||
|
||||
- (void)initObservers
|
||||
{
|
||||
NSNotificationCenter *defaultCenter = [NSNotificationCenter defaultCenter];
|
||||
|
||||
[defaultCenter addObserver:self selector:@selector(batchDidStart:) name:XCCBatchDidStartNotification object:nil];
|
||||
[defaultCenter addObserver:self selector:@selector(batchDidEnd:) name:XCCBatchDidEndNotification object:nil];
|
||||
[defaultCenter addObserver:self selector:@selector(projectDidFinishLoading:) name:XCCProjectDidFinishLoadingNotification object:nil];
|
||||
}
|
||||
|
||||
- (void)initShowInFinderItem
|
||||
{
|
||||
// See if PathFinder is available
|
||||
NSWorkspace *workspace = [NSWorkspace sharedWorkspace];
|
||||
NSString *path = [workspace absolutePathForAppBundleWithIdentifier:@"com.cocoatech.PathFinder"];
|
||||
|
||||
if (path)
|
||||
self.finderName = path.lastPathComponent.stringByDeletingPathExtension;
|
||||
else
|
||||
self.finderName = @"Finder";
|
||||
|
||||
self.menuItemShowInFinder.title = [NSString stringWithFormat:self.menuItemShowInFinder.title, self.finderName];
|
||||
}
|
||||
|
||||
- (void)pruneProjectHistory
|
||||
{
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
NSMutableArray *projectHistory = [[defaults arrayForKey:kDefaultXCCProjectHistory] mutableCopy];
|
||||
NSFileManager *fm = [NSFileManager new];
|
||||
|
||||
for (NSInteger i = projectHistory.count - 1; i >= 0; --i)
|
||||
{
|
||||
if (![fm fileExistsAtPath:projectHistory[i]])
|
||||
[projectHistory removeObjectAtIndex:i];
|
||||
}
|
||||
|
||||
NSInteger maxProjects = [defaults integerForKey:kDefaultMaxRecentProjects];
|
||||
|
||||
if (projectHistory.count > maxProjects)
|
||||
[projectHistory removeObjectsAtIndexes:[NSIndexSet indexSetWithIndexesInRange:NSMakeRange(maxProjects, projectHistory.count - maxProjects)]];
|
||||
|
||||
[defaults setObject:projectHistory forKey:kDefaultXCCProjectHistory];
|
||||
}
|
||||
|
||||
- (void)checkFirstLaunch
|
||||
{
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
|
||||
double firstLaunchVersion = [defaults doubleForKey:kDefaultFirstLaunchVersion];
|
||||
|
||||
// Note: the scanner will only get the major.minor version numbers, which is what we want.
|
||||
NSScanner *scanner = [NSScanner scannerWithString:[self bundleVersion]];
|
||||
double appVersion = 0.0;
|
||||
[scanner scanDouble:&appVersion];
|
||||
|
||||
if ([defaults boolForKey:kDefaultFirstLaunch] || appVersion > firstLaunchVersion)
|
||||
{
|
||||
[defaults setBool:NO forKey:kDefaultFirstLaunch];
|
||||
[defaults setDouble:appVersion forKey:kDefaultFirstLaunchVersion];
|
||||
[self openHelp:self];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Properties
|
||||
|
||||
- (NSImage *)iconActive
|
||||
{
|
||||
if (!_iconActive)
|
||||
_iconActive = [NSImage imageNamed:@"icon-active"];
|
||||
|
||||
return _iconActive;
|
||||
}
|
||||
|
||||
- (NSImage *)iconInactive
|
||||
{
|
||||
if (!_iconInactive)
|
||||
_iconInactive = [NSImage imageNamed:@"icon-inactive"];
|
||||
|
||||
return _iconInactive;
|
||||
}
|
||||
|
||||
- (NSImage *)iconWorking
|
||||
{
|
||||
if (!_iconWorking)
|
||||
_iconWorking = [NSImage imageNamed:@"icon-working"];
|
||||
|
||||
return _iconWorking;
|
||||
}
|
||||
|
||||
- (NSImage *)iconError
|
||||
{
|
||||
if (!_iconError)
|
||||
_iconError = [NSImage imageNamed:@"icon-error"];
|
||||
|
||||
return _iconError;
|
||||
}
|
||||
|
||||
- (NSMenu *)recentMenu
|
||||
{
|
||||
if (!_recentMenu)
|
||||
{
|
||||
_recentMenu = [NSMenu new];
|
||||
_recentMenu.delegate = self;
|
||||
self.menuItemHistory.submenu = _recentMenu;
|
||||
}
|
||||
|
||||
return _recentMenu;
|
||||
}
|
||||
|
||||
#pragma mark - Notification handlers
|
||||
|
||||
- (void)batchDidStart:(NSNotification *)note
|
||||
{
|
||||
DDLogVerbose(@"Batch start");
|
||||
|
||||
self.statusItem.image = self.iconWorking;
|
||||
}
|
||||
|
||||
- (void)batchDidEnd:(NSNotification *)note
|
||||
{
|
||||
DDLogVerbose(@"Batch end");
|
||||
|
||||
if (!self.xcc.isLoadingProject)
|
||||
self.statusItem.image = self.xcc.hasErrors ? self.iconError : self.iconActive;
|
||||
}
|
||||
|
||||
- (void)projectDidFinishLoading:(NSNotification *)note
|
||||
{
|
||||
self.statusItem.image = self.xcc.hasErrors ? self.iconError : self.iconActive;
|
||||
self.menuItemOpenProject.title = [NSString stringWithFormat:@"Close “%@”", self.xcc.projectPath.lastPathComponent];
|
||||
self.menuItemOpenProject.action = @selector(closeProject:);
|
||||
}
|
||||
|
||||
// Watch changes to the max recent projects preference
|
||||
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
|
||||
{
|
||||
if ([keyPath isEqualToString:kDefaultMaxRecentProjects])
|
||||
[self pruneProjectHistory];
|
||||
}
|
||||
|
||||
#pragma mark - Actions
|
||||
|
||||
- (IBAction)loadProject:(id)aSender
|
||||
{
|
||||
[[NSApplication sharedApplication] activateIgnoringOtherApps:YES];
|
||||
|
||||
NSOpenPanel *openPanel = [NSOpenPanel openPanel];
|
||||
openPanel.title = @"Choose Cappuccino Project";
|
||||
openPanel.canChooseDirectories = YES;
|
||||
openPanel.canCreateDirectories = YES;
|
||||
openPanel.canChooseFiles = NO;
|
||||
|
||||
if ([openPanel runModal] != NSFileHandlingPanelOKButton)
|
||||
return;
|
||||
|
||||
NSString *projectPath = [[openPanel.URLs[0] path] stringByStandardizingPath];
|
||||
[self loadProjectAtPath:projectPath reopening:YES];
|
||||
}
|
||||
|
||||
- (void)closeProject:(id)aSender
|
||||
{
|
||||
[self.xcc stop];
|
||||
|
||||
self.statusItem.image = self.iconInactive;
|
||||
self.menuItemOpenProject.title = @"Open Project…";
|
||||
self.menuItemOpenProject.action = @selector(loadProject:);
|
||||
|
||||
[[NSUserDefaults standardUserDefaults] removeObjectForKey:kDefaultLastOpenedPath];
|
||||
}
|
||||
|
||||
- (void)switchToProject:(NSMenuItem *)aSender
|
||||
{
|
||||
[self loadProjectAtPath:aSender.representedObject reopening:NO];
|
||||
}
|
||||
|
||||
- (void)clearProjectHistory:(id)aSender
|
||||
{
|
||||
[[NSUserDefaults standardUserDefaults] setObject:[NSArray array] forKey:kDefaultXCCProjectHistory];
|
||||
[self updateHistoryMenu];
|
||||
}
|
||||
|
||||
- (IBAction)showInFinder:(id)aSender
|
||||
{
|
||||
[[NSWorkspace sharedWorkspace] openFile:self.xcc.projectPath withApplication:self.finderName];
|
||||
}
|
||||
|
||||
- (IBAction)openHelp:(id)aSender
|
||||
{
|
||||
if (!self.helpView.document)
|
||||
{
|
||||
NSURL *helpURL = [[NSBundle mainBundle] URLForResource:@"help" withExtension:@"pdf"];
|
||||
PDFDocument *help = [[PDFDocument alloc] initWithURL:helpURL];
|
||||
self.helpView.document = help;
|
||||
}
|
||||
|
||||
[self openWindow:self.helpWindow];
|
||||
}
|
||||
|
||||
- (IBAction)openAbout:(id)aSender
|
||||
{
|
||||
[self openWindow:self.aboutWindow];
|
||||
}
|
||||
|
||||
- (IBAction)openPreferences:(id)aSender
|
||||
{
|
||||
[self openWindow:self.preferencesWindow];
|
||||
}
|
||||
|
||||
- (IBAction)createProject:(id)sender
|
||||
{
|
||||
NSSavePanel *savePanel = [NSSavePanel savePanel];
|
||||
savePanel.title = @"Create a new Cappuccino Project";
|
||||
savePanel.canCreateDirectories = YES;
|
||||
|
||||
if ([savePanel runModal] != NSFileHandlingPanelOKButton)
|
||||
return;
|
||||
|
||||
NSString *projectPath = [[savePanel.URL path] stringByStandardizingPath];
|
||||
|
||||
NSDictionary *taskResult = [self.xcc createProject:projectPath];
|
||||
|
||||
if ([taskResult[@"status"] intValue])
|
||||
return;
|
||||
|
||||
[self loadProjectAtPath:projectPath reopening:YES];
|
||||
}
|
||||
|
||||
#pragma mark - Delegates
|
||||
|
||||
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)app
|
||||
{
|
||||
[self.xcc stop];
|
||||
|
||||
return NSTerminateNow;
|
||||
}
|
||||
|
||||
- (BOOL)validateMenuItem:(NSMenuItem *)aMenuItem
|
||||
{
|
||||
NSMenu *menu = aMenuItem.menu;
|
||||
|
||||
if (menu == self.recentMenu)
|
||||
{
|
||||
// Disable recent items if they don't exist or are not directories,
|
||||
// but enable the Clear History item, which is last in the menu.
|
||||
if ([menu indexOfItem:aMenuItem] == menu.itemArray.count - 1)
|
||||
return YES;
|
||||
|
||||
BOOL isDirectory;
|
||||
BOOL exists = [self.fm fileExistsAtPath:aMenuItem.representedObject isDirectory:&isDirectory];
|
||||
|
||||
return exists && isDirectory;
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
#pragma mark - Bindings
|
||||
|
||||
- (NSString *)bundleVersion
|
||||
{
|
||||
return [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"];
|
||||
}
|
||||
|
||||
#pragma mark - Private Helpers
|
||||
|
||||
|
||||
- (BOOL)loadProjectAtPath:(NSString *)path reopening:(BOOL)reopen
|
||||
{
|
||||
if (!reopen && [self.xcc.projectPath isEqualToString:path])
|
||||
return YES;
|
||||
|
||||
[self closeProject:self];
|
||||
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
NSMutableArray *projectHistory = [[defaults arrayForKey:kDefaultXCCProjectHistory] mutableCopy];
|
||||
|
||||
if ([projectHistory containsObject:path])
|
||||
[projectHistory removeObject:path];
|
||||
|
||||
// The path may no longer be there, validate it
|
||||
NSFileManager *fm = [NSFileManager defaultManager];
|
||||
|
||||
BOOL exists, isDirectory;
|
||||
exists = [fm fileExistsAtPath:path isDirectory:&isDirectory];
|
||||
|
||||
if (exists && isDirectory)
|
||||
{
|
||||
[projectHistory insertObject:path atIndex:0];
|
||||
}
|
||||
else
|
||||
{
|
||||
[[NSApplication sharedApplication] activateIgnoringOtherApps:YES];
|
||||
NSRunAlertPanel(@"Project not found.", @"%@ %@", nil, nil, nil, path, !exists ? @"no longer exists." : @"is not a directory.");
|
||||
}
|
||||
|
||||
[defaults setObject:projectHistory forKey:kDefaultXCCProjectHistory];
|
||||
[self pruneProjectHistory];
|
||||
[self updateHistoryMenu];
|
||||
|
||||
if (exists && isDirectory)
|
||||
{
|
||||
[self.xcc loadProjectAtPath:path];
|
||||
return YES;
|
||||
}
|
||||
else
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void)openWindow:(NSWindow *)aWindow
|
||||
{
|
||||
[[NSApplication sharedApplication] activateIgnoringOtherApps:YES];
|
||||
[aWindow makeKeyAndOrderFront:nil];
|
||||
}
|
||||
|
||||
- (void)updateHistoryMenu
|
||||
{
|
||||
[self.recentMenu removeAllItems];
|
||||
NSArray *projectHistory = [[NSUserDefaults standardUserDefaults] arrayForKey:kDefaultXCCProjectHistory];
|
||||
|
||||
for (NSString *path in projectHistory)
|
||||
{
|
||||
NSMenuItem *item = [self.recentMenu addItemWithTitle:path.lastPathComponent action:@selector(switchToProject:) keyEquivalent:@""];
|
||||
[item setEnabled:YES];
|
||||
item.representedObject = path;
|
||||
}
|
||||
|
||||
[self.recentMenu addItem:[NSMenuItem separatorItem]];
|
||||
[self.recentMenu addItemWithTitle:@"Clear history" action:@selector(clearProjectHistory:) keyEquivalent:@""];
|
||||
|
||||
self.menuItemHistory.enabled = [projectHistory count] > 0;
|
||||
}
|
||||
|
||||
#pragma mark - Cappuccino methods
|
||||
|
||||
- (IBAction)updateCappuccino:(id)sender
|
||||
{
|
||||
[self.xcc performSelectorInBackground:@selector(updateCappuccino) withObject:nil];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,35 @@
|
||||
//
|
||||
// AppDelegate.h
|
||||
// XcodeCapp
|
||||
//
|
||||
// Created by Alexandre Wilhelm on 5/5/15.
|
||||
// Copyright (c) 2015 cappuccino-project. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import <CoreServices/CoreServices.h>
|
||||
|
||||
@class XCCMainController;
|
||||
|
||||
|
||||
@interface AppDelegate : NSObject <NSApplicationDelegate>
|
||||
{
|
||||
IBOutlet NSMenu *statusMenu;
|
||||
IBOutlet NSUserDefaultsController *preferencesController;
|
||||
IBOutlet NSPanel *aboutWindow;
|
||||
IBOutlet NSWindow *preferencesWindow;
|
||||
|
||||
NSImage *imageStatusInactive;
|
||||
NSImage *imageStatusProcessing;
|
||||
NSImage *imageStatusError;
|
||||
NSStatusItem *statusItem;
|
||||
}
|
||||
|
||||
@property IBOutlet XCCMainController *mainWindowController;
|
||||
@property NSOperationQueue *mainOperationQueue;
|
||||
@property NSString *version;
|
||||
|
||||
- (IBAction)openAbout:(id)aSender;
|
||||
- (IBAction)openPreferences:(id)aSender;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,170 @@
|
||||
//
|
||||
// AppDelegate.m
|
||||
// XcodeCapp
|
||||
//
|
||||
// Created by Alexandre Wilhelm on 5/5/15.
|
||||
// Copyright (c) 2015 cappuccino-project. All rights reserved.
|
||||
//
|
||||
|
||||
#import "AppDelegate.h"
|
||||
#import "XCCMainController.h"
|
||||
#import "XCCUserDefaults.h"
|
||||
|
||||
@implementation AppDelegate
|
||||
|
||||
|
||||
#pragma mark - Utilities
|
||||
|
||||
- (void)_initUserDefaults
|
||||
{
|
||||
NSDictionary *appDefaults = @{
|
||||
XCCUserDefaultsAutoOpenXcodeProject: @YES,
|
||||
XCCUserDefaultsLogLevel: @LOG_LEVEL_WARN,
|
||||
XCCUserDefaultsMaxNumberOfConcurrentOperations: @20
|
||||
};
|
||||
|
||||
[[NSUserDefaults standardUserDefaults] registerDefaults:appDefaults];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
}
|
||||
|
||||
- (void)_initStatusItem
|
||||
{
|
||||
self->imageStatusInactive = [NSImage imageNamed:@"status-icon-inactive"];
|
||||
self->imageStatusProcessing = [NSImage imageNamed:@"status-icon-working"];
|
||||
self->imageStatusError = [NSImage imageNamed:@"status-icon-error"];
|
||||
|
||||
self->statusItem = [[NSStatusBar systemStatusBar] statusItemWithLength:NSVariableStatusItemLength];
|
||||
self->statusItem.menu = self->statusMenu;
|
||||
self->statusItem.image = self->imageStatusInactive;
|
||||
self->statusItem.highlightMode = YES;
|
||||
self->statusItem.length = self->imageStatusInactive.size.width + 12;
|
||||
}
|
||||
|
||||
- (void)_initLogging
|
||||
{
|
||||
#if DEBUG
|
||||
[DDLog addLogger:[DDTTYLogger sharedInstance]];
|
||||
[[DDTTYLogger sharedInstance] setColorsEnabled:YES];
|
||||
[DDLogLevel setLogLevel:LOG_LEVEL_VERBOSE];
|
||||
#else
|
||||
[DDLog addLogger:[DDASLLogger sharedInstance]];
|
||||
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
int logLevel = (int)[defaults integerForKey:XCCUserDefaultsLogLevel];
|
||||
NSUInteger modifiers = [NSEvent modifierFlags];
|
||||
|
||||
if (modifiers & NSAlternateKeyMask)
|
||||
logLevel = LOG_LEVEL_VERBOSE;
|
||||
|
||||
[DDLogLevel setLogLevel:logLevel];
|
||||
#endif
|
||||
}
|
||||
|
||||
- (void)_initOperationQueue
|
||||
{
|
||||
self.mainOperationQueue = [NSOperationQueue new];
|
||||
|
||||
[self.mainOperationQueue setMaxConcurrentOperationCount:[[[NSUserDefaults standardUserDefaults] objectForKey:XCCUserDefaultsMaxNumberOfConcurrentOperations] intValue]];
|
||||
}
|
||||
|
||||
#pragma mark - Actions
|
||||
|
||||
- (IBAction)openPreferences:(id)aSender
|
||||
{
|
||||
[self->preferencesWindow makeKeyAndOrderFront:nil];
|
||||
}
|
||||
|
||||
- (IBAction)openAbout:(id)aSender
|
||||
{
|
||||
[self->aboutWindow makeKeyAndOrderFront:nil];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Observers
|
||||
|
||||
- (void)_startObservers
|
||||
{
|
||||
[[NSUserDefaults standardUserDefaults] addObserver:self forKeyPath:XCCUserDefaultsMaxNumberOfConcurrentOperations options:NSKeyValueObservingOptionNew context:nil];
|
||||
|
||||
[self.mainOperationQueue addObserver:self forKeyPath:@"operationCount" options:NSKeyValueObservingOptionNew context:nil];
|
||||
[self.mainWindowController addObserver:self forKeyPath:@"totalNumberOfErrors" options:NSKeyValueObservingOptionNew context:nil];
|
||||
}
|
||||
|
||||
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
|
||||
{
|
||||
if (object == [NSUserDefaults standardUserDefaults] && [keyPath isEqualToString:XCCUserDefaultsMaxNumberOfConcurrentOperations])
|
||||
{
|
||||
[self.mainOperationQueue setMaxConcurrentOperationCount:[change[NSKeyValueChangeNewKey] intValue]];
|
||||
}
|
||||
else
|
||||
{
|
||||
NSImage *image;
|
||||
|
||||
if (self.mainOperationQueue.operationCount)
|
||||
image = self->imageStatusProcessing;
|
||||
else if ([self.mainWindowController totalNumberOfErrors])
|
||||
image = self->imageStatusError;
|
||||
else
|
||||
image = self->imageStatusInactive;
|
||||
|
||||
[self->statusItem performSelectorOnMainThread:@selector(setImage:) withObject:image waitUntilDone:NO];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Delegates
|
||||
|
||||
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
|
||||
{
|
||||
DDLogVerbose(@"\n******************************\n** XcodeCapp started **\n******************************\n");
|
||||
|
||||
self.version = [NSBundle mainBundle].infoDictionary[@"CFBundleShortVersionString"];
|
||||
|
||||
[self _initUserDefaults];
|
||||
[self _initLogging];
|
||||
[self _initOperationQueue];
|
||||
[self _initStatusItem];
|
||||
|
||||
[self _startObservers];
|
||||
|
||||
[self->_mainWindowController windowDidLoad];
|
||||
}
|
||||
|
||||
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)app
|
||||
{
|
||||
DDLogVerbose(@"Stop listening to all projects");
|
||||
[self.mainWindowController notifyCappuccinoControllersApplicationIsClosing];
|
||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||
|
||||
return NSTerminateNow;
|
||||
}
|
||||
|
||||
- (void)applicationWillTerminate:(NSNotification *)aNotification
|
||||
{
|
||||
DDLogVerbose(@"\n******************************\n** XcodeCapp stopped **\n******************************\n");
|
||||
}
|
||||
|
||||
- (BOOL)applicationShouldHandleReopen:(NSApplication *)theApplication hasVisibleWindows:(BOOL)flag
|
||||
{
|
||||
[self.mainWindowController showWindow:self];
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL)application:(NSApplication *)application openFile:(NSString *)filename
|
||||
{
|
||||
BOOL isDir;
|
||||
|
||||
[[NSFileManager defaultManager] fileExistsAtPath:filename isDirectory:&isDir];
|
||||
|
||||
if (isDir)
|
||||
{
|
||||
[self.mainWindowController manageCappuccinoProjectControllerForPath:filename];
|
||||
return YES;
|
||||
}
|
||||
else
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
File diff suppressed because it is too large.
Load diff
@@ -13,7 +13,7 @@ ONLY_ACTIVE_ARCH = YES
|
||||
DEBUG_INFORMATION_FORMAT = dwarf-with-dsym
|
||||
COMBINE_HIDPI_IMAGES = YES
|
||||
INSTALL_PATH = $(LOCAL_APPS_DIR)
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.6.8
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.10
|
||||
COPY_PHASE_STRIP = NO
|
||||
INFOPLIST_FILE = XcodeCapp/Info.plist
|
||||
PRODUCT_NAME = XcodeCapp
|
||||
|
||||
@@ -0,0 +1,249 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="8121.20" systemVersion="15A204h" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
|
||||
<dependencies>
|
||||
<deployment identifier="macosx"/>
|
||||
<development version="6300" identifier="xcode"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="8121.20"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<customObject id="-2" userLabel="File's Owner" customClass="XCCErrorsViewController">
|
||||
<connections>
|
||||
<outlet property="errorOutlineView" destination="Wcz-on-5sJ" id="5Tx-At-ehM"/>
|
||||
<outlet property="maskingView" destination="zzu-5V-jxy" id="o44-z3-rGK"/>
|
||||
<outlet property="view" destination="bBp-Me-gFz" id="TMO-Xg-NHa"/>
|
||||
</connections>
|
||||
</customObject>
|
||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
||||
<customView id="bBp-Me-gFz" userLabel="Main View">
|
||||
<rect key="frame" x="0.0" y="0.0" width="400" height="400"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<scrollView borderType="none" autohidesScrollers="YES" horizontalLineScroll="111" horizontalPageScroll="10" verticalLineScroll="111" verticalPageScroll="10" usesPredominantAxisScrolling="NO" id="qFG-4o-jZU">
|
||||
<rect key="frame" x="0.0" y="25" width="400" height="375"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<clipView key="contentView" id="ihl-1p-zkN">
|
||||
<rect key="frame" x="0.0" y="0.0" width="400" height="375"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<outlineView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" selectionHighlightStyle="none" multipleSelection="NO" autosaveColumns="NO" rowHeight="101" rowSizeStyle="automatic" viewBased="YES" indentationPerLevel="16" outlineTableColumn="YdX-BQ-xQG" id="Wcz-on-5sJ">
|
||||
<rect key="frame" x="0.0" y="0.0" width="400" height="0.0"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<animations/>
|
||||
<size key="intercellSpacing" width="5" height="10"/>
|
||||
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
|
||||
<tableColumns>
|
||||
<tableColumn width="395" minWidth="40" maxWidth="9999999" id="YdX-BQ-xQG">
|
||||
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left">
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
|
||||
</tableHeaderCell>
|
||||
<textFieldCell key="dataCell" lineBreakMode="truncatingTail" selectable="YES" editable="YES" alignment="left" title="Text Cell" id="sN2-YK-a89">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
|
||||
<prototypeCellViews>
|
||||
<tableCellView identifier="OperationErrorHeaderCell" id="ukB-9q-eZa" customClass="XCCOperationErrorHeaderDataView">
|
||||
<rect key="frame" x="2" y="5" width="395" height="20"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" id="tYH-Hh-IAc">
|
||||
<rect key="frame" x="6" y="3" width="394" height="18"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
|
||||
<animations/>
|
||||
<textFieldCell key="cell" lineBreakMode="truncatingMiddle" sendsActionOnEndEditing="YES" title="Table View Cell" id="T9K-ex-2Wj">
|
||||
<font key="font" size="12" name="Menlo-Regular"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
</subviews>
|
||||
<animations/>
|
||||
<connections>
|
||||
<outlet property="fieldName" destination="tYH-Hh-IAc" id="Jd4-Ex-sgr"/>
|
||||
</connections>
|
||||
</tableCellView>
|
||||
<tableCellView identifier="OperationErrorCell" id="OMn-8Z-L2f" customClass="XCCOperationErrorDataView">
|
||||
<rect key="frame" x="2" y="35" width="395" height="101"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<box autoresizesSubviews="NO" cornerRadius="3" title="Box" boxType="custom" borderType="line" titlePosition="noTitle" id="MWc-o4-8Q2">
|
||||
<rect key="frame" x="3" y="3" width="355" height="80"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<view key="contentView">
|
||||
<rect key="frame" x="1" y="1" width="353" height="78"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" id="fAM-P0-o5o">
|
||||
<rect key="frame" x="13" y="6" width="327" height="66"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<animations/>
|
||||
<textFieldCell key="cell" controlSize="small" selectable="YES" sendsActionOnEndEditing="YES" title="Table View Cell" id="vy1-tz-zDb">
|
||||
<font key="font" size="11" name="Menlo-Regular"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
</subviews>
|
||||
<animations/>
|
||||
</view>
|
||||
<animations/>
|
||||
<color key="borderColor" red="0.90699486819999997" green="0.90699486819999997" blue="0.90699486819999997" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<color key="fillColor" red="0.97414338089999997" green="0.97084119989999995" blue="0.97744556179999997" alpha="1" colorSpace="calibratedRGB"/>
|
||||
</box>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="ng2-IC-e85">
|
||||
<rect key="frame" x="16" y="87" width="74" height="14"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<animations/>
|
||||
<textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Line number" id="jKW-4V-hZZ">
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
<color key="textColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="my2-jo-uaH">
|
||||
<rect key="frame" x="93" y="87" width="233" height="14"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
|
||||
<animations/>
|
||||
<textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="200" id="uhp-6F-EA1">
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
<color key="textColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" id="7DM-NL-nZw">
|
||||
<rect key="frame" x="3" y="88" width="12" height="12"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<animations/>
|
||||
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="NSRemoveTemplate" id="jaI-iA-MGK"/>
|
||||
</imageView>
|
||||
<button toolTip="Edit in Code Editor" verticalHuggingPriority="750" id="mMx-zB-OZi">
|
||||
<rect key="frame" x="325" y="86" width="33" height="16"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
|
||||
<animations/>
|
||||
<buttonCell key="cell" type="bevel" bezelStyle="rounded" image="open-in-editor" imagePosition="overlaps" alignment="center" controlSize="small" imageScaling="proportionallyUpOrDown" inset="2" id="eLG-E9-mZh">
|
||||
<behavior key="behavior" lightByContents="YES"/>
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
</buttonCell>
|
||||
</button>
|
||||
</subviews>
|
||||
<animations/>
|
||||
<connections>
|
||||
<outlet property="buttonOpenInEditor" destination="mMx-zB-OZi" id="PSh-eP-PHa"/>
|
||||
<outlet property="fieldLineNumber" destination="my2-jo-uaH" id="SJQ-Rt-O7D"/>
|
||||
<outlet property="fieldMessage" destination="fAM-P0-o5o" id="2xz-hF-bfY"/>
|
||||
<outlet property="imageViewType" destination="7DM-NL-nZw" id="ebl-MA-9pc"/>
|
||||
<outlet property="labelLineNumber" destination="ng2-IC-e85" id="vP6-Zu-paX"/>
|
||||
</connections>
|
||||
</tableCellView>
|
||||
</prototypeCellViews>
|
||||
</tableColumn>
|
||||
</tableColumns>
|
||||
<connections>
|
||||
<outlet property="dataSource" destination="-2" id="lUL-h0-wdE"/>
|
||||
<outlet property="delegate" destination="-2" id="OWL-DQ-7Bp"/>
|
||||
</connections>
|
||||
</outlineView>
|
||||
</subviews>
|
||||
<animations/>
|
||||
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</clipView>
|
||||
<animations/>
|
||||
<scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="cAr-D4-7cX">
|
||||
<rect key="frame" x="1" y="119" width="223" height="15"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<animations/>
|
||||
</scroller>
|
||||
<scroller key="verticalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="NO" id="FyL-86-3OF">
|
||||
<rect key="frame" x="224" y="17" width="15" height="102"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<animations/>
|
||||
</scroller>
|
||||
</scrollView>
|
||||
<box autoresizesSubviews="NO" borderWidth="0.0" title="Box" boxType="custom" borderType="line" titlePosition="noTitle" id="MD4-zD-QZt">
|
||||
<rect key="frame" x="0.0" y="0.0" width="400" height="25"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
|
||||
<view key="contentView">
|
||||
<rect key="frame" x="0.0" y="0.0" width="400" height="25"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<box verticalHuggingPriority="750" title="Box" boxType="separator" titlePosition="noTitle" id="wTS-n2-UQU">
|
||||
<rect key="frame" x="-1" y="22" width="402" height="5"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
|
||||
<animations/>
|
||||
<color key="borderColor" white="0.0" alpha="0.41999999999999998" colorSpace="calibratedWhite"/>
|
||||
<color key="fillColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
||||
<font key="titleFont" metaFont="system"/>
|
||||
</box>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="ago-XC-fwf">
|
||||
<rect key="frame" x="14" y="7" width="343" height="11"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
|
||||
<animations/>
|
||||
<textFieldCell key="cell" controlSize="mini" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="99999" id="kDG-TG-5o8">
|
||||
<font key="font" metaFont="miniSystem"/>
|
||||
<color key="textColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
<connections>
|
||||
<binding destination="-2" name="value" keyPath="self.cappuccinoProjectController.errorsCountString" id="7je-jq-8G7"/>
|
||||
</connections>
|
||||
</textField>
|
||||
<button toolTip="Clean errors" id="Tdm-5T-jGO">
|
||||
<rect key="frame" x="377" y="3" width="18" height="18"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
|
||||
<animations/>
|
||||
<buttonCell key="cell" type="bevel" bezelStyle="rounded" image="NSMenuOnStateTemplate" imagePosition="only" alignment="center" imageScaling="proportionallyDown" inset="2" id="iCa-fe-gSf">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<action selector="cleanProjectErrors:" target="-2" id="nQ4-Jp-huO"/>
|
||||
</connections>
|
||||
</button>
|
||||
</subviews>
|
||||
<animations/>
|
||||
</view>
|
||||
<animations/>
|
||||
<color key="borderColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<color key="fillColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
|
||||
</box>
|
||||
</subviews>
|
||||
<animations/>
|
||||
<point key="canvasLocation" x="319" y="-459"/>
|
||||
</customView>
|
||||
<box title="Box" boxType="custom" borderType="line" titlePosition="noTitle" id="zzu-5V-jxy">
|
||||
<rect key="frame" x="0.0" y="0.0" width="400" height="400"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<view key="contentView">
|
||||
<rect key="frame" x="1" y="1" width="398" height="398"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="g7p-NU-xFT">
|
||||
<rect key="frame" x="101" y="188" width="196" height="22"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
|
||||
<animations/>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="No Issues" id="cSp-kD-F9V">
|
||||
<font key="font" metaFont="system" size="18"/>
|
||||
<color key="textColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
</subviews>
|
||||
<animations/>
|
||||
</view>
|
||||
<animations/>
|
||||
<color key="borderColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<color key="fillColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<point key="canvasLocation" x="780" y="-454"/>
|
||||
</box>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="NSMenuOnStateTemplate" width="12" height="12"/>
|
||||
<image name="NSRemoveTemplate" width="11" height="11"/>
|
||||
<image name="open-in-editor" width="16" height="16"/>
|
||||
</resources>
|
||||
</document>
|
||||
@@ -1,21 +0,0 @@
|
||||
//
|
||||
// FindSourceFilesOperation.h
|
||||
// XcodeCapp
|
||||
//
|
||||
// Created by Aparajita on 4/27/13.
|
||||
// Copyright (c) 2013 Cappuccino Project. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class XcodeCapp;
|
||||
|
||||
|
||||
extern NSString * const XCCNeedSourceToProjectPathMappingNotification;
|
||||
|
||||
|
||||
@interface FindSourceFilesOperation : NSOperation
|
||||
|
||||
- (id)initWithXCC:(XcodeCapp *)xcc projectId:(NSNumber *)projectId path:(NSString *)path;
|
||||
|
||||
@end
|
||||
@@ -1,172 +0,0 @@
|
||||
//
|
||||
// FindSourceFilesOperation.m
|
||||
// XcodeCapp
|
||||
//
|
||||
// Created by Aparajita on 4/27/13.
|
||||
// Copyright (c) 2013 Cappuccino Project. All rights reserved.
|
||||
//
|
||||
|
||||
#import "FindSourceFilesOperation.h"
|
||||
#import "ProcessSourceOperation.h"
|
||||
#import "XcodeCapp.h"
|
||||
|
||||
NSString * const XCCNeedSourceToProjectPathMappingNotification = @"XCCNeedSourceToProjectPathMappingNotification";
|
||||
|
||||
|
||||
@interface FindSourceFilesOperation ()
|
||||
|
||||
@property XcodeCapp *xcc;
|
||||
@property NSNumber *projectId;
|
||||
@property NSString *projectPathToSearch;
|
||||
@property NSString *projectPath;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation FindSourceFilesOperation
|
||||
|
||||
- (id)initWithXCC:(XcodeCapp *)xcc projectId:(NSNumber *)projectId path:(NSString *)path
|
||||
{
|
||||
self = [super init];
|
||||
|
||||
if (self)
|
||||
{
|
||||
self.xcc = xcc;
|
||||
self.projectId = projectId;
|
||||
self.projectPathToSearch = path;
|
||||
self.projectPath = xcc.projectPath;
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)main
|
||||
{
|
||||
[self findSourceFilesAtProjectPath:self.projectPathToSearch];
|
||||
}
|
||||
|
||||
- (void)findSourceFilesAtProjectPath:(NSString *)aProjectPath
|
||||
{
|
||||
if (self.isCancelled)
|
||||
return;
|
||||
|
||||
DDLogVerbose(@"-->findSourceFiles: %@", aProjectPath);
|
||||
|
||||
NSError *error = NULL;
|
||||
NSString *projectPath = [self.projectPath stringByAppendingPathComponent:aProjectPath];
|
||||
NSFileManager *fm = [NSFileManager defaultManager];
|
||||
|
||||
NSArray *urls = [fm contentsOfDirectoryAtURL:[NSURL fileURLWithPath:projectPath.stringByResolvingSymlinksInPath]
|
||||
includingPropertiesForKeys:@[NSURLIsDirectoryKey, NSURLIsSymbolicLinkKey]
|
||||
options:NSDirectoryEnumerationSkipsHiddenFiles | NSDirectoryEnumerationSkipsPackageDescendants | NSDirectoryEnumerationSkipsSubdirectoryDescendants
|
||||
error:&error];
|
||||
|
||||
if (!urls)
|
||||
return;
|
||||
|
||||
NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
|
||||
|
||||
for (NSURL *url in urls)
|
||||
{
|
||||
if (self.isCancelled)
|
||||
return;
|
||||
|
||||
NSString *filename = url.lastPathComponent;
|
||||
|
||||
NSString *projectRelativePath = [aProjectPath stringByAppendingPathComponent:filename];
|
||||
NSString *realPath = url.path;
|
||||
NSURL *resolvedURL = url;
|
||||
|
||||
NSNumber *isDirectory, *isSymlink;
|
||||
[url getResourceValue:&isSymlink forKey:NSURLIsSymbolicLinkKey error:nil];
|
||||
|
||||
if (isSymlink.boolValue == YES)
|
||||
{
|
||||
resolvedURL = [url URLByResolvingSymlinksInPath];
|
||||
|
||||
if ([resolvedURL checkResourceIsReachableAndReturnError:nil])
|
||||
{
|
||||
filename = resolvedURL.lastPathComponent;
|
||||
realPath = resolvedURL.path;
|
||||
}
|
||||
else
|
||||
continue;
|
||||
}
|
||||
|
||||
[resolvedURL getResourceValue:&isDirectory forKey:NSURLIsDirectoryKey error:nil];
|
||||
|
||||
if (isDirectory.boolValue == YES)
|
||||
{
|
||||
if ([self.xcc shouldIgnoreDirectoryNamed:filename])
|
||||
{
|
||||
DDLogVerbose(@"ignored symlinked directory: %@", projectRelativePath);
|
||||
continue;
|
||||
}
|
||||
|
||||
// If the resolved path is not within the project directory and is not ignored, add a mapping to it
|
||||
// so we can map the resolved path back to the project directory later.
|
||||
if (isSymlink.boolValue == YES)
|
||||
{
|
||||
NSString *fullProjectPath = [self.projectPath stringByAppendingPathComponent:projectRelativePath];
|
||||
|
||||
if (![realPath hasPrefix:fullProjectPath] && ![self.xcc pathMatchesIgnoredPaths:fullProjectPath])
|
||||
{
|
||||
DDLogVerbose(@"symlinked directory: %@ -> %@", projectRelativePath, realPath);
|
||||
|
||||
NSDictionary *info =
|
||||
@{
|
||||
@"projectId":self.projectId,
|
||||
@"sourcePath":realPath,
|
||||
@"projectPath":fullProjectPath
|
||||
};
|
||||
|
||||
if (self.isCancelled)
|
||||
return;
|
||||
|
||||
[center postNotificationName:XCCNeedSourceToProjectPathMappingNotification object:self userInfo:info];
|
||||
}
|
||||
else
|
||||
DDLogVerbose(@"ignored symlinked directory: %@", projectRelativePath);
|
||||
}
|
||||
|
||||
[self findSourceFilesAtProjectPath:projectRelativePath];
|
||||
continue;
|
||||
}
|
||||
|
||||
if (self.isCancelled)
|
||||
return;
|
||||
|
||||
if ([self.xcc pathMatchesIgnoredPaths:realPath])
|
||||
continue;
|
||||
|
||||
NSString *projectSourcePath = [self.projectPath stringByAppendingPathComponent:projectRelativePath];
|
||||
|
||||
if ([self.xcc isObjjFile:filename] || [self.xcc isXibFile:filename])
|
||||
{
|
||||
NSString *processedPath;
|
||||
|
||||
if ([self.xcc isObjjFile:filename])
|
||||
processedPath = [[self.xcc shadowBasePathForProjectSourcePath:projectSourcePath] stringByAppendingPathExtension:@"h"];
|
||||
else
|
||||
processedPath = [projectSourcePath.stringByDeletingPathExtension stringByAppendingPathExtension:@"cib"];
|
||||
|
||||
if (![fm fileExistsAtPath:processedPath])
|
||||
[self createProcessingOperationForProjectSourcePath:projectSourcePath];
|
||||
}
|
||||
}
|
||||
|
||||
DDLogVerbose(@"<--findSourceFiles: %@", aProjectPath);
|
||||
}
|
||||
|
||||
- (void)createProcessingOperationForProjectSourcePath:(NSString *)projectSourcePath
|
||||
{
|
||||
if (self.isCancelled)
|
||||
return;
|
||||
|
||||
ProcessSourceOperation *op = [[ProcessSourceOperation alloc] initWithXCC:self.xcc
|
||||
projectId:self.projectId
|
||||
sourcePath:projectSourcePath];
|
||||
[[NSOperationQueue currentQueue] addOperation:op];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,12 +0,0 @@
|
||||
<?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>TicketVersion</key>
|
||||
<integer>1</integer>
|
||||
<key>AllNotifications</key>
|
||||
<array>
|
||||
<string>DefaultNotifications</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -1 +0,0 @@
|
||||
Versions/Current/Growl
|
||||
@@ -1 +0,0 @@
|
||||
Versions/Current/Headers
|
||||
@@ -1 +0,0 @@
|
||||
Versions/Current/Resources
|
||||
Binary file not shown.
@@ -1,5 +0,0 @@
|
||||
#include <Growl/GrowlDefines.h>
|
||||
|
||||
#ifdef __OBJC__
|
||||
# include <Growl/GrowlApplicationBridge.h>
|
||||
#endif
|
||||
-567
@@ -1,567 +0,0 @@
|
||||
//
|
||||
// GrowlApplicationBridge.h
|
||||
// Growl
|
||||
//
|
||||
// Created by Evan Schoenberg on Wed Jun 16 2004.
|
||||
// Copyright 2004-2006 The Growl Project. All rights reserved.
|
||||
//
|
||||
|
||||
/*!
|
||||
* @header GrowlApplicationBridge.h
|
||||
* @abstract Defines the GrowlApplicationBridge class.
|
||||
* @discussion This header defines the GrowlApplicationBridge class as well as
|
||||
* the GROWL_PREFPANE_BUNDLE_IDENTIFIER constant.
|
||||
*/
|
||||
|
||||
#ifndef __GrowlApplicationBridge_h__
|
||||
#define __GrowlApplicationBridge_h__
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <AppKit/AppKit.h>
|
||||
#import <Growl/GrowlDefines.h>
|
||||
|
||||
//Forward declarations
|
||||
@protocol GrowlApplicationBridgeDelegate;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
#pragma mark -
|
||||
|
||||
/*!
|
||||
* @class GrowlApplicationBridge
|
||||
* @abstract A class used to interface with Growl.
|
||||
* @discussion This class provides a means to interface with Growl.
|
||||
*
|
||||
* Currently it provides a way to detect if Growl is installed and launch the
|
||||
* GrowlHelperApp if it's not already running.
|
||||
*/
|
||||
@interface GrowlApplicationBridge : NSObject {
|
||||
|
||||
}
|
||||
|
||||
/*!
|
||||
* @method isGrowlInstalled
|
||||
* @abstract Detects whether Growl is installed.
|
||||
* @discussion Determines if the Growl prefpane and its helper app are installed.
|
||||
* @result this method will forever return YES.
|
||||
*/
|
||||
+ (BOOL) isGrowlInstalled __attribute__((deprecated));
|
||||
|
||||
/*!
|
||||
* @method isGrowlRunning
|
||||
* @abstract Detects whether GrowlHelperApp is currently running.
|
||||
* @discussion Cycles through the process list to find whether GrowlHelperApp is running and returns its findings.
|
||||
* @result Returns YES if GrowlHelperApp is running, NO otherwise.
|
||||
*/
|
||||
+ (BOOL) isGrowlRunning;
|
||||
|
||||
|
||||
/*!
|
||||
* @method isMistEnabled
|
||||
* @abstract Gives the caller a fairly good indication of whether or not built-in notifications(Mist) will be used.
|
||||
* @discussion since this call makes use of isGrowlRunning it is entirely possible for this value to change between call and
|
||||
* executing a notification dispatch
|
||||
* @result Returns YES if Growl isn't reachable and the developer has not opted-out of
|
||||
* Mist and the user hasn't set the global mist enable key to false.
|
||||
*/
|
||||
+ (BOOL)isMistEnabled;
|
||||
|
||||
/*!
|
||||
* @method setShouldUseBuiltInNotifications
|
||||
* @abstract opt-out mechanism for the mist notification style in the event growl can't be reached.
|
||||
* @discussion if growl is unavailable due to not being installed or as a result of being turned off then
|
||||
* this option can enable/disable a built-in fire and forget display style
|
||||
* @param should Specifies whether or not the developer wants to opt-in (default) or opt out
|
||||
* of the built-in Mist style in the event Growl is unreachable.
|
||||
*/
|
||||
+ (void)setShouldUseBuiltInNotifications:(BOOL)should;
|
||||
|
||||
/*!
|
||||
* @method shouldUseBuiltInNotifications
|
||||
* @abstract returns the current opt-in state of the framework's use of the Mist display style.
|
||||
* @result Returns NO if the developer opt-ed out of Mist, the default value is YES.
|
||||
*/
|
||||
+ (BOOL)shouldUseBuiltInNotifications;
|
||||
|
||||
#pragma mark -
|
||||
|
||||
/*!
|
||||
* @method setGrowlDelegate:
|
||||
* @abstract Set the object which will be responsible for providing and receiving Growl information.
|
||||
* @discussion This must be called before using GrowlApplicationBridge.
|
||||
*
|
||||
* The methods in the GrowlApplicationBridgeDelegate protocol are required
|
||||
* and return the basic information needed to register with Growl.
|
||||
*
|
||||
* The methods in the GrowlApplicationBridgeDelegate_InformalProtocol
|
||||
* informal protocol are individually optional. They provide a greater
|
||||
* degree of interaction between the application and growl such as informing
|
||||
* the application when one of its Growl notifications is clicked by the user.
|
||||
*
|
||||
* The methods in the GrowlApplicationBridgeDelegate_Installation_InformalProtocol
|
||||
* informal protocol are individually optional and are only applicable when
|
||||
* using the Growl-WithInstaller.framework which allows for automated Growl
|
||||
* installation.
|
||||
*
|
||||
* When this method is called, data will be collected from inDelegate, Growl
|
||||
* will be launched if it is not already running, and the application will be
|
||||
* registered with Growl.
|
||||
*
|
||||
* If using the Growl-WithInstaller framework, if Growl is already installed
|
||||
* but this copy of the framework has an updated version of Growl, the user
|
||||
* will be prompted to update automatically.
|
||||
*
|
||||
* @param inDelegate The delegate for the GrowlApplicationBridge. It must conform to the GrowlApplicationBridgeDelegate protocol.
|
||||
*/
|
||||
+ (void) setGrowlDelegate:(id<GrowlApplicationBridgeDelegate>)inDelegate;
|
||||
|
||||
/*!
|
||||
* @method growlDelegate
|
||||
* @abstract Return the object responsible for providing and receiving Growl information.
|
||||
* @discussion See setGrowlDelegate: for details.
|
||||
* @result The Growl delegate.
|
||||
*/
|
||||
+ (id<GrowlApplicationBridgeDelegate>) growlDelegate;
|
||||
|
||||
#pragma mark -
|
||||
|
||||
/*!
|
||||
* @method notifyWithTitle:description:notificationName:iconData:priority:isSticky:clickContext:
|
||||
* @abstract Send a Growl notification.
|
||||
* @discussion This is the preferred means for sending a Growl notification.
|
||||
* The notification name and at least one of the title and description are
|
||||
* required (all three are preferred). All other parameters may be
|
||||
* <code>nil</code> (or 0 or NO as appropriate) to accept default values.
|
||||
*
|
||||
* If using the Growl-WithInstaller framework, if Growl is not installed the
|
||||
* user will be prompted to install Growl. If the user cancels, this method
|
||||
* will have no effect until the next application session, at which time when
|
||||
* it is called the user will be prompted again. The user is also given the
|
||||
* option to not be prompted again. If the user does choose to install Growl,
|
||||
* the requested notification will be displayed once Growl is installed and
|
||||
* running.
|
||||
*
|
||||
* @param title The title of the notification displayed to the user.
|
||||
* @param description The full description of the notification displayed to the user.
|
||||
* @param notifName The internal name of the notification. Should be human-readable, as it will be displayed in the Growl preference pane.
|
||||
* @param iconData <code>NSData</code> object to show with the notification as its icon. If <code>nil</code>, the application's icon will be used instead.
|
||||
* @param priority The priority of the notification. The default value is 0; positive values are higher priority and negative values are lower priority. Not all Growl displays support priority.
|
||||
* @param isSticky If YES, the notification will remain on screen until clicked. Not all Growl displays support sticky notifications.
|
||||
* @param clickContext A context passed back to the Growl delegate if it implements -(void)growlNotificationWasClicked: and the notification is clicked. Not all display plugins support clicking. The clickContext must be plist-encodable (completely of <code>NSString</code>, <code>NSArray</code>, <code>NSNumber</code>, <code>NSDictionary</code>, and <code>NSData</code> types).
|
||||
*/
|
||||
+ (void) notifyWithTitle:(NSString *)title
|
||||
description:(NSString *)description
|
||||
notificationName:(NSString *)notifName
|
||||
iconData:(NSData *)iconData
|
||||
priority:(signed int)priority
|
||||
isSticky:(BOOL)isSticky
|
||||
clickContext:(id)clickContext;
|
||||
|
||||
/*!
|
||||
* @method notifyWithTitle:description:notificationName:iconData:priority:isSticky:clickContext:identifier:
|
||||
* @abstract Send a Growl notification.
|
||||
* @discussion This is the preferred means for sending a Growl notification.
|
||||
* The notification name and at least one of the title and description are
|
||||
* required (all three are preferred). All other parameters may be
|
||||
* <code>nil</code> (or 0 or NO as appropriate) to accept default values.
|
||||
*
|
||||
* If using the Growl-WithInstaller framework, if Growl is not installed the
|
||||
* user will be prompted to install Growl. If the user cancels, this method
|
||||
* will have no effect until the next application session, at which time when
|
||||
* it is called the user will be prompted again. The user is also given the
|
||||
* option to not be prompted again. If the user does choose to install Growl,
|
||||
* the requested notification will be displayed once Growl is installed and
|
||||
* running.
|
||||
*
|
||||
* @param title The title of the notification displayed to the user.
|
||||
* @param description The full description of the notification displayed to the user.
|
||||
* @param notifName The internal name of the notification. Should be human-readable, as it will be displayed in the Growl preference pane.
|
||||
* @param iconData <code>NSData</code> object to show with the notification as its icon. If <code>nil</code>, the application's icon will be used instead.
|
||||
* @param priority The priority of the notification. The default value is 0; positive values are higher priority and negative values are lower priority. Not all Growl displays support priority.
|
||||
* @param isSticky If YES, the notification will remain on screen until clicked. Not all Growl displays support sticky notifications.
|
||||
* @param clickContext A context passed back to the Growl delegate if it implements -(void)growlNotificationWasClicked: and the notification is clicked. Not all display plugins support clicking. The clickContext must be plist-encodable (completely of <code>NSString</code>, <code>NSArray</code>, <code>NSNumber</code>, <code>NSDictionary</code>, and <code>NSData</code> types).
|
||||
* @param identifier An identifier for this notification. Notifications with equal identifiers are coalesced.
|
||||
*/
|
||||
+ (void) notifyWithTitle:(NSString *)title
|
||||
description:(NSString *)description
|
||||
notificationName:(NSString *)notifName
|
||||
iconData:(NSData *)iconData
|
||||
priority:(signed int)priority
|
||||
isSticky:(BOOL)isSticky
|
||||
clickContext:(id)clickContext
|
||||
identifier:(NSString *)identifier;
|
||||
|
||||
/*! @method notifyWithDictionary:
|
||||
* @abstract Notifies using a userInfo dictionary suitable for passing to
|
||||
* <code>NSDistributedNotificationCenter</code>.
|
||||
* @param userInfo The dictionary to notify with.
|
||||
* @discussion Before Growl 0.6, your application would have posted
|
||||
* notifications using <code>NSDistributedNotificationCenter</code> by
|
||||
* creating a userInfo dictionary with the notification data. This had the
|
||||
* advantage of allowing you to add other data to the dictionary for programs
|
||||
* besides Growl that might be listening.
|
||||
*
|
||||
* This method allows you to use such dictionaries without being restricted
|
||||
* to using <code>NSDistributedNotificationCenter</code>. The keys for this dictionary
|
||||
* can be found in GrowlDefines.h.
|
||||
*/
|
||||
+ (void) notifyWithDictionary:(NSDictionary *)userInfo;
|
||||
|
||||
#pragma mark -
|
||||
|
||||
/*! @method registerWithDictionary:
|
||||
* @abstract Register your application with Growl without setting a delegate.
|
||||
* @discussion When you call this method with a dictionary,
|
||||
* GrowlApplicationBridge registers your application using that dictionary.
|
||||
* If you pass <code>nil</code>, GrowlApplicationBridge will ask the delegate
|
||||
* (if there is one) for a dictionary, and if that doesn't work, it will look
|
||||
* in your application's bundle for an auto-discoverable plist.
|
||||
* (XXX refer to more information on that)
|
||||
*
|
||||
* If you pass a dictionary to this method, it must include the
|
||||
* <code>GROWL_APP_NAME</code> key, unless a delegate is set.
|
||||
*
|
||||
* This method is mainly an alternative to the delegate system introduced
|
||||
* with Growl 0.6. Without a delegate, you cannot receive callbacks such as
|
||||
* <code>-growlIsReady</code> (since they are sent to the delegate). You can,
|
||||
* however, set a delegate after registering without one.
|
||||
*
|
||||
* This method was introduced in Growl.framework 0.7.
|
||||
*/
|
||||
+ (BOOL) registerWithDictionary:(NSDictionary *)regDict;
|
||||
|
||||
/*! @method reregisterGrowlNotifications
|
||||
* @abstract Reregister the notifications for this application.
|
||||
* @discussion This method does not normally need to be called. If your
|
||||
* application changes what notifications it is registering with Growl, call
|
||||
* this method to have the Growl delegate's
|
||||
* <code>-registrationDictionaryForGrowl</code> method called again and the
|
||||
* Growl registration information updated.
|
||||
*
|
||||
* This method is now implemented using <code>-registerWithDictionary:</code>.
|
||||
*/
|
||||
+ (void) reregisterGrowlNotifications;
|
||||
|
||||
#pragma mark -
|
||||
|
||||
/*! @method setWillRegisterWhenGrowlIsReady:
|
||||
* @abstract Tells GrowlApplicationBridge to register with Growl when Growl
|
||||
* launches (or not).
|
||||
* @discussion When Growl has started listening for notifications, it posts a
|
||||
* <code>GROWL_IS_READY</code> notification on the Distributed Notification
|
||||
* Center. GrowlApplicationBridge listens for this notification, using it to
|
||||
* perform various tasks (such as calling your delegate's
|
||||
* <code>-growlIsReady</code> method, if it has one). If this method is
|
||||
* called with <code>YES</code>, one of those tasks will be to reregister
|
||||
* with Growl (in the manner of <code>-reregisterGrowlNotifications</code>).
|
||||
*
|
||||
* This attribute is automatically set back to <code>NO</code> (the default)
|
||||
* after every <code>GROWL_IS_READY</code> notification.
|
||||
* @param flag <code>YES</code> if you want GrowlApplicationBridge to register with
|
||||
* Growl when next it is ready; <code>NO</code> if not.
|
||||
*/
|
||||
+ (void) setWillRegisterWhenGrowlIsReady:(BOOL)flag;
|
||||
|
||||
/*! @method willRegisterWhenGrowlIsReady
|
||||
* @abstract Reports whether GrowlApplicationBridge will register with Growl
|
||||
* when Growl next launches.
|
||||
* @result <code>YES</code> if GrowlApplicationBridge will register with Growl
|
||||
* when next it posts GROWL_IS_READY; <code>NO</code> if not.
|
||||
*/
|
||||
+ (BOOL) willRegisterWhenGrowlIsReady;
|
||||
|
||||
#pragma mark -
|
||||
|
||||
/*! @method registrationDictionaryFromDelegate
|
||||
* @abstract Asks the delegate for a registration dictionary.
|
||||
* @discussion If no delegate is set, or if the delegate's
|
||||
* <code>-registrationDictionaryForGrowl</code> method returns
|
||||
* <code>nil</code>, this method returns <code>nil</code>.
|
||||
*
|
||||
* This method does not attempt to clean up the dictionary in any way - for
|
||||
* example, if it is missing the <code>GROWL_APP_NAME</code> key, the result
|
||||
* will be missing it too. Use <code>+[GrowlApplicationBridge
|
||||
* registrationDictionaryByFillingInDictionary:]</code> or
|
||||
* <code>+[GrowlApplicationBridge
|
||||
* registrationDictionaryByFillingInDictionary:restrictToKeys:]</code> to try
|
||||
* to fill in missing keys.
|
||||
*
|
||||
* This method was introduced in Growl.framework 0.7.
|
||||
* @result A registration dictionary.
|
||||
*/
|
||||
+ (NSDictionary *) registrationDictionaryFromDelegate;
|
||||
|
||||
/*! @method registrationDictionaryFromBundle:
|
||||
* @abstract Looks in a bundle for a registration dictionary.
|
||||
* @discussion This method looks in a bundle for an auto-discoverable
|
||||
* registration dictionary file using <code>-[NSBundle
|
||||
* pathForResource:ofType:]</code>. If it finds one, it loads the file using
|
||||
* <code>+[NSDictionary dictionaryWithContentsOfFile:]</code> and returns the
|
||||
* result.
|
||||
*
|
||||
* If you pass <code>nil</code> as the bundle, the main bundle is examined.
|
||||
*
|
||||
* This method does not attempt to clean up the dictionary in any way - for
|
||||
* example, if it is missing the <code>GROWL_APP_NAME</code> key, the result
|
||||
* will be missing it too. Use <code>+[GrowlApplicationBridge
|
||||
* registrationDictionaryByFillingInDictionary:]</code> or
|
||||
* <code>+[GrowlApplicationBridge
|
||||
* registrationDictionaryByFillingInDictionary:restrictToKeys:]</code> to try
|
||||
* to fill in missing keys.
|
||||
*
|
||||
* This method was introduced in Growl.framework 0.7.
|
||||
* @result A registration dictionary.
|
||||
*/
|
||||
+ (NSDictionary *) registrationDictionaryFromBundle:(NSBundle *)bundle;
|
||||
|
||||
/*! @method bestRegistrationDictionary
|
||||
* @abstract Obtains a registration dictionary, filled out to the best of
|
||||
* GrowlApplicationBridge's knowledge.
|
||||
* @discussion This method creates a registration dictionary as best
|
||||
* GrowlApplicationBridge knows how.
|
||||
*
|
||||
* First, GrowlApplicationBridge contacts the Growl delegate (if there is
|
||||
* one) and gets the registration dictionary from that. If no such dictionary
|
||||
* was obtained, GrowlApplicationBridge looks in your application's main
|
||||
* bundle for an auto-discoverable registration dictionary file. If that
|
||||
* doesn't exist either, this method returns <code>nil</code>.
|
||||
*
|
||||
* Second, GrowlApplicationBridge calls
|
||||
* <code>+registrationDictionaryByFillingInDictionary:</code> with whatever
|
||||
* dictionary was obtained. The result of that method is the result of this
|
||||
* method.
|
||||
*
|
||||
* GrowlApplicationBridge uses this method when you call
|
||||
* <code>+setGrowlDelegate:</code>, or when you call
|
||||
* <code>+registerWithDictionary:</code> with <code>nil</code>.
|
||||
*
|
||||
* This method was introduced in Growl.framework 0.7.
|
||||
* @result A registration dictionary.
|
||||
*/
|
||||
+ (NSDictionary *) bestRegistrationDictionary;
|
||||
|
||||
#pragma mark -
|
||||
|
||||
/*! @method registrationDictionaryByFillingInDictionary:
|
||||
* @abstract Tries to fill in missing keys in a registration dictionary.
|
||||
* @discussion This method examines the passed-in dictionary for missing keys,
|
||||
* and tries to work out correct values for them. As of 0.7, it uses:
|
||||
*
|
||||
* Key Value
|
||||
* --- -----
|
||||
* <code>GROWL_APP_NAME</code> <code>CFBundleExecutableName</code>
|
||||
* <code>GROWL_APP_ICON_DATA</code> The data of the icon of the application.
|
||||
* <code>GROWL_APP_LOCATION</code> The location of the application.
|
||||
* <code>GROWL_NOTIFICATIONS_DEFAULT</code> <code>GROWL_NOTIFICATIONS_ALL</code>
|
||||
*
|
||||
* Keys are only filled in if missing; if a key is present in the dictionary,
|
||||
* its value will not be changed.
|
||||
*
|
||||
* This method was introduced in Growl.framework 0.7.
|
||||
* @param regDict The dictionary to fill in.
|
||||
* @result The dictionary with the keys filled in. This is an autoreleased
|
||||
* copy of <code>regDict</code>.
|
||||
*/
|
||||
+ (NSDictionary *) registrationDictionaryByFillingInDictionary:(NSDictionary *)regDict;
|
||||
|
||||
/*! @method registrationDictionaryByFillingInDictionary:restrictToKeys:
|
||||
* @abstract Tries to fill in missing keys in a registration dictionary.
|
||||
* @discussion This method examines the passed-in dictionary for missing keys,
|
||||
* and tries to work out correct values for them. As of 0.7, it uses:
|
||||
*
|
||||
* Key Value
|
||||
* --- -----
|
||||
* <code>GROWL_APP_NAME</code> <code>CFBundleExecutableName</code>
|
||||
* <code>GROWL_APP_ICON_DATA</code> The data of the icon of the application.
|
||||
* <code>GROWL_APP_LOCATION</code> The location of the application.
|
||||
* <code>GROWL_NOTIFICATIONS_DEFAULT</code> <code>GROWL_NOTIFICATIONS_ALL</code>
|
||||
*
|
||||
* Only those keys that are listed in <code>keys</code> will be filled in.
|
||||
* Other missing keys are ignored. Also, keys are only filled in if missing;
|
||||
* if a key is present in the dictionary, its value will not be changed.
|
||||
*
|
||||
* This method was introduced in Growl.framework 0.7.
|
||||
* @param regDict The dictionary to fill in.
|
||||
* @param keys The keys to fill in. If <code>nil</code>, any missing keys are filled in.
|
||||
* @result The dictionary with the keys filled in. This is an autoreleased
|
||||
* copy of <code>regDict</code>.
|
||||
*/
|
||||
+ (NSDictionary *) registrationDictionaryByFillingInDictionary:(NSDictionary *)regDict restrictToKeys:(NSSet *)keys;
|
||||
|
||||
/*! @brief Tries to fill in missing keys in a notification dictionary.
|
||||
* @param notifDict The dictionary to fill in.
|
||||
* @return The dictionary with the keys filled in. This will be a separate instance from \a notifDict.
|
||||
* @discussion This function examines the \a notifDict for missing keys, and
|
||||
* tries to get them from the last known registration dictionary. As of 1.1,
|
||||
* the keys that it will look for are:
|
||||
*
|
||||
* \li <code>GROWL_APP_NAME</code>
|
||||
* \li <code>GROWL_APP_ICON_DATA</code>
|
||||
*
|
||||
* @since Growl.framework 1.1
|
||||
*/
|
||||
+ (NSDictionary *) notificationDictionaryByFillingInDictionary:(NSDictionary *)regDict;
|
||||
|
||||
+ (NSDictionary *) frameworkInfoDictionary;
|
||||
|
||||
#pragma mark -
|
||||
|
||||
/*!
|
||||
*@method growlURLSchemeAvailable
|
||||
*@abstract Lets the app know whether growl:// is registered on the system, used for certain methods below this
|
||||
*@return Returns whether growl:// is registered on the system
|
||||
*@discussion Methods such as openGrowlPreferences rely on the growl:// URL scheme to function
|
||||
* Further, this method can provide a check on whether Growl is installed,
|
||||
* however, the framework will not be relying on this method for choosing when/how to notify,
|
||||
* and it is not recommended that the app rely on it for other than whether to use growl:// methods
|
||||
*@since Growl.framework 1.4
|
||||
*/
|
||||
+ (BOOL) isGrowlURLSchemeAvailable;
|
||||
|
||||
/*!
|
||||
* @method openGrowlPreferences:
|
||||
* @abstract Open Growl preferences, optionally to this app's settings, growl:// method
|
||||
* @param showApp Whether to show the application's settings, otherwise just opens to the last position
|
||||
* @return Return's whether opening the URL was succesfull or not.
|
||||
* @discussion Will launch if Growl is installed, but not running, and open the preferences window
|
||||
* Uses growl:// URL scheme
|
||||
* @since Growl.framework 1.4
|
||||
*/
|
||||
+ (BOOL) openGrowlPreferences:(BOOL)showApp;
|
||||
|
||||
@end
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
#pragma mark -
|
||||
|
||||
/*!
|
||||
* @protocol GrowlApplicationBridgeDelegate
|
||||
* @abstract Required protocol for the Growl delegate.
|
||||
* @discussion The methods in this protocol are optional and are called
|
||||
* automatically as needed by GrowlApplicationBridge. See
|
||||
* <code>+[GrowlApplicationBridge setGrowlDelegate:]</code>.
|
||||
* See also <code>GrowlApplicationBridgeDelegate_InformalProtocol</code>.
|
||||
*/
|
||||
|
||||
@protocol GrowlApplicationBridgeDelegate <NSObject>
|
||||
|
||||
@optional
|
||||
|
||||
/*!
|
||||
* @method registrationDictionaryForGrowl
|
||||
* @abstract Return the dictionary used to register this application with Growl.
|
||||
* @discussion The returned dictionary gives Growl the complete list of
|
||||
* notifications this application will ever send, and it also specifies which
|
||||
* notifications should be enabled by default. Each is specified by an array
|
||||
* of <code>NSString</code> objects.
|
||||
*
|
||||
* For most applications, these two arrays can be the same (if all sent
|
||||
* notifications should be displayed by default).
|
||||
*
|
||||
* The <code>NSString</code> objects of these arrays will correspond to the
|
||||
* <code>notificationName:</code> parameter passed in
|
||||
* <code>+[GrowlApplicationBridge
|
||||
* notifyWithTitle:description:notificationName:iconData:priority:isSticky:clickContext:]</code> calls.
|
||||
*
|
||||
* The dictionary should have the required key object pairs:
|
||||
* key: GROWL_NOTIFICATIONS_ALL object: <code>NSArray</code> of <code>NSString</code> objects
|
||||
* key: GROWL_NOTIFICATIONS_DEFAULT object: <code>NSArray</code> of <code>NSString</code> objects
|
||||
*
|
||||
* The dictionary may have the following key object pairs:
|
||||
* key: GROWL_NOTIFICATIONS_HUMAN_READABLE_NAMES object: <code>NSDictionary</code> of key: notification name object: human-readable notification name
|
||||
*
|
||||
* You do not need to implement this method if you have an auto-discoverable
|
||||
* plist file in your app bundle. (XXX refer to more information on that)
|
||||
*
|
||||
* @result The <code>NSDictionary</code> to use for registration.
|
||||
*/
|
||||
- (NSDictionary *) registrationDictionaryForGrowl;
|
||||
|
||||
/*!
|
||||
* @method applicationNameForGrowl
|
||||
* @abstract Return the name of this application which will be used for Growl bookkeeping.
|
||||
* @discussion This name is used both internally and in the Growl preferences.
|
||||
*
|
||||
* This should remain stable between different versions and incarnations of
|
||||
* your application.
|
||||
* For example, "SurfWriter" is a good app name, whereas "SurfWriter 2.0" and
|
||||
* "SurfWriter Lite" are not.
|
||||
*
|
||||
* You do not need to implement this method if you are providing the
|
||||
* application name elsewhere, meaning in an auto-discoverable plist file in
|
||||
* your app bundle (XXX refer to more information on that) or in the result
|
||||
* of -registrationDictionaryForGrowl.
|
||||
*
|
||||
* @result The name of the application using Growl.
|
||||
*/
|
||||
- (NSString *) applicationNameForGrowl;
|
||||
|
||||
/*!
|
||||
* @method applicationIconForGrowl
|
||||
* @abstract Return the <code>NSImage</code> to treat as the application icon.
|
||||
* @discussion The delegate may optionally return an <code>NSImage</code>
|
||||
* object to use as the application icon. If this method is not implemented,
|
||||
* {{{-applicationIconDataForGrowl}}} is tried. If that method is not
|
||||
* implemented, the application's own icon is used. Neither method is
|
||||
* generally needed.
|
||||
* @result The <code>NSImage</code> to treat as the application icon.
|
||||
*/
|
||||
- (NSImage *) applicationIconForGrowl;
|
||||
|
||||
/*!
|
||||
* @method applicationIconDataForGrowl
|
||||
* @abstract Return the <code>NSData</code> to treat as the application icon.
|
||||
* @discussion The delegate may optionally return an <code>NSData</code>
|
||||
* object to use as the application icon; if this is not implemented, the
|
||||
* application's own icon is used. This is not generally needed.
|
||||
* @result The <code>NSData</code> to treat as the application icon.
|
||||
* @deprecated In version 1.1, in favor of {{{-applicationIconForGrowl}}}.
|
||||
*/
|
||||
- (NSData *) applicationIconDataForGrowl;
|
||||
|
||||
/*!
|
||||
* @method growlIsReady
|
||||
* @abstract Informs the delegate that Growl has launched.
|
||||
* @discussion Informs the delegate that Growl (specifically, the
|
||||
* GrowlHelperApp) was launched successfully. The application can take actions
|
||||
* with the knowledge that Growl is installed and functional.
|
||||
*/
|
||||
- (void) growlIsReady;
|
||||
|
||||
/*!
|
||||
* @method growlNotificationWasClicked:
|
||||
* @abstract Informs the delegate that a Growl notification was clicked.
|
||||
* @discussion Informs the delegate that a Growl notification was clicked. It
|
||||
* is only sent for notifications sent with a non-<code>nil</code>
|
||||
* clickContext, so if you want to receive a message when a notification is
|
||||
* clicked, clickContext must not be <code>nil</code> when calling
|
||||
* <code>+[GrowlApplicationBridge notifyWithTitle: description:notificationName:iconData:priority:isSticky:clickContext:]</code>.
|
||||
* @param clickContext The clickContext passed when displaying the notification originally via +[GrowlApplicationBridge notifyWithTitle:description:notificationName:iconData:priority:isSticky:clickContext:].
|
||||
*/
|
||||
- (void) growlNotificationWasClicked:(id)clickContext;
|
||||
|
||||
/*!
|
||||
* @method growlNotificationTimedOut:
|
||||
* @abstract Informs the delegate that a Growl notification timed out.
|
||||
* @discussion Informs the delegate that a Growl notification timed out. It
|
||||
* is only sent for notifications sent with a non-<code>nil</code>
|
||||
* clickContext, so if you want to receive a message when a notification is
|
||||
* clicked, clickContext must not be <code>nil</code> when calling
|
||||
* <code>+[GrowlApplicationBridge notifyWithTitle: description:notificationName:iconData:priority:isSticky:clickContext:]</code>.
|
||||
* @param clickContext The clickContext passed when displaying the notification originally via +[GrowlApplicationBridge notifyWithTitle:description:notificationName:iconData:priority:isSticky:clickContext:].
|
||||
*/
|
||||
- (void) growlNotificationTimedOut:(id)clickContext;
|
||||
|
||||
|
||||
/*!
|
||||
* @method hasNetworkClientEntitlement
|
||||
* @abstract Used only in sandboxed situations since we don't know whether the app has com.apple.security.network.client entitlement
|
||||
* @discussion GrowlDelegate calls to find out if we have the com.apple.security.network.client entitlement,
|
||||
* since we can't find this out without hitting the sandbox. We only call it if we detect that the application is sandboxed.
|
||||
*/
|
||||
- (BOOL) hasNetworkClientEntitlement;
|
||||
|
||||
@end
|
||||
|
||||
#pragma mark -
|
||||
|
||||
#endif /* __GrowlApplicationBridge_h__ */
|
||||
@@ -1,386 +0,0 @@
|
||||
//
|
||||
// GrowlDefines.h
|
||||
//
|
||||
|
||||
#ifndef _GROWLDEFINES_H
|
||||
#define _GROWLDEFINES_H
|
||||
|
||||
#ifdef __OBJC__
|
||||
#define XSTR(x) (@x)
|
||||
#else
|
||||
#define XSTR CFSTR
|
||||
#endif
|
||||
|
||||
/*! @header GrowlDefines.h
|
||||
* @abstract Defines all the notification keys.
|
||||
* @discussion Defines all the keys used for registration with Growl and for
|
||||
* Growl notifications.
|
||||
*
|
||||
* Most applications should use the functions or methods of Growl.framework
|
||||
* instead of posting notifications such as those described here.
|
||||
* @updated 2004-01-25
|
||||
*/
|
||||
|
||||
// UserInfo Keys for Registration
|
||||
#pragma mark UserInfo Keys for Registration
|
||||
|
||||
/*! @group Registration userInfo keys */
|
||||
/* @abstract Keys for the userInfo dictionary of a GROWL_APP_REGISTRATION distributed notification.
|
||||
* @discussion The values of these keys describe the application and the
|
||||
* notifications it may post.
|
||||
*
|
||||
* Your application must register with Growl before it can post Growl
|
||||
* notifications (and have them not be ignored). However, as of Growl 0.6,
|
||||
* posting GROWL_APP_REGISTRATION notifications directly is no longer the
|
||||
* preferred way to register your application. Your application should instead
|
||||
* use Growl.framework's delegate system.
|
||||
* See +[GrowlApplicationBridge setGrowlDelegate:] or Growl_SetDelegate for
|
||||
* more information.
|
||||
*/
|
||||
|
||||
/*! @defined GROWL_APP_NAME
|
||||
* @abstract The name of your application.
|
||||
* @discussion The name of your application. This should remain stable between
|
||||
* different versions and incarnations of your application.
|
||||
* For example, "SurfWriter" is a good app name, whereas "SurfWriter 2.0" and
|
||||
* "SurfWriter Lite" are not.
|
||||
*/
|
||||
#define GROWL_APP_NAME XSTR("ApplicationName")
|
||||
/*! @defined GROWL_APP_ID
|
||||
* @abstract The bundle identifier of your application.
|
||||
* @discussion The bundle identifier of your application. This key should
|
||||
* be unique for your application while there may be several applications
|
||||
* with the same GROWL_APP_NAME.
|
||||
* This key is optional.
|
||||
*/
|
||||
#define GROWL_APP_ID XSTR("ApplicationId")
|
||||
/*! @defined GROWL_APP_ICON_DATA
|
||||
* @abstract The image data for your application's icon.
|
||||
* @discussion Image data representing your application's icon. This may be
|
||||
* superimposed on a notification icon as a badge, used as the notification
|
||||
* icon when a notification-specific icon is not supplied, or ignored
|
||||
* altogether, depending on the display. Must be in a format supported by
|
||||
* NSImage, such as TIFF, PNG, GIF, JPEG, BMP, PICT, or PDF.
|
||||
*
|
||||
* Optional. Not supported by all display plugins.
|
||||
*/
|
||||
#define GROWL_APP_ICON_DATA XSTR("ApplicationIcon")
|
||||
/*! @defined GROWL_NOTIFICATIONS_DEFAULT
|
||||
* @abstract The array of notifications to turn on by default.
|
||||
* @discussion These are the names of the notifications that should be enabled
|
||||
* by default when your application registers for the first time. If your
|
||||
* application reregisters, Growl will look here for any new notification
|
||||
* names found in GROWL_NOTIFICATIONS_ALL, but ignore any others.
|
||||
*/
|
||||
#define GROWL_NOTIFICATIONS_DEFAULT XSTR("DefaultNotifications")
|
||||
/*! @defined GROWL_NOTIFICATIONS_ALL
|
||||
* @abstract The array of all notifications your application can send.
|
||||
* @discussion These are the names of all of the notifications that your
|
||||
* application may post. See GROWL_NOTIFICATION_NAME for a discussion of good
|
||||
* notification names.
|
||||
*/
|
||||
#define GROWL_NOTIFICATIONS_ALL XSTR("AllNotifications")
|
||||
/*! @defined GROWL_NOTIFICATIONS_HUMAN_READABLE_DESCRIPTIONS
|
||||
* @abstract A dictionary of human-readable names for your notifications.
|
||||
* @discussion By default, the Growl UI will display notifications by the names given in GROWL_NOTIFICATIONS_ALL
|
||||
* which correspond to the GROWL_NOTIFICATION_NAME. This dictionary specifies the human-readable name to display.
|
||||
* The keys of the dictionary are GROWL_NOTIFICATION_NAME strings; the objects are the human-readable versions.
|
||||
* For any GROWL_NOTIFICATION_NAME not specific in this dictionary, the GROWL_NOTIFICATION_NAME will be displayed.
|
||||
*
|
||||
* This key is optional.
|
||||
*/
|
||||
#define GROWL_NOTIFICATIONS_HUMAN_READABLE_NAMES XSTR("HumanReadableNames")
|
||||
/*! @defined GROWL_NOTIFICATIONS_DESCRIPTIONS
|
||||
* @abstract A dictionary of descriptions of _when_ each notification occurs
|
||||
* @discussion This is an NSDictionary whose keys are GROWL_NOTIFICATION_NAME strings and whose objects are
|
||||
* descriptions of _when_ each notification occurs, such as "You received a new mail message" or
|
||||
* "A file finished downloading".
|
||||
*
|
||||
* This key is optional.
|
||||
*/
|
||||
#define GROWL_NOTIFICATIONS_DESCRIPTIONS XSTR("NotificationDescriptions")
|
||||
/*! @defined GROWL_NOTIFICATIONS_ICONS
|
||||
* @abstract A dictionary of icons for each notification
|
||||
* @discussion This is an NSDictionary whose keys are GROWL_NOTIFICATION_NAME strings and whose objects are
|
||||
* icons for each notification, for GNTP spec
|
||||
*
|
||||
* This key is optional.
|
||||
*/
|
||||
#define GROWL_NOTIFICATIONS_ICONS XSTR("NotificationIcons")
|
||||
|
||||
/*! @defined GROWL_TICKET_VERSION
|
||||
* @abstract The version of your registration ticket.
|
||||
* @discussion Include this key in a ticket plist file that you put in your
|
||||
* application bundle for auto-discovery. The current ticket version is 1.
|
||||
*/
|
||||
#define GROWL_TICKET_VERSION XSTR("TicketVersion")
|
||||
// UserInfo Keys for Notifications
|
||||
#pragma mark UserInfo Keys for Notifications
|
||||
|
||||
/*! @group Notification userInfo keys */
|
||||
/* @abstract Keys for the userInfo dictionary of a GROWL_NOTIFICATION distributed notification.
|
||||
* @discussion The values of these keys describe the content of a Growl
|
||||
* notification.
|
||||
*
|
||||
* Not all of these keys are supported by all displays. Only the name, title,
|
||||
* and description of a notification are universal. Most of the built-in
|
||||
* displays do support all of these keys, and most other visual displays
|
||||
* probably will also. But, as of 0.6, the Log, MailMe, and Speech displays
|
||||
* support only textual data.
|
||||
*/
|
||||
|
||||
/*! @defined GROWL_NOTIFICATION_NAME
|
||||
* @abstract The name of the notification.
|
||||
* @discussion The name of the notification. Note that if you do not define
|
||||
* GROWL_NOTIFICATIONS_HUMAN_READABLE_NAMES when registering your ticket originally this name
|
||||
* will the one displayed within the Growl preference pane and should be human-readable.
|
||||
*/
|
||||
#define GROWL_NOTIFICATION_NAME XSTR("NotificationName")
|
||||
/*! @defined GROWL_NOTIFICATION_TITLE
|
||||
* @abstract The title to display in the notification.
|
||||
* @discussion The title of the notification. Should be very brief.
|
||||
* The title usually says what happened, e.g. "Download complete".
|
||||
*/
|
||||
#define GROWL_NOTIFICATION_TITLE XSTR("NotificationTitle")
|
||||
/*! @defined GROWL_NOTIFICATION_DESCRIPTION
|
||||
* @abstract The description to display in the notification.
|
||||
* @discussion The description should be longer and more verbose than the title.
|
||||
* The description usually tells the subject of the action,
|
||||
* e.g. "Growl-0.6.dmg downloaded in 5.02 minutes".
|
||||
*/
|
||||
#define GROWL_NOTIFICATION_DESCRIPTION XSTR("NotificationDescription")
|
||||
/*! @defined GROWL_NOTIFICATION_ICON
|
||||
* @discussion Image data for the notification icon. Image data must be in a format
|
||||
* supported by NSImage, such as TIFF, PNG, GIF, JPEG, BMP, PICT, or PDF.
|
||||
*
|
||||
* Optional. Not supported by all display plugins.
|
||||
*/
|
||||
#define GROWL_NOTIFICATION_ICON_DATA XSTR("NotificationIcon")
|
||||
/*! @defined GROWL_NOTIFICATION_APP_ICON
|
||||
* @discussion Image data for the application icon, in case GROWL_APP_ICON does
|
||||
* not apply for some reason. Image data be in a format supported by NSImage, such
|
||||
* as TIFF, PNG, GIF, JPEG, BMP, PICT, or PDF.
|
||||
*
|
||||
* Optional. Not supported by all display plugins.
|
||||
*/
|
||||
#define GROWL_NOTIFICATION_APP_ICON_DATA XSTR("NotificationAppIcon")
|
||||
/*! @defined GROWL_NOTIFICATION_PRIORITY
|
||||
* @discussion The priority of the notification as an integer number from
|
||||
* -2 to +2 (+2 being highest).
|
||||
*
|
||||
* Optional. Not supported by all display plugins.
|
||||
*/
|
||||
#define GROWL_NOTIFICATION_PRIORITY XSTR("NotificationPriority")
|
||||
/*! @defined GROWL_NOTIFICATION_STICKY
|
||||
* @discussion A Boolean number controlling whether the notification is sticky.
|
||||
*
|
||||
* Optional. Not supported by all display plugins.
|
||||
*/
|
||||
#define GROWL_NOTIFICATION_STICKY XSTR("NotificationSticky")
|
||||
/*! @defined GROWL_NOTIFICATION_CLICK_CONTEXT
|
||||
* @abstract Identifies which notification was clicked.
|
||||
* @discussion An identifier for the notification for clicking purposes.
|
||||
*
|
||||
* This will be passed back to the application when the notification is
|
||||
* clicked. It must be plist-encodable (a data, dictionary, array, number, or
|
||||
* string object), and it should be unique for each notification you post.
|
||||
* A good click context would be a UUID string returned by NSProcessInfo or
|
||||
* CFUUID.
|
||||
*
|
||||
* Optional. Not supported by all display plugins.
|
||||
*/
|
||||
#define GROWL_NOTIFICATION_CLICK_CONTEXT XSTR("NotificationClickContext")
|
||||
|
||||
/*! @defined GROWL_NOTIFICATION_IDENTIFIER
|
||||
* @abstract An identifier for the notification for coalescing purposes.
|
||||
* Notifications with the same identifier fall into the same class; only
|
||||
* the last notification of a class is displayed on the screen. If a
|
||||
* notification of the same class is currently being displayed, it is
|
||||
* replaced by this notification.
|
||||
*
|
||||
* Optional. Not supported by all display plugins.
|
||||
*/
|
||||
#define GROWL_NOTIFICATION_IDENTIFIER XSTR("GrowlNotificationIdentifier")
|
||||
|
||||
/*! @defined GROWL_APP_PID
|
||||
* @abstract The process identifier of the process which sends this
|
||||
* notification. If this field is set, the application will only receive
|
||||
* clicked and timed out notifications which originate from this process.
|
||||
*
|
||||
* Optional.
|
||||
*/
|
||||
#define GROWL_APP_PID XSTR("ApplicationPID")
|
||||
|
||||
/*! @defined GROWL_NOTIFICATION_PROGRESS
|
||||
* @abstract If this key is set, it should contain a double value wrapped
|
||||
* in a NSNumber which describes some sort of progress (from 0.0 to 100.0).
|
||||
* If this is key is not set, no progress bar is shown.
|
||||
*
|
||||
* Optional. Not supported by all display plugins.
|
||||
*/
|
||||
#define GROWL_NOTIFICATION_PROGRESS XSTR("NotificationProgress")
|
||||
|
||||
/*! @defined GROWL_NOTIFICATION_ALREADY_SHOWN
|
||||
* @abstract If this key is set, it should contain a bool value wrapped
|
||||
* in a NSNumber which describes whether the notification has
|
||||
* already been displayed, for instance by built in Notification
|
||||
* Center support. This value can be used to allow display
|
||||
* plugins to skip a notification, while still allowing Growl
|
||||
* actions to run on them.
|
||||
*
|
||||
* Optional. Not supported by all display plugins.
|
||||
*/
|
||||
#define GROWL_NOTIFICATION_ALREADY_SHOWN XSTR("AlreadyShown")
|
||||
|
||||
|
||||
// Notifications
|
||||
#pragma mark Notifications
|
||||
|
||||
/*! @group Notification names */
|
||||
/* @abstract Names of distributed notifications used by Growl.
|
||||
* @discussion These are notifications used by applications (directly or
|
||||
* indirectly) to interact with Growl, and by Growl for interaction between
|
||||
* its components.
|
||||
*
|
||||
* Most of these should no longer be used in Growl 0.6 and later, in favor of
|
||||
* Growl.framework's GrowlApplicationBridge APIs.
|
||||
*/
|
||||
|
||||
/*! @defined GROWL_APP_REGISTRATION
|
||||
* @abstract The distributed notification for registering your application.
|
||||
* @discussion This is the name of the distributed notification that can be
|
||||
* used to register applications with Growl.
|
||||
*
|
||||
* The userInfo dictionary for this notification can contain these keys:
|
||||
* <ul>
|
||||
* <li>GROWL_APP_NAME</li>
|
||||
* <li>GROWL_APP_ICON_DATA</li>
|
||||
* <li>GROWL_NOTIFICATIONS_ALL</li>
|
||||
* <li>GROWL_NOTIFICATIONS_DEFAULT</li>
|
||||
* </ul>
|
||||
*
|
||||
* No longer recommended as of Growl 0.6. An alternate method of registering
|
||||
* is to use Growl.framework's delegate system.
|
||||
* See +[GrowlApplicationBridge setGrowlDelegate:] or Growl_SetDelegate for
|
||||
* more information.
|
||||
*/
|
||||
#define GROWL_APP_REGISTRATION XSTR("GrowlApplicationRegistrationNotification")
|
||||
/*! @defined GROWL_APP_REGISTRATION_CONF
|
||||
* @abstract The distributed notification for confirming registration.
|
||||
* @discussion The name of the distributed notification sent to confirm the
|
||||
* registration. Used by the Growl preference pane. Your application probably
|
||||
* does not need to use this notification.
|
||||
*/
|
||||
#define GROWL_APP_REGISTRATION_CONF XSTR("GrowlApplicationRegistrationConfirmationNotification")
|
||||
/*! @defined GROWL_NOTIFICATION
|
||||
* @abstract The distributed notification for Growl notifications.
|
||||
* @discussion This is what it all comes down to. This is the name of the
|
||||
* distributed notification that your application posts to actually send a
|
||||
* Growl notification.
|
||||
*
|
||||
* The userInfo dictionary for this notification can contain these keys:
|
||||
* <ul>
|
||||
* <li>GROWL_NOTIFICATION_NAME (required)</li>
|
||||
* <li>GROWL_NOTIFICATION_TITLE (required)</li>
|
||||
* <li>GROWL_NOTIFICATION_DESCRIPTION (required)</li>
|
||||
* <li>GROWL_NOTIFICATION_ICON</li>
|
||||
* <li>GROWL_NOTIFICATION_APP_ICON</li>
|
||||
* <li>GROWL_NOTIFICATION_PRIORITY</li>
|
||||
* <li>GROWL_NOTIFICATION_STICKY</li>
|
||||
* <li>GROWL_NOTIFICATION_CLICK_CONTEXT</li>
|
||||
* <li>GROWL_APP_NAME (required)</li>
|
||||
* </ul>
|
||||
*
|
||||
* No longer recommended as of Growl 0.6. Three alternate methods of posting
|
||||
* notifications are +[GrowlApplicationBridge notifyWithTitle:description:notificationName:iconData:priority:isSticky:clickContext:],
|
||||
* Growl_NotifyWithTitleDescriptionNameIconPriorityStickyClickContext, and
|
||||
* Growl_PostNotification.
|
||||
*/
|
||||
#define GROWL_NOTIFICATION XSTR("GrowlNotification")
|
||||
/*! @defined GROWL_PING
|
||||
* @abstract A distributed notification to check whether Growl is running.
|
||||
* @discussion This is used by the Growl preference pane. If it receives a
|
||||
* GROWL_PONG, the preference pane takes this to mean that Growl is running.
|
||||
*/
|
||||
#define GROWL_PING XSTR("Honey, Mind Taking Out The Trash")
|
||||
/*! @defined GROWL_PONG
|
||||
* @abstract The distributed notification sent in reply to GROWL_PING.
|
||||
* @discussion GrowlHelperApp posts this in reply to GROWL_PING.
|
||||
*/
|
||||
#define GROWL_PONG XSTR("What Do You Want From Me, Woman")
|
||||
/*! @defined GROWL_IS_READY
|
||||
* @abstract The distributed notification sent when Growl starts up.
|
||||
* @discussion GrowlHelperApp posts this when it has begin listening on all of
|
||||
* its sources for new notifications. GrowlApplicationBridge (in
|
||||
* Growl.framework), upon receiving this notification, reregisters using the
|
||||
* registration dictionary supplied by its delegate.
|
||||
*/
|
||||
#define GROWL_IS_READY XSTR("Lend Me Some Sugar; I Am Your Neighbor!")
|
||||
|
||||
|
||||
/*! @defined GROWL_DISTRIBUTED_NOTIFICATION_CLICKED_SUFFIX
|
||||
* @abstract Part of the name of the distributed notification sent when a supported notification is clicked.
|
||||
* @discussion When a Growl notification with a click context is clicked on by
|
||||
* the user, Growl posts a distributed notification whose name is in the format:
|
||||
* [NSString stringWithFormat:@"%@-%d-%@", appName, pid, GROWL_DISTRIBUTED_NOTIFICATION_CLICKED_SUFFIX]
|
||||
* The GrowlApplicationBridge responds to this notification by calling a callback in its delegate.
|
||||
*/
|
||||
#define GROWL_DISTRIBUTED_NOTIFICATION_CLICKED_SUFFIX XSTR("GrowlClicked!")
|
||||
|
||||
/*! @defined GROWL_DISTRIBUTED_NOTIFICATION_TIMED_OUT_SUFFIX
|
||||
* @abstract Part of the name of the distributed notification sent when a supported notification times out without being clicked.
|
||||
* @discussion When a Growl notification with a click context times out, Growl posts a distributed notification
|
||||
* whose name is in the format:
|
||||
* [NSString stringWithFormat:@"%@-%d-%@", appName, pid, GROWL_DISTRIBUTED_NOTIFICATION_TIMED_OUT_SUFFIX]
|
||||
* The GrowlApplicationBridge responds to this notification by calling a callback in its delegate.
|
||||
* NOTE: The user may have actually clicked the 'close' button; this triggers an *immediate* time-out of the notification.
|
||||
*/
|
||||
#define GROWL_DISTRIBUTED_NOTIFICATION_TIMED_OUT_SUFFIX XSTR("GrowlTimedOut!")
|
||||
|
||||
/*! @defined GROWL_DISTRIBUTED_NOTIFICATION_NOTIFICATIONCENTER_ON
|
||||
* @abstract The distributed notification sent when the Notification Center support is toggled on in Growl 2.0
|
||||
* @discussion When the user enables Notification Center support in Growl 2.0, this notification is sent
|
||||
* to inform all running apps that they should now speak to Notification Center directly.
|
||||
*/
|
||||
#define GROWL_DISTRIBUTED_NOTIFICATION_NOTIFICATIONCENTER_ON XSTR("GrowlNotificationCenterOn!")
|
||||
|
||||
/*! @defined GROWL_DISTRIBUTED_NOTIFICATION_NOTIFICATIONCENTER_OFF
|
||||
* @abstract The distributed notification sent when the Notification Center support is toggled off in Growl 2.0
|
||||
* @discussion When the user enables Notification Center support in Growl 2.0, this notification is sent
|
||||
* to inform all running apps that they should no longer speak to Notification Center directly.
|
||||
*/
|
||||
#define GROWL_DISTRIBUTED_NOTIFICATION_NOTIFICATIONCENTER_OFF XSTR("GrowlNotificationCenterOff!")
|
||||
|
||||
/*! @defined GROWL_DISTRIBUTED_NOTIFICATION_NOTIFICATIONCENTER_QUERY
|
||||
* @abstract The distributed notification sent by an application to query Growl 2.0's notification center support.
|
||||
* @discussion When an app starts up, it will send this query to get Growl 2.0 to spit out whether notification
|
||||
* center support is on or off.
|
||||
*/
|
||||
#define GROWL_DISTRIBUTED_NOTIFICATION_NOTIFICATIONCENTER_QUERY XSTR("GrowlNotificationCenterYN?")
|
||||
|
||||
|
||||
/*! @group Other symbols */
|
||||
/* Symbols which don't fit into any of the other categories. */
|
||||
|
||||
/*! @defined GROWL_KEY_CLICKED_CONTEXT
|
||||
* @abstract Used internally as the key for the clickedContext passed over DNC.
|
||||
* @discussion This key is used in GROWL_NOTIFICATION_CLICKED, and contains the
|
||||
* click context that was supplied in the original notification.
|
||||
*/
|
||||
#define GROWL_KEY_CLICKED_CONTEXT XSTR("ClickedContext")
|
||||
/*! @defined GROWL_REG_DICT_EXTENSION
|
||||
* @abstract The filename extension for registration dictionaries.
|
||||
* @discussion The GrowlApplicationBridge in Growl.framework registers with
|
||||
* Growl by creating a file with the extension of .(GROWL_REG_DICT_EXTENSION)
|
||||
* and opening it in the GrowlHelperApp. This happens whether or not Growl is
|
||||
* running; if it was stopped, it quits immediately without listening for
|
||||
* notifications.
|
||||
*/
|
||||
#define GROWL_REG_DICT_EXTENSION XSTR("growlRegDict")
|
||||
|
||||
|
||||
#define GROWL_POSITION_PREFERENCE_KEY @"GrowlSelectedPosition"
|
||||
|
||||
#define GROWL_PLUGIN_CONFIG_ID XSTR("GrowlPluginConfigurationID")
|
||||
|
||||
#endif //ndef _GROWLDEFINES_H
|
||||
@@ -1,40 +0,0 @@
|
||||
<?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>BuildMachineOSBuild</key>
|
||||
<string>12C60</string>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>Growl</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.growl.growlframework</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>2.0.1</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>GRRR</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>2.0.1</string>
|
||||
<key>DTCompiler</key>
|
||||
<string>com.apple.compilers.llvm.clang.1_0</string>
|
||||
<key>DTPlatformBuild</key>
|
||||
<string>4G2008a</string>
|
||||
<key>DTPlatformVersion</key>
|
||||
<string>GM</string>
|
||||
<key>DTSDKBuild</key>
|
||||
<string>12C37</string>
|
||||
<key>DTSDKName</key>
|
||||
<string>macosx10.8</string>
|
||||
<key>DTXcode</key>
|
||||
<string>0452</string>
|
||||
<key>DTXcodeBuild</key>
|
||||
<string>4G2008a</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>GrowlApplicationBridge</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -1,34 +0,0 @@
|
||||
<?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>files</key>
|
||||
<dict>
|
||||
<key>Resources/Info.plist</key>
|
||||
<data>
|
||||
VZb3f8My4te/5JwcjfvotgCXTAs=
|
||||
</data>
|
||||
</dict>
|
||||
<key>rules</key>
|
||||
<dict>
|
||||
<key>^Resources/</key>
|
||||
<true/>
|
||||
<key>^Resources/.*\.lproj/</key>
|
||||
<dict>
|
||||
<key>optional</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>1000</real>
|
||||
</dict>
|
||||
<key>^Resources/.*\.lproj/locversion.plist$</key>
|
||||
<dict>
|
||||
<key>omit</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>1100</real>
|
||||
</dict>
|
||||
<key>^version.plist$</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -1 +0,0 @@
|
||||
A
|
||||
Loaded 100 of 262 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user