Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
44f3abf262 | ||
|
|
8c09af5013 | ||
|
|
0781e932c6 | ||
|
|
3cee00323c | ||
|
|
b1f6f3ddfa | ||
|
|
7147266ddf | ||
|
|
357212bff7 | ||
|
|
ed4fc3b20f | ||
|
|
7e8b71dd52 | ||
|
|
267f00bfe1 | ||
|
|
8f90dbce99 | ||
|
|
00485dba89 | ||
|
|
8fd4f5e4b6 | ||
|
|
e7e69b3fd4 | ||
|
|
2463c1dc05 | ||
|
|
bc590286f2 | ||
|
|
8c83816ec8 | ||
|
|
699069ce8f | ||
|
|
ec0cd22c1d | ||
|
|
8da3a8866d | ||
|
|
21f6fdff48 | ||
|
|
ed82a1fc87 | ||
|
|
1fa143453d | ||
|
|
1240bab7ed | ||
|
|
4af29d83d7 | ||
|
|
6aed29af91 | ||
|
|
37f1f50000 | ||
|
|
a93654c66b | ||
|
|
0d2dd94c81 | ||
|
|
c2f97e9aa3 | ||
|
|
e04bf6de95 | ||
|
|
38499c006a | ||
|
|
80cac38682 | ||
|
|
2b16d36aa2 | ||
|
|
dc9d49a12c | ||
|
|
03c81dfa9c | ||
|
|
b096e5dd0a | ||
|
|
7ae519145f | ||
|
|
592c3c1652 | ||
|
|
e940f294a6 | ||
|
|
759de8f45f | ||
|
|
c92c6c37f7 | ||
|
|
f425601043 | ||
|
|
68ba089a26 | ||
|
|
5ff7169546 | ||
|
|
7365a95b4d | ||
|
|
788427ec09 | ||
|
|
01ed8ad583 | ||
|
|
f516ba7a7d | ||
|
|
ab5603bd5a | ||
|
|
5c560e82b3 | ||
|
|
263a94af18 | ||
|
|
9d1cf360b6 | ||
|
|
60f664a5c2 | ||
|
|
a1c7aa7790 | ||
|
|
a29096ca5c | ||
|
|
0ef64f4091 | ||
|
|
945deeba60 | ||
|
|
aa775675b5 | ||
|
|
db76044880 | ||
|
|
edc58e358b | ||
|
|
1133efb3f1 | ||
|
|
d524accc98 | ||
|
|
543f91dd6e | ||
|
|
9848dabfa8 | ||
|
|
bc59efc3ba | ||
|
|
9af63ca32f | ||
|
|
eb8a566ae8 | ||
|
|
38eb3e489e | ||
|
|
97f7eaf499 | ||
|
|
d3356eea5c | ||
|
|
7a57bd73c3 | ||
|
|
b517c93190 | ||
|
|
7a9fded2e4 | ||
|
|
8ed2096de7 | ||
|
|
791a1eb130 | ||
|
|
9dab10ce19 | ||
|
|
fd95c2ced6 | ||
|
|
c32fef0eb9 | ||
|
|
c77b35c07b | ||
|
|
4303ea3584 | ||
|
|
ddb6f63ea7 | ||
|
|
06985a5b6c | ||
|
|
4841f209b3 | ||
|
|
7e6ed01dd2 | ||
|
|
b7e41894af | ||
|
|
5dfcfc32e7 | ||
|
|
fb74541796 | ||
|
|
2f7b29593e | ||
|
|
7ce6b1cfda | ||
|
|
7ad1d14d15 | ||
|
|
444c30e389 | ||
|
|
06fc31c33b | ||
|
|
4c58077cee | ||
|
|
25253942a6 | ||
|
|
4d75b47713 | ||
|
|
63c500c444 | ||
|
|
208c3fea35 | ||
|
|
3201b5921c | ||
|
|
e92a7825bf | ||
|
|
65b1fb2bae | ||
|
|
98df7e1eb8 | ||
|
|
86079af3b1 | ||
|
|
eeab0cf1b2 | ||
|
|
ac16b7ad0b | ||
|
|
e9b87d7acc | ||
|
|
b37893d9bb | ||
|
|
6f4ecdfbd9 | ||
|
|
697921b486 | ||
|
|
3c01d4aa8b | ||
|
|
a1eafdfbd8 | ||
|
|
2cfb171b38 | ||
|
|
2742e3d77b | ||
|
|
5488d8f633 | ||
|
|
35c7155983 | ||
|
|
b90a8a58fd | ||
|
|
85fa2011b2 | ||
|
|
063b05d964 | ||
|
|
ac90a0c0fb | ||
|
|
3efe33d2fb | ||
|
|
3e5ea97768 | ||
|
|
a970657312 | ||
|
|
240615c71b | ||
|
|
d3f4e205af | ||
|
|
cc63c239f6 | ||
|
|
4b82cae638 | ||
|
|
68c8d15ed4 | ||
|
|
021f5bb030 | ||
|
|
fc5d9a413d | ||
|
|
e09acb9208 | ||
|
|
2f57404c9c | ||
|
|
a29bdf0cf4 | ||
|
|
c29597689c | ||
|
|
797fbca6d4 | ||
|
|
6ed4b289d8 | ||
|
|
7dd07b2f5b | ||
|
|
b371fda0a5 | ||
|
|
3bdb11d804 | ||
|
|
199b777dcc | ||
|
|
70ccec2e82 | ||
|
|
a195624549 | ||
|
|
e417eba6bd | ||
|
|
210bb3e5c9 | ||
|
|
140ae354a1 | ||
|
|
2451b08306 | ||
|
|
04d33e772f | ||
|
|
3592fd8dae | ||
|
|
889e8d3b6e | ||
|
|
908fc67f96 | ||
|
|
c9a645285a | ||
|
|
3655724810 | ||
|
|
866047c116 | ||
|
|
8912d31bec | ||
|
|
1e65342814 | ||
|
|
c7ca352205 | ||
|
|
4b1ce8bc0b | ||
|
|
422e940bc7 | ||
|
|
76e2a2b8ca | ||
|
|
e3565bdc7d | ||
|
|
86f01cfaec | ||
|
|
6e4007adc0 | ||
|
|
8c6913c399 | ||
|
|
efdfd0db10 | ||
|
|
d6412eec58 | ||
|
|
53a6d2de83 | ||
|
|
7fe990e9f6 | ||
|
|
7b7ad0715b | ||
|
|
1a57d032b9 | ||
|
|
77bb169680 | ||
|
|
b424c19eee | ||
|
|
4d597069cf | ||
|
|
5afbdf7f20 | ||
|
|
33f558b221 | ||
|
|
b05d0dd1ec | ||
|
|
b2b305cc4b | ||
|
|
c5a9ee544c | ||
|
|
368d66f76e | ||
|
|
5aaae61b46 | ||
|
|
29fe50c2d7 | ||
|
|
d0c59ee253 | ||
|
|
d2e39238f4 | ||
|
|
9570e541d9 | ||
|
|
89b23ef0d7 | ||
|
|
b958911c63 | ||
|
|
f7a7f06c67 | ||
|
|
860f0d5846 |
@@ -9,3 +9,4 @@ WebSite
|
||||
*.xcodeproj/*.perspectivev3
|
||||
xcuserdata/
|
||||
!*.xcodeproj/project.pbxproj
|
||||
*.xCodeSupport/
|
||||
|
||||
@@ -371,8 +371,8 @@ CPCriticalAlertStyle = 2;
|
||||
[_informativeLabel setAlignment:[self currentValueForThemeAttribute:@"informative-text-alignment"]];
|
||||
[_informativeLabel setLineBreakMode:CPLineBreakByWordWrapping];
|
||||
|
||||
informativeLabelWidth = CGRectGetWidth([[_window contentView] frame]) - inset.left - inset.right,
|
||||
informativeLabelOriginY = [_messageLabel frameOrigin].y + [_messageLabel frameSize].height + defaultElementsMargin,
|
||||
informativeLabelWidth = CGRectGetWidth([[_window contentView] frame]) - inset.left - inset.right;
|
||||
informativeLabelOriginY = [_messageLabel frameOrigin].y + [_messageLabel frameSize].height + defaultElementsMargin;
|
||||
informativeLabelTextSize = [[_informativeLabel stringValue] sizeWithFont:[_informativeLabel font] inWidth:informativeLabelWidth];
|
||||
|
||||
[_informativeLabel setFrame:CGRectMake(inset.left, informativeLabelOriginY, informativeLabelTextSize.width, informativeLabelTextSize.height + sizeWithFontCorrection)];
|
||||
|
||||
@@ -338,7 +338,7 @@ CPRunContinuesResponse = -1002;
|
||||
Copyright - Human readable copyright information.
|
||||
</pre>
|
||||
|
||||
If you choose not the include any of the above keys, they will default
|
||||
If you choose not the include any of the above keys, they will default
|
||||
to the following respective keys in your info.plist file.
|
||||
|
||||
<pre>
|
||||
@@ -1003,7 +1003,7 @@ CPRunContinuesResponse = -1002;
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the arguments of your application.
|
||||
Sets the arguments of your application.
|
||||
That is, set the slash seperated values of an array as the window location hash.
|
||||
|
||||
For example if you pass an array:
|
||||
@@ -1340,8 +1340,8 @@ var _CPAppBootstrapperActions = nil;
|
||||
[editMenu addItem:undoMenuItem];
|
||||
[editMenu addItem:redoMenuItem];
|
||||
|
||||
[editMenu addItem:[[CPMenuItem alloc] initWithTitle:@"Cut" action:@selector(cut:) keyEquivalent:@"x"]],
|
||||
[editMenu addItem:[[CPMenuItem alloc] initWithTitle:@"Copy" action:@selector(copy:) keyEquivalent:@"c"]],
|
||||
[editMenu addItem:[[CPMenuItem alloc] initWithTitle:@"Cut" action:@selector(cut:) keyEquivalent:@"x"]];
|
||||
[editMenu addItem:[[CPMenuItem alloc] initWithTitle:@"Copy" action:@selector(copy:) keyEquivalent:@"c"]];
|
||||
[editMenu addItem:[[CPMenuItem alloc] initWithTitle:@"Paste" action:@selector(paste:) keyEquivalent:@"v"]];
|
||||
|
||||
[editMenuItem setSubmenu:editMenu];
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
@import "CPCompatibility.j"
|
||||
@import "CPImage.j"
|
||||
|
||||
/// @cond IGNORE
|
||||
|
||||
var _redComponent = 0,
|
||||
_greenComponent = 1,
|
||||
@@ -54,6 +55,66 @@ var cachedBlackColor,
|
||||
cachedShadowColor,
|
||||
cachedClearColor;
|
||||
|
||||
/// @endcond
|
||||
|
||||
/*!
|
||||
Orientation to use with \c CPColorPattern for vertical patterns.
|
||||
*/
|
||||
CPColorPatternIsVertical = YES;
|
||||
|
||||
/*!
|
||||
Orientation to use with \c CPColorPattern for horizontal patterns.
|
||||
*/
|
||||
CPColorPatternIsHorizontal = NO;
|
||||
|
||||
/*!
|
||||
To create a simple color with a pattern image:
|
||||
|
||||
<code>CPColorWithImages(name, width, height{, bundle})</code>
|
||||
|
||||
To create a color with a three part pattern image:
|
||||
|
||||
<code>CPColorWithImages(slices{, orientation})</code>
|
||||
|
||||
where slices is an array of three [name, width, height{, bundle}] arrays,
|
||||
and orientation is \c CPColorPatternIsVertical or \ref CPColorPatternIsHorizontal.
|
||||
If orientatation is not passed, it defaults to \ref CPColorPatternIsHorizontal.
|
||||
|
||||
To create a color with a nine part pattern image:
|
||||
|
||||
<code>CPColorWithImages(slices);</code>
|
||||
|
||||
where slices is an array of nine [name, width, height{, bundle}] arrays.
|
||||
*/
|
||||
function CPColorWithImages()
|
||||
{
|
||||
if (arguments.length < 3)
|
||||
{
|
||||
var slices = arguments[0],
|
||||
imageSlices = [];
|
||||
|
||||
for (var i = 0; i < slices.length; ++i)
|
||||
{
|
||||
var slice = slices[i];
|
||||
|
||||
imageSlices.push(slice ? CPImageInBundle(slice[0], CGSizeMake(slice[1], slice[2]), slice[3]) : nil);
|
||||
}
|
||||
|
||||
if (imageSlices.length === 3)
|
||||
return [CPColor colorWithPatternImage:[[CPThreePartImage alloc] initWithImageSlices:imageSlices isVertical:arguments[1] || CPColorPatternIsHorizontal]];
|
||||
else
|
||||
return [CPColor colorWithPatternImage:[[CPNinePartImage alloc] initWithImageSlices:imageSlices]];
|
||||
}
|
||||
else if (arguments.length === 3 || arguments.length === 4)
|
||||
{
|
||||
return [CPColor colorWithPatternImage:CPImageInBundle(arguments[0], CGSizeMake(arguments[1], arguments[2]), arguments[3])];
|
||||
}
|
||||
else
|
||||
{
|
||||
return nil;
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
@ingroup appkit
|
||||
|
||||
@@ -633,7 +694,36 @@ url("data:image/png;base64,BASE64ENCODEDDATA") // if there is a pattern image
|
||||
|
||||
- (CPString)description
|
||||
{
|
||||
return [super description]+" "+[self cssString];
|
||||
var description = [super description],
|
||||
patternImage = [self patternImage];
|
||||
|
||||
if (!patternImage)
|
||||
return description + " " + [self cssString];
|
||||
|
||||
description += " {\n";
|
||||
|
||||
if ([patternImage isThreePartImage] || [patternImage isNinePartImage])
|
||||
{
|
||||
var slices = [patternImage imageSlices];
|
||||
|
||||
if ([patternImage isThreePartImage])
|
||||
description += " orientation: " + ([patternImage isVertical] ? "vertical" : "horizontal") + ",\n";
|
||||
|
||||
description += " patternImage (" + slices.length + " part): [\n";
|
||||
|
||||
for (var i = 0; i < slices.length; ++i)
|
||||
{
|
||||
var imgDescription = [slices[i] description];
|
||||
|
||||
description += imgDescription.replace(/^/mg, " ") + ",\n";
|
||||
}
|
||||
|
||||
description = description.substr(0, description.length - 2) + "\n ]\n}";
|
||||
}
|
||||
else
|
||||
description += [patternImage description].replace(/^/mg, " ") + "\n}";
|
||||
|
||||
return description;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -678,8 +768,10 @@ url("data:image/png;base64,BASE64ENCODEDDATA") // if there is a pattern image
|
||||
|
||||
@end
|
||||
|
||||
/// @cond IGNORE
|
||||
var CPColorComponentsKey = @"CPColorComponentsKey",
|
||||
CPColorPatternImageKey = @"CPColorPatternImageKey";
|
||||
/// @endcond
|
||||
|
||||
@implementation CPColor (CPCoding)
|
||||
|
||||
@@ -710,13 +802,12 @@ var CPColorComponentsKey = @"CPColorComponentsKey",
|
||||
@end
|
||||
|
||||
|
||||
/// @cond IGNORE
|
||||
var hexCharacters = "0123456789ABCDEF";
|
||||
|
||||
/*!
|
||||
Used for the CPColor \c +colorWithHexString: implementation
|
||||
@ignore
|
||||
@class CPColor
|
||||
@return an array of rgb components
|
||||
/*
|
||||
Used for the CPColor +colorWithHexString: implementation.
|
||||
Returns an array of rgb components.
|
||||
*/
|
||||
var hexToRGB = function(hex)
|
||||
{
|
||||
@@ -754,3 +845,5 @@ var byteToHex = function(n)
|
||||
return hexCharacters.charAt((n - n % 16) / 16) +
|
||||
hexCharacters.charAt(n % 16);
|
||||
};
|
||||
|
||||
/// @endcond
|
||||
|
||||
@@ -51,7 +51,7 @@ CPWheelColorPickerMode = 1;
|
||||
*/
|
||||
CPSliderColorPickerMode = 2;
|
||||
|
||||
CPColorPickerViewWidth = 265,
|
||||
CPColorPickerViewWidth = 265;
|
||||
CPColorPickerViewHeight = 370;
|
||||
|
||||
/*!
|
||||
|
||||
@@ -571,10 +571,12 @@ var _CPEventPeriodicEventPeriod = 0,
|
||||
if (_modifierFlags & (CPCommandKeyMask | CPControlKeyMask))
|
||||
return YES;
|
||||
|
||||
// Cocoa does not consider space, backspace, or escape a key equivalent
|
||||
// if the first responder is a text field (presumably a subclass of NSText).
|
||||
// Cocoa allows almost any key as a key equivalent unless the first responder is a
|
||||
// text field (presumably a subclass of NSText.)
|
||||
var firstResponderIsText = [[_window firstResponder] isKindOfClass:[CPTextField class]];
|
||||
|
||||
// Some keys are accepted as key equivalents even if the first responder is a text
|
||||
// field.
|
||||
for (var i = 0; i < characterCount; i++)
|
||||
{
|
||||
var c = _characters.charAt(i);
|
||||
@@ -583,18 +585,13 @@ var _CPEventPeriodicEventPeriod = 0,
|
||||
c === CPEnterCharacter ||
|
||||
c === CPNewlineCharacter ||
|
||||
c === CPCarriageReturnCharacter ||
|
||||
c === CPEscapeFunctionKey ||
|
||||
(!firstResponderIsText &&
|
||||
(c === CPSpaceFunctionKey ||
|
||||
c === CPDeleteCharacter ||
|
||||
c === CPBackspaceCharacter)))
|
||||
c === CPEscapeFunctionKey)
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME: More cases?
|
||||
return NO;
|
||||
return !firstResponderIsText;
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
@@ -44,7 +44,8 @@ CPImageNameColorPanel = @"CPImageNameColorPanel";
|
||||
CPImageNameColorPanelHighlighted = @"CPImageNameColorPanelHighlighted";
|
||||
|
||||
var imagesForNames = { },
|
||||
AppKitImageForNames = { };
|
||||
AppKitImageForNames = { },
|
||||
ImageDescriptionFormat = "%s {\n filename: \"%s\",\n size: { width:%f, height:%f }\n}";
|
||||
|
||||
AppKitImageForNames[CPImageNameColorPanel] = CGSizeMake(26.0, 29.0);
|
||||
AppKitImageForNames[CPImageNameColorPanelHighlighted] = CGSizeMake(26.0, 29.0);
|
||||
@@ -324,6 +325,24 @@ function CPAppKitImage(aFilename, aSize)
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (CPString)description
|
||||
{
|
||||
var filename = [self filename],
|
||||
size = [self size];
|
||||
|
||||
if (filename.indexOf("data:") === 0)
|
||||
{
|
||||
var index = filename.indexOf(",");
|
||||
|
||||
if (index > 0)
|
||||
filename = [CPString stringWithFormat:@"%s,%s...%s", filename.substr(0, index), filename.substr(index + 1, 10), filename.substr(filename.length - 10)];
|
||||
else
|
||||
filename = "data:<unknown type>";
|
||||
}
|
||||
|
||||
return [CPString stringWithFormat:ImageDescriptionFormat, [super description], filename, size.width, size.height];
|
||||
}
|
||||
|
||||
/* @ignore */
|
||||
- (void)_derefFromImage
|
||||
{
|
||||
|
||||
@@ -311,10 +311,10 @@ var CPBindingOperationAnd = 0,
|
||||
- (void)bind:(CPString)aBinding toObject:(id)anObject withKeyPath:(CPString)aKeyPath options:(CPDictionary)options
|
||||
{
|
||||
if (!anObject || !aKeyPath)
|
||||
return CPLog.error("Invalid object or path on "+self+" for "+aBinding);
|
||||
return CPLog.error("Invalid object or path on " + self + " for " + aBinding);
|
||||
|
||||
//if (![[self exposedBindings] containsObject:aBinding])
|
||||
// CPLog.warn("No binding exposed on "+self+" for "+aBinding);
|
||||
// CPLog.warn("No binding exposed on " + self + " for " + aBinding);
|
||||
|
||||
var binderClass = [[self class] _binderClassForBinding:aBinding];
|
||||
|
||||
@@ -518,4 +518,4 @@ CPValueTransformerBindingOption = @"CPValueTransformer";
|
||||
CPIsControllerMarker = function(/*id*/anObject)
|
||||
{
|
||||
return anObject === CPMultipleValuesMarker || anObject === CPNoSelectionMarker || anObject === CPNotApplicableMarker || anObject === CPNullMarker;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -352,8 +352,12 @@ var _CPMenuBarVisible = NO,
|
||||
while (count--)
|
||||
[_items[count] setMenu:nil];
|
||||
|
||||
_items = [CPMutableArray array];
|
||||
_highlightedIndex = CPNotFound;
|
||||
|
||||
// Because we are changing _items directly, be sure to notify KVO
|
||||
[self willChangeValueForKey:@"items"];
|
||||
_items = [CPMutableArray array];
|
||||
[self didChangeValueForKey:@"items"];
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
@import <Foundation/CPObject.j>
|
||||
|
||||
|
||||
_CPMenuManagerScrollingStateUp = -1,
|
||||
_CPMenuManagerScrollingStateDown = 1,
|
||||
_CPMenuManagerScrollingStateUp = -1;
|
||||
_CPMenuManagerScrollingStateDown = 1;
|
||||
_CPMenuManagerScrollingStateNone = 0;
|
||||
|
||||
var STICKY_TIME_INTERVAL = 500,
|
||||
|
||||
@@ -86,7 +86,7 @@ CPPopUpButtonStatePullsDown = CPThemeState("pulls-down");
|
||||
|
||||
[self setPullsDown:shouldPullDown];
|
||||
|
||||
var options = CPKeyValueObservingOptionNew |CPKeyValueObservingOptionOld;/* |CPKeyValueObservingOptionInitial;*/
|
||||
var options = CPKeyValueObservingOptionNew | CPKeyValueObservingOptionOld; // | CPKeyValueObservingOptionInitial;
|
||||
[self addObserver:self forKeyPath:@"menu.items" options:options context:nil];
|
||||
[self addObserver:self forKeyPath:@"_firstItem.changeCount" options:options context:nil];
|
||||
[self addObserver:self forKeyPath:@"selectedItem.changeCount" options:options context:nil];
|
||||
@@ -193,6 +193,7 @@ CPPopUpButtonStatePullsDown = CPThemeState("pulls-down");
|
||||
- (void)removeAllItems
|
||||
{
|
||||
[[self menu] removeAllItems];
|
||||
[self synchronizeTitleAndSelectedItem];
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
@@ -39,7 +39,7 @@ CPPopoverBehaviorSemitransient = 2;
|
||||
var CPPopoverDelegate_popover_willShow_ = 1 << 0,
|
||||
CPPopoverDelegate_popover_didShow_ = 1 << 1,
|
||||
CPPopoverDelegate_popover_shouldClose_ = 1 << 2,
|
||||
CPPopoverDelegate_popover_willClose_ = 1 << 3,
|
||||
CPPopoverDelegate_popover_willClose_ = 1 << 3,
|
||||
CPPopoverDelegate_popover_didClose_ = 1 << 4;
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ var CPPopoverDelegate_popover_willShow_ = 1 << 0,
|
||||
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark INitialization
|
||||
#pragma mark Initialization
|
||||
|
||||
/*!
|
||||
Initialize the CPPopover witn default values
|
||||
@@ -103,7 +103,7 @@ var CPPopoverDelegate_popover_willShow_ = 1 << 0,
|
||||
|
||||
@return CPRect represeting the frame of the popover
|
||||
*/
|
||||
- (CPRect)positionningRect
|
||||
- (CPRect)positioningRect
|
||||
{
|
||||
if (!_attachedWindow || ![_attachedWindow isVisible])
|
||||
return nil;
|
||||
@@ -113,7 +113,7 @@ var CPPopoverDelegate_popover_willShow_ = 1 << 0,
|
||||
/*! Sets the frame of the popover
|
||||
@param aRect the desired frame
|
||||
*/
|
||||
- (void)setPositionningRect:(CPRect)aRect
|
||||
- (void)setPositioningRect:(CPRect)aRect
|
||||
{
|
||||
if (!_attachedWindow || ![_attachedWindow isVisible])
|
||||
return;
|
||||
@@ -196,14 +196,14 @@ var CPPopoverDelegate_popover_willShow_ = 1 << 0,
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Positionning
|
||||
#pragma mark Positioning
|
||||
|
||||
/*!
|
||||
Show the popover
|
||||
|
||||
@param positioningRect if set, the popover will be positionned to a random rect relative to the window
|
||||
@param positioningView if set, the popover will be positioned relative to this view
|
||||
@param preferredEdge: CPRectEdge representing the prefered positionning.
|
||||
@param preferredEdge: CPRectEdge representing the preferred positioning.
|
||||
*/
|
||||
- (void)showRelativeToRect:(CPRect)positioningRect ofView:(CPView)positioningView preferredEdge:(CPRectEdge)preferredEdge
|
||||
{
|
||||
@@ -213,7 +213,7 @@ var CPPopoverDelegate_popover_willShow_ = 1 << 0,
|
||||
if (!_contentViewController)
|
||||
[CPException raise:CPInternalInconsistencyException reason:@"contentViewController must not be nil"];
|
||||
|
||||
if (_needsCompute)
|
||||
if (_needsCompute || !_attachedWindow)
|
||||
{
|
||||
var styleMask = (_behavior == CPPopoverBehaviorTransient) ? CPClosableOnBlurWindowMask : nil;
|
||||
_attachedWindow = [[_CPAttachedWindow alloc] initWithContentRect:CPRectMakeZero() styleMask:styleMask];
|
||||
@@ -221,6 +221,7 @@ var CPPopoverDelegate_popover_willShow_ = 1 << 0,
|
||||
|
||||
[_attachedWindow setAppearance:_appearance];
|
||||
[_attachedWindow setAnimates:_animates];
|
||||
[_attachedWindow setDelegate:self];
|
||||
[_attachedWindow setMovableByWindowBackground:NO];
|
||||
[_attachedWindow setFrame:[_attachedWindow frameRectForContentRect:[[_contentViewController view] frame]]];
|
||||
[_attachedWindow setContentView:[_contentViewController view]];
|
||||
@@ -230,7 +231,7 @@ var CPPopoverDelegate_popover_willShow_ = 1 << 0,
|
||||
else if (positioningView)
|
||||
[_attachedWindow positionRelativeToView:positioningView preferredEdge:preferredEdge];
|
||||
else
|
||||
[CPException raise:CPInvalidArgumentException reason:@"you must set positioningRect or positioningRect"];
|
||||
[CPException raise:CPInvalidArgumentException reason:@"a value must be passed for positioningRect or positioningView"];
|
||||
|
||||
if (_implementedDelegateMethods & CPPopoverDelegate_popover_didShow_)
|
||||
[_delegate popoverDidShow:self];
|
||||
@@ -268,8 +269,28 @@ var CPPopoverDelegate_popover_willShow_ = 1 << 0,
|
||||
[self close];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Delegates
|
||||
|
||||
/*! @ignore */
|
||||
- (BOOL)attachedWindowShouldClose:(_CPAttachedWindow)anAttachedWindow
|
||||
{
|
||||
[self close];
|
||||
|
||||
// we return NO, because we want the CPPopover to compute
|
||||
// if the attached can be close in order to send delegate messages
|
||||
return NO;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
var CPPopoverNeedsComputeKey = @"CPPopoverNeedsComputeKey",
|
||||
CPPopoverAppearanceKey = @"CPPopoverAppearanceKey",
|
||||
CPPopoverAnimatesKey = @"CPPopoverAnimatesKey",
|
||||
CPPopoverContentViewControllerKey = @"CPPopoverContentViewControllerKey",
|
||||
CPPopoverDelegateKey = @"CPPopoverDelegateKey",
|
||||
CPPopoverBehaviorKey = @"CPPopoverBehaviorKey";
|
||||
|
||||
@implementation CPPopover (CPCoding)
|
||||
|
||||
@@ -279,12 +300,12 @@ var CPPopoverDelegate_popover_willShow_ = 1 << 0,
|
||||
|
||||
if (self)
|
||||
{
|
||||
_needsCompute = [aCoder decodeIntForKey:@"_needsCompute"];
|
||||
_appearance = [aCoder decodeIntForKey:@"_appearance"];
|
||||
_animates = [aCoder decodeBoolForKey:@"_animates"];
|
||||
_contentViewController = [aCoder decodeObjectForKey:@"_contentViewController"];
|
||||
[self setDelegate:[aCoder decodeObjectForKey:@"_delegate"]];
|
||||
[self setBehaviour:[aCoder decodeIntForKey:@"_behavior"]];
|
||||
_needsCompute = [aCoder decodeIntForKey:CPPopoverNeedsComputeKey];
|
||||
_appearance = [aCoder decodeIntForKey:CPPopoverAppearanceKey];
|
||||
_animates = [aCoder decodeBoolForKey:CPPopoverAnimatesKey];
|
||||
_contentViewController = [aCoder decodeObjectForKey:CPPopoverContentViewControllerKey];
|
||||
[self setDelegate:[aCoder decodeObjectForKey:CPPopoverDelegateKey]];
|
||||
[self setBehaviour:[aCoder decodeIntForKey:CPPopoverBehaviorKey]];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@@ -293,12 +314,12 @@ var CPPopoverDelegate_popover_willShow_ = 1 << 0,
|
||||
{
|
||||
[super encodeWithCoder:aCoder];
|
||||
|
||||
[aCoder encodeInt:_behavior forKey:@"_behavior"];
|
||||
[aCoder encodeInt:_appearance forKey:@"_appearance"];
|
||||
[aCoder encodeBool:_needsCompute forKey:@"_needsCompute"];
|
||||
[aCoder encodeObject:_contentViewController forKey:@"_contentViewController"];
|
||||
[aCoder encodeObject:_delegate forKey:@"_delegate"];
|
||||
[aCoder encodeObject:_animates forKey:@"_animates"];
|
||||
[aCoder encodeBool:_needsCompute forKey:CPPopoverNeedsComputeKey];
|
||||
[aCoder encodeInt:_appearance forKey:CPPopoverAppearanceKey];
|
||||
[aCoder encodeObject:_animates forKey:CPPopoverAnimatesKey];
|
||||
[aCoder encodeObject:_contentViewController forKey:CPPopoverContentViewControllerKey];
|
||||
[aCoder encodeObject:_delegate forKey:CPPopoverDelegateKey];
|
||||
[aCoder encodeInt:_behavior forKey:CPPopoverBehaviorKey];
|
||||
}
|
||||
|
||||
@end
|
||||
@end
|
||||
|
||||
@@ -150,6 +150,14 @@ CPRadioImageOffset = 4.0;
|
||||
[_radioGroup _setSelectedRadio:self];
|
||||
}
|
||||
|
||||
- (void)sendAction:(SEL)anAction to:(id)anObject
|
||||
{
|
||||
[super sendAction:anAction to:anObject];
|
||||
|
||||
if (_radioGroup)
|
||||
[CPApp sendAction:[_radioGroup action] to:[_radioGroup target] from:_radioGroup];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
var CPRadioRadioGroupKey = @"CPRadioRadioGroupKey";
|
||||
@@ -220,8 +228,6 @@ var CPRadioRadioGroupKey = @"CPRadioRadioGroupKey";
|
||||
|
||||
[_selectedRadio setState:CPOffState];
|
||||
_selectedRadio = aRadio;
|
||||
|
||||
[CPApp sendAction:_action to:_target from:self];
|
||||
}
|
||||
|
||||
- (CPRadio)selectedRadio
|
||||
|
||||
@@ -200,7 +200,7 @@
|
||||
if (isPopup)
|
||||
{
|
||||
itemArray = [[templateView itemArray] valueForKey:@"title"];
|
||||
itemsCount = [itemArray count],
|
||||
itemsCount = [itemArray count];
|
||||
menuIndex = 0;
|
||||
}
|
||||
|
||||
@@ -501,4 +501,4 @@ var CPPredicateTemplatesKey = @"CPPredicateTemplates";
|
||||
|
||||
@end
|
||||
|
||||
/*! @endcond */
|
||||
/*! @endcond */
|
||||
|
||||
@@ -20,17 +20,17 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
CPUndefinedAttributeType = 0,
|
||||
CPInteger16AttributeType = 100,
|
||||
CPInteger32AttributeType = 200,
|
||||
CPInteger64AttributeType = 300,
|
||||
CPDecimalAttributeType = 400,
|
||||
CPDoubleAttributeType = 500,
|
||||
CPFloatAttributeType = 600,
|
||||
CPStringAttributeType = 700,
|
||||
CPBooleanAttributeType = 800,
|
||||
CPDateAttributeType = 900,
|
||||
CPBinaryDataAttributeType = 1000,
|
||||
CPUndefinedAttributeType = 0;
|
||||
CPInteger16AttributeType = 100;
|
||||
CPInteger32AttributeType = 200;
|
||||
CPInteger64AttributeType = 300;
|
||||
CPDecimalAttributeType = 400;
|
||||
CPDoubleAttributeType = 500;
|
||||
CPFloatAttributeType = 600;
|
||||
CPStringAttributeType = 700;
|
||||
CPBooleanAttributeType = 800;
|
||||
CPDateAttributeType = 900;
|
||||
CPBinaryDataAttributeType = 1000;
|
||||
CPTransformableAttributeType = 1800;
|
||||
|
||||
@implementation CPPredicateEditorRowTemplate : CPObject
|
||||
@@ -785,4 +785,4 @@ var CPPredicateTemplateTypeKey = @"CPPredicateTemplateType",
|
||||
}
|
||||
|
||||
@end
|
||||
/*! @endcond */
|
||||
/*! @endcond */
|
||||
|
||||
@@ -16,12 +16,12 @@ var GRADIENT_NORMAL,
|
||||
{
|
||||
if (CPBrowserIsEngine(CPWebKitBrowserEngine))
|
||||
{
|
||||
GRADIENT_NORMAL = "-webkit-gradient(linear, left top, left bottom, from(rgb(252, 252, 252)), to(rgb(223, 223, 223)))",
|
||||
GRADIENT_NORMAL = "-webkit-gradient(linear, left top, left bottom, from(rgb(252, 252, 252)), to(rgb(223, 223, 223)))";
|
||||
GRADIENT_HIGHLIGHTED = "-webkit-gradient(linear, left top, left bottom, from(rgb(223, 223, 223)), to(rgb(252, 252, 252)))";
|
||||
}
|
||||
else if (CPBrowserIsEngine(CPGeckoBrowserEngine))
|
||||
{
|
||||
GRADIENT_NORMAL = "-moz-linear-gradient(top, rgb(252, 252, 252), rgb(223, 223, 223))",
|
||||
GRADIENT_NORMAL = "-moz-linear-gradient(top, rgb(252, 252, 252), rgb(223, 223, 223))";
|
||||
GRADIENT_HIGHLIGHTED = "-moz-linear-gradient(top, rgb(223, 223, 223), rgb(252, 252, 252))";
|
||||
}
|
||||
}
|
||||
@@ -35,7 +35,7 @@ var GRADIENT_NORMAL,
|
||||
style.border = "1px solid rgb(189, 189, 189)";
|
||||
style.filter = IE_FILTER;
|
||||
|
||||
[self setTextColor:[CPColor colorWithWhite:101/255 alpha:1]];
|
||||
[self setTextColor:[CPColor colorWithWhite:101 / 255 alpha:1]];
|
||||
[self setBordered:NO];
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
* Created by Francisco Tolmasky.
|
||||
* Copyright 2008, 280 North, Inc.
|
||||
*
|
||||
* Modified to match Lion style by Antoine Mercadal 2011
|
||||
* <antoine.mercadal@archipelproject.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
@@ -22,7 +25,6 @@
|
||||
|
||||
@import "CPControl.j"
|
||||
|
||||
|
||||
// CPScroller Constants
|
||||
CPScrollerNoPart = 0;
|
||||
CPScrollerDecrementPage = 1;
|
||||
@@ -54,6 +56,17 @@ NAMES_FOR_PARTS[CPScrollerKnobSlot] = @"knob-slot";
|
||||
NAMES_FOR_PARTS[CPScrollerKnob] = @"knob";
|
||||
|
||||
|
||||
CPScrollerStyleLegacy = 0;
|
||||
CPScrollerStyleOverlay = 1;
|
||||
|
||||
CPScrollerKnobStyleDefault = 0;
|
||||
CPScrollerKnobStyleDark = 1;
|
||||
CPScrollerKnobStyleLight = 2;
|
||||
|
||||
CPThemeStateScrollViewLegacy = CPThemeState("scroller-style-legacy");
|
||||
CPThemeStateScrollerKnobLight = CPThemeState("scroller-knob-light");
|
||||
CPThemeStateScrollerKnobDark = CPThemeState("scroller-knob-dark");
|
||||
|
||||
@implementation CPScroller : CPControl
|
||||
{
|
||||
CPControlSize _controlSize;
|
||||
@@ -68,8 +81,19 @@ NAMES_FOR_PARTS[CPScrollerKnob] = @"knob";
|
||||
CPScrollerPart _trackingPart;
|
||||
float _trackingFloatValue;
|
||||
CGPoint _trackingStartPoint;
|
||||
|
||||
CPViewAnimation _animationScroller;
|
||||
|
||||
BOOL _allowFadingOut @accessors(getter=allowFadingOut);
|
||||
int _style;
|
||||
CPTimer _timerFadeOut;
|
||||
BOOL _isMouseOver;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Class methods
|
||||
|
||||
+ (CPString)defaultThemeClass
|
||||
{
|
||||
return "scroller";
|
||||
@@ -78,49 +102,43 @@ NAMES_FOR_PARTS[CPScrollerKnob] = @"knob";
|
||||
+ (id)themeAttributes
|
||||
{
|
||||
return [CPDictionary dictionaryWithJSObject:{
|
||||
@"scroller-width": 15.0,
|
||||
@"knob-slot-color": [CPColor lightGrayColor],
|
||||
@"scroller-width": 7.0,
|
||||
@"knob-slot-color": [CPNull null],
|
||||
@"decrement-line-color": [CPNull null],
|
||||
@"increment-line-color": [CPNull null],
|
||||
@"knob-color": [CPColor grayColor],
|
||||
@"knob-color": [CPNull null],
|
||||
@"decrement-line-size":_CGSizeMakeZero(),
|
||||
@"increment-line-size":_CGSizeMakeZero(),
|
||||
@"track-inset":_CGInsetMakeZero(),
|
||||
@"knob-inset": _CGInsetMakeZero(),
|
||||
@"minimum-knob-length":21.0
|
||||
}]
|
||||
@"minimum-knob-length":21.0,
|
||||
@"track-border-overlay": 9.0
|
||||
}];
|
||||
}
|
||||
|
||||
|
||||
// Calculating Layout
|
||||
|
||||
- (id)initWithFrame:(CGRect)aFrame
|
||||
+ (float)scrollerWidth
|
||||
{
|
||||
self = [super initWithFrame:aFrame];
|
||||
|
||||
if (self)
|
||||
{
|
||||
_controlSize = CPRegularControlSize;
|
||||
_partRects = [];
|
||||
|
||||
[self setFloatValue:0.0];
|
||||
[self setKnobProportion:1.0];
|
||||
|
||||
_hitPart = CPScrollerNoPart;
|
||||
|
||||
[self _calculateIsVertical];
|
||||
}
|
||||
|
||||
return self;
|
||||
return [self scrollerWidthInStyle:CPScrollerStyleLegacy];
|
||||
}
|
||||
|
||||
// Determining CPScroller Size
|
||||
/*!
|
||||
Returns the CPScroller's width for a CPRegularControlSize.
|
||||
*/
|
||||
+ (float)scrollerWidth
|
||||
+ (float)scrollerWidthInStyle:(int)aStyle
|
||||
{
|
||||
return [[[CPScroller alloc] init] currentValueForThemeAttribute:@"scroller-width"];
|
||||
var scroller = [[self alloc] init];
|
||||
|
||||
if (aStyle == CPScrollerStyleLegacy)
|
||||
return [scroller valueForThemeAttribute:@"scroller-width" inState:CPThemeStateScrollViewLegacy];
|
||||
return [scroller currentValueForThemeAttribute:@"scroller-width"];
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the CPScroller's overlay value.
|
||||
*/
|
||||
+ (float)scrollerOverlay
|
||||
{
|
||||
return [[[self alloc] init] currentValueForThemeAttribute:@"track-border-overlay"];
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -132,6 +150,87 @@ NAMES_FOR_PARTS[CPScrollerKnob] = @"knob";
|
||||
return [self scrollerWidth];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Initialization
|
||||
|
||||
- (id)initWithFrame:(CGRect)aFrame
|
||||
{
|
||||
if (self = [super initWithFrame:aFrame])
|
||||
{
|
||||
_controlSize = CPRegularControlSize;
|
||||
_partRects = [];
|
||||
|
||||
[self setFloatValue:0.0];
|
||||
[self setKnobProportion:1.0];
|
||||
|
||||
_hitPart = CPScrollerNoPart;
|
||||
_allowFadingOut = YES;
|
||||
_isMouseOver = NO;
|
||||
_style = CPScrollerStyleOverlay;
|
||||
var paramAnimFadeOut = [CPDictionary dictionaryWithObjects:[self, CPViewAnimationFadeOutEffect]
|
||||
forKeys:[CPViewAnimationTargetKey, CPViewAnimationEffectKey]];
|
||||
|
||||
_animationScroller = [[CPViewAnimation alloc] initWithDuration:0.2 animationCurve:CPAnimationEaseInOut];
|
||||
[_animationScroller setViewAnimations:[paramAnimFadeOut]];
|
||||
[_animationScroller setDelegate:self];
|
||||
[self setAlphaValue:0.0];
|
||||
[self _calculateIsVertical];
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Getters / Setters
|
||||
|
||||
/*!
|
||||
Returns the scroller's style
|
||||
*/
|
||||
- (void)style
|
||||
{
|
||||
return _style;
|
||||
}
|
||||
|
||||
/*!
|
||||
Set the scroller's control size
|
||||
@param aStyle the scroller style: CPScrollerStyleLegacy or CPScrollerStyleOverlay
|
||||
*/
|
||||
- (void)setStyle:(id)aStyle
|
||||
{
|
||||
if (_style != nil && _style === aStyle)
|
||||
return;
|
||||
|
||||
_style = aStyle;
|
||||
|
||||
if (_style === CPScrollerStyleLegacy)
|
||||
{
|
||||
[self fadeIn];
|
||||
[self setThemeState:CPThemeStateScrollViewLegacy];
|
||||
}
|
||||
else
|
||||
{
|
||||
_allowFadingOut = YES;
|
||||
[self unsetThemeState:CPThemeStateScrollViewLegacy];
|
||||
}
|
||||
|
||||
[self _adjustScrollerSize];
|
||||
}
|
||||
|
||||
- (void)setObjectValue:(id)aValue
|
||||
{
|
||||
[super setObjectValue:MIN(1.0, MAX(0.0, +aValue))];
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the scroller's control size
|
||||
*/
|
||||
- (CPControlSize)controlSize
|
||||
{
|
||||
return _controlSize;
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the scroller's size.
|
||||
@param aControlSize the scroller's size
|
||||
@@ -148,18 +247,17 @@ NAMES_FOR_PARTS[CPScrollerKnob] = @"knob";
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns the scroller's control size
|
||||
Return's the knob's proportion
|
||||
*/
|
||||
- (CPControlSize)controlSize
|
||||
- (float)knobProportion
|
||||
{
|
||||
return _controlSize;
|
||||
}
|
||||
|
||||
- (void)setObjectValue:(id)aValue
|
||||
{
|
||||
[super setObjectValue:MIN(1.0, MAX(0.0, +aValue))];
|
||||
return _knobProportion;
|
||||
}
|
||||
|
||||
/*!
|
||||
Set the knob's proportion
|
||||
@param aProportion the desired proportion
|
||||
*/
|
||||
- (void)setKnobProportion:(float)aProportion
|
||||
{
|
||||
_knobProportion = MIN(1.0, MAX(0.0001, aProportion));
|
||||
@@ -168,25 +266,35 @@ NAMES_FOR_PARTS[CPScrollerKnob] = @"knob";
|
||||
[self setNeedsLayout];
|
||||
}
|
||||
|
||||
/*!
|
||||
Return's the knob's proportion
|
||||
*/
|
||||
- (float)knobProportion
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Privates
|
||||
|
||||
/*! @ignore */
|
||||
- (void)_adjustScrollerSize
|
||||
{
|
||||
return _knobProportion;
|
||||
var frame = [self frame],
|
||||
scrollerWidth = [self currentValueForThemeAttribute:@"scroller-width"];
|
||||
|
||||
if ([self isVertical] && CGRectGetWidth(frame) !== scrollerWidth)
|
||||
frame.size.width = scrollerWidth;
|
||||
|
||||
if (![self isVertical] && CGRectGetHeight(frame) !== scrollerWidth)
|
||||
frame.size.height = scrollerWidth;
|
||||
|
||||
[self setFrame:frame];
|
||||
}
|
||||
|
||||
- (id)currentValueForThemeAttribute:(CPString)anAttributeName
|
||||
/*! @ignore */
|
||||
- (void)_performFadeOut:(CPTimer)aTimer
|
||||
{
|
||||
var themeState = _themeState;
|
||||
|
||||
if (NAMES_FOR_PARTS[_hitPart] + "-color" !== anAttributeName)
|
||||
themeState &= ~CPThemeStateHighlighted;
|
||||
|
||||
return [self valueForThemeAttribute:anAttributeName inState:themeState];
|
||||
[self fadeOut];
|
||||
_timerFadeOut = nil;
|
||||
}
|
||||
|
||||
// Calculating Layout
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Utilities
|
||||
|
||||
- (CGRect)rectForPart:(CPScrollerPart)aPart
|
||||
{
|
||||
@@ -208,6 +316,9 @@ NAMES_FOR_PARTS[CPScrollerKnob] = @"knob";
|
||||
// The ordering of these tests is important. We check the knob and
|
||||
// page rects first since they may overlap with the arrows.
|
||||
|
||||
if (![self hasThemeState:CPThemeStateSelected])
|
||||
return CPScrollerNoPart;
|
||||
|
||||
if (CGRectContainsPoint([self rectForPart:CPScrollerKnob], aPoint))
|
||||
return CPScrollerKnob;
|
||||
|
||||
@@ -330,7 +441,35 @@ NAMES_FOR_PARTS[CPScrollerKnob] = @"knob";
|
||||
return _usableParts;
|
||||
}
|
||||
|
||||
// Drawing the Parts
|
||||
/*!
|
||||
Display the scroller
|
||||
*/
|
||||
- (void)fadeIn
|
||||
{
|
||||
if (_isMouseOver && _knobProportion != 1.0)
|
||||
[self setThemeState:CPThemeStateSelected];
|
||||
|
||||
if (_timerFadeOut)
|
||||
[_timerFadeOut invalidate];
|
||||
|
||||
[self setAlphaValue:1.0];
|
||||
}
|
||||
|
||||
/*!
|
||||
Start the fade out anination
|
||||
*/
|
||||
- (void)fadeOut
|
||||
{
|
||||
if ([self hasThemeState:CPThemeStateScrollViewLegacy])
|
||||
return;
|
||||
|
||||
[_animationScroller startAnimation];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Drawing
|
||||
|
||||
/*!
|
||||
Draws the specified arrow and sets the highlight.
|
||||
@param anArrow the arrow to draw
|
||||
@@ -457,7 +596,7 @@ NAMES_FOR_PARTS[CPScrollerKnob] = @"knob";
|
||||
}
|
||||
|
||||
[CPApp setTarget:self selector:@selector(trackKnob:) forNextEventMatchingMask:CPLeftMouseDraggedMask | CPLeftMouseUpMask untilDate:nil inMode:nil dequeue:YES];
|
||||
|
||||
|
||||
if (type === CPLeftMouseDragged)
|
||||
[self sendAction:[self action] to:[self target]];
|
||||
}
|
||||
@@ -565,6 +704,20 @@ NAMES_FOR_PARTS[CPScrollerKnob] = @"knob";
|
||||
[self setNeedsLayout];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Overrides
|
||||
|
||||
- (id)currentValueForThemeAttribute:(CPString)anAttributeName
|
||||
{
|
||||
var themeState = _themeState;
|
||||
|
||||
if (NAMES_FOR_PARTS[_hitPart] + "-color" !== anAttributeName)
|
||||
themeState &= ~CPThemeStateHighlighted;
|
||||
|
||||
return [self valueForThemeAttribute:anAttributeName inState:themeState];
|
||||
}
|
||||
|
||||
- (void)mouseDown:(CPEvent)anEvent
|
||||
{
|
||||
if (![self isEnabled])
|
||||
@@ -583,10 +736,52 @@ NAMES_FOR_PARTS[CPScrollerKnob] = @"knob";
|
||||
}
|
||||
}
|
||||
|
||||
- (void)mouseEntered:(CPEvent)anEvent
|
||||
{
|
||||
[super mouseEntered:anEvent];
|
||||
|
||||
if (_timerFadeOut)
|
||||
[_timerFadeOut invalidate];
|
||||
|
||||
if (![self isEnabled])
|
||||
return;
|
||||
|
||||
_allowFadingOut = NO;
|
||||
_isMouseOver = YES;
|
||||
|
||||
if ([self alphaValue] > 0 && _knobProportion != 1.0)
|
||||
[self setThemeState:CPThemeStateSelected];
|
||||
}
|
||||
|
||||
- (void)mouseExited:(CPEvent)anEvent
|
||||
{
|
||||
[super mouseExited:anEvent];
|
||||
|
||||
if ([self isHidden] || ![self isEnabled] || !_isMouseOver)
|
||||
return;
|
||||
|
||||
_allowFadingOut = YES;
|
||||
_isMouseOver = NO;
|
||||
|
||||
if (_timerFadeOut)
|
||||
[_timerFadeOut invalidate];
|
||||
_timerFadeOut = [CPTimer scheduledTimerWithTimeInterval:1.2 target:self selector:@selector(_performFadeOut:) userInfo:nil repeats:NO];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Delegates
|
||||
|
||||
- (void)animationDidEnd:(CPAnimation)animation
|
||||
{
|
||||
[self unsetThemeState:CPThemeStateSelected];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
var CPScrollerControlSizeKey = "CPScrollerControlSize",
|
||||
CPScrollerKnobProportionKey = "CPScrollerKnobProportion";
|
||||
var CPScrollerControlSizeKey = @"CPScrollerControlSize",
|
||||
CPScrollerKnobProportionKey = @"CPScrollerKnobProportion",
|
||||
CPScrollerStyleKey = @"CPScrollerStyleKey";
|
||||
|
||||
@implementation CPScroller (CPCoding)
|
||||
|
||||
@@ -606,20 +801,18 @@ var CPScrollerControlSizeKey = "CPScrollerControlSize",
|
||||
|
||||
_hitPart = CPScrollerNoPart;
|
||||
|
||||
_allowFadingOut = YES;
|
||||
_isMouseOver = NO;
|
||||
var paramAnimFadeOut = [CPDictionary dictionaryWithObjects:[self, CPViewAnimationFadeOutEffect]
|
||||
forKeys:[CPViewAnimationTargetKey, CPViewAnimationEffectKey]];
|
||||
_animationScroller = [[CPViewAnimation alloc] initWithDuration:0.2 animationCurve:CPAnimationEaseInOut];
|
||||
[_animationScroller setViewAnimations:[paramAnimFadeOut]];
|
||||
[_animationScroller setDelegate:self];
|
||||
[self setAlphaValue:0.0];
|
||||
|
||||
[self _calculateIsVertical];
|
||||
|
||||
// Adjust the size of the scroller if the size from cib
|
||||
// isn't equal to the scrollerWidth
|
||||
var frame = [self frame],
|
||||
scrollerWidth = [CPScroller scrollerWidth];
|
||||
|
||||
if ([self isVertical] && CGRectGetWidth(frame) !== scrollerWidth)
|
||||
frame.size.width = scrollerWidth;
|
||||
|
||||
if (![self isVertical] && CGRectGetHeight(frame) !== scrollerWidth)
|
||||
frame.size.height = scrollerWidth;
|
||||
|
||||
[self setFrame:frame];
|
||||
[self setStyle:[aCoder decodeIntForKey:CPScrollerStyleKey]];
|
||||
}
|
||||
|
||||
return self;
|
||||
@@ -631,6 +824,7 @@ var CPScrollerControlSizeKey = "CPScrollerControlSize",
|
||||
|
||||
[aCoder encodeInt:_controlSize forKey:CPScrollerControlSizeKey];
|
||||
[aCoder encodeFloat:_knobProportion forKey:CPScrollerKnobProportionKey];
|
||||
[aCoder encodeInt:_style forKey:CPScrollerStyleKey];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -20,16 +20,43 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include "../Foundation/Foundation.h"
|
||||
|
||||
@import "CPButtonBar.j"
|
||||
@import "CPImage.j"
|
||||
@import "CPView.j"
|
||||
|
||||
#define SPLIT_VIEW_MAYBE_POST_WILL_RESIZE() \
|
||||
if ((_suppressResizeNotificationsMask & DidPostWillResizeNotification) === 0) \
|
||||
{ \
|
||||
[self _postNotificationWillResize]; \
|
||||
_suppressResizeNotificationsMask |= DidPostWillResizeNotification; \
|
||||
}
|
||||
|
||||
#define SPLIT_VIEW_MAYBE_POST_DID_RESIZE() \
|
||||
if ((_suppressResizeNotificationsMask & ShouldSuppressResizeNotifications) !== 0) \
|
||||
_suppressResizeNotificationsMask |= DidSuppressResizeNotification; \
|
||||
else \
|
||||
[self _postNotificationDidResize];
|
||||
|
||||
#define SPLIT_VIEW_DID_SUPPRESS_RESIZE_NOTIFICATION() \
|
||||
((_suppressResizeNotificationsMask & DidSuppressResizeNotification) !== 0)
|
||||
|
||||
#define SPLIT_VIEW_SUPPRESS_RESIZE_NOTIFICATIONS(shouldSuppress) \
|
||||
if (shouldSuppress) \
|
||||
_suppressResizeNotificationsMask |= ShouldSuppressResizeNotifications; \
|
||||
else \
|
||||
_suppressResizeNotificationsMask = 0;
|
||||
|
||||
CPSplitViewDidResizeSubviewsNotification = @"CPSplitViewDidResizeSubviewsNotification";
|
||||
CPSplitViewWillResizeSubviewsNotification = @"CPSplitViewWillResizeSubviewsNotification";
|
||||
|
||||
var CPSplitViewHorizontalImage = nil,
|
||||
CPSplitViewVerticalImage = nil;
|
||||
CPSplitViewVerticalImage = nil,
|
||||
|
||||
ShouldSuppressResizeNotifications = 1,
|
||||
DidPostWillResizeNotification = 1 << 1,
|
||||
DidSuppressResizeNotification = 1 << 2;
|
||||
|
||||
/*!
|
||||
@ingroup appkit
|
||||
@@ -45,24 +72,29 @@ var CPSplitViewHorizontalImage = nil,
|
||||
|
||||
@implementation CPSplitView : CPView
|
||||
{
|
||||
id _delegate;
|
||||
BOOL _isVertical;
|
||||
BOOL _isPaneSplitter;
|
||||
id _delegate;
|
||||
BOOL _isVertical;
|
||||
BOOL _isPaneSplitter;
|
||||
|
||||
int _currentDivider;
|
||||
float _initialOffset;
|
||||
float _preCollapsePosition;
|
||||
int _currentDivider;
|
||||
float _initialOffset;
|
||||
CPDictionary _preCollapsePositions;
|
||||
|
||||
CPString _originComponent;
|
||||
CPString _sizeComponent;
|
||||
CPString _originComponent;
|
||||
CPString _sizeComponent;
|
||||
|
||||
CPArray _DOMDividerElements;
|
||||
CPString _dividerImagePath;
|
||||
int _drawingDivider;
|
||||
CPArray _DOMDividerElements;
|
||||
CPString _dividerImagePath;
|
||||
int _drawingDivider;
|
||||
|
||||
BOOL _needsResizeSubviews;
|
||||
CPString _autosaveName;
|
||||
BOOL _shouldAutosave;
|
||||
BOOL _needsRestoreFromAutosave;
|
||||
|
||||
CPArray _buttonBars;
|
||||
BOOL _needsResizeSubviews;
|
||||
int _suppressResizeNotificationsMask;
|
||||
|
||||
CPArray _buttonBars;
|
||||
}
|
||||
|
||||
+ (CPString)defaultThemeClass
|
||||
@@ -93,11 +125,15 @@ var CPSplitViewHorizontalImage = nil,
|
||||
{
|
||||
if (self = [super initWithFrame:aFrame])
|
||||
{
|
||||
_suppressResizeNotificationsMask = 0;
|
||||
_preCollapsePositions = [CPMutableDictionary new];
|
||||
_currentDivider = CPNotFound;
|
||||
|
||||
_DOMDividerElements = [];
|
||||
_buttonBars = [];
|
||||
|
||||
_shouldAutosave = YES;
|
||||
|
||||
[self _setVertical:YES];
|
||||
}
|
||||
|
||||
@@ -412,7 +448,6 @@ var CPSplitViewHorizontalImage = nil,
|
||||
{
|
||||
_currentDivider = CPNotFound;
|
||||
[self _updateResizeCursor:anEvent];
|
||||
[self _postNotificationDidResize];
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -436,7 +471,8 @@ var CPSplitViewHorizontalImage = nil,
|
||||
[_delegate respondsToSelector:@selector(splitView:shouldCollapseSubview:forDoubleClickOnDividerAtIndex:)])
|
||||
{
|
||||
var minPosition = [self minPossiblePositionOfDividerAtIndex:i],
|
||||
maxPosition = [self maxPossiblePositionOfDividerAtIndex:i];
|
||||
maxPosition = [self maxPossiblePositionOfDividerAtIndex:i],
|
||||
_preCollapsePosition = [_preCollapsePositions objectForKey:"" + i] || 0;
|
||||
|
||||
if ([_delegate splitView:self canCollapseSubview:_subviews[i]] && [_delegate splitView:self shouldCollapseSubview:_subviews[i] forDoubleClickOnDividerAtIndex:i])
|
||||
{
|
||||
@@ -526,20 +562,34 @@ var CPSplitViewHorizontalImage = nil,
|
||||
// If we are currently tracking, keep the resize cursor active even outside of hit areas.
|
||||
if (_currentDivider === i || (_currentDivider == CPNotFound && [self cursorAtPoint:point hitDividerAtIndex:i]))
|
||||
{
|
||||
var frame = [_subviews[i] frame],
|
||||
size = frame.size[_sizeComponent],
|
||||
startPosition = frame.origin[_originComponent] + size,
|
||||
var frameA = [_subviews[i] frame],
|
||||
sizeA = frameA.size[_sizeComponent],
|
||||
startPosition = frameA.origin[_originComponent] + sizeA,
|
||||
frameB = [_subviews[i + 1] frame],
|
||||
sizeB = frameB.size[_sizeComponent],
|
||||
canShrink = [self _realPositionForPosition:startPosition - 1 ofDividerAtIndex:i] < startPosition,
|
||||
canGrow = [self _realPositionForPosition:startPosition + 1 ofDividerAtIndex:i] > startPosition,
|
||||
cursor = [CPCursor arrowCursor];
|
||||
|
||||
if (size === 0)
|
||||
if (sizeA === 0)
|
||||
canGrow = YES; // Subview is collapsed.
|
||||
else if (!canShrink &&
|
||||
[_delegate respondsToSelector:@selector(splitView:canCollapseSubview:)] &&
|
||||
[_delegate splitView:self canCollapseSubview:_subviews[i]])
|
||||
canShrink = YES; // Subview is collapsible.
|
||||
|
||||
if (sizeB === 0)
|
||||
{
|
||||
// Right/lower subview is collapsed.
|
||||
canGrow = NO;
|
||||
// It's safe to assume it can always be uncollapsed.
|
||||
canShrink = YES;
|
||||
}
|
||||
else if (!canGrow &&
|
||||
[_delegate respondsToSelector:@selector(splitView:canCollapseSubview:)] &&
|
||||
[_delegate splitView:self canCollapseSubview:_subviews[i + 1]])
|
||||
canGrow = YES; // Right/lower subview is collapsible.
|
||||
|
||||
if (_isVertical && canShrink && canGrow)
|
||||
cursor = [CPCursor resizeLeftRightCursor];
|
||||
else if (_isVertical && canShrink)
|
||||
@@ -597,7 +647,15 @@ var CPSplitViewHorizontalImage = nil,
|
||||
{
|
||||
// not sure where this should override other positions?
|
||||
if ([_delegate respondsToSelector:@selector(splitView:constrainSplitPosition:ofSubviewAt:)])
|
||||
position = [_delegate splitView:self constrainSplitPosition:position ofSubviewAt:dividerIndex];
|
||||
{
|
||||
var proposedPosition = [_delegate splitView:self constrainSplitPosition:position ofSubviewAt:dividerIndex];
|
||||
|
||||
// Silently ignore bad positions which could result from odd delegate responses. We don't want these
|
||||
// bad results to go into the system and cause havoc with frame sizes as the split view tries to resize
|
||||
// its subviews.
|
||||
if (_IS_NUMERIC(proposedPosition))
|
||||
position = proposedPosition;
|
||||
}
|
||||
|
||||
var proposedMax = [self maxPossiblePositionOfDividerAtIndex:dividerIndex],
|
||||
proposedMin = [self minPossiblePositionOfDividerAtIndex:dividerIndex],
|
||||
@@ -605,18 +663,33 @@ var CPSplitViewHorizontalImage = nil,
|
||||
actualMin = proposedMin;
|
||||
|
||||
if ([_delegate respondsToSelector:@selector(splitView:constrainMinCoordinate:ofSubviewAt:)])
|
||||
actualMin = [_delegate splitView:self constrainMinCoordinate:proposedMin ofSubviewAt:dividerIndex];
|
||||
{
|
||||
var proposedActualMin = [_delegate splitView:self constrainMinCoordinate:proposedMin ofSubviewAt:dividerIndex];
|
||||
if (_IS_NUMERIC(proposedActualMin))
|
||||
actualMin = proposedActualMin;
|
||||
}
|
||||
|
||||
if ([_delegate respondsToSelector:@selector(splitView:constrainMaxCoordinate:ofSubviewAt:)])
|
||||
actualMax = [_delegate splitView:self constrainMaxCoordinate:proposedMax ofSubviewAt:dividerIndex];
|
||||
{
|
||||
var proposedActualMax = [_delegate splitView:self constrainMaxCoordinate:proposedMax ofSubviewAt:dividerIndex];
|
||||
if (_IS_NUMERIC(proposedActualMax))
|
||||
actualMax = proposedActualMax;
|
||||
}
|
||||
|
||||
var viewA = _subviews[dividerIndex],
|
||||
viewB = _subviews[dividerIndex + 1],
|
||||
realPosition = MAX(MIN(position, actualMax), actualMin);
|
||||
|
||||
if (position < proposedMin + (actualMin - proposedMin) / 2)
|
||||
// Is this position past the halfway point to collapse?
|
||||
if (position < proposedMin + (actualMin - proposedMin) / 2)
|
||||
if ([_delegate respondsToSelector:@selector(splitView:canCollapseSubview:)])
|
||||
if ([_delegate splitView:self canCollapseSubview:viewA])
|
||||
realPosition = proposedMin;
|
||||
// We can also collapse to the right.
|
||||
if (position > proposedMax - (proposedMax - actualMax) / 2)
|
||||
if ([_delegate respondsToSelector:@selector(splitView:canCollapseSubview:)])
|
||||
if ([_delegate splitView:self canCollapseSubview:viewB])
|
||||
realPosition = proposedMax;
|
||||
|
||||
return realPosition;
|
||||
}
|
||||
@@ -628,6 +701,7 @@ var CPSplitViewHorizontalImage = nil,
|
||||
*/
|
||||
- (void)setPosition:(float)position ofDividerAtIndex:(int)dividerIndex
|
||||
{
|
||||
SPLIT_VIEW_SUPPRESS_RESIZE_NOTIFICATIONS(YES);
|
||||
[self _adjustSubviewsWithCalculatedSize];
|
||||
|
||||
var realPosition = [self _realPositionForPosition:position ofDividerAtIndex:dividerIndex];
|
||||
@@ -635,32 +709,59 @@ var CPSplitViewHorizontalImage = nil,
|
||||
var viewA = _subviews[dividerIndex],
|
||||
frameA = [viewA frame],
|
||||
viewB = _subviews[dividerIndex + 1],
|
||||
frameB = [viewB frame];
|
||||
|
||||
_preCollapsePosition = 0;
|
||||
frameB = [viewB frame],
|
||||
_preCollapsePosition = 0;
|
||||
|
||||
var preSize = frameA.size[_sizeComponent];
|
||||
frameA.size[_sizeComponent] = realPosition - frameA.origin[_originComponent];
|
||||
if (preSize !== 0 && frameA.size[_sizeComponent] === 0)
|
||||
_preCollapsePosition = preSize;
|
||||
[_subviews[dividerIndex] setFrame:frameA];
|
||||
if (preSize !== frameA.size[_sizeComponent])
|
||||
{
|
||||
SPLIT_VIEW_MAYBE_POST_WILL_RESIZE();
|
||||
[_subviews[dividerIndex] setFrame:frameA];
|
||||
SPLIT_VIEW_MAYBE_POST_DID_RESIZE();
|
||||
}
|
||||
|
||||
preSize = frameB.size[_sizeComponent];
|
||||
var preOrigin = frameB.origin[_originComponent];
|
||||
frameB.size[_sizeComponent] = frameB.origin[_originComponent] + frameB.size[_sizeComponent] - realPosition - [self dividerThickness];
|
||||
if (preSize !== 0 && frameB.size[_sizeComponent] === 0)
|
||||
_preCollapsePosition = preSize;
|
||||
_preCollapsePosition = frameB.origin[_originComponent];
|
||||
frameB.origin[_originComponent] = realPosition + [self dividerThickness];
|
||||
[_subviews[dividerIndex + 1] setFrame:frameB];
|
||||
if (preSize !== frameB.size[_sizeComponent] || preOrigin !== frameB.origin[_originComponent])
|
||||
{
|
||||
SPLIT_VIEW_MAYBE_POST_WILL_RESIZE();
|
||||
[_subviews[dividerIndex + 1] setFrame:frameB];
|
||||
SPLIT_VIEW_MAYBE_POST_DID_RESIZE();
|
||||
}
|
||||
|
||||
if (_preCollapsePosition)
|
||||
[_preCollapsePositions setObject:_preCollapsePosition forKey:"" + dividerIndex];
|
||||
|
||||
[self setNeedsDisplay:YES];
|
||||
|
||||
if (SPLIT_VIEW_DID_SUPPRESS_RESIZE_NOTIFICATION())
|
||||
[self _postNotificationDidResize];
|
||||
SPLIT_VIEW_SUPPRESS_RESIZE_NOTIFICATIONS(NO);
|
||||
}
|
||||
|
||||
- (void)setFrameSize:(CGSize)aSize
|
||||
{
|
||||
[self _adjustSubviewsWithCalculatedSize];
|
||||
if (_needsRestoreFromAutosave)
|
||||
_shouldAutosave = NO;
|
||||
else
|
||||
[self _adjustSubviewsWithCalculatedSize];
|
||||
|
||||
[super setFrameSize:aSize];
|
||||
|
||||
if (_needsRestoreFromAutosave)
|
||||
{
|
||||
_needsRestoreFromAutosave = NO;
|
||||
[self _restoreFromAutosave];
|
||||
_shouldAutosave = YES;
|
||||
}
|
||||
|
||||
[self setNeedsDisplay:YES];
|
||||
}
|
||||
|
||||
@@ -672,6 +773,7 @@ var CPSplitViewHorizontalImage = nil,
|
||||
return;
|
||||
}
|
||||
|
||||
SPLIT_VIEW_MAYBE_POST_WILL_RESIZE();
|
||||
[self _postNotificationWillResize];
|
||||
|
||||
var index = 0,
|
||||
@@ -730,9 +832,10 @@ var CPSplitViewHorizontalImage = nil,
|
||||
bounds.origin[_originComponent] += viewFrame.size[_sizeComponent] + dividerThickness;
|
||||
|
||||
[view setFrame:viewFrame];
|
||||
|
||||
}
|
||||
|
||||
[self _postNotificationDidResize];
|
||||
SPLIT_VIEW_MAYBE_POST_DID_RESIZE();
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -831,6 +934,7 @@ The sum of the views and the sum of the dividers should be equal to the size of
|
||||
@param CPButtonBar - The supplied button bar.
|
||||
@param unsigned int - The divider index the button bar will be assigned to.
|
||||
*/
|
||||
// FIXME Should be renamed to setButtonBar:ofDividerAtIndex:.
|
||||
- (void)setButtonBar:(CPButtonBar)aButtonBar forDividerAtIndex:(unsigned)dividerIndex
|
||||
{
|
||||
if (!aButtonBar)
|
||||
@@ -867,15 +971,121 @@ The sum of the views and the sum of the dividers should be equal to the size of
|
||||
|
||||
- (void)_postNotificationDidResize
|
||||
{
|
||||
[self _autosave];
|
||||
[[CPNotificationCenter defaultCenter] postNotificationName:CPSplitViewDidResizeSubviewsNotification object:self];
|
||||
}
|
||||
|
||||
/*!
|
||||
Set the name under which the split view divider positions is automatically saved to CPUserDefaults.
|
||||
|
||||
@param autosaveName the name to save under or nil to not save
|
||||
*/
|
||||
- (void)setAutosaveName:(CPString)autosaveName
|
||||
{
|
||||
if (_autosaveName == autosaveName)
|
||||
return;
|
||||
_autosaveName = autosaveName;
|
||||
}
|
||||
|
||||
/*!
|
||||
Get the name under which the split view divider position is automatically saved to CPUserDefaults.
|
||||
|
||||
@return the name to save under or nil if no auto save is active
|
||||
*/
|
||||
- (CPString)autosaveName
|
||||
{
|
||||
return _autosaveName;
|
||||
}
|
||||
|
||||
/*!
|
||||
@ignore
|
||||
*/
|
||||
- (void)_autosave
|
||||
{
|
||||
if (!_shouldAutosave)
|
||||
return;
|
||||
|
||||
var userDefaults = [CPUserDefaults standardUserDefaults],
|
||||
autosaveName = [self _framesKeyForAutosaveName:[self autosaveName]],
|
||||
autosavePrecollapseName = [self _precollapseKeyForAutosaveName:[self autosaveName]],
|
||||
count = [_subviews count],
|
||||
positions = [CPMutableArray new],
|
||||
preCollapseArray = [CPMutableArray new];
|
||||
|
||||
for (var i = 0; i < count; i++)
|
||||
{
|
||||
var frame = [_subviews[i] frame];
|
||||
[positions addObject:CPStringFromRect(frame)];
|
||||
[preCollapseArray addObject:[_preCollapsePositions objectForKey:"" + i]];
|
||||
}
|
||||
|
||||
[userDefaults setObject:positions forKey:autosaveName];
|
||||
[userDefaults setObject:preCollapseArray forKey:autosavePrecollapseName];
|
||||
}
|
||||
|
||||
/*!
|
||||
@ignore
|
||||
*/
|
||||
- (void)_restoreFromAutosave
|
||||
{
|
||||
if (!_autosaveName)
|
||||
return;
|
||||
|
||||
var autosaveName = [self _framesKeyForAutosaveName:[self autosaveName]],
|
||||
autosavePrecollapseName = [self _precollapseKeyForAutosaveName:[self autosaveName]],
|
||||
userDefaults = [CPUserDefaults standardUserDefaults],
|
||||
frames = [userDefaults objectForKey:autosaveName],
|
||||
preCollapseArray = [userDefaults objectForKey:autosavePrecollapseName];
|
||||
|
||||
if (frames)
|
||||
{
|
||||
var dividerThickness = [self dividerThickness],
|
||||
position = 0;
|
||||
|
||||
_shouldAutosave = NO;
|
||||
for (var i = 0, count = [frames count] - 1; i < count; i++)
|
||||
{
|
||||
var frame = CPRectFromString(frames[i]);
|
||||
position += frame.size[_sizeComponent];
|
||||
|
||||
[self setPosition:position ofDividerAtIndex:i];
|
||||
|
||||
position += dividerThickness;
|
||||
}
|
||||
_shouldAutosave = YES;
|
||||
}
|
||||
|
||||
if (preCollapseArray)
|
||||
{
|
||||
_preCollapsePositions = [CPMutableDictionary new];
|
||||
for (var i = 0, count = [preCollapseArray count]; i < count; i++)
|
||||
[_preCollapsePositions setObject:preCollapseArray[i] forKey:i + ""];
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
@ignore
|
||||
*/
|
||||
- (CPString)_framesKeyForAutosaveName:(CPString)theAutosaveName
|
||||
{
|
||||
return @"CPSplitView Subview Frames " + theAutosaveName;
|
||||
}
|
||||
|
||||
/*!
|
||||
@ignore
|
||||
*/
|
||||
- (CPString)_precollapseKeyForAutosaveName:(CPString)theAutosaveName
|
||||
{
|
||||
return @"CPSplitView Subview Precollapse Positions " + theAutosaveName;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
var CPSplitViewDelegateKey = "CPSplitViewDelegateKey",
|
||||
CPSplitViewIsVerticalKey = "CPSplitViewIsVerticalKey",
|
||||
CPSplitViewIsPaneSplitterKey = "CPSplitViewIsPaneSplitterKey",
|
||||
CPSplitViewButtonBarsKey = "CPSplitViewButtonBarsKey";
|
||||
CPSplitViewButtonBarsKey = "CPSplitViewButtonBarsKey",
|
||||
CPSplitViewAutosaveNameKey = "CPSplitViewAutosaveNameKey";
|
||||
|
||||
@implementation CPSplitView (CPCoding)
|
||||
|
||||
@@ -889,7 +1099,11 @@ var CPSplitViewDelegateKey = "CPSplitViewDelegateKey",
|
||||
|
||||
if (self)
|
||||
{
|
||||
_suppressResizeNotificationsMask = 0;
|
||||
_preCollapsePositions = [CPMutableDictionary new];
|
||||
|
||||
_currentDivider = CPNotFound;
|
||||
_shouldAutosave = YES;
|
||||
|
||||
_DOMDividerElements = [];
|
||||
|
||||
@@ -899,6 +1113,13 @@ var CPSplitViewDelegateKey = "CPSplitViewDelegateKey",
|
||||
|
||||
_isPaneSplitter = [aCoder decodeBoolForKey:CPSplitViewIsPaneSplitterKey];
|
||||
[self _setVertical:[aCoder decodeBoolForKey:CPSplitViewIsVerticalKey]];
|
||||
|
||||
[self setAutosaveName:[aCoder decodeObjectForKey:CPSplitViewAutosaveNameKey]];
|
||||
|
||||
// We have to wait until we know our frame size before restoring, or the frame resize later will throw
|
||||
// away the restored size.
|
||||
if (_autosaveName)
|
||||
_needsRestoreFromAutosave = YES;
|
||||
}
|
||||
|
||||
return self;
|
||||
@@ -919,6 +1140,8 @@ var CPSplitViewDelegateKey = "CPSplitViewDelegateKey",
|
||||
|
||||
[aCoder encodeBool:_isVertical forKey:CPSplitViewIsVerticalKey];
|
||||
[aCoder encodeBool:_isPaneSplitter forKey:CPSplitViewIsPaneSplitterKey];
|
||||
|
||||
[aCoder encodeObject:_autosaveName forKey:CPSplitViewAutosaveNameKey];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -25,11 +25,11 @@
|
||||
@import <AppKit/CPTextField.j>
|
||||
|
||||
|
||||
var CPStepperButtonsSize = CPSizeMake(19, 13);
|
||||
|
||||
/*! CPStepper is an implementation of Cocoa NSStepper.
|
||||
/*!
|
||||
CPStepper is an implementation of Cocoa NSStepper.
|
||||
|
||||
This control display a two part button that can be used to increase or decrease a value with a given interval.
|
||||
This control displays a two part button that can be used to increase or decrease a value with a given interval.
|
||||
*/
|
||||
@implementation CPStepper: CPControl
|
||||
{
|
||||
@@ -45,7 +45,8 @@ var CPStepperButtonsSize = CPSizeMake(19, 13);
|
||||
#pragma mark -
|
||||
#pragma mark Initialization
|
||||
|
||||
/*! Initializes a CPStepper with given values
|
||||
/*!
|
||||
Initializes a CPStepper with given values.
|
||||
@param aValue the initial value of the CPStepper
|
||||
@param minValue the minimal acceptable value of the stepper
|
||||
@param maxValue the maximal acceptable value of the stepper
|
||||
@@ -53,7 +54,7 @@ var CPStepperButtonsSize = CPSizeMake(19, 13);
|
||||
*/
|
||||
+ (CPStepper)stepperWithInitialValue:(float)aValue minValue:(float)aMinValue maxValue:(float)aMaxValue
|
||||
{
|
||||
var stepper = [[CPStepper alloc] initWithFrame:CPRectMake(0, 0, 19, 25)];
|
||||
var stepper = [[CPStepper alloc] initWithFrame:_CGRectMake(0, 0, 19, 25)];
|
||||
[stepper setDoubleValue:aValue];
|
||||
[stepper setMinValue:aMinValue];
|
||||
[stepper setMaxValue:aMaxValue];
|
||||
@@ -61,10 +62,12 @@ var CPStepperButtonsSize = CPSizeMake(19, 13);
|
||||
return stepper;
|
||||
}
|
||||
|
||||
/*! Initializes a CPStepper with default values:
|
||||
/*!
|
||||
Initializes a CPStepper with default values:
|
||||
- minValue = 0.0
|
||||
- maxValue = 59.0
|
||||
- value = 0.0
|
||||
|
||||
@return Initialized CPStepper
|
||||
*/
|
||||
+ (CPStepper)stepper
|
||||
@@ -72,7 +75,8 @@ var CPStepperButtonsSize = CPSizeMake(19, 13);
|
||||
return [CPStepper stepperWithInitialValue:0.0 minValue:0.0 maxValue:59.0];
|
||||
}
|
||||
|
||||
/*! Initializes the CPStepper
|
||||
/*!
|
||||
Initializes a CPStepper.
|
||||
@param aFrame the frame of the control
|
||||
@return initialized CPStepper
|
||||
*/
|
||||
@@ -87,14 +91,14 @@ var CPStepperButtonsSize = CPSizeMake(19, 13);
|
||||
|
||||
[self setDoubleValue:0.0];
|
||||
|
||||
_buttonUp = [[CPButton alloc] initWithFrame:CPRectMake(aFrame.size.width - CPStepperButtonsSize.width, 0, CPStepperButtonsSize.width, CPStepperButtonsSize.height)];
|
||||
_buttonUp = [[CPButton alloc] initWithFrame:_CGRectMakeZero()];
|
||||
[_buttonUp setContinuous:YES];
|
||||
[_buttonUp setTarget:self];
|
||||
[_buttonUp setAction:@selector(_buttonDidClick:)];
|
||||
[_buttonUp setAutoresizingMask:CPViewNotSizable];
|
||||
[self addSubview:_buttonUp];
|
||||
|
||||
_buttonDown = [[CPButton alloc] initWithFrame:CPRectMake(aFrame.size.width - CPStepperButtonsSize.width, CPStepperButtonsSize.height, CPStepperButtonsSize.width, CPStepperButtonsSize.height - 1)];
|
||||
_buttonDown = [[CPButton alloc] initWithFrame:_CGRectMakeZero()];
|
||||
[_buttonDown setContinuous:YES];
|
||||
[_buttonDown setTarget:self];
|
||||
[_buttonDown setAction:@selector(_buttonDidClick:)];
|
||||
@@ -110,7 +114,8 @@ var CPStepperButtonsSize = CPSizeMake(19, 13);
|
||||
#pragma mark -
|
||||
#pragma mark Superclass overrides
|
||||
|
||||
/*! set if the CPStepper is enabled or not
|
||||
/*!
|
||||
Set if the CPStepper is enabled or not.
|
||||
@param shouldEnabled BOOL that define if stepper is enabled or not.
|
||||
*/
|
||||
- (void)setEnabled:(BOOL)shouldEnabled
|
||||
@@ -121,19 +126,30 @@ var CPStepperButtonsSize = CPSizeMake(19, 13);
|
||||
[_buttonDown setEnabled:shouldEnabled];
|
||||
}
|
||||
|
||||
/*! set the frame of the CPStepper and check if width is not smaller than theme min-size
|
||||
@param aFrame the frame
|
||||
*/
|
||||
|
||||
- (void)setFrame:(CGRect)aFrame
|
||||
{
|
||||
if (aFrame.size.width >= CGRectGetWidth(aFrame))
|
||||
[super setFrame:aFrame];
|
||||
var upSize = [self valueForThemeAttribute:@"up-button-size"],
|
||||
downSize = [self valueForThemeAttribute:@"down-button-size"],
|
||||
minSize = _CGSizeMake(upSize.width, upSize.height + downSize.height),
|
||||
frame = _CGRectMakeCopy(aFrame);
|
||||
|
||||
frame.size.width = Math.max(minSize.width, frame.size.width);
|
||||
frame.size.height = Math.max(minSize.height, frame.size.height);
|
||||
[super setFrame:frame];
|
||||
}
|
||||
|
||||
/*! @ignore
|
||||
*/
|
||||
/*! @ignore */
|
||||
- (void)layoutSubviews
|
||||
{
|
||||
var aFrame = [self frame],
|
||||
upSize = [self valueForThemeAttribute:@"up-button-size"],
|
||||
downSize = [self valueForThemeAttribute:@"down-button-size"],
|
||||
upFrame = _CGRectMake(aFrame.size.width - upSize.width, 0, upSize.width, upSize.height),
|
||||
downFrame = _CGRectMake(aFrame.size.width - downSize.width, upSize.height, downSize.width, downSize.height);
|
||||
[_buttonUp setFrame:upFrame];
|
||||
[_buttonDown setFrame:downFrame];
|
||||
|
||||
[_buttonUp setValue:[self valueForThemeAttribute:@"bezel-color-up-button" inState:CPThemeStateBordered] forThemeAttribute:@"bezel-color" inState:CPThemeStateBordered];
|
||||
[_buttonUp setValue:[self valueForThemeAttribute:@"bezel-color-up-button" inState:CPThemeStateBordered | CPThemeStateDisabled] forThemeAttribute:@"bezel-color" inState:CPThemeStateBordered | CPThemeStateDisabled];
|
||||
[_buttonUp setValue:[self valueForThemeAttribute:@"bezel-color-up-button" inState:CPThemeStateBordered | CPThemeStateHighlighted] forThemeAttribute:@"bezel-color" inState:CPThemeStateBordered | CPThemeStateHighlighted];
|
||||
@@ -142,7 +158,8 @@ var CPStepperButtonsSize = CPSizeMake(19, 13);
|
||||
[_buttonDown setValue:[self valueForThemeAttribute:@"bezel-color-down-button" inState:CPThemeStateBordered | CPThemeStateHighlighted] forThemeAttribute:@"bezel-color" inState:CPThemeStateBordered | CPThemeStateHighlighted];
|
||||
}
|
||||
|
||||
/*! set if CPStepper should autorepeat
|
||||
/*!
|
||||
Set if CPStepper should autorepeat.
|
||||
@param shouldAutoRepeat if YES, the first mouse down does one increment (decrement) and, after each delay of 0.5 seconds
|
||||
*/
|
||||
- (void)setAutorepeat:(BOOL)shouldAutoRepeat
|
||||
@@ -151,7 +168,8 @@ var CPStepperButtonsSize = CPSizeMake(19, 13);
|
||||
[_buttonDown setContinuous:shouldAutoRepeat];
|
||||
}
|
||||
|
||||
/*! set the current value of the stepper
|
||||
/*!
|
||||
Set the current value of the stepper.
|
||||
@param aValue a float containing the value
|
||||
*/
|
||||
- (void)setDoubleValue:(float)aValue
|
||||
@@ -167,8 +185,7 @@ var CPStepperButtonsSize = CPSizeMake(19, 13);
|
||||
#pragma mark -
|
||||
#pragma mark Actions
|
||||
|
||||
/*! @ignore
|
||||
*/
|
||||
/*! @ignore */
|
||||
- (IBAction)_buttonDidClick:(id)aSender
|
||||
{
|
||||
if (![self isEnabled])
|
||||
@@ -183,7 +200,8 @@ var CPStepperButtonsSize = CPSizeMake(19, 13);
|
||||
[self sendAction:_action to:_target];
|
||||
}
|
||||
|
||||
/*! @perform a programatic click on up button
|
||||
/*!
|
||||
Perform a programatic click on up button.
|
||||
@param aSender sender of the action
|
||||
*/
|
||||
- (IBAction)performClickUp:(id)aSender
|
||||
@@ -191,7 +209,8 @@ var CPStepperButtonsSize = CPSizeMake(19, 13);
|
||||
[_buttonUp performClick:aSender];
|
||||
}
|
||||
|
||||
/*! @perform a programatic click on down button
|
||||
/*!
|
||||
Perform a programatic click on down button.
|
||||
@param aSender sender of the action
|
||||
*/
|
||||
- (IBAction)performClickDown:(id)aSender
|
||||
@@ -210,8 +229,8 @@ var CPStepperButtonsSize = CPSizeMake(19, 13);
|
||||
|
||||
+ (id)themeAttributes
|
||||
{
|
||||
return [CPDictionary dictionaryWithObjects:[[CPNull null], [CPNull null]]
|
||||
forKeys:[@"bezel-color-up-button", @"bezel-color-down-button"]];
|
||||
return [CPDictionary dictionaryWithObjects:[[CPNull null], [CPNull null], _CGSizeMakeZero(), _CGSizeMakeZero()]
|
||||
forKeys:[@"bezel-color-up-button", @"bezel-color-down-button", @"up-button-size", @"down-button-size"]];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -132,7 +132,7 @@ CPTableColumnUserResizingMask = 1 << 1;
|
||||
{
|
||||
var min = [self minWidth],
|
||||
max = [self maxWidth],
|
||||
newWidth = MIN(MAX(width, min), max);
|
||||
newWidth = ROUND(MIN(MAX(width, min), max));
|
||||
|
||||
[self setWidth:newWidth];
|
||||
|
||||
@@ -594,7 +594,22 @@ CPTableColumnUserResizingMask = 1 << 1;
|
||||
[super bind:aBinding toObject:anObject withKeyPath:aKeyPath options:options];
|
||||
|
||||
if (![aBinding isEqual:@"someListOfExceptedBindings(notAcceptedBindings)"])
|
||||
[[self tableView] _establishBindingsIfUnbound:anObject];
|
||||
{
|
||||
// Bind the table to the array controller this column is bound to.
|
||||
// Note that anObject might not be the array controller. E.g. the keypath could be something like
|
||||
// somePathTo.anArrayController.arrangedObjects.aKey. Cocoa doesn't support this but it is consistent
|
||||
// and it makes sense.
|
||||
var acIndex = aKeyPath.lastIndexOf("arrangedObjects."),
|
||||
arrayController = anObject;
|
||||
|
||||
if (acIndex > 1)
|
||||
{
|
||||
var firstPart = aKeyPath.substring(0, acIndex - 1);
|
||||
arrayController = [anObject valueForKeyPath:firstPart];
|
||||
}
|
||||
|
||||
[[self tableView] _establishBindingsIfUnbound:arrayController];
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
|
||||
@@ -509,6 +509,11 @@ NOT YET IMPLEMENTED
|
||||
_objectValues = { };
|
||||
_cachedRowHeights = [];
|
||||
|
||||
// Otherwise, if we have a row marked as group with a
|
||||
// index greater than the new number or rows
|
||||
// it keeps the the graphical group style.
|
||||
[_groupRows removeAllIndexes];
|
||||
|
||||
// This updates the size too.
|
||||
[self noteNumberOfRowsChanged];
|
||||
|
||||
@@ -1984,7 +1989,7 @@ NOT YET IMPLEMENTED
|
||||
// so we should size the last resized to fit
|
||||
|
||||
// find the last visisble column
|
||||
while (count-- && [_tableColumns[count] isHidden]) ;
|
||||
while (count-- && [_tableColumns[count] isHidden]);
|
||||
|
||||
// find the max x, but subtract a single pixel since the spacing isn't applicable here.
|
||||
var delta = superviewWidth - _CGRectGetMaxX([self rectOfColumn:count]) - ([self intercellSpacing].width || 1),
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* CPTextField.j
|
||||
* AppKit
|
||||
@@ -29,7 +28,7 @@
|
||||
@import "_CPImageAndTextView.j"
|
||||
|
||||
|
||||
CPTextFieldSquareBezel = 0; /*! A textfield bezel with a squared corners. */
|
||||
CPTextFieldSquareBezel = 0; /*! A textfield bezel with squared corners. */
|
||||
CPTextFieldRoundedBezel = 1; /*! A textfield bezel with rounded corners. */
|
||||
|
||||
CPTextFieldDidFocusNotification = @"CPTextFieldDidFocusNotification";
|
||||
@@ -574,11 +573,17 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
||||
#if PLATFORM(DOM)
|
||||
|
||||
var element = [self _inputElement],
|
||||
newValue = element.value,
|
||||
error = @"";
|
||||
|
||||
if (newValue !== _stringValue)
|
||||
{
|
||||
[self _setStringValue:newValue];
|
||||
}
|
||||
|
||||
// If there is a formatter, always give it a chance to reject the resignation,
|
||||
// even if the value has not changed.
|
||||
if ([self _valueIsValid:element.value] === NO)
|
||||
if ([self _valueIsValid:newValue] === NO)
|
||||
{
|
||||
[self setThemeState:CPThemeStateEditing];
|
||||
element.focus();
|
||||
@@ -774,6 +779,13 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
||||
|
||||
- (void)insertNewline:(id)sender
|
||||
{
|
||||
var newValue = [self _inputElement].value;
|
||||
|
||||
if (newValue !== _stringValue)
|
||||
{
|
||||
[self _setStringValue:newValue];
|
||||
}
|
||||
|
||||
if ([self _valueIsValid:_stringValue])
|
||||
{
|
||||
// If _isEditing == YES then the target action can also be called via
|
||||
@@ -1010,7 +1022,6 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
|
||||
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
|
||||
{
|
||||
[self setFrameSize:[self _minimumFrameSize]];
|
||||
|
||||
@@ -310,6 +310,14 @@ var CPThemeStateAutoCompleting = @"CPThemeStateAutoCompleting",
|
||||
[self _controlTextDidChange];
|
||||
}
|
||||
|
||||
- (void)_updatePlaceholderState
|
||||
{
|
||||
if (([[self _tokens] count] === 0) && ![self hasThemeState:CPThemeStateEditing])
|
||||
[self setThemeState:CPTextFieldStatePlaceholder];
|
||||
else
|
||||
[self unsetThemeState:CPTextFieldStatePlaceholder];
|
||||
}
|
||||
|
||||
// =============
|
||||
// = RESPONDER =
|
||||
// =============
|
||||
|
||||
@@ -271,6 +271,7 @@ var CPWindowActionMessageKeys = [
|
||||
BOOL _isAnimating;
|
||||
BOOL _hasShadow;
|
||||
BOOL _isMovableByWindowBackground;
|
||||
BOOL _isMovable;
|
||||
unsigned _shadowStyle;
|
||||
BOOL _showsResizeIndicator;
|
||||
|
||||
@@ -404,6 +405,7 @@ CPTexturedBackgroundWindowMask
|
||||
_registeredDraggedTypesArray = [];
|
||||
_isSheet = NO;
|
||||
_acceptsMouseMovedEvents = YES;
|
||||
_isMovable = YES;
|
||||
|
||||
// Set up our window number.
|
||||
_windowNumber = [CPApp._windows count];
|
||||
@@ -1438,6 +1440,23 @@ CPTexturedBackgroundWindowMask
|
||||
return _isMovableByWindowBackground;
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets whether the window can be moved.
|
||||
@param shouldBeMovable \c YES makes the window movable.
|
||||
*/
|
||||
- (void)setMovable:(BOOL)shouldBeMovable
|
||||
{
|
||||
_isMovable = shouldBeMovable;
|
||||
}
|
||||
|
||||
/*!
|
||||
Returns \c YES if the window can be moved.
|
||||
*/
|
||||
- (void)isMovable
|
||||
{
|
||||
return _isMovable;
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the window location to be the center of the screen
|
||||
*/
|
||||
|
||||
@@ -111,7 +111,7 @@ var _CPWindowViewResizeIndicatorImage = nil;
|
||||
return [self trackResizeWithEvent:anEvent];
|
||||
}
|
||||
|
||||
if ([theWindow isMovableByWindowBackground])
|
||||
if ([theWindow isMovable] && [theWindow isMovableByWindowBackground])
|
||||
[self trackMoveWithEvent:anEvent];
|
||||
|
||||
else
|
||||
@@ -174,6 +174,9 @@ var _CPWindowViewResizeIndicatorImage = nil;
|
||||
|
||||
- (void)trackMoveWithEvent:(CPEvent)anEvent
|
||||
{
|
||||
if (![[self window] isMovable])
|
||||
return;
|
||||
|
||||
var type = [anEvent type];
|
||||
|
||||
if (type === CPLeftMouseUp)
|
||||
|
||||
@@ -34,9 +34,9 @@
|
||||
@import "_CPCibWindowTemplate.j"
|
||||
|
||||
|
||||
CPCibOwner = @"CPCibOwner",
|
||||
CPCibTopLevelObjects = @"CPCibTopLevelObjects",
|
||||
CPCibReplacementClasses = @"CPCibReplacementClasses",
|
||||
CPCibOwner = @"CPCibOwner";
|
||||
CPCibTopLevelObjects = @"CPCibTopLevelObjects";
|
||||
CPCibReplacementClasses = @"CPCibReplacementClasses";
|
||||
CPCibExternalObjects = @"CPCibExternalObjects";
|
||||
|
||||
var CPCibObjectDataKey = @"CPCibObjectDataKey";
|
||||
|
||||
@@ -264,7 +264,8 @@ var PrimaryPlatformWindow = NULL;
|
||||
_title = aTitle;
|
||||
|
||||
#if PLATFORM(DOM)
|
||||
if (_DOMWindow && _DOMWindow.document && (aWindow === [CPApp mainWindow]))
|
||||
if (_DOMWindow && _DOMWindow.document
|
||||
&& (aWindow === [CPApp mainWindow] || [aWindow platformWindow] !== [CPPlatformWindow primaryPlatformWindow]))
|
||||
_DOMWindow.document.title = _title;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -708,7 +708,8 @@ var ModifierKeyCodes = [
|
||||
var characters;
|
||||
|
||||
// Handle key codes for which String.fromCharCode won't work.
|
||||
if (aDOMEvent.which === 0 || aDOMEvent.charCode === 0)
|
||||
// Refs #1036: In Internet Explorer, both 'which' and 'charCode' are undefined for special keys.
|
||||
if (aDOMEvent.which === 0 || aDOMEvent.charCode === 0 || (aDOMEvent.which === undefined && aDOMEvent.charCode === undefined))
|
||||
characters = KeyCodesToUnicodeMap[_keyCode];
|
||||
|
||||
if (!characters)
|
||||
|
||||
|
Before Width: | Height: | Size: 161 B |
|
Before Width: | Height: | Size: 146 B After Width: | Height: | Size: 123 B |
|
After Width: | Height: | Size: 120 B |
|
After Width: | Height: | Size: 162 B |
|
After Width: | Height: | Size: 155 B |
|
Before Width: | Height: | Size: 154 B |
|
Before Width: | Height: | Size: 436 B |
|
Before Width: | Height: | Size: 452 B |
|
Before Width: | Height: | Size: 444 B After Width: | Height: | Size: 205 B |
|
After Width: | Height: | Size: 122 B |
|
After Width: | Height: | Size: 158 B |
|
After Width: | Height: | Size: 157 B |
|
Before Width: | Height: | Size: 460 B After Width: | Height: | Size: 208 B |
|
After Width: | Height: | Size: 147 B |
|
After Width: | Height: | Size: 147 B |
|
After Width: | Height: | Size: 185 B |
|
After Width: | Height: | Size: 179 B |
|
Before Width: | Height: | Size: 145 B |
|
After Width: | Height: | Size: 220 B |
|
After Width: | Height: | Size: 122 B |
|
After Width: | Height: | Size: 158 B |
|
After Width: | Height: | Size: 152 B |
|
After Width: | Height: | Size: 218 B |
|
Before Width: | Height: | Size: 147 B |
|
After Width: | Height: | Size: 123 B |
|
After Width: | Height: | Size: 158 B |
|
After Width: | Height: | Size: 157 B |
|
After Width: | Height: | Size: 145 B |
|
After Width: | Height: | Size: 285 B |
|
After Width: | Height: | Size: 301 B |
|
After Width: | Height: | Size: 153 B |
|
After Width: | Height: | Size: 123 B |
|
After Width: | Height: | Size: 157 B |
|
After Width: | Height: | Size: 310 B |
|
After Width: | Height: | Size: 139 B |
|
After Width: | Height: | Size: 302 B |
|
Before Width: | Height: | Size: 423 B After Width: | Height: | Size: 189 B |
|
Before Width: | Height: | Size: 136 B After Width: | Height: | Size: 119 B |
|
After Width: | Height: | Size: 160 B |
|
After Width: | Height: | Size: 119 B |
|
After Width: | Height: | Size: 163 B |
|
Before Width: | Height: | Size: 421 B |
|
Before Width: | Height: | Size: 143 B |
|
Before Width: | Height: | Size: 424 B |
|
After Width: | Height: | Size: 154 B |
|
After Width: | Height: | Size: 116 B |
|
After Width: | Height: | Size: 154 B |
|
Before Width: | Height: | Size: 433 B After Width: | Height: | Size: 186 B |
|
After Width: | Height: | Size: 213 B |
|
After Width: | Height: | Size: 145 B |
|
After Width: | Height: | Size: 194 B |
|
After Width: | Height: | Size: 145 B |
|
After Width: | Height: | Size: 178 B |
|
After Width: | Height: | Size: 220 B |
|
After Width: | Height: | Size: 154 B |
|
After Width: | Height: | Size: 116 B |
|
After Width: | Height: | Size: 151 B |
|
After Width: | Height: | Size: 214 B |
|
After Width: | Height: | Size: 204 B |
@@ -633,54 +633,107 @@ var themedButtonValues = nil,
|
||||
+ (CPScroller)themedVerticalScroller
|
||||
{
|
||||
var scroller = [self makeVerticalScroller],
|
||||
trackColor = PatternColor("scroller-vertical-track.png", 15.0, 1.0),
|
||||
disabledTrackColor = PatternColor("scroller-vertical-track-disabled.png", 15.0, 1.0),
|
||||
|
||||
upArrowColor = PatternColor("scroller-up-arrow.png", 15.0, 24.0),
|
||||
highlightedUpArrowColor = PatternColor("scroller-up-arrow-highlighted.png", 15.0, 24.0),
|
||||
disabledUpArrowColor = PatternColor("scroller-up-arrow-disabled.png", 15.0, 24.0),
|
||||
|
||||
downArrowColor = PatternColor("scroller-down-arrow.png", 15.0, 24.0),
|
||||
highlightedDownArrowColor = PatternColor("scroller-down-arrow-highlighted.png", 15.0, 24.0),
|
||||
disabledDownArrowColor = PatternColor("scroller-down-arrow-disabled.png", 15.0, 24.0),
|
||||
|
||||
knobColor = PatternColor(
|
||||
trackColor = PatternColor(
|
||||
[
|
||||
["scroller-vertical-knob-top.png", 15.0, 10.0],
|
||||
["scroller-vertical-knob-center.png", 15.0, 1.0],
|
||||
["scroller-vertical-knob-bottom.png", 15.0, 10.0]
|
||||
["scroller-vertical-track-top.png", 9.0, 4.0],
|
||||
["scroller-vertical-track-center.png", 9.0, 1.0],
|
||||
["scroller-vertical-track-bottom.png", 9.0, 4.0]
|
||||
],
|
||||
PatternIsVertical),
|
||||
|
||||
disabledKnobColor = PatternColor(
|
||||
trackColorLight = PatternColor(
|
||||
[
|
||||
["scroller-vertical-knob-disabled-top.png", 15.0, 10.0],
|
||||
["scroller-vertical-knob-disabled-center.png", 15.0, 1.0],
|
||||
["scroller-vertical-knob-disabled-bottom.png", 15.0, 10.0]
|
||||
["scroller-vertical-track-light-top.png", 9.0, 4.0],
|
||||
["scroller-vertical-track-light-center.png", 9.0, 1.0],
|
||||
["scroller-vertical-track-light-bottom.png", 9.0, 4.0]
|
||||
],
|
||||
PatternIsVertical),
|
||||
|
||||
trackColorDark = PatternColor(
|
||||
[
|
||||
["scroller-vertical-track-dark-top.png", 9.0, 4.0],
|
||||
["scroller-vertical-track-dark-center.png", 9.0, 1.0],
|
||||
["scroller-vertical-track-dark-bottom.png", 9.0, 4.0]
|
||||
],
|
||||
PatternIsVertical),
|
||||
|
||||
trackColorLegacy = PatternColor("scroller-legacy-vertical-track-center.png", 14.0, 1.0),
|
||||
incrementColorLegacy = PatternColor("scroller-legacy-vertical-track-bottom.png", 14.0, 11.0),
|
||||
decrementColorLegacy = PatternColor("scroller-legacy-vertical-track-top.png", 14.0, 11.0),
|
||||
|
||||
knobColor = PatternColor(
|
||||
[
|
||||
["scroller-vertical-knob-top.png", 9.0, 4.0],
|
||||
["scroller-vertical-knob-center.png", 9.0, 1.0],
|
||||
["scroller-vertical-knob-bottom.png", 9.0, 4.0]
|
||||
],
|
||||
PatternIsVertical),
|
||||
|
||||
knobColorLight = PatternColor(
|
||||
[
|
||||
["scroller-vertical-knob-light-top.png", 9.0, 4.0],
|
||||
["scroller-vertical-knob-light-center.png", 9.0, 1.0],
|
||||
["scroller-vertical-knob-light-bottom.png", 9.0, 4.0]
|
||||
],
|
||||
PatternIsVertical),
|
||||
|
||||
knobColorDark = PatternColor(
|
||||
[
|
||||
["scroller-vertical-knob-dark-top.png", 9.0, 4.0],
|
||||
["scroller-vertical-knob-dark-center.png", 9.0, 1.0],
|
||||
["scroller-vertical-knob-dark-bottom.png", 9.0, 4.0]
|
||||
],
|
||||
PatternIsVertical),
|
||||
|
||||
knobColorLegacy = PatternColor(
|
||||
[
|
||||
["scroller-legacy-vertical-knob-top.png", 14.0, 3.0],
|
||||
["scroller-legacy-vertical-knob-center.png", 14.0, 1.0],
|
||||
["scroller-legacy-vertical-knob-bottom.png", 14.0, 3.0]
|
||||
],
|
||||
PatternIsVertical);
|
||||
|
||||
|
||||
themedVerticalScrollerValues =
|
||||
[
|
||||
[@"minimum-knob-length", 21.0, CPThemeStateVertical],
|
||||
[@"knob-inset", CGInsetMake(0.0, 0.0, 0.0, 0.0), CPThemeStateVertical],
|
||||
[@"track-inset", CGInsetMake(-10.0, 0.0, -10.0, 0.0), CPThemeStateVertical],
|
||||
// Common
|
||||
[@"minimum-knob-length", 21.0, CPThemeStateVertical],
|
||||
|
||||
[@"knob-color", knobColor, CPThemeStateVertical],
|
||||
[@"knob-color", disabledKnobColor, CPThemeStateVertical | CPThemeStateDisabled],
|
||||
// Overlay
|
||||
[@"scroller-width", 9.0, CPThemeStateVertical],
|
||||
[@"knob-inset", CGInsetMake(2.0, 0.0, 0.0, 0.0), CPThemeStateVertical],
|
||||
[@"track-inset", CGInsetMake(2.0, 0.0, 2.0, 0.0), CPThemeStateVertical],
|
||||
[@"track-border-overlay", 12.0, CPThemeStateVertical],
|
||||
[@"knob-slot-color", [CPNull null], CPThemeStateVertical],
|
||||
[@"knob-slot-color", trackColor, CPThemeStateVertical | CPThemeStateSelected],
|
||||
[@"knob-slot-color", trackColorLight, CPThemeStateVertical | CPThemeStateSelected | CPThemeStateScrollerKnobLight],
|
||||
[@"knob-slot-color", trackColorDark, CPThemeStateVertical | CPThemeStateSelected | CPThemeStateScrollerKnobDark],
|
||||
[@"knob-color", knobColor, CPThemeStateVertical],
|
||||
[@"knob-color", knobColorLight, CPThemeStateVertical | CPThemeStateScrollerKnobLight],
|
||||
[@"knob-color", knobColorDark, CPThemeStateVertical | CPThemeStateScrollerKnobDark],
|
||||
[@"increment-line-color", [CPNull null], CPThemeStateVertical],
|
||||
[@"decrement-line-color", [CPNull null], CPThemeStateVertical],
|
||||
[@"decrement-line-size", CPSizeMakeZero(), CPThemeStateVertical],
|
||||
[@"increment-line-size", CPSizeMakeZero(), CPThemeStateVertical],
|
||||
|
||||
[@"knob-slot-color", trackColor, CPThemeStateVertical],
|
||||
[@"knob-slot-color", disabledTrackColor, CPThemeStateVertical | CPThemeStateDisabled],
|
||||
|
||||
[@"decrement-line-size", CGSizeMake(15.0, 24.0), CPThemeStateVertical],
|
||||
[@"decrement-line-color", upArrowColor, CPThemeStateVertical],
|
||||
[@"decrement-line-color", highlightedUpArrowColor, CPThemeStateVertical | CPThemeStateHighlighted],
|
||||
[@"decrement-line-color", disabledUpArrowColor, CPThemeStateVertical | CPThemeStateDisabled],
|
||||
|
||||
[@"increment-line-size", CGSizeMake(15.0, 24.0), CPThemeStateVertical],
|
||||
[@"increment-line-color", downArrowColor, CPThemeStateVertical],
|
||||
[@"increment-line-color", highlightedDownArrowColor, CPThemeStateVertical | CPThemeStateHighlighted],
|
||||
[@"increment-line-color", disabledDownArrowColor, CPThemeStateVertical | CPThemeStateDisabled]
|
||||
// Legacy
|
||||
[@"scroller-width", 14.0, CPThemeStateVertical | CPThemeStateScrollViewLegacy],
|
||||
[@"knob-inset", CGInsetMake(0.0, 0.0, 0.0, 0.0), CPThemeStateVertical | CPThemeStateScrollViewLegacy],
|
||||
[@"track-inset", CGInsetMake(0.0, 0.0, 0.0, 0.0), CPThemeStateVertical | CPThemeStateScrollViewLegacy],
|
||||
[@"track-border-overlay", 0.0, CPThemeStateVertical | CPThemeStateScrollViewLegacy],
|
||||
[@"knob-slot-color", trackColorLegacy, CPThemeStateVertical | CPThemeStateScrollViewLegacy],
|
||||
[@"knob-slot-color", trackColorLegacy, CPThemeStateVertical | CPThemeStateScrollViewLegacy | CPThemeStateSelected],
|
||||
[@"knob-slot-color", trackColorLegacy, CPThemeStateVertical | CPThemeStateScrollViewLegacy | CPThemeStateSelected | CPThemeStateScrollerKnobLight],
|
||||
[@"knob-slot-color", trackColorLegacy, CPThemeStateVertical | CPThemeStateScrollViewLegacy | CPThemeStateSelected | CPThemeStateScrollerKnobDark],
|
||||
[@"knob-slot-color", trackColorLegacy, CPThemeStateVertical | CPThemeStateScrollViewLegacy | CPThemeStateScrollerKnobDark],
|
||||
[@"knob-slot-color", trackColorLegacy, CPThemeStateVertical | CPThemeStateScrollViewLegacy | CPThemeStateScrollerKnobLight],
|
||||
[@"knob-color", knobColorLegacy, CPThemeStateVertical | CPThemeStateScrollViewLegacy],
|
||||
[@"knob-color", knobColorLegacy, CPThemeStateVertical | CPThemeStateScrollViewLegacy | CPThemeStateScrollerKnobLight],
|
||||
[@"knob-color", knobColorLegacy, CPThemeStateVertical | CPThemeStateScrollViewLegacy | CPThemeStateScrollerKnobDark],
|
||||
[@"increment-line-color", incrementColorLegacy, CPThemeStateVertical | CPThemeStateScrollViewLegacy],
|
||||
[@"decrement-line-color", decrementColorLegacy, CPThemeStateVertical | CPThemeStateScrollViewLegacy],
|
||||
[@"decrement-line-size", CPSizeMake(14.0, 11.0), CPThemeStateVertical | CPThemeStateScrollViewLegacy],
|
||||
[@"increment-line-size", CPSizeMake(14.0, 11.0), CPThemeStateVertical | CPThemeStateScrollViewLegacy]
|
||||
];
|
||||
|
||||
[self registerThemeValues:themedVerticalScrollerValues forView:scroller];
|
||||
@@ -701,54 +754,102 @@ var themedButtonValues = nil,
|
||||
+ (CPScroller)themedHorizontalScroller
|
||||
{
|
||||
var scroller = [self makeHorizontalScroller],
|
||||
trackColor = PatternColor("scroller-horizontal-track.png", 1.0, 15.0),
|
||||
disabledTrackColor = PatternColor("scroller-horizontal-track-disabled.png", 1.0, 15.0),
|
||||
|
||||
leftArrowColor = PatternColor("scroller-left-arrow.png", 24.0, 15.0),
|
||||
highlightedLeftArrowColor = PatternColor("scroller-left-arrow-highlighted.png", 24.0, 15.0),
|
||||
disabledLeftArrowColor = PatternColor("scroller-left-arrow-disabled.png", 24.0, 15.0),
|
||||
|
||||
rightArrowColor = PatternColor("scroller-right-arrow.png", 24.0, 15.0),
|
||||
highlightedRightArrowColor = PatternColor("scroller-right-arrow-highlighted.png", 24.0, 15.0),
|
||||
disabledRightArrowColor = PatternColor("scroller-right-arrow-disabled.png", 24.0, 15.0),
|
||||
|
||||
knobColor = PatternColor(
|
||||
trackColor = PatternColor(
|
||||
[
|
||||
["scroller-horizontal-knob-left.png", 10.0, 15.0],
|
||||
["scroller-horizontal-knob-center.png", 1.0, 15.0],
|
||||
["scroller-horizontal-knob-right.png", 10.0, 15.0]
|
||||
["scroller-horizontal-track-left.png", 4.0, 9.0],
|
||||
["scroller-horizontal-track-center.png", 1.0, 9.0],
|
||||
["scroller-horizontal-track-right.png", 4.0, 9.0]
|
||||
],
|
||||
PatternIsHorizontal),
|
||||
|
||||
disabledKnobColor = PatternColor(
|
||||
trackColorLight = PatternColor(
|
||||
[
|
||||
["scroller-horizontal-knob-disabled-left.png", 10.0, 15.0],
|
||||
["scroller-horizontal-knob-disabled-center.png", 1.0, 15.0],
|
||||
["scroller-horizontal-knob-disabled-right.png", 10.0, 15.0]
|
||||
["scroller-horizontal-track-light-left.png", 4.0, 9.0],
|
||||
["scroller-horizontal-track-light-center.png", 1.0, 9.0],
|
||||
["scroller-horizontal-track-light-right.png", 4.0, 9.0]
|
||||
],
|
||||
PatternIsHorizontal),
|
||||
|
||||
trackColorDark = PatternColor(
|
||||
[
|
||||
["scroller-horizontal-track-dark-left.png", 4.0, 9.0],
|
||||
["scroller-horizontal-track-dark-center.png", 1.0, 9.0],
|
||||
["scroller-horizontal-track-dark-right.png", 4.0, 9.0]
|
||||
],
|
||||
PatternIsHorizontal),
|
||||
|
||||
trackColorLegacy = PatternColor("scroller-legacy-horizontal-track-center.png", 1.0, 14.0),
|
||||
incrementColorLegacy = PatternColor("scroller-legacy-horizontal-track-right.png", 11.0, 14.0),
|
||||
decrementColorLegacy = PatternColor("scroller-legacy-horizontal-track-left.png", 11.0, 14.0),
|
||||
|
||||
knobColor = PatternColor(
|
||||
[
|
||||
["scroller-horizontal-knob-left.png", 4.0, 9.0],
|
||||
["scroller-horizontal-knob-center.png", 1.0, 9.0],
|
||||
["scroller-horizontal-knob-right.png", 4.0, 9.0]
|
||||
],
|
||||
PatternIsHorizontal),
|
||||
|
||||
knobColorLight = PatternColor(
|
||||
[
|
||||
["scroller-horizontal-knob-light-left.png", 4.0, 9.0],
|
||||
["scroller-horizontal-knob-light-center.png", 1.0, 9.0],
|
||||
["scroller-horizontal-knob-light-right.png", 4.0, 9.0]
|
||||
],
|
||||
PatternIsHorizontal),
|
||||
|
||||
knobColorDark = PatternColor(
|
||||
[
|
||||
["scroller-horizontal-knob-dark-left.png", 4.0, 9.0],
|
||||
["scroller-horizontal-knob-dark-center.png", 1.0, 9.0],
|
||||
["scroller-horizontal-knob-dark-right.png", 4.0, 9.0]
|
||||
],
|
||||
PatternIsHorizontal),
|
||||
|
||||
knobColorLegacy = PatternColor(
|
||||
[
|
||||
["scroller-legacy-horizontal-knob-left.png", 3.0, 14.0],
|
||||
["scroller-legacy-horizontal-knob-center.png", 1.0, 14.0],
|
||||
["scroller-legacy-horizontal-knob-right.png", 3.0, 14.0]
|
||||
],
|
||||
PatternIsHorizontal);
|
||||
|
||||
themedHorizontalScrollerValues =
|
||||
[
|
||||
// Common
|
||||
[@"minimum-knob-length", 21.0],
|
||||
[@"knob-inset", CGInsetMake(0.0, 0.0, 0.0, 0.0)],
|
||||
[@"track-inset", CGInsetMake(0.0, -10.0, 0.0, -11.0)],
|
||||
|
||||
// Overlay
|
||||
[@"scroller-width", 9.0],
|
||||
[@"knob-inset", CGInsetMake(0.0, 0.0, 0.0, 2.0)],
|
||||
[@"track-inset", CGInsetMake(0.0, 2.0, 0.0, 2.0)],
|
||||
[@"track-border-overlay", 12.0],
|
||||
[@"knob-slot-color", [CPNull null]],
|
||||
[@"knob-slot-color", trackColor, CPThemeStateSelected],
|
||||
[@"knob-slot-color", trackColorLight, CPThemeStateSelected | CPThemeStateScrollerKnobLight],
|
||||
[@"knob-slot-color", trackColorDark, CPThemeStateSelected | CPThemeStateScrollerKnobDark],
|
||||
[@"knob-color", knobColor],
|
||||
[@"knob-color", disabledKnobColor, CPThemeStateDisabled],
|
||||
[@"knob-color", knobColorLight, CPThemeStateScrollerKnobLight],
|
||||
[@"knob-color", knobColorDark, CPThemeStateScrollerKnobDark],
|
||||
[@"decrement-line-size", CPSizeMakeZero()],
|
||||
[@"increment-line-size", CPSizeMakeZero()],
|
||||
|
||||
[@"knob-slot-color", trackColor],
|
||||
[@"knob-slot-color", disabledTrackColor, CPThemeStateDisabled],
|
||||
|
||||
[@"decrement-line-size", CGSizeMake(24.0, 15.0)],
|
||||
[@"decrement-line-color", leftArrowColor],
|
||||
[@"decrement-line-color", highlightedLeftArrowColor, CPThemeStateHighlighted],
|
||||
[@"decrement-line-color", disabledLeftArrowColor, CPThemeStateDisabled],
|
||||
|
||||
[@"increment-line-size", CGSizeMake(24.0, 15.0)],
|
||||
[@"increment-line-color", rightArrowColor],
|
||||
[@"increment-line-color", highlightedRightArrowColor, CPThemeStateHighlighted],
|
||||
[@"increment-line-color", disabledRightArrowColor, CPThemeStateDisabled]
|
||||
// Legacy
|
||||
[@"scroller-width", 14.0, CPThemeStateScrollViewLegacy],
|
||||
[@"knob-inset", CGInsetMake(0.0, 0.0, 0.0, 0.0), CPThemeStateScrollViewLegacy],
|
||||
[@"track-inset", CGInsetMake(0.0, 0.0, 0.0, 0.0), CPThemeStateScrollViewLegacy],
|
||||
[@"track-border-overlay", 0.0, CPThemeStateScrollViewLegacy],
|
||||
[@"knob-slot-color", trackColorLegacy, CPThemeStateScrollViewLegacy],
|
||||
[@"knob-slot-color", trackColorLegacy, CPThemeStateScrollViewLegacy | CPThemeStateSelected],
|
||||
[@"knob-slot-color", trackColorLegacy, CPThemeStateScrollViewLegacy | CPThemeStateScrollerKnobLight],
|
||||
[@"knob-slot-color", trackColorLegacy, CPThemeStateScrollViewLegacy | CPThemeStateScrollerKnobDark],
|
||||
[@"knob-color", knobColorLegacy, CPThemeStateScrollViewLegacy],
|
||||
[@"knob-color", knobColorLegacy, CPThemeStateScrollViewLegacy | CPThemeStateScrollerKnobLight],
|
||||
[@"knob-color", knobColorLegacy, CPThemeStateScrollViewLegacy | CPThemeStateScrollerKnobDark],
|
||||
[@"increment-line-color", incrementColorLegacy, CPThemeStateScrollViewLegacy],
|
||||
[@"decrement-line-color", decrementColorLegacy, CPThemeStateScrollViewLegacy],
|
||||
[@"decrement-line-size", CPSizeMake(11.0, 14.0), CPThemeStateScrollViewLegacy],
|
||||
[@"increment-line-size", CPSizeMake(11.0, 14.0), CPThemeStateScrollViewLegacy]
|
||||
];
|
||||
|
||||
[self registerThemeValues:themedHorizontalScrollerValues forView:scroller];
|
||||
@@ -1625,7 +1726,8 @@ var themedButtonValues = nil,
|
||||
[@"bezel-color-down-button", bezelDownDisabled, CPThemeStateBordered | CPThemeStateDisabled],
|
||||
[@"bezel-color-up-button", bezelUpHighlighted, CPThemeStateBordered | CPThemeStateHighlighted],
|
||||
[@"bezel-color-down-button", bezelDownHighlighted, CPThemeStateBordered | CPThemeStateHighlighted],
|
||||
[@"min-size", CGSizeMake(19.0, 25.0)]
|
||||
[@"up-button-size", CGSizeMake(19.0, 13.0)],
|
||||
[@"down-button-size", CGSizeMake(19.0, 12.0)]
|
||||
];
|
||||
|
||||
[self registerThemeValues:themeValues forView:stepper];
|
||||
@@ -1637,7 +1739,7 @@ var themedButtonValues = nil,
|
||||
{
|
||||
var ruleEditor = [[CPRuleEditor alloc] initWithFrame:CGRectMake(0, 0, 400, 300)];
|
||||
|
||||
var backgroundColors = [[CPColor whiteColor], [CPColor colorWithRed:235/255 green:239/255 blue:252/255 alpha:1]],
|
||||
var backgroundColors = [[CPColor whiteColor], [CPColor colorWithRed:235 / 255 green:239 / 255 blue:252 / 255 alpha:1]],
|
||||
selectedActiveRowColor = [CPColor colorWithHexString:@"5f83b9"],
|
||||
selectedInactiveRowColor = [CPColor colorWithWhite:0.83 alpha:1],
|
||||
sliceTopBorderColor = [CPColor colorWithWhite:0.9 alpha:1],
|
||||
@@ -1738,31 +1840,33 @@ var themedButtonValues = nil,
|
||||
return button;
|
||||
}
|
||||
|
||||
+ (CPScroller)themedVerticalScroller
|
||||
{
|
||||
var scroller = [AristoThemeDescriptor makeVerticalScroller],
|
||||
overrides =
|
||||
[
|
||||
[@"knob-color", nil, CPThemeStateVertical | CPThemeStateDisabled]
|
||||
];
|
||||
// We need an artwork for the legacy scroller here.
|
||||
// For the moment I just deactivate it to avoid 404 with HUD theme
|
||||
// + (CPScroller)themedVerticalScroller
|
||||
// {
|
||||
// var scroller = [AristoThemeDescriptor makeVerticalScroller],
|
||||
// overrides =
|
||||
// [
|
||||
// [@"knob-color", nil, CPThemeStateVertical | CPThemeStateDisabled]
|
||||
// ];
|
||||
//
|
||||
// [self registerThemeValues:[self defaultThemeOverridesAddedTo:overrides] forView:scroller inherit:themedVerticalScrollerValues];
|
||||
//
|
||||
// return scroller;
|
||||
// }
|
||||
|
||||
[self registerThemeValues:[self defaultThemeOverridesAddedTo:overrides] forView:scroller inherit:themedVerticalScrollerValues];
|
||||
|
||||
return scroller;
|
||||
}
|
||||
|
||||
+ (CPScroller)themedHorizontalScroller
|
||||
{
|
||||
var scroller = [AristoThemeDescriptor makeHorizontalScroller],
|
||||
overrides =
|
||||
[
|
||||
[@"knob-color", nil, CPThemeStateDisabled]
|
||||
];
|
||||
|
||||
[self registerThemeValues:[self defaultThemeOverridesAddedTo:overrides] forView:scroller inherit:themedHorizontalScrollerValues];
|
||||
|
||||
return scroller;
|
||||
}
|
||||
// + (CPScroller)themedHorizontalScroller
|
||||
// {
|
||||
// var scroller = [AristoThemeDescriptor makeHorizontalScroller],
|
||||
// overrides =
|
||||
// [
|
||||
// [@"knob-color", nil, CPThemeStateDisabled]
|
||||
// ];
|
||||
//
|
||||
// [self registerThemeValues:[self defaultThemeOverridesAddedTo:overrides] forView:scroller inherit:themedHorizontalScrollerValues];
|
||||
//
|
||||
// return scroller;
|
||||
// }
|
||||
|
||||
+ (CPSlider)themedHorizontalSlider
|
||||
{
|
||||
|
||||
@@ -341,8 +341,7 @@ function BKLabelFromIdentifier(anIdentifier)
|
||||
}
|
||||
|
||||
|
||||
|
||||
PatternIsVertical = YES,
|
||||
PatternIsVertical = YES;
|
||||
PatternIsHorizontal = NO;
|
||||
|
||||
/*
|
||||
|
||||
@@ -30,6 +30,9 @@ CPClosableOnBlurWindowMask = 1 << 4;
|
||||
CPPopoverAppearanceMinimal = 0;
|
||||
CPPopoverAppearanceHUD = 1;
|
||||
|
||||
var _CPAttachedWindow_attachedWindowShouldClose_ = 1 << 0,
|
||||
_CPAttachedWindow_attachedWindowDidClose_ = 1 << 1;
|
||||
|
||||
|
||||
/*!
|
||||
@ignore
|
||||
@@ -48,6 +51,7 @@ CPPopoverAppearanceHUD = 1;
|
||||
BOOL _shouldPerformAnimation;
|
||||
CPButton _closeButton;
|
||||
float _animationDuration;
|
||||
CPInteger _implementedDelegateMethods;
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -106,7 +110,7 @@ CPPopoverAppearanceHUD = 1;
|
||||
*/
|
||||
- (id)initWithContentRect:(CGRect)aFrame
|
||||
{
|
||||
self = [self initWithContentRect:aFrame styleMask:nil]
|
||||
self = [self initWithContentRect:aFrame styleMask:nil];
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -153,6 +157,21 @@ CPPopoverAppearanceHUD = 1;
|
||||
[_windowView setAppearance:anAppearance];
|
||||
}
|
||||
|
||||
- (void)setDelegate:(id)aDelegate
|
||||
{
|
||||
if (_delegate == aDelegate)
|
||||
return;
|
||||
|
||||
_delegate = aDelegate;
|
||||
_implementedDelegateMethods = 0;
|
||||
|
||||
if ([_delegate respondsToSelector:@selector(attachedWindowShouldClose:)])
|
||||
_implementedDelegateMethods |= _CPAttachedWindow_attachedWindowShouldClose_;
|
||||
|
||||
if ([_delegate respondsToSelector:@selector(attachedWindowDidClose:)])
|
||||
_implementedDelegateMethods |= _CPAttachedWindow_attachedWindowDidClose_;
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Observer
|
||||
|
||||
@@ -231,11 +250,11 @@ CPPopoverAppearanceHUD = 1;
|
||||
|
||||
// CPMaxXEdge
|
||||
originRight.x += aRect.size.width;
|
||||
originRight.y += (aRect.size.height / 2.0) - (CPRectGetHeight([self frame]) / 2.0)
|
||||
originRight.y += (aRect.size.height / 2.0) - (CPRectGetHeight([self frame]) / 2.0);
|
||||
|
||||
// CPMinXEdge
|
||||
originLeft.x -= CPRectGetWidth([self frame]);
|
||||
originLeft.y += (aRect.size.height / 2.0) - (CPRectGetHeight([self frame]) / 2.0)
|
||||
originLeft.y += (aRect.size.height / 2.0) - (CPRectGetHeight([self frame]) / 2.0);
|
||||
|
||||
// CPMaxYEdge
|
||||
originBottom.x += aRect.size.width / 2.0 - CPRectGetWidth([self frame]) / 2.0;
|
||||
@@ -362,7 +381,7 @@ CPPopoverAppearanceHUD = 1;
|
||||
*/
|
||||
- (void)positionRelativeToRect:(CPRect)aRect
|
||||
{
|
||||
[self positionRelativeToRect:aRect preferredEdge:nil]
|
||||
[self positionRelativeToRect:aRect preferredEdge:nil];
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -408,12 +427,9 @@ CPPopoverAppearanceHUD = 1;
|
||||
{
|
||||
if (_closeOnBlur && !_isClosed)
|
||||
{
|
||||
// set a close flag to avoid infinite loop
|
||||
_isClosed = YES;
|
||||
if (!_delegate || ((_implementedDelegateMethods & _CPAttachedWindow_attachedWindowShouldClose_)
|
||||
&& [_delegate attachedWindowShouldClose:self]))
|
||||
[self close];
|
||||
|
||||
if (_delegate && [_delegate respondsToSelector:@selector(didAttachedWindowClose:)])
|
||||
[_delegate didAttachedWindowClose:self];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -454,16 +470,18 @@ CPPopoverAppearanceHUD = 1;
|
||||
_DOMElement.style.opacity = 0;
|
||||
_DOMElement.style.WebkitTransform = "scale(0)";
|
||||
_DOMElement.style.WebkitTransformOrigin = tranformOrigin;
|
||||
window.setTimeout(function(){
|
||||
window.setTimeout(function()
|
||||
{
|
||||
_DOMElement.style.height = _frame.size.height + @"px";
|
||||
_DOMElement.style.width = _frame.size.width + @"px";
|
||||
_DOMElement.style.opacity = 1;
|
||||
_DOMElement.style.WebkitTransform = "scale(1.1)";
|
||||
var transitionEndFunction = function(){
|
||||
var transitionEndFunction = function()
|
||||
{
|
||||
_DOMElement.style.WebkitTransform = "scale(1)";
|
||||
_DOMElement.removeEventListener("webkitTransitionEnd", transitionEndFunction, YES);
|
||||
};
|
||||
_DOMElement.addEventListener("webkitTransitionEnd", transitionEndFunction, YES)
|
||||
_DOMElement.addEventListener("webkitTransitionEnd", transitionEndFunction, YES);
|
||||
},0);
|
||||
}
|
||||
|
||||
@@ -478,6 +496,9 @@ CPPopoverAppearanceHUD = 1;
|
||||
*/
|
||||
- (void)close
|
||||
{
|
||||
// set a close flag to avoid infinite loop
|
||||
_isClosed = YES;
|
||||
|
||||
if (_animates && typeof(_DOMElement.style.WebkitTransform) != "undefined")
|
||||
{
|
||||
_DOMElement.style.opacity = 0;
|
||||
@@ -494,8 +515,8 @@ CPPopoverAppearanceHUD = 1;
|
||||
|
||||
_shouldPerformAnimation = _animates;
|
||||
|
||||
if (_delegate && [_delegate respondsToSelector:@selector(didAttachedWindowClose:)])
|
||||
[_delegate didAttachedWindowClose:self];
|
||||
if (_implementedDelegateMethods & _CPAttachedWindow_attachedWindowDidClose_)
|
||||
[_delegate attachedWindowDidClose:self];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
+ (id)themeAttributes
|
||||
{
|
||||
return [CPDictionary dictionaryWithObjects:[[CPNull null], [CPNull null]]
|
||||
forKeys:[@"background-color", "divider-color"]];
|
||||
forKeys:[@"background-color", @"divider-color"]];
|
||||
}
|
||||
|
||||
- (void)drawRect:(CGRect)aRect
|
||||
@@ -64,7 +64,7 @@
|
||||
|
||||
- (id)initWithFrame:(CGRect)aFrame
|
||||
{
|
||||
self = [super initWithFrame:aFrame]
|
||||
self = [super initWithFrame:aFrame];
|
||||
|
||||
if (self)
|
||||
[self _init];
|
||||
|
||||
@@ -374,18 +374,21 @@ function CPDecimalCompare(leftOperand, rightOperand)
|
||||
return CPOrderedAscending;
|
||||
}
|
||||
|
||||
var s1 = leftOperand._exponent + leftOperand._mantissa.length,
|
||||
// Before comparing number size check if zero (dont use CPDecimalIsZero as it is more computationally intensive)
|
||||
var leftIsZero = (leftOperand._mantissa.length == 1 && leftOperand._mantissa[0] == 0),
|
||||
rightIsZero = (rightOperand._mantissa.length == 1 && rightOperand._mantissa[0] == 0),
|
||||
// Sign is the same, quick check size (length + exp)
|
||||
s1 = leftOperand._exponent + leftOperand._mantissa.length,
|
||||
s2 = rightOperand._exponent + rightOperand._mantissa.length;
|
||||
|
||||
// Sign is the same, quick check size (length + exp)
|
||||
if (s1 < s2)
|
||||
if (leftIsZero || s1 < s2)
|
||||
{
|
||||
if (rightOperand._isNegative)
|
||||
return CPOrderedDescending;
|
||||
else
|
||||
return CPOrderedAscending;
|
||||
}
|
||||
if (s1 > s2)
|
||||
if (rightIsZero || s1 > s2)
|
||||
{
|
||||
if (rightOperand._isNegative)
|
||||
return CPOrderedAscending;
|
||||
|
||||
@@ -176,7 +176,7 @@
|
||||
for (; i < count; i++)
|
||||
{
|
||||
var thisValue = value[i];
|
||||
|
||||
|
||||
if (thisValue === null)
|
||||
{
|
||||
newValue.push([CPNull null]);
|
||||
@@ -364,7 +364,7 @@
|
||||
|
||||
for (; index < count; ++index)
|
||||
{
|
||||
thisKey = _keys[index],
|
||||
thisKey = _keys[index];
|
||||
thisValue = _buckets[thisKey];
|
||||
if (thisValue.isa && anObject && anObject.isa && [thisValue respondsToSelector:@selector(isEqual:)] && [thisValue isEqual:anObject])
|
||||
matchingKeys.push(thisKey);
|
||||
|
||||
@@ -618,13 +618,31 @@ var StandardUserDefaults;
|
||||
|
||||
@end
|
||||
|
||||
var CPUserDefaultsLocalStoreTestKey = "9961800812587769-Cappuccino-Storage-Test";
|
||||
|
||||
@implementation CPUserDefaultsLocalStore : CPUserDefaultsStore
|
||||
{
|
||||
}
|
||||
|
||||
+ (BOOL)supportsLocalStorage
|
||||
{
|
||||
return !!window.localStorage;
|
||||
if (!window.localStorage)
|
||||
return NO;
|
||||
|
||||
try
|
||||
{
|
||||
// Just because localStorage exists does not mean it works. In particular it might be disabled
|
||||
// as it is when Safari's private browsing mode is active.
|
||||
localStorage.setItem(CPUserDefaultsLocalStoreTestKey, "1");
|
||||
if (localStorage.getItem(CPUserDefaultsLocalStoreTestKey) != "1")
|
||||
return NO;
|
||||
localStorage.removeItem(CPUserDefaultsLocalStoreTestKey);
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (id)init
|
||||
@@ -649,7 +667,14 @@ var StandardUserDefaults;
|
||||
|
||||
- (void)setData:(CPData)aData
|
||||
{
|
||||
localStorage.setItem(_domain, encodeURIComponent([aData rawString]));
|
||||
try
|
||||
{
|
||||
localStorage.setItem(_domain, encodeURIComponent([aData rawString]));
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
CPLog.warn("Unable to write to local storage: " + e);
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
// By Christian C. Salvadó, http://stackoverflow.com/questions/18082/validate-numbers-in-javascript-isnumeric/1830844#1830844
|
||||
#define _IS_NUMERIC(n) (!isNaN(parseFloat(n)) && isFinite(n))
|
||||
@@ -59,7 +59,7 @@ task ("sudo-install", ["CommonJS"], function()
|
||||
if (OS.system(["sudo", "tusk", "install", "--force", $BUILD_CJS_OBJECTIVE_J, $BUILD_CJS_CAPPUCCINO]))
|
||||
{
|
||||
// Attempt a hackish work-around for sudo compiled with the --with-secure-path option
|
||||
sudo("tusk install --force " + $BUILD_CJS_OBJECTIVE_J + " " + $BUILD_CJS_CAPPUCCINO)
|
||||
sudo("tusk install --force " + $BUILD_CJS_OBJECTIVE_J + " " + $BUILD_CJS_CAPPUCCINO);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -71,10 +71,38 @@ task ("install-symlinks", function()
|
||||
|
||||
task ("install-debug-symlinks", function()
|
||||
{
|
||||
SYSTEM.env["CONFIG"] = "Debug";
|
||||
SYSTEM.env.CONFIG = "Debug";
|
||||
spawnJake("install-symlinks");
|
||||
});
|
||||
|
||||
task ("clean-sprites", function()
|
||||
{
|
||||
var f = new FileList(FILE.join(SYSTEM.env.CAPP_BUILD, "**/dataURLs.txt")),
|
||||
paths = f.items();
|
||||
|
||||
f = new FileList(FILE.join(SYSTEM.env.CAPP_BUILD, "**/MHTML*.txt"));
|
||||
paths = paths.concat(f.items());
|
||||
|
||||
paths.forEach(function(path)
|
||||
{
|
||||
FILE.remove(path);
|
||||
});
|
||||
});
|
||||
|
||||
task ("clobber-theme", function()
|
||||
{
|
||||
var f = new FileList(FILE.join(SYSTEM.env.CAPP_BUILD, "**/Aristo.blend")),
|
||||
paths = f.items();
|
||||
|
||||
f = new FileList(FILE.join(SYSTEM.env.CAPP_BUILD, "Aristo.build"));
|
||||
paths = paths.concat(f.items());
|
||||
|
||||
paths.forEach(function(path)
|
||||
{
|
||||
rm_rf(path);
|
||||
});
|
||||
});
|
||||
|
||||
// Documentation
|
||||
|
||||
$DOCUMENTATION_BUILD = FILE.join($BUILD_DIR, "Documentation");
|
||||
@@ -251,30 +279,30 @@ task ("demos", function()
|
||||
if (key)
|
||||
return this._plist.valueForKey(key);
|
||||
return this._plist;
|
||||
}
|
||||
};
|
||||
|
||||
Demo.prototype.name = function()
|
||||
{
|
||||
return this.plist("CPBundleName");
|
||||
}
|
||||
};
|
||||
|
||||
Demo.prototype.path = function()
|
||||
{
|
||||
return this._path;
|
||||
}
|
||||
};
|
||||
|
||||
Demo.prototype.excluded = function()
|
||||
{
|
||||
return !!this.plist("CPDemoExcluded");
|
||||
}
|
||||
};
|
||||
|
||||
Demo.prototype.toString = function()
|
||||
{
|
||||
return this.name();
|
||||
}
|
||||
};
|
||||
|
||||
FILE.glob(FILE.join(demosDir, "demos", "**/Info.plist")).map(function(demoPath){
|
||||
return new Demo(FILE.dirname(demoPath))
|
||||
return new Demo(FILE.dirname(demoPath));
|
||||
}).filter(function(demo){
|
||||
return !demo.excluded();
|
||||
}).forEach(function(demo)
|
||||
@@ -319,7 +347,7 @@ task("push-cappuccino", function() {
|
||||
pushPackage(
|
||||
$BUILD_CJS_CAPPUCCINO,
|
||||
"git@github.com:280north/cappuccino-package.git",
|
||||
SYSTEM.env["PACKAGE_BRANCH"]
|
||||
SYSTEM.env.PACKAGE_BRANCH
|
||||
);
|
||||
});
|
||||
|
||||
@@ -327,7 +355,7 @@ task("push-objective-j", function() {
|
||||
pushPackage(
|
||||
$BUILD_CJS_OBJECTIVE_J,
|
||||
"git@github.com:280north/objective-j-package.git",
|
||||
SYSTEM.env["PACKAGE_BRANCH"]
|
||||
SYSTEM.env.PACKAGE_BRANCH
|
||||
);
|
||||
});
|
||||
|
||||
@@ -365,7 +393,7 @@ function pushPackage(path, remote, branch)
|
||||
|
||||
var pkg = JSON.parse(packagePath.join("package.json").read({ charset : "UTF-8" }));
|
||||
|
||||
stream.print(" Version: " + colorize(pkg["version"], "purple"));
|
||||
stream.print(" Version: " + colorize(pkg.version, "purple"));
|
||||
stream.print(" Revision: " + colorize(pkg["cappuccino-revision"], "purple"));
|
||||
stream.print(" Timestamp: " + colorize(pkg["cappuccino-timestamp"], "purple"));
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ if (system.engine === "rhino")
|
||||
window.__parent__ = null;
|
||||
window.__proto__ = global;
|
||||
}
|
||||
|
||||
|
||||
// setup OBJJ_HOME, OBJJ_INCLUDE_PATHS, etc
|
||||
window.OBJJ_HOME = exports.OBJJ_HOME = FILE.resolve(module.path, "..");
|
||||
|
||||
@@ -146,7 +146,7 @@ exports.repl = function()
|
||||
|
||||
require("browser/timeout").serviceTimeouts();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// creates a narwhal factory function in the objj module scope
|
||||
exports.make_narwhal_factory = function(path)
|
||||
@@ -157,7 +157,7 @@ exports.make_narwhal_factory = function(path)
|
||||
Executable.setCommonJSArguments(require, exports, module, system, print, window);
|
||||
Executable.fileImporterForURL(FILE.dirname(path))(path, YES);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
} // end "with"
|
||||
|
||||
|
||||
@@ -31,12 +31,14 @@ function compressor(code) {
|
||||
return winner;
|
||||
}
|
||||
|
||||
function compileWithResolvedFlags(aFilePath, objjcFlags, gccFlags)
|
||||
function compileWithResolvedFlags(aFilePath, objjcFlags, gccFlags, asPlainJavascript)
|
||||
{
|
||||
var shouldObjjPreprocess = objjcFlags & ObjectiveJ.Preprocessor.Flags.Preprocess,
|
||||
shouldCheckSyntax = objjcFlags & ObjectiveJ.Preprocessor.Flags.CheckSyntax,
|
||||
shouldCompress = objjcFlags & ObjectiveJ.Preprocessor.Flags.Compress,
|
||||
fileContents = "";
|
||||
fileContents = "",
|
||||
executable,
|
||||
code;
|
||||
|
||||
if (OS.popen("which gcc").stdout.read().length === 0)
|
||||
fileContents = FILE.read(aFilePath, { charset:"UTF-8" });
|
||||
@@ -58,7 +60,7 @@ function compileWithResolvedFlags(aFilePath, objjcFlags, gccFlags)
|
||||
// FIXME: should calculate relative path, etc.
|
||||
try
|
||||
{
|
||||
var executable = ObjectiveJ.preprocess(fileContents, FILE.basename(aFilePath), objjcFlags);
|
||||
executable = ObjectiveJ.preprocess(fileContents, FILE.basename(aFilePath), objjcFlags);
|
||||
}
|
||||
catch (anException)
|
||||
{print(anException);
|
||||
@@ -76,14 +78,14 @@ function compileWithResolvedFlags(aFilePath, objjcFlags, gccFlags)
|
||||
|
||||
if (shouldCompress)
|
||||
{
|
||||
var code = executable.code();
|
||||
code = executable.code();
|
||||
code = compressor("function(){" + code + "}");
|
||||
// more robust function wrapper stripping
|
||||
code = code.replace(/^\s*function\s*\(\s*\)\s*{|}\s*;?\s*$/g, "");
|
||||
executable.setCode(code);
|
||||
}
|
||||
|
||||
return executable.toMarkedString();
|
||||
return asPlainJavascript ? executable.code() : executable.toMarkedString();
|
||||
}
|
||||
|
||||
function resolveFlags(args)
|
||||
@@ -100,16 +102,16 @@ function resolveFlags(args)
|
||||
for (; index < count; ++index)
|
||||
{
|
||||
var argument = args[index];
|
||||
|
||||
|
||||
if (argument === "-o")
|
||||
{
|
||||
if (++index < count)
|
||||
outputFilePaths.push(args[index]);
|
||||
}
|
||||
|
||||
|
||||
else if (argument.indexOf("-D") === 0)
|
||||
gccFlags.push(argument)
|
||||
|
||||
gccFlags.push(argument);
|
||||
|
||||
else if (argument.indexOf("-U") === 0)
|
||||
gccFlags.push(argument);
|
||||
|
||||
@@ -124,13 +126,13 @@ function resolveFlags(args)
|
||||
|
||||
else if (argument.indexOf("-E") === 0)
|
||||
objjcFlags &= ~ObjectiveJ.Preprocessor.Flags.Preprocess;
|
||||
|
||||
|
||||
else if (argument.indexOf("-S") === 0)
|
||||
objjcFlags &= ~ObjectiveJ.Preprocessor.Flags.CheckSyntax;
|
||||
|
||||
|
||||
else if (argument.indexOf("-g") === 0)
|
||||
objjcFlags |= ObjectiveJ.Preprocessor.Flags.IncludeDebugSymbols;
|
||||
|
||||
|
||||
else if (argument.indexOf("-O") === 0)
|
||||
objjcFlags |= ObjectiveJ.Preprocessor.Flags.Compress;
|
||||
|
||||
@@ -149,25 +151,69 @@ exports.compile = function(aFilePath, flags)
|
||||
var resolvedFlags = resolveFlags(flags);
|
||||
|
||||
return compileWithResolvedFlags(aFilePath, resolvedFlags.objjcFlags, resolvedFlags.gccFlags);
|
||||
}
|
||||
};
|
||||
|
||||
exports.main = function(args)
|
||||
{
|
||||
// TODO: args parser
|
||||
args.shift();
|
||||
var shouldPrintOutput = false,
|
||||
asPlainJavascript = false;
|
||||
|
||||
var resolved = resolveFlags(args),
|
||||
var argv = args.slice(1);
|
||||
|
||||
while(argv.length)
|
||||
{
|
||||
if (argv[0] === '--')
|
||||
{
|
||||
argv.shift();
|
||||
break;
|
||||
}
|
||||
|
||||
if (argv[0] === "-p" || argv[0] === "--print")
|
||||
{
|
||||
shouldPrintOutput = YES;
|
||||
argv.shift();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (argv[0] === "--unmarked")
|
||||
{
|
||||
asPlainJavascript = true;
|
||||
argv.shift();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (argv[0] === "--help" || argv[0].substr(0, 1) == '-')
|
||||
{
|
||||
print("Usage: " + args[0] + " [options] [--] file...");
|
||||
print(" -p, --print print the output directly to stdout");
|
||||
print(" --unmarked don't tag the output with @STATIC header");
|
||||
print(" --help print this help");
|
||||
return;
|
||||
}
|
||||
|
||||
// Current argument doesn't begin with - so it's not an argument but the
|
||||
// first filename.
|
||||
// TODO Full GNU getopt parsing which doesn't stop on the first non-argument.
|
||||
break;
|
||||
}
|
||||
|
||||
var resolved = resolveFlags(argv),
|
||||
outputFilePaths = resolved.outputFilePaths,
|
||||
objjcFlags = resolved.objjcFlags,
|
||||
gccFlags = resolved.gccFlags;
|
||||
|
||||
resolved.filePaths.forEach(function(filePath, index)
|
||||
{
|
||||
print("Statically Compiling " + filePath);
|
||||
if (!shouldPrintOutput)
|
||||
print("Statically Compiling " + filePath);
|
||||
var output = compileWithResolvedFlags(filePath, objjcFlags, gccFlags, asPlainJavascript);
|
||||
|
||||
FILE.write(outputFilePaths[index], compileWithResolvedFlags(filePath, objjcFlags, gccFlags), { charset: "UTF-8" });
|
||||
if (shouldPrintOutput)
|
||||
print(output);
|
||||
else
|
||||
FILE.write(outputFilePaths[index], output, { charset: "UTF-8" });
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
if (require.main == module.id)
|
||||
exports.main(system.args);
|
||||
|
||||
@@ -56,12 +56,12 @@ exports.Executable = Executable;
|
||||
Executable.prototype.path = function()
|
||||
{
|
||||
return this.URL().path();
|
||||
}
|
||||
};
|
||||
|
||||
Executable.prototype.URL = function()
|
||||
{
|
||||
return this._URL;
|
||||
}
|
||||
};
|
||||
|
||||
DISPLAY_NAME(Executable.prototype.URL);
|
||||
|
||||
@@ -76,7 +76,7 @@ Executable.prototype.functionParameters = function()
|
||||
#endif
|
||||
|
||||
return functionParameters;
|
||||
}
|
||||
};
|
||||
|
||||
DISPLAY_NAME(Executable.prototype.functionParameters);
|
||||
|
||||
@@ -89,7 +89,7 @@ Executable.prototype.functionArguments = function()
|
||||
#endif
|
||||
|
||||
return functionArguments;
|
||||
}
|
||||
};
|
||||
|
||||
DISPLAY_NAME(Executable.prototype.functionArguments);
|
||||
|
||||
@@ -97,22 +97,22 @@ DISPLAY_NAME(Executable.prototype.functionArguments);
|
||||
Executable.setCommonJSParameters = function()
|
||||
{
|
||||
this._commonJSParameters = Array.prototype.slice.call(arguments);
|
||||
}
|
||||
};
|
||||
|
||||
Executable.commonJSParameters = function()
|
||||
{
|
||||
return this._commonJSParameters || [];
|
||||
}
|
||||
};
|
||||
|
||||
Executable.setCommonJSArguments = function()
|
||||
{
|
||||
this._commonJSArguments = Array.prototype.slice.call(arguments);
|
||||
}
|
||||
};
|
||||
|
||||
Executable.commonJSArguments = function()
|
||||
{
|
||||
return this._commonJSArguments || [];
|
||||
}
|
||||
};
|
||||
|
||||
Executable.prototype.toMarkedString = function()
|
||||
{
|
||||
@@ -127,7 +127,7 @@ Executable.prototype.toMarkedString = function()
|
||||
var code = this.code();
|
||||
|
||||
return markedString + MARKER_TEXT + ";" + code.length + ";" + code;
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
Executable.prototype.execute = function()
|
||||
@@ -145,14 +145,14 @@ Executable.prototype.execute = function()
|
||||
CONTEXT_BUNDLE = oldContextBundle;
|
||||
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
DISPLAY_NAME(Executable.prototype.execute);
|
||||
|
||||
Executable.prototype.code = function()
|
||||
{
|
||||
return this._code;
|
||||
}
|
||||
};
|
||||
|
||||
DISPLAY_NAME(Executable.prototype.code);
|
||||
|
||||
|
||||