Merge branch 'master' of git@github.com:tolmasky/cappuccino into tolmasky

This commit is contained in:
Tom Robinson committed 2009-03-18 23:39:04 -07:00
commit d0b437bc74
198 files changed
+1729 -3450

No files matched your search

+16
View File
@@ -739,7 +739,23 @@ var _CPRunModalLoop = function(anEvent)
@class CPApplication
@return void
*/
@implementation X : CPObject
{
}
- (void)blendDidFinishLoading:(CPBundle)aBundle
{
[CPTheme setDefaultTheme:[CPTheme themeNamed:@"Aristo"]];
_CPApplicationMain()
}
@end
function CPApplicationMain(args, namedArgs)
{
var blend = [[CPBlend alloc] initWithContentsOfURL:[[CPBundle bundleForClass:[CPApplication class]] pathForResource:@"Aristo.blend"]];
[blend loadWithDelegate:[X new]];
}
function _CPApplicationMain(args, namedArgs)
{
var mainBundle = [CPBundle mainBundle],
principalClass = [mainBundle principalClass];
+2 -1
View File
@@ -111,6 +111,7 @@
_tileWidth = -1.0;
_selectionIndexes = [CPIndexSet indexSet];
_isSelectable = YES;
}
return self;
@@ -258,7 +259,7 @@
*/
- (void)setSelectionIndexes:(CPIndexSet)anIndexSet
{
if (_selectionIndexes == anIndexSet)
if (_selectionIndexes == anIndexSet || !_isSelectable)
return;
var index = CPNotFound;
+2
View File
@@ -523,6 +523,8 @@ var hexCharacters = "0123456789ABCDEF";
*/
function hexToRGB(hex)
{
if ( hex.length == 3 )
hex = hex.charAt(0) + hex.charAt(0) + hex.charAt(1) + hex.charAt(1) + hex.charAt(2) + hex.charAt(2);
if(hex.length != 6)
return null;
+29
View File
@@ -103,6 +103,8 @@ var CPControlBlackColor = [CPColor blackColor];
JSObject _ephemeralSubviewsForNames;
CPSet _ephereralSubviews;
CPString _toolTip;
// FIXME: Who uses this?
BOOL _isBezeled;
@@ -183,6 +185,33 @@ var CPControlBlackColor = [CPColor blackColor];
return previousMask;
}
/*!
Sets the tooltip for the receiver.
@param aToolTip the tooltip
*/
/*
-(void)setToolTip:(CPString)aToolTip
{
if (_toolTip == aToolTip)
return;
_toolTip = aToolTip;
#if PLATFORM(DOM)
_DOMElement.title = aToolTip;
#endif
}
*/
/*!
Returns the receiver's tooltip
*/
/*
-(CPString)toolTip
{
return _toolTip;
}
*/
/*!
Returns whether the control can continuously send its action messages.
*/
+1 -1
View File
@@ -450,7 +450,7 @@ CPPopUpButtonStatePullsDown = 1 << 12;
*/
- (int)indexOfItemWithRepresentedObject:(id)anObject
{
return [_menu indexOfItemWithRepresentedObejct:anObject];
return [_menu indexOfItemWithRepresentedObject:anObject];
}
/*!
+10
View File
@@ -173,6 +173,16 @@
return [super createEphemeralSubviewNamed:aName];
}
- (void)setAltIncrementValue:(float)anAltIncrementValue
{
_altIncrementValue = anAltIncrementValue;
}
- (float)altIncrementValue
{
return _altIncrementValue;
}
- (int)isVertical
{
var bounds = [self bounds],
+1 -1
View File
@@ -780,4 +780,4 @@ var CPTextFieldIsEditableKey = "CPTextFieldIsEditableKey",
[aCoder encodeObject:_placeholderString forKey:CPTextFieldPlaceholderStringKey];
}
@end
@end
+54
View File
@@ -27,6 +27,60 @@
@import "CPThemedAttribute.j"
@implementation CPBlend : CPObject
{
CPBundle _bundle;
CPArray _themes @accessors(readonly);
id _loadDelegate;
}
- (id)initWithContentsOfURL:(CPURL)aURL
{
self = [super init];
if (self)
{
_bundle = [[CPBundle alloc] initWithPath:aURL + "/Info.plist"];
}
return self;
}
- (void)loadWithDelegate:(id)aDelegate
{
_loadDelegate = aDelegate;
[_bundle loadWithDelegate:self];
}
- (void)bundleDidFinishLoading:(CPBundle)aBundle
{
var paths = [_bundle objectForInfoDictionaryKey:@"CPBundleReplacedFiles"],
index = 0,
count = paths.length,
bundlePath = [_bundle bundlePath];
while (count--)
{
var path = paths[count];
if ([path pathExtension] === "keyedtheme")
{
var unarchiver = [[_CPThemeKeyedUnarchiver alloc]
initForReadingWithData:[CPData dataWithString:objj_files[bundlePath + '/' + path].contents]
bundle:_bundle];
[unarchiver decodeObjectForKey:@"root"];
[unarchiver finishDecoding];
}
}
[_loadDelegate blendDidFinishLoading:self];
}
@end
var CPThemesByName = nil,
CPThemeDefaultTheme = nil,
+1 -1
View File
@@ -95,7 +95,7 @@ var CAMediaNamedTimingFunctions = nil;
else
{
reference[0] = 1.0;
reference[0] = 1.0;
reference[1] = 1.0;
}
}
+47
View File
@@ -0,0 +1,47 @@
#!/usr/bin/env ruby
require 'rake'
require '../common'
require 'objective-j'
require 'objective-j/bundletask'
$BUILD_PATH = File.join($BUILD_DIR, $CONFIGURATION, 'AppKit')
$ENVIRONMENT_PRODUCT = File.join($ENVIRONMENT_FRAMEWORKS_DIR, 'AppKit')
$THEME_PRODUCT = File.join($BUILD_PATH, 'Resources', 'Aristo.blend')
subprojects = %w{Tools}
subrake(subprojects)
AppKitFiles = FileList['**/*.j'].exclude('CoreGraphics/CGContextCanvas.j', 'CoreGraphics/CGContextVML.j', 'Themes/**', 'Tools/**')
ObjectiveJ::BundleTask.new(:AppKit) do |t|
t.name = 'AppKit'
t.identifier = 'com.280n.AppKit'
t.version = '0.6.5'
t.author = '280 North, Inc.'
t.email = 'feedback @nospam@ 280north.com'
t.summary = 'AppKit classes for Cappuccino'
t.sources = AppKitFiles
t.resources = FileList['Resources/*']
t.license = ObjectiveJ::License::LGPL_v2_1
t.build_path = $BUILD_PATH
t.flag = 'DEBUG' if $CONFIGURATION == 'Debug'
t.platforms = [ObjectiveJ::Platform::Browser, ObjectiveJ::Platform::Rhino]
end
#Framework in environment directory
file_d $ENVIRONMENT_PRODUCT => [:AppKit] do
cp_r(File.join($BUILD_PATH, '.'), $ENVIRONMENT_PRODUCT)
end
ThemeFiles = FileList['Themes/Aristo/*']
file_d $THEME_PRODUCT => ThemeFiles do
File.popen("blend -d Themes/Aristo/ThemeDescriptors.j -o #{$THEME_PRODUCT} -R Themes/Aristo/Resources") do |blend|
puts blend.read
end
end
task :build => [:AppKit, $ENVIRONMENT_PRODUCT, $THEME_PRODUCT]
@@ -5,7 +5,7 @@
<key>CPApplicationDelegateClass</key>
<string>BKShowcaseController</string>
<key>CPBundleName</key>
<string>__Product__</string>
<string>A</string>
<key>CPPrincipalClass</key>
<string>CPApplication</string>
</dict>
Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 370 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 129 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 117 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 126 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 112 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 113 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 120 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

+321
View File
@@ -0,0 +1,321 @@
/*
* AppController.j
* A
*
* Created by __Me__ on __Date__.
* Copyright 2008 __MyCompanyName__. All rights reserved.
*/
@import <Foundation/CPObject.j>
@implementation AristoThemeDescriptor : CPObject
{
}
+ (CPString)themeName
{
return @"Aristo";
}
+ (CPScroller)themedVerticalScroller
{
var scroller = [[CPScroller alloc] initWithFrame:CGRectMake(0.0, 0.0, 17.0, 170.0)],
trackColor = PatterColor([_CPCibCustomResource imageResourceWithName:"scroller-vertical-track.png" size:CGSizeMake(17.0, 1.0)]),
disabledTrackColor = PatterColor([_CPCibCustomResource imageResourceWithName:"scroller-vertical-track-disabled.png" size:CGSizeMake(17.0, 1.0)]);
[scroller setValue:CGSizeMake(15.0, 19.0) forThemedAttributeName:@"minimum-knob-size" inControlState:CPControlStateVertical];
[scroller setValue:CGInsetMake(9.0, 9.0, 9.0, 9.0) forThemedAttributeName:@"track-overlap-inset" inControlState:CPControlStateVertical];
[scroller setValue:trackColor forThemedAttributeName:@"knob-slot-color" inControlState:CPControlStateVertical];
[scroller setValue:disabledTrackColor forThemedAttributeName:@"knob-slot-color" inControlState:CPControlStateVertical | CPControlStateDisabled];
var arrowColor = PatterColor([_CPCibCustomResource imageResourceWithName:"scroller-up-arrow.png" size:CGSizeMake(17.0, 30.0)]),
highlightedArrowColor = PatterColor([_CPCibCustomResource imageResourceWithName:"scroller-up-arrow-highlighted.png" size:CGSizeMake(17.0, 30.0)]),
disabledArrowColor = PatterColor([_CPCibCustomResource imageResourceWithName:"scroller-up-arrow-disabled.png" size:CGSizeMake(17.0, 30.0)]);
[scroller setValue:CGSizeMake(17.0, 30.0) forThemedAttributeName:@"decrement-line-size" inControlState:CPControlStateVertical];
[scroller setValue:arrowColor forThemedAttributeName:@"decrement-line-color" inControlState:CPControlStateVertical];
[scroller setValue:highlightedArrowColor forThemedAttributeName:@"decrement-line-color" inControlState:CPControlStateVertical | CPControlStateHighlighted],
[scroller setValue:disabledArrowColor forThemedAttributeName:@"decrement-line-color" inControlState:CPControlStateVertical | CPControlStateDisabled];
var arrowColor = PatterColor([_CPCibCustomResource imageResourceWithName:"scroller-down-arrow.png" size:CGSizeMake(17.0, 30.0)]),
highlightedArrowColor = PatterColor([_CPCibCustomResource imageResourceWithName:"scroller-down-arrow-highlighted.png" size:CGSizeMake(17.0, 30.0)]),
disabledArrowColor = PatterColor([_CPCibCustomResource imageResourceWithName:"scroller-down-arrow-disabled.png" size:CGSizeMake(17.0, 30.0)]);
[scroller setValue:CGSizeMake(17.0, 30.0) forThemedAttributeName:@"increment-line-size"];
[scroller setValue:arrowColor forThemedAttributeName:@"increment-line-color" inControlState:CPControlStateVertical];
[scroller setValue:highlightedArrowColor forThemedAttributeName:@"increment-line-color" inControlState:CPControlStateVertical | CPControlStateHighlighted];
[scroller setValue:disabledArrowColor forThemedAttributeName:@"increment-line-color" inControlState:CPControlStateVertical | CPControlStateDisabled];
var knobColor = PatterColor([[CPThreePartImage alloc] initWithImageSlices:
[
[_CPCibCustomResource imageResourceWithName:"scroller-vertical-knob-top.png" size:CGSizeMake(15.0, 8.0)],
[_CPCibCustomResource imageResourceWithName:"scroller-vertical-knob-center.png" size:CGSizeMake(15.0, 1.0)],
[_CPCibCustomResource imageResourceWithName:"scroller-vertical-knob-bottom.png" size:CGSizeMake(15.0, 10.0)]
]
isVertical:YES]);
[scroller setValue:knobColor forThemedAttributeName:@"knob-color" inControlState:CPControlStateVertical];
[scroller setFloatValue:0.1 knobProportion:0.5];
return scroller;
}
+ (CPScroller)themedHorizontalScroller
{CPControlStateHorizontal = 0;
var scroller = [[CPScroller alloc] initWithFrame:CGRectMake(0.0, 0.0, 170.0, 17.0)],
trackColor = PatterColor([_CPCibCustomResource imageResourceWithName:"scroller-horizontal-track.png" size:CGSizeMake(1.0, 17.0)]),
disabledTrackColor = PatterColor([_CPCibCustomResource imageResourceWithName:"scroller-vertical-track-disabled.png" size:CGSizeMake(17.0, 1.0)]);
[scroller setBackgroundColor:[CPColor blueColor]];
[scroller setValue:CGSizeMake(19.0, 15.0) forThemedAttributeName:@"minimum-knob-size" inControlState:CPControlStateHorizontal];
[scroller setValue:CGInsetMake(9.0, 9.0, 9.0, 9.0) forThemedAttributeName:@"track-overlap-inset" inControlState:CPControlStateHorizontal];
[scroller setValue:trackColor forThemedAttributeName:@"knob-slot-color" inControlState:CPControlStateHorizontal];
[scroller setValue:disabledTrackColor forThemedAttributeName:@"knob-slot-color" inControlState:CPControlStateHorizontal | CPControlStateDisabled];
var arrowColor = PatterColor([_CPCibCustomResource imageResourceWithName:"scroller-left-arrow.png" size:CGSizeMake(32.0, 17.0)]),
highlightedArrowColor = PatterColor([_CPCibCustomResource imageResourceWithName:"scroller-up-arrow-highlighted.png" size:CGSizeMake(17.0, 30.0)]),
disabledArrowColor = PatterColor([_CPCibCustomResource imageResourceWithName:"scroller-up-arrow-disabled.png" size:CGSizeMake(17.0, 30.0)]);
[scroller setValue:CGSizeMake(32.0, 17.0) forThemedAttributeName:@"decrement-line-size" inControlState:CPControlStateHorizontal];
[scroller setValue:arrowColor forThemedAttributeName:@"decrement-line-color" inControlState:CPControlStateHorizontal];
[scroller setValue:highlightedArrowColor forThemedAttributeName:@"decrement-line-color" inControlState:CPControlStateHorizontal | CPControlStateHighlighted],
[scroller setValue:disabledArrowColor forThemedAttributeName:@"decrement-line-color" inControlState:CPControlStateHorizontal | CPControlStateDisabled];
var arrowColor = PatterColor([_CPCibCustomResource imageResourceWithName:"scroller-right-arrow.png" size:CGSizeMake(31.0, 17.0)]),
highlightedArrowColor = PatterColor([_CPCibCustomResource imageResourceWithName:"scroller-down-arrow-highlighted.png" size:CGSizeMake(17.0, 30.0)]),
disabledArrowColor = PatterColor([_CPCibCustomResource imageResourceWithName:"scroller-down-arrow-disabled.png" size:CGSizeMake(17.0, 30.0)]);
[scroller setValue:CGSizeMake(31.0, 17.0) forThemedAttributeName:@"increment-line-size"];
[scroller setValue:arrowColor forThemedAttributeName:@"increment-line-color" inControlState:CPControlStateHorizontal];
[scroller setValue:highlightedArrowColor forThemedAttributeName:@"increment-line-color" inControlState:CPControlStateHorizontal | CPControlStateHighlighted];
[scroller setValue:disabledArrowColor forThemedAttributeName:@"increment-line-color" inControlState:CPControlStateHorizontal | CPControlStateDisabled];
var knobColor = PatterColor([[CPThreePartImage alloc] initWithImageSlices:
[
[_CPCibCustomResource imageResourceWithName:"scroller-horizontal-knob-left.png" size:CGSizeMake(11.0, 15.0)],
[_CPCibCustomResource imageResourceWithName:"scroller-horizontal-knob-center.png" size:CGSizeMake(1.0, 15.0)],
[_CPCibCustomResource imageResourceWithName:"scroller-horizontal-knob-right.png" size:CGSizeMake(9.0, 15.0)]
]
isVertical:NO]);
[scroller setValue:knobColor forThemedAttributeName:@"knob-color" inControlState:CPControlStateHorizontal];
[scroller setFloatValue:0.1 knobProportion:0.5];
return scroller;
}
+ (CPTextField)themedStandardTextField
{
var textfield = [[CPTextField alloc] initWithFrame:CGRectMake(0.0, 0.0, 60.0, 22.0)],
bezelColor = [CPColor colorWithPatternImage:[[CPNinePartImage alloc] initWithImageSlices:
[
[_CPCibCustomResource imageResourceWithName:"textfield-bezel-square-0.png" size:CGSizeMake(2.0, 3.0)],
[_CPCibCustomResource imageResourceWithName:"textfield-bezel-square-1.png" size:CGSizeMake(1.0, 3.0)],
[_CPCibCustomResource imageResourceWithName:"textfield-bezel-square-2.png" size:CGSizeMake(2.0, 3.0)],
[_CPCibCustomResource imageResourceWithName:"textfield-bezel-square-3.png" size:CGSizeMake(2.0, 1.0)],
[_CPCibCustomResource imageResourceWithName:"textfield-bezel-square-4.png" size:CGSizeMake(1.0, 1.0)],
[_CPCibCustomResource imageResourceWithName:"textfield-bezel-square-5.png" size:CGSizeMake(2.0, 1.0)],
[_CPCibCustomResource imageResourceWithName:"textfield-bezel-square-6.png" size:CGSizeMake(2.0, 2.0)],
[_CPCibCustomResource imageResourceWithName:"textfield-bezel-square-7.png" size:CGSizeMake(1.0, 2.0)],
[_CPCibCustomResource imageResourceWithName:"textfield-bezel-square-8.png" size:CGSizeMake(2.0, 2.0)]
]]];
[textfield setBezeled:YES];
[textfield setValue:bezelColor forThemedAttributeName:@"bezel-color" inControlState:CPControlStateBezeled];
[textfield setValue:[CPFont systemFontOfSize:12.0] forThemedAttributeName:@"font"];
[textfield setValue:CGInsetMake(5.0, 4.0, 2.0, 3.0) forThemedAttributeName:@"content-inset" inControlState:CPControlStateBezeled];
[textfield setValue:[CPColor colorWithCalibratedRed:189.0 / 255.0 green:199.0 / 255.0 blue:211.0 / 255.0 alpha:1.0] forThemedAttributeName:@"text-color" inControlState:CPTextFieldStatePlaceholder];
[textfield setPlaceholderString:"cheese cheese"];
[textfield setStringValue:""];
[textfield setEditable:YES];
return textfield;
}
+ (CPTextField)themedRoundedTextField
{
var textfield = [[CPTextField alloc] initWithFrame:CGRectMake(0.0, 0.0, 60.0, 22.0)],
bezelColor = [CPColor colorWithPatternImage:[[CPThreePartImage alloc] initWithImageSlices:
[
[_CPCibCustomResource imageResourceWithName:"textfield-bezel-rounded-left.png" size:CGSizeMake(13.0, 22.0)],
[_CPCibCustomResource imageResourceWithName:"textfield-bezel-rounded-center.png" size:CGSizeMake(1.0, 22.0)],
[_CPCibCustomResource imageResourceWithName:"textfield-bezel-rounded-right.png" size:CGSizeMake(13.0, 22.0)]
] isVertical:NO]];
[textfield setBezeled:YES];
[textfield setBezelStyle:CPTextFieldRoundedBezel];
[textfield setValue:bezelColor forThemedAttributeName:@"bezel-color" inControlState:CPControlStateBezeled | CPTextFieldStateRounded];
[textfield setValue:[CPFont systemFontOfSize:12.0] forThemedAttributeName:@"font"];
[textfield setValue:CGInsetMake(5.0, 10.0, 2.0, 10.0) forThemedAttributeName:@"content-inset" inControlState:CPControlStateBezeled | CPTextFieldStateRounded];
[textfield setValue:[CPColor colorWithCalibratedRed:189.0 / 255.0 green:199.0 / 255.0 blue:211.0 / 255.0 alpha:1.0] forThemedAttributeName:@"text-color" inControlState:CPTextFieldStatePlaceholder];
[textfield setPlaceholderString:"cheese cheese"];
[textfield setStringValue:""];
[textfield setEditable:YES];
return textfield;
}
+ (CPButton)themedButton
{
var button = [[CPButton alloc] initWithFrame:CGRectMake(0.0, 0.0, 60.0, 24.0)],
bezelColor = [CPColor colorWithPatternImage:[[CPThreePartImage alloc] initWithImageSlices:
[
[_CPCibCustomResource imageResourceWithName:"button-bezel-left.png" size:CGSizeMake(4.0, 24.0)],
[_CPCibCustomResource imageResourceWithName:"button-bezel-center.png" size:CGSizeMake(1.0, 24.0)],
[_CPCibCustomResource imageResourceWithName:"button-bezel-right.png" size:CGSizeMake(4.0, 24.0)]
]
isVertical:NO]];
highlightedBezelColor = [CPColor colorWithPatternImage:[[CPThreePartImage alloc] initWithImageSlices:
[
[_CPCibCustomResource imageResourceWithName:"button-bezel-highlighted-left.png" size:CGSizeMake(4.0, 24.0)],
[_CPCibCustomResource imageResourceWithName:"button-bezel-highlighted-center.png" size:CGSizeMake(1.0, 24.0)],
[_CPCibCustomResource imageResourceWithName:"button-bezel-highlighted-right.png" size:CGSizeMake(4.0, 24.0)]
]
isVertical:NO]];
[button setTitle:@"Cancel"];
[button setValue:[CPFont boldSystemFontOfSize:12.0] forThemedAttributeName:@"font" inControlState:CPControlStateBordered];
[button setValue:[CPColor colorWithCalibratedWhite:79.0 / 255.0 alpha:1.0] forThemedAttributeName:@"text-color"];
[button setValue:[CPColor colorWithCalibratedWhite:240.0 / 255.0 alpha:1.0] forThemedAttributeName:@"text-shadow-color" inControlState:CPControlStateBordered];
[button setValue:CGSizeMake(0.0, 1.0) forThemedAttributeName:@"text-shadow-offset" inControlState:CPControlStateBordered];
[button setValue:CPLineBreakByTruncatingTail forThemedAttributeName:@"line-break-mode"];
[button setValue:bezelColor forThemedAttributeName:@"bezel-color" inControlState:CPControlStateBordered];
[button setValue:highlightedBezelColor forThemedAttributeName:@"bezel-color" inControlState:CPControlStateBordered|CPControlStateHighlighted];
[button setValue:CGInsetMake(0.0, 5.0, 0.0, 5.0) forThemedAttributeName:@"content-inset" inControlState:CPControlStateBordered];
[button setValue:24.0 forThemedAttributeName:@"default-height"];
return button;
}
+ (CPPopUpButton)themedPopUpButton
{
var button = [[CPPopUpButton alloc] initWithFrame:CGRectMake(0.0, 0.0, 100.0, 24.0) pullsDown:NO],color = [CPColor colorWithPatternImage:[[CPThreePartImage alloc] initWithImageSlices:
[
[_CPCibCustomResource imageResourceWithName:"button-bezel-left.png" size:CGSizeMake(4.0, 24.0)],
[_CPCibCustomResource imageResourceWithName:"button-bezel-center.png" size:CGSizeMake(1.0, 24.0)],
[_CPCibCustomResource imageResourceWithName:"popup-bezel-right.png" size:CGSizeMake(27.0, 24.0)]
]
isVertical:NO]];
[button setTitle:@"Pop Up"];
[button setValue:color forThemedAttributeName:@"bezel-color"];
[button setValue:CGInsetMake(0, 5, 0, 27.0 + 5.0) forThemedAttributeName:@"content-inset"];
[button setValue:[CPFont boldSystemFontOfSize:12.0] forThemedAttributeName:@"font"];
[button setValue:[CPColor colorWithCalibratedWhite:79.0 / 255.0 alpha:1.0] forThemedAttributeName:@"text-color"];
[button setValue:[CPColor colorWithCalibratedWhite:240.0 / 255.0 alpha:1.0] forThemedAttributeName:@"text-shadow-color"];
[button setValue:CGSizeMake(0.0, 1.0) forThemedAttributeName:@"text-shadow-offset"];
[button addItemWithTitle:@"item"];
return button;
}
+ (CPPopUpButton)themedPullDownMenu
{
var button = [[CPPopUpButton alloc] initWithFrame:CGRectMake(0.0, 0.0, 100.0, 24.0) pullsDown:YES],
color = [CPColor colorWithPatternImage:[[CPThreePartImage alloc] initWithImageSlices:
[
[_CPCibCustomResource imageResourceWithName:"button-bezel-left.png" size:CGSizeMake(4.0, 24.0)],
[_CPCibCustomResource imageResourceWithName:"button-bezel-center.png" size:CGSizeMake(1.0, 24.0)],
[_CPCibCustomResource imageResourceWithName:"popup-bezel-right-pullsdown.png" size:CGSizeMake(27.0, 24.0)]
]
isVertical:NO]];
[button setTitle:@"Pop Up"];
[button setValue:color forThemedAttributeName:@"bezel-color" inControlState:CPPopUpButtonStatePullsDown];
[button setValue:CGInsetMake(0, 5, 0, 27.0 + 5.0) forThemedAttributeName:@"content-inset"];
[button setValue:[CPFont boldSystemFontOfSize:12.0] forThemedAttributeName:@"font"];
[button setValue:[CPColor colorWithCalibratedWhite:79.0 / 255.0 alpha:1.0] forThemedAttributeName:@"text-color"];
[button setValue:[CPColor colorWithCalibratedWhite:240.0 / 255.0 alpha:1.0] forThemedAttributeName:@"text-shadow-color"];
[button setValue:CGSizeMake(0.0, 1.0) forThemedAttributeName:@"text-shadow-offset"];
[button addItemWithTitle:@"item"];
return button;
}
+ (CPSlider)themedHorizontalSlider
{
var slider = [[CPSlider alloc] initWithFrame:CGRectMake(0.0, 0.0, 50.0, 24.0)],
trackColor = [CPColor colorWithPatternImage:[[CPThreePartImage alloc] initWithImageSlices:
[
[_CPCibCustomResource imageResourceWithName:"horizontal-track-left.png" size:CGSizeMake(4.0, 5.0)],
[_CPCibCustomResource imageResourceWithName:"horizontal-track-center.png" size:CGSizeMake(1.0, 5.0)],
[_CPCibCustomResource imageResourceWithName:"horizontal-track-right.png" size:CGSizeMake(4.0, 5.0)]
]
isVertical:NO]];
[slider setValue:5.0 forThemedAttributeName:@"track-width"];
[slider setValue:trackColor forThemedAttributeName:@"horizontal-track-color"];
var knobColor = [CPColor colorWithPatternImage:[_CPCibCustomResource imageResourceWithName:"knob.png" size:CGSizeMake(23.0, 24.0)]];
knobHighlightedColor = [CPColor colorWithPatternImage:[_CPCibCustomResource imageResourceWithName:"knob-highlighted.png" size:CGSizeMake(23.0, 24.0)]];
[slider setValue:CGSizeMake(23.0, 24.0) forThemedAttributeName:@"knob-size"];
[slider setValue:knobColor forThemedAttributeName:@"knob-color"];
[slider setValue:knobHighlightedColor forThemedAttributeName:@"knob-color" inControlState:CPControlStateHighlighted];
return slider;
}
+ (CPSlider)themedVerticalSlider
{
var slider = [[CPSlider alloc] initWithFrame:CGRectMake(0.0, 0.0, 24.0, 50.0)],
trackColor = [CPColor colorWithPatternImage:[[CPThreePartImage alloc] initWithImageSlices:
[
[_CPCibCustomResource imageResourceWithName:"vertical-track-top.png" size:CGSizeMake(5.0, 6.0)],
[_CPCibCustomResource imageResourceWithName:"vertical-track-center.png" size:CGSizeMake(5.0, 1.0)],
[_CPCibCustomResource imageResourceWithName:"vertical-track-bottom.png" size:CGSizeMake(5.0, 4.0)]
]
isVertical:YES]];
[slider setValue:5.0 forThemedAttributeName:@"track-width"];
[slider setValue:trackColor forThemedAttributeName:@"vertical-track-color"];
var knobColor = [CPColor colorWithPatternImage:[_CPCibCustomResource imageResourceWithName:"knob.png" size:CGSizeMake(23.0, 24.0)]];
knobHighlightedColor = [CPColor colorWithPatternImage:[_CPCibCustomResource imageResourceWithName:"knob-highlighted.png" size:CGSizeMake(23.0, 24.0)]];
[slider setValue:CGSizeMake(23.0, 24.0) forThemedAttributeName:@"knob-size"];
[slider setValue:knobColor forThemedAttributeName:@"knob-color"];
[slider setValue:knobHighlightedColor forThemedAttributeName:@"knob-color" inControlState:CPControlStateHighlighted];
return slider;
}
/*
var buttonBar = [[CPButtonBar alloc] initWithFrame:CGRectMake(0.0, 0.0, 100.0, 30.0)],
color = [CPColor colorWithPatternImage:[[CPThreePartImage alloc] initWithImageSlices:
[
[_CPCibCustomResource imageResourceWithName:"buttonbar-bezel.png" size:CGSizeMake(1.0, 30.0)],
[_CPCibCustomResource imageResourceWithName:"buttonbar-bezel.png" size:CGSizeMake(1.0, 30.0)],
[_CPCibCustomResource imageResourceWithName:"buttonbar-bezel-right.png" size:CGSizeMake(13.0, 30.0)]
]
isVertical:NO]];
[buttonBar setValue:color forThemedAttributeName:@"bezel-color"];
[buttonBar setNeedsLayout];
views.push(buttonBar);
return views;
*/
@end
function PatterColor(anImage)
{
return [CPColor colorWithPatternImage:anImage];
}
+22
View File
@@ -0,0 +1,22 @@
<?xml version = "1.0"?>
<project name = "Aristo" default = "build" basedir = "." >
<import file = "../../../common.xml" />
<import file = "${env.OBJJ_LIB}/steam/steam.xml" />
<target name = "clean" depends = "steam-uptodate">
</target>
<target name = "build" depends = "steam-uptodate">
<exec executable = "objj">
<env key = "OBJJ_INCLUDE_PATHS" value = "${Build}/${Configuration}-Rhino:${Build}/${Configuration}" />
<arg line = "${Build}/Release/blend/main.j -d ThemeDescriptors.j -o ${Build}/${Configuration}/AppKit/Resources/Aristo.blend -R Resources" />
</exec>
<steam-inline-bundle bundle = "${Build}/${Configuration}/AppKit" />
</target>
</project>
@@ -6,7 +6,7 @@
<!--
//
// index-debug.html
// __Product__
// A
//
// Created by __Me__ on __Date__.
// Copyright 2008 __MyCompanyName__. All rights reserved.
@@ -6,7 +6,7 @@
<!--
//
// index.html
// __Product__
// A
//
// Created by __Me__ on __Date__.
// Copyright 2008 __MyCompanyName__. All rights reserved.
+1 -1
View File
@@ -1,6 +1,6 @@
/*
* main.j
* __Product__
* A
*
* Created by __Me__ on __Date__.
* Copyright 2008 __MyCompanyName__. All rights reserved.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+31
View File
@@ -0,0 +1,31 @@
#!/usr/bin/env ruby
require 'rake'
require '../../../common'
require 'objective-j'
require 'objective-j/bundletask'
$ENVIRONMENT_PRODUCT = File.join($ENVIRONMENT_FRAMEWORKS_DIR, 'BlendKit')
$BUILD_PATH = File.join($BUILD_DIR, $CONFIGURATION, 'BlendKit')
task :build => [:BlendKit, $ENVIRONMENT_PRODUCT]
ObjectiveJ::BundleTask.new(:BlendKit) do |t|
t.name = 'BlendKit'
t.identifier = 'com.280n.BlendKit'
t.version = '0.6.5'
t.author = '280 North, Inc.'
t.email = 'feedback @nospam@ 280north.com'
t.summary = 'BlendKit classes for Cappuccino'
t.sources = FileList['*.j']
t.resources = FileList['Resources/*'].to_a
t.license = ObjectiveJ::License::LGPL_v2_1
t.build_path = $BUILD_PATH
t.flag = 'DEBUG' if $CONFIGURATION == 'Debug'
end
#Framework in environment directory
file_d $ENVIRONMENT_PRODUCT => [:BlendKit] do
cp_r(File.join($BUILD_PATH, '.'), $ENVIRONMENT_PRODUCT)
end
+31
View File
@@ -0,0 +1,31 @@
#!/usr/bin/env ruby
require 'rake'
require '../../../common'
require 'objective-j'
require 'objective-j/bundletask'
$ENVIRONMENT_PRODUCT = File.join($ENVIRONMENT_FRAMEWORKS_DIR, 'BlendKit')
$BUILD_PATH = File.join($BUILD_DIR, $CONFIGURATION, 'BlendKit')
task :build => [:BlendKit, $ENVIRONMENT_PRODUCT]
ObjectiveJ::BundleTask.new(:BlendKit) do |t|
t.name = 'BlendKit'
t.identifier = 'com.280n.BlendKit'
t.version = '0.6.5'
t.author = '280 North, Inc.'
t.email = 'feedback @nospam@ 280north.com'
t.summary = 'BlendKit classes for Cappuccino'
t.sources = FileList['*.j']
t.resources = FileList['Resources/*'].to_a
t.license = ObjectiveJ::License::LGPL_v2_1
t.build_path = $BUILD_PATH
t.flag = 'DEBUG' if $CONFIGURATION == 'Debug'
end
#Framework in environment directory
file_d $ENVIRONMENT_PRODUCT => [:BlendKit] do
cp_r(File.join($BUILD_PATH, '.'), $ENVIRONMENT_PRODUCT)
end
@@ -4,7 +4,7 @@ require 'rake'
require '../../common'
subprojects = %w{objj objjc}
subprojects = %w{BlendKit blend}
%w(build clean).each do |task_name|
task task_name do
+38
View File
@@ -0,0 +1,38 @@
#!/usr/bin/env ruby
require 'rake'
require '../../../common'
require 'objective-j'
require 'objective-j/bundletask'
$PRODUCT = :blend
$BUILD_PATH = File.join($BUILD_DIR, $CONFIGURATION, 'blend')
$ENVIRONMENT_BIN_PRODUCT = File.join($ENVIRONMENT_BIN_DIR, 'blend')
$ENVIRONMENT_LIB_PRODUCT = File.join($ENVIRONMENT_LIB_DIR, 'blend')
task :build => [:blend, $ENVIRONMENT_BIN_PRODUCT, $ENVIRONMENT_LIB_PRODUCT]
# Debug Framework
ObjectiveJ::BundleTask.new(:blend) do |t|
t.name = 'blend'
t.identifier = 'com.280n.blend'
t.version = '0.6.5'
t.author = '280 North, Inc.'
t.email = 'feedback @nospam@ 280north.com'
t.summary = 'blend classes for Cappuccino'
t.sources = FileList['**/*.j']
t.resources = FileList['Resources/*']
t.license = ObjectiveJ::License::LGPL_v2_1
t.build_path = $BUILD_PATH
t.flag = 'DEBUG' if $CONFIGURATION == 'Debug'
end
#executable in environment directory
file_d $ENVIRONMENT_BIN_PRODUCT do
make_objj_executable($ENVIRONMENT_BIN_PRODUCT)
end
file_d $ENVIRONMENT_LIB_PRODUCT => [:blend] do
cp_r(File.join($BUILD_PATH, '.'), $ENVIRONMENT_LIB_PRODUCT)
end
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -294,5 +294,3 @@ function exec(/*Array*/ command, /*Boolean*/ showOutput)
}
@end
main.apply(main, args);
-57
View File
@@ -1,57 +0,0 @@
#!/usr/bin/env ruby
require 'rake'
require '../common'
require 'objective-j'
require 'objective-j/bundle'
$PRODUCT = 'AppKit' + $CONFIGURATION
$ENVIRONMENT_PRODUCT = File.join($ENVIRONMENT_FRAMEWORKS_DIR, 'AppKit')
task :build => [$PRODUCT, $ENVIRONMENT_PRODUCT]
Specs = {}
AppKitFiles = FileList['**/*.j'].exclude('CoreGraphics/CGContextCanvas.j', 'CoreGraphics/CGContextVML.j', 'Themes/**')
# Debug Framework
Specs[:AppKitDebug] = ObjectiveJ::BundleSpecification.new do |s|
s.name = 'AppKit'
s.identifier = 'com.280n.AppKit'
s.version = '0.6.5'
s.author = '280 North, Inc.'
s.email = 'feedback @nospam@ 280north.com'
s.summary = 'AppKit classes for Cappuccino'
s.sources = AppKitFiles
s.resources = FileList['Resources/*']
s.license = ObjectiveJ::License::LGPL_v2_1
s.build_path = File.join($BUILD_DIR, 'Debug', 'AppKit')
s.intermediates_path = File.join($BUILD_DIR, 'AppKit.build', 'Debug')
s.flags = ['PLATFORM_DOM', 'DEBUG']
end
bundle Specs[:AppKitDebug], :AppKitDebug
# Release Framework
Specs[:AppKitRelease] = ObjectiveJ::BundleSpecification.new do |s|
s.name = 'AppKit'
s.identifier = 'com.280n.AppKit'
s.version = '0.6.5'
s.author = '280 North, Inc.'
s.email = 'feedback @nospam@ 280north.com'
s.summary = 'AppKit classes for Cappuccino'
s.sources = AppKitFiles
s.resources = FileList['Resources/*']
s.license = ObjectiveJ::License::LGPL_v2_1
s.build_path = File.join($BUILD_DIR, 'Release', 'AppKit')
s.intermediates_path = File.join($BUILD_DIR, 'AppKit.build', 'Release')
s.flag = 'PLATFORM_DOM'
end
bundle Specs[:AppKitRelease], :AppKitRelease
#Framework in environment directory
file_d $ENVIRONMENT_PRODUCT => [$PRODUCT] do
cp_r(Specs[$PRODUCT.to_sym].build_path, $ENVIRONMENT_PRODUCT)
end
+40 -19
View File
@@ -57,7 +57,16 @@
SEL _replaceSEL;
Function _replace;
SEL _insertManySEL;
Function _insertMany;
SEL _removeManySEL;
Function _removeMany;
SEL _replaceManySEL;
Function _replaceMany;
SEL _objectAtIndexSEL;
Function _objectAtIndex;
@@ -95,32 +104,44 @@
var capitalizedKey = _key.charAt(0).toUpperCase() + _key.substring(1);
_insertSEL = sel_getName(@"insertObject:in"+capitalizedKey+"AtIndex:");
if ([_proxyObject respondsToSelector:selector])
_insert = [_proxyObject methodForSelector:selector];
if ([_proxyObject respondsToSelector:_insertSEL])
_insert = [_proxyObject methodForSelector:_insertSEL];
_removeSEL = sel_getName(@"removeObjectFrom"+capitalizedKey+"AtIndex:");
if ([_proxyObject respondsToSelector:selector])
_remove = [_proxyObject methodForSelector:selector];
if ([_proxyObject respondsToSelector:_removeSEL])
_remove = [_proxyObject methodForSelector:_removeSEL];
_replaceSEL = sel_getName(@"replaceObjectFrom"+capitalizedKey+"AtIndex:withObject:");
if ([_proxyObject respondsToSelector:selector])
_replace = [_proxyObject methodForSelector:selector];
if ([_proxyObject respondsToSelector:_replaceSEL])
_replace = [_proxyObject methodForSelector:_replaceSEL];
_insertManySEL = sel_getName(@"insertObjects:in"+capitalizedKey+"AtIndexes:");
if ([_proxyObject respondsToSelector:_insertManySEL])
_insert = [_proxyObject methodForSelector:_insertManySEL];
_removeManySEL = sel_getName(@"removeObjectsFrom"+capitalizedKey+"AtIndexes:");
if ([_proxyObject respondsToSelector:_removeManySEL])
_remove = [_proxyObject methodForSelector:_removeManySEL];
_replaceManySEL = sel_getName(@"replaceObjectsFrom"+capitalizedKey+"AtIndexes:withObjects:");
if ([_proxyObject respondsToSelector:_replaceManySEL])
_replace = [_proxyObject methodForSelector:_replaceManySEL];
_objectAtIndexSEL = sel_getName(@"objectIn"+capitalizedKey+"AtIndex:");
if ([_proxyObject respondsToSelector:selector])
_objectAtIndex = [_proxyObject methodForSelector:selector];
if ([_proxyObject respondsToSelector:_objectAtIndexSEL])
_objectAtIndex = [_proxyObject methodForSelector:_objectAtIndexSEL];
_countSEL = sel_getName(@"countOf"+capitalizedKey);
if ([_proxyObject respondsToSelector:selector])
_count = [_proxyObject methodForSelector:selector];
if ([_proxyObject respondsToSelector:_countSEL])
_count = [_proxyObject methodForSelector:_countSEL];
_accessSEL = sel_getName(_key);
if ([_proxyObject respondsToSelector:selector])
_access = [_proxyObject methodForSelector:selector];
if ([_proxyObject respondsToSelector:_accessSEL])
_access = [_proxyObject methodForSelector:_accessSEL];
_setSEL = sel_getName(@"set"+capitalizedKey+":");
if ([_proxyObject respondsToSelector:selector])
_set = [_proxyObject methodForSelector:selector];
if ([_proxyObject respondsToSelector:_setSEL])
_set = [_proxyObject methodForSelector:_setSEL];
return self;
}
@@ -176,7 +197,7 @@
var target = [[self _representedObject] copy];
[target addObject:anObject];
[_self _setRepresentedObject:target];
[self _setRepresentedObject:target];
}
- (void)insertObject:(id)anObject atIndex:(unsigned)anIndex
@@ -187,7 +208,7 @@
var target = [[self _representedObject] copy];
[target insertObject:anObject atIndex:anIndex];
[_self _setRepresentedObject:target];
[self _setRepresentedObject:target];
}
- (void)removeLastObject
@@ -198,7 +219,7 @@
var target = [[self _representedObject] copy];
[target removeLastObject];
[_self _setRepresentedObject:target];
[self _setRepresentedObject:target];
}
- (void)removeObjectAtIndex:(unsigned)anIndex
@@ -209,7 +230,7 @@
var target = [[self _representedObject] copy];
[target removeObjectAtIndex:anIndex];
[_self _setRepresentedObject:target];
[self _setRepresentedObject:target];
}
- (void)replaceObjectAtIndex:(unsigned)anIndex withObject:(id)anObject
@@ -220,7 +241,7 @@
var target = [[self _representedObject] copy];
[target replaceObjectAtIndex:anIndex withObject:anObject];
[_self _setRepresentedObject:target];
[self _setRepresentedObject:target];
}
- (CPArray)objectsAtIndexes:(CPIndexSet)indexes
+1 -1
View File
@@ -674,7 +674,7 @@
*/
- (CPArray)arrayByAddingObject:(id)anObject
{
if (!anObject)
if (anObject === nil || anObject === undefined)
[CPException raise:CPInvalidArgumentException
reason:"arrayByAddingObject: object can't be nil"];
+22 -3
View File
@@ -93,6 +93,11 @@
return className ? CPClassFromString(className) : Nil;
}
- (CPString)pathForResource:(CPString)aFilename
{
return [self resourcePath] + '/' + aFilename;
}
- (CPDictionary)infoDictionary
{
return info;
@@ -129,15 +134,29 @@
context.didCompleteCallback = function() { [_delegate bundleDidFinishLoading:self]; };
var files = [self objectForInfoDictionaryKey:@"CPBundleReplacedFiles"],
count = files.length;
count = files.length,
bundlePath = [self bundlePath];
while (count--)
context.pushFragment(fragment_create_file([self bundlePath] + '/' + files[count], new objj_bundle(""), YES, NULL));
{
var fileName = files[count];
if (fileName.indexOf(".j") === fileName.length - 2)
context.pushFragment(fragment_create_file(bundlePath + '/' + fileName, new objj_bundle(""), YES, NULL));
}
context.evaluate();
if (context.fragments.length)
context.evaluate();
else
[_delegate bundleDidFinishLoading:self];
}
}
- (void)connection:(CPURLConnection)aConnection didFailWithError:(CPError)anError
{
alert("what the hell!?!!!" + anError)
}
- (void)connectionDidFinishLoading:(CPURLConnection)aConnection
{
}
+20 -2
View File
@@ -39,10 +39,17 @@ var CPDateReferenceDate = new Date(Date.UTC(2001,1,1,0,0,0,0));
{
return [[self alloc] init];
}
+ (id)dateWithTimeIntervalSinceNow:(CPTimeInterval)seconds
{
return [[CPDate alloc] initWithTimeIntervalSinceNow:seconds];
}
+ (id)dateWithTimeIntervalSince1970:(CPTimeInterval)seconds
{
return [[CPDate alloc] initWithTimeIntervalSince1970:seconds];
}
+ (id)dateWithTimeIntervalSinceReferenceDate:(CPTimeInterval)seconds
{
return [[CPDate alloc] initWithTimeIntervalSinceReferenceDate:seconds];
@@ -63,23 +70,31 @@ var CPDateReferenceDate = new Date(Date.UTC(2001,1,1,0,0,0,0));
self = new Date((new Date()).getTime() + seconds * 1000);
return self;
}
- (id)initWithTimeIntervalSince1970:(CPTimeInterval)seconds
{
self = new Date(seconds * 1000);
return self;
}
- (id)initWithTimeIntervalSinceReferenceDate:(CPTimeInterval)seconds
{
self = [self initWithTimeInterval:seconds sinceDate:CPDateReferenceDate];
return self;
}
- (id)initWithTimeInterval:(CPTimeInterval)seconds sinceDate:(CPDate)refDate
{
self = new Date(refDate.getTime() + seconds * 1000);
return self;
}
- (id)initWithString:(CPString)description
{
self = new Date(description); // FIXME: not same format as NSString
return self;
}
- (CPTimeInterval)timeIntervalSinceDate:(CPDate)anotherDate
{
return (self.getTime() - anotherDate.getTime()) / 1000.0;
@@ -89,14 +104,17 @@ var CPDateReferenceDate = new Date(Date.UTC(2001,1,1,0,0,0,0));
{
return [self timeIntervalSinceDate:[CPDate date]];
}
- (CPTimeInterval)timeIntervalSince1970
{
return self.getTime() / 1000.0;
}
- (CPTimeInterval)timeIntervalSinceReferenceDate
{
return (self.getTime() - CPDateReferenceDate.getTime()) / 1000.0;
}
+ (CPTimeInterval)timeIntervalSinceReferenceDate
{
return [[CPDate date] timeIntervalSinceReferenceDate];
@@ -129,4 +147,4 @@ var CPDateReferenceDate = new Date(Date.UTC(2001,1,1,0,0,0,0));
@end
Date.prototype.isa = CPDate;
Date.prototype.isa = CPDate;
+1 -1
View File
@@ -268,7 +268,7 @@
if (lhsObject === rhsObject)
continue;
if ([lhsObject respondsToSelector:@selector(isEqual:)] && [lhsObject isEqual:rhsObject])
if (lhsObject.isa && rhsObject.isa && [lhsObject respondsToSelector:@selector(isEqual:)] && [lhsObject isEqual:rhsObject])
continue;
return NO;
+5 -1
View File
@@ -146,6 +146,10 @@ if (input == nil)
@end
var CPExceptionNameKey = "CPExceptionNameKey",
CPExceptionReasonKey = "CPExceptionReasonKey",
CPExceptionUserInfoKey = "CPExceptionUserInfoKey";
@implementation CPException (CPCoding)
/*!
@@ -161,7 +165,7 @@ if (input == nil)
{
name = [aCoder decodeObjectForKey:CPExceptionNameKey];
reason = [aCoder decodeObjectForKey:CPExceptionReasonKey];
userInfo = [aCoer decodeObjectForKey:CPExceptionUserInfoKey];
userInfo = [aCoder decodeObjectForKey:CPExceptionUserInfoKey];
}
return self;
+1 -1
View File
@@ -41,7 +41,7 @@ var CPNotificationDefaultCenter = nil;
/*!
Returns the application's notification center
*/
+ (CPNotifcationCenter)defaultCenter
+ (CPNotificationCenter)defaultCenter
{
if (!CPNotificationDefaultCenter)
CPNotificationDefaultCenter = [[CPNotificationCenter alloc] init];
+37 -4
View File
@@ -23,8 +23,41 @@
/*!
@class CPObject
CPObject is the root class for most Cappuccino classes. Your custom classes
should almost always subclass CPObject or one of its children.
CPObject is the root class for most Cappuccino classes. Like in Objective-C,
you have to declare parent class explicitly in Objective-J, so your custom
classes should almost always subclass CPObject or one of its children.
CPObject provides facilities for class allocation and initialization,
querying runtime about parent classes and available selectors, using KVC
(key-value coding).
When you subclass CPObject, most of the time you override one selector - init.
It is called for default initialization of custom object. You must call
parent class init in your overriden code:
<pre>- (id)init
{
self = [super init];
if(self) {
... provide default initialization code for your object ...
}
return self;
}</pre>
One more useful thing to override is description(). This selector
is used to provide developer-readable information about object. description
selector is often used with CPLog debugging:
<pre>- (CPString)description
{
return [CPString stringWithFormat:@"<SomeClass %d>", someValue];
}</pre>
To get description value you can use %@ specifier everywhere where format
specifiers are allowed:
<pre>var inst = [[SomeClass alloc] initWithSomeValue:10];
CPLog(@"Got some class: %@", inst);</pre>
would output:
<pre>Got some class: <SomeClass 10></pre>
@todo document KVC usage.
*/
@implementation CPObject
{
@@ -177,7 +210,7 @@
*/
+ (BOOL)instancesRespondToSelector:(SEL)aSelector
{
return class_getInstanceMethod(self, aSelector);
return !!class_getInstanceMethod(self, aSelector);
}
/*!
@@ -187,7 +220,7 @@
*/
- (BOOL)respondsToSelector:(SEL)aSelector
{
return class_getInstanceMethod(isa, aSelector) != NULL;
return !!class_getInstanceMethod(isa, aSelector);
}
// Obtaining method information
+13 -5
View File
@@ -91,7 +91,7 @@ var CPStringHashes = new objj_dictionary();
*/
+ (id)stringWithHash:(unsigned)aHash
{
var hashString = String(aHash);
var hashString = parseInt(aHash, 10).toString(16);
return "000000".substring(0, MAX(6-hashString.length, 0)) + hashString;
}
@@ -222,13 +222,16 @@ var CPStringHashes = new objj_dictionary();
return substr(0, aLength);
var string = self,
substring = aString.substr(anIndex),
substring = aString.substring(anIndex),
difference = aLength - length;
while ((difference -= substring.length) > 0)
while ((difference -= substring.length) >= 0)
string += substring;
if (difference) string += substring.substr(difference + substring.length);
if (-difference < substring.length)
string += substring.substring(0, -difference);
return string;
}
//Dividing Strings
@@ -584,7 +587,12 @@ var CPStringHashes = new objj_dictionary();
*/
- (CPArray)pathComponents
{
return split('/');
var result = split('/');
if (result[0] === "")
result[0] = "/";
if (result[result.length - 1] === "")
result.pop();
return result;
}
/*!
+16
View File
@@ -55,3 +55,19 @@
@import "CPURLResponse.j"
@import "CPUserSessionManager.j"
@import "CPValue.j"
/*! @mainpage
Cappuccino is distributed under the @ref license "GNU LGPL".
@htmlonly <pre>@endhtmlonly
@htmlinclude README
@htmlonly </pre>@endhtmlonly
@page license License
@htmlonly <pre>@endhtmlonly
@htmlinclude LICENSE
@htmlonly </pre>@endhtmlonly
@defgroup appkit AppKit
@defgroup foundation Foundation
*/
+31
View File
@@ -0,0 +1,31 @@
#!/usr/bin/env ruby
require 'rake'
require '../common'
require 'objective-j'
require 'objective-j/bundletask'
$ENVIRONMENT_PRODUCT = File.join($ENVIRONMENT_FRAMEWORKS_DIR, 'Foundation')
$BUILD_PATH = File.join($BUILD_DIR, $CONFIGURATION, 'Foundation')
task :build => [:Foundation, $ENVIRONMENT_PRODUCT]
ObjectiveJ::BundleTask.new(:Foundation) do |t|
t.name = 'Foundation'
t.identifier = 'com.280n.Foundation'
t.version = '0.6.5'
t.author = '280 North, Inc.'
t.email = 'feedback @nospam@ 280north.com'
t.summary = 'Foundation classes for Cappuccino'
t.sources = FileList['*.j']
t.resources = FileList['Resources/*'].to_a
t.license = ObjectiveJ::License::LGPL_v2_1
t.build_path = $BUILD_PATH
t.flag = 'DEBUG' if $CONFIGURATION == 'Debug'
end
#Framework in environment directory
file_d $ENVIRONMENT_PRODUCT => [:Foundation] do
cp_r(File.join($BUILD_PATH, '.'), $ENVIRONMENT_PRODUCT)
end
Loaded 100 of 198 files, more files were not shown because too many files have changed in this diff. Show more