Merge remote-tracking branch 'upstream/main' into Aristo3

This commit is contained in:
daboe01
2026-07-25 19:26:39 +02:00
95 changed files with 1877 additions and 1401 deletions
+8 -8
View File
@@ -172,7 +172,7 @@ var bottomHeight = 71;
BOOL _needsLayout;
}
#pragma mark Creating Alerts
// MARK: Creating Alerts
/*!
Returns a CPAlert object with the provided info
@@ -249,8 +249,8 @@ var bottomHeight = 71;
}
#pragma mark -
#pragma mark Delegate
// MARK: -
// MARK: Delegate
/*!
Set the delegate of the receiver
@@ -272,7 +272,7 @@ var bottomHeight = 71;
}
#pragma mark Accessors
// MARK: Accessors
- (CPTheme)theme
{
@@ -402,7 +402,7 @@ var bottomHeight = 71;
_needsLayout = YES;
}
#pragma mark Accessing Buttons
// MARK: Accessing Buttons
/*!
Adds a button with a given title to the receiver.
@@ -443,7 +443,7 @@ var bottomHeight = 71;
[_buttons insertObject:button atIndex:0];
}
#pragma mark Layout
// MARK: Layout
/*!
@ignore
@@ -708,7 +708,7 @@ var bottomHeight = 71;
_needsLayout = NO;
}
#pragma mark Displaying Alerts
// MARK: Displaying Alerts
/*!
Displays the \c CPAlert panel as a modal dialog. The user will not be
@@ -786,7 +786,7 @@ var bottomHeight = 71;
[self beginSheetModalForWindow:aWindow modalDelegate:nil didEndSelector:nil contextInfo:nil];
}
#pragma mark Private
// MARK: Private
/*!
@ignore
+9 -9
View File
@@ -63,8 +63,8 @@ CPThemeStateAppearanceVibrantDark = CPThemeState("appearance-vibrant-dark")
}
#pragma mark -
#pragma mark Class Methods
// MARK: -
// MARK: Class Methods
/*! Returns the current default CPAppearance
*/
@@ -99,8 +99,8 @@ CPThemeStateAppearanceVibrantDark = CPThemeState("appearance-vibrant-dark")
}
#pragma mark -
#pragma mark Initialization
// MARK: -
// MARK: Initialization
/*! Creates a CPAppearance object initialized to the specified appearance file in the specified bundle
This method does actually nothing special. It just creates a default appearance object
@@ -122,8 +122,8 @@ CPThemeStateAppearanceVibrantDark = CPThemeState("appearance-vibrant-dark")
}
#pragma mark -
#pragma mark Implementation
// MARK: -
// MARK: Implementation
- (BOOL)isEqual:(id)anObject
{
@@ -139,8 +139,8 @@ CPThemeStateAppearanceVibrantDark = CPThemeState("appearance-vibrant-dark")
}
#pragma mark -
#pragma mark CPCoding
// MARK: -
// MARK: CPCoding
- (id)initWithCoder:(CPCoder)aCoder
{
@@ -159,4 +159,4 @@ CPThemeStateAppearanceVibrantDark = CPThemeState("appearance-vibrant-dark")
[aCoder encodeBool:_allowsVibrancy forKey:@"_allowsVibrancy"];
}
@end
@end
+8 -8
View File
@@ -264,8 +264,8 @@ CPBelowBottom = 6;
[self _manageTitlePositioning];
}
#pragma mark -
#pragma mark Style properties which override theme values
// MARK: -
// MARK: Style properties which override theme values
/*!
The borderColor, borderWidth, cornerRadius and fillColor properties for the receiver
are only supported for boxes with boxType === CPBoxCustom and borderType === CPLineBorder.
@@ -282,7 +282,7 @@ CPBelowBottom = 6;
*/
// See discussion above.
#pragma mark borderColor
// MARK: borderColor
- (CPColor)borderColor
{
return [self currentValueForThemeAttribute:@"border-color"];
@@ -308,7 +308,7 @@ CPBelowBottom = 6;
}
// See discussion above.
#pragma mark borderWidth
// MARK: borderWidth
- (float)borderWidth
{
return [self valueForThemeAttribute:@"border-width"];
@@ -334,7 +334,7 @@ CPBelowBottom = 6;
}
// See discussion above.
#pragma mark cornerRadius
// MARK: cornerRadius
- (float)cornerRadius
{
return [self valueForThemeAttribute:@"corner-radius"];
@@ -360,7 +360,7 @@ CPBelowBottom = 6;
}
// See discussion above.
#pragma mark fillColor
// MARK: fillColor
- (CPColor)fillColor
{
return [self valueForThemeAttribute:@"background-color"];
@@ -761,7 +761,7 @@ CPBelowBottom = 6;
@end
#pragma mark -
// MARK: -
@implementation CPBox (CSSTheming)
@@ -829,7 +829,7 @@ CPBelowBottom = 6;
@end
#pragma mark -
// MARK: -
var CPBoxTypeKey = @"CPBoxTypeKey",
CPBoxBorderTypeKey = @"CPBoxBorderTypeKey",
+3 -3
View File
@@ -221,8 +221,8 @@ CPButtonImageOffset = 3.0;
[self setButtonType:CPMomentaryPushInButton];
}
#pragma mark -
#pragma mark Control Size
// MARK: -
// MARK: Control Size
- (void)setControlSize:(CPControlSize)aControlSize
{
@@ -233,7 +233,7 @@ CPButtonImageOffset = 3.0;
}
#pragma mark -
// MARK: -
// Setting the state
/*!
+3 -3
View File
@@ -95,8 +95,8 @@ CPCheckBoxImageOffset = 4.0;
}
#pragma mark -
#pragma mark Override methods from CPButton
// MARK: -
// MARK: Override methods from CPButton
- (CGSize)_minimumFrameSize
{
@@ -177,7 +177,7 @@ CPCheckBoxImageOffset = 4.0;
@end
#pragma mark -
// MARK: -
@implementation CPCheckBox (TableDataView)
+2 -2
View File
@@ -202,8 +202,8 @@ var HORIZONTAL_MARGIN = 2;
#pragma mark -
#pragma mark Delegate
// MARK: -
// MARK: Delegate
/*!
Set the delegate of the receiver
+7 -7
View File
@@ -89,8 +89,8 @@ var cachedBlackColor,
}
@global document
#pragma mark -
#pragma mark Theming
// MARK: -
// MARK: Theming
+ (CPString)defaultThemeClass
{
@@ -109,8 +109,8 @@ var cachedBlackColor,
}
#pragma mark -
#pragma mark Static methods
// MARK: -
// MARK: Static methods
/*!
Creates a color in the RGB colorspace, with an alpha value.
@@ -884,8 +884,8 @@ url("data:image/png;base64,BASE64ENCODEDDATA") // if there is a pattern image
@end
#pragma mark -
#pragma mark CSS Theming
// MARK: -
// MARK: CSS Theming
// The code below adds support for CSS theming with 100% compatibility with current theming system.
// The idea is to extend CPColor (and CPImage) with CSS components and adapt low level UI components to
@@ -1091,7 +1091,7 @@ url("data:image/png;base64,BASE64ENCODEDDATA") // if there is a pattern image
@end
#pragma mark -
// MARK: -
/// @cond IGNORE
var CPColorComponentsKey = @"CPColorComponentsKey",
+12 -12
View File
@@ -123,8 +123,8 @@ var _CPColorWellDidBecomeExclusiveNotification = @"_CPColorWellDidBecomeExclusiv
return self;
}
#pragma mark -
#pragma mark Draw
// MARK: -
// MARK: Draw
/*!
Sets whether the color well is bordered.
@@ -145,8 +145,8 @@ var _CPColorWellDidBecomeExclusiveNotification = @"_CPColorWellDidBecomeExclusiv
return [self hasThemeState:CPThemeStateBordered];
}
#pragma mark -
#pragma mark Managing Color
// MARK: -
// MARK: Managing Color
/*!
Returns the color well's current color.
@@ -199,8 +199,8 @@ var _CPColorWellDidBecomeExclusiveNotification = @"_CPColorWellDidBecomeExclusiv
}
}
#pragma mark -
#pragma mark Activating and Deactivating
// MARK: -
// MARK: Activating and Deactivating
/*!
Activates the color well, displays the color panel, and makes the panel's current color the same as its own.
@@ -241,8 +241,8 @@ var _CPColorWellDidBecomeExclusiveNotification = @"_CPColorWellDidBecomeExclusiv
return YES;
}
#pragma mark -
#pragma mark Event Handling
// MARK: -
// MARK: Event Handling
- (void)mouseDown:(CPEvent)anEvent
{
@@ -289,8 +289,8 @@ var _CPColorWellDidBecomeExclusiveNotification = @"_CPColorWellDidBecomeExclusiv
}
#pragma mark -
#pragma mark Drag and Drop
// MARK: -
// MARK: Drag and Drop
- (void)draggingEntered:(id)sender
{
@@ -346,8 +346,8 @@ var _CPColorWellDidBecomeExclusiveNotification = @"_CPColorWellDidBecomeExclusiv
return CPDragOperationCopy;
}
#pragma mark -
#pragma mark Layout
// MARK: -
// MARK: Layout
- (CGRect)contentRectForBounds:(CGRect)bounds
{
+12 -12
View File
@@ -133,7 +133,7 @@ var CPComboBoxTextSubview = @"text",
[self setThemeState:CPComboBoxStateButtonBordered];
}
#pragma mark Setting Display Attributes
// MARK: Setting Display Attributes
- (BOOL)hasVerticalScroller
{
@@ -214,7 +214,7 @@ var CPComboBoxTextSubview = @"text",
_numberOfVisibleItems = MAX(visibleItems, 1);
}
#pragma mark Setting a Delegate
// MARK: Setting a Delegate
- (id <CPComboBoxDelegate>)delegate
{
@@ -254,7 +254,7 @@ var CPComboBoxTextSubview = @"text",
[super setDelegate:aDelegate];
}
#pragma mark Setting a Data Source
// MARK: Setting a Data Source
- (id <CPComboBoxDataSource>)dataSource
{
@@ -305,7 +305,7 @@ var CPComboBoxTextSubview = @"text",
[self reloadData];
}
#pragma mark Working with an Internal List
// MARK: Working with an Internal List
- (void)addItemsWithObjectValues:(CPArray)objects
{
@@ -378,7 +378,7 @@ var CPComboBoxTextSubview = @"text",
return _items.length;
}
#pragma mark Manipulating the Displayed List
// MARK: Manipulating the Displayed List
/*!
Returns the delegate to be used when creating the pop up list.
@@ -601,7 +601,7 @@ var CPComboBoxTextSubview = @"text",
[self sendAction:[self action] to:[self target]];
}
#pragma mark Manipulating the Selection
// MARK: Manipulating the Selection
- (void)deselectItemAtIndex:(int)index
{
@@ -653,7 +653,7 @@ var CPComboBoxTextSubview = @"text",
[self selectItemAtIndex:index];
}
#pragma mark Completing the Text Field
// MARK: Completing the Text Field
- (BOOL)completes
{
@@ -700,7 +700,7 @@ var CPComboBoxTextSubview = @"text",
_forceSelection = !!flag;
}
#pragma mark CPTextField Delegate Methods and Overrides
// MARK: CPTextField Delegate Methods and Overrides
/*! @ignore */
- (BOOL)sendAction:(SEL)anAction to:(id)anObject
@@ -900,7 +900,7 @@ var CPComboBoxTextSubview = @"text",
[_listDelegate setAlignment:alignment];
}
#pragma mark Pop Up Button Layout
// MARK: Pop Up Button Layout
- (CGRect)popupButtonRectForBounds:(CGRect)bounds
{
@@ -945,7 +945,7 @@ var CPComboBoxTextSubview = @"text",
relativeToEphemeralSubviewNamed:@"content-view"];
}
#pragma mark Internal Helpers
// MARK: Internal Helpers
/*! @ignore */
- (void)_dataSourceWarningForMethod:(SEL)cmd condition:(CPString)flag
@@ -1006,8 +1006,8 @@ var CPComboBoxTextSubview = @"text",
}
#pragma mark -
#pragma mark Observers method
// MARK: -
// MARK: Observers method
- (void)_addObservers
{
+5 -5
View File
@@ -208,8 +208,8 @@ var CPControlBlackColor = [CPColor blackColor];
return self;
}
#pragma mark -
#pragma mark Control Size
// MARK: -
// MARK: Control Size
/*!
Returns the control's control size
@@ -290,7 +290,7 @@ var CPControlBlackColor = [CPColor blackColor];
}
#pragma mark -
// MARK: -
/*!
Sets the receiver's target action.
@@ -1027,8 +1027,8 @@ var CPControlBlackColor = [CPColor blackColor];
}
#pragma mark -
#pragma mark Base writing direction
// MARK: -
// MARK: Base writing direction
/*!
Sets the initial writing direction of the receiver
+20 -20
View File
@@ -82,8 +82,8 @@ CPEraDatePickerElementFlag = 0x0100;
}
#pragma mark -
#pragma mark Theme methods
// MARK: -
// MARK: Theme methods
+ (CPString)defaultThemeClass
{
@@ -174,8 +174,8 @@ CPEraDatePickerElementFlag = 0x0100;
}
#pragma mark -
#pragma mark Binding methods
// MARK: -
// MARK: Binding methods
+ (Class)_binderClassForBinding:(CPString)theBinding
{
@@ -200,8 +200,8 @@ CPEraDatePickerElementFlag = 0x0100;
}
#pragma mark -
#pragma mark Init methods
// MARK: -
// MARK: Init methods
- (id)initWithFrame:(CGRect)aFrame
{
@@ -271,8 +271,8 @@ CPEraDatePickerElementFlag = 0x0100;
}
#pragma mark -
#pragma mark Control Size
// MARK: -
// MARK: Control Size
- (void)setControlSize:(CPControlSize)aControlSize
{
@@ -285,8 +285,8 @@ CPEraDatePickerElementFlag = 0x0100;
}
#pragma mark -
#pragma mark Delegate methods
// MARK: -
// MARK: Delegate methods
/*! Set the delegate of the datePicker
@param aDelegate delegate of the datePicker
@@ -302,8 +302,8 @@ CPEraDatePickerElementFlag = 0x0100;
}
#pragma mark -
#pragma mark Layout method
// MARK: -
// MARK: Layout method
/*! Layout the subviews
*/
@@ -313,8 +313,8 @@ CPEraDatePickerElementFlag = 0x0100;
[_datePickerComponent setNeedsDisplay:YES];
}
#pragma mark -
#pragma mark Setter
// MARK: -
// MARK: Setter
/*! Return the objectValue of the datePicker. The objectValue should take the timeZoneEffect
*/
@@ -651,8 +651,8 @@ CPEraDatePickerElementFlag = 0x0100;
}
#pragma mark -
#pragma mark First responder methods
// MARK: -
// MARK: First responder methods
/*! Return YES if style is set to CPTextFieldAndStepperDatePickerStyle or CPTextFieldDatePickerStyle
*/
@@ -689,8 +689,8 @@ CPEraDatePickerElementFlag = 0x0100;
}
#pragma mark -
#pragma mark getter
// MARK: -
// MARK: getter
/*!
Returns \c YES if the textfield is bezeled.
@@ -723,8 +723,8 @@ CPEraDatePickerElementFlag = 0x0100;
return [[_locale objectForKey:CPLocaleCountryCode] isEqualToString:@"US"];
}
#pragma mark -
#pragma mark Key event
// MARK: -
// MARK: Key event
/*! Key down event
@param anEvent
+9 -9
View File
@@ -52,7 +52,7 @@
}
#pragma mark Init method
// MARK: Init method
/*! Init a _CPDatePickerCalendar
@param aFrame
@@ -111,8 +111,8 @@
}
#pragma mark -
#pragma mark Responder methods
// MARK: -
// MARK: Responder methods
- (BOOL)acceptsFirstResponder
{
@@ -120,8 +120,8 @@
}
#pragma mark -
#pragma mark Getter Setter methods
// MARK: -
// MARK: Getter Setter methods
/*! Set the date value of the component. It sets the dateValue of the header and the monthView also
@param aDateValue
@@ -160,8 +160,8 @@
[self _init];
}
#pragma mark -
#pragma mark Layout methods
// MARK: -
// MARK: Layout methods
/*! Manager the subviews. It hides or not the clock.
*/
@@ -221,8 +221,8 @@
}
#pragma mark -
#pragma mark Action methods
// MARK: -
// MARK: Action methods
/*! Move to the nextMonth without changing the dateValue of the datePicker
*/
+5 -5
View File
@@ -76,8 +76,8 @@ _CPDatePickerClockSeconds = 3;
CPInteger _datePickerElements @accessors(getter=datePickerElements);
}
#pragma mark -
#pragma mark Init methods
// MARK: -
// MARK: Init methods
- (id)initWithFrame:(CGRect)aFrame datePicker:(CPDatePicker)aDatePicker
{
@@ -186,7 +186,7 @@ _CPDatePickerClockSeconds = 3;
[_secondHandView setHidden:!((_datePickerElements & CPHourMinuteSecondDatePickerElementFlag) == CPHourMinuteSecondDatePickerElementFlag)];
}
#pragma mark Layout methods
// MARK: Layout methods
- (void)layoutSubviews
{
@@ -267,7 +267,7 @@ _CPDatePickerClockSeconds = 3;
[self _rotateView:_secondHandView byAngle:_secondAngle];
}
#pragma mark Accessors
// MARK: Accessors
- (void)setEnabled:(BOOL)shouldEnable
{
@@ -281,7 +281,7 @@ _CPDatePickerClockSeconds = 3;
[self setNeedsLayout];
}
#pragma mark Mouse actions
// MARK: Mouse actions
// Since we rotate using Pure CSS, Cappuccino's `convertPoint:` doesn't know about it.
// So we use standard Trigonometry to perfectly hit-test the rotated hands!
+7 -7
View File
@@ -41,7 +41,7 @@
}
#pragma mark Init methods
// MARK: Init methods
/*! Create a new instance of _CPDatePickerDayView
@param aFrame
@@ -123,8 +123,8 @@
}
#pragma mark -
#pragma mark Theme methods
// MARK: -
// MARK: Theme methods
/*! Set a theme
*/
@@ -143,8 +143,8 @@
}
#pragma mark -
#pragma mark Getter methods
// MARK: -
// MARK: Getter methods
/*! Select the tile
*/
@@ -205,8 +205,8 @@
}
#pragma mark -
#pragma mark Layout methods
// MARK: -
// MARK: Layout methods
/*! Layout the subviews
*/
@@ -481,8 +481,8 @@ CPAMPMDateType = 6;
}
#pragma mark -
#pragma mark Mouse event
// MARK: -
// MARK: Mouse event
/*! Mouse down event. Launch a notification to notif the new first responder textField
*/
@@ -496,8 +496,8 @@ CPAMPMDateType = 6;
}
#pragma mark -
#pragma mark Theme functions
// MARK: -
// MARK: Theme functions
/*! Set the theme CPThemeStateSelected
*/
@@ -517,8 +517,8 @@ CPAMPMDateType = 6;
}
#pragma mark -
#pragma mark Override
// MARK: -
// MARK: Override
/*!
We override this method to get all the time the good width
@@ -584,7 +584,7 @@ CPAMPMDateType = 6;
@end
#pragma mark -
// MARK: -
@implementation _CPDatePickerElementSeparator : CPTextField
+15 -15
View File
@@ -50,7 +50,7 @@
}
#pragma mark Init
// MARK: Init
- (id)initWithFrame:(CGRect)aFrame withDatePicker:(CPDatePicker)aDatePicker
{
@@ -141,8 +141,8 @@
}
#pragma mark -
#pragma mark Responder methods
// MARK: -
// MARK: Responder methods
/*! @ignore */
- (BOOL)acceptsFirstResponder
@@ -154,8 +154,8 @@
}
#pragma mark -
#pragma mark Override observers
// MARK: -
// MARK: Override observers
- (void)_removeObservers
{
@@ -177,8 +177,8 @@
[[CPNotificationCenter defaultCenter] addObserver:self selector:@selector(_datePickerElementTextFieldAMPMChangedNotification:) name:CPDatePickerElementTextFieldAMPMChangedNotification object:_textFieldPMAM];
}
#pragma mark -
#pragma mark Mouse event
// MARK: -
// MARK: Mouse event
- (BOOL)continueTracking:(CGPoint)lastPoint at:(CGPoint)aPoint
{
@@ -229,8 +229,8 @@
return nil;
}
#pragma mark -
#pragma mark Setter Getter methods
// MARK: -
// MARK: Setter Getter methods
/*! Set the value of the textFields
@param aDateValue the value
@@ -378,8 +378,8 @@
}
#pragma mark -
#pragma mark Notification methods
// MARK: -
// MARK: Notification methods
/*! Called when changing AM or PM
@param aNotification
@@ -413,8 +413,8 @@
}
#pragma mark -
#pragma mark Layout methods
// MARK: -
// MARK: Layout methods
- (CGRect)rectForEphemeralSubviewNamed:(CPString)aName
{
@@ -886,8 +886,8 @@
}
#pragma mark -
#pragma mark Responder methods
// MARK: -
// MARK: Responder methods
- (void)_updateResponderTextField
{
@@ -50,7 +50,7 @@ var CPShortWeekDayNameArrayEn = [@"Mo", @"Tu", @"We", @"Th", @"Fr", @"Sa", @"Su"
}
#pragma mark Init methods
// MARK: Init methods
/*! Init a new instance of _CPDatePickerHeaderView
@param aFrame
@@ -153,8 +153,8 @@ var CPShortWeekDayNameArrayEn = [@"Mo", @"Tu", @"We", @"Th", @"Fr", @"Sa", @"Su"
}
#pragma mark -
#pragma mark Getter Setter methods
// MARK: -
// MARK: Getter Setter methods
/*! Return the day names depending on the CPLocale of the datePicker
@return an array
@@ -242,8 +242,8 @@ var CPShortWeekDayNameArrayEn = [@"Mo", @"Tu", @"We", @"Th", @"Fr", @"Sa", @"Su"
}
#pragma mark -
#pragma mark Layout methods
// MARK: -
// MARK: Layout methods
/*! Layout the subviews
*/
+15 -15
View File
@@ -46,7 +46,7 @@
}
#pragma mark Init methods
// MARK: Init methods
/*! Init a _CPDatePickerMonthView
@param aFrame
@@ -77,8 +77,8 @@
}
#pragma mark -
#pragma mark Getter Setter methods
// MARK: -
// MARK: Getter Setter methods
/*! Set the monthDate of the component
@param aDate
@@ -194,8 +194,8 @@
return tileIndex;
}
#pragma mark -
#pragma mark Reload data
// MARK: -
// MARK: Reload data
/*! Reload the data
*/
@@ -235,8 +235,8 @@
}
#pragma mark -
#pragma mark Select methods
// MARK: -
// MARK: Select methods
/*! Select one date or several date depending of the giving interval
@param aStartDate
@@ -297,8 +297,8 @@
}
}
#pragma mark -
#pragma mark Layout methods
// MARK: -
// MARK: Layout methods
/*! Tile the view
*/
@@ -438,8 +438,8 @@
}
#pragma mark -
#pragma mark Mouse event
// MARK: -
// MARK: Mouse event
/*! Mouse down event
*/
@@ -596,8 +596,8 @@
}
#pragma mark -
#pragma mark Timer
// MARK: -
// MARK: Timer
- (void)_timerNextMonthEvent:(CPEvent)anEvent
{
@@ -618,8 +618,8 @@
}
#pragma mark -
#pragma mark Date methods
// MARK: -
// MARK: Date methods
- (CPDate)_hoursMinutesSecondsFromDatePickerForDate:(CPDate)aDate
{
+15 -15
View File
@@ -62,7 +62,7 @@
}
#pragma mark Init
// MARK: Init
- (id)initWithFrame:(CGRect)aFrame withDatePicker:(CPDatePicker)aDatePicker
{
@@ -103,8 +103,8 @@
}
#pragma mark -
#pragma mark Override responder methods
// MARK: -
// MARK: Override responder methods
- (BOOL)becomeFirstResponder
{
@@ -138,8 +138,8 @@
}
#pragma mark -
#pragma mark Setter Getter methods
// MARK: -
// MARK: Setter Getter methods
/*! Set the value of the control
@param aDateValue
@@ -188,8 +188,8 @@
[self setNeedsLayout];
}
#pragma mark -
#pragma mark Notification methods
// MARK: -
// MARK: Notification methods
/*! This is called to when the user just changed the selected textField
@param aNotification
@@ -207,8 +207,8 @@
}
#pragma mark -
#pragma mark SelectTextField action
// MARK: -
// MARK: SelectTextField action
- (void)_selectTextFieldWithFlags:(unsigned)flags
{
@@ -273,8 +273,8 @@
}
#pragma mark -
#pragma mark Events
// MARK: -
// MARK: Events
/*! Called when the user click on the stepper
*/
@@ -557,8 +557,8 @@
}
#pragma mark -
#pragma mark Layout methods
// MARK: -
// MARK: Layout methods
/*! Layout the subviews
*/
@@ -607,8 +607,8 @@
}
#pragma mark -
#pragma mark Override observers
// MARK: -
// MARK: Override observers
- (void)_removeObservers
{
+8 -8
View File
@@ -517,8 +517,8 @@ function CPAppKitImage(aFilename, aSize)
@end
#pragma mark -
#pragma mark CSS Theming
// MARK: -
// MARK: CSS Theming
// The code below adds support for CSS theming with 100% compatibility with current theming system.
// The idea is to extend CPImage (and CPColor) with CSS components and adapt low level UI components to
@@ -738,7 +738,7 @@ var CPImageCSSDictionaryKey = @"CPImageCSSDictionaryKey",
CPImageCSSBeforeDictionaryKey = @"CPImageCSSBeforeDictionaryKey",
CPImageCSSAfterDictionaryKey = @"CPImageCSSAfterDictionaryKey";
#pragma mark -
// MARK: -
@implementation CPImage (CPCoding)
@@ -775,8 +775,8 @@ var CPImageCSSDictionaryKey = @"CPImageCSSDictionaryKey",
@end
#pragma mark -
#pragma mark Drawing
// MARK: -
// MARK: Drawing
@implementation CPImage (Drawing)
@@ -813,7 +813,7 @@ var CPImageCSSDictionaryKey = @"CPImageCSSDictionaryKey",
@end
#pragma mark -
// MARK: -
@implementation _CPMaterialIconImage : CPImage
{
@@ -973,7 +973,7 @@ var CPImageCSSDictionaryKey = @"CPImageCSSDictionaryKey",
@end
#pragma mark -
// MARK: -
@implementation CPThreePartImage : CPObject
{
@@ -1116,7 +1116,7 @@ var CPNinePartImageImageSlicesKey = @"CPNinePartImageImageSlicesKey";
@end
#pragma mark -
// MARK: -
@implementation CPImage (Duplication)
+1 -1
View File
@@ -1400,7 +1400,7 @@ var CPMenuTitleKey = @"CPMenuTitleKey",
@end
#pragma mark -
// MARK: -
@implementation CPMenu (CSSTheming)
+3 -3
View File
@@ -465,7 +465,7 @@ _CPMenuWindowAttachedMenuBackgroundStyle = 2;
@end
#pragma mark -
// MARK: -
@implementation _CPMenuWindow (CSSTheming)
@@ -478,7 +478,7 @@ _CPMenuWindowAttachedMenuBackgroundStyle = 2;
@end
#pragma mark -
// MARK: -
/*
@ignore
@@ -664,7 +664,7 @@ _CPMenuWindowAttachedMenuBackgroundStyle = 2;
@end
#pragma mark -
// MARK: -
@implementation _CPMenuView (CSSTheming)
+4 -4
View File
@@ -826,7 +826,7 @@ CPControlKeyMask
return [[self menu] highlightedItem] == self;
}
#pragma mark CPObject Overrides
// MARK: CPObject Overrides
/*!
Returns a copy of the item. The copy does not belong If the item has a submenu, it is NOT copied.
@@ -867,7 +867,7 @@ CPControlKeyMask
return [self copy];
}
#pragma mark Internal
// MARK: Internal
/*
@ignore
@@ -897,7 +897,7 @@ CPControlKeyMask
@end
#pragma mark -
// MARK: -
@implementation CPMenuItem (CSSTheming)
@@ -909,7 +909,7 @@ CPControlKeyMask
@end
#pragma mark -
// MARK: -
var CPMenuItemIsSeparatorKey = @"CPMenuItemIsSeparatorKey",
+3 -3
View File
@@ -436,11 +436,11 @@
@end
#pragma mark -
// MARK: -
@implementation _CPMenuItemStandardView (CSSTheming)
#pragma mark Override
// MARK: Override
- (void)_setThemeIncludingDescendants:(CPTheme)aTheme
{
@@ -450,7 +450,7 @@
@end
#pragma mark -
// MARK: -
@implementation _CPMenuItemSubmenuIndicatorView : CPView
{
+3 -3
View File
@@ -274,11 +274,11 @@
@end
#pragma mark -
// MARK: -
@implementation _CPMenuItemView (CSSTheming)
#pragma mark Override
// MARK: Override
- (void)_setThemeIncludingDescendants:(CPTheme)aTheme
{
@@ -297,7 +297,7 @@
@end
#pragma mark -
// MARK: -
@implementation _CPMenuItemArrowView : CPView
{
+2 -2
View File
@@ -121,8 +121,8 @@ CPDocModalWindowMask = 1 << 6;
}
#pragma mark -
#pragma mark Overrides
// MARK: -
// MARK: Overrides
/*!
@ignore
+10 -10
View File
@@ -84,8 +84,8 @@ var CPPopoverDelegate_popover_willShow_ = 1 << 0,
}
#pragma mark -
#pragma mark Initialization
// MARK: -
// MARK: Initialization
/*!
Initialize the CPPopover witn default values
@@ -105,8 +105,8 @@ var CPPopoverDelegate_popover_willShow_ = 1 << 0,
}
#pragma mark -
#pragma mark Getters / Setters
// MARK: -
// MARK: Getters / Setters
/*!
Returns the current rect of the popover
@@ -220,8 +220,8 @@ Set the behavior of the CPPopover. It can be:
_implementedDelegateMethods |= CPPopoverDelegate_popover_didClose_;
}
#pragma mark -
#pragma mark Positioning
// MARK: -
// MARK: Positioning
/*!
Show the popover
@@ -298,8 +298,8 @@ Set the behavior of the CPPopover. It can be:
}
#pragma mark -
#pragma mark Action
// MARK: -
// MARK: Action
/*!
Close the popover
@@ -318,8 +318,8 @@ Set the behavior of the CPPopover. It can be:
}
#pragma mark -
#pragma mark Delegates
// MARK: -
// MARK: Delegates
/*! @ignore */
- (BOOL)_popoverWindowShouldClose
+4 -4
View File
@@ -187,7 +187,7 @@ CPRadioImageOffset = 4.0;
[self _setRadioGroup];
}
#pragma mark Private methods
// MARK: Private methods
- (void)_setRadioGroup
{
@@ -260,8 +260,8 @@ var CPRadioRadioGroupKey = @"CPRadioRadioGroupKey";
[aCoder encodeObject:_radioGroup forKey:CPRadioRadioGroupKey];
}
#pragma mark -
#pragma mark Override methods from CPButton
// MARK: -
// MARK: Override methods from CPButton
- (CPThemeState)_contentVisualState
{
@@ -412,7 +412,7 @@ var CPRadioRadioGroupKey = @"CPRadioRadioGroupKey";
[_radios makeObjectsPerformSelector:@selector(setHidden:) withObject:hidden];
}
#pragma mark Private
// MARK: Private
- (void)_addRadio:(CPRadio)aRadio
{
+5 -5
View File
@@ -34,7 +34,7 @@
SEL _predicateAction @accessors(property=action);
}
#pragma mark public methods
// MARK: public methods
/*!
@ingroup appkit
@class CPPredicateEditor
@@ -251,7 +251,7 @@
return tree;
}
#pragma mark Set the Predicate
// MARK: Set the Predicate
- (void)setObjectValue:(id)objectValue
{
@@ -374,7 +374,7 @@
return row;
}
#pragma mark Get the predicate
// MARK: Get the predicate
- (void)_updatePredicate
{
@@ -452,7 +452,7 @@
return CPAndPredicateType;
}
#pragma mark Control delegate
// MARK: Control delegate
- (void)_sendRuleAction
{
@@ -487,7 +487,7 @@
}
*/
#pragma mark RuleEditor delegate methods
// MARK: RuleEditor delegate methods
- (int)_queryNumberOfChildrenOfItem:(id)rowItem withRowType:(CPRuleEditorRowType)type
{
+26 -17
View File
@@ -1304,7 +1304,7 @@ TODO: implement
return shouldHide;
}
#pragma mark Rows management
// MARK: Rows management
- (id)_rowCacheForIndex:(int)index
{
@@ -1566,7 +1566,7 @@ TODO: implement
return row;
}
#pragma mark Key value observing
// MARK: Key value observing
- (void)_startObservingRowObjectsRecursively:(CPArray)rowObjects
{
@@ -2354,33 +2354,41 @@ TODO: implement
- (BOOL)performDragOperation:(id /*< CPDraggingInfo >*/)info
{
var aboveInsertIndexCount = 0,
object,
removeIndex;
var object;
var rowObjects = [_rowCache valueForKey:@"rowObject"],
index = [_draggingRows lastIndex];
var parentRowIndex = [self parentRowForRow:index], // first index of draggingrows
var firstDraggingIndex = [_draggingRows firstIndex],
parentRowIndex = [self parentRowForRow:firstDraggingIndex],
parentRowObject = (parentRowIndex === -1) ? _boundArrayOwner : [[self _rowCacheForIndex:parentRowIndex] rowObject],
insertIndex = _subviewIndexOfDropLine;
while (index !== CPNotFound)
{
if (index >= insertIndex)
// Identify if this row's parent is also inside the dragging set.
// If it is, we skip it because it will move automatically with its parent.
var parentOfCurrent = [self parentRowForRow:index];
if (parentOfCurrent !== -1 && [_draggingRows containsIndex:parentOfCurrent])
{
removeIndex = index + aboveInsertIndexCount;
aboveInsertIndexCount += 1;
}
else
{
removeIndex = index;
insertIndex -= 1;
index = [_draggingRows indexLessThanIndex:index];
continue;
}
object = [rowObjects objectAtIndex:removeIndex];
[self removeRowAtIndex:removeIndex];
[[self _subrowObjectsOfObject:parentRowObject] insertObject:object atIndex:insertIndex - parentRowIndex - 1];
object = [rowObjects objectAtIndex:index];
// Find the current live index of the object inside the editor
var cache = [self _searchCacheForRowObject:object];
var liveIndex = [_rowCache indexOfObjectIdenticalTo:cache];
if (liveIndex !== CPNotFound)
{
if (liveIndex < insertIndex)
insertIndex -= 1;
[self removeRowAtIndex:liveIndex];
[[self _subrowObjectsOfObject:parentRowObject] insertObject:object atIndex:insertIndex - parentRowIndex - 1];
}
index = [_draggingRows indexLessThanIndex:index];
}
@@ -2390,6 +2398,7 @@ TODO: implement
return YES;
}
- (CPIndexSet)_draggingTypes
{
return [CPIndexSet indexSetWithIndex:CPDragOperationMove];
+1 -1
View File
@@ -97,7 +97,7 @@ var LocalizerStringsRegex = new RegExp("\"(.+)\"\\s*=\\s*\"(.+)\"\\s*;\\s*(//.+)
return aString;
}
#pragma mark - Formatting & Reordering Helpers
// MARK: - Formatting & Reordering Helpers
- (CPString)_englishRepresentationForView:(id)aView
{
+16 -16
View File
@@ -159,8 +159,8 @@ var _CPScrollViews;
}
#pragma mark -
#pragma mark Class methods
// MARK: -
// MARK: Class methods
+ (void)initialize
{
@@ -320,8 +320,8 @@ var _CPScrollViews;
}
#pragma mark -
#pragma mark Initialization
// MARK: -
// MARK: Initialization
- (id)initWithFrame:(CGRect)aFrame
{
@@ -366,8 +366,8 @@ var _CPScrollViews;
}
#pragma mark -
#pragma mark Getters / Setters
// MARK: -
// MARK: Getters / Setters
/*!
The delegate of the scroll view
@@ -845,8 +845,8 @@ Notifies the delegate when the scroll view has finished scrolling.
}
#pragma mark -
#pragma mark Rulers
// MARK: -
// MARK: Rulers
- (BOOL)hasHorizontalRuler
{
@@ -942,8 +942,8 @@ Notifies the delegate when the scroll view has finished scrolling.
}
#pragma mark -
#pragma mark Privates
// MARK: -
// MARK: Privates
/* @ignore */
- (void)_updateScrollerStyle
@@ -1263,8 +1263,8 @@ Notifies the delegate when the scroll view has finished scrolling.
#pragma mark -
#pragma mark Utilities
// MARK: -
// MARK: Utilities
/*!
Lays out the scroll view's components.
@@ -1530,8 +1530,8 @@ Notifies the delegate when the scroll view has finished scrolling.
return [_contentView documentVisibleRect];
}
#pragma mark -
#pragma mark Overrides
// MARK: -
// MARK: Overrides
- (void)_removeObservers
{
@@ -1765,7 +1765,7 @@ Notifies the delegate when the scroll view has finished scrolling.
@end
#pragma mark -
// MARK: -
@implementation CPScrollView (CSSTheming)
@@ -1840,7 +1840,7 @@ Notifies the delegate when the scroll view has finished scrolling.
@end
#pragma mark -
// MARK: -
var CPScrollViewContentViewKey = @"CPScrollViewContentView",
CPScrollViewHeaderClipViewKey = @"CPScrollViewHeaderClipViewKey",
+16 -16
View File
@@ -102,8 +102,8 @@ CPThemeStateScrollerKnobDark = CPThemeState("scroller-knob-dark");
}
#pragma mark -
#pragma mark Class methods
// MARK: -
// MARK: Class methods
+ (CPString)defaultThemeClass
{
@@ -167,8 +167,8 @@ CPThemeStateScrollerKnobDark = CPThemeState("scroller-knob-dark");
}
#pragma mark -
#pragma mark Initialization
// MARK: -
// MARK: Initialization
- (id)initWithFrame:(CGRect)aFrame
{
@@ -203,8 +203,8 @@ CPThemeStateScrollerKnobDark = CPThemeState("scroller-knob-dark");
}
#pragma mark -
#pragma mark Getters / Setters
// MARK: -
// MARK: Getters / Setters
/*!
Returns the scroller's style
@@ -269,8 +269,8 @@ CPThemeStateScrollerKnobDark = CPThemeState("scroller-knob-dark");
}
#pragma mark -
#pragma mark Privates
// MARK: -
// MARK: Privates
/*! @ignore */
- (void)_adjustScrollerSize
@@ -295,8 +295,8 @@ CPThemeStateScrollerKnobDark = CPThemeState("scroller-knob-dark");
}
#pragma mark -
#pragma mark Utilities
// MARK: -
// MARK: Utilities
- (CGRect)rectForPart:(CPScrollerPart)aPart
{
@@ -486,8 +486,8 @@ CPThemeStateScrollerKnobDark = CPThemeState("scroller-knob-dark");
}
#pragma mark -
#pragma mark Drawing
// MARK: -
// MARK: Drawing
/*!
Draws the specified arrow and sets the highlight.
@@ -721,8 +721,8 @@ CPThemeStateScrollerKnobDark = CPThemeState("scroller-knob-dark");
}
#pragma mark -
#pragma mark Overrides
// MARK: -
// MARK: Overrides
- (id)currentValueForThemeAttribute:(CPString)anAttributeName
{
@@ -798,8 +798,8 @@ CPThemeStateScrollerKnobDark = CPThemeState("scroller-knob-dark");
return [self currentValueForThemeAttribute:@"scroller-width"];
}
#pragma mark -
#pragma mark Delegates
// MARK: -
// MARK: Delegates
- (void)animationDidEnd:(CPAnimation)animation
{
+5 -5
View File
@@ -143,8 +143,8 @@ var CPAutosavedRecentsChangedNotification = @"CPAutosavedRecentsChangedNotificat
}
#pragma mark -
#pragma mark Override observers
// MARK: -
// MARK: Override observers
- (void)_removeObservers
{
@@ -795,7 +795,7 @@ var CPAutosavedRecentsChangedNotification = @"CPAutosavedRecentsChangedNotificat
@end
#pragma mark -
// MARK: -
@implementation CPSearchField (ThemingAdditions)
@@ -987,7 +987,7 @@ var CPAutosavedRecentsChangedNotification = @"CPAutosavedRecentsChangedNotificat
@end
#pragma mark -
// MARK: -
@implementation CPSearchField (CPTrackingArea)
{
@@ -1042,7 +1042,7 @@ var CPAutosavedRecentsChangedNotification = @"CPAutosavedRecentsChangedNotificat
@end
#pragma mark -
// MARK: -
var CPRecentsAutosaveNameKey = @"CPRecentsAutosaveNameKey",
CPSendsWholeSearchStringKey = @"CPSendsWholeSearchStringKey",
+4 -4
View File
@@ -586,7 +586,7 @@ var AFFINITY = 5;
return [self setFloatValue:1.0];
}
#pragma mark - New methods as in High Sierra (10.13)
// MARK: - New methods as in High Sierra (10.13)
/*!
Creates and returns a continuous horizontal slider whose values range from 0.0 to 1.0.
@@ -812,7 +812,7 @@ var AFFINITY = 5;
return [self valueForThemeAttribute:@"left-track-color" inStates:normalState];
}
#pragma mark - Private methods
// MARK: - Private methods
- (void)_refreshCachesAndStates
{
@@ -1050,7 +1050,7 @@ var AFFINITY = 5;
return value;
}
#pragma mark - Overrides
// MARK: - Overrides
- (void)setFrameSize:(CGSize)aSize
{
@@ -1060,7 +1060,7 @@ var AFFINITY = 5;
[self setNeedsDisplay:YES];
}
#pragma mark -
// MARK: -
@end
+11 -11
View File
@@ -66,8 +66,8 @@ CPSoundPlayBackStatePause = 2;
unsigned _implementedDelegateMethods;
}
#pragma mark -
#pragma mark Initialization
// MARK: -
// MARK: Initialization
- (id)init
{
@@ -147,8 +147,8 @@ CPSoundPlayBackStatePause = 2;
}
#pragma mark -
#pragma mark Delegate methods
// MARK: -
// MARK: Delegate methods
/*!
Sets the sound's delegate.
@@ -166,8 +166,8 @@ CPSoundPlayBackStatePause = 2;
_implementedDelegateMethods |= CPSoundDelegate_sound_didFinishPlaying_;
}
#pragma mark -
#pragma mark Events listener
// MARK: -
// MARK: Events listener
/*! @ignore
*/
@@ -199,8 +199,8 @@ CPSoundPlayBackStatePause = 2;
}
#pragma mark -
#pragma mark Media controls
// MARK: -
// MARK: Media controls
/*!
Play the sound.
@@ -324,8 +324,8 @@ CPSoundPlayBackStatePause = 2;
_audioTag.volume = aVolume;
}
#pragma mark -
#pragma mark Accessors
// MARK: -
// MARK: Accessors
/*!
Returns the duration in seconds of the sound.
@@ -364,4 +364,4 @@ CPSoundPlayBackStatePause = 2;
[_delegate sound:self didFinishPlaying:finishedPlaying];
}
@end
@end
+9 -9
View File
@@ -216,7 +216,7 @@ var CPThemeStatesForSplitViewDivider = @[@"dummy one as CPSplitViewDividerStyle
[self _setVertical:YES];
}
#pragma mark - Properties
// MARK: - Properties
- (CPSplitViewDividerStyle)dividerStyle
{
@@ -479,7 +479,7 @@ var CPThemeStatesForSplitViewDivider = @[@"dummy one as CPSplitViewDividerStyle
return _delegate;
}
#pragma mark - Subviews management
// MARK: - Subviews management
// FIXME: il faut également tenir compte des button bars quand on ajouter / insert une vue.
// Par exemple, si une button bar est placée sur la dernière vue, pas de resize à droite mais
@@ -652,7 +652,7 @@ var CPThemeStatesForSplitViewDivider = @[@"dummy one as CPSplitViewDividerStyle
_subviewsManagementDisabled = NO;
}
#pragma mark - Layout subviews
// MARK: - Layout subviews
- (CGRect)rectOfDividerAtIndex:(int)aDivider
{
@@ -851,7 +851,7 @@ var CPThemeStatesForSplitViewDivider = @[@"dummy one as CPSplitViewDividerStyle
[self updateTrackingAreas];
}
#pragma mark - Private layout utilities
// MARK: - Private layout utilities
- (void)_distribute:(CPInteger)remainingSpace amoung:(CPInteger)count onFlexible:(BOOL)onFlexible fromIndex:(CPInteger)fromIndex toIndex:(CPInteger)toIndex
{
@@ -906,7 +906,7 @@ var CPThemeStatesForSplitViewDivider = @[@"dummy one as CPSplitViewDividerStyle
[_ratios addObject:(_initialSizes[i] / fixedSpace)];
}
#pragma mark -
// MARK: -
/*!
Returns YES if the supplied subview is collapsed, otherwise NO.
@@ -1493,7 +1493,7 @@ var CPThemeStatesForSplitViewDivider = @[@"dummy one as CPSplitViewDividerStyle
@end
#pragma mark -
// MARK: -
@implementation CPSplitView (CPTrackingArea)
{
@@ -1573,7 +1573,7 @@ var CPThemeStatesForSplitViewDivider = @[@"dummy one as CPSplitViewDividerStyle
@end
#pragma mark -
// MARK: -
@implementation CPSplitView (CPSplitViewDelegate)
@@ -1751,7 +1751,7 @@ var CPThemeStatesForSplitViewDivider = @[@"dummy one as CPSplitViewDividerStyle
@end
#pragma mark -
// MARK: -
var CPSplitViewDelegateKey = @"CPSplitViewDelegateKey",
CPSplitViewIsVerticalKey = @"CPSplitViewIsVerticalKey",
@@ -1876,7 +1876,7 @@ var CPSplitViewDelegateKey = @"CPSplitViewDelegateKey",
@end
#pragma mark -
// MARK: -
@implementation CPSplitView (Deprecated)
+14 -14
View File
@@ -82,8 +82,8 @@ var CPStackViewSpacingUseDefault = 3.40282347e+38; // FLT_MAX
CPMapTable _visibilityPriorities;
}
#pragma mark -
#pragma mark Initialization
// MARK: -
// MARK: Initialization
+ (CPStackView)stackViewWithViews:(CPArray)views
{
@@ -116,8 +116,8 @@ var CPStackViewSpacingUseDefault = 3.40282347e+38; // FLT_MAX
return self;
}
#pragma mark -
#pragma mark Configuration
// MARK: -
// MARK: Configuration
/*!
The horizontal or vertical layout direction of the stack view.
@@ -222,8 +222,8 @@ var CPStackViewSpacingUseDefault = 3.40282347e+38; // FLT_MAX
[self setNeedsLayout:YES];
}
#pragma mark -
#pragma mark Managing Views in Gravity Areas
// MARK: -
// MARK: Managing Views in Gravity Areas
- (CPArray)_containerForGravity:(CPStackViewGravity)gravity
{
@@ -358,8 +358,8 @@ var CPStackViewSpacingUseDefault = 3.40282347e+38; // FLT_MAX
[self removeView:view];
}
#pragma mark -
#pragma mark Custom Spacing
// MARK: -
// MARK: Custom Spacing
- (float)customSpacingAfterView:(CPView)aView
{
@@ -388,8 +388,8 @@ var CPStackViewSpacingUseDefault = 3.40282347e+38; // FLT_MAX
return _spacing;
}
#pragma mark -
#pragma mark Visibility Priority
// MARK: -
// MARK: Visibility Priority
- (void)setVisibilityPriority:(float)priority forView:(CPView)aView
{
@@ -418,8 +418,8 @@ var CPStackViewSpacingUseDefault = 3.40282347e+38; // FLT_MAX
return CPStackViewVisibilityPriorityMustHold;
}
#pragma mark -
#pragma mark Layout
// MARK: -
// MARK: Layout
- (void)resizeSubviewsWithOldSize:(CGSize)oldSize
{
@@ -649,8 +649,8 @@ var CPStackViewSpacingUseDefault = 3.40282347e+38; // FLT_MAX
return cursor;
}
#pragma mark -
#pragma mark CPCoding
// MARK: -
// MARK: CPCoding
- (id)initWithCoder:(CPCoder)aCoder
{
+8 -8
View File
@@ -42,8 +42,8 @@
CPButton _buttonUp;
}
#pragma mark -
#pragma mark Initialization
// MARK: -
// MARK: Initialization
/*!
Initializes a CPStepper with given values.
@@ -147,8 +147,8 @@
[self _sizeToFit];
}
#pragma mark -
#pragma mark Superclass overrides
// MARK: -
// MARK: Superclass overrides
/*!
Set if the CPStepper is enabled or not.
@@ -290,8 +290,8 @@
[super setDoubleValue:aValue];
}
#pragma mark -
#pragma mark Actions
// MARK: -
// MARK: Actions
/*! @ignore */
- (IBAction)_buttonDidClick:(id)aSender
@@ -326,8 +326,8 @@
}
#pragma mark -
#pragma mark Theming
// MARK: -
// MARK: Theming
+ (CPString)defaultThemeClass
{
+7 -7
View File
@@ -696,8 +696,8 @@ var CPTabViewDidSelectTabViewItemSelector = 1 << 1,
[self _displayItemView:_placeholderView];
}
#pragma mark -
#pragma mark Override
// MARK: -
// MARK: Override
/*!
Enabled controls accept first mouse by default.
@@ -886,11 +886,11 @@ var CPTabViewItemsKey = "CPTabViewItemsKey",
@end
#pragma mark -
// MARK: -
@implementation CPTabView (CSSTheming)
#pragma mark Override
// MARK: Override
- (void)_setThemeIncludingDescendants:(CPTheme)aTheme
{
@@ -906,7 +906,7 @@ var CPTabViewItemsKey = "CPTabViewItemsKey",
@end
#pragma mark -
// MARK: -
@implementation _CPTabViewBox : CPBox
{
@@ -915,8 +915,8 @@ var CPTabViewItemsKey = "CPTabViewItemsKey",
}
#pragma mark -
#pragma mark Override
// MARK: -
// MARK: Override
- (id)initWithFrame:(CGRect)aFrame
{
+4 -4
View File
@@ -5811,8 +5811,8 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
}
#pragma mark -
#pragma mark DataSource methods to implement
// MARK: -
// MARK: DataSource methods to implement
/*!
@ignore
@@ -6080,8 +6080,8 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
}
#pragma mark -
#pragma mark Delegate methods to implement
// MARK: -
// MARK: Delegate methods to implement
/*!
@ignore
+10 -10
View File
@@ -245,8 +245,8 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
}
#pragma mark -
#pragma mark Control Size
// MARK: -
// MARK: Control Size
- (void)setControlSize:(CPControlSize)aControlSize
{
@@ -257,7 +257,7 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
}
#pragma mark -
// MARK: -
#if PLATFORM(DOM)
- (DOMElement)_inputElement
@@ -381,7 +381,7 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
return self;
}
#pragma mark Controlling Editability and Selectability
// MARK: Controlling Editability and Selectability
/*!
Sets whether or not the receiver text field can be edited. If NO, any
@@ -1848,7 +1848,7 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
[self _didEdit];
}
#pragma mark Setting the Delegate
// MARK: Setting the Delegate
- (void)setDelegate:(id <CPTextFieldDelegate>)aDelegate
{
@@ -2008,7 +2008,7 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
[self _setCSSStyleForInputElement];
}
#pragma mark Overrides
// MARK: Overrides
/*!
Sets the font of the receiver.
@@ -2061,7 +2061,7 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
}
}
#pragma mark Overrides
// MARK: Overrides
/*!
Sets the text color of the receiver.
@@ -2130,7 +2130,7 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
return YES;
}
#pragma mark Private
// MARK: Private
- (BOOL)_isWithinUsablePlatformRect
{
@@ -2429,7 +2429,7 @@ var CPTextFieldIsEditableKey = "CPTextFieldIsEditableKey",
@end
#pragma mark -
// MARK: -
@implementation CPTextField (TableDataView)
@@ -2446,7 +2446,7 @@ var CPTextFieldIsEditableKey = "CPTextFieldIsEditableKey",
@end
#pragma mark -
// MARK: -
@implementation CPTextField (Deprecated)
+4 -4
View File
@@ -86,8 +86,8 @@ var _availableTraits = [@"Normal", @"Italic", @"Bold", @"Bold Italic"],
int _fontChanges;
}
#pragma mark -
#pragma mark Class methods
// MARK: -
// MARK: Class methods
/*!
Check if the shared Font panel exists.
@@ -113,8 +113,8 @@ var _availableTraits = [@"Normal", @"Italic", @"Bold", @"Bold Italic"],
return NO;
}
#pragma mark -
#pragma mark Init methods
// MARK: -
// MARK: Init methods
/*! @ignore */
- (id)init
+6 -6
View File
@@ -76,8 +76,8 @@ _oncontextmenuhandler = function () { return false; };
}
#pragma mark -
#pragma mark Init methods
// MARK: -
// MARK: Init methods
- (id)init
{
@@ -103,8 +103,8 @@ _oncontextmenuhandler = function () { return false; };
}
#pragma mark -
#pragma mark Text containes method
// MARK: -
// MARK: Text containes method
- (void)insertTextContainer:(CPTextContainer)aContainer atIndex:(int)index
{
@@ -1132,8 +1132,8 @@ var _objectsInRange = function(aList, aRange)
CPMutableArray _runs;
}
#pragma mark -
#pragma mark Init methods
// MARK: -
// MARK: Init methods
- (id)createDOMElementWithText:(CPString)aString andFont:(CPFont)aFont andColor:(CPColor)aColor
{
+6 -6
View File
@@ -154,8 +154,8 @@ CPRulerOrientationVertical = 1
}
}
}
#pragma mark -
#pragma mark Context Menu Support
// MARK: -
// MARK: Context Menu Support
- (CPMenu)menuForEvent:(CPEvent)anEvent
{
@@ -385,8 +385,8 @@ CPRulerOrientationVertical = 1
}
#pragma mark -
#pragma mark Interaction Handlers
// MARK: -
// MARK: Interaction Handlers
- (void)mouseDown:(CPEvent)anEvent
{
@@ -500,8 +500,8 @@ CPRulerOrientationVertical = 1
}
#pragma mark -
#pragma mark DOM Layout Builder
// MARK: -
// MARK: DOM Layout Builder
- (void)updateRuler
{
+4 -4
View File
@@ -89,8 +89,8 @@ CPLineMovesUp = 4;
}
#pragma mark -
#pragma mark Init methods
// MARK: -
// MARK: Init methods
- (id)initWithContainerSize:(CGSize)aSize
{
@@ -118,8 +118,8 @@ CPLineMovesUp = 4;
[_layoutManager addTextContainer:self];
}
#pragma mark -
#pragma mark Setter methods
// MARK: -
// MARK: Setter methods
- (void)setContainerSize:(CGSize)someSize
{
+8 -8
View File
@@ -70,8 +70,8 @@ var CPTextStorageDelegate_textStorageWillProcessEditing_ = 1 << 1,
}
#pragma mark -
#pragma mark Init methods
// MARK: -
// MARK: Init methods
- (id)initWithString:(CPString)aString attributes:(CPDictionary)attributes
{
@@ -99,8 +99,8 @@ var CPTextStorageDelegate_textStorageWillProcessEditing_ = 1 << 1,
}
#pragma mark -
#pragma mark Delegate methods
// MARK: -
// MARK: Delegate methods
- (void)setDelegate:(id <CPTextStorageDelegate>)aDelegate
{
@@ -121,8 +121,8 @@ var CPTextStorageDelegate_textStorageWillProcessEditing_ = 1 << 1,
}
#pragma mark -
#pragma mark Layout manager methods
// MARK: -
// MARK: Layout manager methods
- (void)addLayoutManager:(CPLayoutManager)aManager
{
@@ -148,8 +148,8 @@ var CPTextStorageDelegate_textStorageWillProcessEditing_ = 1 << 1,
}
#pragma mark -
#pragma mark Editing methods
// MARK: -
// MARK: Editing methods
- (void)processEditing
{
+34 -34
View File
@@ -191,8 +191,8 @@ var kDelegateRespondsTo_textShouldBeginEditing
return editMenu;
}
#pragma mark -
#pragma mark Class methods
// MARK: -
// MARK: Class methods
/* <!> FIXME
just a testing characterSet
@@ -200,8 +200,8 @@ var kDelegateRespondsTo_textShouldBeginEditing
Need some CPLocale support and maybe even a FSM...
*/
#pragma mark -
#pragma mark Init methods
// MARK: -
// MARK: Init methods
- (id)initWithFrame:(CGRect)aFrame textContainer:(CPTextContainer)aContainer
{
@@ -444,8 +444,8 @@ var kDelegateRespondsTo_textShouldBeginEditing
[self _becomeFirstResponder];
}
#pragma mark -
#pragma mark Copy and paste methods
// MARK: -
// MARK: Copy and paste methods
- (void)copy:(id)sender
{
@@ -527,8 +527,8 @@ var kDelegateRespondsTo_textShouldBeginEditing
[self _pasteString:[self _stringForPasting]];
}
#pragma mark -
#pragma mark Responders method
// MARK: -
// MARK: Responders method
- (BOOL)acceptsFirstResponder
{
@@ -587,8 +587,8 @@ var kDelegateRespondsTo_textShouldBeginEditing
}
#pragma mark -
#pragma mark Delegate methods
// MARK: -
// MARK: Delegate methods
/*!
TODO : documentation
@@ -647,8 +647,8 @@ var kDelegateRespondsTo_textShouldBeginEditing
}
#pragma mark -
#pragma mark Key window methods
// MARK: -
// MARK: Key window methods
- (void)becomeKeyWindow
{
@@ -674,8 +674,8 @@ var kDelegateRespondsTo_textShouldBeginEditing
}
#pragma mark -
#pragma mark Undo redo methods
// MARK: -
// MARK: Undo redo methods
- (void)undo:(id)sender
{
@@ -690,8 +690,8 @@ var kDelegateRespondsTo_textShouldBeginEditing
}
#pragma mark -
#pragma mark Accessors
// MARK: -
// MARK: Accessors
- (CPString)stringValue
{
@@ -805,8 +805,8 @@ var kDelegateRespondsTo_textShouldBeginEditing
}
#pragma mark -
#pragma mark Insert characters methods
// MARK: -
// MARK: Insert characters methods
- (void)_fixupReplaceForRange:(CPRange)aRange
{
@@ -864,8 +864,8 @@ var kDelegateRespondsTo_textShouldBeginEditing
_stickyXLocation = MAX(0, _caret._rect.origin.x - 1);
}
#pragma mark -
#pragma mark Drawing methods
// MARK: -
// MARK: Drawing methods
- (void)drawInsertionPointInRect:(CGRect)aRect color:(CPColor)aColor turnedOn:(BOOL)flag
{
@@ -928,8 +928,8 @@ var kDelegateRespondsTo_textShouldBeginEditing
}
#pragma mark -
#pragma mark Select methods
// MARK: -
// MARK: Select methods
- (void)selectAll:(id)sender
{
@@ -1060,8 +1060,8 @@ Sets the selection to a range of characters in response to user action.
return [_selectionRange];
}
#pragma mark -
#pragma mark Keyboard events
// MARK: -
// MARK: Keyboard events
- (void)keyDown:(CPEvent)event
{
@@ -1129,8 +1129,8 @@ Sets the selection to a range of characters in response to user action.
[placeholderString addAttribute:_CPAttachmentInvisible value:YES range:rangeToHide];
}
#pragma mark -
#pragma mark Mouse Events
// MARK: -
// MARK: Mouse Events
- (void)mouseDown:(CPEvent)event
{
@@ -1852,8 +1852,8 @@ Sets the selection to a range of characters in response to user action.
}
#pragma mark -
#pragma mark Font methods
// MARK: -
// MARK: Font methods
- (CPFont)font
{
@@ -1943,8 +1943,8 @@ Sets the selection to a range of characters in response to user action.
}
#pragma mark -
#pragma mark Color methods
// MARK: -
// MARK: Color methods
- (void)changeColor:(id)sender
{
@@ -1979,8 +1979,8 @@ Sets the selection to a range of characters in response to user action.
[_layoutManager textStorage:_textStorage edited:0 range:CPMakeRangeCopy(range) changeInLength:0 invalidatedRange:CPMakeRangeCopy(range)];
}
#pragma mark -
#pragma mark Style & Alignment methods
// MARK: -
// MARK: Style & Alignment methods
- (void)bold:(id)sender
{
@@ -2388,8 +2388,8 @@ Sets the selection to a range of characters in response to user action.
[_caret setVisibility:YES];
}
#pragma mark -
#pragma mark Dragging operation
// MARK: -
// MARK: Dragging operation
- (void)performDragOperation:(CPDraggingInfo)aSender
{
+4 -4
View File
@@ -54,8 +54,8 @@ var CPSystemTypesetterFactory,
@implementation CPTypesetter : CPObject
#pragma mark -
#pragma mark Class methods
// MARK: -
// MARK: Class methods
+ (void)initialize
{
@@ -122,8 +122,8 @@ var CPSystemTypesetterFactory,
}
#pragma mark -
#pragma mark Class methods
// MARK: -
// MARK: Class methods
+ (id)sharedInstance
{
+4 -4
View File
@@ -70,8 +70,8 @@ function _points2twips(a) { return (a) * 20.0; }
CPColor ulColor;
}
#pragma mark -
#pragma mark Class methods
// MARK: -
// MARK: Class methods
+ (CPString)produceRTF:(CPAttributedString)aText documentAttributes:(CPDictionary)dict
@@ -82,8 +82,8 @@ function _points2twips(a) { return (a) * 20.0; }
}
#pragma mark -
#pragma mark init methods
// MARK: -
// MARK: init methods
- (id)init
{
+3 -3
View File
@@ -319,8 +319,8 @@ var CPThemeNameKey = @"CPThemeNameKey",
@end
#pragma mark -
#pragma mark CSS Theming
// MARK: -
// MARK: CSS Theming
// The code below adds support for CSS theming with 100% compatibility with current theming system.
// The idea is to extend CPColor and CPImage with CSS components and adapt low level UI components to
@@ -556,7 +556,7 @@ var _savedThemesByName = { };
@end
#pragma mark -
// MARK: -
/*!
* ThemeStates are immutable objects representing a particular ThemeState. Applications should never be creating
+2 -2
View File
@@ -169,8 +169,8 @@ CPTokenFieldDeleteButtonType = 1;
[self addSubview:_tokenScrollView];
}
#pragma mark -
#pragma mark Delegate methods
// MARK: -
// MARK: Delegate methods
/*!
Set the delegate of the receiver
+6 -6
View File
@@ -69,8 +69,8 @@ CPTrackingOwnerImplementsCursorUpdate = 1 << 4;
}
#pragma mark -
#pragma mark Initialization
// MARK: -
// MARK: Initialization
/*!
Initializes and returns an object defining a region of a view to receive mouse-tracking events, mouse-moved events, cursor-update events, or possibly
@@ -121,8 +121,8 @@ CPTrackingOwnerImplementsCursorUpdate = 1 << 4;
}
#pragma mark -
#pragma mark Implementation
// MARK: -
// MARK: Implementation
- (void)_updateWindowRect
{
@@ -140,8 +140,8 @@ CPTrackingOwnerImplementsCursorUpdate = 1 << 4;
@end
#pragma mark -
#pragma mark CPCoding
// MARK: -
// MARK: CPCoding
@implementation CPTrackingArea (CPCoding)
+3 -3
View File
@@ -3375,7 +3375,7 @@ setBoundsOrigin:
@implementation CPView (Theming)
#pragma mark Override
// MARK: Override
- (BOOL)setThemeState:(ThemeState)aState
{
@@ -3412,7 +3412,7 @@ setBoundsOrigin:
}
#pragma mark First responder
// MARK: First responder
- (BOOL)becomeFirstResponder
{
@@ -3474,7 +3474,7 @@ setBoundsOrigin:
[_subviews[count] _notifyWindowDidResignKey];
}
#pragma mark Theme Attributes
// MARK: Theme Attributes
- (void)_setThemeIncludingDescendants:(CPTheme)aTheme
{
+9 -9
View File
@@ -57,8 +57,8 @@ CPVisualEffectStateInactive = 2;
}
#pragma mark -
#pragma mark Initialization
// MARK: -
// MARK: Initialization
- (id)initWithFrame:(CGRect)aFrame
{
@@ -74,8 +74,8 @@ CPVisualEffectStateInactive = 2;
}
#pragma mark -
#pragma mark CPVisualEffectView API
// MARK: -
// MARK: CPVisualEffectView API
/*! Sets the appearance of the CPVisualEffectView.
@@ -114,8 +114,8 @@ CPVisualEffectStateInactive = 2;
}
#pragma mark -
#pragma mark Utilities
// MARK: -
// MARK: Utilities
- (void)_setEffectEnabled:(BOOL)shouldEnable
{
@@ -156,8 +156,8 @@ CPVisualEffectStateInactive = 2;
}
#pragma mark -
#pragma mark CPCoding
// MARK: -
// MARK: CPCoding
- (id)initWithCoder:(CPCoder)aCoder
{
@@ -183,4 +183,4 @@ CPVisualEffectStateInactive = 2;
}
@end
@end
+2 -2
View File
@@ -4462,7 +4462,7 @@ var interpolate = function(fromValue, toValue, progress)
@end
#pragma mark -
// MARK: -
@implementation CPWindow (CSSTheming)
@@ -4473,7 +4473,7 @@ var interpolate = function(fromValue, toValue, progress)
@end
#pragma mark -
// MARK: -
function _CPWindowFullPlatformWindowSessionMake(aWindowView, aContentRect, hasShadow, aLevel)
{
+5 -4
View File
@@ -29,8 +29,9 @@
unsigned _gravity @accessors(property=gravity);
}
#pragma mark -
#pragma mark Class methods
// MARK: -
// MARK: Class methods
+ (CPString)defaultThemeClass
{
@@ -84,8 +85,8 @@
return aFrameRect;
}
#pragma mark -
#pragma mark DOM/CSS Rendering
// MARK: -
// MARK: drawing
- (void)layoutSubviews
{
+5 -5
View File
@@ -66,8 +66,8 @@ var CPViewThemeClassKey = @"CPViewThemeClassKey",
}
#pragma mark -
#pragma mark Theme State
// MARK: -
// MARK: Theme State
- (unsigned)themeState
{
@@ -155,7 +155,7 @@ var CPViewThemeClassKey = @"CPViewThemeClassKey",
return [self unsetThemeState:aState];
}
#pragma mark Theme Attributes
// MARK: Theme Attributes
+ (CPString)defaultThemeClass
{
@@ -494,8 +494,8 @@ var NULL_THEME = {};
}
}
#pragma mark -
#pragma mark CSS styling additions
// MARK: -
// MARK: CSS styling additions
- (CPTheme)actualTheme
{
+7 -7
View File
@@ -210,7 +210,7 @@ var ListColumnIdentifier = @"1";
CPTableColumn _tableColumn;
}
#pragma mark Creating and Displaying a List
// MARK: Creating and Displaying a List
/*!
Creates a pop up list of choices that will display in a scrollable CPTableView.
@@ -386,7 +386,7 @@ var ListColumnIdentifier = @"1";
[self scrollItemAtIndexToTop:[_tableView selectedRow]];
}
#pragma mark Setting Display Attributes
// MARK: Setting Display Attributes
/*!
Returns the desired width of the list.
@@ -481,7 +481,7 @@ var ListColumnIdentifier = @"1";
return _panel;
}
#pragma mark Setting a Data Source
// MARK: Setting a Data Source
- (void)setDataSource:(_CPPopUpListDataSource)aDataSource
{
@@ -501,7 +501,7 @@ var ListColumnIdentifier = @"1";
return _dataSource;
}
#pragma mark Manipulating the Selection
// MARK: Manipulating the Selection
/*!
Select the next item in the list if there one. If there is currently no selected item,
@@ -589,7 +589,7 @@ var ListColumnIdentifier = @"1";
return NO;
}
#pragma mark Manipulating the Displayed List
// MARK: Manipulating the Displayed List
/*!
Scroll the list down one page.
@@ -670,7 +670,7 @@ var ListColumnIdentifier = @"1";
[[CPNotificationCenter defaultCenter] postNotificationName:_CPPopUpListItemWasClickedNotification object:self];
}
#pragma mark Handling Events
// MARK: Handling Events
/*!
Handles standard key equivalents for moving the selection
@@ -818,7 +818,7 @@ var ListColumnIdentifier = @"1";
return YES;
}
#pragma mark Internal Helpers
// MARK: Internal Helpers
/*! @ignore */
- (void)listWillPopUp
+16 -16
View File
@@ -74,8 +74,8 @@ var _CPPopoverWindow_shouldClose_ = 1 << 4,
}
#pragma mark -
#pragma mark Class methods
// MARK: -
// MARK: Class methods
/*!
Overrides the default windowView class loader.
@@ -89,8 +89,8 @@ var _CPPopoverWindow_shouldClose_ = 1 << 4,
}
#pragma mark -
#pragma mark Initialization
// MARK: -
// MARK: Initialization
/*!
Create and init a _CPPopoverWindow with given the given frame.
@@ -138,8 +138,8 @@ var _CPPopoverWindow_shouldClose_ = 1 << 4,
return self;
}
#pragma mark -
#pragma mark Getters / Setters
// MARK: -
// MARK: Getters / Setters
- (void)setAppearance:(int)anAppearance
{
@@ -177,8 +177,8 @@ var _CPPopoverWindow_shouldClose_ = 1 << 4,
_implementedDelegateMethods |= _CPPopoverWindow_didShow_;
}
#pragma mark -
#pragma mark Observer
// MARK: -
// MARK: Observer
/*!
@ignore
@@ -236,8 +236,8 @@ var _CPPopoverWindow_shouldClose_ = 1 << 4,
}
#pragma mark -
#pragma mark Utilities
// MARK: -
// MARK: Utilities
- (CGPoint)computeOriginFromRect:(CGRect)aRect ofView:(CPView)positioningView preferredEdge:(int)anEdge
{
@@ -447,8 +447,8 @@ var _CPPopoverWindow_shouldClose_ = 1 << 4,
}
}
#pragma mark -
#pragma mark Actions
// MARK: -
// MARK: Actions
/*!
@ignore
@@ -462,8 +462,8 @@ var _CPPopoverWindow_shouldClose_ = 1 << 4,
}
#pragma mark -
#pragma mark Overrides
// MARK: -
// MARK: Overrides
/*!
@ignore
@@ -697,8 +697,8 @@ var _CPPopoverWindow_shouldClose_ = 1 << 4,
}
#pragma mark -
#pragma mark Private
// MARK: -
// MARK: Private
- (CPString)_currentTransformMatrix
{
+6 -6
View File
@@ -45,8 +45,8 @@ var _CPToolTipHeight = 24.0,
}
#pragma mark -
#pragma mark Class Methods
// MARK: -
// MARK: Class Methods
/*! @ignore
Invalidate any scheduled tooltips, or hide any visible one
@@ -169,8 +169,8 @@ var _CPToolTipHeight = 24.0,
}
#pragma mark -
#pragma mark Initialization
// MARK: -
// MARK: Initialization
/*!
Returns an initialized _CPToolTip with string.
@@ -223,8 +223,8 @@ var _CPToolTipHeight = 24.0,
}
#pragma mark -
#pragma mark Controls
// MARK: -
// MARK: Controls
/*!
Show the tooltip after computing the position.
+3 -3
View File
@@ -239,8 +239,8 @@ var CPBundlesForURLStrings = { };
}
#pragma mark -
#pragma mark Localization
// MARK: -
// MARK: Localization
- (CPArray)localizations
{
@@ -267,4 +267,4 @@ function CPLocalizedStringFromTable(key, table, comment)
function CPCopyLocalizedStringFromTableInBundle(key, table, bundle, comment)
{
return CFCopyLocalizedStringFromTableInBundle(key, table, bundle._bundle, comment);
}
}
+8 -8
View File
@@ -74,8 +74,8 @@ var CPCacheDelegate_cache_willEvictObject_ = 1 << 1;
}
#pragma mark -
#pragma mark Initialization
// MARK: -
// MARK: Initialization
/*!
Initializes the cache with default values
@@ -100,8 +100,8 @@ var CPCacheDelegate_cache_willEvictObject_ = 1 << 1;
}
#pragma mark -
#pragma mark Managing cache
// MARK: -
// MARK: Managing cache
/*!
Returns the object which correspond to the given key
@@ -182,8 +182,8 @@ var CPCacheDelegate_cache_willEvictObject_ = 1 << 1;
}
#pragma mark -
#pragma mark Setters
// MARK: -
// MARK: Setters
/*!
Sets the count limit of the cache.
@@ -224,8 +224,8 @@ var CPCacheDelegate_cache_willEvictObject_ = 1 << 1;
}
#pragma mark -
#pragma mark Privates
// MARK: -
// MARK: Privates
/*
* This method return the number of objects in the cache
+10 -10
View File
@@ -231,8 +231,8 @@ var _separatorsCharacterSet = nil;
}
#pragma mark -
#pragma mark Setter Getter Helper
// MARK: -
// MARK: Setter Getter Helper
/*! Return symbols for the given language code
*/
@@ -280,8 +280,8 @@ var _separatorsCharacterSet = nil;
[languageSymbols setValue:aSymbol forKey:aKey];
}
#pragma mark -
#pragma mark Setter Getter
// MARK: -
// MARK: Setter Getter
/*! Return AMSymbol
*/
@@ -536,8 +536,8 @@ var _separatorsCharacterSet = nil;
}
#pragma mark -
#pragma mark StringFromDate methods
// MARK: -
// MARK: StringFromDate methods
/*! Return a string representation of a given date.
This method returns (if possible) a representation of the given date with the dateFormat of the CPDateFormatter, otherwise it takes the dateStyle and timeStyle
@@ -1160,8 +1160,8 @@ var _separatorsCharacterSet = nil;
}
#pragma mark -
#pragma mark datefromString
// MARK: -
// MARK: datefromString
/*! Return a date of the given string
This method returns (if possible) a representation of the given string with the dateFormat of the CPDateFormatter, otherwise it takes the dateStyle and timeStyle
@@ -1922,8 +1922,8 @@ var _separatorsCharacterSet = nil;
}
#pragma mark -
#pragma mark Utils
// MARK: -
// MARK: Utils
- (CPString)_stringValueForValue:(id)aValue length:(int)length
{
+1 -2
View File
@@ -20,11 +20,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@import "CPCoder.j"
@import "CPObject.j"
@import "CPString.j"
@class CPString
@class CPCoder
CPInvalidArgumentException = @"CPInvalidArgumentException";
CPUnsupportedMethodException = @"CPUnsupportedMethodException";
+6 -6
View File
@@ -70,8 +70,8 @@
return [super description] + " " + _indexes;
}
#pragma mark -
#pragma mark Accessing
// MARK: -
// MARK: Accessing
- (id)length
{
@@ -93,8 +93,8 @@
return [_indexes copy];
}
#pragma mark -
#pragma mark Modification
// MARK: -
// MARK: Modification
- (CPIndexPath)indexPathByAddingIndex:(int)index
{
@@ -106,8 +106,8 @@
return [CPIndexPath indexPathWithIndexes:_indexes length:[self length] - 1];
}
#pragma mark -
#pragma mark Comparison
// MARK: -
// MARK: Comparison
- (BOOL)isEqual:(id)anObject
{
-7
View File
@@ -176,13 +176,6 @@
return YES;
}
- (BOOL)isEqual:(id)anObject
{
return self === anObject ||
[anObject isKindOfClass:[self class]] &&
[self isEqualToIndexSet:anObject];
}
/*!
Returns \c YES if the index set contains the specified index.
@param anIndex the index to check for in the set
+1 -3
View File
@@ -20,6 +20,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@import "CPArray+KVO.j"
@import "CPArray.j"
@import "CPDictionary.j"
@import "CPException.j"
@@ -1566,6 +1567,3 @@ var _CPKVOInfoMake = function(anObserver, theOptions, aContext, aForwarder)
forwarder: aForwarder
};
};
@import "CPArray+KVO.j"
@import "CPSet+KVO.j"
+6 -6
View File
@@ -29,8 +29,8 @@
return self;
}
#pragma mark -
#pragma mark Accessing Content
// MARK: -
// MARK: Accessing Content
/*!
Returns the value associated with a given key.
@@ -70,8 +70,8 @@
return _map.size;
}
#pragma mark -
#pragma mark Manipulating Content
// MARK: -
// MARK: Manipulating Content
/*!
Adds a given key-value pair to the map table.
@@ -101,8 +101,8 @@
_map.clear();
}
#pragma mark -
#pragma mark Creating a Dictionary Representation
// MARK: -
// MARK: Creating a Dictionary Representation
/*!
Returns a dictionary representation of the map table.
+15 -15
View File
@@ -98,8 +98,8 @@ var runLoop = [CPRunLoop mainRunLoop];
}
#pragma mark -
#pragma mark Class methods
// MARK: -
// MARK: Class methods
/*!
Returns the application's notification queue. This notification queue uses the default notification center
@@ -113,8 +113,8 @@ var runLoop = [CPRunLoop mainRunLoop];
}
#pragma mark -
#pragma mark Init methods
// MARK: -
// MARK: Init methods
/*!
Initializes and returns a notification queue for the specified notification center.
@@ -135,8 +135,8 @@ var runLoop = [CPRunLoop mainRunLoop];
}
#pragma mark -
#pragma mark Enqueue methods
// MARK: -
// MARK: Enqueue methods
/*!
Adds a notification to the notification queue with a specified posting style.
@@ -185,8 +185,8 @@ var runLoop = [CPRunLoop mainRunLoop];
}
#pragma mark -
#pragma mark Dequeue methods
// MARK: -
// MARK: Dequeue methods
/*!
Removes all notifications from the queue that match a provided notification using provided matching criteria.
@@ -199,8 +199,8 @@ var runLoop = [CPRunLoop mainRunLoop];
}
#pragma mark -
#pragma mark RunLoop methods
// MARK: -
// MARK: RunLoop methods
/*!
@ignore
@@ -244,8 +244,8 @@ var runLoop = [CPRunLoop mainRunLoop];
}
#pragma mark -
#pragma mark Posting methods
// MARK: -
// MARK: Posting methods
/*!
@ignore
@@ -262,8 +262,8 @@ var runLoop = [CPRunLoop mainRunLoop];
}
#pragma mark -
#pragma mark Remove methods
// MARK: -
// MARK: Remove methods
/*!
@ignore
@@ -325,4 +325,4 @@ var runLoop = [CPRunLoop mainRunLoop];
[notifications removeObjectsInArray:notificationsToRemove];
}
@end
@end
+1 -1
View File
@@ -273,7 +273,7 @@ var NumberRegex = new RegExp('(-)?(\\d*)(\\.(\\d*))?');
SET_NEEDS_NUMBER_HANDLER_UPDATE();
}
#pragma mark Private
// MARK: Private
- (void)_updateNumberHandlerIfNecessary
{
-440
View File
@@ -1,440 +0,0 @@
/*
* CPSet+KVO.j
* Foundation
*
* Created by Daniel Stolzenberg.
* Copyright 2010, University of Rostock
*
* 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
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@import "CPException.j"
@import "CPObject.j"
@import "CPMutableSet.j"
@import "CPNull.j"
@import "_CPCollectionKVCOperators.j"
@implementation CPObject (CPSetKVO)
- (id)mutableSetValueForKey:(id)aKey
{
return [[_CPKVCSet alloc] initWithKey:aKey forProxyObject:self];
}
- (id)mutableSetValueForKeyPath:(id)aKeyPath
{
var dotIndex = aKeyPath.indexOf(".");
if (dotIndex < 0)
return [self mutableSetValueForKey:aKeyPath];
var firstPart = aKeyPath.substring(0, dotIndex),
lastPart = aKeyPath.substring(dotIndex + 1);
return [[self valueForKeyPath:firstPart] mutableSetValueForKeyPath:lastPart];
}
@end
@implementation _CPKVCSet : CPMutableSet
{
id _proxyObject;
id _key;
SEL _accessSEL;
Function _access;
SEL _setSEL;
Function _set;
SEL _countSEL;
Function _count;
SEL _enumeratorSEL;
Function _enumerator;
SEL _memberSEL;
Function _member;
SEL _addSEL;
Function _add;
SEL _addManySEL;
Function _addMany;
SEL _removeSEL;
Function _remove;
SEL _removeManySEL;
Function _removeMany;
SEL _intersectSEL;
Function _intersect;
}
+ (id)alloc
{
var set = [CPMutableSet set];
set.isa = self;
var ivars = class_copyIvarList(self),
count = ivars.length;
while (count--)
set[ivar_getName(ivars[count])] = nil;
return set;
}
- (id)initWithKey:(id)aKey forProxyObject:(id)anObject
{
self = [super init];
_key = aKey;
_proxyObject = anObject;
var capitalizedKey = _key.charAt(0).toUpperCase() + _key.substring(1);
_accessSEL = sel_getName(_key);
if ([_proxyObject respondsToSelector:_accessSEL])
_access = [_proxyObject methodForSelector:_accessSEL];
_setSEL = sel_getName(@"set"+capitalizedKey+":");
if ([_proxyObject respondsToSelector:_setSEL])
_set = [_proxyObject methodForSelector:_setSEL];
_countSEL = sel_getName(@"countOf"+capitalizedKey);
if ([_proxyObject respondsToSelector:_countSEL])
_count = [_proxyObject methodForSelector:_countSEL];
_enumeratorSEL = sel_getName(@"enumeratorOf"+capitalizedKey);
if ([_proxyObject respondsToSelector:_enumeratorSEL])
_enumerator = [_proxyObject methodForSelector:_enumeratorSEL];
_memberSEL = sel_getName(@"memberOf"+capitalizedKey+":");
if ([_proxyObject respondsToSelector:_memberSEL])
_member = [_proxyObject methodForSelector:_memberSEL];
_addSEL = sel_getName(@"add"+capitalizedKey+"Object:");
if ([_proxyObject respondsToSelector:_addSEL])
_add = [_proxyObject methodForSelector:_addSEL];
_addManySEL = sel_getName(@"add"+capitalizedKey+":");
if ([_proxyObject respondsToSelector:_addManySEL])
_addMany = [_proxyObject methodForSelector:_addManySEL];
_removeSEL = sel_getName(@"remove"+capitalizedKey+"Object:");
if ([_proxyObject respondsToSelector:_removeSEL])
_remove = [_proxyObject methodForSelector:_removeSEL];
_removeManySEL = sel_getName(@"remove"+capitalizedKey+":");
if ([_proxyObject respondsToSelector:_removeManySEL])
_removeMany = [_proxyObject methodForSelector:_removeManySEL];
_intersectSEL = sel_getName(@"intersect"+capitalizedKey+":");
if ([_proxyObject respondsToSelector:_intersectSEL])
_intersect = [_proxyObject methodForSelector:_intersectSEL];
return self;
}
- (id)_representedObject
{
if (_access)
return _access(_proxyObject, _accessSEL);
return [_proxyObject valueForKey:_key];
}
- (void)_setRepresentedObject:(id)anObject
{
if (_set)
return _set(_proxyObject, _setSEL, anObject);
[_proxyObject setValue:anObject forKey:_key];
}
- (CPUInteger)count
{
if (_count)
return _count(_proxyObject, _countSEL);
return [[self _representedObject] count];
}
- (CPEnumerator)objectEnumerator
{
if (_enumerator)
return _enumerator(_proxyObject, _enumeratorSEL);
return [[self _representedObject] objectEnumerator];
}
- (id)member:(id)anObject
{
if (_member)
return _member(_proxyObject, _memberSEL, anObject);
return [[self _representedObject] member:anObject];
}
- (void)addObject:(id)anObject
{
if (_add)
_add(_proxyObject, _addSEL, anObject);
else if (_addMany)
{
var objectSet = [CPSet setWithObject: anObject];
_addMany(_proxyObject, _addManySEL, objectSet);
}
else
{
var target = [[self _representedObject] copy];
[target addObject:anObject];
[self _setRepresentedObject:target];
}
}
- (void)addObjectsFromArray:(CPArray)objects
{
if (_addMany)
{
var objectSet = [CPSet setWithArray: objects];
_addMany(_proxyObject, _addManySEL, objectSet);
}
else if (_add)
{
var object,
objectEnumerator = [objects objectEnumerator];
while ((object = [objectEnumerator nextObject]) != nil)
_add(_proxyObject, _addSEL, object);
}
else
{
var target = [[self _representedObject] copy];
[target addObjectsFromArray:objects];
[self _setRepresentedObject:target];
}
}
- (void)unionSet:(CPSet)aSet
{
if (_addMany)
_addMany(_proxyObject, _addManySEL, aSet);
else if (_add)
{
var object,
objectEnumerator = [aSet objectEnumerator];
while ((object = [objectEnumerator nextObject]) != nil)
_add(_proxyObject, _addSEL, object);
}
else
{
var target = [[self _representedObject] copy];
[target unionSet:aSet];
[self _setRepresentedObject:target];
}
}
- (void)removeObject:(id)anObject
{
if (_remove)
_remove(_proxyObject, _removeSEL, anObject);
else if (_removeMany)
{
var objectSet = [CPSet setWithObject: anObject];
_removeMany(_proxyObject, _removeManySEL, objectSet);
}
else
{
var target = [[self _representedObject] copy];
[target removeObject:anObject];
[self _setRepresentedObject:target];
}
}
- (void)minusSet:(CPSet)aSet
{
if (_removeMany)
_removeMany(_proxyObject, _removeManySEL, aSet);
else if (_remove)
{
var object,
objectEnumerator = [aSet objectEnumerator];
while ((object = [objectEnumerator nextObject]) != nil)
_remove(_proxyObject, _removeSEL, object);
}
else
{
var target = [[self _representedObject] copy];
[target minusSet:aSet];
[self _setRepresentedObject:target];
}
}
- (void)removeObjectsInArray:(CPArray)objects
{
if (_removeMany)
{
var objectSet = [CPSet setWithArray:objects];
_removeMany(_proxyObject, _removeManySEL, objectSet);
}
else if (_remove)
{
var object,
objectEnumerator = [objects objectEnumerator];
while ((object = [objectEnumerator nextObject]) != nil)
_remove(_proxyObject, _removeSEL, object);
}
else
{
var target = [[self _representedObject] copy];
[target removeObjectsInArray:objects];
[self _setRepresentedObject:target];
}
}
- (void)removeAllObjects
{
if (_removeMany)
{
var allObjectsSet = [[self _representedObject] copy];
_removeMany(_proxyObject, _removeManySEL, allObjectsSet);
}
else if (_remove)
{
var object,
objectEnumerator = [[[self _representedObject] copy] objectEnumerator];
while ((object = [objectEnumerator nextObject]) != nil)
_remove(_proxyObject, _removeSEL, object);
}
else
{
var target = [[self _representedObject] copy];
[target removeAllObjects];
[self _setRepresentedObject:target];
}
}
- (void)intersectSet:(CPSet)aSet
{
if (_intersect)
_intersect(_proxyObject, _intersectSEL, aSet);
else
{
var target = [[self _representedObject] copy];
[target intersectSet:aSet];
[self _setRepresentedObject:target];
}
}
- (void)setSet:(CPSet)set
{
[self _setRepresentedObject: set];
}
- (CPArray)allObjects
{
return [[self _representedObject] allObjects];
}
- (id)anyObject
{
return [[self _representedObject] anyObject];
}
- (BOOL)containsObject:(id)anObject
{
return [[self _representedObject] containsObject: anObject];
}
- (BOOL)intersectsSet:(CPSet)aSet
{
return [[self _representedObject] intersectsSet: aSet];
}
- (BOOL)isEqualToSet:(CPSet)aSet
{
return [[self _representedObject] isEqualToSet: aSet];
}
- (id)copy
{
return [[self _representedObject] copy];
}
@end
@implementation CPSet (CPKeyValueCoding)
- (id)valueForKeyPath:(CPString)aKeyPath
{
if (!aKeyPath)
[self valueForUndefinedKey:@"<empty path>"];
if (aKeyPath.charAt(0) === "@")
{
var dotIndex = aKeyPath.indexOf("."),
operator,
parameter;
if (dotIndex !== -1)
{
operator = aKeyPath.substring(1, dotIndex);
parameter = aKeyPath.substring(dotIndex + 1);
}
else
operator = aKeyPath.substring(1);
return [_CPCollectionKVCOperator performOperation:operator withCollection:self propertyPath:parameter];
}
else
{
var valuesForKeySet = [CPSet set],
containedObject,
containedObjectValue,
containedObjectEnumerator = [self objectEnumerator];
while ((containedObject = [containedObjectEnumerator nextObject]) != nil)
{
containedObjectValue = [containedObject valueForKeyPath:aKeyPath];
if (containedObjectValue == nil)
containedObjectValue = [CPNull null];
[valuesForKeySet addObject:containedObjectValue];
}
return valuesForKeySet;
}
}
- (void)setValue:(id)aValue forKey:(CPString)aKey
{
var containedObject,
containedObjectEnumerator = [self objectEnumerator];
while ((containedObject = [containedObjectEnumerator nextObject]) != nil)
[containedObject setValue:aValue forKey:aKey];
}
@end
+595 -79
View File
@@ -1,149 +1,665 @@
/*!
@class CPMutableSet
@ingroup compatability
This class is just an empty subclass of CPSet.
CPSet already implements mutable methods and
this class only exists for source compatability.
*/
/*
* CPMutableSet.j
* Foundation
*
* Core mutable subclass interface and Key-Value Observing proxy implementations.
*/
@import "_CPSet.j"
/*!
@class CPMutableSet
@ingroup compatability
This class is just an empty subclass of CPSet.
CPSet already implements mutable methods and
this class only exists for source compatibility.
*/
@implementation CPMutableSet : CPSet
/*!
Returns an initialized set with a given initial capacity.
@param aCapacity, only present for compatability
*/
Returns an initialized set with a given initial capacity.
@param aCapacity, only present for compatibility
*/
- (id)initWithCapacity:(unsigned)aCapacity
{
return [self init];
return [self init];
}
/*!
Creates and returns a set with a given initial capacity.
@param aCapacity, only present for compatability
*/
Creates and returns a set with a given initial capacity.
@param aCapacity, only present for compatibility
*/
+ (id)setWithCapacity:(CPUInteger)aCapacity
{
return [[self alloc] initWithCapacity:aCapacity];
return [[self alloc] initWithCapacity:aCapacity];
}
/*!
Returns a set filtered using a given predicate.
@prarm aPredicate a CPPredicate object used to filter the objects in the set.
*/- (void)filterUsingPredicate:(CPPredicate)aPredicate
Returns a set filtered using a given predicate.
@prarm aPredicate a CPPredicate object used to filter the objects in the set.
*/
- (void)filterUsingPredicate:(CPPredicate)aPredicate
{
var object,
objectEnumerator = [self objectEnumerator];
var object,
objectEnumerator = [self objectEnumerator];
while ((object = [objectEnumerator nextObject]) != nil)
if (![aPredicate evaluateWithObject:object])
[self removeObject:object];
while ((object = [objectEnumerator nextObject]) != nil)
{
if (![aPredicate evaluateWithObject:object])
{
[self removeObject:object];
}
}
}
/*!
Removes an object from the set.
@param anObject the object to remove from the set. If the object is not in the set, the method will not modify the set.
*/
Removes an object from the set.
@param anObject the object to remove from the set. If the object is not in the set, the method will not modify the set.
*/
- (void)removeObject:(id)anObject
{
_CPRaiseInvalidAbstractInvocation(self, _cmd);
_CPRaiseInvalidAbstractInvocation(self, _cmd);
}
/*!
Removes an array of objects from the set.
@param anArray an array of object to remove from the set.
*/
Removes an array of objects from the set.
@param anArray an array of object to remove from the set.
*/
- (void)removeObjectsInArray:(CPArray)anArray
{
var index = 0,
count = [anArray count];
var index = 0,
count = [anArray count];
for (; index < count; ++index)
[self removeObject:[anArray objectAtIndex:index]];
for (; index < count; ++index)
{
[self removeObject:[anArray objectAtIndex:index]];
}
}
/*!
Removes all the objects from the set.
*/
Removes all the objects from the set.
*/
- (void)removeAllObjects
{
var object,
objectEnumerator = [self objectEnumerator];
var object,
objectEnumerator = [self objectEnumerator];
while ((object = [objectEnumerator nextObject]) != nil)
[self removeObject:object];
while ((object = [objectEnumerator nextObject]) != nil)
{
[self removeObject:object];
}
}
/*!
Adds to the receiver each object contained in a given array that is not already a member.
@param array An array of objects to add to the receiver.
*/
Adds to the receiver each object contained in a given array that is not already a member.
@param array An array of objects to add to the receiver.
*/
- (void)addObjectsFromArray:(CPArray)objects
{
var count = [objects count];
var count = [objects count];
while (count--)
[self addObject:objects[count]];
while (count--)
{
[self addObject:objects[count]];
}
}
/*!
Adds to the receiver each object contained in another given set
@param set The set of objects to add to the receiver.
*/
Adds to the receiver each object contained in another given set
@param set The set of objects to add to the receiver.
*/
- (void)unionSet:(CPSet)aSet
{
var object,
objectEnumerator = [aSet objectEnumerator];
var object,
objectEnumerator = [aSet objectEnumerator];
while ((object = [objectEnumerator nextObject]) != nil)
[self addObject:object];
while ((object = [objectEnumerator nextObject]) != nil)
{
[self addObject:object];
}
}
/*!
Removes from the receiver each object contained in another given set that is present in the receiver.
@param set The set of objects to remove from the receiver.
*/
Removes from the receiver each object contained in another given set that is present in the receiver.
@param set The set of objects to remove from the receiver.
*/
- (void)minusSet:(CPSet)aSet
{
var object,
objectEnumerator = [aSet objectEnumerator];
var object,
objectEnumerator = [aSet objectEnumerator];
while ((object = [objectEnumerator nextObject]) != nil)
[self removeObject:object];
while ((object = [objectEnumerator nextObject]) != nil)
{
[self removeObject:object];
}
}
/*!
Removes from the receiver each object that isn't a member of another given set.
@param set The set with which to perform the intersection.
*/
Removes from the receiver each object that isn't a member of another given set.
@param set The set with which to perform the intersection.
*/
- (void)intersectSet:(CPSet)aSet
{
var object,
objectEnumerator = [self objectEnumerator],
objectsToRemove = [];
var object,
objectEnumerator = [self objectEnumerator],
objectsToRemove = [];
while ((object = [objectEnumerator nextObject]) != nil)
if (![aSet containsObject:object])
objectsToRemove.push(object);
while ((object = [objectEnumerator nextObject]) != nil)
{
if (![aSet containsObject:object])
{
objectsToRemove.push(object);
}
}
var count = [objectsToRemove count];
var count = [objectsToRemove count];
while (count--)
[self removeObject:objectsToRemove[count]];
while (count--)
{
[self removeObject:objectsToRemove[count]];
}
}
/*!
Empties the receiver, then adds to the receiver each object contained in another given set.
@param set The set whose members replace the receiver's content.
*/
Empties the receiver, then adds to the receiver each object contained in another given set.
@param set The set whose members replace the receiver's content.
*/
- (void)setSet:(CPSet)aSet
{
[self removeAllObjects];
[self unionSet:aSet];
[self removeAllObjects];
[self unionSet:aSet];
}
@end
//@import "_CPConcreteMutableSet.j"
// MARK: -
// MARK: Category: CPKeyValueCoding
@implementation CPSet (CPKeyValueCoding)
- (id)valueForKeyPath:(CPString)aKeyPath
{
if (!aKeyPath)
{
[self valueForUndefinedKey:@"<empty path>"];
}
if (aKeyPath.charAt(0) === "@")
{
var dotIndex = aKeyPath.indexOf("."),
operator,
parameter;
if (dotIndex !== -1)
{
operator = aKeyPath.substring(1, dotIndex);
parameter = aKeyPath.substring(dotIndex + 1);
}
else
{
operator = aKeyPath.substring(1);
}
return [_CPCollectionKVCOperator performOperation:operator withCollection:self propertyPath:parameter];
}
else
{
var valuesForKeySet = [CPSet set],
containedObject,
containedObjectValue,
containedObjectEnumerator = [self objectEnumerator];
while ((containedObject = [containedObjectEnumerator nextObject]) != nil)
{
containedObjectValue = [containedObject valueForKeyPath:aKeyPath];
if (containedObjectValue == nil)
{
containedObjectValue = [CPNull null];
}
[valuesForKeySet addObject:containedObjectValue];
}
return valuesForKeySet;
}
}
- (id)valueForKey:(CPString)aKey
{
// If the key starts with @, it is an operator path.
// If not, it is a property path that we want applied to all members.
// In either case, valueForKeyPath: handles both scenarios correctly.
return [self valueForKeyPath:aKey];
}
- (void)setValue:(id)aValue forKey:(CPString)aKey
{
var containedObject,
containedObjectEnumerator = [self objectEnumerator];
while ((containedObject = [containedObjectEnumerator nextObject]) != nil)
{
[containedObject setValue:aValue forKey:aKey];
}
}
@end
// MARK: -
// MARK: Key-Value Observing Extensions
@implementation CPObject (CPSetKVO)
- (id)mutableSetValueForKey:(id)aKey
{
return [[_CPKVCSet alloc] initWithKey:aKey forProxyObject:self];
}
- (id)mutableSetValueForKeyPath:(id)aKeyPath
{
var dotIndex = aKeyPath.indexOf(".");
if (dotIndex < 0)
{
return [self mutableSetValueForKey:aKeyPath];
}
var firstPart = aKeyPath.substring(0, dotIndex),
lastPart = aKeyPath.substring(dotIndex + 1);
return [[self valueForKeyPath:firstPart] mutableSetValueForKeyPath:lastPart];
}
@end
// MARK: -
// MARK: Key-Value Observing Proxy Implementation
@implementation _CPKVCSet : CPMutableSet
{
id _proxyObject;
id _key;
SEL _accessSEL;
Function _access;
SEL _setSEL;
Function _set;
SEL _countSEL;
Function _count;
SEL _enumeratorSEL;
Function _enumerator;
SEL _memberSEL;
Function _member;
SEL _addSEL;
Function _add;
SEL _addManySEL;
Function _addMany;
SEL _removeSEL;
Function _remove;
SEL _removeManySEL;
Function _removeMany;
SEL _intersectSEL;
Function _intersect;
}
+ (id)alloc
{
var set = [CPMutableSet set];
set.isa = self;
var ivars = class_copyIvarList(self),
count = ivars.length;
while (count--)
{
set[ivar_getName(ivars[count])] = nil;
}
return set;
}
- (id)initWithKey:(id)aKey forProxyObject:(id)anObject
{
self = [super init];
_key = aKey;
_proxyObject = anObject;
var capitalizedKey = _key.charAt(0).toUpperCase() + _key.substring(1);
_accessSEL = sel_getName(_key);
if ([_proxyObject respondsToSelector:_accessSEL])
{
_access = [_proxyObject methodForSelector:_accessSEL];
}
_setSEL = sel_getName(@"set" + capitalizedKey + ":");
if ([_proxyObject respondsToSelector:_setSEL])
{
_set = [_proxyObject methodForSelector:_setSEL];
}
_countSEL = sel_getName(@"countOf" + capitalizedKey);
if ([_proxyObject respondsToSelector:_countSEL])
{
_count = [_proxyObject methodForSelector:_countSEL];
}
_enumeratorSEL = sel_getName(@"enumeratorOf" + capitalizedKey);
if ([_proxyObject respondsToSelector:_enumeratorSEL])
{
_enumerator = [_proxyObject methodForSelector:_enumeratorSEL];
}
_memberSEL = sel_getName(@"memberOf" + capitalizedKey + ":");
if ([_proxyObject respondsToSelector:_memberSEL])
{
_member = [_proxyObject methodForSelector:_memberSEL];
}
_addSEL = sel_getName(@"add" + capitalizedKey + "Object:");
if ([_proxyObject respondsToSelector:_addSEL])
{
_add = [_proxyObject methodForSelector:_addSEL];
}
_addManySEL = sel_getName(@"add" + capitalizedKey + ":");
if ([_proxyObject respondsToSelector:_addManySEL])
{
_addMany = [_proxyObject methodForSelector:_addManySEL];
}
_removeSEL = sel_getName(@"remove" + capitalizedKey + "Object:");
if ([_proxyObject respondsToSelector:_removeSEL])
{
_remove = [_proxyObject methodForSelector:_removeSEL];
}
_removeManySEL = sel_getName(@"remove" + capitalizedKey + ":");
if ([_proxyObject respondsToSelector:_removeManySEL])
{
_removeMany = [_proxyObject methodForSelector:_removeManySEL];
}
_intersectSEL = sel_getName(@"intersect" + capitalizedKey + ":");
if ([_proxyObject respondsToSelector:_intersectSEL])
{
_intersect = [_proxyObject methodForSelector:_intersectSEL];
}
return self;
}
- (id)_representedObject
{
if (_access)
{
return _access(_proxyObject, _accessSEL);
}
return [_proxyObject valueForKey:_key];
}
- (void)_setRepresentedObject:(id)anObject
{
if (_set)
{
return _set(_proxyObject, _setSEL, anObject);
}
[_proxyObject setValue:anObject forKey:_key];
}
- (CPUInteger)count
{
if (_count)
{
return _count(_proxyObject, _countSEL);
}
return [[self _representedObject] count];
}
- (CPEnumerator)objectEnumerator
{
if (_enumerator)
{
return _enumerator(_proxyObject, _enumeratorSEL);
}
return [[self _representedObject] objectEnumerator];
}
- (id)member:(id)anObject
{
if (_member)
{
return _member(_proxyObject, _memberSEL, anObject);
}
return [[self _representedObject] member:anObject];
}
- (void)addObject:(id)anObject
{
if (_add)
{
_add(_proxyObject, _addSEL, anObject);
}
else if (_addMany)
{
var objectSet = [CPSet setWithObject:anObject];
_addMany(_proxyObject, _addManySEL, objectSet);
}
else
{
var target = [[self _representedObject] copy];
[target addObject:anObject];
[self _setRepresentedObject:target];
}
}
- (void)addObjectsFromArray:(CPArray)objects
{
if (_addMany)
{
var objectSet = [CPSet setWithArray:objects];
_addMany(_proxyObject, _addManySEL, objectSet);
}
else if (_add)
{
var object,
objectEnumerator = [objects objectEnumerator];
while ((object = [objectEnumerator nextObject]) != nil)
{
_add(_proxyObject, _addSEL, object);
}
}
else
{
var target = [[self _representedObject] copy];
[target addObjectsFromArray:objects];
[self _setRepresentedObject:target];
}
}
- (void)unionSet:(CPSet)aSet
{
if (_addMany)
{
_addMany(_proxyObject, _addManySEL, aSet);
}
else if (_add)
{
var object,
objectEnumerator = [aSet objectEnumerator];
while ((object = [objectEnumerator nextObject]) != nil)
{
_add(_proxyObject, _addSEL, object);
}
}
else
{
var target = [[self _representedObject] copy];
[target unionSet:aSet];
[self _setRepresentedObject:target];
}
}
- (void)removeObject:(id)anObject
{
if (_remove)
{
_remove(_proxyObject, _removeSEL, anObject);
}
else if (_removeMany)
{
var objectSet = [CPSet setWithObject:anObject];
_removeMany(_proxyObject, _removeManySEL, objectSet);
}
else
{
var target = [[self _representedObject] copy];
[target removeObject:anObject];
[self _setRepresentedObject:target];
}
}
- (void)minusSet:(CPSet)aSet
{
if (_removeMany)
{
_removeMany(_proxyObject, _removeManySEL, aSet);
}
else if (_remove)
{
var object,
objectEnumerator = [aSet objectEnumerator];
while ((object = [objectEnumerator nextObject]) != nil)
{
_remove(_proxyObject, _removeSEL, object);
}
}
else
{
var target = [[self _representedObject] copy];
[target minusSet:aSet];
[self _setRepresentedObject:target];
}
}
- (void)removeObjectsInArray:(CPArray)objects
{
if (_removeMany)
{
var objectSet = [CPSet setWithArray:objects];
_removeMany(_proxyObject, _removeManySEL, objectSet);
}
else if (_remove)
{
var object,
objectEnumerator = [objects objectEnumerator];
while ((object = [objectEnumerator nextObject]) != nil)
{
_remove(_proxyObject, _removeSEL, object);
}
}
else
{
var target = [[self _representedObject] copy];
[target removeObjectsInArray:objects];
[self _setRepresentedObject:target];
}
}
- (void)removeAllObjects
{
if (_removeMany)
{
var allObjectsSet = [[self _representedObject] copy];
_removeMany(_proxyObject, _removeManySEL, allObjectsSet);
}
else if (_remove)
{
var object,
objectEnumerator = [[[self _representedObject] copy] objectEnumerator];
while ((object = [objectEnumerator nextObject]) != nil)
{
_remove(_proxyObject, _removeSEL, object);
}
}
else
{
var target = [[self _representedObject] copy];
[target removeAllObjects];
[self _setRepresentedObject:target];
}
}
- (void)intersectSet:(CPSet)aSet
{
if (_intersect)
{
_intersect(_proxyObject, _intersectSEL, aSet);
}
else
{
var target = [[self _representedObject] copy];
[target intersectSet:aSet];
[self _setRepresentedObject:target];
}
}
- (void)setSet:(CPSet)set
{
[self _setRepresentedObject:set];
}
- (CPArray)allObjects
{
return [[self _representedObject] allObjects];
}
- (id)anyObject
{
return [[self _representedObject] anyObject];
}
- (BOOL)containsObject:(id)anObject
{
return [[self _representedObject] containsObject:anObject];
}
- (BOOL)intersectsSet:(CPSet)aSet
{
return [[self _representedObject] intersectsSet:aSet];
}
- (BOOL)isEqualToSet:(CPSet)aSet
{
return [[self _representedObject] isEqualToSet:aSet];
}
- (id)copy
{
return [[self _representedObject] copy];
}
@end
+126 -294
View File
@@ -12,493 +12,329 @@
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
@import "CPArray.j"
@import "CPEnumerator.j"
@import "CPException.j"
@import "CPNull.j"
@import "CPNumber.j"
@import "CPObject.j"
@import "_CPCollectionKVCOperators.j"
@class _CPConcreteMutableSet
/*!
@class CPMutableSet
@ingroup Foundation
CPSet is a data structure for storing an an unordered collection of unique objects.
Sets have O(1) insertion/lookup/deletion time complexity.
*/
@class CPSet
@ingroup Foundation
*/
@implementation CPSet : CPObject
{
}
+ (id)alloc
{
if (self === [CPSet class] || self === [CPMutableSet class])
return [_CPPlaceholderSet alloc];
if (self === [CPSet class] || self === [CPMutableSet class])
return [_CPPlaceholderSet alloc];
return [super alloc];
return [super alloc];
}
/*!
Creates and returns an empty set.
*/
+ (id)set
{
return [[self alloc] init];
return [[self alloc] init];
}
/*!
Creates and returns a set containing a uniqued collection of those objects contained in a given array.
@param anArray array containing the objects to add to the new set. If the same object appears more than once objects, it is added only once to the returned set.
*/
+ (id)setWithArray:(CPArray)anArray
{
return [[self alloc] initWithArray:anArray];
return [[self alloc] initWithArray:anArray];
}
/*!
Creates and returns a set that contains a single given object.
@param anObject The object to add to the new set.
*/
+ (id)setWithObject:(id)anObject
{
return [[self alloc] initWithObjects:anObject];
return [[self alloc] initWithObjects:anObject];
}
/*!
Creates and returns a set containing a specified number of objects from a given array of objects.
@param objects A array of objects to add to the new set. If the same object appears more than once objects, it is added only once to the returned set.
@param count The number of objects from objects to add to the new set.
*/
+ (id)setWithObjects:(id)objects count:(CPUInteger)count
{
return [[self alloc] initWithObjects:objects count:count];
return [[self alloc] initWithObjects:objects count:count];
}
/*!
Creates and returns a set containing the objects in a given argument list.
@param anObject The first object to add to the new set.
@param ... A comma-separated list of objects, ending with nil, to add to the new set. If the same object appears more than once objects, it is added only once to the returned set.
*/
+ (id)setWithObjects:(id)anObject, ...
{
var argumentsArray = Array.prototype.slice.apply(arguments);
var argumentsArray = Array.prototype.slice.apply(arguments);
argumentsArray[0] = [self alloc];
argumentsArray[1] = @selector(initWithObjects:);
argumentsArray[0] = [self alloc];
argumentsArray[1] = @selector(initWithObjects:);
return objj_msgSend.apply(this, argumentsArray);
return objj_msgSend.apply(this, argumentsArray);
}
/*!
Creates and returns a set containing the objects from another set.
@param aSet A set containing the objects to add to the new set.
*/
+ (id)setWithSet:(CPSet)set
{
return [[self alloc] initWithSet:set];
return [[self alloc] initWithSet:set];
}
/*!
Creates and returns a set by adding anObject.
@param anObject to add to the new set.
*/
- (id)setByAddingObject:(id)anObject
{
return [[self class] setWithArray:[[self allObjects] arrayByAddingObject:anObject]];
return [[self class] setWithArray:[[self allObjects] arrayByAddingObject:anObject]];
}
/*!
Creates and returns a set by adding the objects from another set.
@param aSet to add objects to add to the new set.
*/
- (id)setByAddingObjectsFromSet:(CPSet)aSet
{
return [self setByAddingObjectsFromArray:[aSet allObjects]];
return [self setByAddingObjectsFromArray:[aSet allObjects]];
}
/*!
Creates and returns a set by adding the objects from an array.
@param anArray with objects to add to a new set.
*/
- (id)setByAddingObjectsFromArray:(CPArray)anArray
{
return [[self class] setWithArray:[[self allObjects] arrayByAddingObjectsFromArray:anArray]];
return [[self class] setWithArray:[[self allObjects] arrayByAddingObjectsFromArray:anArray]];
}
/*!
Basic initializer, returns an empty set.
*/
- (id)init
{
return [self initWithObjects:nil count:0];
return [self initWithObjects:nil count:0];
}
/*!
Initializes a newly allocated set with the objects that are contained in a given array.
@param array An array of objects to add to the new set. If the same object appears more than once in array, it is represented only once in the returned set.
*/
- (id)initWithArray:(CPArray)anArray
{
return [self initWithObjects:anArray count:[anArray count]];
return [self initWithObjects:anArray count:[anArray count]];
}
/*!
Initializes a newly allocated set with members taken from the specified list of objects.
@param anObject The first object to add to the new set.
@param ... A comma-separated list of objects, ending with nil, to add to the new set. If the same object appears more than once in the list, it is represented only once in the returned set.
*/
- (id)initWithObjects:(id)anObject, ...
{
var index = 2,
count = arguments.length;
var index = 2,
count = arguments.length;
for (; index < count; ++index)
if (arguments[index] === nil)
break;
for (; index < count; ++index)
if (arguments[index] === nil)
break;
return [self initWithObjects:Array.prototype.slice.call(arguments, 2, index) count:index - 2];
return [self initWithObjects:Array.prototype.slice.call(arguments, 2, index) count:index - 2];
}
/*!
Creates and returns a set containing the objects from an array.
@param anArray An array containing the objects to add to the new set.
@param aCount the number of objects in anArray.
*/
- (id)initWithObjects:(CPArray)objects count:(CPUInteger)aCount
{
if (self === _CPSharedPlaceholderSet)
return [[_CPConcreteMutableSet alloc] initWithObjects:objects count:aCount];
if (self === _CPSharedPlaceholderSet)
return [[_CPConcreteMutableSet alloc] initWithObjects:objects count:aCount];
return [super init];
return [super init];
}
/*!
Initializes a newly allocated set and adds to it objects from another given set.
@param aSet a set containing objects to add to the new set.
*/
- (id)initWithSet:(CPSet)aSet
{
return [self initWithArray:[aSet allObjects]];
return [self initWithArray:[aSet allObjects]];
}
/*!
Initializes a newly allocated set and adds to it members of another given set. Only included for compatability.
@param aSet a set of objects to add to the new set.
@param shouldCopyItems a boolean value. If YES the objects would be copied, if NO the objects will not be copied.
*/
- (id)initWithSet:(CPSet)aSet copyItems:(BOOL)shouldCopyItems
{
if (shouldCopyItems)
return [aSet valueForKey:@"copy"];
if (shouldCopyItems)
return [aSet valueForKey:@"copy"];
return [self initWithSet:aSet];
return [self initWithSet:aSet];
}
/*!
Returns the number of members in the receiver.
*/
- (CPUInteger)count
{
_CPRaiseInvalidAbstractInvocation(self, _cmd);
_CPRaiseInvalidAbstractInvocation(self, _cmd);
}
/*!
Returns an array containing the receivers members, or an empty array if the receiver has no members.
*/
- (CPArray)allObjects
{
var objects = [],
object,
objectEnumerator = [self objectEnumerator];
var objects = [],
object,
objectEnumerator = [self objectEnumerator];
while ((object = [objectEnumerator nextObject]) != nil)
objects.push(object);
while ((object = [objectEnumerator nextObject]) != nil)
objects.push(object);
return objects;
return objects;
}
/*!
Returns one of the objects in the receiver, or nil if the receiver contains no objects.
*/
- (id)anyObject
{
return [[self objectEnumerator] nextObject];
return [[self objectEnumerator] nextObject];
}
/*!
Returns a Boolean value that indicates whether a given object is present in the receiver.
@param anObject The object for which to test membership of the receiver.
*/
- (BOOL)containsObject:(id)anObject
{
return [self member:anObject] != nil;
return [self member:anObject] != nil;
}
/*!
Returns a set filtered using a given predicate.
@prarm aPredicate a CPPredicate object used to filter the objects in the set.
*/
- (CPSet)filteredSetUsingPredicate:(CPPredicate)aPredicate
{
var objects = [],
object,
objectEnumerator = [self objectEnumerator];
var objects = [],
object,
objectEnumerator = [self objectEnumerator];
while ((object = [objectEnumerator nextObject]) != nil)
if ([aPredicate evaluateWithObject:object])
objects.push(object);
while ((object = [objectEnumerator nextObject]) != nil)
if ([aPredicate evaluateWithObject:object])
objects.push(object);
return [[[self class] alloc] initWithArray:objects];
return [[[self class] alloc] initWithArray:objects];
}
/*!
Sends to each object in the receiver a message specified by a given selector.
@param aSelector A selector that specifies the message to send to the members of the receiver. The method must not take any arguments. It should not have the side effect of modifying the receiver. This value must not be NULL.
*/
- (void)makeObjectsPerformSelector:(SEL)aSelector
{
[self makeObjectsPerformSelector:aSelector withObjects:nil];
[self makeObjectsPerformSelector:aSelector withObjects:nil];
}
/*!
Sends to each object in the receiver a message specified by a given selector.
@param aSelector A selector that specifies the message to send to the receiver's members. The method must take a single argument of type id. The method should not, as a side effect, modify the receiver. The value must not be NULL.
@param anObject The object to pass as an argument to the method specified by aSelector.
*/
- (void)makeObjectsPerformSelector:(SEL)aSelector withObject:(id)anObject
{
[self makeObjectsPerformSelector:aSelector withObjects:[anObject]];
[self makeObjectsPerformSelector:aSelector withObjects:[anObject]];
}
/*!
Sends to each object in the receiver a message specified by a given selector.
@param aSelector A selector that specifies the message to send to the receiver's members. The method must take a single argument of type id. The method should not, as a side effect, modify the receiver. The value must not be NULL.
@param objects The objects to pass as an argument to the method specified by aSelector.
*/
- (void)makeObjectsPerformSelector:(SEL)aSelector withObjects:(CPArray)objects
{
var object,
objectEnumerator = [self objectEnumerator],
argumentsArray = [nil, aSelector].concat(objects || []);
var object,
objectEnumerator = [self objectEnumerator],
argumentsArray = [nil, aSelector].concat(objects || []);
while ((object = [objectEnumerator nextObject]) != nil)
{
argumentsArray[0] = object;
objj_msgSend.apply(this, argumentsArray);
}
while ((object = [objectEnumerator nextObject]) != nil)
{
argumentsArray[0] = object;
objj_msgSend.apply(this, argumentsArray);
}
}
/*!
Determines whether the receiver contains an object equal to a given object, and returns that object if it is present.
@param anObject The object for which to test for membership of the receiver.
*/
- (id)member:(id)anObject
{
_CPRaiseInvalidAbstractInvocation(self, _cmd);
_CPRaiseInvalidAbstractInvocation(self, _cmd);
}
/*!
Returns an object enumerator (CPEnumerator) for the receiver.
*/
- (CPEnumerator)objectEnumerator
{
_CPRaiseInvalidAbstractInvocation(self, _cmd);
_CPRaiseInvalidAbstractInvocation(self, _cmd);
}
/*!
Enumberates over the objects in a set using a given function.
@param aFunction a callback for each itteration, should be of the format: function(anObject, stop).
*/
- (void)enumerateObjectsUsingBlock:(Function /*(id anObject, @ref BOOL stop)*/)aFunction
- (void)enumerateObjectsUsingBlock:(Function)aFunction
{
var object,
objectEnumerator = [self objectEnumerator],
shouldStop = NO;
var object,
objectEnumerator = [self objectEnumerator],
shouldStop = NO;
while (!shouldStop && (object = [objectEnumerator nextObject]) != nil) {
if (aFunction(object, @ref(shouldStop)) !== undefined) {
throw "DEPRECATED: The method enumerateObjectsUsingBlock: does not support returning a value in the block to stop the iteration. Please use the stop variable";
}
}
while (!shouldStop && (object = [objectEnumerator nextObject]) != nil) {
if (aFunction(object, @ref(shouldStop)) !== undefined) {
throw "DEPRECATED: The method enumerateObjectsUsingBlock: does not support returning a value in the block to stop the iteration.";
}
}
}
// FIXME: stop is broken.
- (CPSet)objectsPassingTest:(Function)aFunction
{
var objects = [],
object = nil,
objectEnumerator = [self objectEnumerator];
var objects = [],
object = nil,
objectEnumerator = [self objectEnumerator];
while ((object = [objectEnumerator nextObject]) != nil)
if (aFunction(object))
objects.push(object);
while ((object = [objectEnumerator nextObject]) != nil)
if (aFunction(object))
objects.push(object);
return [[[self class] alloc] initWithArray:objects];
return [[[self class] alloc] initWithArray:objects];
}
/*!
Returns a Boolean value that indicates whether every object in the receiver is also present in another given set.
@param set The set with which to compare the receiver.
*/
- (BOOL)isSubsetOfSet:(CPSet)aSet
{
var object = nil,
objectEnumerator = [self objectEnumerator];
var object = nil,
objectEnumerator = [self objectEnumerator];
while ((object = [objectEnumerator nextObject]) != nil)
if (![aSet containsObject:object])
return NO;
while ((object = [objectEnumerator nextObject]) != nil)
if (![aSet containsObject:object])
return NO;
return YES;
return YES;
}
/*!
Returns a Boolean value that indicates whether at least one object in the receiver is also present in another given set.
@param set The set with which to compare the receiver.
*/
- (BOOL)intersectsSet:(CPSet)aSet
{
if (self === aSet)
// The empty set intersects nothing
return [self count] > 0;
if (self === aSet)
return [self count] > 0;
var object = nil,
objectEnumerator = [self objectEnumerator];
var object = nil,
objectEnumerator = [self objectEnumerator];
while ((object = [objectEnumerator nextObject]) != nil)
if ([aSet containsObject:object])
return YES;
while ((object = [objectEnumerator nextObject]) != nil)
if ([aSet containsObject:object])
return YES;
return NO;
return NO;
}
/*!
Returns an array of the set's content sorted as specified by a given array of sort descriptors.
@param sortDescriptors an array of CPSortDescriptor objects.
*/
- (CPArray)sortedArrayUsingDescriptors:(CPArray)someSortDescriptors
{
return [[self allObjects] sortedArrayUsingDescriptors:someSortDescriptors];
return [[self allObjects] sortedArrayUsingDescriptors:someSortDescriptors];
}
/*!
Compares the receiver to another set.
@param set The set with which to compare the receiver.
*/
- (BOOL)isEqualToSet:(CPSet)aSet
{
return [self isEqual:aSet];
return [self isEqual:aSet];
}
/*!
Returns YES if BOTH sets are a subset of the other.
@param aSet a set of objects
*/
- (BOOL)isEqual:(CPSet)aSet
{
// If both are subsets of each other, they are equal
return self === aSet ||
[aSet isKindOfClass:[CPSet class]] &&
([self count] === [aSet count] &&
[aSet isSubsetOfSet:self]);
return self === aSet ||
[aSet isKindOfClass:[CPSet class]] &&
([self count] === [aSet count] &&
[aSet isSubsetOfSet:self]);
}
- (CPString)description
{
var string = "{(\n",
objects = [self allObjects],
index = 0,
count = [objects count];
var string = "{(\n",
objects = [self allObjects],
index = 0,
count = [objects count];
for (; index < count; ++index)
{
var object = objects[index];
for (; index < count; ++index)
{
var object = objects[index];
string += "\t" + String(object).split('\n').join("\n\t") + "\n";
}
string += "\t" + String(object).split('\n').join("\n\t") + "\n";
}
return string + ")}";
return string + ")}";
}
@end
// MARK: -
// MARK: Category: CPCopying
@implementation CPSet (CPCopying)
- (id)copy
{
return [[self class] setWithSet:self];
return [[self class] setWithSet:self];
}
- (id)mutableCopy
{
return [self copy];
return [self copy];
}
@end
// MARK: -
// MARK: Category: CPCoding
var CPSetObjectsKey = @"CPSetObjectsKey";
@implementation CPSet (CPCoding)
- (id)initWithCoder:(CPCoder)aCoder
{
return [self initWithArray:[aCoder decodeObjectForKey:CPSetObjectsKey]];
return [self initWithArray:[aCoder decodeObjectForKey:CPSetObjectsKey]];
}
- (void)encodeWithCoder:(CPCoder)aCoder
{
[aCoder encodeObject:[self allObjects] forKey:CPSetObjectsKey];
[aCoder encodeObject:[self allObjects] forKey:CPSetObjectsKey];
}
@end
@implementation CPSet (CPKeyValueCoding)
// MARK: -
// MARK: Private Allocation Placeholder
- (id)valueForKey:(CPString)aKey
{
if (aKey === "@count")
return [self count];
var valueSet = [CPSet set],
object,
objectEnumerator = [self objectEnumerator];
while ((object = [objectEnumerator nextObject]) != nil)
{
var value = [object valueForKey:aKey];
[valueSet addObject:value];
}
return valueSet;
}
- (void)setValue:(id)aValue forKey:(CPString)aKey
{
var object,
objectEnumerator = [self objectEnumerator];
while ((object = [objectEnumerator nextObject]) != nil)
[object setValue:aValue forKey:aKey];
}
@end
var _CPSharedPlaceholderSet = nil;
var _CPSharedPlaceholderSet = nil;
@implementation _CPPlaceholderSet : CPSet
{
@@ -506,14 +342,10 @@ var _CPSharedPlaceholderSet = nil;
+ (id)alloc
{
if (!_CPSharedPlaceholderSet)
_CPSharedPlaceholderSet = [super alloc];
if (!_CPSharedPlaceholderSet)
_CPSharedPlaceholderSet = [super alloc];
return _CPSharedPlaceholderSet;
return _CPSharedPlaceholderSet;
}
@end
// We actually want _CPConcreteMutableSet, but this introduces the possibility of an invalid @import loop.
// This will be correctly solved when we move to true immutable/mutable pairs.
//@import "CPMutableSet.j"
+1 -3
View File
@@ -20,17 +20,15 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@import "CPException.j"
@import "CPObject.j"
@import "CPObjJRuntime.j"
@import "CPRange.j"
@import "CPSortDescriptor.j"
@import "CPURL.j"
@import "CPValue.j"
@import "CPNull.j"
@class CPException
@class CPURL
@class CPSortDescriptor
@global CPInvalidArgumentException
@global CPRangeException
+14 -14
View File
@@ -377,8 +377,8 @@ function _abbreviationForNameAndDate(tzName, date)
}
#pragma mark -
#pragma mark Class constructor
// MARK: -
// MARK: Class constructor
/*! Returns a time zone from the given abbreviation.
Returns nil if the given abbreviation doesn't match with any abbreviations
@@ -482,8 +482,8 @@ function _abbreviationForNameAndDate(tzName, date)
return array;
}
#pragma mark -
#pragma mark Class accessors
// MARK: -
// MARK: Class accessors
/*! Return the timeZoneDataVersion (not yet implemented)
*/
@@ -558,8 +558,8 @@ function _abbreviationForNameAndDate(tzName, date)
}
#pragma mark -
#pragma mark Consructors
// MARK: -
// MARK: Consructors
/*! Init a new time zone with the given time zone name and abbreviation
Returns nil if tzName doesn't match with any timeZoneNames or if abbreviation is nil
@@ -658,8 +658,8 @@ function _abbreviationForNameAndDate(tzName, date)
}
#pragma mark -
#pragma mark Methods for CPDate
// MARK: -
// MARK: Methods for CPDate
/*! Returns the abbreviation from a date
Returns nil if the date is nil
@@ -697,8 +697,8 @@ function _abbreviationForNameAndDate(tzName, date)
}
#pragma mark -
#pragma mark Compars methods
// MARK: -
// MARK: Compars methods
/*! Returns a bool to compare tow timeZones.
This is made by the compare of the name and the data of the timeZones
@@ -710,8 +710,8 @@ function _abbreviationForNameAndDate(tzName, date)
}
#pragma mark -
#pragma mark Description
// MARK: -
// MARK: Description
/*! Returns the description of the timeZone
The pattern of the description is : 'name of the timeZone' ('abbreviation of the timeZone') offset 'the timeDifferenceFromGMT'
@@ -723,8 +723,8 @@ function _abbreviationForNameAndDate(tzName, date)
}
#pragma mark -
#pragma mark Localized methods
// MARK: -
// MARK: Localized methods
/*! Return a localized string from the given style and locale
@param style the style
+2 -2
View File
@@ -381,7 +381,7 @@ var StandardUserDefaults;
}
}
#pragma mark Getting Default Values
// MARK: Getting Default Values
/*!
Returns the array value associated with the specified key.
@@ -517,7 +517,7 @@ var StandardUserDefaults;
return nil;
}
#pragma mark Setting Default Values
// MARK: Setting Default Values
/*!
Sets the value of the specified default key to the specified Boolean value.
+3 -3
View File
@@ -91,8 +91,8 @@ CPUserNotificationActivationTypeAdditionalActionClicked = 4;
}
#pragma mark -
#pragma mark Creating an user notification
// MARK: -
// MARK: Creating an user notification
- (id)init
{
@@ -106,4 +106,4 @@ CPUserNotificationActivationTypeAdditionalActionClicked = 4;
return self
}
@end
@end
+13 -13
View File
@@ -62,8 +62,8 @@ var CPUserNotificationDefaultCenter = nil;
}
#pragma mark -
#pragma mark Creating Default User Notification Center
// MARK: -
// MARK: Creating Default User Notification Center
/*!
Returns the user's notification center
@@ -91,8 +91,8 @@ var CPUserNotificationDefaultCenter = nil;
}
#pragma mark -
#pragma mark Getting and Setting the Delegate
// MARK: -
// MARK: Getting and Setting the Delegate
- (void)setDelegate:(id <CPUserNotificationCenterDelegate>)aDelegate
{
@@ -113,8 +113,8 @@ var CPUserNotificationDefaultCenter = nil;
}
#pragma mark -
#pragma mark Managing the Scheduled Notification Queue
// MARK: -
// MARK: Managing the Scheduled Notification Queue
/*!
Schedules the given user notification
@@ -158,8 +158,8 @@ var CPUserNotificationDefaultCenter = nil;
}
#pragma mark -
#pragma mark Managing the Delivered Notifications
// MARK: -
// MARK: Managing the Delivered Notifications
/*!
Deliver the given user notification
@@ -188,8 +188,8 @@ var CPUserNotificationDefaultCenter = nil;
}
#pragma mark -
#pragma mark Permission Utilities
// MARK: -
// MARK: Permission Utilities
- (void)_askPermissionForUserNotification:(CPUserNotification)anUserNotification
{
@@ -201,8 +201,8 @@ var CPUserNotificationDefaultCenter = nil;
}
#pragma mark -
#pragma mark Notification Utilities
// MARK: -
// MARK: Notification Utilities
- (void)_launchUserNotification:(CPUserNotification)anUserNotification
{
@@ -290,4 +290,4 @@ var CPUserNotificationDefaultCenter = nil;
[_delegate userNotificationCenter:self didDeliverNotification:aNotification];
}
@end
@end
+2 -1
View File
@@ -20,9 +20,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
@import "CPCoder.j"
@import "CPObject.j"
@class CPCoder
/*!
@class CPValue
@ingroup foundation
+1 -1
View File
@@ -377,7 +377,7 @@ Preprocessor.prototype.hash = function(tokens, aStringBuffer)
{
token = tokens.skip_whitespace();
// '#pragma mark' directive is used in Xcode editor for creating labels,
// '// MARK:' directive is used in Xcode editor for creating labels,
// which is irrelevant to Cappuccino - just swallow this line
if (token === TOKEN_MARK)
{
@@ -140,7 +140,7 @@
[self assert:[track volume] equals:[slider floatValue]];
}
#pragma mark ----- actions used by implementation 01 -----
// MARK: ----- actions used by implementation 01 -----
- (void)updateVolumeFrom:(id)sender
{
@@ -161,7 +161,7 @@
[self updateUserInterface];
}
#pragma mark ----- actions used by implementation 02 and 03 -----
// MARK: ----- actions used by implementation 02 and 03 -----
- (void)muteTrack:(id)sender
{
+6 -6
View File
@@ -31,8 +31,8 @@
}
#pragma mark -
#pragma mark Test creation
// MARK: -
// MARK: Test creation
- (void)testArchiving
{
@@ -57,8 +57,8 @@
}
#pragma mark -
#pragma mark Test objectValue and stringValue
// MARK: -
// MARK: Test objectValue and stringValue
/*!
This is totally different than cocoa
@@ -82,8 +82,8 @@
}
#pragma mark -
#pragma mark Delegate methods
// MARK: -
// MARK: Delegate methods
- (void)testDelegateDisplayStringForRepresentedObject
{
+8 -8
View File
@@ -52,8 +52,8 @@
}
#pragma mark -
#pragma mark Setter
// MARK: -
// MARK: Setter
- (void)testSetterAMSymbol
{
@@ -163,8 +163,8 @@
[self assert:[_dateFormatter shortStandaloneQuarterSymbols] equals:[@"Hej hej"]];
}
#pragma mark -
#pragma mark string from date
// MARK: -
// MARK: string from date
- (void)testLocalizedStringFromDate
{
@@ -446,8 +446,8 @@
}
#pragma mark -
#pragma mark Date From string
// MARK: -
// MARK: Date From string
- (void)testDateFromStringToken
{
@@ -1328,8 +1328,8 @@
[self assert:error equals:@"The value \"ezr 12\" is invalid."];
}
#pragma mark -
#pragma mark non-en locales
// MARK: -
// MARK: non-en locales
// Unless we have full locale support any non-supported locale should return the english values as they are the only defined ones at the moment.
+178
View File
@@ -0,0 +1,178 @@
/*
* AppController.j
*
* Markdown Live Viewer mit kollabiertem Rahmen-Layout und adaptiver Spalten-Projektion
*/
@import <Foundation/Foundation.j>
@import <AppKit/AppKit.j>
// --- MAIN CONTROLLER ---
@implementation AppController : CPObject
{
CPTextView _markdownInputTextView;
CPTextView _markdownRenderTextView;
CPScrollView _inputScrollView;
CPScrollView _renderScrollView;
}
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
{
var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask],
contentView = [theWindow contentView];
[contentView setBackgroundColor:[CPColor colorWithWhite:0.95 alpha:1.0]];
// 1. Tool-Bar
var toolbarView = [[CPView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth([contentView bounds]), 60)];
[toolbarView setAutoresizingMask:CPViewWidthSizable];
[toolbarView setBackgroundColor:[CPColor colorWithWhite:0.88 alpha:1.0]];
[contentView addSubview:toolbarView];
var currentX = 15;
var renderButton = [[CPButton alloc] initWithFrame:CGRectMake(currentX, 15, 140, 30)];
[renderButton setTitle:@"Force Render"];
[renderButton setTarget:self];
[renderButton setAction:@selector(renderMarkdownAction:)];
[toolbarView addSubview:renderButton];
currentX += 150;
var clearButton = [[CPButton alloc] initWithFrame:CGRectMake(currentX, 15, 100, 30)];
[clearButton setTitle:@"Clear All"];
[clearButton setTarget:self];
[clearButton setAction:@selector(clearAction:)];
[toolbarView addSubview:clearButton];
// 2. Workspace Split-View Layout
var splitView = [[CPSplitView alloc] initWithFrame:CGRectMake(0, 60, CGRectGetWidth([contentView bounds]), CGRectGetHeight([contentView bounds]) - 60)];
[splitView setVertical:YES];
[splitView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable];
var leftContainer = [[CPView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth([splitView bounds]) / 2, CGRectGetHeight([splitView bounds]))];
[leftContainer setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable];
var rightContainer = [[CPView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth([splitView bounds]) / 2, CGRectGetHeight([splitView bounds]))];
[rightContainer setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable];
[splitView addSubview:leftContainer];
[splitView addSubview:rightContainer];
[contentView addSubview:splitView];
// Split-Pane Größenänderung überwachen
[[CPNotificationCenter defaultCenter] addObserver:self
selector:@selector(splitViewDidResizeSubviews:)
name:CPSplitViewDidResizeSubviewsNotification
object:splitView];
// Linke Seite: Plain-Text Editor
var leftLabel = [[CPTextField alloc] initWithFrame:CGRectMake(15, 10, CGRectGetWidth([leftContainer bounds]) - 30, 20)];
[leftLabel setStringValue:@"Markdown Editor (Plain Text)"];
[leftLabel setFont:[CPFont boldSystemFontOfSize:14]];
[leftLabel setAutoresizingMask:CPViewWidthSizable];
[leftContainer addSubview:leftLabel];
_markdownInputTextView = [[CPTextView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth([leftContainer bounds]) - 30, CGRectGetHeight([leftContainer bounds]) - 70)];
[_markdownInputTextView setRichText:NO];
[_markdownInputTextView setBackgroundColor:[CPColor whiteColor]];
[_markdownInputTextView setDelegate:self];
[_markdownInputTextView setVerticallyResizable:YES];
[_markdownInputTextView setHorizontallyResizable:NO];
[_markdownInputTextView setAutoresizingMask:CPViewWidthSizable];
[[_markdownInputTextView textContainer] setWidthTracksTextView:YES];
_inputScrollView = [[CPScrollView alloc] initWithFrame:CGRectMake(15, 40, CGRectGetWidth([leftContainer bounds]) - 30, CGRectGetHeight([leftContainer bounds]) - 65)];
[_inputScrollView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable];
[_inputScrollView setDocumentView:_markdownInputTextView];
[leftContainer addSubview:_inputScrollView];
// Rechte Seite: Formatted Rich-Text Viewer
var rightLabel = [[CPTextField alloc] initWithFrame:CGRectMake(15, 10, CGRectGetWidth([rightContainer bounds]) - 30, 20)];
[rightLabel setStringValue:@"Formatted Output (Rich Text View)"];
[rightLabel setFont:[CPFont boldSystemFontOfSize:14]];
[rightLabel setAutoresizingMask:CPViewWidthSizable];
[rightContainer addSubview:rightLabel];
_markdownRenderTextView = [[CPTextView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth([rightContainer bounds]) - 30, CGRectGetHeight([rightContainer bounds]) - 70)];
[_markdownRenderTextView setRichText:YES];
[_markdownRenderTextView setEditable:YES];
[_markdownRenderTextView setBackgroundColor:[CPColor whiteColor]];
[_markdownRenderTextView setVerticallyResizable:YES];
[_markdownRenderTextView setHorizontallyResizable:NO];
[_markdownRenderTextView setAutoresizingMask:CPViewWidthSizable];
[[_markdownRenderTextView textContainer] setWidthTracksTextView:YES];
_renderScrollView = [[CPScrollView alloc] initWithFrame:CGRectMake(15, 40, CGRectGetWidth([rightContainer bounds]) - 30, CGRectGetHeight([rightContainer bounds]) - 65)];
[_renderScrollView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable];
[_renderScrollView setDocumentView:_markdownRenderTextView];
[rightContainer addSubview:_renderScrollView];
// 3. System Menü aufbauen
var mainMenu = [CPApp mainMenu];
while ([mainMenu numberOfItems] > 0)
[mainMenu removeItemAtIndex:0];
var item = [mainMenu insertItemWithTitle:@"Edit" action:nil keyEquivalent:nil atIndex:0],
editMenu = [[CPMenu alloc] initWithTitle:@"Edit Menu"];
[editMenu addItemWithTitle:@"Cut" action:@selector(cut:) keyEquivalent:@"x"];
[editMenu addItemWithTitle:@"Copy" action:@selector(copy:) keyEquivalent:@"c"];
[editMenu addItemWithTitle:@"Paste" action:@selector(paste:) keyEquivalent:@"v"];
[editMenu addItemWithTitle:@"Select All" action:@selector(selectAll:) keyEquivalent:@"a"];
[mainMenu setSubmenu:editMenu forItem:item];
[theWindow orderFront:self];
[CPMenu setMenuBarVisible:YES];
// 4. Default-Startup-Markdown mit Ihrem Buchungsbeispiel (inkl. geschützten Trennzeichen und Emojis)
var startupMarkdown = @"**Aufenthalts\u2011Daten Ihrer Pierre\u202f&\u202fVacances\u2011Reservation (Rechnungs\u2011Nr\u202f23651325)** \n\n" +
@"| \uD83D\uDCC5\u202fCheck\u2011in\u2011Datum | \uD83D\uDCC5\u202fCheck\u2011out\u2011Datum | \uD83D\uDD22\u202fN\u00e4chte | \uD83C\uDFE0\u202fUnterkunft | \uD83D\uDCCD\u202fAdresse | \uD83D\uDC65\u202fG\u00e4ste (Erwachsene\u202f/\u202fKinder) | \u23f0\u202fAnkunftszeit | \u23f0\u202fAbreisezeit | \uD83D\uDCDD\u202fBemerkung |\n" +
@"|-------------------|--------------------|-----------|--------------|------------|-------------------------------|----------------|----------------|-------------|\n" +
@"| 27.\u202fMai\u202f2026 | 03.\u202fJuni\u202f2026 | 7 | **Les\u202fVillas\u202fd\u2019Olonne** \u2013 Premium\u2011Villas | 19\u202fRoute\u202fdes\u202fAmis\u202fde\u202fla\u202fNature, 85340\u202fLes\u202fSables\u2011de\u2011L\u2011Olonne | 2\u202fErwachsene\u202f/\u202f1\u202fKind | 17:00\u202f\u2013\u202f17:30 (je nach Vereinbarung) | 10:00\u202f\u2013\u202f10:30 (Fr\u00fchst\u00fcck inklusive) | Hotel\u2011Check\u2011in erfolgt in der Rezeption; Schl\u00fcssel werden bei Ankunft \u00fcbergeben. |\n" +
@"| | | | **Haus\u2011und\u2011Sammelbecken** | | | | | |\n" +
@"| **Hinweis** | | | | | | | | |\n\n" +
@"> **Kurz\u00fcbersicht** \n" +
@"> \u2022 7\u202fN\u00e4chte von 27\u202fMai bis 3\u202fJuni 2026 \n" +
@"> \u2022 2\u202fErwachsene und 1\u202fKind \n" +
@"> \u2022 Check\u2011in um 17:00\u202f\u2013\u202f17:30 Uhr, Check\u2011out um 10:00\u202f\u2013\u202f10:30 Uhr \n" +
@"> \u2022 Unterkunft: Premium\u2011Villas \u201eLes\u202fVillas\u202fd\u2019Olonne\u201c an der Adresse 19\u202fRoute\u202fdes\u202fAmis\u202fde\u202fla\u202fNature, 85340\u202fLes\u202fSables\u2011de\u2011L\u2011Olonne \n\n" +
@"Falls Sie noch weitere Details ben\u00f6tigen (z.\u202fB.\u202fZahlungsbedingungen, Rezeption\u2011Kontaktdaten, Reiseziel\u2011Informationen), lassen Sie es mich einfach wissen!";
[_markdownInputTextView setString:startupMarkdown];
[self renderMarkdown];
}
- (void)textDidChange:(CPNotification)aNotification
{
[self renderMarkdown];
}
- (void)splitViewDidResizeSubviews:(CPNotification)aNotification
{
[self renderMarkdown];
}
- (void)renderMarkdownAction:(id)sender
{
[self renderMarkdown];
}
- (void)clearAction:(id)sender
{
[_markdownInputTextView setString:@""];
[self renderMarkdown];
}
- (void)renderMarkdown
{
var rawText = [_markdownInputTextView string];
if (!rawText) rawText = @"";
var parsedAttrStr = [CPMarkdownParser attributedStringFromMarkdown:rawText];
[_markdownRenderTextView setString:parsedAttrStr];
}
@end
+12
View File
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CPApplicationDelegateClass</key>
<string>AppController</string>
<key>CPBundleName</key>
<string>CPTextViewTest</string>
<key>CPPrincipalClass</key>
<string>CPApplication</string>
</dict>
</plist>
+94
View File
@@ -0,0 +1,94 @@
/*
* Jakefile
* CPLevelIndicator
*
* Created by Alexander Ljungberg on May 28, 2011.
* Copyright 2011, WireLoad All rights reserved.
*/
var ENV = require("system").env,
FILE = require("file"),
JAKE = require("jake"),
task = JAKE.task,
FileList = JAKE.FileList,
app = require("cappuccino/jake").app,
configuration = ENV["CONFIG"] || ENV["CONFIGURATION"] || ENV["c"] || "Debug",
OS = require("os");
app ("CPLevelIndicator", function(task)
{
task.setBuildIntermediatesPath(FILE.join("Build", "CPLevelIndicator.build", configuration));
task.setBuildPath(FILE.join("Build", configuration));
task.setProductName("CPLevelIndicator");
task.setIdentifier("com.yourcompany.CPLevelIndicator");
task.setVersion("1.0");
task.setAuthor("WireLoad");
task.setEmail("feedback @nospam@ yourcompany.com");
task.setSummary("CPLevelIndicator");
task.setSources((new FileList("**/*.j")).exclude(FILE.join("Build", "**")));
task.setResources(new FileList("Resources/**"));
task.setIndexFilePath("index.html");
task.setInfoPlistPath("Info.plist");
task.setNib2CibFlags("-R Resources/");
if (configuration === "Debug")
task.setCompilerFlags("-DDEBUG -g");
else
task.setCompilerFlags("-O");
});
task ("default", ["CPLevelIndicator"], function()
{
printResults(configuration);
});
task ("build", ["default"]);
task ("debug", function()
{
ENV["CONFIGURATION"] = "Debug";
JAKE.subjake(["."], "build", ENV);
});
task ("release", function()
{
ENV["CONFIGURATION"] = "Release";
JAKE.subjake(["."], "build", ENV);
});
task ("run", ["debug"], function()
{
OS.system(["open", FILE.join("Build", "Debug", "CPLevelIndicator", "index.html")]);
});
task ("run-release", ["release"], function()
{
OS.system(["open", FILE.join("Build", "Release", "CPLevelIndicator", "index.html")]);
});
task ("deploy", ["release"], function()
{
FILE.mkdirs(FILE.join("Build", "Deployment", "CPLevelIndicator"));
OS.system(["press", "-f", FILE.join("Build", "Release", "CPLevelIndicator"), FILE.join("Build", "Deployment", "CPLevelIndicator")]);
printResults("Deployment")
});
task ("desktop", ["release"], function()
{
FILE.mkdirs(FILE.join("Build", "Desktop", "CPLevelIndicator"));
require("cappuccino/nativehost").buildNativeHost(FILE.join("Build", "Release", "CPLevelIndicator"), FILE.join("Build", "Desktop", "CPLevelIndicator", "CPLevelIndicator.app"));
printResults("Desktop")
});
task ("run-desktop", ["desktop"], function()
{
OS.system([FILE.join("Build", "Desktop", "CPLevelIndicator", "CPLevelIndicator.app", "Contents", "MacOS", "NativeHost"), "-i"]);
});
function printResults(configuration)
{
print("----------------------------");
print(configuration+" app built at path: "+FILE.join("Build", configuration, "CPLevelIndicator"));
print("----------------------------");
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

@@ -0,0 +1,103 @@
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!--
index-debug.html
CPLevelIndicator
Created by Alexander Ljungberg on May 28, 2011.
Copyright 2011, WireLoad All rights reserved.
-->
<head>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7, chrome=1" />
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<link rel="apple-touch-icon" href="Resources/icon.png" />
<link rel="apple-touch-startup-image" href="Resources/default.png" />
<title>CPLevelIndicator</title>
<script type="text/javascript">
OBJJ_MAIN_FILE = "main.j";
OBJJ_INCLUDE_PATHS = ["Frameworks/Debug", "Frameworks", "SomethingElse"];
</script>
<script type="text/javascript" src="Frameworks/Debug/Objective-J/Objective-J.js" charset="UTF-8"></script>
<script type="text/javascript">
objj_msgSend_reset();
// DEBUG OPTIONS:
// Uncomment to enable printing of backtraces on exceptions:
//objj_msgSend_decorate(objj_backtrace_decorator);
// Uncomment to supress exceptions that take place inside a message
//objj_msgSend_decorate(objj_supress_exceptions_decorator)
// Uncomment to enable runtime type checking:
//objj_msgSend_decorate(objj_typecheck_decorator);
// Uncomment (along with both above) to print backtraces on type check errors:
//objj_typecheck_prints_backtrace = true;
// Uncomment to disable the default logger (CPLogConsole if window.console exists, CPLogPopup otherwise):
//CPLogUnregister(CPLogDefault);
// Uncomment to enable a specific logger:
//CPLogRegister(CPLogConsole);
//CPLogRegister(CPLogPopup);
</script>
<style type="text/css">
body{margin:0; padding:0;}
#container {position: absolute; top:50%; left:50%;}
#content {width:800px; text-align:center; margin-left: -400px; height:50px; margin-top:-25px; line-height: 50px;}
#content {font-family: "Helvetica", "Arial", sans-serif; font-size: 18px; color: black; text-shadow: 0px 1px 0px white; }
#loadgraphic {margin-right: 0.2em; margin-bottom:-2px;}
</style>
<!--[if lt IE 7]>
<STYLE type="text/css">
#container { position: relative; top: 50%; }
#content { position: relative;}
</STYLE>
<![endif]-->
</head>
<body style="">
<div id="cappuccino-body">
<div id="loadingcontainer" style="background-color: #eeeeee; overflow:hidden; width:100%; height:100%; position: absolute; top: 0; left: 0;">
<script type="text/javascript">
document.write("<div id='container'><p id='content'>" +
"<img id='loadgraphic' width='16' height='16' src='Resources/spinner.gif' /> " +
"Loading CPLevelIndicator...</p></div>");
</script>
<noscript>
<div id="container">
<div style="width: 440px; padding: 10px 25px 20px 25px; font-family: sans-serif; background-color: #ffffff; position: relative; left: -245px; top: -120px; text-align: center; -moz-border-radius: 20px; -webkit-border-radius: 20px; color: #555555">
<p style="line-height: 1.4em;">JavaScript is required for this site to work correctly but is either disabled or not supported by your browser.</p>
<p style="font-size:120%; padding:10px;"><a href="http://cappuccino-project.org/noscript">Show me how to enable JavaScript</a></p>
<p style="font-size:80%;">You may want to upgrade to a newer browser while you're at it:</p>
<ul style="margin:0;padding:0; text-align: center; font-size:80%;" >
<li style="display: inline;"><a href="http://www.apple.com/safari/download/">Safari</a></li>
<li style="display: inline;"><a href="http://www.mozilla.com/en-US/firefox/">Firefox</a></li>
<li style="display: inline;"><a href="http://www.google.com/chrome/">Chrome</a></li>
<li style="display: inline;"><a href="http://www.opera.com/download/">Opera</a></li>
<li style="display: inline;"><a href="http://www.microsoft.com/windows/downloads/ie/getitnow.mspx">Internet Explorer</a></li>
</ul>
</div>
</div>
</noscript>
</div>
</div>
</body>
</html>
+166
View File
@@ -0,0 +1,166 @@
<!DOCTYPE html>
<html lang="en">
<!--
index.html
__project.name__
Created by __user.name__ on __project.date__.
Copyright __project.year__, __organization.name__ All rights reserved.
-->
<head>
<meta charset="utf-8">
<!--[if lte IE 8]>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7, chrome=1">
<![endif]-->
<!--[if gte IE 9]>
<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
<![endif]-->
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="apple-touch-icon" href="Resources/icon.png">
<link rel="apple-touch-startup-image" href="Resources/default.png">
<title>__project.name__</title>
<!-- Custom javascript goes here -->
<!-- End custom javascript -->
<script type="text/javascript">
OBJJ_MAIN_FILE = "main.j";
// The below will tell the compiler to not generate debug symbols but will generate type signatures and inline objj_msgSend functions.
// This will affect only Objective-J code that is compiled when loading the application. It will not affect precompiled
// code like the Cappuccino frameworks.
// Uncomment or comment on the line below to change the flags
OBJJ_COMPILER_FLAGS = ["IncludeDebugSymbols", "IncludeTypeSignatures", "SourceMap", "InlineMsgSend"];
var progressBar = null;
OBJJ_PROGRESS_CALLBACK = function(percent, appSize, path)
{
percent = percent * 100;
if (!progressBar)
progressBar = document.getElementById("progress-bar");
if (progressBar)
progressBar.style.width = Math.min(percent, 100) + "%";
}
var loadingHTML =
'<div id="loading">' +
' <div id="loading-text">Loading...</div>' +
' <div id="progress-indicator">' +
' <span id="progress-bar" style="width:0%"></span>' +
' </div>' +
'</div>';
</script>
<script type="text/javascript" src="Frameworks/Objective-J/Objective-J.js" charset="UTF-8"></script>
<style type="text/css">
html, body, h1, p {
margin: 0;
padding: 0;
}
/* We need a body wrapper because Cappuccino is unhappy if we change the body element */
#cappuccino-body {
/* Position it absolutely so it will fill the height without content */
position: absolute;
top: 0;
bottom: 0;
width: 100%;
/* Put it at the bottom of the stack so it doesn't interfere with UI */
z-index: 0;
}
#cappuccino-body .container {
display: table;
margin: 0 auto;
height: 100%;
}
#cappuccino-body .content {
display: table-cell;
height: 100%;
vertical-align: top;
}
#loading {
position: relative;
top: 35%;
}
#loading-text {
height: 1.5em;
color: #555;
font: normal bold 36px/36px Arial, sans-serif;
}
#progress-indicator {
padding: 0px;
height: 16px;
border: 5px solid #555;
border-radius: 18px;
background-color: white;
}
#progress-bar {
position: relative;
top: -1px;
left: -1px;
display: block;
height: 18px;
/* Compensate for moving the bar left 1px to overlap the indicator border */
border-right: 1px solid #555;
background-color: #555;
}
#noscript {
position: relative;
top: 35%;
padding: 1em 1.5em;
border: 5px solid #555;
border-radius: 16px;
background-color: white;
color: #555;
text-align: center;
font: bold 24px Arial, sans-serif;
}
#noscript a {
color: #98c0ff;
text-decoration: none;
}
</style>
</head>
<body>
<div id="cappuccino-body">
<div class="container">
<div class="content">
<script type="text/javascript">
document.write(loadingHTML);
</script>
</div>
</div>
<noscript style="position:absolute; top:0; left:0; width:100%; height:100%">
<div class="container">
<div class="content">
<div id="noscript">
<p style="font-size:120%; margin-bottom:.75em">JavaScript is required for this application.</p>
<p><a href="http://www.enable-javascript.com" target="_blank">Enable JavaScript</a></p>
</div>
</div>
</div>
</noscript>
</div>
</body>
</html>
+16
View File
@@ -0,0 +1,16 @@
/*
* AppController.j
* CPLevelIndicator
*
*/
@import <Foundation/Foundation.j>
@import <AppKit/AppKit.j>
@import "AppController.j"
function main(args, namedArgs)
{
CPApplicationMain(args, namedArgs);
}
@@ -76,8 +76,8 @@
}
#pragma mark -
#pragma mark Delegate
// MARK: -
// MARK: Delegate
- (void)windowDidBecomeKey:(CPNotification)aNotification
{
+2 -2
View File
@@ -226,8 +226,8 @@
[aPopover setAppearance:appearance];
}
#pragma mark -
#pragma mark CPPopover Delegate
// MARK: -
// MARK: CPPopover Delegate
- (void)popoverWillShow:(CPPopover)aPopover
{
+4 -4
View File
@@ -141,8 +141,8 @@
// If we were using a Cib, initialization would happen here.
}
#pragma mark -
#pragma mark Actions
// MARK: -
// MARK: Actions
- (@action)toggleHidden:(id)sender
{
@@ -183,8 +183,8 @@
[stackViewHorizontal setSpacing:(current >= 20.0 ? 8.0 : current + 4.0)];
}
#pragma mark -
#pragma mark Helpers
// MARK: -
// MARK: Helpers
- (CPView)_createBoxColor:(CPColor)aColor size:(CGSize)aSize label:(CPString)text
{
+1 -1
View File
@@ -33,7 +33,7 @@
[[self scrollView] setDocumentView:pagePreview];
}
#pragma mark - Window delegate methods
// MARK: - Window delegate methods
- (CGSize)windowWillResize:(CPWindow)theWindow toSize:(CPSize)frameSize
{
if (![self pagePreviewBox])