mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-08-25 04:57:03 +00:00
Further capp_linting - removing accidental global.
Reviewed by me.
This commit is contained in:
@@ -534,7 +534,7 @@ var CPColorPanelSwatchesCookie = "CPColorPanelSwatchesCookie";
|
||||
{
|
||||
var point = [self convertPoint:[anEvent locationInWindow] fromView:nil];
|
||||
|
||||
if(point.x > [self bounds].size.width - 1 || point.x < 1)
|
||||
if (point.x > [self bounds].size.width - 1 || point.x < 1)
|
||||
return NO;
|
||||
|
||||
[[CPPasteboard pasteboardWithName:CPDragPboard] declareTypes:[CPArray arrayWithObject:CPColorDragType] owner:self];
|
||||
|
||||
+1
-1
@@ -559,7 +559,7 @@ var _CPEventPeriodicEventPeriod = 0,
|
||||
|
||||
for (var i = 0; i < characterCount; i++)
|
||||
{
|
||||
switch(_characters.charAt(i))
|
||||
switch (_characters.charAt(i))
|
||||
{
|
||||
case CPBackspaceCharacter:
|
||||
case CPDeleteCharacter:
|
||||
|
||||
@@ -78,7 +78,8 @@ var CPSharedFontManager = nil,
|
||||
_CPFontDetectReferenceFonts = _CPFontDetectPickTwoDifferentFonts(["monospace", "serif", "sans-serif", "cursive"]);
|
||||
|
||||
_availableFonts = [];
|
||||
for (var i = 0; i < _CPFontDetectAllFonts.length; i++) {
|
||||
for (var i = 0; i < _CPFontDetectAllFonts.length; i++)
|
||||
{
|
||||
var available = _CPFontDetectFontAvailable(_CPFontDetectAllFonts[i]);
|
||||
if (available)
|
||||
_availableFonts.push(_CPFontDetectAllFonts[i]);
|
||||
@@ -136,7 +137,8 @@ var _CPFontDetectSpan,
|
||||
"Zapfino"];
|
||||
|
||||
// Compare against the reference fonts. Return true if it produces a different size than at least one of them.
|
||||
var _CPFontDetectFontAvailable = function(font) {
|
||||
var _CPFontDetectFontAvailable = function(font)
|
||||
{
|
||||
for (var i = 0; i < _CPFontDetectReferenceFonts.length; i++)
|
||||
if (_CPFontDetectCompareFonts(_CPFontDetectReferenceFonts[i], font))
|
||||
return true;
|
||||
@@ -146,7 +148,8 @@ var _CPFontDetectFontAvailable = function(font) {
|
||||
var _CPFontDetectCache = {};
|
||||
|
||||
// Compares two given fonts. Returns true if they produce different sizes (i.e. fontA didn't fallback to fontB)
|
||||
var _CPFontDetectCompareFonts = function(fontA, fontB) {
|
||||
var _CPFontDetectCompareFonts = function(fontA, fontB)
|
||||
{
|
||||
var a;
|
||||
if (_CPFontDetectCache[fontA])
|
||||
a = _CPFontDetectCache[fontA];
|
||||
@@ -165,7 +168,8 @@ var _CPFontDetectCompareFonts = function(fontA, fontB) {
|
||||
}
|
||||
|
||||
// Test the candidate fonts pairwise until we find two that are different. Otherwise return the first.
|
||||
var _CPFontDetectPickTwoDifferentFonts = function(candidates) {
|
||||
var _CPFontDetectPickTwoDifferentFonts = function(candidates)
|
||||
{
|
||||
for (var i = 0; i < candidates.length; i++)
|
||||
for (var j = 0; j < i; j++)
|
||||
if (_CPFontDetectCompareFonts(candidates[i], candidates[j]))
|
||||
|
||||
+2
-2
@@ -65,7 +65,7 @@ function CPAppKitImage(aFilename, aSize)
|
||||
return CPImageInBundle(aFilename, aSize, [CPBundle bundleForClass:[CPView class]]);
|
||||
}
|
||||
|
||||
/*!
|
||||
/*!
|
||||
@ingroup appkit
|
||||
@class CPImage
|
||||
|
||||
@@ -73,7 +73,7 @@ function CPAppKitImage(aFilename, aSize)
|
||||
all image types supported by the browser.
|
||||
|
||||
@par Delegate Methods
|
||||
|
||||
|
||||
@delegate -(void)imageDidLoad:(CPImage)image;
|
||||
Called when the specified image has finished loading.
|
||||
@param image the image that loaded
|
||||
|
||||
+1
-1
@@ -51,7 +51,7 @@ CPCancelButton = 0;
|
||||
@global
|
||||
@class CPWindow
|
||||
*/
|
||||
CPDocModalWindowMask = 1 << 6;
|
||||
CPDocModalWindowMask = 1 << 6;
|
||||
|
||||
@implementation CPPanel : CPWindow
|
||||
{
|
||||
|
||||
@@ -128,7 +128,7 @@ var CPProgressIndicatorSpinningStyleColors = nil,
|
||||
CPProgressIndicatorClassName + @"Bar" + CPProgressIndicatorStyleIdentifiers[CPProgressIndicatorHUDBarStyle]
|
||||
];
|
||||
|
||||
for (var i = 0, count = prefixes.length; i<count; i++)
|
||||
for (var i = 0, count = prefixes.length; i < count; i++)
|
||||
{
|
||||
var prefix = prefixes[i];
|
||||
CPProgressIndicatorStyleSizes[prefix + regularIdentifier] = [_CGSizeMake(3.0, 16.0), _CGSizeMake(1.0, 16.0), _CGSizeMake(3.0, 16.0)];
|
||||
|
||||
+6
-6
@@ -23,8 +23,8 @@
|
||||
@import <Foundation/CPObject.j>
|
||||
|
||||
|
||||
/*!
|
||||
@deprecated
|
||||
/*!
|
||||
@deprecated
|
||||
@class CPShadow
|
||||
|
||||
Instances of this class contain the attributes of a drop shadow used in Cappuccino.
|
||||
@@ -34,7 +34,7 @@
|
||||
CPSize _offset;
|
||||
float _blurRadius;
|
||||
CPColor _color;
|
||||
|
||||
|
||||
CPString _cssString;
|
||||
}
|
||||
|
||||
@@ -54,16 +54,16 @@
|
||||
- (id)_initWithOffset:(CPSize)anOffset blurRadius:(float)aBlurRadius color:(CPColor)aColor
|
||||
{
|
||||
self = [super init];
|
||||
|
||||
|
||||
if (self)
|
||||
{
|
||||
_offset = anOffset;
|
||||
_blurRadius = aBlurRadius;
|
||||
_color = aColor;
|
||||
|
||||
|
||||
_cssString = [_color cssString] + " " + Math.round(anOffset.width) + @"px " + Math.round(anOffset.height) + @"px " + Math.round(_blurRadius) + @"px";
|
||||
}
|
||||
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
|
||||
@@ -28,16 +28,16 @@
|
||||
@ignore
|
||||
*/
|
||||
@implementation CPSliderColorPicker : CPColorPicker
|
||||
{
|
||||
{
|
||||
CPView _contentView;
|
||||
|
||||
|
||||
CPSlider _redSlider;
|
||||
CPSlider _greenSlider;
|
||||
CPSlider _blueSlider;
|
||||
CPSlider _hueSlider;
|
||||
CPSlider _saturationSlider;
|
||||
CPSlider _brightnessSlider;
|
||||
|
||||
|
||||
CPTextField _rgbLabel;
|
||||
CPTextField _hsbLabel;
|
||||
CPTextField _redLabel;
|
||||
@@ -58,27 +58,27 @@
|
||||
CPTextField _brightnessValue;
|
||||
}
|
||||
|
||||
- (id)initWithPickerMask:(int)mask colorPanel:(CPColorPanel)owningColorPanel
|
||||
- (id)initWithPickerMask:(int)mask colorPanel:(CPColorPanel)owningColorPanel
|
||||
{
|
||||
return [super initWithPickerMask:mask colorPanel: owningColorPanel];
|
||||
}
|
||||
|
||||
|
||||
-(id)initView
|
||||
{
|
||||
aFrame = CPRectMake(0, 0, CPColorPickerViewWidth, CPColorPickerViewHeight);
|
||||
|
||||
aFrame = CGRectMake(0, 0, CPColorPickerViewWidth, CPColorPickerViewHeight);
|
||||
|
||||
_contentView = [[CPView alloc] initWithFrame:aFrame];
|
||||
[_contentView setAutoresizingMask:CPViewWidthSizable|CPViewHeightSizable];
|
||||
|
||||
_rgbLabel = [[CPTextField alloc] initWithFrame: CPRectMake(0, 10, 100, 20)];
|
||||
[_contentView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable];
|
||||
|
||||
_rgbLabel = [[CPTextField alloc] initWithFrame: CGRectMake(0, 10, 100, 20)];
|
||||
[_rgbLabel setStringValue: "Red, Green, Blue"];
|
||||
[_rgbLabel setTextColor:[CPColor blackColor]];
|
||||
|
||||
_redLabel = [[CPTextField alloc] initWithFrame: CPRectMake(0, 35, 15, 20)];
|
||||
_redLabel = [[CPTextField alloc] initWithFrame: CGRectMake(0, 35, 15, 20)];
|
||||
[_redLabel setStringValue: "R"];
|
||||
[_redLabel setTextColor:[CPColor blackColor]];
|
||||
|
||||
_redSlider = [[CPSlider alloc] initWithFrame: CPRectMake(15, 35, aFrame.size.width - 70, 20)];
|
||||
|
||||
_redSlider = [[CPSlider alloc] initWithFrame: CGRectMake(15, 35, aFrame.size.width - 70, 20)];
|
||||
[_redSlider setMaxValue: 1.0];
|
||||
[_redSlider setMinValue: 0.0];
|
||||
[_redSlider setTarget: self];
|
||||
@@ -93,11 +93,11 @@
|
||||
[_redValue setDelegate: self];
|
||||
[_contentView addSubview: _redValue];
|
||||
|
||||
_greenLabel = [[CPTextField alloc] initWithFrame: CPRectMake(0, 58, 15, 20)];
|
||||
_greenLabel = [[CPTextField alloc] initWithFrame: CGRectMake(0, 58, 15, 20)];
|
||||
[_greenLabel setStringValue: "G"];
|
||||
[_greenLabel setTextColor:[CPColor blackColor]];
|
||||
|
||||
_greenSlider = [[CPSlider alloc] initWithFrame: CPRectMake(15, 58, aFrame.size.width - 70, 20)];
|
||||
_greenSlider = [[CPSlider alloc] initWithFrame: CGRectMake(15, 58, aFrame.size.width - 70, 20)];
|
||||
[_greenSlider setMaxValue: 1.0];
|
||||
[_greenSlider setMinValue: 0.0];
|
||||
[_greenSlider setTarget: self];
|
||||
@@ -112,11 +112,11 @@
|
||||
[_greenValue setDelegate: self];
|
||||
[_contentView addSubview: _greenValue];
|
||||
|
||||
_blueLabel = [[CPTextField alloc] initWithFrame: CPRectMake(0, 81, 15, 20)];
|
||||
_blueLabel = [[CPTextField alloc] initWithFrame: CGRectMake(0, 81, 15, 20)];
|
||||
[_blueLabel setStringValue: "B"];
|
||||
[_blueLabel setTextColor:[CPColor blackColor]];
|
||||
|
||||
_blueSlider = [[CPSlider alloc] initWithFrame: CPRectMake(15, 81, aFrame.size.width - 70, 20)];
|
||||
_blueSlider = [[CPSlider alloc] initWithFrame: CGRectMake(15, 81, aFrame.size.width - 70, 20)];
|
||||
[_blueSlider setMaxValue: 1.0];
|
||||
[_blueSlider setMinValue: 0.0];
|
||||
[_blueSlider setTarget: self];
|
||||
@@ -131,15 +131,15 @@
|
||||
[_blueValue setDelegate: self];
|
||||
[_contentView addSubview: _blueValue];
|
||||
|
||||
_hsbLabel = [[CPTextField alloc] initWithFrame: CPRectMake(0, 120, 190, 20)];
|
||||
_hsbLabel = [[CPTextField alloc] initWithFrame: CGRectMake(0, 120, 190, 20)];
|
||||
[_hsbLabel setStringValue: "Hue, Saturation, Brightness"];
|
||||
[_hsbLabel setTextColor:[CPColor blackColor]];
|
||||
|
||||
_hueLabel = [[CPTextField alloc] initWithFrame: CPRectMake(0, 145, 15, 20)];
|
||||
_hueLabel = [[CPTextField alloc] initWithFrame: CGRectMake(0, 145, 15, 20)];
|
||||
[_hueLabel setStringValue: "H"];
|
||||
[_hueLabel setTextColor:[CPColor blackColor]];
|
||||
|
||||
_hueSlider = [[CPSlider alloc] initWithFrame: CPRectMake(15, 145, aFrame.size.width - 70, 20)];
|
||||
|
||||
_hueSlider = [[CPSlider alloc] initWithFrame: CGRectMake(15, 145, aFrame.size.width - 70, 20)];
|
||||
[_hueSlider setMaxValue: 359.0];
|
||||
[_hueSlider setMinValue: 0.0];
|
||||
[_hueSlider setTarget: self];
|
||||
@@ -154,11 +154,11 @@
|
||||
[_hueValue setDelegate: self];
|
||||
[_contentView addSubview: _hueValue];
|
||||
|
||||
_saturationLabel = [[CPTextField alloc] initWithFrame: CPRectMake(0, 168, 15, 20)];
|
||||
_saturationLabel = [[CPTextField alloc] initWithFrame: CGRectMake(0, 168, 15, 20)];
|
||||
[_saturationLabel setStringValue: "S"];
|
||||
[_saturationLabel setTextColor:[CPColor blackColor]];
|
||||
|
||||
_saturationSlider = [[CPSlider alloc] initWithFrame: CPRectMake(15, 168, aFrame.size.width - 70, 20)];
|
||||
_saturationSlider = [[CPSlider alloc] initWithFrame: CGRectMake(15, 168, aFrame.size.width - 70, 20)];
|
||||
[_saturationSlider setMaxValue: 100.0];
|
||||
[_saturationSlider setMinValue: 0.0];
|
||||
[_saturationSlider setTarget: self];
|
||||
@@ -173,11 +173,11 @@
|
||||
[_saturationValue setDelegate: self];
|
||||
[_contentView addSubview: _saturationValue];
|
||||
|
||||
_brightnessLabel = [[CPTextField alloc] initWithFrame: CPRectMake(0, 191, 15, 20)];
|
||||
_brightnessLabel = [[CPTextField alloc] initWithFrame: CGRectMake(0, 191, 15, 20)];
|
||||
[_brightnessLabel setStringValue: "B"];
|
||||
[_brightnessLabel setTextColor:[CPColor blackColor]];
|
||||
|
||||
_brightnessSlider = [[CPSlider alloc] initWithFrame: CPRectMake(15, 191, aFrame.size.width - 70, 20)];
|
||||
_brightnessSlider = [[CPSlider alloc] initWithFrame: CGRectMake(15, 191, aFrame.size.width - 70, 20)];
|
||||
[_brightnessSlider setMaxValue: 100.0];
|
||||
[_brightnessSlider setMinValue: 0.0];
|
||||
[_brightnessSlider setTarget: self];
|
||||
@@ -192,7 +192,7 @@
|
||||
[_brightnessValue setDelegate: self];
|
||||
[_contentView addSubview: _brightnessValue];
|
||||
|
||||
_hexLabel = [[CPTextField alloc] initWithFrame: CPRectMake(0, 230, 30, 20)];
|
||||
_hexLabel = [[CPTextField alloc] initWithFrame: CGRectMake(0, 230, 30, 20)];
|
||||
[_hexLabel setStringValue: "Hex"];
|
||||
[_hexLabel setTextColor:[CPColor blackColor]];
|
||||
|
||||
@@ -210,7 +210,7 @@
|
||||
[_contentView addSubview: _redSlider];
|
||||
[_contentView addSubview: _greenSlider];
|
||||
[_contentView addSubview: _blueSlider];
|
||||
|
||||
|
||||
[_contentView addSubview: _hsbLabel];
|
||||
[_contentView addSubview: _hueLabel];
|
||||
[_contentView addSubview: _saturationLabel];
|
||||
@@ -218,24 +218,24 @@
|
||||
[_contentView addSubview: _hueSlider];
|
||||
[_contentView addSubview: _saturationSlider];
|
||||
[_contentView addSubview: _brightnessSlider];
|
||||
|
||||
|
||||
[_contentView addSubview: _hexLabel];
|
||||
}
|
||||
|
||||
- (CPView)provideNewView:(BOOL)initialRequest
|
||||
- (CPView)provideNewView:(BOOL)initialRequest
|
||||
{
|
||||
if (initialRequest)
|
||||
if (initialRequest)
|
||||
[self initView];
|
||||
|
||||
|
||||
return _contentView;
|
||||
}
|
||||
|
||||
- (int)currentMode
|
||||
- (int)currentMode
|
||||
{
|
||||
return CPSliderColorPickerMode;
|
||||
}
|
||||
|
||||
- (BOOL)supportsMode:(int)mode
|
||||
- (BOOL)supportsMode:(int)mode
|
||||
{
|
||||
return (mode == CPSliderColorPickerMode) ? YES : NO;
|
||||
}
|
||||
@@ -246,7 +246,7 @@
|
||||
colorPanel = [self colorPanel],
|
||||
alpha = [colorPanel opacity];
|
||||
|
||||
switch(sender)
|
||||
switch (sender)
|
||||
{
|
||||
case _hueSlider:
|
||||
case _saturationSlider:
|
||||
@@ -254,21 +254,21 @@
|
||||
saturation: [_saturationSlider floatValue]
|
||||
brightness: [_brightnessSlider floatValue]
|
||||
alpha: alpha];
|
||||
|
||||
|
||||
[self updateRGBSliders: newColor];
|
||||
break;
|
||||
|
||||
|
||||
case _redSlider:
|
||||
case _greenSlider:
|
||||
case _blueSlider: newColor = [CPColor colorWithCalibratedRed: [_redSlider floatValue]
|
||||
green: [_greenSlider floatValue]
|
||||
blue: [_blueSlider floatValue]
|
||||
alpha: alpha];
|
||||
|
||||
|
||||
[self updateHSBSliders: newColor];
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
[self updateLabels];
|
||||
[self updateHex: newColor];
|
||||
[colorPanel setColor: newColor];
|
||||
@@ -285,7 +285,7 @@
|
||||
-(void)updateHSBSliders:(CPColor)aColor
|
||||
{
|
||||
var hsb = [aColor hsbComponents];
|
||||
|
||||
|
||||
[_hueSlider setFloatValue:hsb[0]];
|
||||
[_saturationSlider setFloatValue:hsb[1]];
|
||||
[_brightnessSlider setFloatValue:hsb[2]];
|
||||
@@ -310,7 +310,7 @@
|
||||
[_hueValue setStringValue: ROUND([_hueSlider floatValue])];
|
||||
[_saturationValue setStringValue: ROUND([_saturationSlider floatValue])];
|
||||
[_brightnessValue setStringValue: ROUND([_brightnessSlider floatValue])];
|
||||
|
||||
|
||||
[_redValue setStringValue: ROUND([_redSlider floatValue] * 255)];
|
||||
[_greenValue setStringValue: ROUND([_greenSlider floatValue] * 255)];
|
||||
[_blueValue setStringValue: ROUND([_blueSlider floatValue] * 255)];
|
||||
@@ -330,14 +330,21 @@
|
||||
{
|
||||
var field = [aNotification object],
|
||||
value = [[field stringValue] stringByTrimmingWhitespace];
|
||||
if (field === _hexValue) {
|
||||
|
||||
if (field === _hexValue)
|
||||
{
|
||||
var newColor = [CPColor colorWithHexString: value];
|
||||
if (newColor) {
|
||||
|
||||
if (newColor)
|
||||
{
|
||||
[self setColor: newColor];
|
||||
[[self colorPanel] setColor: newColor];
|
||||
}
|
||||
} else {
|
||||
switch(field) {
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (field)
|
||||
{
|
||||
case _redValue: [_redSlider setFloatValue:MAX(MIN(ROUND(value), 255) / 255.0, 0)];
|
||||
[self sliderChanged: _redSlider];
|
||||
break;
|
||||
|
||||
+18
-16
@@ -37,7 +37,7 @@ var CPStepperButtonsSize = CPSizeMake(19, 13);
|
||||
int _increment @accessors(property=increment);
|
||||
int _maxValue @accessors(property=maxValue);
|
||||
int _minValue @accessors(property=minValue);
|
||||
|
||||
|
||||
_CPContinuousButton _buttonDown;
|
||||
_CPContinuousButton _buttonUp;
|
||||
}
|
||||
@@ -57,11 +57,11 @@ var CPStepperButtonsSize = CPSizeMake(19, 13);
|
||||
[stepper setDoubleValue:aValue];
|
||||
[stepper setMinValue:aMinValue];
|
||||
[stepper setMaxValue:aMaxValue];
|
||||
|
||||
|
||||
return stepper;
|
||||
}
|
||||
|
||||
/*! Initializes a CPStepper with default values:
|
||||
/*! Initializes a CPStepper with default values:
|
||||
- minValue = 0.0
|
||||
- maxValue = 59.0
|
||||
- value = 0.0
|
||||
@@ -84,23 +84,23 @@ var CPStepperButtonsSize = CPSizeMake(19, 13);
|
||||
_minValue = 0.0;
|
||||
_increment = 1.0;
|
||||
_valueWraps = YES;
|
||||
|
||||
|
||||
[self setDoubleValue:0.0];
|
||||
|
||||
|
||||
_buttonUp = [[_CPContinuousButton alloc] initWithFrame:CPRectMake(aFrame.size.width - CPStepperButtonsSize.width, 0, CPStepperButtonsSize.width, CPStepperButtonsSize.height)];
|
||||
[_buttonUp setContinuous:YES];
|
||||
[_buttonUp setTarget:self];
|
||||
[_buttonUp setAction:@selector(_buttonDidClick:)];
|
||||
[_buttonUp setAutoresizingMask:CPViewNotSizable];
|
||||
[self addSubview:_buttonUp];
|
||||
|
||||
|
||||
_buttonDown = [[_CPContinuousButton alloc] initWithFrame:CPRectMake(aFrame.size.width - CPStepperButtonsSize.width, CPStepperButtonsSize.height, CPStepperButtonsSize.width, CPStepperButtonsSize.height - 1)];
|
||||
[_buttonDown setContinuous:YES];
|
||||
[_buttonDown setTarget:self];
|
||||
[_buttonDown setAction:@selector(_buttonDidClick:)];
|
||||
[_buttonDown setAutoresizingMask:CPViewNotSizable];
|
||||
[self addSubview:_buttonDown];
|
||||
|
||||
|
||||
[self setNeedsLayout];
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ var CPStepperButtonsSize = CPSizeMake(19, 13);
|
||||
[_buttonUp setValue:[self valueForThemeAttribute:@"bezel-color-up-button" inState:CPThemeStateBordered | CPThemeStateHighlighted] forThemeAttribute:@"bezel-color" inState:CPThemeStateBordered | CPThemeStateHighlighted];
|
||||
[_buttonDown setValue:[self valueForThemeAttribute:@"bezel-color-down-button" inState:CPThemeStateBordered] forThemeAttribute:@"bezel-color" inState:CPThemeStateBordered];
|
||||
[_buttonDown setValue:[self valueForThemeAttribute:@"bezel-color-down-button" inState:CPThemeStateBordered | CPThemeStateDisabled] forThemeAttribute:@"bezel-color" inState:CPThemeStateBordered | CPThemeStateDisabled];
|
||||
[_buttonDown setValue:[self valueForThemeAttribute:@"bezel-color-down-button" inState:CPThemeStateBordered | CPThemeStateHighlighted] forThemeAttribute:@"bezel-color" inState:CPThemeStateBordered | CPThemeStateHighlighted];
|
||||
[_buttonDown setValue:[self valueForThemeAttribute:@"bezel-color-down-button" inState:CPThemeStateBordered | CPThemeStateHighlighted] forThemeAttribute:@"bezel-color" inState:CPThemeStateBordered | CPThemeStateHighlighted];
|
||||
}
|
||||
|
||||
/*! set if CPStepper should autorepeat
|
||||
@@ -235,7 +235,7 @@ var CPStepperButtonsSize = CPSizeMake(19, 13);
|
||||
- (void)encodeWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
[super encodeWithCoder:aCoder];
|
||||
|
||||
|
||||
[aCoder encodeObject:_maxValue forKey:@"_maxValue"];
|
||||
[aCoder encodeObject:_minValue forKey:@"_minValue"];
|
||||
[aCoder encodeObject:_increment forKey:@"_increment"];
|
||||
@@ -264,7 +264,7 @@ var CPStepperButtonsSize = CPSizeMake(19, 13);
|
||||
_periodicInterval = 0.05;
|
||||
_periodicDelay = 0.5;
|
||||
}
|
||||
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -278,13 +278,15 @@ var CPStepperButtonsSize = CPSizeMake(19, 13);
|
||||
{
|
||||
if ([self isContinuous])
|
||||
{
|
||||
_continuousDelayTimer = [CPTimer scheduledTimerWithTimeInterval:_periodicDelay callback: function(){
|
||||
_continuousDelayTimer = [CPTimer scheduledTimerWithTimeInterval:_periodicDelay callback: function()
|
||||
{
|
||||
if (!_continuousTimer)
|
||||
_continuousTimer = [CPTimer scheduledTimerWithTimeInterval:_periodicInterval target:self selector:@selector(onContinousEvent:) userInfo:anEvent repeats:YES];
|
||||
}
|
||||
}
|
||||
|
||||
repeats:NO];
|
||||
}
|
||||
|
||||
|
||||
[super mouseDown:anEvent];
|
||||
}
|
||||
|
||||
@@ -304,10 +306,10 @@ var CPStepperButtonsSize = CPSizeMake(19, 13);
|
||||
{
|
||||
if (_continuousTimer)
|
||||
{
|
||||
[_continuousTimer invalidate];
|
||||
[_continuousTimer invalidate];
|
||||
_continuousTimer = nil;
|
||||
}
|
||||
|
||||
|
||||
if (_continuousDelayTimer)
|
||||
{
|
||||
[_continuousDelayTimer invalidate];
|
||||
@@ -334,7 +336,7 @@ var CPStepperButtonsSize = CPSizeMake(19, 13);
|
||||
- (void)encodeWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
[super encodeWithCoder:aCoder];
|
||||
|
||||
|
||||
[self invalidateTimers];
|
||||
[aCoder encodeObject:_periodicDelay forKey:@"_periodicDelay"];
|
||||
[aCoder encodeObject:_periodicInterval forKey:@"_periodicInterval"];
|
||||
|
||||
@@ -44,7 +44,7 @@ CPBackgroundTab = 1;
|
||||
*/
|
||||
CPPressedTab = 2;
|
||||
|
||||
/*!
|
||||
/*!
|
||||
@ingroup appkit
|
||||
@class CPTabViewItem
|
||||
|
||||
@@ -55,10 +55,10 @@ CPPressedTab = 2;
|
||||
{
|
||||
id _identifier;
|
||||
CPString _label;
|
||||
|
||||
|
||||
CPView _view;
|
||||
CPView _auxiliaryView;
|
||||
|
||||
|
||||
CPTabView _tabView;
|
||||
}
|
||||
|
||||
@@ -74,10 +74,10 @@ CPPressedTab = 2;
|
||||
- (id)initWithIdentifier:(id)anIdentifier
|
||||
{
|
||||
self = [super init];
|
||||
|
||||
|
||||
if (self)
|
||||
_identifier = anIdentifier;
|
||||
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -191,16 +191,16 @@ var CPTabViewItemIdentifierKey = "CPTabViewItemIdentifierKey",
|
||||
- (id)initWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
self = [super init];
|
||||
|
||||
|
||||
if (self)
|
||||
{
|
||||
_identifier = [aCoder decodeObjectForKey:CPTabViewItemIdentifierKey];
|
||||
_label = [aCoder decodeObjectForKey:CPTabViewItemLabelKey];
|
||||
|
||||
|
||||
_view = [aCoder decodeObjectForKey:CPTabViewItemViewKey];
|
||||
_auxiliaryView = [aCoder decodeObjectForKey:CPTabViewItemAuxViewKey];
|
||||
}
|
||||
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -208,7 +208,7 @@ var CPTabViewItemIdentifierKey = "CPTabViewItemIdentifierKey",
|
||||
{
|
||||
[aCoder encodeObject:_identifier forKey:CPTabViewItemIdentifierKey];
|
||||
[aCoder encodeObject:_label forKey:CPTabViewItemLabelKey];
|
||||
|
||||
|
||||
[aCoder encodeObject:_view forKey:CPTabViewItemViewKey];
|
||||
[aCoder encodeObject:_auxiliaryView forKey:CPTabViewItemAuxViewKey];
|
||||
}
|
||||
|
||||
+11
-11
@@ -56,7 +56,7 @@
|
||||
{
|
||||
_textField = [[_CPImageAndTextView alloc] initWithFrame:_CGRectMakeZero()];
|
||||
|
||||
[_textField setAutoresizingMask:CPViewWidthSizable|CPViewHeightSizable];
|
||||
[_textField setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable];
|
||||
|
||||
[_textField setLineBreakMode:CPLineBreakByTruncatingTail];
|
||||
[_textField setAlignment:CPLeftTextAlignment];
|
||||
@@ -107,15 +107,15 @@
|
||||
|
||||
- (void)_setIndicatorImage:(CPImage)anImage
|
||||
{
|
||||
if (anImage)
|
||||
{
|
||||
[_textField setImage:anImage];
|
||||
[_textField setImagePosition:CPImageRight];
|
||||
}
|
||||
else
|
||||
{
|
||||
[_textField setImagePosition:CPNoImage];
|
||||
}
|
||||
if (anImage)
|
||||
{
|
||||
[_textField setImage:anImage];
|
||||
[_textField setImagePosition:CPImageRight];
|
||||
}
|
||||
else
|
||||
{
|
||||
[_textField setImagePosition:CPNoImage];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -634,7 +634,7 @@ var _CPTableColumnHeaderViewStringValueKey = @"_CPTableColumnHeaderViewStringVal
|
||||
columnMaxX;
|
||||
|
||||
CGContextBeginPath(context);
|
||||
for(; columnArrayIndex < columnArrayCount; columnArrayIndex++)
|
||||
for (; columnArrayIndex < columnArrayCount; columnArrayIndex++)
|
||||
{
|
||||
// grab each column rect and add vertical lines
|
||||
var columnIndex = columnsArray[columnArrayIndex],
|
||||
|
||||
+35
-36
@@ -1318,7 +1318,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
*/
|
||||
- (CGRect)rectOfRow:(CPInteger)aRowIndex
|
||||
{
|
||||
if(aRowIndex > [self numberOfRows] - 1 || aRowIndex < 0)
|
||||
if (aRowIndex > [self numberOfRows] - 1 || aRowIndex < 0)
|
||||
return _CGRectMakeZero();
|
||||
|
||||
if (_implementedDelegateMethods & CPTableViewDelegate_tableView_heightOfRow_)
|
||||
@@ -1331,7 +1331,6 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
var y = aRowIndex * (_rowHeight + _intercellSpacing.height),
|
||||
height = _rowHeight + _intercellSpacing.height;
|
||||
}
|
||||
|
||||
|
||||
return _CGRectMake(0.0, y, _CGRectGetWidth([self bounds]), height);
|
||||
}
|
||||
@@ -1457,13 +1456,13 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
return idx = [_cachedRowHeights indexOfObject:aPoint sortedByFunction:function(aPoint, rowCache) {
|
||||
var upperBound = rowCache.heightAboveRow;
|
||||
|
||||
if (aPoint.y < upperBound)
|
||||
return CPOrderedAscending;
|
||||
if (aPoint.y < upperBound)
|
||||
return CPOrderedAscending;
|
||||
|
||||
if (aPoint.y > upperBound + rowCache.height)
|
||||
return CPOrderedDescending;
|
||||
if (aPoint.y > upperBound + rowCache.height)
|
||||
return CPOrderedDescending;
|
||||
|
||||
return CPOrderedSame;
|
||||
return CPOrderedSame;
|
||||
}];
|
||||
}
|
||||
|
||||
@@ -1723,7 +1722,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
if (!(_implementedDelegateMethods & CPTableViewDelegate_tableView_heightOfRow_))
|
||||
return;
|
||||
|
||||
// this method will update the height of those rows, but since the cached array also contains
|
||||
// this method will update the height of those rows, but since the cached array also contains
|
||||
// the height above the row it needs to recalculate for the rows below it too
|
||||
var i = [anIndexSet firstIndex],
|
||||
count = _numberOfRows - i,
|
||||
@@ -1766,7 +1765,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
if ([self numberOfRows] !== _cachedRowHeights.length)
|
||||
[self noteHeightOfRowsWithIndexesChanged:[CPIndexSet indexSetWithIndexesInRange:CPMakeRange(0, [self numberOfRows])]];
|
||||
|
||||
var heightObject = _cachedRowHeights[_cachedRowHeights.length -1],
|
||||
var heightObject = _cachedRowHeights[_cachedRowHeights.length - 1],
|
||||
height = heightObject.heightAboveRow + heightObject.height + _intercellSpacing.height;
|
||||
}
|
||||
|
||||
@@ -2042,7 +2041,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
*/
|
||||
- (BOOL)_sendDelegateDeleteKeyPressed
|
||||
{
|
||||
if([_delegate respondsToSelector: @selector(tableViewDeleteKeyPressed:)])
|
||||
if ([_delegate respondsToSelector: @selector(tableViewDeleteKeyPressed:)])
|
||||
{
|
||||
[_delegate tableViewDeleteKeyPressed:self];
|
||||
return YES;
|
||||
@@ -2568,7 +2567,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
|
||||
if (_implementedDelegateMethods & CPTableViewDelegate_tableView_isGroupRow_)
|
||||
{
|
||||
if([_delegate tableView:self isGroupRow:row])
|
||||
if ([_delegate tableView:self isGroupRow:row])
|
||||
{
|
||||
[_groupRows addIndex:row];
|
||||
[dataView setThemeState:CPThemeStateGroupRow];
|
||||
@@ -2738,8 +2737,8 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
groupRowRects = [],
|
||||
row = exposedRows.location;
|
||||
|
||||
//loop through each color so we only draw once for each color
|
||||
while(colorIndex < colorCount)
|
||||
//loop through each color so we only draw once for each color
|
||||
while (colorIndex < colorCount)
|
||||
{
|
||||
CGContextBeginPath(context);
|
||||
for (var row = colorIndex; row < lastRow; row += colorCount)
|
||||
@@ -3412,7 +3411,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
numberOfRows = [self numberOfRows];
|
||||
|
||||
if (row < 0)
|
||||
row = (_cachedRowHeights[numberOfRows-1].heightAboveRow + _cachedRowHeights[numberOfRows-1].height + _intercellSpacing.height < dragPoint.y) ? numberOfRows : row;
|
||||
row = (_cachedRowHeights[numberOfRows - 1].heightAboveRow + _cachedRowHeights[numberOfRows - 1].height + _intercellSpacing.height < dragPoint.y) ? numberOfRows : row;
|
||||
else if (dragPoint.y > MAX(bottomThirty, bottomPoint - 6))
|
||||
row = lowerRow;
|
||||
|
||||
@@ -3521,7 +3520,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
*/
|
||||
- (void)draggedImage:(CPImage)anImage endedAt:(CGPoint)aLocation operation:(CPDragOperation)anOperation
|
||||
{
|
||||
if([_dataSource respondsToSelector:@selector(tableView:didEndDraggedImage:atPosition:operation:)])
|
||||
if ([_dataSource respondsToSelector:@selector(tableView:didEndDraggedImage:atPosition:operation:)])
|
||||
[_dataSource tableView:self didEndDraggedImage:anImage atPosition:aLocation operation:anOperation];
|
||||
}
|
||||
|
||||
@@ -3538,7 +3537,7 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
- (void)_updateSelectionWithMouseAtRow:(CPInteger)aRow
|
||||
{
|
||||
//check to make sure the row exists
|
||||
if(aRow < 0)
|
||||
if (aRow < 0)
|
||||
return;
|
||||
|
||||
var newSelection,
|
||||
@@ -3683,43 +3682,43 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
![_delegate selectionShouldChangeInTableView:self])
|
||||
return;
|
||||
|
||||
if([[self selectedRowIndexes] count] > 0)
|
||||
if ([[self selectedRowIndexes] count] > 0)
|
||||
{
|
||||
var extend = NO;
|
||||
|
||||
if(([theEvent modifierFlags] & CPShiftKeyMask) && _allowsMultipleSelection)
|
||||
if (([theEvent modifierFlags] & CPShiftKeyMask) && _allowsMultipleSelection)
|
||||
extend = YES;
|
||||
|
||||
var i = [[self selectedRowIndexes] lastIndex];
|
||||
if(i<[self numberOfRows] - 1)
|
||||
if (i < [self numberOfRows] - 1)
|
||||
i++; //set index to the next row after the last row selected
|
||||
}
|
||||
else
|
||||
{
|
||||
var extend = NO;
|
||||
//no rows are currently selected
|
||||
if([self numberOfRows] > 0)
|
||||
if ([self numberOfRows] > 0)
|
||||
var i = 0; //select the first row
|
||||
}
|
||||
|
||||
|
||||
if(_implementedDelegateMethods & CPTableViewDelegate_tableView_shouldSelectRow_)
|
||||
if (_implementedDelegateMethods & CPTableViewDelegate_tableView_shouldSelectRow_)
|
||||
{
|
||||
|
||||
while((![_delegate tableView:self shouldSelectRow:i]) && i<[self numberOfRows])
|
||||
while ((![_delegate tableView:self shouldSelectRow:i]) && i < [self numberOfRows])
|
||||
{
|
||||
//check to see if the row can be selected if it can't be then see if the next row can be selected
|
||||
i++;
|
||||
}
|
||||
|
||||
//if the index still can be selected after the loop then just return
|
||||
if(![_delegate tableView:self shouldSelectRow:i])
|
||||
if (![_delegate tableView:self shouldSelectRow:i])
|
||||
return;
|
||||
}
|
||||
|
||||
[self selectRowIndexes:[CPIndexSet indexSetWithIndex:i] byExtendingSelection:extend];
|
||||
|
||||
if(i >= 0)
|
||||
if (i >= 0)
|
||||
[self scrollRowToVisible:i];
|
||||
}
|
||||
|
||||
@@ -3729,43 +3728,43 @@ CPTableViewFirstColumnOnlyAutoresizingStyle = 5;
|
||||
![_delegate selectionShouldChangeInTableView:self])
|
||||
return;
|
||||
|
||||
if([[self selectedRowIndexes] count] > 0)
|
||||
if ([[self selectedRowIndexes] count] > 0)
|
||||
{
|
||||
var extend = NO;
|
||||
|
||||
if(([theEvent modifierFlags] & CPShiftKeyMask) && _allowsMultipleSelection)
|
||||
if (([theEvent modifierFlags] & CPShiftKeyMask) && _allowsMultipleSelection)
|
||||
extend = YES;
|
||||
|
||||
var i = [[self selectedRowIndexes] firstIndex];
|
||||
if(i > 0)
|
||||
if (i > 0)
|
||||
i--; //set index to the prev row before the first row selected
|
||||
}
|
||||
else
|
||||
{
|
||||
var extend = NO;
|
||||
//no rows are currently selected
|
||||
if([self numberOfRows] > 0)
|
||||
if ([self numberOfRows] > 0)
|
||||
var i = [self numberOfRows] - 1; //select the first row
|
||||
}
|
||||
|
||||
|
||||
if(_implementedDelegateMethods & CPTableViewDelegate_tableView_shouldSelectRow_)
|
||||
if (_implementedDelegateMethods & CPTableViewDelegate_tableView_shouldSelectRow_)
|
||||
{
|
||||
|
||||
while((![_delegate tableView:self shouldSelectRow:i]) && i > 0)
|
||||
while ((![_delegate tableView:self shouldSelectRow:i]) && i > 0)
|
||||
{
|
||||
//check to see if the row can be selected if it can't be then see if the prev row can be selected
|
||||
i--;
|
||||
}
|
||||
|
||||
//if the index still can be selected after the loop then just return
|
||||
if(![_delegate tableView:self shouldSelectRow:i])
|
||||
if (![_delegate tableView:self shouldSelectRow:i])
|
||||
return;
|
||||
}
|
||||
|
||||
[self selectRowIndexes:[CPIndexSet indexSetWithIndex:i] byExtendingSelection:extend];
|
||||
|
||||
if(i >= 0)
|
||||
if (i >= 0)
|
||||
[self scrollRowToVisible:i];
|
||||
}
|
||||
|
||||
@@ -3919,7 +3918,7 @@ var CPTableViewDataSourceKey = @"CPTableViewDataSourceKey",
|
||||
var firstindex = [self firstIndex];
|
||||
var index = MIN(firstindex, [otherSet firstIndex]);
|
||||
var switchFlag = (index == firstindex);
|
||||
while(index != CPNotFound)
|
||||
while (index != CPNotFound)
|
||||
{
|
||||
var indexSet = (switchFlag) ? otherSet : self;
|
||||
otherIndex = [indexSet indexGreaterThanOrEqualToIndex:index];
|
||||
@@ -3945,7 +3944,7 @@ var CPTableViewDataSourceKey = @"CPTableViewDataSourceKey",
|
||||
|
||||
- (void)drawRect:(CGRect)aRect
|
||||
{
|
||||
if(tableView._destinationDragStyle === CPTableViewDraggingDestinationFeedbackStyleNone || isBlinking)
|
||||
if (tableView._destinationDragStyle === CPTableViewDraggingDestinationFeedbackStyleNone || isBlinking)
|
||||
return;
|
||||
|
||||
var context = [[CPGraphicsContext currentContext] graphicsPort];
|
||||
@@ -3964,7 +3963,7 @@ var CPTableViewDataSourceKey = @"CPTableViewDataSourceKey",
|
||||
var selectedRows = [tableView selectedRowIndexes],
|
||||
newRect = _CGRectMake(aRect.origin.x + 2, aRect.origin.y + 2, aRect.size.width - 4, aRect.size.height - 5);
|
||||
|
||||
if([selectedRows containsIndex:currentRow])
|
||||
if ([selectedRows containsIndex:currentRow])
|
||||
{
|
||||
CGContextSetLineWidth(context, 2);
|
||||
CGContextSetStrokeColor(context, [CPColor whiteColor]);
|
||||
@@ -3984,7 +3983,7 @@ var CPTableViewDataSourceKey = @"CPTableViewDataSourceKey",
|
||||
|
||||
var selectedRows = [tableView selectedRowIndexes];
|
||||
|
||||
if([selectedRows containsIndex:currentRow - 1] || [selectedRows containsIndex:currentRow])
|
||||
if ([selectedRows containsIndex:currentRow - 1] || [selectedRows containsIndex:currentRow])
|
||||
{
|
||||
CGContextSetStrokeColor(context, [CPColor whiteColor]);
|
||||
CGContextSetLineWidth(context, 4);
|
||||
|
||||
+1
-1
@@ -667,7 +667,7 @@ var _CPToolbarItemInfoMake = function(anIndex, aView, aLabel, aMinWidth)
|
||||
|
||||
// Determine all the items that have flexible width.
|
||||
// Also determine the height of the toolbar.
|
||||
var count = _visibleItems.length
|
||||
var count = _visibleItems.length,
|
||||
flexibleItemIndexes = [CPIndexSet indexSet];
|
||||
|
||||
while (count--)
|
||||
|
||||
+36
-36
@@ -40,7 +40,7 @@ CPToolbarShowFontsItemIdentifier = @"CPToolbarShowFontsItem";
|
||||
CPToolbarCustomizeToolbarItemIdentifier = @"CPToolbarCustomizeToolbarItem";
|
||||
CPToolbarPrintItemIdentifier = @"CPToolbarPrintItem";
|
||||
|
||||
/*!
|
||||
/*!
|
||||
@ingroup appkit
|
||||
@class CPToolbarItem
|
||||
|
||||
@@ -49,9 +49,9 @@ CPToolbarPrintItemIdentifier = @"CPToolbarPrintItem";
|
||||
@implementation CPToolbarItem : CPObject
|
||||
{
|
||||
CPString _itemIdentifier;
|
||||
|
||||
|
||||
CPToolbar _toolbar;
|
||||
|
||||
|
||||
CPString _label;
|
||||
CPString _paletteLabel;
|
||||
CPString _toolTip;
|
||||
@@ -61,12 +61,12 @@ CPToolbarPrintItemIdentifier = @"CPToolbarPrintItem";
|
||||
BOOL _isEnabled;
|
||||
CPImage _image;
|
||||
CPImage _alternateImage;
|
||||
|
||||
|
||||
CPView _view;
|
||||
|
||||
|
||||
CGSize _minSize;
|
||||
CGSize _maxSize;
|
||||
|
||||
CGSize _maxSize;
|
||||
|
||||
int _visibilityPriority;
|
||||
|
||||
BOOL _autovalidates;
|
||||
@@ -86,21 +86,21 @@ CPToolbarPrintItemIdentifier = @"CPToolbarPrintItem";
|
||||
- (id)initWithItemIdentifier:(CPString)anItemIdentifier
|
||||
{
|
||||
self = [super init];
|
||||
|
||||
|
||||
if (self)
|
||||
{
|
||||
_itemIdentifier = anItemIdentifier;
|
||||
|
||||
|
||||
_tag = 0;
|
||||
_isEnabled = YES;
|
||||
|
||||
|
||||
_minSize = CGSizeMakeZero();
|
||||
_maxSize = CGSizeMakeZero();
|
||||
|
||||
|
||||
_visibilityPriority = CPToolbarItemVisibilityPriorityStandard;
|
||||
_autovalidates = YES;
|
||||
}
|
||||
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ CPToolbarPrintItemIdentifier = @"CPToolbarPrintItem";
|
||||
{
|
||||
if ([_view respondsToSelector:@selector(toolTip)])
|
||||
return [_view toolTip];
|
||||
|
||||
|
||||
return _toolTip;
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ CPToolbarPrintItemIdentifier = @"CPToolbarPrintItem";
|
||||
{
|
||||
if ([_view respondsToSelector:@selector(setToolTip:)])
|
||||
[_view setToolTip:aToolTip];
|
||||
|
||||
|
||||
_toolTip = aToolTip;
|
||||
}
|
||||
|
||||
@@ -193,7 +193,7 @@ CPToolbarPrintItemIdentifier = @"CPToolbarPrintItem";
|
||||
{
|
||||
if ([_view respondsToSelector:@selector(tag)])
|
||||
return [_view tag];
|
||||
|
||||
|
||||
return _tag;
|
||||
}
|
||||
|
||||
@@ -205,7 +205,7 @@ CPToolbarPrintItemIdentifier = @"CPToolbarPrintItem";
|
||||
{
|
||||
if ([_view respondsToSelector:@selector(setTag:)])
|
||||
[_view setTag:aTag];
|
||||
|
||||
|
||||
_tag = aTag;
|
||||
}
|
||||
|
||||
@@ -216,12 +216,12 @@ CPToolbarPrintItemIdentifier = @"CPToolbarPrintItem";
|
||||
{
|
||||
if (_view)
|
||||
return [_view respondsToSelector:@selector(target)] ? [_view target] : nil;
|
||||
|
||||
|
||||
return _target;
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets the target of the action that is triggered when the user clicks this item. \c nil will cause
|
||||
Sets the target of the action that is triggered when the user clicks this item. \c nil will cause
|
||||
the action to be passed on to the first responder.
|
||||
@param aTarget the new target
|
||||
*/
|
||||
@@ -229,7 +229,7 @@ CPToolbarPrintItemIdentifier = @"CPToolbarPrintItem";
|
||||
{
|
||||
if (!_view)
|
||||
_target = aTarget;
|
||||
|
||||
|
||||
else if ([_view respondsToSelector:@selector(setTarget:)])
|
||||
[_view setTarget:aTarget];
|
||||
}
|
||||
@@ -241,7 +241,7 @@ CPToolbarPrintItemIdentifier = @"CPToolbarPrintItem";
|
||||
{
|
||||
if (_view)
|
||||
return [_view respondsToSelector:@selector(action)] ? [_view action] : nil;
|
||||
|
||||
|
||||
return _action;
|
||||
}
|
||||
|
||||
@@ -265,7 +265,7 @@ CPToolbarPrintItemIdentifier = @"CPToolbarPrintItem";
|
||||
{
|
||||
if ([_view respondsToSelector:@selector(isEnabled)])
|
||||
return [_view isEnabled];
|
||||
|
||||
|
||||
return _isEnabled;
|
||||
}
|
||||
|
||||
@@ -277,7 +277,7 @@ CPToolbarPrintItemIdentifier = @"CPToolbarPrintItem";
|
||||
{
|
||||
if ([_view respondsToSelector:@selector(setEnabled:)])
|
||||
[_view setEnabled:shouldBeEnabled];
|
||||
|
||||
|
||||
_isEnabled = shouldBeEnabled;
|
||||
}
|
||||
|
||||
@@ -288,7 +288,7 @@ CPToolbarPrintItemIdentifier = @"CPToolbarPrintItem";
|
||||
{
|
||||
if ([_view respondsToSelector:@selector(image)])
|
||||
return [_view image];
|
||||
|
||||
|
||||
return _image;
|
||||
}
|
||||
|
||||
@@ -302,11 +302,11 @@ CPToolbarPrintItemIdentifier = @"CPToolbarPrintItem";
|
||||
[_view setImage:anImage];
|
||||
|
||||
_image = anImage;
|
||||
|
||||
|
||||
if (!_image)
|
||||
return;
|
||||
|
||||
if (_minSize.width === 0 && _minSize.height === 0 &&
|
||||
|
||||
if (_minSize.width === 0 && _minSize.height === 0 &&
|
||||
_maxSize.width === 0 && _maxSize.height === 0)
|
||||
{
|
||||
var imageSize = [_image size];
|
||||
@@ -327,7 +327,7 @@ CPToolbarPrintItemIdentifier = @"CPToolbarPrintItem";
|
||||
{
|
||||
if ([_view respondsToSelector:@selector(setAlternateImage:)])
|
||||
[_view setAlternateImage:anImage];
|
||||
|
||||
|
||||
_alternateImage = anImage;
|
||||
}
|
||||
|
||||
@@ -338,7 +338,7 @@ CPToolbarPrintItemIdentifier = @"CPToolbarPrintItem";
|
||||
{
|
||||
if ([_view respondsToSelector:@selector(alternateIamge)])
|
||||
return [_view alternateImage];
|
||||
|
||||
|
||||
return _alternateImage;
|
||||
}
|
||||
|
||||
@@ -358,7 +358,7 @@ CPToolbarPrintItemIdentifier = @"CPToolbarPrintItem";
|
||||
{
|
||||
if (_view == aView)
|
||||
return;
|
||||
|
||||
|
||||
_view = aView;
|
||||
|
||||
if (_view)
|
||||
@@ -366,7 +366,7 @@ CPToolbarPrintItemIdentifier = @"CPToolbarPrintItem";
|
||||
// Tags get forwarded.
|
||||
if (_tag !== 0 && [_view respondsToSelector:@selector(setTag:)])
|
||||
[_view setTag:_tag];
|
||||
|
||||
|
||||
_target = nil;
|
||||
_action = nil;
|
||||
}
|
||||
@@ -386,11 +386,11 @@ CPToolbarPrintItemIdentifier = @"CPToolbarPrintItem";
|
||||
*/
|
||||
- (void)setMinSize:(CGSize)aMinSize
|
||||
{
|
||||
if(!aMinSize.height || !aMinSize.width)
|
||||
if (!aMinSize.height || !aMinSize.width)
|
||||
return;
|
||||
|
||||
_minSize = CGSizeMakeCopy(aMinSize);
|
||||
|
||||
|
||||
// Try to provide some sanity: Make maxSize >= minSize
|
||||
_maxSize = CGSizeMake(MAX(_minSize.width, _maxSize.width), MAX(_minSize.height, _maxSize.height));
|
||||
}
|
||||
@@ -409,11 +409,11 @@ CPToolbarPrintItemIdentifier = @"CPToolbarPrintItem";
|
||||
*/
|
||||
- (void)setMaxSize:(CGSize)aMaxSize
|
||||
{
|
||||
if(!aMaxSize.height || !aMaxSize.width)
|
||||
if (!aMaxSize.height || !aMaxSize.width)
|
||||
return;
|
||||
|
||||
|
||||
_maxSize = CGSizeMakeCopy(aMaxSize);
|
||||
|
||||
|
||||
// Try to provide some sanity: Make minSize <= maxSize
|
||||
_minSize = CGSizeMake(MIN(_minSize.width, _maxSize.width), MIN(_minSize.height, _maxSize.height));
|
||||
}
|
||||
@@ -623,7 +623,7 @@ var CPToolbarItemItemIdentifierKey = @"CPToolbarItemItemIdentifierKey",
|
||||
case CPToolbarCustomizeToolbarItemIdentifier: return nil;
|
||||
case CPToolbarPrintItemIdentifier: return nil;
|
||||
}
|
||||
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
|
||||
+24
-25
@@ -107,7 +107,7 @@ CPWebViewScrollNative = 2;
|
||||
_ignoreLoadEnd = YES;
|
||||
|
||||
_iframe = document.createElement("iframe");
|
||||
_iframe.name = "iframe_" + Math.floor(Math.random()*10000);
|
||||
_iframe.name = "iframe_" + FLOOR(RAND() * 10000);
|
||||
_iframe.style.width = "100%";
|
||||
_iframe.style.height = "100%";
|
||||
_iframe.style.borderWidth = "0px";
|
||||
@@ -116,47 +116,46 @@ CPWebViewScrollNative = 2;
|
||||
[self setDrawsBackground:YES];
|
||||
|
||||
_loadCallback = function() {
|
||||
// HACK: this block handles the case where we don't know about loads initiated by the user clicking a link
|
||||
if (!_ignoreLoadStart)
|
||||
{
|
||||
// post the start load notification
|
||||
[self _startedLoading];
|
||||
// HACK: this block handles the case where we don't know about loads initiated by the user clicking a link
|
||||
if (!_ignoreLoadStart)
|
||||
{
|
||||
// post the start load notification
|
||||
[self _startedLoading];
|
||||
|
||||
if (_mainFrameURL)
|
||||
[_backwardStack addObject:_mainFrameURL];
|
||||
if (_mainFrameURL)
|
||||
[_backwardStack addObject:_mainFrameURL];
|
||||
|
||||
// FIXME: this doesn't actually get the right URL for different domains. Not possible due to browser security restrictions.
|
||||
// FIXME: this doesn't actually get the right URL for different domains. Not possible due to browser security restrictions.
|
||||
_mainFrameURL = _iframe.src;
|
||||
_mainFrameURL = _iframe.src;
|
||||
|
||||
// clear the forward
|
||||
[_forwardStack removeAllObjects];
|
||||
}
|
||||
else
|
||||
[_forwardStack removeAllObjects];
|
||||
}
|
||||
else
|
||||
_ignoreLoadStart = NO;
|
||||
|
||||
if (!_ignoreLoadEnd)
|
||||
{
|
||||
if (!_ignoreLoadEnd)
|
||||
{
|
||||
[self _finishedLoading];
|
||||
}
|
||||
else
|
||||
_ignoreLoadEnd = NO;
|
||||
}
|
||||
else
|
||||
_ignoreLoadEnd = NO;
|
||||
|
||||
[[CPRunLoop currentRunLoop] limitDateForMode:CPDefaultRunLoopMode];
|
||||
}
|
||||
|
||||
if (_iframe.addEventListener)
|
||||
_iframe.addEventListener("load", _loadCallback, false);
|
||||
else if (_iframe.attachEvent)
|
||||
_iframe.attachEvent("onload", _loadCallback);
|
||||
}
|
||||
|
||||
if (_iframe.addEventListener)
|
||||
_iframe.addEventListener("load", _loadCallback, false);
|
||||
else if (_iframe.attachEvent)
|
||||
_iframe.attachEvent("onload", _loadCallback);
|
||||
|
||||
_frameView = [[CPView alloc] initWithFrame:[self bounds]];
|
||||
[_frameView setAutoresizingMask:CPViewWidthSizable|CPViewHeightSizable];
|
||||
[_frameView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable];
|
||||
|
||||
_scrollView = [[CPScrollView alloc] initWithFrame:[self bounds]];
|
||||
[_scrollView setAutohidesScrollers:YES];
|
||||
[_scrollView setAutoresizingMask:CPViewWidthSizable|CPViewHeightSizable];
|
||||
[_scrollView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable];
|
||||
[_scrollView setDocumentView:_frameView];
|
||||
|
||||
_frameView._DOMElement.appendChild(_iframe);
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
@import "CPDocument.j"
|
||||
|
||||
|
||||
/*!
|
||||
/*!
|
||||
@ingroup appkit
|
||||
@class CPWindowController
|
||||
|
||||
@@ -171,8 +171,8 @@
|
||||
|
||||
if (_window === nil && [_cibOwner isKindOfClass:[CPDocument class]])
|
||||
[self setWindow:[_cibOwner valueForKey:@"window"]];
|
||||
|
||||
if (!_window)
|
||||
|
||||
if (!_window)
|
||||
{
|
||||
var reason = [CPString stringWithFormat:@"Window for %@ could not be loaded from Cib or no window specified. \
|
||||
Override loadWindow to load the window manually.", self];
|
||||
@@ -232,7 +232,7 @@
|
||||
{
|
||||
if (![self supportsMultipleDocuments])
|
||||
[self removeDocument:_document];
|
||||
|
||||
|
||||
[defaultCenter removeObserver:self
|
||||
name:CPDocumentWillSaveNotification
|
||||
object:_document];
|
||||
@@ -381,7 +381,7 @@
|
||||
}
|
||||
|
||||
/*!
|
||||
Sets whether the document has unsaved changes. The window can use this as a hint to
|
||||
Sets whether the document has unsaved changes. The window can use this as a hint to
|
||||
@param isEdited \c YES means the document has unsaved changes.
|
||||
*/
|
||||
- (void)setDocumentEdited:(BOOL)isEdited
|
||||
|
||||
@@ -34,7 +34,7 @@ var _CPCibCustomObjectClassName = @"_CPCibCustomObjectClassName";
|
||||
|
||||
if (self)
|
||||
_className = [aCoder decodeObjectForKey:_CPCibCustomObjectClassName];
|
||||
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ var _CPCibCustomObjectClassName = @"_CPCibCustomObjectClassName";
|
||||
|
||||
if (theClass === [CPApplication class])
|
||||
return [CPApplication sharedApplication];
|
||||
|
||||
|
||||
return [[theClass alloc] init];
|
||||
}
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ function descriptionWithoutEntity(aString)
|
||||
|
||||
// Test no indexes
|
||||
[self assert:descriptionWithoutEntity(indexSet) equals:@"(no indexes)"];
|
||||
|
||||
|
||||
// Test adding initial range
|
||||
[indexSet addIndexesInRange:CPMakeRange(0, 70)];
|
||||
|
||||
@@ -121,12 +121,12 @@ function descriptionWithoutEntity(aString)
|
||||
[indexSet removeIndexesInRange:CPMakeRange(20, 36)];
|
||||
|
||||
[self assert:@"[number of indexes: 31 (in 3 ranges), indexes: (0-19 56 60-69)]" equals:descriptionWithoutEntity(indexSet)];
|
||||
|
||||
|
||||
// Remove single index that represents an entire range.
|
||||
[indexSet removeIndex:56];
|
||||
|
||||
[self assert:@"[number of indexes: 30 (in 2 ranges), indexes: (0-19 60-69)]" equals:descriptionWithoutEntity(indexSet)];
|
||||
|
||||
|
||||
// Remove index set that is subset of existing range, causing a split.
|
||||
[indexSet removeIndexes:[CPIndexSet indexSetWithIndexesInRange:CPMakeRange(5, 10)]];
|
||||
|
||||
@@ -185,12 +185,10 @@ function descriptionWithoutEntity(aString)
|
||||
- (void)testIndexSet:(CPIndexSet)set containsRange:(CPRange)range
|
||||
{
|
||||
[self assertFalse:[set containsIndex:range.location -1]];
|
||||
|
||||
for (var i=range.location, max=CPMaxRange(range); i<max; i++)
|
||||
{
|
||||
|
||||
for (var i = range.location, max = CPMaxRange(range); i < max; i++)
|
||||
[self assertTrue:[set containsIndex:i]];
|
||||
}
|
||||
|
||||
|
||||
[self assertFalse:[set containsIndex:i]];
|
||||
}
|
||||
|
||||
@@ -296,14 +294,14 @@ function descriptionWithoutEntity(aString)
|
||||
- (void)testAddSpeed
|
||||
{
|
||||
var startTime = [CPDate date];
|
||||
|
||||
|
||||
for (var i = 0; i < 1000; i++)
|
||||
{
|
||||
[_set addIndex:ROUND(RAND()*100000)];
|
||||
}
|
||||
|
||||
print([startTime timeIntervalSinceNow]);
|
||||
//[self assertTrue: ABS([startTime timeIntervalSinceNow]) < 2];
|
||||
//[self assertTrue: ABS([startTime timeIntervalSinceNow]) < 2];
|
||||
}
|
||||
*/
|
||||
- (void)testIndexGreaterThanIndex
|
||||
@@ -372,19 +370,19 @@ function descriptionWithoutEntity(aString)
|
||||
var startRange = CPMakeRange(1, 5),
|
||||
shiftRange = CPMakeRange(2, 5);
|
||||
_set = [CPIndexSet indexSetWithIndexesInRange:startRange];
|
||||
|
||||
|
||||
// positive delta for downward shift
|
||||
[_set shiftIndexesStartingAtIndex:1 by:1];
|
||||
[self assertTrue:[_set containsIndexes:[CPIndexSet indexSetWithIndexesInRange:shiftRange]]];
|
||||
|
||||
|
||||
// negative delta for downward shift
|
||||
[_set shiftIndexesStartingAtIndex:1 by:-1];
|
||||
[self assertTrue:[_set containsIndexes:[CPIndexSet indexSetWithIndexesInRange:startRange]]];
|
||||
|
||||
|
||||
// test for fix to issue #746 (last item is mistakenly shifted)
|
||||
_set = [CPIndexSet indexSetWithIndexesInRange:CPMakeRange(0, 1)];
|
||||
[self assertTrue:[_set lastIndex] === 0];
|
||||
|
||||
|
||||
[_set shiftIndexesStartingAtIndex:[_set lastIndex] + 1 by:1];
|
||||
[self assertTrue:[_set lastIndex] === 0];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user