Skip to content

Commit

Permalink
Merge branch 'master' of git@github.com:280north/cappuccino
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Robinson committed May 29, 2009
2 parents 5446e1f + d4b9c4c commit 318d045
Show file tree
Hide file tree
Showing 53 changed files with 1,163 additions and 468 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
.DS_Store
Frameworks
Build
Demos
Aristo
WebSite
1 change: 1 addition & 0 deletions AppKit/AppKit.j
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
@import "CPImageView.j"
@import "CPMenu.j"
@import "CPMenuItem.j"
@import "CPOpenPanel.j"
@import "CPPanel.j"
@import "CPPasteboard.j"
@import "CPPopUpButton.j"
Expand Down
7 changes: 6 additions & 1 deletion AppKit/CPApplication.j
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,11 @@ CPRunContinuesResponse = -1002;
_mainMenu = aMenu;
}

- (void)orderFrontColorPanel:(id)aSender
{
[[CPColorPanel sharedColorPanel] orderFront:self];
}

- (void)orderFrontStandardAboutPanel:(id)aSender
{
[self orderFrontStandardAboutPanelWithOptions:nil];
Expand Down Expand Up @@ -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];

Expand Down
4 changes: 2 additions & 2 deletions AppKit/CPButton.j
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ CPButtonStateMixed = CPThemeState("mixed");

