Merge branch 'master' of git@github.com:280north/cappuccino

This commit is contained in:
Ross Boucher
2009-05-23 17:28:55 -07:00
28 changed files with 754 additions and 340 deletions
+6 -1
View File
@@ -476,6 +476,11 @@ CPRunContinuesResponse = -1002;
_mainMenu = aMenu;
}
- (void)orderFrontColorPanel:(id)aSender
{
[[CPColorPanel sharedColorPanel] orderFront:self];
}
- (void)orderFrontStandardAboutPanel:(id)aSender
{
[self orderFrontStandardAboutPanelWithOptions:nil];
@@ -841,7 +846,7 @@ var _CPAppBootstrapperActions = nil;
if (mainCibFile)
{
[CPBundle loadCibFile:[mainBundle pathForResource:mainCibFile]
[mainBundle loadCibFile:mainCibFile
externalNameTable:[CPDictionary dictionaryWithObject:CPApp forKey:CPCibOwner]
loadDelegate:self];
+1 -1
View File
@@ -502,7 +502,7 @@ CPPopUpButtonStatePullsDown = CPThemeState("pulls-down");
{
if ([self title] === aTitle)
return;
if ([self pullsDown])
{
var items = [_menu itemArray];
+3
View File
@@ -2107,6 +2107,9 @@ setBoundsOrigin:
for (var attributeName in _themeAttributes)
if (_themeAttributes.hasOwnProperty(attributeName))
[_themeAttributes[attributeName] setParentAttribute:[theme _attributeWithName:attributeName forClass:themeClass]];
[self setNeedsLayout];
[self setNeedsDisplay:YES];
}
- (CPDictionary)_themeAttributeDictionary
Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 397 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 341 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

+136 -114
View File
@@ -10,7 +10,7 @@
@import <AppKit/AppKit.j>
@implementation AristoThemeDescriptor : CPObject
@implementation AristoThemeDescriptor : BKThemeDescriptor
{
}
@@ -19,6 +19,137 @@
return @"Aristo";
}
+ (CPButton)button
{
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]],
defaultBezelColor = [CPColor colorWithPatternImage:[[CPThreePartImage alloc] initWithImageSlices:
[
[_CPCibCustomResource imageResourceWithName:"default-button-bezel-left.png" size:CGSizeMake(4.0, 24.0)],
[_CPCibCustomResource imageResourceWithName:"default-button-bezel-center.png" size:CGSizeMake(1.0, 24.0)],
[_CPCibCustomResource imageResourceWithName:"default-button-bezel-right.png" size:CGSizeMake(4.0, 24.0)]
]
isVertical:NO]],
defaultHighlightedBezelColor = [CPColor colorWithPatternImage:[[CPThreePartImage alloc] initWithImageSlices:
[
[_CPCibCustomResource imageResourceWithName:"default-button-bezel-highlighted-left.png" size:CGSizeMake(4.0, 24.0)],
[_CPCibCustomResource imageResourceWithName:"default-button-bezel-highlighted-center.png" size:CGSizeMake(1.0, 24.0)],
[_CPCibCustomResource imageResourceWithName:"default-button-bezel-highlighted-right.png" size:CGSizeMake(4.0, 24.0)]
]
isVertical:NO]];
[button setValue:[CPFont boldSystemFontOfSize:12.0] forThemeAttribute:@"font" inState:CPThemeStateBordered];
[button setValue:[CPColor colorWithCalibratedWhite:79.0 / 255.0 alpha:1.0] forThemeAttribute:@"text-color"];
[button setValue:[CPColor colorWithCalibratedWhite:240.0 / 255.0 alpha:1.0] forThemeAttribute:@"text-shadow-color" inState:CPThemeStateBordered];
[button setValue:CGSizeMake(0.0, 1.0) forThemeAttribute:@"text-shadow-offset" inState:CPThemeStateBordered];
[button setValue:CPLineBreakByTruncatingTail forThemeAttribute:@"line-break-mode"];
[button setValue:bezelColor forThemeAttribute:@"bezel-color" inState:CPThemeStateBordered];
[button setValue:highlightedBezelColor forThemeAttribute:@"bezel-color" inState:CPThemeStateBordered|CPThemeStateHighlighted];
[button setValue:CGInsetMake(0.0, 5.0, 0.0, 5.0) forThemeAttribute:@"content-inset" inState:CPThemeStateBordered];
[button setValue:defaultBezelColor forThemeAttribute:@"bezel-color" inState:CPThemeStateBordered|CPThemeStateDefault];
[button setValue:defaultHighlightedBezelColor forThemeAttribute:@"bezel-color" inState:CPThemeStateBordered|CPThemeStateHighlighted|CPThemeStateDefault];
[button setValue:[CPColor colorWithCalibratedRed:13.0/255.0 green:51.0/255.0 blue:70.0/255.0 alpha:1.0] forThemeAttribute:@"text-color" inState:CPThemeStateDefault];
[button setValue:CGSizeMake(0.0, 24.0) forThemeAttribute:@"min-size"];
[button setValue:CGSizeMake(-1.0, 24.0) forThemeAttribute:@"max-size"];
return button;
}
+ (CPButton)themedStandardButton
{
var button = [self button];
[button setTitle:@"Cancel"];
return button;
}
+ (CPButton)themedDefaultButton
{
var button = [self button];
[button setTitle:@"OK"];
[button setDefaultButton:YES];
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 forThemeAttribute:@"bezel-color" inState:CPThemeStateBordered];
[button setValue:CGInsetMake(0, 27.0 + 5.0, 0, 5.0) forThemeAttribute:@"content-inset" inState:CPThemeStateBordered];
[button setValue:[CPFont boldSystemFontOfSize:12.0] forThemeAttribute:@"font"];
[button setValue:[CPColor colorWithCalibratedWhite:79.0 / 255.0 alpha:1.0] forThemeAttribute:@"text-color"];
[button setValue:[CPColor colorWithCalibratedWhite:240.0 / 255.0 alpha:1.0] forThemeAttribute:@"text-shadow-color"];
[button setValue:CGSizeMake(0.0, 1.0) forThemeAttribute:@"text-shadow-offset"];
[button setValue:CGSizeMake(32.0, 24.0) forThemeAttribute:@"min-size"];
[button setValue:CGSizeMake(-1.0, 24.0) forThemeAttribute:@"max-size"];
[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:@"Pull Down"];
[button setValue:color forThemeAttribute:@"bezel-color" inState:CPPopUpButtonStatePullsDown|CPThemeStateBordered];
[button setValue:CGInsetMake(0, 27.0 + 5.0, 0, 5.0) forThemeAttribute:@"content-inset" inState:CPThemeStateBordered];
[button setValue:[CPFont boldSystemFontOfSize:12.0] forThemeAttribute:@"font"];
[button setValue:[CPColor colorWithCalibratedWhite:79.0 / 255.0 alpha:1.0] forThemeAttribute:@"text-color"];
[button setValue:[CPColor colorWithCalibratedWhite:240.0 / 255.0 alpha:1.0] forThemeAttribute:@"text-shadow-color"];
[button setValue:CGSizeMake(0.0, 1.0) forThemeAttribute:@"text-shadow-offset"];
[button setValue:CGSizeMake(32.0, 24.0) forThemeAttribute:@"min-size"];
[button setValue:CGSizeMake(-1.0, 24.0) forThemeAttribute:@"max-size"];
[button addItemWithTitle:@"item"];
return button;
}
+ (CPScroller)themedVerticalScroller
{
var scroller = [[CPScroller alloc] initWithFrame:CGRectMake(0.0, 0.0, 17.0, 170.0)],
@@ -69,11 +200,11 @@
{
var scroller = [[CPScroller alloc] initWithFrame:CGRectMake(0.0, 0.0, 170.0, 17.0)],
trackColor = PatternColor([_CPCibCustomResource imageResourceWithName:"scroller-horizontal-track.png" size:CGSizeMake(1.0, 17.0)]),
disabledTrackColor = PatternColor([_CPCibCustomResource imageResourceWithName:"scroller-vertical-track-disabled.png" size:CGSizeMake(17.0, 1.0)]);
disabledTrackColor = PatternColor([_CPCibCustomResource imageResourceWithName:"scroller-horizontal-track-disabled.png" size:CGSizeMake(17.0, 1.0)]);
[scroller setValue:19.0 forThemeAttribute:@"minimum-knob-length"];
[scroller setValue:CGInsetMake(2.0, 0.0, 0.0, 0.0) forThemeAttribute:@"knob-inset"];
[scroller setValue:CGInsetMake(0.0, -9.0, 0.0, -11.0) forThemeAttribute:@"track-inset"];
[scroller setValue:CGInsetMake(0.0, -10.0, 0.0, -11.0) forThemeAttribute:@"track-inset"];
[scroller setValue:trackColor forThemeAttribute:@"knob-slot-color"];
[scroller setValue:disabledTrackColor forThemeAttribute:@"knob-slot-color" inState:CPThemeStateDisabled];
@@ -200,65 +331,6 @@
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]],
defaultBezelColor = [CPColor colorWithPatternImage:[[CPThreePartImage alloc] initWithImageSlices:
[
[_CPCibCustomResource imageResourceWithName:"default-button-bezel-left.png" size:CGSizeMake(4.0, 24.0)],
[_CPCibCustomResource imageResourceWithName:"default-button-bezel-center.png" size:CGSizeMake(1.0, 24.0)],
[_CPCibCustomResource imageResourceWithName:"default-button-bezel-right.png" size:CGSizeMake(4.0, 24.0)]
]
isVertical:NO]],
defaultHighlightedBezelColor = [CPColor colorWithPatternImage:[[CPThreePartImage alloc] initWithImageSlices:
[
[_CPCibCustomResource imageResourceWithName:"default-button-bezel-highlighted-left.png" size:CGSizeMake(4.0, 24.0)],
[_CPCibCustomResource imageResourceWithName:"default-button-bezel-highlighted-center.png" size:CGSizeMake(1.0, 24.0)],
[_CPCibCustomResource imageResourceWithName:"default-button-bezel-highlighted-right.png" size:CGSizeMake(4.0, 24.0)]
]
isVertical:NO]];
[button setTitle:@"Cancel"];
[button setValue:[CPFont boldSystemFontOfSize:12.0] forThemeAttribute:@"font" inState:CPThemeStateBordered];
[button setValue:[CPColor colorWithCalibratedWhite:79.0 / 255.0 alpha:1.0] forThemeAttribute:@"text-color"];
[button setValue:[CPColor colorWithCalibratedWhite:240.0 / 255.0 alpha:1.0] forThemeAttribute:@"text-shadow-color" inState:CPThemeStateBordered];
[button setValue:CGSizeMake(0.0, 1.0) forThemeAttribute:@"text-shadow-offset" inState:CPThemeStateBordered];
[button setValue:CPLineBreakByTruncatingTail forThemeAttribute:@"line-break-mode"];
[button setValue:bezelColor forThemeAttribute:@"bezel-color" inState:CPThemeStateBordered];
[button setValue:highlightedBezelColor forThemeAttribute:@"bezel-color" inState:CPThemeStateBordered|CPThemeStateHighlighted];
[button setValue:CGInsetMake(0.0, 5.0, 0.0, 5.0) forThemeAttribute:@"content-inset" inState:CPThemeStateBordered];
[button setValue:defaultBezelColor forThemeAttribute:@"bezel-color" inState:CPThemeStateBordered|CPThemeStateDefault];
[button setValue:defaultHighlightedBezelColor forThemeAttribute:@"bezel-color" inState:CPThemeStateBordered|CPThemeStateHighlighted|CPThemeStateDefault];
[button setValue:[CPColor colorWithCalibratedRed:13.0/255.0 green:51.0/255.0 blue:70.0/255.0 alpha:1.0] forThemeAttribute:@"text-color" inState:CPThemeStateDefault];
[button setValue:CGSizeMake(0.0, 24.0) forThemeAttribute:@"min-size"];
[button setValue:CGSizeMake(-1.0, 24.0) forThemeAttribute:@"max-size"];
return button;
}
+ (CPRadioButton)themedRadioButton
{
var button = [[CPRadio alloc] initWithFrame:CGRectMake(0.0, 0.0, 120.0, 17.0)];
@@ -315,56 +387,6 @@
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 forThemeAttribute:@"bezel-color" inState:CPThemeStateBordered];
[button setValue:CGInsetMake(0, 27.0 + 5.0, 0, 5.0) forThemeAttribute:@"content-inset" inState:CPThemeStateBordered];
[button setValue:[CPFont boldSystemFontOfSize:12.0] forThemeAttribute:@"font"];
[button setValue:[CPColor colorWithCalibratedWhite:79.0 / 255.0 alpha:1.0] forThemeAttribute:@"text-color"];
[button setValue:[CPColor colorWithCalibratedWhite:240.0 / 255.0 alpha:1.0] forThemeAttribute:@"text-shadow-color"];
[button setValue:CGSizeMake(0.0, 1.0) forThemeAttribute:@"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 forThemeAttribute:@"bezel-color" inState:CPPopUpButtonStatePullsDown|CPThemeStateBordered];
[button setValue:CGInsetMake(0, 27.0 + 5.0, 0, 5.0) forThemeAttribute:@"content-inset" inState:CPThemeStateBordered];
[button setValue:[CPFont boldSystemFontOfSize:12.0] forThemeAttribute:@"font"];
[button setValue:[CPColor colorWithCalibratedWhite:79.0 / 255.0 alpha:1.0] forThemeAttribute:@"text-color"];
[button setValue:[CPColor colorWithCalibratedWhite:240.0 / 255.0 alpha:1.0] forThemeAttribute:@"text-shadow-color"];
[button setValue:CGSizeMake(0.0, 1.0) forThemeAttribute:@"text-shadow-offset"];
[button addItemWithTitle:@"item"];
return button;
}
+ (CPPopUpButton)themedSegmentedControl
{
var segmentedControl = [[CPSegmentedControl alloc] initWithFrame:CGRectMake(0.0, 0.0, 0.0, 24.0)];
@@ -527,7 +549,7 @@
@end
@implementation AristoHUDThemeDescriptor : CPObject
@implementation AristoHUDThemeDescriptor : BKThemeDescriptor
{
}
@@ -536,7 +558,7 @@
return @"Aristo-HUD";
}
+ (CPColor)themeShowcaseBackgroundColor
+ (CPColor)defaultShowcaseBackgroundColor
{
return [CPColor blackColor];
}
+47 -13
View File
@@ -4,17 +4,16 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns = "http://www.w3.org/1999/xhtml" xml:lang = "en" lang = "en">
<!--
//
// index-debug.html
// A
//
// Created by __Me__ on __Date__.
// Copyright 2008 __MyCompanyName__. All rights reserved.
//
index-debug.html
Aristo
Created by Francisco Tolmasky on May 23, 2009.
Copyright 2009, 280 North, Inc. All rights reserved.
-->
<head>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<title>Hello World</title>
<title>Aristo</title>
<script type = "text/javascript">
OBJJ_MAIN_FILE = "main.j";
@@ -23,14 +22,49 @@
<script src = "Frameworks/Debug/Objective-J/Objective-J.js" type = "text/javascript"></script>
<style type = "text/css">
body{margin:0; padding:0;}
#container {position: absolute; top:50%; left:50%;}
#content {width:800px; text-align:center; margin-left: -400px; height:50px; margin-top:-25px; line-height: 50px;}
#content {font-family: "Helvetica", "Arial", sans-serif; font-size: 18px; color: black; text-shadow: 0px 1px 0px white; }
#loadgraphic {margin-right: 0.2em; margin-bottom:-2px;}
</style>
<!--[if lt IE 7]>
<STYLE type="text/css">
#container { position: relative; top: 50%; }
#content { position: relative;}
</STYLE>
<![endif]-->
</head>
<body>
<div style="position: absolute; left: 50%; top: 50%;">
<center>
<img src = "Frameworks/AppKit/Resources/CPProgressIndicator/CPProgressIndicatorSpinningStyleRegular.gif" style="left: -32px; position: relative; top: -32px;" />
</center>
<body style="">
<div id="loadingcontainer" style=" background-color: #eeeeee; overflow:hidden; width:100%; height:100%; position: absolute; top: 0; left: 0;">
<script type = "text/javascript">
document.write("<div id='container'><p id='content'>" +
"<img id='loadgraphic' width='16' height='16' src='Resources/spinner.gif' /> " +
"Loading Aristo...</p></div>");
</script>
<noscript>
<div id="container">
<div style="width: 440px; padding: 10px 25px 20px 25px; font-family: sans-serif; background-color: #ffffff; position: relative; left: -245px; top: -120px; text-align: center; -moz-border-radius: 20px; -webkit-border-radius: 20px; color: #555555">
<p style="line-height: 1.4em;">JavaScript is required for this site to work correctly but is either disabled or not supported by your browser.</p>
<p style="font-size:120%; padding:10px;"><a href="http://cappuccino.org/noscript">Show me how to enable JavaScript</a></p>
<p style="font-size:80%;">You may want to upgrade to a newer browser while you're at it:</p>
<ul style="margin:0;padding:0; text-align: center; font-size:80%;" >
<li style="display: inline;"><a href="http://www.apple.com/safari/download/">Safari</a></li>
<li style="display: inline;"><a href="http://www.mozilla.com/en-US/firefox/">Firefox</a></li>
<li style="display: inline;"><a href="http://www.google.com/chrome/">Chrome</a></li>
<li style="display: inline;"><a href="http://www.opera.com/download/">Opera</a></li>
<li style="display: inline;"><a href="http://www.microsoft.com/windows/downloads/ie/getitnow.mspx">Internet Explorer</a></li>
</ul>
</div>
</div>
</noscript>
</div>
</body>
</html>
+46 -15
View File
@@ -4,17 +4,16 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns = "http://www.w3.org/1999/xhtml" xml:lang = "en" lang = "en">
<!--
//
// index.html
// A
//
// Created by __Me__ on __Date__.
// Copyright 2008 __MyCompanyName__. All rights reserved.
//
index.html
Aristo
Created by Francisco Tolmasky on May 23, 2009.
Copyright 2009, 280 North, Inc. All rights reserved.
-->
<head>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<title>Hello World</title>
<title>Aristo</title>
<script type = "text/javascript">
OBJJ_MAIN_FILE = "main.j";
@@ -22,16 +21,48 @@
<script src = "Frameworks/Objective-J/Objective-J.js" type = "text/javascript"></script>
<style type = "text/css">
body{margin:0; padding:0;}
#container {position: absolute; top:50%; left:50%;}
#content {width:800px; text-align:center; margin-left: -400px; height:50px; margin-top:-25px; line-height: 50px;}
#content {font-family: "Helvetica", "Arial", sans-serif; font-size: 18px; color: black; text-shadow: 0px 1px 0px white; }
#loadgraphic {margin-right: 0.2em; margin-bottom:-2px;}
</style>
<!--[if lt IE 7]>
<STYLE type="text/css">
#container { position: relative; top: 50%; }
#content { position: relative;}
</STYLE>
<![endif]-->
</head>
<body>
<div style="position: absolute; left: 50%; top: 50%;">
<center>
<img src = "Frameworks/AppKit/Resources/CPProgressIndicator/CPProgressIndicatorSpinningStyleRegular.gif" style="left: -32px; position: relative; top: -32px;" />
</center>
<body style="">
<div id="loadingcontainer" style=" background-color: #eeeeee; overflow:hidden; width:100%; height:100%; position: absolute; top: 0; left: 0;">
<script type = "text/javascript">
document.write("<div id='container'><p id='content'>" +
"<img id='loadgraphic' width='16' height='16' src='Resources/spinner.gif' /> " +
"Loading Aristo...</p></div>");
</script>
<noscript>
<div id="container">
<div style="width: 440px; padding: 10px 25px 20px 25px; font-family: sans-serif; background-color: #ffffff; position: relative; left: -245px; top: -120px; text-align: center; -moz-border-radius: 20px; -webkit-border-radius: 20px; color: #555555">
<p style="line-height: 1.4em;">JavaScript is required for this site to work correctly but is either disabled or not supported by your browser.</p>
<p style="font-size:120%; padding:10px;"><a href="http://cappuccino.org/noscript">Show me how to enable JavaScript</a></p>
<p style="font-size:80%;">You may want to upgrade to a newer browser while you're at it:</p>
<ul style="margin:0;padding:0; text-align: center; font-size:80%;" >
<li style="display: inline;"><a href="http://www.apple.com/safari/download/">Safari</a></li>
<li style="display: inline;"><a href="http://www.mozilla.com/en-US/firefox/">Firefox</a></li>
<li style="display: inline;"><a href="http://www.google.com/chrome/">Chrome</a></li>
<li style="display: inline;"><a href="http://www.opera.com/download/">Opera</a></li>
<li style="display: inline;"><a href="http://www.microsoft.com/windows/downloads/ie/getitnow.mspx">Internet Explorer</a></li>
</ul>
</div>
</div>
</noscript>
</div>
</body>
</html>
</html>
+305 -87
View File
@@ -5,108 +5,344 @@
@import "BKUtilities.j"
var LEFT_PANEL_WIDTH = 176.0;
var BKStateToolbarItemIdentifier = @"BKStateToolbarItemIdentifier",
BKBackgroundColorToolbarItemIdentifier = @"BKBackgroundColorToolbarItemIdentifier";
@implementation BKShowcaseController : CPObject
{
CPArray _themeDescriptorClasses;
CPCollectionView _themesCollectionView;
CPCollectionView _themedObjectsCollectionView;
}
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
{
_themeDescriptorClasses = [BKThemeDescriptor allThemeDescriptorClasses];
var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask],
contentView = [theWindow contentView],
toolbar = [[CPToolbar alloc] initWithIdentifier:@"Toolbar"];
[toolbar setDelegate:self];
[theWindow setToolbar:toolbar];
var contentView = [theWindow contentView],
bounds = [contentView bounds],
themeDescriptorClasses = BKThemeDescriptorClasses();
var tabView = [[CPTabView alloc] initWithFrame:bounds];
[tabView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable];
[contentView addSubview:tabView];
var index = 0,
count = [themeDescriptorClasses count];
for (; index < count; ++index)
splitView = [[CPSplitView alloc] initWithFrame:bounds];
[splitView setIsPaneSplitter:YES];
[splitView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable];
[contentView addSubview:splitView];
// Left Pane
var label = [CPTextField labelWithTitle:@"THEMES"];
[label setFont:[CPFont boldSystemFontOfSize:11.0]];
[label setTextColor:[CPColor colorWithCalibratedRed:92.0 / 255.0 green:110.0 / 255.0 blue:129.0 / 255.0 alpha:1.0]];
[label setTextShadowColor:[CPColor colorWithCalibratedRed:225.0 / 255.0 green:255.0 / 255.0 blue:255.0 / 255.0 alpha:0.7]];
[label setTextShadowOffset:CGSizeMake(0.0, 1.0)];
[label sizeToFit];
[label setFrameOrigin:CGPointMake(5.0, 2.0)];
var themeDescriptorItem = [[CPCollectionViewItem alloc] init];
[themeDescriptorItem setView:[[BKThemeDescriptorCell alloc] init]];
_themesCollectionView = [[CPCollectionView alloc] initWithFrame:CGRectMake(0.0, 0.0, LEFT_PANEL_WIDTH, CGRectGetHeight(bounds))];
[_themesCollectionView setDelegate:self];
[_themesCollectionView setItemPrototype:themeDescriptorItem];
[_themesCollectionView setMinItemSize:CGSizeMake(20.0, 36.0)];
[_themesCollectionView setMaxItemSize:CGSizeMake(10000000.0, 36.0)];
[_themesCollectionView setMaxNumberOfColumns:1];
[_themesCollectionView setContent:_themeDescriptorClasses];
[_themesCollectionView setAutoresizingMask:CPViewWidthSizable];
[_themesCollectionView setVerticalMargin:0.0];
[_themesCollectionView setSelectable:YES];
[_themesCollectionView setFrameOrigin:CGPointMake(0.0, 20.0)];
[_themesCollectionView setAutoresizingMask:CPViewWidthSizable];
var scrollView = [[CPScrollView alloc] initWithFrame:CGRectMake(0.0, 0.0, LEFT_PANEL_WIDTH, CGRectGetHeight(bounds))],
contentView = [scrollView contentView];
[scrollView setAutohidesScrollers:YES];
[scrollView setDocumentView:_themesCollectionView];
[contentView setBackgroundColor:[CPColor colorWithRed:212.0 / 255.0 green:221.0 / 255.0 blue:230.0 / 255.0 alpha:1.0]];
[contentView addSubview:label];
[splitView addSubview:scrollView];
// Right Pane
_themedObjectsCollectionView = [[CPCollectionView alloc] initWithFrame:CGRectMake(0.0, 0.0, CGRectGetWidth(bounds) - LEFT_PANEL_WIDTH - 1.0, 10.0)];
var collectionViewItem = [[CPCollectionViewItem alloc] init];
[collectionViewItem setView:[[BKShowcaseCell alloc] init]];
[_themedObjectsCollectionView setItemPrototype:collectionViewItem];
[_themedObjectsCollectionView setVerticalMargin:20.0];
[_themedObjectsCollectionView setAutoresizingMask:CPViewWidthSizable];
var scrollView = [[CPScrollView alloc] initWithFrame:CGRectMake(LEFT_PANEL_WIDTH + 1.0, 0.0, CGRectGetWidth(bounds) - LEFT_PANEL_WIDTH - 1.0, CGRectGetHeight(bounds))];
[scrollView setHasHorizontalScroller:NO];
[scrollView setAutohidesScrollers:YES];
[scrollView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable];
[scrollView setDocumentView:_themedObjectsCollectionView];
[splitView addSubview:scrollView];
[_themesCollectionView setSelectionIndexes:[CPIndexSet indexSetWithIndex:0]];
[theWindow setFullBridge:YES];
[theWindow makeKeyAndOrderFront:self];
}
- (void)collectionViewDidChangeSelection:(CPCollectionView)aCollectionView
{
var themeDescriptorClass = _themeDescriptorClasses[[[aCollectionView selectionIndexes] firstIndex]],
itemSize = [themeDescriptorClass itemSize];
// Make room for label and apply a minimum size.
itemSize.width = MAX(100.0, itemSize.width + 20.0);
itemSize.height = MAX(100.0, itemSize.height + 30.0);
[_themedObjectsCollectionView setMinItemSize:itemSize];
[_themedObjectsCollectionView setMaxItemSize:itemSize];
[_themedObjectsCollectionView setContent:[themeDescriptorClass themedObjectTemplates]];
[BKShowcaseCell setBackgroundColor:[themeDescriptorClass showcaseBackgroundColor]];
}
- (CPArray)toolbarAllowedItemIdentifiers:(CPToolbar)aToolbar
{
return [CPToolbarSpaceItemIdentifier, CPToolbarFlexibleSpaceItemIdentifier, BKBackgroundColorToolbarItemIdentifier, BKStateToolbarItemIdentifier];
}
- (CPArray)toolbarDefaultItemIdentifiers:(CPToolbar)aToolbar
{
return [CPToolbarFlexibleSpaceItemIdentifier, BKBackgroundColorToolbarItemIdentifier, BKStateToolbarItemIdentifier];
}
- (CPToolbarItem)toolbar:(CPToolbar)aToolbar itemForItemIdentifier:(CPString)anItemIdentifier willBeInsertedIntoToolbar:(BOOL)aFlag
{
var toolbarItem = [[CPToolbarItem alloc] initWithItemIdentifier:anItemIdentifier];
[toolbarItem setTarget:self];
if (anItemIdentifier === BKStateToolbarItemIdentifier)
{
var theClass = themeDescriptorClasses[index],
item = [[CPTabViewItem alloc] initWithIdentifier:[theClass themeName]],
templates = BKThemeObjectTemplatesForClass(theClass),
templatesCount = [templates count],
viewTemplates = [],
itemSize = CGSizeMake(0.0, 0.0);
while (templatesCount--)
{
var template = templates[templatesCount],
object = [template valueForKey:@"themedObject"];
var popUpButton = [CPPopUpButton buttonWithTitle:@"Enabled"];
if ([object isKindOfClass:[CPView class]])
{
var size = [object frame].size,
labelWidth = [[template valueForKey:@"label"] sizeWithFont:[CPFont boldSystemFontOfSize:12.0]].width + 20.0;
[popUpButton addItemWithTitle:@"Disabled"];
if (size.width > itemSize.width)
itemSize.width = size.width;
if (labelWidth > itemSize.width)
itemSize.width = labelWidth;
if (size.height > itemSize.height)
itemSize.height = size.height;
[viewTemplates addObject:template];
}
}
itemSize.width += 20.0;
itemSize.height += 30.0;
[toolbarItem setView:popUpButton];
[toolbarItem setTarget:nil];
[toolbarItem setAction:@selector(changeState:)];
[toolbarItem setLabel:@"State"];
var collectionView = [[CPCollectionView alloc] initWithFrame:CGRectMakeZero()],
collectionViewItem = [[CPCollectionViewItem alloc] init];
var width = CGRectGetWidth([popUpButton frame]);
var backgroundColor = nil;
[toolbarItem setMinSize:CGSizeMake(width + 20.0, 32.0)];
[toolbarItem setMaxSize:CGSizeMake(width + 20.0, 32.0)];
}
else if (BKBackgroundColorToolbarItemIdentifier)
{
var popUpButton = [CPPopUpButton buttonWithTitle:@"Light Checkers"];
if ([theClass respondsToSelector:@selector(themeShowcaseBackgroundColor)])
backgroundColor = [theClass themeShowcaseBackgroundColor];
[popUpButton addItemWithTitle:@"Dark Checkers"];
[popUpButton addItemWithTitle:@"Window Background Color"];
[popUpButton addItemWithTitle:@"White"];
[popUpButton addItemWithTitle:@"Black"];
[popUpButton addItemWithTitle:@"More Choices..."];
[collectionViewItem setView:[[BKShowcaseCell alloc] initWithShowcaseBackgroundColor:backgroundColor]];
var itemArray = [popUpButton itemArray];
[collectionView setItemPrototype:collectionViewItem];
[collectionView setMinItemSize:itemSize];
[collectionView setMaxItemSize:itemSize];
[collectionView setVerticalMargin:5.0];
[collectionView setContent:viewTemplates];
[item setLabel:[theClass themeName]];
[item setView:collectionView];
[itemArray[0] setRepresentedObject:[BKThemeDescriptor lightCheckersColor]];
[itemArray[1] setRepresentedObject:[BKThemeDescriptor darkCheckersColor]];
[itemArray[2] setRepresentedObject:[BKThemeDescriptor windowBackgroundColor]];
[itemArray[3] setRepresentedObject:[CPColor whiteColor]];
[itemArray[4] setRepresentedObject:[CPColor blackColor]];
[tabView addTabViewItem:item];
[toolbarItem setView:popUpButton];
[toolbarItem setTarget:nil];
[toolbarItem setAction:@selector(changeColor:)];
[toolbarItem setLabel:@"Background Color"];
var width = CGRectGetWidth([popUpButton frame]);
[toolbarItem setMinSize:CGSizeMake(width, 32.0)];
[toolbarItem setMaxSize:CGSizeMake(width, 32.0)];
}
[theWindow orderFront:self];
return toolbarItem;
}
- (BKThemeDescriptor)selectedThemeDescriptor
{
return _themeDescriptorClasses[[[_themesCollectionView selectionIndexes] firstIndex]];
}
- (void)changeState:(id)aSender
{
var themedObjectTemplates = [[self selectedThemeDescriptor] themedObjectTemplates],
count = [themedObjectTemplates count];
while (count--)
{
var themedObject = [themedObjectTemplates[count] valueForKey:@"themedObject"];
if ([themedObject respondsToSelector:@selector(setEnabled:)])
[themedObject setEnabled:[aSender title] === @"Enabled" ? YES : NO];
}
}
- (void)changeColor:(id)aSender
{
var color = nil;
if ([aSender isKindOfClass:[CPColorPanel class]])
color = [aSender color];
else
{
if ([aSender titleOfSelectedItem] === @"More Choices...")
{
[aSender addItemWithTitle:@"Other"];
[aSender selectItemWithTitle:@"Other"];
[CPApp orderFrontColorPanel:self];
}
else
{
color = [[aSender selectedItem] representedObject];
[aSender removeItemWithTitle:@"Other"];
}
}
if (color)
{
[[self selectedThemeDescriptor] setShowcaseBackgroundColor:color];
[BKShowcaseCell setBackgroundColor:color];
}
}
@end
var SelectionColor = nil;
@implementation BKThemeDescriptorCell : CPView
{
CPTextField _label;
}
+ (CPImage)selectionColor
{
if (!SelectionColor)
SelectionColor = [CPColor colorWithPatternImage:[[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:[BKThemeDescriptorCell class]] pathForResource:@"selection.png"] size:CGSizeMake(1.0, 36.0)]];
return SelectionColor;
}
- (void)setRepresentedObject:(id)aThemeDescriptor
{
if (!_label)
{
_label = [CPTextField labelWithTitle:@"hello"];
[_label setFont:[CPFont systemFontOfSize:11.0]];
[_label setFrame:CGRectMake(10.0, 0.0, CGRectGetWidth([self bounds]) - 20.0, CGRectGetHeight([self bounds]))];
[_label setVerticalAlignment:CPCenterVerticalTextAlignment];
[_label setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable];
[self addSubview:_label];
}
[_label setStringValue:[aThemeDescriptor themeName] + " (" + [[aThemeDescriptor themedObjectTemplates] count] + ")"];
}
- (void)setSelected:(BOOL)isSelected
{
[self setBackgroundColor:isSelected ? [[self class] selectionColor] : nil];
[_label setTextShadowOffset:isSelected ? CGSizeMake(0.0, 1.0) : CGSizeMakeZero()];
[_label setTextShadowColor:isSelected ? [CPColor blackColor] : nil];
[_label setFont:isSelected ? [CPFont boldSystemFontOfSize:11.0] : [CPFont systemFontOfSize:11.0]];
[_label setTextColor:isSelected ? [CPColor whiteColor] : [CPColor blackColor]];
}
@end
var ShowcaseCellBackgroundColor = nil;
var BKShowcaseCellBackgroundColorDidChangeNotification = @"BKShowcaseCellBackgroundColorDidChangeNotification";
@implementation BKShowcaseCell : CPView
{
CPColor _showcaseBackgroundColor;
CPView _backgroundView;
CPView _view;
CPTextField _label;
}
- (id)initWithShowcaseBackgroundColor:(CPColor)aColor
+ (void)setBackgroundColor:(CPColor)aColor
{
if (ShowcaseCellBackgroundColor === aColor)
return;
ShowcaseCellBackgroundColor = aColor;
[[CPNotificationCenter defaultCenter]
postNotificationName:BKShowcaseCellBackgroundColorDidChangeNotification
object:nil];
}
+ (CPColor)backgroundColor
{
return ShowcaseCellBackgroundColor;
}
- (id)init
{
self = [super init];
if (self)
_showcaseBackgroundColor = aColor;
[[CPNotificationCenter defaultCenter]
addObserver:self
selector:@selector(showcaseBackgroundDidChange:)
name:BKShowcaseCellBackgroundColorDidChangeNotification
object:nil];
return self;
}
- (id)initWithCoder:(CPCoder)aCoder
{
self = [super initWithCoder:aCoder];
if (self)
[[CPNotificationCenter defaultCenter]
addObserver:self
selector:@selector(showcaseBackgroundDidChange:)
name:BKShowcaseCellBackgroundColorDidChangeNotification
object:nil];
return self;
}
- (void)showcaseBackgroundDidChange:(CPNotification)aNotification
{
[_backgroundView setBackgroundColor:[BKShowcaseCell backgroundColor]];
}
- (void)setSelected:(BOOL)isSelected
{
}
@@ -116,26 +352,24 @@
if (!_label)
{
_label = [[CPTextField alloc] initWithFrame:CGRectMakeZero()];
[_label setAlignment:CPCenterTextAlignment];
[_label setAutoresizingMask:CPViewMinYMargin | CPViewWidthSizable];
[_label setFont:[CPFont boldSystemFontOfSize:12.0]];
[_label setFont:[CPFont boldSystemFontOfSize:11.0]];
[self addSubview:_label];
}
[_label setStringValue:[anObject valueForKey:@"label"]];
[_label sizeToFit];
[_label setFrame:CGRectMake(0.0, CGRectGetHeight([self bounds]) - CGRectGetHeight([_label frame]),
CGRectGetWidth([self bounds]), CGRectGetHeight([_label frame]))];
if (!_backgroundView)
{
_backgroundView = [[CPView alloc] init];
[_backgroundView setBackgroundColor:_showcaseBackgroundColor];
[self addSubview:_backgroundView];
}
@@ -153,23 +387,7 @@
(CGRectGetHeight([_backgroundView bounds]) - CGRectGetHeight([_view frame])) / 2.0)];
[_backgroundView addSubview:_view];
}
- (id)initWithCoder:(CPCoder)aCoder
{
self = [super initWithCoder:aCoder];
if (self)
_showcaseBackgroundColor = [aCoder decodeObjectForKey:@"showcase-background-color"];
return self
}
- (void)encodeWithCoder:(CPCoder)aCoder
{
[super encodeWithCoder:aCoder];
[aCoder encodeObject:_showcaseBackgroundColor forKey:@"showcase-background-color"];
[_backgroundView setBackgroundColor:[BKShowcaseCell backgroundColor]];
}
@end
+200
View File
@@ -0,0 +1,200 @@
@import <Foundation/CPObject.j>
var ItemSizes = { },
ThemedObjects = { },
BackgroundColors = { },
LightCheckersColor = nil,
DarkCheckersColor = nil,
WindowBackgroundColor = nil;
@implementation BKThemeDescriptor : CPObject
{
}
+ (CPArray)allThemeDescriptorClasses
{
// Grab Theme Descriptor Classes.
var themeDescriptorClasses = [];
for (candidate in window)
{
var theClass = objj_getClass(candidate),
theClassName = class_getName(theClass);
if (theClassName === "BKThemeDescriptor")
continue;
var index = theClassName.indexOf("ThemeDescriptor");
if ((index >= 0) && (index === theClassName.length - "ThemeDescriptor".length))
themeDescriptorClasses.push(theClass);
}
[themeDescriptorClasses sortUsingSelector:@selector(compare:)];
return themeDescriptorClasses;
}
+ (CPColor)lightCheckersColor
{
if (!LightCheckersColor)
LightCheckersColor = [CPColor colorWithPatternImage:[[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:[BKThemeDescriptor class]] pathForResource:@"light-checkers.png"] size:CGSizeMake(12.0, 12.0)]];
return LightCheckersColor;
}
+ (CPColor)darkCheckersColor
{
if (!DarkCheckersColor)
DarkCheckersColor = [CPColor colorWithPatternImage:[[CPImage alloc] initWithContentsOfFile:[[CPBundle bundleForClass:[BKThemeDescriptor class]] pathForResource:@"dark-checkers.png"] size:CGSizeMake(12.0, 12.0)]];
return DarkCheckersColor;
}
+ (CPColor)windowBackgroundColor
{
return [_CPStandardWindowView bodyBackgroundColor];
}
+ (CPColor)defaultShowcaseBackgroundColor
{
return [self lightCheckersColor];
}
+ (CPColor)showcaseBackgroundColor
{
var className = [self className];
if (!BackgroundColors[className])
BackgroundColors[className] = [self defaultShowcaseBackgroundColor];
return BackgroundColors[className];
}
+ (void)setShowcaseBackgroundColor:(CPColor)aColor
{
BackgroundColors[[self className]] = aColor;
}
+ (CGSize)itemSize
{
var className = [self className];
if (!ItemSizes[className])
[self calculateThemedObjectTemplates];
return CGSizeMakeCopy(ItemSizes[className]);
}
+ (CPArray)themedObjectTemplates
{
var className = [self className];
if (!ThemedObjects[className])
[self calculateThemedObjectTemplates];
return ThemedObjects[className];
}
+ (void)calculateThemedObjectTemplates
{
var templates = [],
itemSize = CGSizeMake(0.0, 0.0),
methods = class_copyMethodList([self class].isa),
index = 0,
count = [methods count];
for (; index < count; ++index)
{
var method = methods[index],
selector = method_getName(method);
if (selector.indexOf("themed") !== 0)
continue;
var impl = method_getImplementation(method),
object = impl(self, selector);
if (!object)
continue;
var template = [[BKThemeObjectTemplate alloc] init];
[template setValue:object forKey:@"themedObject"];
[template setValue:BKLabelFromIdentifier(selector) forKey:@"label"];
[templates addObject:template];
if ([object isKindOfClass:[CPView class]])
{
var size = [object frame].size,
labelWidth = [[template valueForKey:@"label"] sizeWithFont:[CPFont boldSystemFontOfSize:12.0]].width + 20.0;
if (size.width > itemSize.width)
itemSize.width = size.width;
if (labelWidth > itemSize.width)
itemSize.width = labelWidth;
if (size.height > itemSize.height)
itemSize.height = size.height;
}
}
var className = [self className];
ItemSizes[className] = itemSize;
ThemedObjects[className] = templates;
}
+ (int)compare:(BKThemeDescriptor)aThemeDescriptor
{
return [[self themeName] compare:[aThemeDescriptor themeName]];
}
@end
function BKLabelFromIdentifier(anIdentifier)
{
var string = anIdentifier.substr("themed".length);
index = 0,
count = string.length,
label = "",
lastCapital = null,
isLeadingCapital = YES;
for (; index < count; ++index)
{
var character = string.charAt(index),
isCapital = /^[A-Z]/.test(character);
if (isCapital)
{
if (!isLeadingCapital)
{
if (lastCapital === null)
label += ' ' + character.toLowerCase();
else
label += character;
}
lastCapital = character;
}
else
{
if (isLeadingCapital && lastCapital !== null)
label += lastCapital;
label += character;
lastCapital = null;
isLeadingCapital = NO;
}
}
return label;
}
-91
View File
@@ -52,94 +52,3 @@
}
@end
function BKThemeDescriptorClasses()
{
// Grab Theme Descriptor Classes.
var themeDescriptorClasses = [];
for (candidate in window)
{
var theClass = objj_getClass(candidate),
theClassName = class_getName(theClass),
index = theClassName.indexOf("ThemeDescriptor");
if ((index >= 0) && (index === theClassName.length - "ThemeDescriptor".length))
themeDescriptorClasses.push(theClass);
}
return themeDescriptorClasses;
}
function BKThemeObjectTemplatesForClass(aClass)
{
var templates = [],
methods = class_copyMethodList(aClass.isa),
count = [methods count];
while (count--)
{
var method = methods[count],
selector = method_getName(method);
if (selector.indexOf("themed") === 0)
{
var impl = method_getImplementation(method),
object = impl(aClass, selector);
if (object)
{
var template = [[BKThemeObjectTemplate alloc] init];
[template setValue:object forKey:@"themedObject"];
[template setValue:BKLabelFromIdentifier(selector) forKey:@"label"];
[templates addObject:template];
}
}
}
return templates;
}
function BKLabelFromIdentifier(anIdentifier)
{
var string = anIdentifier.substr("themed".length);
index = 0,
count = string.length,
label = "",
lastCapital = null,
isLeadingCapital = YES;
for (; index < count; ++index)
{
var character = string.charAt(index),
isCapital = /^[A-Z]/.test(character);
if (isCapital)
{
if (!isLeadingCapital)
{
if (lastCapital === null)
label += ' ' + character.toLowerCase();
else
label += character;
}
lastCapital = character;
}
else
{
if (isLeadingCapital && lastCapital !== null)
label += lastCapital;
label += character;
lastCapital = null;
isLeadingCapital = NO;
}
}
return label;
}
+1
View File
@@ -1,3 +1,4 @@
@import "BKShowcaseController.j"
@import "BKThemeDescriptor.j"
@import "BKUtilities.j"
Binary file not shown.

After

Width:  |  Height:  |  Size: 131 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

+2 -2
View File
@@ -53,7 +53,7 @@ function main()
objj_import(descriptorFiles, YES, function()
{
var themeDescriptorClasses = BKThemeDescriptorClasses(),
var themeDescriptorClasses = [BKThemeDescriptor allThemeDescriptorClasses],
count = [themeDescriptorClasses count];
while (count--)
@@ -63,7 +63,7 @@ function main()
[themeTemplate setValue:[theClass themeName] forKey:@"name"];
var objectTemplates = BKThemeObjectTemplatesForClass(theClass),
var objectTemplates = [theClass themedObjectTemplates],
data = cibDataFromTopLevelObjects(objectTemplates.concat([themeTemplate])),
temporaryCibFile = Packages.java.io.File.createTempFile("temp", ".cib"),
temporaryCibFilePath = String(temporaryCibFile.getAbsolutePath());
+3 -11
View File
@@ -31,7 +31,6 @@ $TOOLS_DOWNLOAD_INSTALLER = File.join($TOOLS_DOWNLOAD, 'install-tools'
$STARTER_README = File.join('Tools', 'READMEs', 'STARTER-README')
$STARTER_DOWNLOAD = File.join($BUILD_DIR, 'Cappuccino', 'Starter')
$STARTER_DOWNLOAD_APPLICATION = File.join($STARTER_DOWNLOAD, 'NewApplication')
$STARTER_DOWNLOAD_NIBAPPLICATION = File.join($STARTER_DOWNLOAD, 'NibApplication')
$STARTER_DOWNLOAD_README = File.join($STARTER_DOWNLOAD, 'README')
task :downloads => [:starter_download, :tools_download]
@@ -60,7 +59,7 @@ end
task :tools_download => [$TOOLS_DOWNLOAD_ENV, $TOOLS_DOWNLOAD_EDITORS, $TOOLS_DOWNLOAD_README, $TOOLS_DOWNLOAD_INSTALLER, :objj_gem]
task :starter_download => [$STARTER_DOWNLOAD_NIBAPPLICATION, $STARTER_DOWNLOAD_APPLICATION, $STARTER_DOWNLOAD_README]
task :starter_download => [$STARTER_DOWNLOAD_APPLICATION, $STARTER_DOWNLOAD_README]
task :deploy => [:downloads, :docs] do
#copy the docs into the starter pack
@@ -89,15 +88,8 @@ file_d $STARTER_DOWNLOAD_APPLICATION => [$TOOLS_DOWNLOAD_ENV] do
mkdir_p($STARTER_DOWNLOAD)
system %{capp gen #{$STARTER_DOWNLOAD_APPLICATION} -t Application --noconfig }
end
file_d $STARTER_DOWNLOAD_NIBAPPLICATION => [$TOOLS_DOWNLOAD_ENV] do
ENV['PATH'] = "#{File.join($TOOLS_DOWNLOAD_ENV, 'bin')}:#{ENV['PATH']}"
rm_rf($STARTER_DOWNLOAD_NIBAPPLICATION)
mkdir_p($STARTER_DOWNLOAD)
system %{capp gen #{$STARTER_DOWNLOAD_NIBAPPLICATION} -t NibApplication --noconfig }
# No tools means no objective-j gem
rm(File.join($STARTER_DOWNLOAD_APPLICATION, 'Rakefile'))
end
+2 -3
View File
@@ -4,11 +4,10 @@ Included you should find the following:
1. Documentation
2. NewApplication
3. NibApplication
4. README
NewApplication is a stand alone Cappuccino application that you can use as a template to start building your own apps. To get started, just open up NewApplication/index.html in your favorite web browser. A great place to go from there is to read the "Downloading and Getting Started" tutorial found at http://cappuccino.org/learn/tutorials/starter-tutorial.php. This will walk you through these initial steps as well as getting you to do a little coding. If you want to debug your application, try running it with index-debug.html instead, which should make it easier.
NibApplication is a stand alone Cappuccino application that uses .cib files for its interface. You will find two files of interest in the Resources folder: MainMenu.xib and MainMenu.cib. To edit the interface, open MainMenu.xib in Interface Builder. When you are done, run the nib2cib command on MainMenu.xib to generate a new MainMenu.cib file, and refresh your application.
You can build your entire application right from either of these sample projects, but if you want to dig a little deeper, you can also download the Tools package found at http://cappuccino.org/download/. This will set you up with some great additions like syntax modules for certain text editors and build tools to get extra performance.
NOTE: If you'd like to make a nib-based application, you will need to download the Tools package from cappuccino.org/download
@@ -6,10 +6,10 @@
* Copyright __project.year__, __organization.name__ All rights reserved.
*/
@import <Foundation/CPObject.j>
@import <BlendKit/BKThemeDescriptor.j>
@implementation __project.nameasidentifier__ThemeDescriptor : CPObject
@implementation __project.nameasidentifier__ThemeDescriptor : BKThemeDescriptor
{
}