- (void)setButtonType:(CPButtonType)aButtonType
{
switch (buttonType)
switch (aButtonType)
{
case CPMomentaryLightButton: [self setHighlightsBy:CPChangeBackgroundCellMask];
[self setShowsStateBy:CPNoCellMask];
Expand All @@ -390,7 +390,7 @@ CPButtonStateMixed = CPThemeState("mixed");
[self setShowsStateBy:CPChangeBackgroundCellMask];
break;

case CPToggleButton: [self setHighlightsBy:CPPushInCellMask | NSContentsCellMask];
case CPToggleButton: [self setHighlightsBy:CPPushInCellMask | CPContentsCellMask];
[self setShowsStateBy:CPContentsCellMask];
break;

Expand Down
9 changes: 9 additions & 0 deletions AppKit/CPColor.j
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,15 @@ url("data:image/png;base64,BASE64ENCODEDDATA") // if there is a pattern image

@end

@implementation CPColor (Debugging)

+ (CPColor)randomColor
{
return [CPColor colorWithRed:RAND() green:RAND() blue:RAND() alpha:1.0];
}

@end

var CPColorComponentsKey = @"CPColorComponentsKey",
CPColorPatternImageKey = @"CPColorPatternImageKey";

Expand Down
9 changes: 3 additions & 6 deletions AppKit/CPCompatibility.j
Original file line number Diff line number Diff line change
Expand Up @@ -119,22 +119,19 @@ else if (USER_AGENT.indexOf("KHTML") != -1) // Must follow WebKit check.
}

// Gecko
else if (USER_AGENT.indexOf("Gecko") != -1) // Must follow KHTML check.
else if (USER_AGENT.indexOf("Gecko") !== -1) // Must follow KHTML check.
{
PLATFORM_ENGINE = CPGeckoBrowserEngine;

PLATFORM_FEATURES |= CPJavaScriptCanvasDrawFeature;

var index = USER_AGENT.indexOf("Firefox"),
version = (index == -1) ? 2.0 : parseFloat(USER_AGENT.substring(index + "Firefox".length + 1));
version = (index === -1) ? 2.0 : parseFloat(USER_AGENT.substring(index + "Firefox".length + 1));

if (version >= 3.0)
PLATFORM_FEATURES |= CPCSSRGBAFeature;

var geckoIndex = USER_AGENT.indexOf("Gecko"),
geckoVersion = (geckoIndex === -1) ? 0.0 : parseFloat(USER_AGENT.substring(geckoIndex + "Gecko".length + 1, USER_AGENT.indexOf(' ', geckoIndex)));

if (version < 20061028)
if (version < 3.0)
PLATFORM_FEATURES |= CPJavaScriptMouseWheelValues_8_15;
}

Expand Down
63 changes: 63 additions & 0 deletions AppKit/CPOpenPanel.j
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@

@import <AppKit/CPPanel.j>
#include "Platform/Platform.h"

var SharedOpenPanel = nil;

@implementation CPOpenPanel : CPPanel
{
CPArray _files;
BOOL _canChooseFiles @accessors(property=canChooseFiles);
BOOL _canChooseDirectories @accessors(property=canChooseDirectories);
BOOL _allowsMultipleSelection @accessors(property=allowsMultipleSelection);
}

+ (id)openPanel
{
if (!SharedOpenPanel)
SharedOpenPanel = [[CPOpenPanel alloc] init];

return SharedOpenPanel;
}

- (id)init
{
if (self = [super init])
{
_files = [];
_canChooseFiles = YES;
}

return self;
}

- (void)filenames
{
return _files;
}

- (unsigned)runModalForDirectory:(CPString)absoluteDirectoryPath file:(CPString)filename types:(CPArray)fileTypes
{
#if PLATFORM(DOM)
console.log("0 "+Titanium);
console.log("1 "+window.Titanium);
if (window.Titanium)
{
_files = Titanium.Desktop.openFiles({
path:absoluteDirectoryPath,
types:fileTypes,
multiple:_allowsMultipleSelection,
filename:filename,
directories:_canChooseDirectories,
files:_canChooseFiles
});
}
#endif
}

- (unsigned)runModalForTypes:(CPArray)fileTypes
{alert("HERE");
[self runModalForDirectory:"/" file:nil types:fileTypes];
}

@end
2 changes: 1 addition & 1 deletion AppKit/CPPopUpButton.j
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ CPPopUpButtonStatePullsDown = CPThemeState("pulls-down");
{
if ([self title] === aTitle)
return;

if ([self pullsDown])
{
var items = [_menu itemArray];
Expand Down
15 changes: 14 additions & 1 deletion AppKit/CPTextField.j
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,20 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
}

/*!
Adjusts the text field's size in the application.
Size to fit has two behavior, depending on if the receiver is an editable text field or not.
For non-editable text fields (typically, a label), sizeToFit will change the frame of the
receiver to perfectly fit the current text in stringValue in the current font, and respecting
the current theme values for content-inset, min-size, and max-size.
For editable text fields, sizeToFit will ONLY change the HEIGHT of the text field. It will not
change the width of the text field. You can use setFrameSize: with the current height to set the
width, and you can get the size of a string with [CPString sizeWithFont:].
The logic behind this decision is that most of the time you do not know what content will be placed
in an editable text field, so you want to just choose a fixed width and leave it at that size.
However, since you don't know how tall it needs to be if you change the font, sizeToFit will still be
useful for making the textfield an appropriate height.
*/

- (void)sizeToFit
Expand Down
3 changes: 3 additions & 0 deletions AppKit/CPView.j
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion AppKit/Platform/DOM/CPDOMWindowBridge.j
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,7 @@ var CTRL_KEY_CODE = 17;
{
var windows = [layers objectForKey:levels[levelCount]]._windows,
windowCount = windows.length;

while (windowCount--)
[windows[windowCount] resizeWithOldBridgeSize:oldSize];
}
Expand Down
2 changes: 1 addition & 1 deletion AppKit/Platform/DOM/CPDOMWindowLayer.j
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
aWindow._isVisible = YES;

if ([aWindow isFullBridge])
[aWindow setFrame:[aWindow._bridge contentBounds]];
[aWindow setFrame:[aWindow._bridge visibleFrame]];
}
}

Expand Down
6 changes: 5 additions & 1 deletion AppKit/Themes/Aristo/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@
<key>CPApplicationDelegateClass</key>
<string>BKShowcaseController</string>
<key>CPBundleName</key>
<string>A</string>
<string>Aristo</string>
<key>BKLearnMoreURL</key>
<string>http://cappuccino.org/aristo</string>
<key>BKLearnMoreButtonTitle</key>
<string>Aristo Home Page</string>
<key>CPPrincipalClass</key>
<string>CPApplication</string>
</dict>
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit 318d045

Please sign in to comment.