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

This commit is contained in:
daboe01 committed 2026-01-02 21:53:59 +01:00
commit 3c1c01fd9f
109 files changed
+6700 -1153

No files matched your search

+12
View File
@@ -0,0 +1,12 @@
# EditorConfig reference: https://editorconfig.org
# https://editorconfig.org/#file-format-details
root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true
+1 -1
View File
@@ -16,7 +16,7 @@ jobs:
strategy:
matrix:
node-version: [17.x, 18.x, 19.x, 20.x, 21.x]
node-version: [20.x, 21.x, 22.x, 23.x, 24.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
@@ -0,0 +1,178 @@
name: Main branch - Build Testbook with fresh frameworks and manual tests & deploy to GitHub Pages
on:
push:
branches: [ main ]
workflow_dispatch:
permissions:
contents: write
pages: write # required by deploy-pages
id-token: write # required by deploy-pages
pull-requests: write
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout cappuccino (this repo)
uses: actions/checkout@v5
- name: Checkout Cappuccino-Testbook into ./testbook
uses: actions/checkout@v5
with:
repository: ArgosOz/Cappuccino-Testbook
path: testbook
- name: Use Node.js
uses: actions/setup-node@v4
- run: echo "${PWD}/dist/cappuccino/bin" >> $GITHUB_PATH
- run: echo "${PWD}/dist/objective-j/bin" >> $GITHUB_PATH
- run: npm install
- run: npm update
- run: jake dist
- run: jake test-only
# Refresh Frameworks from dist → testbook/Frameworks
- name: Refresh Frameworks
run: |
set -euo pipefail
if [ ! -d dist ]; then
echo "❌ dist/ not found at repo root" >&2
exit 1
fi
mkdir -p testbook/Frameworks
rm -rf testbook/Frameworks/*
cp -a dist/cappuccino/Frameworks/{Foundation,AppKit} testbook/Frameworks/
cp -a dist/objective-j/Frameworks/Objective-J testbook/Frameworks/
echo "Frameworks populated:" && ls -la testbook/Frameworks || true
- name: Generate manifest of manual test directories
if: ${{ hashFiles('Tests/Manual/**') != '' }}
run: |
set -euo pipefail
mkdir -p artifacts
OUT="testbook/Resources/recipes.txt"
: > "$OUT"
if [ ! -d "Tests/Manual" ]; then
echo "❌ Tests/Manual not found at repo root" >&2
exit 1
fi
# Iterate over immediate subdirectories of Tests/Manual (null-safe for spaces)
while IFS= read -r -d '' d; do
name=$(basename "$d")
ts=$(date +%s%3N) # milliseconds since epoch
printf '%s|%s|\n' "$ts" "$name" >> "$OUT"
# Optional tiny sleep to help keep timestamps distinct:
sleep 0.01
done < <(find "Tests/Manual" -mindepth 1 -maxdepth 1 -type d -print0 | sort -z)
echo "Wrote $OUT:"
cat "$OUT"
# Replace subdirectories inside testbook/Resources with Tests/Manual subdirectories
- name: Sync Resources from Tests/Manual
run: |
set -euo pipefail
if [ ! -d "Tests/Manual" ]; then
echo "❌ Tests/Manual not found at repo root" >&2
exit 1
fi
mkdir -p testbook/Resources
# Remove only immediate subdirectories (keep stray files if any)
find testbook/Resources -mindepth 1 -maxdepth 1 -type d -print0 | xargs -0 -r rm -rf
# Copy each immediate subdirectory from Tests/Manual → testbook/Resources
while IFS= read -r -d '' d; do
cp -a "$d" testbook/Resources/
done < <(find Tests/Manual -mindepth 1 -maxdepth 1 -type d -print0)
echo "Resources now contains:" && ls -la testbook/Resources || true
# Ensure each test Index.html includes the include path line before OBJJ_MAIN_FILE
- name: Inject OBJJ_INCLUDE_PATHS into Index.html files
run: |
set -euo pipefail
found=0
while IFS= read -r -d '' f; do
found=1
if grep -q 'OBJJ_INCLUDE_PATHS' "$f"; then
echo "Already updated: $f"
continue
fi
perl -0777 -i -pe 's/OBJJ_MAIN_FILE\s*=\s*"main\.j";/OBJJ_INCLUDE_PATHS = ["..\/..\/Frameworks"];\nOBJJ_MAIN_FILE = "main.j";/i' "$f"
perl -0777 -i -pe 's/Frameworks\/Objective-J\/Objective-J.js/\.\.\/\.\.\/Frameworks\/Objective-J\/Objective-J.js/' "$f"
echo "Updated: $f"
done < <(find testbook/Resources -mindepth 2 -maxdepth 2 -type f -iname "index.html" -print0)
if [ "$found" -eq 0 ]; then
echo "⚠️ No index.html files found under testbook/Resources/*/" >&2
fi
# Optional: prune VCS/CI metadata from the served content
- name: Clean testbook for Pages (optional)
run: |
set -euo pipefail
test -f testbook/index.html
test -d testbook/Resources
test -d testbook/Frameworks
rm -rf testbook/.git testbook/.github || true
find testbook -maxdepth 1 -type f -name ".git*" -delete || true
- name: Publish to gh-pages (preserve PR previews)
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: testbook
clean-exclude: pr-preview/ # keep PR preview folders
force: false # avoid force-push so previews survive
- name: Checkout gh-pages ./gh-pages
uses: actions/checkout@v5
with:
path: gh-pages
ref: gh-pages
- name: Clean gh-pages for Pages
run: |
set -euo pipefail
test -d gh-pages
rm -rf gh-pages/.git gh-pages/.github || true
find gh-pages -maxdepth 1 -type f -name ".git*" -delete || true
find gh-pages -type f -name "*.xib" -delete || true
find gh-pages -type f -name "*xcode*" -delete || true
find gh-pages -name "Jakefile" -delete || true
- name: Upload Pages artifact (testbook/)
uses: actions/upload-pages-artifact@v4
with:
path: gh-pages
deploy:
needs: build
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
concurrency:
group: pages
cancel-in-progress: true
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
- name: Comment Pages URL on PR
if: ${{ github.event_name == 'pull_request' }}
uses: actions/github-script@v7
with:
script: |
const url = `${{ toJSON(steps.deployment.outputs.page_url) }}`;
const body = `📄 GitHub Pages preview for this PR:\n\n${url}`;
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body
});
+1 -1
View File
@@ -25,4 +25,4 @@ node_modules
/dist/objective-j/lib
/dist/cappuccino/package.json
/dist/cappuccino/lib
/dist/cappuccino/bin
+44
View File
@@ -378,3 +378,47 @@ var DefaultLineWidth = 1.0;
}
@end
@implementation CPBezierPath (AnimationAdditions)
- (CPString)SVGString
{
var pathString = "";
var elements = _path.elements;
var count = _path.count;
for (var i = 0; i < count; i++)
{
var element = elements[i];
// Use the kCGPathElement* constants defined in CGPath.j
switch (element.type)
{
case kCGPathElementMoveToPoint:
pathString += "M " + element.x + " " + element.y + " ";
break;
case kCGPathElementAddLineToPoint:
pathString += "L " + element.x + " " + element.y + " ";
break;
case kCGPathElementAddQuadCurveToPoint:
pathString += "Q " + element.cpx + " " + element.cpy + " " + element.x + " " + element.y + " ";
break;
case kCGPathElementAddCurveToPoint:
pathString += "C " + element.cp1x + " " + element.cp1y + " " + element.cp2x + " " + element.cp2y + " " + element.x + " " + element.y + " ";
break;
case kCGPathElementCloseSubpath:
pathString += "Z ";
break;
}
}
return pathString.trim();
}
@end
+11 -4
View File
@@ -600,9 +600,12 @@ var HORIZONTAL_MARGIN = 2;
if (_maxNumberOfRows > 0)
numberOfRows = MIN(numberOfRows, _maxNumberOfRows);
height = MAX(height, numberOfRows * (_minItemSize.height + _verticalMargin));
// calculate the required height: (sum of item heights) + (sum of margins between items).
var requiredHeight = (numberOfRows * _minItemSize.height) + (MAX(0, numberOfRows - 1) * _verticalMargin);
height = MAX(height, requiredHeight);
var itemSizeHeight = FLOOR(height / numberOfRows) - _verticalMargin;
// calculate individual item height based on the total available height.
var itemSizeHeight = (numberOfRows > 0) ? FLOOR((height - (MAX(0, numberOfRows - 1) * _verticalMargin)) / numberOfRows) : 0;
if (maxItemSizeHeight > 0)
itemSizeHeight = MIN(itemSizeHeight, maxItemSizeHeight);
@@ -621,7 +624,7 @@ var HORIZONTAL_MARGIN = 2;
_horizontalMargin = _uniformSubviewsResizing ? FLOOR((aFrameSize.width - numberOfColumns * anItemSize.width) / (numberOfColumns + 1)) : HORIZONTAL_MARGIN;
var x = _horizontalMargin,
y = -anItemSize.height;
y = -anItemSize.height;
[displayItems enumerateObjectsUsingBlock:function(item, idx, stop)
{
@@ -636,7 +639,11 @@ var HORIZONTAL_MARGIN = 2;
if (idx % numberOfColumns == 0)
{
x = _horizontalMargin;
y += _verticalMargin + anItemSize.height;
// For the first row, don't add a margin. For all subsequent rows, add the margin.
if (idx === 0)
y += anItemSize.height;
else
y += _verticalMargin + anItemSize.height;
}
[view setFrameOrigin:CGPointMake(x, y)];
+5 -2
View File
@@ -871,10 +871,13 @@ var CPDocumentUntitledCount = 0;
{
var theDelegate = context.delegate;
if (aDocument === self && shouldClose)
// Only close the document explicitly if there is NO delegate to handle the action.
// If a delegate exists (e.g., the CPWindow), it is responsible for performing the close
// upon receiving the callback below. Calling [self close] here would cause a double-close.
if (aDocument === self && shouldClose && theDelegate == nil)
[self close];
if (theDelegate != null)
if (theDelegate)
theDelegate.isa.objj_msgSend3(theDelegate, context.selector, aDocument, shouldClose, context.context);
}
+56 -2
View File
@@ -26,6 +26,7 @@
@import "CPPasteboard.j"
@import "CPView.j"
@import "CPWindow_Constants.j"
@import "CPViewAnimation.j"
@class CPWindow // This file is imported by CPWindow.j
@class _CPDOMDataTransferPasteboard
@@ -132,6 +133,10 @@ var CPDraggingSource_draggedImage_movedTo_ = 1 << 0,
unsigned _dragOperation;
CPTimer _draggingUpdateTimer;
// Animation State
CGPoint _pendingEndLocation;
CPDragOperation _pendingEndOperation;
}
/*
@@ -261,10 +266,19 @@ var CPDraggingSource_draggedImage_movedTo_ = 1 << 0,
{
var contentView = [scrollView contentView],
bounds = [contentView bounds],
insetBounds = CGRectInset(bounds, 30, 30),
eventLocation = [contentView convertPoint:_draggingLocation fromView:nil],
deltaX = 0,
deltaY = 0;
deltaY = 0,
insetSize = 30;
if ([contentView respondsToSelector:@selector(documentView)] &&
[[contentView documentView] respondsToSelector:@selector(rowHeight)])
{
// Adjust inset bounds based on CPTableView row height
insetSize = MAX(insetSize, [[contentView documentView] rowHeight]);
}
var insetBounds = CGRectInset(bounds, insetSize, insetSize);
if (!CGRectContainsPoint(insetBounds, eventLocation))
{
@@ -316,6 +330,46 @@ var CPDraggingSource_draggedImage_movedTo_ = 1 << 0,
[_draggingUpdateTimer invalidate];
_draggingUpdateTimer = nil;
// Check if we should slide back (drag failed + slideBack requested)
if (![CPPlatform supportsDragAndDrop] && _shouldSlideBack && anOperation === CPDragOperationNone)
{
// Store state to finalize drag after animation completes
_pendingEndLocation = aLocation;
_pendingEndOperation = anOperation;
var currentFrame = [_draggedWindow frame],
targetFrame = CGRectMake(_startDragLocation.x, _startDragLocation.y, currentFrame.size.width, currentFrame.size.height);
// We use CPViewAnimation. Even though _draggedWindow is a CPWindow,
// CPViewAnimation supports targets that respond to setFrame: (like NSViewAnimation does for NSWindow).
var animation = [[CPViewAnimation alloc] initWithViewAnimations:[
[CPDictionary dictionaryWithObjects:[_draggedWindow, currentFrame, targetFrame]
forKeys:[CPViewAnimationTargetKey, CPViewAnimationStartFrameKey, CPViewAnimationEndFrameKey]]
]];
[animation setAnimationCurve:CPAnimationEaseOut];
[animation setDuration:0.25];
[animation setDelegate:self];
[animation startAnimation];
return;
}
[self _performFinalCleanupWithLocation:aLocation operation:anOperation];
}
- (void)animationDidEnd:(CPAnimation)anAnimation
{
[self _performFinalCleanupWithLocation:_pendingEndLocation operation:_pendingEndOperation];
}
- (void)animationDidStop:(CPAnimation)anAnimation
{
[self _performFinalCleanupWithLocation:_pendingEndLocation operation:_pendingEndOperation];
}
- (void)_performFinalCleanupWithLocation:(CGPoint)aLocation operation:(CPDragOperation)anOperation
{
[_draggedView removeFromSuperview];
if (![CPPlatform supportsDragAndDrop])
+39
View File
@@ -31,6 +31,7 @@
@import "CGGeometry.j"
@import "CPCompatibility.j"
@import "CPGraphicsContext.j"
@class CPColor
@global document
@@ -774,6 +775,44 @@ var CPImageCSSDictionaryKey = @"CPImageCSSDictionaryKey",
@end
#pragma mark -
#pragma mark Drawing
@implementation CPImage (Drawing)
- (void)drawAtPoint:(CGPoint)point fromRect:(CPRect)fromRect operation:(CGBlendMode)op fraction:(float)delta
{
if (_loadStatus !== CPImageLoadStatusCompleted)
return;
var context = [CPGraphicsContext currentContext].graphicsPort;
if (!context)
return;
CGContextSaveGState(context);
CGContextSetBlendMode(context, op);
CGContextSetAlpha(context, delta);
context.drawImage(
_image,
fromRect.origin.x,
fromRect.origin.y,
fromRect.size.width,
fromRect.size.height,
point.x,
point.y,
fromRect.size.width,
fromRect.size.height
);
CGContextRestoreGState(context);
}
@end
#pragma mark -
@implementation _CPMaterialIconImage : CPImage
+5 -1
View File
@@ -208,7 +208,11 @@ var CPBindingOperationAnd = 0,
options = [_info objectForKey:CPOptionsKey],
newValue = [destination valueForKeyPath:keyPath];
if (CPIsControllerMarker(newValue))
// give nil values the chance to be transformed to true via CPNegateBoolean (issue #1986)
if ((newValue == nil || CPIsControllerMarker(newValue)) && [options objectForKey:CPValueTransformerNameBindingOption] === CPNegateBooleanTransformerName)
[self setValue:[self transformValue:NO withOptions:options] forBinding:theBinding];
else if (CPIsControllerMarker(newValue))
{
[self raiseIfNotApplicable:newValue forKeyPath:keyPath options:options];
+54 -2
View File
@@ -27,6 +27,7 @@
@import "CPKeyValueBinding.j"
@import "CPMenuItem.j"
@import "CALayer.j"
@global CPApp
@@ -268,7 +269,8 @@ var _CPMenuBarVisible = NO,
if (self)
{
_title = aTitle;
_items = [];
// Use CPMutableArray instead of raw JS array for consistency with removeAllItems
_items = [CPMutableArray array];
_autoenablesItems = YES;
_showsStateColumn = YES;
@@ -373,6 +375,10 @@ var _CPMenuBarVisible = NO,
[self willChangeValueForKey:@"items"];
_items = [CPMutableArray array];
[self didChangeValueForKey:@"items"];
// Ensure the main menu updates if cleared
if (self === [CPApp mainMenu] && _CPMenuBarSharedWindow)
[_CPMenuBarSharedWindow setMenu:self];
}
/*!
@@ -389,6 +395,9 @@ var _CPMenuBarVisible = NO,
if ([aMenuItem menu] !== self || !_items)
return;
if (_menuWindow)
[[_menuWindow _menuView] tile];
[aMenuItem setValue:[aMenuItem valueForKey:@"changeCount"] + 1 forKey:@"changeCount"];
[[CPNotificationCenter defaultCenter]
@@ -1016,6 +1025,10 @@ var _CPMenuBarVisible = NO,
// an additional mouse move after all this, but not in other browsers.
// This will be fixed correctly with the coming run loop changes.
[_CPDisplayServer run];
// If layers are updated within the menu callback, the re-draw & re-layout doesn't occur until a mouse move.
// We force the update here.
[CALayer runLoopUpdateLayers];
}
/* @ignore */
@@ -1057,7 +1070,13 @@ var _CPMenuBarVisible = NO,
if ([anEvent _triggersKeyEquivalent:[item keyEquivalent] withModifierMask:[item keyEquivalentModifierMask]])
{
if ([item isEnabled])
{
// Flash the top-level item if this is the Main Menu
if (self === [CPApp mainMenu])
[self _flashItemAtIndex:index];
[self performActionForItemAtIndex:index];
}
else
{
//beep?
@@ -1067,7 +1086,13 @@ var _CPMenuBarVisible = NO,
}
if ([[item submenu] performKeyEquivalent:anEvent])
{
// Flash the top-level item if a submenu handled the event
if (self === [CPApp mainMenu])
[self _flashItemAtIndex:index];
return YES;
}
}
return NO;
@@ -1147,6 +1172,25 @@ var _CPMenuBarVisible = NO,
return nil;
}
//
/*
@ignore
*/
- (void)_flashItemAtIndex:(int)anIndex
{
// If we are using a native bridge (like a desktop wrapper), let the OS handle the visual feedback.
if ([CPPlatform supportsNativeMainMenu])
return;
[self _highlightItemAtIndex:anIndex];
[self performSelector:@selector(_stopFlashingItem) withObject:nil afterDelay:0.2];
}
- (void)_stopFlashingItem
{
[self _highlightItemAtIndex:CPNotFound];
}
@end
@@ -1218,6 +1262,11 @@ var _CPMenuBarVisible = NO,
postNotificationName:CPMenuDidAddItemNotification
object:self
userInfo:@{ @"CPMenuItemIndex": anIndex }];
// FIX #1222: If this is the main menu, force the shared menu bar window to refresh its layout.
// This ensures new items are positioned correctly (e.g. not pushed to the far right by previous layout states).
if (self === [CPApp mainMenu] && _CPMenuBarSharedWindow)
[_CPMenuBarSharedWindow setMenu:self];
}
- (void)removeObjectFromItemsAtIndex:(CPUInteger)anIndex
@@ -1233,6 +1282,10 @@ var _CPMenuBarVisible = NO,
postNotificationName:CPMenuDidRemoveItemNotification
object:self
userInfo:@{ @"CPMenuItemIndex": anIndex }];
// FIX #1222: Ensure the shared menu bar updates layout when items are removed.
if (self === [CPApp mainMenu] && _CPMenuBarSharedWindow)
[_CPMenuBarSharedWindow setMenu:self];
}
@end
@@ -1326,4 +1379,3 @@ var CPMenuTitleKey = @"CPMenuTitleKey",
@import "_CPMenuBarWindow.j"
@import "_CPMenuWindow.j"
+49 -23
View File
@@ -370,12 +370,41 @@
- (void)tile
{
var bounds = [[self contentView] bounds],
height = CGRectGetHeight(bounds),
x = [[CPTheme defaultTheme] valueForAttributeWithName:@"menu-bar-window-left-margin" forClass:_CPMenuView];
// 1. Layout the Icon (if present)
if (_iconImageView && ![_iconImageView isHidden])
{
var iconFrame = [_iconImageView frame];
iconFrame.origin.x = x;
// Vertically center
iconFrame.origin.y = (height - CGRectGetHeight(iconFrame)) / 2.0;
[_iconImageView setFrame:iconFrame];
x = CGRectGetMaxX(iconFrame) + 6.0; // Spacing between icon and title
}
// 2. Layout the Title (if present)
if (_titleField && [_titleField stringValue] && [[_titleField stringValue] length] > 0)
{
var titleFrame = [_titleField frame];
titleFrame.origin.x = x;
titleFrame.origin.y = (height - CGRectGetHeight(titleFrame)) / 2.0;
[_titleField setFrame:titleFrame];
x = CGRectGetMaxX(titleFrame) + 12.0; // Spacing between title and menu items
}
// 3. Layout the Menu Items
var items = [_menu itemArray],
index = 0,
count = items.length,
x = [[CPTheme defaultTheme] valueForAttributeWithName:@"menu-bar-window-left-margin" forClass:_CPMenuView],
y = 0.0,
count = items ? items.length : 0,
isLeftAligned = YES;
for (; index < count; ++index)
@@ -390,11 +419,18 @@
continue;
}
if ([item isHidden])
// Fix for #1742: If a main menu item does not have a submenu, it should not appear in the menu bar.
if ([item isHidden] || ![item submenu])
{
[[item _menuItemView] setHidden:YES];
continue;
}
var menuItemView = [item _menuItemView],
frame = [menuItemView frame];
var menuItemView = [item _menuItemView];
[menuItemView setHidden:NO];
var frame = [menuItemView frame];
if (isLeftAligned)
{
@@ -409,21 +445,6 @@
x = CGRectGetMinX([menuItemView frame]);
}
}
var bounds = [[self contentView] bounds],
titleFrame = [_titleField frame];
if ([_iconImageView isHidden])
[_titleField setFrameOrigin:CGPointMake((CGRectGetWidth(bounds) - CGRectGetWidth(titleFrame)) / 2.0, (CGRectGetHeight(bounds) - CGRectGetHeight(titleFrame)) / 2.0)];
else
{
var iconFrame = [_iconImageView frame],
iconWidth = CGRectGetWidth(iconFrame),
totalWidth = iconWidth + CGRectGetWidth(titleFrame);
[_iconImageView setFrameOrigin:CGPointMake((CGRectGetWidth(bounds) - totalWidth) / 2.0, (CGRectGetHeight(bounds) - CGRectGetHeight(iconFrame)) / 2.0)];
[_titleField setFrameOrigin:CGPointMake((CGRectGetWidth(bounds) - totalWidth) / 2.0 + iconWidth, (CGRectGetHeight(bounds) - CGRectGetHeight(titleFrame)) / 2.0)];
}
}
- (void)setFrame:(CGRect)aRect display:(BOOL)shouldDisplay animate:(BOOL)shouldAnimate
@@ -464,13 +485,18 @@
{
var item = items[index];
if ([item isHidden] || [item isSeparatorItem])
if ([item isHidden] || [item isSeparatorItem] || ![item submenu])
continue;
if (CGRectContainsPoint([self rectForItemAtIndex:index], aPoint))
return index;
}
// If the mouse is within the menu bar bounds but not over an item
// (e.g. dragging far left or right), force the menu to unhighlight.
if (CGRectContainsPoint([[self contentView] bounds], aPoint))
[_menu _highlightItemAtIndex:CPNotFound];
return CPNotFound;
}
+13
View File
@@ -234,6 +234,19 @@ _CPMenuWindowAttachedMenuBackgroundStyle = 2;
// FIXME: This gets called far too often.
_unconstrainedFrame = CGRectMakeCopy(aFrame);
// If we are a submenu and we are being displayed off the right of the screen,
// we should try and display on the left of our supermenu.
var supermenu = [[self menu] supermenu];
if (supermenu && (CGRectGetMaxX(_unconstrainedFrame) > CGRectGetMaxX(_constraintRect)))
{
var supermenuWindow = supermenu._menuWindow;
if (supermenuWindow)
{
var supermenuFrame = [supermenuWindow frame];
_unconstrainedFrame.origin.x = CGRectGetMinX(supermenuFrame) - CGRectGetWidth(_unconstrainedFrame);
}
}
var constrainedFrame = CGRectIntersection(_unconstrainedFrame, _constraintRect),
marginInset = [_menuView valueForThemeAttribute:@"menu-window-margin-inset"],
scrollIndicatorHeight = [_menuView valueForThemeAttribute:@"menu-window-scroll-indicator-height"];
+3 -2
View File
@@ -808,7 +808,8 @@ var CPObjectControllerContentKey = @"CPObjectControllerCo
var value = [self _controllerMarkerForValues:values];
[_cachedValues setObject:value forKey:theKeyPath];
return value;
// Apple's implementation returns nil instead of CPNullMarker
return value === CPNullMarker ? nil : value;
}
else
return values;
@@ -948,4 +949,4 @@ var CPManagedProxyEntityNameKey = @"CPManagedProxyEntity
[aCoder encodeObject:[self fetchPredicate] forKey:CPManagedProxyFetchPredicateKey];
}
@end
@end
+96
View File
@@ -127,16 +127,112 @@ var CPOutlineViewCoalesceSelectionNotificationStateOff = 0,
@protocol CPOutlineViewDataSource <CPObject>
@optional
/*!
@abstract Invoked when a drag operation concludes over the outline view.
@discussion The data source should incorporate the data from the dragging pasteboard and update its data model.
@param anOutlineView The outline view that is the destination of the drop.
@param info An object that contains information about the dragging session.
@param anItem The item that is the proposed parent for the dropped data. If anItem is nil, the data is to be dropped at the root level.
@param anIndex The index at which to drop the data among the item's children. If you want to drop on anItem, this will be CPOutlineViewDropOnItemIndex (-1).
@return YES if the drop was successful; otherwise, NO.
*/
- (BOOL)outlineView:(CPOutlineView)anOutlineView acceptDrop:(id /*<CPDraggingInfo>*/)info item:(id)anItem childIndex:(CPInteger)anIndex;
/*!
@abstract Asks the data source whether to defer displaying the children of a given item.
@discussion This method is useful for implementing lazy loading of outline view data. Returning NO prevents the outline view from querying for children of anItem, even if it is expandable.
@param anOutlineView The outline view that sent the message.
@param anItem The item being considered for expansion.
@return YES to allow the outline view to query for children of anItem; otherwise, NO. The default is YES.
*/
- (BOOL)outlineView:(CPOutlineView)anOutlineView shouldDeferDisplayingChildrenOfItem:(id)anItem;
/*!
@abstract Invoked when a drag should begin.
@discussion The data source should write the representation of the specified items to the pasteboard.
@param anOutlineView The outline view that is the source of the drag.
@param items An array of items to be dragged.
@param pboard The pasteboard to which the data for the dragged items should be written.
@return YES if the drag should begin; NO to prevent the drag.
*/
- (BOOL)outlineView:(CPOutlineView)anOutlineView writeItems:(CPArray)items toPasteboard:(CPPasteboard)pboard;
/*!
@abstract Used for promised-file dragging.
@discussion When a promised-file drag is dropped, this method is invoked to ask the data source to create the files at the specified destination and return their names.
@param anOutlineView The outline view that was the source of the drag.
@param dropDestination The URL of the directory where the files should be created.
@param items The items that were dragged, representing the promised files.
@return An array of strings containing the names of the files that were created.
*/
- (CPArray)outlineView:(CPOutlineView)anOutlineView namesOfPromisedFilesDroppedAtDestination:(CPURL)dropDestination forDraggedItems:(CPArray)items;
/*!
@abstract Invoked to determine if a drop is allowed at a specified location.
@discussion This method is called repeatedly while the user drags over the outline view. It should return the drag operation that should be performed.
@param anOutlineView The outline view that is the destination of the drag.
@param info An object that contains information about the dragging session.
@param anItem The item that is the proposed parent for the dropped data.
@param anIndex The index at which to drop the data among the item's children. If you want to drop on anItem, this will be CPOutlineViewDropOnItemIndex (-1).
@return A CPDragOperation value that indicates the type of operation to perform.
*/
- (CPDragOperation)outlineView:(CPOutlineView)anOutlineView validateDrop:(id /*<CPDraggingInfo>*/)info proposedItem:(id)anItem proposedChildIndex:(CPInteger)anIndex;
/*!
@abstract Invoked to determine if a drop is allowed at a specified row.
@discussion This is a legacy method from CPTableView. It is recommended to implement outlineView:validateDrop:proposedItem:proposedChildIndex: instead for more precise control in an outline view.
@param anOutlineView The outline view that is the destination of the drag.
@param info An object that contains information about the dragging session.
@param theRow The proposed row for the drop.
@param theOperation The proposed drop operation (CPTableViewDropOn or CPTableViewDropAbove).
@return A CPDragOperation value that indicates the type of operation to perform.
*/
- (CPDragOperation)outlineView:(CPOutlineView)anOutlineView validateDrop:(id /*<CPDraggingInfo>*/)info proposedRow:(int)theRow proposedDropOperation:(CPTableViewDropOperation)theOperation;
/*!
@abstract Used for state preservation.
@discussion This method is called to convert a persistent, serializable object back into a model item.
@param anOutlineView The outline view requesting the item.
@param anObject The persistent object used to identify the model item.
@return The model item corresponding to anObject, or nil if it cannot be found.
*/
- (id)outlineView:(CPOutlineView)anOutlineView itemForPersistentObject:(id)anObject;
/*!
@abstract Returns the data object to be displayed for a given item and column.
@discussion This method is called by the outline view to get the value for each cell. It is required for cell-based outline views.
@param anOutlineView The outline view that sent the message.
@param aTableColumn The column for which the value is requested.
@param anItem The item for the row being displayed.
@return The data object (e.g., a CPString) for the specified item and column.
*/
- (id)outlineView:(CPOutlineView)anOutlineView objectValueforTableColumn:(CPTableColumn)aTableColumn byItem:(id)anItem;
/*!
@abstract Used for state preservation.
@discussion This method is called to convert a model item into a persistent, serializable object (e.g., a string identifier) that can be saved.
@param anOutlineView The outline view requesting the persistent object.
@param anItem The item to be converted.
@return A serializable object that persistently identifies anItem.
*/
- (id)outlineView:(CPOutlineView)anOutlineView persistentObjectForItem:(id)anItem;
/*!
@abstract Sets the data object for a given item and column.
@discussion This method is called when the user edits a cell's value. The data source should update its model with the new value.
@param anOutlineView The outline view that sent the message.
@param anObject The new value.
@param aTableColumn The column that was edited.
@param anItem The item whose value was edited.
*/
- (void)outlineView:(CPOutlineView)anOutlineView setObjectValue:(id)anObject forTableColumn:(CPTableColumn)aTableColumn byItem:(id)anItem;
/*!
@abstract Notifies the data source that the sort descriptors have changed.
@discussion This method is called after the user clicks a column header to change the sort order. The data source should re-sort its data based on the outline view's new 'sortDescriptors' property and then call `reloadData`.
@param anOutlineView The outline view that sent the message.
@param oldDescriptors The previous sort descriptors.
*/
- (void)outlineView:(CPOutlineView)anOutlineView sortDescriptorsDidChange:(CPArray)oldDescriptors;
@end
+6 -1
View File
@@ -1774,7 +1774,12 @@ TODO: implement
- (_CPRuleEditorViewSliceRow)_createNewSliceWithFrame:(CGRect)frame ruleEditorView:(CPRuleEditor)editor
{
return [[_CPRuleEditorViewSliceRow alloc] initWithFrame:frame ruleEditorView:editor];
var slice = [[_CPRuleEditorViewSliceRow alloc] initWithFrame:frame ruleEditorView:editor];
// Ensure the slice resizes with the editor
[slice setAutoresizingMask:CPViewWidthSizable];
return slice;
}
- (void)_reconfigureSubviewsAnimate:(BOOL)animate
+13
View File
@@ -94,6 +94,10 @@ var TIMER_INTERVAL = 0.2,
CPScrollViewFadeOutTime = 1.3;
var CPScrollViewWillStartLiveScrollNotification = @"CPScrollViewWillStartLiveScrollNotification",
CPScrollViewDidLiveScrollNotification = @"CPScrollViewDidLiveScrollNotification",
CPScrollViewDidEndLiveScrollNotification = @"CPScrollViewDidEndLiveScrollNotification";
var CPScrollerStyleGlobal = CPScrollerStyleOverlay,
CPScrollerStyleGlobalChangeNotification = @"CPScrollerStyleGlobalChangeNotification";
@@ -1024,6 +1028,8 @@ Notifies the delegate when the scroll view has finished scrolling.
[self _sendDelegateMessages];
[_contentView scrollToPoint:contentBounds.origin];
[[CPNotificationCenter defaultCenter] postNotificationName:CPScrollViewDidLiveScrollNotification object:self];
}
/* @ignore */
@@ -1062,6 +1068,8 @@ Notifies the delegate when the scroll view has finished scrolling.
[_contentView scrollToPoint:contentBounds.origin];
[_headerClipView scrollToPoint:CGPointMake(contentBounds.origin.x, 0.0)];
[[CPNotificationCenter defaultCenter] postNotificationName:CPScrollViewDidLiveScrollNotification object:self];
}
/* @ignore */
@@ -1072,6 +1080,7 @@ Notifies the delegate when the scroll view has finished scrolling.
if (!_scrollTimer)
{
[[CPNotificationCenter defaultCenter] postNotificationName:CPScrollViewWillStartLiveScrollNotification object:self];
[self _scrollViewWillScroll];
_scrollTimer = [CPTimer scheduledTimerWithTimeInterval:TIMER_INTERVAL target:self selector:@selector(_scrollViewDidScroll) userInfo:nil repeats:YES];
}
@@ -1110,6 +1119,8 @@ Notifies the delegate when the scroll view has finished scrolling.
[_contentView scrollToPoint:constrainedOrigin];
[_headerClipView scrollToPoint:CGPointMake(constrainedOrigin.x, 0.0)];
[[CPNotificationCenter defaultCenter] postNotificationName:CPScrollViewDidLiveScrollNotification object:self];
if (extraX || extraY)
[enclosingScrollView _respondToScrollWheelEventWithDeltaX:extraX deltaY:extraY];
}
@@ -1129,6 +1140,8 @@ Notifies the delegate when the scroll view has finished scrolling.
if (_implementedDelegateMethods & CPScrollViewDelegate_scrollViewDidScroll_)
[_delegate scrollViewDidScroll:self];
[[CPNotificationCenter defaultCenter] postNotificationName:CPScrollViewDidEndLiveScrollNotification object:self];
}
/*! @ignore*/
+5 -4
View File
@@ -573,10 +573,11 @@ CPSegmentSwitchTrackingMomentary = 2;
}
else if (aName === "right-segment-bezel")
{
return CGRectMake(CGRectGetWidth([self bounds]) - contentInset.right,
bezelInset.top,
contentInset.right,
height);
// we have to FLOOR the coordinates to prevent a 1px glitch in Safari
return CGRectMake(FLOOR(CGRectGetWidth([self bounds]) - contentInset.right),
FLOOR(bezelInset.top),
FLOOR(contentInset.right),
FLOOR(height));
}
else if (aName.indexOf("segment-bezel") === 0)
{
+6
View File
@@ -312,6 +312,12 @@ var AFFINITY = 5;
if (!trackRect || CGRectIsEmpty(trackRect))
trackRect = bounds;
if (_allowsTickMarkValuesOnly)
{
[self closestTickMarkValueToValue:[self doubleValue]]; // we only need the side effect …
_currentTickMarkSegment = _closestTickMarkIndex;
}
if (_isCircular)
{
var angle = 3 * PI_2 - (1.0 - [self doubleValue] - _minValue) / (_maxValue - _minValue) * PI2,
+388
View File
@@ -0,0 +1,388 @@
/*
* CPSplitViewController.j
*
* Created by Daniel Boehringer on September 2, 2025.
* Copyright (c) 2025 Daniel Boehringer. All rights reserved.
*
* 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 "CPViewController.j"
@import "CPSplitView.j"
var CPSplitViewControllerAutomaticDimension = -1.0;
/**
* A container view controller that manages two or more child view
* controllers in a split view interface.
*
* This class provides a controller-level abstraction for CPSplitView,
* managing the addition, removal, and arrangement of view controllers
* through CPSplitViewItem instances.
*
* This implementation was synthesized with the assistance of an LLM,
* directed by the author.
*/
@implementation CPSplitViewController : CPViewController <CPSplitViewDelegate>
{
/** @private The underlying split view that arranges the child views. */
CPSplitView _splitView;
/** @private An array of CPSplitViewItem objects managed by this controller. */
CPMutableArray _splitViewItems;
/** @private The minimum thickness for sidebars to be displayed inline. */
CPNumber _minimumThicknessForInlineSidebars;
}
// MARK: - Initialization
- (id)init
{
if (self = [super init])
{
_splitViewItems = [CPMutableArray array];
_minimumThicknessForInlineSidebars = 20.0;
}
return self;
}
// MARK: - View Lifecycle
- (void)loadView
{
if (!_splitView)
{
_splitView = [[CPSplitView alloc] initWithFrame:CGRectMake(0,0,400,400)];
[_splitView setDelegate:self];
}
[self setView:_splitView];
}
- (void)viewDidLoad
{
[super viewDidLoad];
for (var i = 0; i < [_splitViewItems count]; i++)
{
var viewController = [[_splitViewItems objectAtIndex:i] viewController];
[[self splitView] addArrangedSubview:[viewController view]];
}
}
// MARK: - Accessors
/**
* Returns the CPSplitView instance managed by the controller.
*
* @returns {CPSplitView} The split view.
*/
- (CPSplitView)splitView
{
return _splitView;
}
/**
* Sets a custom split view for the controller.
*
* @param {CPSplitView} splitView The custom split view to use.
*/
- (void)setSplitView:(CPSplitView)splitView
{
if (_splitView !== splitView)
{
_splitView = splitView;
[_splitView setDelegate:self];
if ([self isViewLoaded])
[self setView:_splitView];
}
}
/**
* Returns the array of split view items.
*
* @returns {CPArray} The array of CPSplitViewItem objects.
*/
- (CPArray)splitViewItems
{
return _splitViewItems;
}
/**
* Sets the array of split view items, replacing any existing items.
*
* @param {CPArray} splitViewItems An array of CPSplitViewItem objects.
*/
- (void)setSplitViewItems:(CPArray)splitViewItems
{
// Remove all existing items
while ([_splitViewItems count] > 0)
{
[self removeSplitViewItem:[_splitViewItems lastObject]];
}
// Add new items
for (var i = 0; i < [splitViewItems count]; i++)
{
[self addSplitViewItem:[splitViewItems objectAtIndex:i]];
}
}
// MARK: - Managing Split View Items
/**
* Adds a split view item to the end of the split view.
*
* @param {CPSplitViewItem} splitViewItem The split view item to add.
*/
- (void)addSplitViewItem:(CPSplitViewItem)splitViewItem
{
[self insertSplitViewItem:splitViewItem atIndex:[_splitViewItems count]];
}
/**
* Inserts a split view item at a specific index.
*
* @param {CPSplitViewItem} splitViewItem The split view item to insert.
* @param {CPInteger} index The zero-based index at which to insert the item.
*/
- (void)insertSplitViewItem:(CPSplitViewItem)splitViewItem atIndex:(CPInteger)index
{
[splitViewItem _setSplitViewController:self];
[_splitViewItems insertObject:splitViewItem atIndex:index];
[self addChildViewController:[splitViewItem viewController]];
if ([self isViewLoaded])
[[self splitView] insertArrangedSubview:[[splitViewItem viewController] view] atIndex:index];
}
/**
* Removes the specified split view item.
*
* @param {CPSplitViewItem} splitViewItem The split view item to remove.
*/
- (void)removeSplitViewItem:(CPSplitViewItem)splitViewItem
{
var viewController = [splitViewItem viewController];
if ([self isViewLoaded])
[[viewController view] removeFromSuperview];
[viewController removeFromParentViewController];
[splitViewItem _setSplitViewController:nil];
[_splitViewItems removeObject:splitViewItem];
}
/**
* Retrieves the split view item associated with a given view controller.
*
* @param {CPViewController} viewController The view controller to find.
* @returns {CPSplitViewItem | null} The corresponding split view item, or nil if not found.
*/
- (CPSplitViewItem)splitViewItemForViewController:(CPViewController)viewController
{
for (var i = 0; i < [_splitViewItems count]; i++)
{
var item = [_splitViewItems objectAtIndex:i];
if ([item viewController] === viewController)
return item;
}
return nil;
}
// MARK: - Managing Sidebars and Inspectors
/**
* Toggles the collapsed state of the first split view item, typically a sidebar.
*
* @param {id} sender The object that initiated the action.
*/
- (void)toggleSidebar:(id)sender
{
if ([_splitViewItems count] > 0)
{
var sidebarItem = [_splitViewItems objectAtIndex:0];
[sidebarItem setCollapsed:![sidebarItem isCollapsed]];
}
}
/**
* Toggles the collapsed state of the last split view item, typically an inspector.
*
* @param {id} sender The object that initiated the action.
*/
- (void)toggleInspector:(id)sender
{
if ([_splitViewItems count] > 1)
{
var inspectorItem = [_splitViewItems lastObject];
[inspectorItem setCollapsed:![inspectorItem isCollapsed]];
}
}
/**
* Returns the minimum thickness for sidebars to be displayed inline.
*
* @returns {CPNumber} The minimum thickness.
*/
- (CPNumber)minimumThicknessForInlineSidebars
{
return _minimumThicknessForInlineSidebars;
}
// MARK: - CPSplitViewDelegate Methods
// Note: A more complete implementation would forward these delegate methods
// to a separate delegate property on the CPSplitViewController itself.
// For now, these are stubbed to demonstrate where they would be handled.
- (BOOL)splitView:(CPSplitView)splitView canCollapseSubview:(CPView)subview
{
// Default behavior: allow all subviews to be collapsed.
return YES;
}
- (CGFloat)splitView:(CPSplitView)splitView constrainMinCoordinate:(CGFloat)proposedMinimumPosition ofSubviewAt:(CPInteger)dividerIndex
{
return proposedMinimumPosition;
}
- (CGFloat)splitView:(CPSplitView)splitView constrainMaxCoordinate:(CGFloat)proposedMaximumPosition ofSubviewAt:(CPInteger)dividerIndex
{
return proposedMaximumPosition;
}
- (CGRect)splitView:(CPSplitView)splitView effectiveRect:(CGRect)proposedEffectiveRect forDrawnRect:(CGRect)drawnRect ofDividerAtIndex:(CPInteger)dividerIndex
{
// Default behavior: return the proposed rectangle.
// This can be overridden to provide a larger or custom hit area for the divider.
return proposedEffectiveRect;
}
- (void)splitViewDidResizeSubviews:(CPNotification)notification
{
// Can be used to respond to user-initiated resizing.
}
@end
/**
* An object that manages a view controller within a CPSplitViewController.
*
* A CPSplitViewItem acts as a wrapper around a CPViewController,
* maintaining properties like its collapsed state within the parent
* split view controller.
*/
@implementation CPSplitViewItem : CPObject
{
/** @private The view controller managed by this item. */
CPViewController _viewController;
/** @private A boolean indicating whether the item is collapsed. */
BOOL _isCollapsed;
/** @private A weak reference to the owning split view controller. */
CPSplitViewController _splitViewController;
}
// MARK: - Class Methods
/**
* Creates and returns a new split view item with the specified view controller.
*
* @param {CPViewController} viewController The view controller for the new item.
* @returns {instancetype} A new CPSplitViewItem instance.
*/
+ (instancetype)splitViewItemWithViewController:(CPViewController)viewController
{
return [[self alloc] initWithViewController:viewController];
}
// MARK: - Initialization
/**
* Initializes a new split view item with the specified view controller.
*
* @param {CPViewController} viewController The view controller for the new item.
* @returns {id} The initialized CPSplitViewItem instance.
*/
- (id)initWithViewController:(CPViewController)viewController
{
if (self = [super init])
{
_viewController = viewController;
_isCollapsed = NO;
}
return self;
}
// MARK: - Accessors
/**
* Returns the view controller associated with the item.
*
* @returns {CPViewController} The associated view controller.
*/
- (CPViewController)viewController
{
return _viewController;
}
/**
* Returns a boolean value indicating whether the item is collapsed.
*
* @returns {BOOL} YES if the item is collapsed, otherwise NO.
*/
- (BOOL)isCollapsed
{
return _isCollapsed;
}
/**
* Sets the collapsed state of the item.
* When collapsed, the view controller's view is hidden.
*
* @param {BOOL} shouldCollapse YES to collapse the item, NO to expand it.
*/
- (void)setCollapsed:(BOOL)shouldCollapse
{
if (_isCollapsed === shouldCollapse)
return;
_isCollapsed = shouldCollapse;
[[_viewController view] setHidden:shouldCollapse];
}
/**
* Returns the split view controller that owns this item.
*
* @returns {CPSplitViewController | null} The parent split view controller.
*/
- (CPSplitViewController)splitViewController
{
return _splitViewController;
}
/**
* @private
* Sets the owning split view controller. This method is for internal use by
* CPSplitViewController.
*
* @param {CPSplitViewController} splitViewController The parent controller.
*/
- (void)_setSplitViewController:(CPSplitViewController)splitViewController
{
_splitViewController = splitViewController;
}
@end
+700
View File
@@ -0,0 +1,700 @@
/*
* CPStackView.j
* AppKit
*
* Created by Daniel Boehringer.
* Copyright 2025, Cappuccino Project.
*
* 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
*/
#include "../Foundation/Foundation.h"
@import "CPView.j"
// Gravity Areas
@typedef CPStackViewGravity
CPStackViewGravityTop = 1;
CPStackViewGravityLeading = 1;
CPStackViewGravityCenter = 2;
CPStackViewGravityBottom = 3;
CPStackViewGravityTrailing = 3;
// Distribution (Deprecated in modern macOS, but kept for compatibility/logic)
@typedef CPStackViewDistribution
CPStackViewDistributionGravityAreas = 0;
CPStackViewDistributionFill = 1;
CPStackViewDistributionFillEqually = 2;
CPStackViewDistributionFillProportionally = 3;
CPStackViewDistributionEqualSpacing = 4;
CPStackViewDistributionEqualCentering = 5;
// Visibility Priority
@typedef CPStackViewVisibilityPriority
CPStackViewVisibilityPriorityMustHold = 1000.0;
CPStackViewVisibilityPriorityNotVisible = 0.0;
var CPStackViewSpacingUseDefault = 3.40282347e+38; // FLT_MAX
/*!
@ingroup appkit
@class CPStackView
CPStackView arranges an array of views horizontally or vertically and updates
their placement and sizing when the window size changes.
Unlike a simple list, CPStackView supports "Gravity Areas" (Leading, Center, Trailing),
allowing you to pin groups of views to specific sections of the layout.
*/
@implementation CPStackView : CPView
{
CPUserInterfaceLayoutOrientation _orientation;
CPLayoutAttribute _alignment;
float _spacing;
CPEdgeInsets _edgeInsets;
BOOL _detachesHiddenViews;
// View Storage by Gravity
CPMutableArray _viewsLeading;
CPMutableArray _viewsCenter;
CPMutableArray _viewsTrailing;
// Internal cache of all arranged subviews to maintain order for hittesting/iterating
CPMutableArray _arrangedSubviews;
// Custom Spacing storage
CPMapTable _customSpacings;
// Visibility Priorities
CPMapTable _visibilityPriorities;
}
#pragma mark -
#pragma mark Initialization
+ (CPStackView)stackViewWithViews:(CPArray)views
{
var stackView = [[CPStackView alloc] initWithFrame:CGRectMakeZero()];
for (var i = 0, count = [views count]; i < count; i++)
[stackView addView:views[i] inGravity:CPStackViewGravityLeading];
return stackView;
}
- (id)initWithFrame:(CGRect)aFrame
{
if (self = [super initWithFrame:aFrame])
{
_orientation = CPUserInterfaceLayoutOrientationHorizontal;
_alignment = CPLayoutAttributeCenterY; // Default alignment
_spacing = 8.0; // Default Cocoa spacing
_edgeInsets = CPEdgeInsetsMake(0, 0, 0, 0);
_detachesHiddenViews = YES;
_viewsLeading = [[CPMutableArray alloc] init];
_viewsCenter = [[CPMutableArray alloc] init];
_viewsTrailing = [[CPMutableArray alloc] init];
_arrangedSubviews = [[CPMutableArray alloc] init];
_customSpacings = [[CPMapTable alloc] init];
_visibilityPriorities = [[CPMapTable alloc] init];
}
return self;
}
#pragma mark -
#pragma mark Configuration
/*!
The horizontal or vertical layout direction of the stack view.
*/
- (CPUserInterfaceLayoutOrientation)orientation
{
return _orientation;
}
- (void)setOrientation:(CPUserInterfaceLayoutOrientation)anOrientation
{
if (_orientation === anOrientation)
return;
_orientation = anOrientation;
// Reset default alignment based on new orientation if needed,
// though usually developer sets alignment explicitly.
// If switching to Vertical, CenterY makes less sense, usually CenterX.
if (_orientation === CPUserInterfaceLayoutOrientationVertical)
{
if (_alignment === CPLayoutAttributeCenterY)
_alignment = CPLayoutAttributeCenterX;
}
else
{
if (_alignment === CPLayoutAttributeCenterX)
_alignment = CPLayoutAttributeCenterY;
}
[self setNeedsLayout:YES];
}
/*!
The view alignment within the stack view.
Common values:
Horizontal: CPLayoutAttributeTop, CPLayoutAttributeBottom, CPLayoutAttributeCenterY, CPLayoutAttributeHeight (fill)
Vertical: CPLayoutAttributeLeading, CPLayoutAttributeTrailing, CPLayoutAttributeCenterX, CPLayoutAttributeWidth (fill)
*/
- (CPLayoutAttribute)alignment
{
return _alignment;
}
- (void)setAlignment:(CPLayoutAttribute)anAlignment
{
if (_alignment === anAlignment)
return;
_alignment = anAlignment;
[self setNeedsLayout:YES];
}
/*!
The minimum spacing, in points, between adjacent views in the stack view.
*/
- (float)spacing
{
return _spacing;
}
- (void)setSpacing:(float)aSpacing
{
if (_spacing === aSpacing)
return;
_spacing = aSpacing;
[self setNeedsLayout:YES];
}
/*!
The geometric padding, in points, inside the stack view, surrounding its views.
*/
- (CPEdgeInsets)edgeInsets
{
return _edgeInsets;
}
- (void)setEdgeInsets:(CPEdgeInsets)insets
{
if (CPEdgeInsetsEqualToEdgeInsets(_edgeInsets, insets))
return;
_edgeInsets = insets;
[self setNeedsLayout:YES];
}
/*!
A Boolean value that indicates whether the stack view removes hidden views from its view hierarchy.
*/
- (BOOL)detachesHiddenViews
{
return _detachesHiddenViews;
}
- (void)setDetachesHiddenViews:(BOOL)shouldDetach
{
if (_detachesHiddenViews === shouldDetach)
return;
_detachesHiddenViews = shouldDetach;
[self setNeedsLayout:YES];
}
#pragma mark -
#pragma mark Managing Views in Gravity Areas
- (CPArray)_containerForGravity:(CPStackViewGravity)gravity
{
if (gravity === CPStackViewGravityCenter)
return _viewsCenter;
else if (gravity === CPStackViewGravityTrailing) // or Bottom
return _viewsTrailing;
return _viewsLeading; // Leading or Top
}
/*!
Adds a view to the end of the stack view gravity area.
*/
- (void)addView:(CPView)aView inGravity:(CPStackViewGravity)gravity
{
var container = [self _containerForGravity:gravity];
// Check if view is already in a container
if ([_arrangedSubviews containsObject:aView])
[self removeView:aView];
[container addObject:aView];
[_arrangedSubviews addObject:aView];
// Add as actual subview
if ([aView superview] !== self)
[self addSubview:aView];
[self setNeedsLayout:YES];
}
/*!
Adds a view to a stack view gravity area at a specified index position.
*/
- (void)insertView:(CPView)aView atIndex:(CPInteger)index inGravity:(CPStackViewGravity)gravity
{
var container = [self _containerForGravity:gravity];
if ([_arrangedSubviews containsObject:aView])
[self removeView:aView];
if (index >= [container count])
[container addObject:aView];
else
[container insertObject:aView atIndex:index];
[_arrangedSubviews addObject:aView];
if ([aView superview] !== self)
[self addSubview:aView];
[self setNeedsLayout:YES];
}
/*!
Specifies an array of views for a specified gravity area in the stack view, replacing any previous views in that area.
*/
- (void)setViews:(CPArray)views inGravity:(CPStackViewGravity)gravity
{
var container = [self _containerForGravity:gravity];
// Remove old views from arranged list and superview
for (var i = 0; i < [container count]; i++)
{
var oldView = container[i];
[oldView removeFromSuperview];
[_arrangedSubviews removeObject:oldView];
}
[container removeAllObjects];
for (var i = 0; i < [views count]; i++)
{
var newView = views[i];
[container addObject:newView];
[_arrangedSubviews addObject:newView];
[self addSubview:newView];
}
[self setNeedsLayout:YES];
}
/*!
Removes a specified view from the stack view.
*/
- (void)removeView:(CPView)aView
{
if (![_arrangedSubviews containsObject:aView])
return;
[_viewsLeading removeObject:aView];
[_viewsCenter removeObject:aView];
[_viewsTrailing removeObject:aView];
[_arrangedSubviews removeObject:aView];
[aView removeFromSuperview];
[self setNeedsLayout:YES];
}
/*!
Returns the array of views in the specified gravity area in the stack view.
*/
- (CPArray)viewsInGravity:(CPStackViewGravity)gravity
{
return [[self _containerForGravity:gravity] copy];
}
/*!
The array of views arranged by the stack view.
*/
- (CPArray)arrangedSubviews
{
return [_arrangedSubviews copy];
}
/*!
Adds the specified view to the end of the arranged subviews list.
(Defaults to Leading gravity if not specified).
*/
- (void)addArrangedSubview:(CPView)view
{
[self addView:view inGravity:CPStackViewGravityLeading];
}
/*!
Removes the provided view from the stack’s array of arranged subviews.
*/
- (void)removeArrangedSubview:(CPView)view
{
[self removeView:view];
}
#pragma mark -
#pragma mark Custom Spacing
- (float)customSpacingAfterView:(CPView)aView
{
var val = [_customSpacings objectForKey:aView];
if (val)
return [val floatValue];
return CPStackViewSpacingUseDefault;
}
- (void)setCustomSpacing:(float)spacing afterView:(CPView)aView
{
if (spacing === CPStackViewSpacingUseDefault)
[_customSpacings removeObjectForKey:aView];
else
[_customSpacings setObject:spacing forKey:aView];
[self setNeedsLayout:YES];
}
- (float)_spacingAfterView:(CPView)aView
{
var custom = [self customSpacingAfterView:aView];
if (custom !== CPStackViewSpacingUseDefault)
return custom;
return _spacing;
}
#pragma mark -
#pragma mark Visibility Priority
- (void)setVisibilityPriority:(float)priority forView:(CPView)aView
{
[_visibilityPriorities setObject:priority forKey:aView];
if (priority === CPStackViewVisibilityPriorityNotVisible)
{
[aView setHidden:YES];
}
else if (priority === CPStackViewVisibilityPriorityMustHold)
{
[aView setHidden:NO];
}
// Note: Intermediate priorities require complex constraint logic
// or a multi-pass layout system to determine fitting, which is
// simplified here to basic Hidden/Visible states.
[self setNeedsLayout:YES];
}
- (float)visibilityPriorityForView:(CPView)aView
{
var val = [_visibilityPriorities objectForKey:aView];
if (val)
return [val floatValue];
return CPStackViewVisibilityPriorityMustHold;
}
#pragma mark -
#pragma mark Layout
- (void)resizeSubviewsWithOldSize:(CGSize)oldSize
{
[self layoutSubviews];
}
- (void)layoutSubviews
{
if (_orientation === CPUserInterfaceLayoutOrientationVertical)
[self _layoutVertical];
else
[self _layoutHorizontal];
}
- (void)_layoutHorizontal
{
var bounds = [self bounds],
availWidth = CGRectGetWidth(bounds) - _edgeInsets.left - _edgeInsets.right,
availHeight = CGRectGetHeight(bounds) - _edgeInsets.top - _edgeInsets.bottom,
currentX = _edgeInsets.left;
// 1. Layout Leading Views
currentX = [self _layoutViews:_viewsLeading startOffset:currentX availableOrthogonalSize:availHeight direction:1];
// 2. Layout Trailing Views
// We layout backwards from the right
var startRight = CGRectGetWidth(bounds) - _edgeInsets.right;
[self _layoutViews:_viewsTrailing startOffset:startRight availableOrthogonalSize:availHeight direction:-1];
// 3. Layout Center Views
if ([_viewsCenter count] > 0)
{
// Calculate total width of center stack
var centerStackWidth = 0.0;
for (var i = 0; i < [_viewsCenter count]; i++)
{
var view = _viewsCenter[i];
if (_detachesHiddenViews && [view isHidden]) continue;
centerStackWidth += CGRectGetWidth([view frame]);
if (i < [_viewsCenter count] - 1)
centerStackWidth += [self _spacingAfterView:view];
}
var centerStart = (CGRectGetWidth(bounds) / 2.0) - (centerStackWidth / 2.0);
// Clamp to prevent overlap with Leading (simplified collision logic)
// ideally stack view compresses views, but here we just shift/clip
if (centerStart < currentX)
centerStart = currentX;
[self _layoutViews:_viewsCenter startOffset:centerStart availableOrthogonalSize:availHeight direction:1];
}
}
- (void)_layoutVertical
{
var bounds = [self bounds],
availWidth = CGRectGetWidth(bounds) - _edgeInsets.left - _edgeInsets.right,
availHeight = CGRectGetHeight(bounds) - _edgeInsets.top - _edgeInsets.bottom,
currentY = _edgeInsets.top;
// 1. Layout Top (Leading) Views
currentY = [self _layoutViews:_viewsLeading startOffset:currentY availableOrthogonalSize:availWidth direction:1];
// 2. Layout Bottom (Trailing) Views
var startBottom = CGRectGetHeight(bounds) - _edgeInsets.bottom;
[self _layoutViews:_viewsTrailing startOffset:startBottom availableOrthogonalSize:availWidth direction:-1];
// 3. Layout Center Views
if ([_viewsCenter count] > 0)
{
var centerStackHeight = 0.0;
for (var i = 0; i < [_viewsCenter count]; i++)
{
var view = _viewsCenter[i];
if (_detachesHiddenViews && [view isHidden]) continue;
centerStackHeight += CGRectGetHeight([view frame]);
if (i < [_viewsCenter count] - 1)
centerStackHeight += [self _spacingAfterView:view];
}
var centerStart = (CGRectGetHeight(bounds) / 2.0) - (centerStackHeight / 2.0);
if (centerStart < currentY)
centerStart = currentY;
[self _layoutViews:_viewsCenter startOffset:centerStart availableOrthogonalSize:availWidth direction:1];
}
}
// Helper to layout a specific array of views in one direction
// Returns the ending offset
- (float)_layoutViews:(CPArray)views startOffset:(float)offset availableOrthogonalSize:(float)orthoSize direction:(int)dir
{
var cursor = offset;
var isVert = (_orientation === CPUserInterfaceLayoutOrientationVertical);
// If direction is -1 (Trailing/Bottom), we iterate backwards
// However, the standard behavior for trailing gravity is that the *last* view added is at the *end*.
// Leading: [A] [B] ->
// Trailing: -> [C] [D] (where D is rightmost)
// To support Trailing logic: We start at Right Edge, move left by Width(D), place D, move left by Spacing...
var count = [views count];
if (count === 0) return cursor;
// If direction is negative (Trailing), we process list in reverse order to stack them from edge inwards
var i = (dir === 1) ? 0 : count - 1;
var limit = (dir === 1) ? count : -1;
var step = (dir === 1) ? 1 : -1;
for (; i !== limit; i += step)
{
var view = views[i];
if (_detachesHiddenViews && [view isHidden])
continue;
var viewFrame = [view frame];
var viewSizePrimary = isVert ? CGRectGetHeight(viewFrame) : CGRectGetWidth(viewFrame);
// Handle Alignment (Orthogonal Axis)
var orthoPos = 0.0;
var viewOrthoSize = isVert ? CGRectGetWidth(viewFrame) : CGRectGetHeight(viewFrame);
// Apply Stretch/Fill Alignment
if (isVert)
{
// Vertical Stack, dealing with Width
if (_alignment === CPLayoutAttributeWidth || _alignment === CPLayoutAttributeLeading || _alignment === CPLayoutAttributeTrailing)
{
// Note: CPLayoutAttributeLeading/Trailing in this context implies filling width usually,
// or aligning to edges. Let's assume Width/Fill for Leading/Trailing/Left/Right
// in this simplified implementation, or strictly left/right.
if (_alignment === CPLayoutAttributeWidth || _alignment === CPLayoutAttributeLeft || _alignment === CPLayoutAttributeLeading)
{
// Fill width if explicit, or just align left
if (_alignment === CPLayoutAttributeWidth) viewOrthoSize = orthoSize;
orthoPos = _edgeInsets.left;
}
else if (_alignment === CPLayoutAttributeRight || _alignment === CPLayoutAttributeTrailing)
{
orthoPos = _edgeInsets.left + (orthoSize - viewOrthoSize);
}
else // CenterX
{
orthoPos = _edgeInsets.left + (orthoSize - viewOrthoSize) / 2.0;
}
}
else // Default CenterX
{
orthoPos = _edgeInsets.left + (orthoSize - viewOrthoSize) / 2.0;
}
}
else
{
// Horizontal Stack, dealing with Height
if (_alignment === CPLayoutAttributeHeight || _alignment === CPLayoutAttributeTop || _alignment === CPLayoutAttributeBottom)
{
if (_alignment === CPLayoutAttributeHeight)
{
viewOrthoSize = orthoSize;
orthoPos = _edgeInsets.top;
}
else if (_alignment === CPLayoutAttributeTop)
{
orthoPos = _edgeInsets.top;
}
else if (_alignment === CPLayoutAttributeBottom)
{
orthoPos = _edgeInsets.top + (orthoSize - viewOrthoSize);
}
else // CenterY
{
orthoPos = _edgeInsets.top + (orthoSize - viewOrthoSize) / 2.0;
}
}
else // Default CenterY
{
orthoPos = _edgeInsets.top + (orthoSize - viewOrthoSize) / 2.0;
}
}
// Calculate Position
var originX = 0.0, originY = 0.0;
var sizeW = 0.0, sizeH = 0.0;
if (isVert)
{
// Vertical
sizeH = viewSizePrimary;
sizeW = viewOrthoSize;
originX = orthoPos;
if (dir === 1) {
originY = cursor;
cursor += sizeH + [self _spacingAfterView:view];
} else {
cursor -= sizeH;
originY = cursor;
cursor -= [self _spacingAfterView:view];
}
}
else
{
// Horizontal
sizeW = viewSizePrimary;
sizeH = viewOrthoSize;
originY = orthoPos;
if (dir === 1) {
originX = cursor;
cursor += sizeW + [self _spacingAfterView:view];
} else {
cursor -= sizeW;
originX = cursor;
cursor -= [self _spacingAfterView:view];
}
}
[view setFrame:CGRectMake(originX, originY, sizeW, sizeH)];
}
return cursor;
}
#pragma mark -
#pragma mark CPCoding
- (id)initWithCoder:(CPCoder)aCoder
{
self = [super initWithCoder:aCoder];
if (self)
{
_orientation = [aCoder decodeIntForKey:@"CPStackViewOrientation"];
_alignment = [aCoder decodeIntForKey:@"CPStackViewAlignment"];
_spacing = [aCoder decodeFloatForKey:@"CPStackViewSpacing"];
_edgeInsets = [aCoder decodeObjectForKey:@"CPStackViewEdgeInsets"]; // Assuming CPEdgeInsets supports obj coding or manual decode
if (!_edgeInsets) _edgeInsets = CPEdgeInsetsMake(0,0,0,0);
_detachesHiddenViews = [aCoder decodeBoolForKey:@"CPStackViewDetachesHiddenViews"];
_viewsLeading = [aCoder decodeObjectForKey:@"CPStackViewViewsLeading"] || [];
_viewsCenter = [aCoder decodeObjectForKey:@"CPStackViewViewsCenter"] || [];
_viewsTrailing = [aCoder decodeObjectForKey:@"CPStackViewViewsTrailing"] || [];
// Rebuild arranged subviews cache
_arrangedSubviews = [[CPMutableArray alloc] init];
[_arrangedSubviews addObjectsFromArray:_viewsLeading];
[_arrangedSubviews addObjectsFromArray:_viewsCenter];
[_arrangedSubviews addObjectsFromArray:_viewsTrailing];
_customSpacings = [aCoder decodeObjectForKey:@"CPStackViewCustomSpacings"] || [[CPMapTable alloc] init];
_visibilityPriorities = [[CPMapTable alloc] init]; // usually not persisted
}
return self;
}
- (void)encodeWithCoder:(CPCoder)aCoder
{
[super encodeWithCoder:aCoder];
[aCoder encodeInt:_orientation forKey:@"CPStackViewOrientation"];
[aCoder encodeInt:_alignment forKey:@"CPStackViewAlignment"];
[aCoder encodeFloat:_spacing forKey:@"CPStackViewSpacing"];
[aCoder encodeObject:_edgeInsets forKey:@"CPStackViewEdgeInsets"];
[aCoder encodeBool:_detachesHiddenViews forKey:@"CPStackViewDetachesHiddenViews"];
[aCoder encodeObject:_viewsLeading forKey:@"CPStackViewViewsLeading"];
[aCoder encodeObject:_viewsCenter forKey:@"CPStackViewViewsCenter"];
[aCoder encodeObject:_viewsTrailing forKey:@"CPStackViewViewsTrailing"];
[aCoder encodeObject:_customSpacings forKey:@"CPStackViewCustomSpacings"];
}
@end
+1 -1
View File
@@ -1472,7 +1472,7 @@ CPTextFieldStatePlaceholder = CPThemeState("placeholder");
![self isBezeled] &&
(lineBreakMode === CPLineBreakByWordWrapping || lineBreakMode === CPLineBreakByCharWrapping))
{
textSize = [text sizeWithFont:font inWidth:textSize.width] + 1;
textSize = [text sizeWithFont:font inWidth:textSize.width];
}
else
{
+1 -2
View File
@@ -1353,9 +1353,8 @@ var _objectsInRange = function(aList, aRange)
if (!_RectEqualToRectHorizontally(newLineFragment._fragmentRect, _fragmentRect))
return NO;
if (newFragmentRuns[i].color !== oldFragmentRuns[i].color || newFragmentRuns[i].font !== oldFragmentRuns[i].font)
if (newFragmentRuns[i].color !== oldFragmentRuns[i].color || newFragmentRuns[i].bgcolor !== oldFragmentRuns[i].bgcolor || newFragmentRuns[i].font !== oldFragmentRuns[i].font)
return NO;
}
return YES;
+1 -2
View File
@@ -116,6 +116,7 @@ var kDelegateRespondsTo_textShouldBeginEditing
/*!
@ingroup appkit
@class CPTextView
Copy / Paste is only fully supported with a CPMenu (can be hidden)
*/
@implementation CPTextView : CPText
{
@@ -2718,8 +2719,6 @@ var _CPCopyPlaceholder = '-';
if (![currentFirstResponder respondsToSelector:@selector(_activateNativeInputElement:)])
return false; // prevent the default behaviour
var charCode = _CPNativeInputField.innerHTML.charCodeAt(0);
// chrome-trigger: keypressed is omitted for deadkeys
if (!_CPNativeInputFieldActive && _CPNativeInputFieldKeyPressedCalled == NO && _CPNativeInputField.innerHTML.length && _CPNativeInputField.innerHTML != _CPCopyPlaceholder && _CPNativeInputField.innerHTML.length < 3)
{
+8 -2
View File
@@ -585,6 +585,12 @@ CPTokenFieldDeleteButtonType = 1;
// Snap to the token if it's only half visible due to mouse wheel scrolling.
_shouldScrollTo = aToken;
}
// this is a hack to compensate for a recent adoption in FR management as introduced by commit #26aab29
// this PR makes the tokenfield loose FR status prematurely, so we have to regain here in order to make deleteForward: and friends work
setTimeout(function(){
[[self window] makeFirstResponder:self];
}, 50);
}
// ===========
@@ -965,8 +971,8 @@ CPTokenFieldDeleteButtonType = 1;
[self _selectToken:tokenView byExtendingSelection:NO];
}
}
else
[self _removeSelectedTokens:nil];
// we have to remove unconditionally because the backspace is not propagated anymore starting from commit #26aab29
[self _removeSelectedTokens:nil];
}
else
{
+15
View File
@@ -1014,6 +1014,7 @@ var LABEL_MARGIN = 2.0;
CPImageView _imageView;
CPView _view;
CPView _highlightView;
CPTextField _labelField;
@@ -1243,6 +1244,18 @@ var LABEL_MARGIN = 2.0;
if (alternateImage)
[_imageView setImage:alternateImage];
else
{
if (!_highlightView)
{
_highlightView = [[CPView alloc] initWithFrame:[_imageView bounds]];
[_highlightView setBackgroundColor:[CPColor blackColor]];
[_highlightView setAlphaValue:0.3];
[_highlightView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable];
}
[_imageView addSubview:_highlightView];
}
[_labelField setTextShadowOffset:CGSizeMakeZero()];
}
@@ -1253,6 +1266,8 @@ var LABEL_MARGIN = 2.0;
if (image)
[_imageView setImage:image];
[_highlightView removeFromSuperview];
[_labelField setTextShadowOffset:CGSizeMake(0.0, 1.0)];
}
+90 -14
View File
@@ -603,7 +603,8 @@ var CPViewHighDPIDrawingEnabled = YES;
// We will have to adjust the z-index of all views starting at this index.
var count = _subviews.length,
lastWindow;
lastWindow,
isNewAddOrMove = aSubview._superview !== self;
// Dirty the key view loop, in case the window wants to auto recalculate it
[[self window] _dirtyKeyViewLoop];
@@ -662,6 +663,11 @@ var CPViewHighDPIDrawingEnabled = YES;
#endif
}
#if PLATFORM(DOM)
var origin = aSubview._frame.origin;
CPDOMDisplayServerSetStyleLeftTop(aSubview._DOMElement, _boundsTransform, origin.x, origin.y);
#endif
[aSubview setNextResponder:self];
[aSubview _scaleSizeUnitSquareToSize:[self _hierarchyScaleSize]];
@@ -674,6 +680,9 @@ var CPViewHighDPIDrawingEnabled = YES;
if (!_window && lastWindow)
[aSubview _setWindow:nil];
if (isNewAddOrMove)
[aSubview _postViewDidAppearNotification];
// This method might be called before we are fully unarchived, in which case the theme state isn't set up yet
// and none of the below matters anyhow.
if (_themeState)
@@ -736,6 +745,7 @@ var CPViewHighDPIDrawingEnabled = YES;
// If the view is not hidden and one of its ancestors is hidden,
// notify the view that it is now unhidden.
[self _setSuperview:nil];
[self _postViewDidDisappearNotification];
[self _notifyWindowDidResignKey];
[self _notifyViewDidResignFirstResponder];
@@ -1406,6 +1416,9 @@ var CPViewHighDPIDrawingEnabled = YES;
_inverseBoundsTransform = nil;
}
if (_layer)
[_layer _owningViewBoundsChanged];
#if PLATFORM(DOM)
var index = _subviews.length;
@@ -1462,6 +1475,9 @@ var CPViewHighDPIDrawingEnabled = YES;
origin.y *= size.height / frameSize.height;
}
if (_layer)
[_layer _owningViewBoundsChanged];
if (_postsBoundsChangedNotifications && !_inhibitFrameAndBoundsChangedNotifications)
[CachedNotificationCenter postNotificationName:CPViewBoundsDidChangeNotification object:self];
@@ -1720,11 +1736,7 @@ var CPViewHighDPIDrawingEnabled = YES;
_superview = aSuperview;
if (hasOldSuperview)
[self _postViewDidDisappearNotification];
if (hasNewSuperview)
[self _postViewDidAppearNotification];
// Notifications are now posted manually from _insertSubview and _removeFromSuperview
}
- (void)_recursiveLostHiddenAncestor
@@ -3215,7 +3227,8 @@ setBoundsOrigin:
{
_layer._owningView = nil;
#if PLATFORM(DOM)
_DOMElement.removeChild(_layer._DOMElement);
if (_layer._DOMElement && _layer._DOMElement.parentNode === _DOMElement)
_DOMElement.removeChild(_layer._DOMElement);
#endif
}
@@ -3223,33 +3236,56 @@ setBoundsOrigin:
if (_layer)
{
var bounds = CGRectMakeCopy([self bounds]);
[_layer _setOwningView:self];
[_layer setFrame:[self bounds]]; // Sync layer frame with view bounds
#if PLATFORM(DOM)
_layer._DOMElement.style.zIndex = 100;
_DOMElement.appendChild(_layer._DOMElement);
#endif
}
}
/*!
Returns the core animation layer used by the receiver.
Returns the core animation layer used by the receiver and creates one if necessary.
*/
- (CALayer)layer
{
if (_wantsLayer && !_layer)
{
var layer = [[CALayer alloc] init];
[self setLayer:layer];
[self setNeedsLayout:YES];
[self setNeedsDisplay:YES];
}
return _layer;
}
/*!
Sets whether the receiver wants a core animation layer.
@param \c YES means the receiver wants a layer.
@param aFlag \c YES means the receiver wants a layer.
*/
- (void)setWantsLayer:(BOOL)aFlag
{
_wantsLayer = !!aFlag;
aFlag = !!aFlag;
if (_wantsLayer === aFlag)
return;
_wantsLayer = aFlag;
if (_wantsLayer)
{
// Accessing the layer will create it if it doesn't exist.
[self layer];
}
else
{
// Remove the layer if we no longer want it.
if (_layer)
[self setLayer:nil];
}
}
/*!
@@ -3261,6 +3297,38 @@ setBoundsOrigin:
return _wantsLayer;
}
/*!
Rotates the view's visual representation by a given angle (in degrees) around its center point.
This method achieves the rotation by applying a transform directly to the view's backing CALayer.
Because this is a direct layer manipulation, the view's own `frame` property is not updated to
reflect the new visual bounding box. Consequently, a `CPViewBoundsDidChangeNotification` is
**not** posted by this method. Note that this is a deviation from Cocoa's behavior.
This method requires the view to be layer-backed. If the view is not
already layer-backed, this method will automatically set wantsLayer to YES.
@param angle The angle in degrees to rotate the view.
*/
- (void)rotateByAngle:(CGFloat)angle
{
// Ensure the view is layer-backed
[self setWantsLayer:YES];
var layer = [self layer];
if (!layer)
return;
// Convert degrees to radians for the transform
var radians = angle * Math.PI / 180.0;
var rotationTransform = CGAffineTransformMakeRotation(radians);
var currentTransform = [layer affineTransform];
var newTransform = CGAffineTransformConcat(currentTransform, rotationTransform);
[layer setAffineTransform:newTransform];
}
@end
@@ -3766,7 +3834,8 @@ var CPViewAutoresizingMaskKey = @"CPViewAutoresizingMask",
CPViewSizeScaleKey = @"CPViewSizeScaleKey",
CPViewIsScaledKey = @"CPViewIsScaledKey",
CPViewAppearanceKey = @"CPViewAppearanceKey",
CPViewTrackingAreasKey = @"CPViewTrackingAreasKey";
CPViewTrackingAreasKey = @"CPViewTrackingAreasKey",
CPViewWantsLayerKey = @"CPViewWantsLayerKey";
@implementation CPView (CPCoding)
@@ -3869,6 +3938,10 @@ var CPViewAutoresizingMaskKey = @"CPViewAutoresizingMask",
_opacity = 1.0;
[self setBackgroundColor:[aCoder decodeObjectForKey:CPViewBackgroundColorKey]];
if ([aCoder containsValueForKey:CPViewWantsLayerKey])
[self setWantsLayer:[aCoder decodeBoolForKey:CPViewWantsLayerKey]];
[self _setupViewFlags];
[self setAppearance:[aCoder decodeObjectForKey:CPViewAppearanceKey]];
@@ -3956,6 +4029,9 @@ var CPViewAutoresizingMaskKey = @"CPViewAutoresizingMask",
if (_identifier)
[aCoder encodeObject:_identifier forKey:CPReuseIdentifierKey];
if (_wantsLayer)
[aCoder encodeBool:_wantsLayer forKey:CPViewWantsLayerKey];
[aCoder encodeSize:[self scaleSize] forKey:CPViewScaleKey];
[aCoder encodeSize:[self _hierarchyScaleSize] forKey:CPViewSizeScaleKey];
[aCoder encodeBool:_isScaled forKey:CPViewIsScaledKey];
+26 -1
View File
@@ -166,7 +166,7 @@ var CPViewControllerCachedCibs;
if (!cib)
{
// if the cib isn't cached yet : fetch it and cache it
// if the cib isn't cached yet: fetch it and cache it
cib = [[CPCib alloc] initWithCibNamed:_cibName bundle:_cibBundle];
[CPViewControllerCachedCibs setObject:cib forKey:_cibName];
}
@@ -261,6 +261,11 @@ var CPViewControllerCachedCibs;
if (_view == nil && [cibOwner isKindOfClass:[CPDocument class]])
[self setView:[cibOwner valueForKey:@"view"]];
// If the view was just loaded, we must set its next responder.
// This is the first half of inserting the controller into the responder chain.
if (_view)
[_view setNextResponder:self];
if (!_view)
{
var reason = [CPString stringWithFormat:@"View for %@ could not be loaded from Cib or no view specified. Override loadView to load the view manually.", self];
@@ -408,12 +413,28 @@ var CPViewControllerCachedCibs;
[self willChangeValueForKey:"isViewLoaded"];
_view = aView;
// When the view is set manually, we must set its next responder.
if (_view)
[_view setNextResponder:self];
_isViewLoaded = aView != nil;
if (willChangeIsViewLoaded)
[self didChangeValueForKey:"isViewLoaded"];
}
/*!
@method nextResponder
@discussion The CPViewController implementation of this method returns the superview
of the view controller's view. This is the second half of the insertion,
completing the chain: view -> viewController -> superview.
*/
- (id)nextResponder
{
return [_view superview];
}
- (BOOL)automaticallyNotifiesObserversOfIsViewLoaded
{
return NO;
@@ -465,6 +486,10 @@ var CPViewControllerViewKey = @"CPViewControllerViewKey",
if (self)
{
_view = [aCoder decodeObjectForKey:CPViewControllerViewKey];
// When the view is unarchived, we must also set its next responder.
if (_view)
[_view setNextResponder:self];
_title = [aCoder decodeObjectForKey:CPViewControllerTitleKey];
_cibName = [aCoder decodeObjectForKey:CPViewControllerCibNameKey];
+21 -2
View File
@@ -1,12 +1,28 @@
@import <Foundation/CPObject.j>
@import "CAPropertyAnimation.j"
// Value calculation modes
kCAAnimationLinear = @"linear";
kCAAnimationDiscrete = @"discrete";
kCAAnimationPaced = @"paced";
kCAAnimationCubic = @"cubic";
kCAAnimationCubicPaced = @"cubicPaced";
// Rotation Mode Values
kCAAnimationRotateAuto = @"auto";
kCAAnimationRotateAutoReverse = @"autoReverse";
@implementation CAKeyframeAnimation : CAPropertyAnimation
{
CPArray _values @accessors(property=values);
CPArray _keyTimes @accessors(property=keyTimes);
CPArray _timingFunctions @accessors(property=timingFunctions);
id _path @accessors(property=path);
CPString _calculationMode @accessors(property=calculationMode);
CPString _rotationMode @accessors(property=rotationMode);
CPArray _tensionValues @accessors(property=tensionValues);
CPArray _continuityValues @accessors(property=continuityValues);
CPArray _biasValues @accessors(property=biasValues);
}
- (id)init
@@ -16,8 +32,11 @@
_values = [CPArray array];
_keyTimes = [CPArray array];
_timingFunctions = [CPArray array];
_tensionValues = [CPArray array];
_continuityValues = [CPArray array];
_biasValues = [CPArray array];
return self;
}
@end
@end
+39 -11
View File
@@ -164,9 +164,36 @@ var _CPAnimationContextStack = nil,
if ([animation isKindOfClass:[CAKeyframeAnimation class]])
{
values = [animation values];
keyTimes = [animation keyTimes];
timingFunctions = [animation timingFunctionsControlPoints];
var path = [animation path];
var calculationMode = [animation calculationMode] || kCAAnimationLinear; // Default to linear
var rotationMode = [animation rotationMode];
var tensionValues = [animation tensionValues];
var continuityValues = [animation continuityValues];
var biasValues = [animation biasValues];
return {
object: anObject,
root: anObject,
keypath: animatedKeyPath,
duration: duration,
completion: completionFunction,
// Keyframe-specific properties
values: values,
keytimes: keyTimes,
timingfunctions: timingFunctions,
path: path,
calculationMode: calculationMode,
rotationMode: rotationMode,
tensionValues: tensionValues,
continuityValues: continuityValues,
biasValues: biasValues
};
}
else
{
@@ -183,18 +210,19 @@ var _CPAnimationContextStack = nil,
values = [fromValue, toValue];
keyTimes = [0, 1];
timingFunctions = isBasicAnimation ? [animation timingFunctionControlPoints] : [_timingFunction controlPoints];
}
return {
object:anObject,
root:anObject,
keypath:animatedKeyPath,
values:values,
keytimes:keyTimes,
duration:duration,
timingfunctions:timingFunctions,
completion:completionFunction
};
// Return a basic animation action
return {
object:anObject,
root:anObject,
keypath:animatedKeyPath,
values:values,
keytimes:keyTimes,
duration:duration,
timingfunctions:timingFunctions,
completion:completionFunction
};
}
}
- (void)_flushAnimations
+105 -2
View File
@@ -1,4 +1,3 @@
@import "_CPObjectAnimator.j"
@import "CPView.j"
@import "CPCompatibility.j"
@@ -116,6 +115,13 @@ var DEFAULT_CSS_PROPERTIES = nil,
{
var target = anAction.object;
if (anAction.path)
{
// Path animations are handled differently. They don't map to standard properties like width/height.
// They use CSS offset-path.
return [self _addPathAnimation:animations forAction:anAction domElement:[target _DOMElement] identifier:[target UID]];
}
return [self _addAnimations:animations forAction:anAction domElement:[target _DOMElement] identifier:[target UID]];
}
@@ -132,6 +138,20 @@ var DEFAULT_CSS_PROPERTIES = nil,
[animations addObject:animation];
}
var calculationMode = anAction.calculationMode;
var timingFunctions = anAction.timingfunctions;
if (calculationMode === kCAAnimationDiscrete)
{
// For discrete animations, we use the steps() timing function.
// This makes the property jump between values.
timingFunctions = "steps(1, end)";
}
// For other calculation modes like 'paced' or 'cubic', more complex logic would be needed here.
// 'paced' would require pre-calculating keyTimes based on distance.
// 'cubic' would require generating many keyframes to simulate a spline.
// For now, we let them fall through to the default behavior.
var css_mapping = [self _cssPropertiesForKeyPath:anAction.keypath];
[css_mapping enumerateObjectsUsingBlock:function(aDict, anIndex, stop)
@@ -140,10 +160,93 @@ var DEFAULT_CSS_PROPERTIES = nil,
property = [aDict objectForKey:@"property"],
getter = [aDict objectForKey:@"value"];
animation.addPropertyAnimation(property, getter, anAction.duration, anAction.keytimes, anAction.values, anAction.timingfunctions, completionFunction);
animation.addPropertyAnimation(property, getter, anAction.duration, anAction.keytimes, anAction.values, timingFunctions, completionFunction);
}];
}
+ (void)_addPathAnimation:(CPArray)animations forAction:(id)anAction domElement:(Object)aDomElement identifier:(CPString)anIdentifier
{
var animation = [animations objectPassingTest:function(anim, idx, stop)
{
return anim.identifier == anIdentifier;
}];
if (animation == nil)
{
animation = new CSSAnimation(aDomElement, anIdentifier, [anAction.object debug_description]);
[animations addObject:animation];
}
// 1. Get the SVG path string.
var svgPath = [anAction.path SVGString];
// 2. Set the offset-path property.
aDomElement.style.offsetPath = "path('" + svgPath + "')";
// 3. Set the anchor point and neutralize the static position.
if (anAction.keypath === @"frameOrigin")
{
aDomElement.style.offsetAnchor = "0% 0%";
aDomElement.style.left = "0px";
aDomElement.style.top = "0px";
}
else
{
aDomElement.style.offsetAnchor = "50% 50%";
}
// 4. Set the rotation mode.
var rotationMode = anAction.rotationMode;
if (rotationMode === kCAAnimationRotateAuto)
{
aDomElement.style.offsetRotate = "auto";
}
else if (rotationMode === kCAAnimationRotateAutoReverse)
{
aDomElement.style.offsetRotate = "auto reverse";
}
else
{
aDomElement.style.offsetRotate = "0deg";
}
// Create a new completion handler that cleans up after the animation.
var originalCompletion = anAction.completion;
var cleanupCompletion = function()
{
// STEP 1: Run the original completion handler first. This is critical.
// It sets the final frameOrigin, which updates the static 'left' and 'top'
// styles to their final values, locking the view in the correct place.
if (originalCompletion)
originalCompletion();
// STEP 2: Now that the view's static position is correct, we can safely
// remove the animation-specific properties. This prevents state leakage.
aDomElement.style.offsetPath = null;
aDomElement.style.offsetAnchor = null;
aDomElement.style.offsetRotate = null;
};
// 5. Create the @keyframes rule, passing in our NEW cleanup handler.
var getter = function(start, current) { return current; };
var values = ["0%", "100%"];
var keytimes = [0, 1];
var timingfunctions;
if (anAction.calculationMode === kCAAnimationPaced) {
timingfunctions = "linear";
} else {
timingfunctions = [[CPAnimationContext currentContext] timingFunction];
}
animation.addPropertyAnimation("offset-distance", getter, anAction.duration, keytimes, values, timingfunctions, cleanupCompletion);
// 6. Keep fill-mode as 'forwards'. This is essential to prevent the view
// from jumping to (0,0) in the tiny gap between the animation ending
// and our completion handler running.
animation.setFillMode("forwards");
}
+ (CPArray)_cssPropertiesForKeyPath:(CPString)aKeyPath
{
return [[self _defaultCSSProperties] objectForKey:aKeyPath];
+5
View File
@@ -306,3 +306,8 @@ CSSAnimation.prototype.start = function()
return true;
};
CSSAnimation.prototype.setFillMode = function(aProperty)
{
this.target.style.setProperty(ANIMATION_FILL_MODE_PROPERTY, aProperty);
};
+9
View File
@@ -82,6 +82,15 @@ var PrimaryPlatformWindow = NULL;
CPWindow _currentMainWindow;
CPWindow _previousMainWindow;
// state of touch momentum scrolling
CPTimer _momentumScrollTimer;
float _touchVelocityX;
float _touchVelocityY;
float _lastTouchMoveTimestamp;
float _lastMomentumTimestamp;
BOOL _isTwoFingerScrolling;
#endif
}
+122 -26
View File
@@ -208,6 +208,10 @@ var resizeTimer = nil;
var PreventScroll = true;
var blurTimer = nil;
var MOMENTUM_DAMPING = 0.95, // The friction factor. Higher is less friction (0.95 is a good start).
MIN_MOMENTUM_VELOCITY = 0.05, // The velocity (pixels/ms) at which the scroll animation will stop.
MIN_MOMENTUM_START_VELOCITY = 0.1; // The minimum velocity required from a flick to initiate momentum scrolling.
var touchStartingPointX,
touchStartingPointY;
@@ -239,6 +243,13 @@ _CPPlatformWindowWillCloseNotification = @"_CPPlatformWindowWillCloseNotificatio
[self updateFromNativeContentRect];
_charCodes = {};
_momentumScrollTimer = nil;
_touchVelocityX = 0;
_touchVelocityY = 0;
_lastTouchMoveTimestamp = 0;
_lastMomentumTimestamp = 0;
_isTwoFingerScrolling = NO;
}
return self;
@@ -1157,49 +1168,116 @@ _CPPlatformWindowWillCloseNotification = @"_CPPlatformWindowWillCloseNotificatio
[aWindow becomeMainWindow];
}
- (void)_momentumScrollStep
{
// Use a high-resolution timer for smooth animation
var now = performance.now();
var interval = now - _lastMomentumTimestamp;
_lastMomentumTimestamp = now;
// If the interval is too large (e.g., tab was backgrounded), stop the animation.
if (interval > 100)
{
[_momentumScrollTimer invalidate];
_momentumScrollTimer = nil;
return;
}
var location = _lastMouseEventLocation || CGPointMakeZero();
// Create a fake event to pass to the existing scrollEvent handler
var newEvent = {
shiftKey: NO, ctrlKey: NO, altKey: NO, metaKey: NO,
_overrideLocation: location,
_hasPreciseScrollingDeltas: YES,
// The scroll delta is velocity (pixels/ms) * time (ms)
deltaX: _touchVelocityX * interval,
deltaY: _touchVelocityY * interval,
type: CPDOMEventScrollWheel,
preventDefault: function() {},
stopPropagation: function() {}
};
[self scrollEvent:newEvent];
// Apply time-corrected damping for consistent friction feel across different frame rates
var dampingFactor = Math.pow(MOMENTUM_DAMPING, interval / (1000 / 60));
_touchVelocityX *= dampingFactor;
_touchVelocityY *= dampingFactor;
// Stop the animation when velocity is negligible
if (Math.abs(_touchVelocityX) < MIN_MOMENTUM_VELOCITY && Math.abs(_touchVelocityY) < MIN_MOMENTUM_VELOCITY)
{
[_momentumScrollTimer invalidate];
_momentumScrollTimer = nil;
}
}
- (void)touchEvent:(DOMEvent)aDOMEvent
{
// Handle gesture state and momentum start/stop.
if (aDOMEvent.type === CPDOMEventTouchStart)
{
_isTwoFingerScrolling = aDOMEvent.touches.length === 2;
// A new touch always stops any existing momentum scroll.
if (_momentumScrollTimer) {
[_momentumScrollTimer invalidate];
_momentumScrollTimer = nil;
}
}
else if (aDOMEvent.type === CPDOMEventTouchEnd || aDOMEvent.type === CPDOMEventTouchCancel)
{
if (_isTwoFingerScrolling)
{
// If the gesture ends with enough velocity, start the momentum animation.
if (Math.abs(_touchVelocityX) > MIN_MOMENTUM_START_VELOCITY || Math.abs(_touchVelocityY) > MIN_MOMENTUM_START_VELOCITY) {
_lastMomentumTimestamp = aDOMEvent.timeStamp;
_momentumScrollTimer = [CPTimer scheduledTimerWithTimeInterval:1.0/60.0 target:self selector:@selector(_momentumScrollStep) userInfo:nil repeats:YES];
}
_isTwoFingerScrolling = NO;
// Prevent default browser actions (like pinch-zoom) for our handled scroll gesture.
if (aDOMEvent.preventDefault) aDOMEvent.preventDefault();
return;
}
}
var newEvent = {},
touch = aDOMEvent.touches.length ? aDOMEvent.touches[0] : aDOMEvent.changedTouches[0];
newEvent.timestamp = [CPEvent currentTimestamp];
newEvent.target = aDOMEvent.target;
newEvent.shiftKey = newEvent.ctrlKey = newEvent.altKey = newEvent.metaKey = false;
newEvent.clientX = touch.clientX;
/*
Normally the document can't scroll in Cappuccino: our body element has top:0 and bottom:0 with absolute positioning. So it should always be exactly the height of the viewport. The below handles a special case. iOS scrolls the document when the virtual keyboard is present and it needs to move a text input upwards visually to avoid covering the input with the keyboard. For most purposes we can ignore this, except here. In theory I think we could always apply this (scrollTop should always be 0 on every other device and situation) but let's be defensive and only apply it for touch events to minimise the risk of surprises.
*/
newEvent.clientY = _DOMWindow.document.body.scrollTop + touch.clientY;
newEvent.preventDefault = function() { if (aDOMEvent.preventDefault) aDOMEvent.preventDefault() };
newEvent.stopPropagation = function() { if (aDOMEvent.stopPropagation) aDOMEvent.stopPropagation() };
// single finger event-> simulate a simple mouse-click
// Single-finger event -> simulate a simple mouse-click
if (aDOMEvent.touches && (aDOMEvent.touches.length == 1 || (aDOMEvent.touches.length == 0 && aDOMEvent.changedTouches.length == 1)))
{
switch (aDOMEvent.type)
{
case CPDOMEventTouchStart: newEvent.type = CPDOMEventMouseDown;
break;
case CPDOMEventTouchEnd: newEvent.type = CPDOMEventMouseUp;
break;
case CPDOMEventTouchMove: newEvent.type = CPDOMEventMouseMoved;
break;
case CPDOMEventTouchCancel: newEvent.type = CPDOMEventMouseUp;
break;
case CPDOMEventTouchStart:
newEvent.type = CPDOMEventMouseDown;
break;
case CPDOMEventTouchEnd:
newEvent.type = CPDOMEventMouseUp;
break;
case CPDOMEventTouchMove:
newEvent.type = CPDOMEventMouseMoved;
break;
case CPDOMEventTouchCancel:
newEvent.type = CPDOMEventMouseUp;
break;
}
[self mouseEvent:newEvent];
return;
}
else
{
// two fingers->simulate scrolling events
if (aDOMEvent.touches && aDOMEvent.touches.length == 2)
// Two-fingers -> simulate scrolling events
if (_isTwoFingerScrolling && aDOMEvent.touches && aDOMEvent.touches.length == 2)
{
if (aDOMEvent.preventDefault)
aDOMEvent.preventDefault();
@@ -1212,23 +1290,41 @@ _CPPlatformWindowWillCloseNotification = @"_CPPlatformWindowWillCloseNotificatio
case CPDOMEventTouchStart:
touchStartingPointX = touch.pageX;
touchStartingPointY = touch.pageY;
_lastTouchMoveTimestamp = aDOMEvent.timeStamp;
_touchVelocityX = 0;
_touchVelocityY = 0;
break;
case CPDOMEventTouchMove:
newEvent._hasPreciseScrollingDeltas = YES;
newEvent.deltaX = touchStartingPointX - touch.pageX;
newEvent.deltaY = touchStartingPointY - touch.pageY;
newEvent.type = CPDOMEventScrollWheel;
var now = aDOMEvent.timeStamp;
var deltaTime = now - _lastTouchMoveTimestamp;
[self scrollEvent:newEvent];
if (deltaTime > 0)
{
var deltaX = touchStartingPointX - touch.pageX;
var deltaY = touchStartingPointY - touch.pageY;
// Calculate velocity for momentum, smoothing it with an exponential moving average.
var currentVelocityX = deltaX / deltaTime;
var currentVelocityY = deltaY / deltaTime;
_touchVelocityX = 0.8 * currentVelocityX + 0.2 * _touchVelocityX;
_touchVelocityY = 0.8 * currentVelocityY + 0.2 * _touchVelocityY;
// Send the raw delta for immediate, direct-manipulation feedback.
newEvent._hasPreciseScrollingDeltas = YES;
newEvent.deltaX = deltaX;
newEvent.deltaY = deltaY;
newEvent.type = CPDOMEventScrollWheel;
[self scrollEvent:newEvent];
}
touchStartingPointX = touch.pageX;
touchStartingPointY = touch.pageY;
_lastTouchMoveTimestamp = now;
return;
}
}
// cancel other touch cases preventively
// Preventively cancel other touch cases (e.g., 3+ fingers)
if (aDOMEvent.preventDefault)
aDOMEvent.preventDefault();
+12 -1
View File
@@ -360,4 +360,15 @@ var concat = Array.prototype.concat,
@end
Array.prototype.isa = _CPJavaScriptArray;
if (Array.prototype.isa !== _CPJavaScriptArray)
{
Object.defineProperties(Array.prototype,
{
isa:
{
value: _CPJavaScriptArray,
enumerable: false,
writable: true
}
});
}
+24 -2
View File
@@ -214,5 +214,27 @@
@end
CFData.prototype.isa = CPData;
CFMutableData.prototype.isa = CPData;
if (CFData.prototype.isa !== CPData)
{
Object.defineProperties(CFData.prototype,
{
isa:
{
value: CPData,
enumerable: false,
writable: true
}
})
};
if (CFMutableData.prototype.isa !== CPData)
{
Object.defineProperties(CFMutableData.prototype,
{
isa:
{
value: CPData,
enumerable: false,
writable: true
}
});
}
+12 -1
View File
@@ -286,7 +286,18 @@ Date.parseISO8601 = function (date)
return timestamp;
};
Date.prototype.isa = CPDate;
if (Date.prototype.isa !== CPDate)
{
Object.defineProperties(Date.prototype,
{
isa:
{
value: CPDate,
enumerable: false,
writable: true
}
});
}
function _isNumberType(value)
{
+12
View File
@@ -1291,6 +1291,18 @@ var _separatorsCharacterSet = nil;
if (!aString)
return [[CPDate alloc] initWithTimeIntervalSinceReferenceDate:-31622400];
// Special case for ISO8601 format, which is poorly handled by the generic parser.
if (aFormat === @"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'") {
var d = new Date(aString);
if (d && !isNaN(d.getTime())) {
// The native JS Date object handles ISO 8601 strings correctly (as UTC).
// We can create a CPDate directly from the resulting timestamp.
var kCFAbsoluteTimeIntervalSince1970 = 978307200.0;
var interval = (d.getTime() / 1000.0) - kCFAbsoluteTimeIntervalSince1970;
return [CPDate dateWithTimeIntervalSinceReferenceDate:interval];
}
}
if (aFormat == nil)
return nil;
+24 -2
View File
@@ -751,5 +751,27 @@ var CPDictionaryMaxDescriptionRecursion = 10;
@end
CFDictionary.prototype.isa = CPDictionary;
CFMutableDictionary.prototype.isa = CPMutableDictionary;
if (CFDictionary.prototype.isa !== CPDictionary)
{
Object.defineProperties(CFDictionary.prototype,
{
isa:
{
value: CPDictionary,
enumerable: false,
writable: true
}
});
}
if (CFMutableDictionary.prototype.isa !== CPMutableDictionary)
{
Object.defineProperties(CFMutableDictionary.prototype,
{
isa:
{
value: CPMutableDictionary,
enumerable: false,
writable: true
}
});
}
+12 -1
View File
@@ -166,5 +166,16 @@ var CPErrorCodeKey = @"CPErrorCodeKey",
@end
CFError.prototype.isa = CPError;
if (CFError.prototype.isa !== CPError)
{
Object.defineProperties(CFError.prototype,
{
isa:
{
value: CPError,
enumerable: false,
writable: true
}
});
}
+24 -2
View File
@@ -222,8 +222,30 @@ var CPExceptionNameKey = @"CPExceptionNameKey",
// toll-free bridge Error to CPException
// [CPException alloc] uses an objj_exception, which is a subclass of Error
Error.prototype.isa = CPException;
Error.prototype._userInfo = null;
if (Error.prototype.isa !== CPException)
{
Object.defineProperties(Error.prototype,
{
isa:
{
value: CPException,
enumerable: false,
writable: true
}
});
}
if (Error.prototype._userInfo !== null)
{
Object.defineProperties(Error.prototype,
{
_userInfo:
{
value: null,
enumerable: false,
writable: true
}
});
}
[CPException initialize];
+125
View File
@@ -0,0 +1,125 @@
@import "CPObject.j"
@import "CPEnumerator.j"
@import "CPDictionary.j"
@import "CPArray.j"
/*!
@class CPMapTable
@ingroup foundation
A mutable collection modeled after NSDictionary that allows for arbitrary
objects or values to be used as keys. This implementation uses the native
ECMAScript 6 Map object for its underlying storage.
*/
@implementation CPMapTable : CPObject
{
// The underlying ES6 Map to store the key-value pairs.
id _map;
}
/*!
Initializes a new, empty CPMapTable.
*/
- (id)init
{
if (self = [super init])
{
_map = new Map();
}
return self;
}
#pragma mark -
#pragma mark Accessing Content
/*!
Returns the value associated with a given key.
@param aKey The key for which to return the corresponding value.
@return The value associated with aKey, or nil if no value is associated with aKey.
*/
- (id)objectForKey:(id)aKey
{
var value = _map.get(aKey);
return value === undefined ? nil : value;
}
/*!
Returns an enumerator object that lets you access each key in the map table.
@return A CPEnumerator object for the keys in the map table.
*/
- (CPEnumerator)keyEnumerator
{
return [[..._map.keys()] objectEnumerator];
}
/*!
Returns an enumerator object that lets you access each value in the map table.
@return A CPEnumerator object for the values in the map table.
*/
- (CPEnumerator)objectEnumerator
{
return [[..._map.values()] objectEnumerator];
}
/*!
Returns the number of key-value pairs in the map table.
@return The number of entries in the map table.
*/
- (unsigned int)count
{
return _map.size;
}
#pragma mark -
#pragma mark Manipulating Content
/*!
Adds a given key-value pair to the map table.
If aKey already exists in the map table, anObject takes its place.
@param anObject The value for aKey.
@param aKey The key for anObject.
*/
- (void)setObject:(id)anObject forKey:(id)aKey
{
_map.set(aKey, anObject);
}
/*!
Removes a given key and its associated value from the map table.
@param aKey The key to remove.
*/
- (void)removeObjectForKey:(id)aKey
{
_map.delete(aKey);
}
/*!
Empties the map table of its entries.
*/
- (void)removeAllObjects
{
_map.clear();
}
#pragma mark -
#pragma mark Creating a Dictionary Representation
/*!
Returns a dictionary representation of the map table.
Note: This will only work correctly if all keys are strings.
@return A CPDictionary containing the entries of the map table.
*/
- (CPDictionary)dictionaryRepresentation
{
var dictionary = [CPDictionary dictionary];
for (var [key, value] of _map.entries())
{
[dictionary setObject:value forKey:key];
}
return dictionary;
}
@end
+25 -2
View File
@@ -346,6 +346,29 @@ FIXME: Do we need this?
@end
Number.prototype.isa = CPNumber;
Boolean.prototype.isa = CPNumber;
if (Number.prototype.isa !== CPNumber)
{
Object.defineProperties(Number.prototype,
{
isa:
{
value: CPNumber,
enumerable: false,
writable: true
}
});
}
if (Boolean.prototype.isa !== CPNumber)
{
Object.defineProperties(Boolean.prototype,
{
isa:
{
value: CPNumber,
enumerable: false,
writable: true
}
});
}
[CPNumber initialize];
+26
View File
@@ -138,3 +138,29 @@ var hasOwnProperty = Object.prototype.hasOwnProperty;
}
@end
// This makes all CPSet instances iterable using for...of or the spread operator.
//
// This implementation is 'lazy' and efficient, iterating directly over the
// internal _contents object rather than creating a temporary array.
//
_CPConcreteMutableSet.allocator.prototype[Symbol.iterator] = function*()
{
// 'this._contents' is the internal JavaScript object used for storage.
// The keys are object UIDs and the values are the objects themselves.
const contents = this._contents;
// A 'for...in' loop iterates over the keys (UIDs) of the contents object.
// This is a lazy operation and does not create an intermediate array.
for (const key in contents)
{
// It's crucial to check that the key is an own property and not
// one inherited from Object.prototype.
if (Object.prototype.hasOwnProperty.call(contents, key))
{
// Yield the VALUE, which is the actual object stored in the set.
yield contents[key];
}
}
};
+12 -1
View File
@@ -1010,4 +1010,15 @@ String.prototype.stripDiacritics = function()
return output;
};
String.prototype.isa = CPString;
if (String.prototype.isa !== CPString)
{
Object.defineProperties(String.prototype,
{
isa:
{
value: CPString,
enumerable: false,
writable: true
}
})
};
+113 -14
View File
@@ -25,6 +25,7 @@
@import "CPLocale.j"
@class CPData
@class CPNotificationCenter
CPTimeZoneNameStyleStandard = 0;
CPTimeZoneNameStyleShortStandard = 1;
@@ -46,14 +47,93 @@ var abbreviationDictionary,
function abbreviationForDate(date)
{
// Sometimes the browsers will give unmatched timezones in other languages so try one more thing
// Take the locale string for english in the US. It has the following format (9/21/2021, 2:40:44 PM Central European Summer Time)
// Remove the date and time with this regex and take first letter in each word in the time zone name.
// This is not 100% but is better than nothing as JAvascript has no good support for this.
var abbreviation = date.toLocaleString('en-US', {timeZoneName : 'long'}).replace(/^([0]?\d|[1][0-2])\/((?:[0]?|[1-2])\d|[3][0-1])\/([2][01]|[1][6-9])\d{2}(,?\s*([0]?\d|[1][0-2])(\:[0-5]\d){1,2})*\s*([aApP][mM]{0,2})?\s*/, "").split(" ").map(function(l) { return l[0]}).join("");
// Strategy 1: Parse date.toString() as it's more reliable than toLocaleString.
// Format is usually: "Day Mon dd yyyy hh:mm:ss GMT+XXXX (Time Zone Name)"
var dateString = date.toString();
return abbreviation;
// Check for a long name within parentheses, e.g., (Pacific Daylight Time)
var longNameMatch = dateString.match(/\(([^)]+)\)/);
if (longNameMatch) {
var timeZoneComponent = longNameMatch[1];
// If the component is already a known abbreviation (e.g., "EST"), return it.
if ([abbreviationDictionary objectForKey:timeZoneComponent]) {
return timeZoneComponent;
}
// If it's a long name (e.g., "Eastern Daylight Time"), create an acronym.
if (timeZoneComponent.indexOf(' ') > -1) {
var generatedAbbr = timeZoneComponent.split(' ').map(function(word) { return word[0]; }).join('');
if ([abbreviationDictionary objectForKey:generatedAbbr]) {
return generatedAbbr;
}
}
}
// Strategy 2: If string parsing fails (e.g., for "GMT-04:00"), use the modern and reliable Intl API.
try {
var ianaName = new Intl.DateTimeFormat().resolvedOptions().timeZone;
var currentOffset = -date.getTimezoneOffset(); // in minutes
var keys = [abbreviationDictionary keyEnumerator],
key;
// Find all abbreviations for the current IANA time zone.
var possibleAbbrs = [];
while (key = [keys nextObject]) {
if ([abbreviationDictionary valueForKey:key] === ianaName) {
possibleAbbrs.push(key);
}
}
// If more than one (e.g., standard and daylight), use the current offset to find the right one.
for (var i = 0; i < possibleAbbrs.length; i++) {
var abbr = possibleAbbrs[i];
if ([timeDifferenceFromUTC valueForKey:abbr] === currentOffset) {
return abbr;
}
}
// If offset matching fails but we have a unique IANA match, use it as a best guess.
if (possibleAbbrs.length > 0) {
return possibleAbbrs[0];
}
} catch (e) {
// Intl API not supported, or it failed. We cannot proceed with this strategy.
}
// Return nil if no valid abbreviation could be determined.
return nil;
}
function _abbreviationForNameAndDate(tzName, date)
{
// This is a helper function based on the existing `abbreviationForDate`.
// It determines the abbreviation for a given IANA name based on the provided date,
// which allows it to respect daylight saving time.
try {
var options = {
timeZone: tzName,
timeZoneName: 'long'
};
// The 'en-US' locale provides a predictable format for parsing.
var dateString = date.toLocaleString('en-US', options);
// This regex is copied from the global 'abbreviationForDate' function.
// It strips the date and time, leaving the long time zone name.
var longTZName = dateString.replace(/^([0]?\d|[1][0-2])\/((?:[0]?|[1-2])\d|[3][0-1])\/([2][01]|[1][6-9])\d{2}(,?\s*([0]?\d|[1][0-2])(\:[0-5]\d){1,2})*\s*([aApP][mM]{0,2})?\s*/, "");
// Create the abbreviation from the long name (e.g., "Pacific Daylight Time" -> "PDT")
var abbreviation = longTZName.split(" ").map(function(l) { return l[0]}).join("");
return abbreviation;
} catch (e) {
// The tzName might be invalid for toLocaleString, which throws a RangeError.
// In this case, we can't determine the abbreviation.
return nil;
}
}
/*!
@class CPTimeZone
@ingroup foundation
@@ -445,7 +525,7 @@ function abbreviationForDate(date)
systemTimeZone = [self timeZoneWithAbbreviation:abbreviation];
[[CPNotification defaultCenter] postNotificationName:CPSystemTimeZoneDidChangeNotification object:systemTimeZone];
[[CPNotificationCenter defaultCenter] postNotificationName:CPSystemTimeZoneDidChangeNotification object:systemTimeZone];
}
/*! Return the systemTimeZone
@@ -523,19 +603,38 @@ function abbreviationForDate(date)
{
_name = tzName;
var keys = [abbreviationDictionary keyEnumerator],
key;
// Determine the abbreviation based on the current date to handle DST.
var currentAbbreviation = _abbreviationForNameAndDate(tzName, [CPDate date]);
while (key = [keys nextObject])
// If we got a valid abbreviation from the date, and it's one we know about, use it.
// Otherwise, fall back to the old logic.
if (currentAbbreviation && [abbreviationDictionary containsKey:currentAbbreviation])
{
var value = [abbreviationDictionary valueForKey:key];
_abbreviation = currentAbbreviation;
}
else
{
// FALLBACK: Find the first matching abbreviation in the dictionary.
// Note: This is not DST-aware and may not be correct, but it preserves
// the original behavior for cases where the dynamic lookup fails.
var keys = [abbreviationDictionary keyEnumerator],
key;
if ([value isEqualToString:_name])
while (key = [keys nextObject])
{
_abbreviation = key;
break;
var value = [abbreviationDictionary valueForKey:key];
if ([value isEqualToString:_name])
{
_abbreviation = key;
break;
}
}
}
// If no abbreviation could be found by any means, initialization fails.
if (!_abbreviation)
return nil;
}
return self;
+12 -1
View File
@@ -260,4 +260,15 @@ var CPURLURLStringKey = @"CPURLURLStringKey",
@end
CFURL.prototype.isa = [CPURL class];
if (CFURL.prototype.isa !== CPURL)
{
Object.defineProperties(CFURL.prototype,
{
isa:
{
value: CPURL,
enumerable: false,
writable: true
}
})
};
+105 -77
View File
@@ -3,6 +3,7 @@ require("./common.jake");
var fs = require('fs');
var path = require('path');
var childProcess = require("child_process");
var os = require('os');
const term = ObjectiveJ.term;
const utilsFile = ObjectiveJ.utils.file;
@@ -131,95 +132,122 @@ task ("documentation-no-frame", function()
});
task ("docset", function()
{
generateDocs(true);
var documentationDir = path.resolve(path.join("Tools", "Documentation")),
docsetShell = path.join(documentationDir, "support", "docset.sh");
OS.system([docsetShell, documentationDir]);
});
function generateDocs(/* boolean */ noFrame)
{
// try to find a doxygen executable in the PATH;
var doxygen = executableExists("doxygen");
// If the Doxygen application is installed on Mac OS X, use that
if (!doxygen && executableExists("mdfind"))
{
try
{
var p = OS.popen(["mdfind", "kMDItemContentType == 'com.apple.application-bundle' && kMDItemCFBundleIdentifier == 'org.doxygen'"]);
if (p.wait() === 0)
{
var doxygenApps = p.stdout.read().split("\n");
if (doxygenApps[0])
doxygen = path.join(doxygenApps[0], "Contents/Resources/doxygen");
}
}
finally
{
p.stdin.close();
p.stdout.close();
p.stderr.close();
}
{
// First, check if docsetutil is available. This is only required for this task.
if (!executableExists("docsetutil")) {
console.error("\nError: 'docsetutil' is not installed, but it's required to build the docset.".red);
console.log("This tool is no longer bundled with Xcode, but can be installed with Homebrew:");
console.log("\n brew install swiftdocorg/formulae/docsetutil\n".yellow);
process.exit(1);
}
if (!doxygen || !FILE.exists(doxygen))
{
colorPrint("Doxygen not installed, skipping documentation generation.", "yellow");
// If the tool exists, proceed with the build.
generateDocs(true, true);
});
function executableExists(command) {
try {
const checkCmd = process.platform === 'win32' ? 'where' : 'which';
childProcess.execSync(`${checkCmd} ${command}`, { stdio: 'pipe' });
return true;
} catch (e) {
return false;
}
}
function generateDocs(/* boolean */ noFrame, /* boolean */ buildDocset = false)
{
var doxygen = null;
if (executableExists("doxygen")) {
doxygen = "doxygen";
}
if (!doxygen) {
console.log("Doxygen not installed or not found, skipping documentation generation.");
return;
}
colorPrint("Using " + doxygen + " for doxygen binary.", "green");
colorPrint("Pre-processing source files...", "green");
// --- Temporary Directory Setup ---
const projectRoot = process.cwd();
const tempDir = fs.realpathSync(fs.mkdtempSync(path.join(os.tmpdir(), 'capp-docs-')));
console.log(`Using temporary directory for build: ${tempDir}`);
var documentationDir = FILE.canonical(path.join("Tools", "Documentation")),
processors = FILE.glob(path.join(documentationDir, "preprocess/*"));
try {
var documentationDir = path.join(projectRoot, "Tools", "Documentation");
for (var i = 0; i < processors.length; ++i)
if (OS.system([processors[i], documentationDir]))
return;
// --- Pre-processing ---
console.log("Pre-processing source files...");
const preProcessorsDir = path.join(documentationDir, "preprocess");
var processors = fs.readdirSync(preProcessorsDir).sort();
if (noFrame)
{
// Back up the default settings, turn off the treeview
if (OS.system(["sed", "-i", ".bak", "s/GENERATE_TREEVIEW.*=.*YES/GENERATE_TREEVIEW = NO/", path.join(documentationDir, "Cappuccino.doxygen")]))
return;
}
else if (FILE.exists(path.join(documentationDir, "Cappuccino.doxygen.bak")))
utilsFile.mv(path.join(documentationDir, "Cappuccino.doxygen.bak"), path.join(documentationDir, "Cappuccino.doxygen"));
var doxygenDidSucceed = !OS.system([doxygen, path.join(documentationDir, "Cappuccino.doxygen")]);
// Restore the original doxygen settings
if (FILE.exists(path.join(documentationDir, "Cappuccino.doxygen.bak")))
utilsFile.mv(path.join(documentationDir, "Cappuccino.doxygen.bak"), path.join(documentationDir, "Cappuccino.doxygen"));
colorPrint("Post-processing generated documentation...", "green");
processors = FILE.glob(path.join(documentationDir, "postprocess/*"));
for (var i = 0; i < processors.length; ++i)
if (OS.system([processors[i], documentationDir, path.join("Documentation", "html")]))
{
utilsFile.rm_rf("Documentation");
return;
for (const processor of processors) {
const processorPath = path.join(preProcessorsDir, processor);
childProcess.execSync(`"${processorPath}" "${projectRoot}"`, { stdio: 'inherit', cwd: tempDir });
}
if (doxygenDidSucceed)
{
if (!FILE.isDirectory($BUILD_DIR))
FILE.mkdirs($BUILD_DIR);
// --- Doxygen Execution ---
const doxygenConfigFile = path.join(documentationDir, "Cappuccino.doxygen");
const doxygenTempConfig = path.join(tempDir, "Cappuccino.doxygen");
fs.copyFileSync(doxygenConfigFile, doxygenTempConfig);
utilsFile.rm_rf($DOCUMENTATION_BUILD);
utilsFile.mv("debug.txt", path.join("Documentation", "debug.txt"));
utilsFile.mv("Documentation", $DOCUMENTATION_BUILD);
if (noFrame) {
console.log("Disabling treeview for no-frame documentation.");
childProcess.execSync(`sed -i.bak 's/GENERATE_TREEVIEW.*=.*YES/GENERATE_TREEVIEW = NO/' "${doxygenTempConfig}"`);
}
// There is a bug in doxygen 1.7.x preventing loading correctly the custom CSS
// So let's do it manually
utilsFile.cp(path.join(documentationDir, "doxygen.css"), path.join($DOCUMENTATION_BUILD, "html", "doxygen.css"));
console.log("Running Doxygen...");
childProcess.execSync(`"${doxygen}" "${doxygenTempConfig}"`, { stdio: 'inherit', cwd: tempDir });
const generatedDocsRoot = path.join(tempDir, "Documentation");
const htmlOutputDir = path.join(generatedDocsRoot, "html");
const makefilePath = path.join(htmlOutputDir, "Makefile");
// --- Makefile Execution (ONLY for docset) ---
// For a standard 'jake docs', we do NOT run make.
if (buildDocset && fs.existsSync(makefilePath)) {
console.log("Patching Makefile to use 'docsetutil' from PATH...");
childProcess.execSync(`sed -i.bak 's|"\\$(XCODE_INSTALL_DIR)"/usr/bin/docsetutil|docsetutil|' "${makefilePath}"`);
console.log("Building docset with 'make'...");
childProcess.execSync('make', { stdio: 'inherit', cwd: htmlOutputDir });
}
// --- Post-processing ---
console.log("Post-processing generated documentation...");
const postProcessorsDir = path.join(documentationDir, "postprocess");
processors = fs.readdirSync(postProcessorsDir).sort();
for (const processor of processors) {
const processorPath = path.join(postProcessorsDir, processor);
childProcess.execSync(`"${processorPath}" "${projectRoot}" "${htmlOutputDir}"`, { stdio: 'inherit', cwd: tempDir });
}
// --- Final Installation ---
if (fs.existsSync(generatedDocsRoot)) {
if (fs.existsSync($DOCUMENTATION_BUILD)) {
fs.rmSync($DOCUMENTATION_BUILD, { recursive: true, force: true });
}
fs.renameSync(generatedDocsRoot, $DOCUMENTATION_BUILD);
// Manually copy the custom CSS file
const finalHtmlPath = path.join($DOCUMENTATION_BUILD, "html");
const customCSS = path.join(documentationDir, "doxygen.css");
if (fs.existsSync(customCSS)) {
console.log("Applying custom stylesheet...");
fs.copyFileSync(customCSS, path.join(finalHtmlPath, "doxygen.css"));
}
console.log("Documentation successfully built in " + finalHtmlPath);
} else {
console.error("Doxygen or post-processing failed to produce the 'Documentation' directory.");
}
} catch (e) {
console.error("An error occurred during documentation generation:", e.message);
process.exit(1);
} finally {
// --- Cleanup ---
console.log(`Cleaning up temporary directory: ${tempDir}`);
fs.rmSync(tempDir, { recursive: true, force: true });
}
}
+19
View File
@@ -133,6 +133,25 @@ CFDictionary.prototype.valueForKey = function(/*String*/ aKey)
DISPLAY_NAME(CFDictionary.prototype.valueForKey);
// This allows the use of 'for...of' loops directly on CFDictionary instances.
CFDictionary.prototype[Symbol.iterator] = function*()
{
// Access the internal storage directly for maximum performance.
// 'this._keys' is the internal array of keys.
const keys = this._keys;
// 'this._buckets' is the internal hash map of key -> value.
const buckets = this._buckets;
// A 'for...of' loop on an array is itself a lazy and efficient way to iterate.
for (const key of keys)
{
// 'yield' pauses the generator and returns the [key, value] pair
// to the consumer (the for...of loop).
yield [key, buckets[key]];
}
};
CFDictionary.prototype.toString = function()
{
var string = "{\n",
+106 -91
View File
@@ -1,129 +1,144 @@
[![build](https://github.com/cappuccino/cappuccino/actions/workflows/BuildAndTest.yml/badge.svg)](https://github.com/cappuccino/cappuccino/actions/workflows/BuildAndTest.yml)
[![Join the chat at https://gitter.im/cappuccino/cappuccino](https://badges.gitter.im/cappuccino/cappuccino.svg)](
https://gitter.im/cappuccino/cappuccino?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Join the chat at https://gitter.im/cappuccino/cappuccino](https://badges.gitter.im/cappuccino/cappuccino.svg)](https://gitter.im/cappuccino/cappuccino?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
Welcome to Cappuccino!
======================
# Cappuccino: Build Desktop-Class Web Applications
Introduction
------------
Cappuccino is an open source framework that makes it easy to build
desktop-caliber applications that run in a web browser.
Cappuccino is an open-source framework that supports building powerful, desktop-class applications running in any modern web browser. Instead of direct manipulation of HTML, CSS, and the DOM, applications are built using Objective-J, a superset of JavaScript modeled on Objective-C.
With Cappuccino, you don't concern yourself with HTML, CSS, or the DOM. You write applications with the APIs from
Apple's Cocoa frameworks and the Objective-J language.
Cappuccino faithfully implements the proven design patterns of NeXTSTEP/Apple's Cocoa frameworks, enabling the creation of incredibly complex and reliable applications with a fraction of the code.
Check out a [live demo of the widgets in Cappuccino](https://cappuccino-testbook.5apps.com/#ThemeKitchenSink)
> **✨ Project Status: Active Development & Node.js Transition**
> Cappuccino has been under continuous development since 2008 and is actively maintained. A major transition to a modern, **Node.js-based toolchain** has recently been finalized. The current release is a production-ready Release Candidate, with a formal release scheduled for 2026. It is stable, fast, and ready for new projects.
Check out some [tutorials](https://cappuccino-cookbook.5apps.com)
---
For more information, see the
- [Official website](http://cappuccino-project.org)
- [Github Wiki](https://github.com/cappuccino/cappuccino/wiki)
- [FAQ](http://cappuccino-project.org/support/faq.html)
- [Documentation](http://cappuccino-project.org/learn/)
- [Mailing list](http://groups.google.com/group/objectivej)
- [Gitter](https://gitter.im/cappuccino/cappuccino)
## Why Use Cappuccino?
Follow [@cappuccino](https://twitter.com/cappuccino) on Twitter for updates on the project.
Cappuccino is not intended for building simple websites. It is for building **applications**—especially complex, data-rich, line-of-business tools where productivity and user experience are paramount.
If you discover any bugs, please [file a ticket](http://github.com/cappuccino/cappuccino/issues).
* **💻 True Desktop Behavior, Out-of-the-Box:** Applications built with Cappuccino behave like native desktop software by default. This includes a rich palette of UI controls, **full keyboard navigation and focus management**, and **multi-level undo/redo support** — as you can see in this [Demo application](https://ansb.uniklinik-freiburg.de/UIBuilder/index.html). Also take a look at the [Kitchen Sink demo](https://cappuccino-testbook.5apps.com/#ThemeKitchenSink).
* **🚀 Incredible Productivity:** Less code is needed. High-level abstractions and a powerful object-oriented model mean development is focused on application logic, not browser quirks.
* **🏛️ Stable & Mature:** Built on decades of proven API design from Cocoa®, Cappuccino provides a stable foundation, free from the churn common in the JavaScript ecosystem.
* **🧱 True Object-Oriented Architecture:** Objective-J's message-passing architecture promotes loose coupling and clean design, making large-scale applications easier to build and maintain.
* **🌐 Platform Independent:** Development can be done on macOS, Windows, or Linux. Deployment can target any modern web browser.
System Requirements
-------------------
To run Cappuccino applications, all you need is a HTML5 compliant web browser.
## 🚀 Quick Start
You can develop Cappuccino applications with only a simple text editor on any platform.
A new Cappuccino application can be running in five minutes.
If you are on a Mac, our integration with Xcode leverages the world-class visual development tools from Apple to create complex applications with minimal coding.
### 1. Prerequisites
[Node.js](https://nodejs.org/en/download/) (LTS versions are recommended) and `npm` are required.
Node.js version alpha
------------------
### 2. Configure npm (Recommended First-Time Setup)
To avoid potential permission issues with global packages, setting a local directory for npm is the recommended approach.
There is currently an ongoing effort to switch JavaScript platform from [Narwhal](https://narwhaljs.org/) to Node.js.
To try the Node.js version, do the following:
```bash
# Tell npm where to install global packages
npm set prefix ~/.npm
1. Install Node.js and npm from the [Node.js website](https://nodejs.org/en/).
2. Run `npm set prefix ~/.npm`. This will set the default install location for npm to `~/.npm`. The reasoning behind
this is outlined in the section about permission issues below.
# Add this directory to the shell's path in .zshrc, .bash_profile, etc.
export PATH="~/.npm/bin:$PATH"
```
The shell must be restarted or the profile sourced (`source ~/.zshrc`) for the changes to take effect. For more details, see the [npm documentation](https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally).
3. Add this line to your `.zshrc` or equivalent config file.
```bash
export PATH="~/.npm/bin:$PATH"
### 3. Install Cappuccino
```bash
npm install -g @objj/cappuccino
```
### 4. Create and Run the First App
```bash
# 1. A new project is generated
capp gen HelloWorld
# 2. Move into the new directory
cd HelloWorld
# 3. A local web server is started (Python 3 example)
python3 -m http.server 8000
# 4. The new app can be opened in any modern browser
# http://localhost:8000
```
A fully-functional Cappuccino application has now been created.
---
## What is Objective-J?
Objective-J is a strict superset of JavaScript, which means **all JavaScript code is valid Objective-J code**. It adds the powerful object-oriented features of Smalltalk and Objective-C, like explicit message-passing and class-based inheritance.
The syntax might look different, but it is designed for clarity and power.
* **Objective-C:**
```objc
NSString *greeting = [NSString stringWithFormat:@"Hello, %@!", name];
```
* **Objective-J:**
```objj
var greeting = [CPString stringWithFormat:@"Hello, %@!", name];
```
4. Restart your shell.
Pure JavaScript and Objective-J can be mixed and matched, even in the same file. The Objective-J code is transpiled into highly-optimized JavaScript for deployment, but can also be run directly in the browser during development.
5. Run `npm install -g @objj/cappuccino`.
## Find Out More
6. Done! See below for basic usage.
* **Official Website:** [cappuccino.dev](http://cappuccino.dev)
* **Documentation & Tutorials:** [cappuccino.dev/learn/](http://cappuccino.dev/learn/), [cappuccino cookbook](https://cappuccino-cookbook.5apps.com)
* **Gitter Community Chat:** [gitter.im/cappuccino/cappuccino](https://gitter.im/cappuccino/cappuccino)
* **GitHub Wiki:** [github.com/cappuccino/cappuccino/wiki](https://github.com/cappuccino/cappuccino/wiki)
* **FAQ:** [cappuccino.dev/support/faq.html](http://cappuccino.dev/support/faq.html)
* **Report a Bug:** [Create a GitHub Issue](http://github.com/cappuccino/cappuccino/issues)
### Permisson issues
---
By default npm uses `/usr/local/lib/node_modules` as the install location for globally installed packages. This causes
problems since users typically lack write permissions there. It is therefore recommended to either use a version
manager, or change npm's default install location manually (which is what we did above). For more details on how to do
this, see [this article](https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally).
## Frequently Asked Questions (FAQ)
### Basic usage
**Q: What are the advantages over React or Vue?**
**A:** React and Vue are excellent libraries for building web UIs. Cappuccino is a comprehensive **framework** for building entire **applications**. It provides a fully integrated stack—including a mature UI library, event handling, and data management—designed for large-scale development.
If the install succeeded you will be able to do the following to create a simple Cappuccino application:
Beyond this, Cappuccino provides a more integrated and powerful data-binding layer inspired directly by Cocoa, which dramatically reduces boilerplate code for complex UIs as you can see in this [example code](https://github.com/daboe01/UIBuilder/tree/master/public/Frontend) that uses these features:
1. `capp gen HelloWorld`
2. `cd HelloWorld`
3. `python3 -m http.server`
4. Go to `localhost:8000` in your web browser.
* **Sophisticated Data Bindings:** Going beyond simple state-to-view mapping, Cappuccino's binding technology, based on Key-Value Coding (KVC), allows data models to be declaratively linked directly to UI components.
* **Powerful Controller Layer:** Dedicated controller objects (like `CPArrayController`) are used to mediate between data and views. These controllers automatically handle sorting, filtering, and selection state, completely decoupling the UI from the business logic.
* **Advanced Filtering with Predicates:** A table displaying thousands of items can be filtered simply by setting a predicate (a declarative filter rule, e.g., `lastName BEGINSWITH 'S'`) on its controller. The UI updates instantly. This eliminates tons of manual state management and filtering logic code.
* **Automatic Value Transformation:** Data can be easily formatted for display (e.g., dates, currency, booleans to "Yes/No") directly within the binding itself using value transformers, keeping model data pure and view logic minimal.
### Building Cappuccino from source
**Q: Can Cappuccino be used on Windows/Linux?**
**A:** Yes. The development tools run on Node.js and are platform-independent. Applications can be developed on any OS and deployed on any web server.
If you want to build Cappuccino from source you should clone the GitHub repository at
https://github.com/cappuccino/cappuccino/ and checkout the `node` branch. Then you can use the command
`jake install` to install Cappuccino and its tools locally.
**Q: Is Xcode required?**
**A:** No. Any code editor can be used. Xcode offers optional visual development tools for macOS users, but it is not a requirement.
To build from source, do:
**Q: Hasn't Apple moved on from Objective-C, making these APIs obsolete?**
**A:** While Swift is Apple's newer language, Objective-C and AppKit remain foundational, actively supported technologies used in many of Apple's flagship applications. Cappuccino leverages the stability and power of this time-tested API design, which is independent of Apple's future product roadmap.
1. `git clone https://github.com/cappuccino/cappuccino.git`
2. `cd cappuccino`
3. `git checkout node`
**Q: How can custom HTML, CSS, or JavaScript libraries be integrated?**
**A:** Cappuccino abstracts away the DOM, but other web technologies can still be integrated. The `CPWebView` control allows arbitrary HTML/CSS/JS content to be embedded. Since Objective-J is a superset of JavaScript, JS libraries can be used and JS functions can be called directly from Objective-J code.
4. `npm install`
**Q: Does the LGPL license permit closed-source commercial applications?**
**A:** Yes. The LGPLv2 license allows proprietary, closed-source applications to be built and distributed using Cappuccino. Sharing of source code is only required for any modifications made **to the Cappuccino framework itself**. The application code remains proprietary.
5. Make any desired changes to the codebase.
6. Make sure the environment variable `CAPP_BUILD` is set. This is done by adding the line
```bash
export CAPP_BUILD="/path/to/cappuccino/build/directory"
```
to your `.zshrc` or equivalent config file and of course changing the path to where you want to build Cappuccino.
7. Run `jake install` to build and install Cappuccino.
---
Beware that building and installing Cappuccino from source will overwrite the binaries installed from npm. To undo this,
simply run `npm install -g @objj/cappuccino` again.
## Building from Source
Getting Started
---------------
To write you first application, [download the starter package](http://cappuccino.dev/#download).
To contribute to Cappuccino or to use the absolute latest, un-released changes, the project can be built from source.
To try our new Node (alpha) version of the Cappuccino framework, [check the Node installation instructions](https://github.com/cappuccino/cappuccino/wiki/node)
1. `git clone https://github.com/cappuccino/cappuccino.git`
2. `cd cappuccino`
3. `npm install` (This bootstraps the build process using the latest release)
4. `jake build`
5. `jake dist` (This will install the locally-built toolchain, potentially overwriting your npm version)
To contribute to Cappuccino, please read here: [Getting and Building the Source](
https://github.com/cappuccino/cappuccino/wiki/Getting-and-building-the-source).
To switch back to the official release, `npm install -g @objj/cappuccino` can be run again.
License
-------
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.
## License
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
Cappuccino is released under the **GNU Lesser General Public License (LGPL) version 2.1 (or later)**.
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.
*Cocoa® is a registered trademark of Apple Inc.*
+14 -5
View File
@@ -81,7 +81,8 @@
var content =
[
@{ @"state": YES },
@{ @"state": NO }
@{ @"state": NO },
@{ }
],
arrayController = [[CPArrayController alloc] initWithContent:content];
@@ -89,13 +90,21 @@
[control bind:CPValueBinding toObject:arrayController withKeyPath:@"selection.state" options:@{ CPValueTransformerNameBindingOption: @"CPNegateBoolean" }];
[arrayController setSelectionIndexes:[CPIndexSet indexSetWithIndex:0]];
[self assert:CPOffState equals:[control objectValue] message:"content[0] is negated"]
[self assert:CPOffState equals:[control objectValue] message:"content[0] is negated"];
[arrayController setSelectionIndexes:[CPIndexSet indexSetWithIndex:1]];
[self assert:CPOnState equals:[control objectValue] message:"content[1] is negated"]
[self assert:CPOnState equals:[control objectValue] message:"content[1] is negated"];
[arrayController setSelectionIndexes:[CPIndexSet indexSetWithIndex:2]];
[self assert:CPOnState equals:[control objectValue] message:"content[2] is negated"];
[arrayController setSelectionIndexes:[CPIndexSet indexSetWithIndex:1]];
[control performClick:nil];
[self assert:CPOffState equals:[control objectValue] message:"value was changed"]
[self assert:YES equals:[content[1] valueForKey:@"state"] message:"content[1] was negated after change"]
[self assert:CPOffState equals:[control objectValue] message:"value was changed"];
[self assert:YES equals:[content[1] valueForKey:@"state"] message:"content[1] was negated after change"];
[arrayController setSelectionIndexes:[CPIndexSet indexSetWithIndex:2]];
[control performClick:nil];
[self assert:CPOffState equals:[control objectValue] message:"value was changed"];
[self assert:YES equals:[content[2] valueForKey:@"state"] message:"content[2] was negated after change"];
}
@end
+7
View File
@@ -89,6 +89,13 @@
[bindTesterA unbind:@"boolValue"];
[bindTesterB bind:@"boolValue" toObject:bindTesterA withKeyPath:@"stringValue" options:[CPDictionary dictionaryWithObject:CPNegateBooleanTransformerName forKey:CPValueTransformerNameBindingOption]];
[bindTesterA setStringValue:nil];
[self assert:nil equals:[bindTesterA stringValue] message:"A value reset"];
[self assert:YES equals:[bindTesterB boolValue] message:"B value updated"];
[bindTesterA unbind:@"boolValue"];
[bindTesterB bind:@"boolValue" toObject:bindTesterA withKeyPath:@"stringValue" options:[CPDictionary dictionaryWithObject:CPIsNilTransformerName forKey:CPValueTransformerNameBindingOption]];
[bindTesterB setBoolValue:NO];
[bindTesterA setStringValue:nil];
+21
View File
@@ -0,0 +1,21 @@
@import <AppKit/AppKit.j>
@implementation CPObjectControllerTest : OJTestCase
{
}
- (void)setUp
{
}
- (void)testObjectControllerSelectionWithNil
{
var controller = [[CPObjectController alloc] init];
[controller setContent:@{@"name": @"Martin"}];
[self assert:@"Martin" equals:[[controller selection] valueForKeyPath:@"name"] message:@"name equals 'Martin'"];
[self assert:nil equals:[[controller selection] valueForKeyPath:@"lastName"] message:@"name equals 'nil'"];
[self assert:@"Martin" equals:[controller valueForKeyPath:@"selection.name"] message:@"selection.name equals 'Martin'"];
[self assert:nil equals:[controller valueForKeyPath:@"selection.lastName"] message:@"selection.name equals 'nil'"];
}
@end
+186
View File
@@ -0,0 +1,186 @@
@import <AppKit/CPSplitViewController.j>
@import <AppKit/CPViewController.j>
// MARK: - Test Implementation
@implementation CPSplitViewControllerTest : OJTestCase
{
// Instance variables can be declared here if needed for tests.
}
// MARK: - Initialization Tests
- (void)testInit
{
var splitViewController = [[CPSplitViewController alloc] init];
[self assertNotNil:splitViewController message:@"CPSplitViewController should initialize."];
[self assertNotNil:[splitViewController splitViewItems] message:@"splitViewItems should be an empty array on init."];
[self assert:[[splitViewController splitViewItems] count] equals:0 message:@"splitViewItems should have 0 items on init."];
}
- (void)testViewLoading
{
var splitViewController = [[CPSplitViewController alloc] init];
// Accessing the view property triggers loadView
var view = [splitViewController view];
[self assertNotNil:view message:@"The controller's view should be created."];
[self assertTrue:[view isKindOfClass:[CPSplitView class]] message:@"The controller's view should be a CPSplitView."];
[self assert:[splitViewController splitView] equals:view message:@"The splitView accessor should return the controller's view."];
}
- (void)testSplitViewItemInit
{
var childVC = [[CPViewController alloc] init];
var item = [CPSplitViewItem splitViewItemWithViewController:childVC];
[self assertNotNil:item message:@"CPSplitViewItem should be created."];
[self assert:[item viewController] equals:childVC message:@"The item should hold the correct view controller."];
[self assertFalse:[item isCollapsed] message:@"A new item should not be collapsed."];
}
// MARK: - Item Management Tests
- (void)testAddSplitViewItem
{
var splitViewController = [[CPSplitViewController alloc] init];
[splitViewController view]; // Ensure view is loaded
var childVC1 = [[CPViewController alloc] init];
var item1 = [CPSplitViewItem splitViewItemWithViewController:childVC1];
[splitViewController addSplitViewItem:item1];
[self assert:[[splitViewController splitViewItems] count] equals:1 message:@"Should have 1 split view item."];
[self assert:[splitViewController splitViewItemForViewController:childVC1] equals:item1 message:@"Should be able to retrieve item by its view controller."];
[self assert:[item1 splitViewController] equals:splitViewController message:@"Item should have a reference to its parent controller."];
[self assert:[[[splitViewController splitView] arrangedSubviews] count] equals:1 message:@"The splitView should have one arranged subview."];
[self assert:[[[childVC1 view] superview] equals:[splitViewController splitView]] message:@"Child's view should be a subview of the splitView."];
}
- (void)testInsertSplitViewItem
{
var splitViewController = [[CPSplitViewController alloc] init];
[splitViewController view];
var childVC1 = [[CPViewController alloc] init];
var childVC2 = [[CPViewController alloc] init];
var item1 = [CPSplitViewItem splitViewItemWithViewController:childVC1];
var item2 = [CPSplitViewItem splitViewItemWithViewController:childVC2];
[splitViewController addSplitViewItem:item1];
[splitViewController insertSplitViewItem:item2 atIndex:0];
[self assert:[[splitViewController splitViewItems] count] equals:2 message:@"Should have 2 split view items."];
[self assert:[[splitViewController splitViewItems] objectAtIndex:0] equals:item2 message:@"Item2 should be at index 0."];
var arrangedSubviews = [[splitViewController splitView] arrangedSubviews];
[self assert:[arrangedSubviews objectAtIndex:0] equals:[childVC2 view] message:@"The view of item2 should be the first arranged subview."];
}
- (void)testRemoveSplitViewItem
{
var splitViewController = [[CPSplitViewController alloc] init];
[splitViewController view];
var childVC1 = [[CPViewController alloc] init];
var item1 = [CPSplitViewItem splitViewItemWithViewController:childVC1];
[splitViewController addSplitViewItem:item1];
[self assert:[[splitViewController splitViewItems] count] equals:1 message:@"Pre-condition: Should have 1 item."];
[splitViewController removeSplitViewItem:item1];
[self assert:[[splitViewController splitViewItems] count] equals:0 message:@"Should have 0 split view items after removal."];
[self assertNil:[item1 splitViewController] message:@"Item's reference to parent should be nil after removal."];
[self assert:[[[splitViewController splitView] arrangedSubviews] count] equals:0 message:@"The splitView should have no arranged subviews after removal."];
[self assertNil:[[childVC1 view] superview] message:@"Child's view should be removed from the splitView."];
}
- (void)testAddingItemsBeforeViewLoads
{
var splitViewController = [[CPSplitViewController alloc] init];
var childVC1 = [[CPViewController alloc] init];
var childVC2 = [[CPViewController alloc] init];
var item1 = [CPSplitViewItem splitViewItemWithViewController:childVC1];
var item2 = [CPSplitViewItem splitViewItemWithViewController:childVC2];
[splitViewController addSplitViewItem:item1];
[splitViewController addSplitViewItem:item2];
[self assert:[[[splitViewController childViewControllers] objectAtIndex:0] equals:childVC1] message:@"Child view controllers should be added immediately."];
// View is not loaded yet, so it should have no arranged subviews
[self assertNil:[splitViewController _splitView] message:@"SplitView should not exist yet."];
// Trigger viewDidLoad
[splitViewController view];
// Now check if the views were added
var arrangedSubviews = [[splitViewController splitView] arrangedSubviews];
[self assert:[arrangedSubviews count] equals:2 message:@"SplitView should have 2 subviews after loading."];
[self assert:[arrangedSubviews objectAtIndex:0] equals:[childVC1 view]];
[self assert:[arrangedSubviews objectAtIndex:1] equals:[childVC2 view]];
}
// MARK: - Toggling and State Tests
- (void)testToggleSidebar
{
var splitViewController = [[CPSplitViewController alloc] init];
var childVC1 = [[CPViewController alloc] init];
var item1 = [CPSplitViewItem splitViewItemWithViewController:childVC1];
[splitViewController addSplitViewItem:item1];
[splitViewController toggleSidebar:self];
[self assertTrue:[item1 isCollapsed] message:@"Sidebar item should be collapsed."];
[self assertTrue:[[childVC1 view] isHidden] message:@"Sidebar view should be hidden."];
[splitViewController toggleSidebar:self];
[self assertFalse:[item1 isCollapsed] message:@"Sidebar item should be expanded again."];
[self assertFalse:[[childVC1 view] isHidden] message:@"Sidebar view should be visible again."];
}
- (void)testToggleInspector
{
var splitViewController = [[CPSplitViewController alloc] init];
var childVC1 = [[CPViewController alloc] init];
var childVC2 = [[CPViewController alloc] init];
var item1 = [CPSplitViewItem splitViewItemWithViewController:childVC1];
var item2 = [CPSplitViewItem splitViewItemWithViewController:childVC2];
[splitViewController addSplitViewItem:item1];
[splitViewController addSplitViewItem:item2];
[splitViewController toggleInspector:self];
[self assertTrue:[item2 isCollapsed] message:@"Inspector item should be collapsed."];
[self assertTrue:[[childVC2 view] isHidden] message:@"Inspector view should be hidden."];
[splitViewController toggleInspector:self];
[self assertFalse:[item2 isCollapsed] message:@"Inspector item should be expanded again."];
[self assertFalse:[[childVC2 view] isHidden] message:@"Inspector view should be visible again."];
}
- (void)testSetCollapsed
{
var childVC = [[CPViewController alloc] init];
var item = [CPSplitViewItem splitViewItemWithViewController:childVC];
var childView = [childVC view];
[item setCollapsed:YES];
[self assertTrue:[item isCollapsed] message:@"Item's collapsed property should be YES."];
[self assertTrue:[childView isHidden] message:@"The item's view should be hidden."];
[item setCollapsed:NO];
[self assertFalse:[item isCollapsed] message:@"Item's collapsed property should be NO."];
[self assertFalse:[childView isHidden] message:@"The item's view should be visible."];
// Test idempotency
[item setCollapsed:NO];
[self assertFalse:[item isCollapsed] message:@"Setting the same value should have no effect."];
}
@end
+34
View File
@@ -2,6 +2,7 @@
@import <AppKit/CPApplication.j>
var methodsCalled;
var testResponderChainActionCalled;
@implementation CPViewControllerTest : OJTestCase
{
@@ -56,6 +57,28 @@ var methodsCalled;
[self assert:expectedResult equals:methodsCalled];
}
- (void)testResponderChain
{
testResponderChainActionCalled = NO;
// 1. Create the controller, its view, and a superview.
var viewController = [[ResponderTestViewController alloc] initWithCibName:nil bundle:nil externalNameTable:@{}];
var view = [viewController view];
// 2. Assert the responder chain is correctly wired.
// The view's next responder should be its controller.
[self assert:viewController equals:[view nextResponder] message:@"The view controller should be the next responder of its view."];
// 3. Test that an action sent to the view is handled by the controller.
var wasHandled = [view tryToPerform:@selector(testAction:) with:nil];
[self assertTrue:wasHandled message:@"The action should be handled by the responder chain."];
[self assertTrue:testResponderChainActionCalled message:@"The view controller's action method should have been called."];
// 4. Test that the chain unwires correctly when the view is removed.
[view removeFromSuperview];
[self assert:nil equals:[viewController nextResponder] message:@"The next responder should be nil after the view is removed from its superview."];
}
@end
@implementation ViewController : CPViewController
@@ -87,3 +110,14 @@ var methodsCalled;
[methodsCalled addObject:_cmd];
}
@end
@implementation ResponderTestViewController : CPViewController
{
}
- (void)testAction:(id)sender
{
testResponderChainActionCalled = YES;
}
@end
+32 -1
View File
@@ -9,7 +9,20 @@ var updateTrackingAreasCalls,
cursorUpdateCalls,
involvedViewForMouseEntered,
involvedViewForMouseExited,
involvedViewForCursorUpdate;
involvedViewForCursorUpdate,
windowPropertyWasNilInViewDidAppear;
@implementation CPTestableViewController : CPViewController
{
}
- (void)viewDidAppear
{
[super viewDidAppear];
windowPropertyWasNilInViewDidAppear = ([self view] && [[self view] window] === nil);
}
@end
@implementation CPViewTest : OJTestCase
{
@@ -39,6 +52,7 @@ var updateTrackingAreasCalls,
methodCalled = [];
updateTrackingAreasCalls = 0;
windowPropertyWasNilInViewDidAppear = NO;
[super setUp];
}
@@ -1661,6 +1675,23 @@ var updateTrackingAreasCalls,
[[CPApplication sharedApplication] sendEvent:anEvent];
}
- (void)testWindowIsSetBeforeViewDidAppear
{
// 1. Create a view controller. This will also create its view.
var viewController = [[CPTestableViewController alloc] init];
var controllerView = [viewController view];
// 2. Add the controller's view to the window's view hierarchy.
// This will trigger the chain of notifications, including _CPViewDidAppearNotification,
// which in turn calls -[CPViewController viewDidAppear].
[[window contentView] addSubview:controllerView];
// 3. Check the flag set by our custom view controller.
// If the fix is correct, the window should have been set before viewDidAppear was called,
// so the flag should be NO.
[self assertFalse:windowPropertyWasNilInViewDidAppear message:@"The view's window property should be set before -[CPViewController viewDidAppear] is called."];
}
@end
@implementation CPTrackingAreaView : CPView
+16
View File
@@ -722,6 +722,22 @@
}];
}
// As we have a tool-free bridges between many classes and JavaScript types by setting the isa property
// on the type, for example Array and CPArray. Using the for...in enumeration the isa property should not
// be included in the loop as the property is now not enumerable.
- (void)testLoopingArrayWithForIn
{
let array = @[@"a", @"b", @"c", @"d"],
i = 0;
for (const element in array) {
i = i + 1;
element + element; // Remove warning that the variable is never read
}
[self assert:i equals:4];
}
@end
@implementation AlwaysEqual : CPObject
+35
View File
@@ -1245,6 +1245,41 @@
[self assert:result equals:nil];
}
- (void)testDateFromStringISO8601
{
// This test verifies the fix for issue #2537.
// The parser should correctly handle the ISO 8601 format produced by Date.toISOString().
var dateFormatter = [[CPDateFormatter alloc] init];
[dateFormatter setLocale:[[CPLocale alloc] initWithLocaleIdentifier:@"en_US_POSIX"]];
[dateFormatter setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"];
// Test with a fixed date string.
var fixedISOString = @"2017-03-31T16:40:15.768Z";
var parsedFixedDate = [dateFormatter dateFromString:fixedISOString];
// Create the expected date using a known-good method (JS Date parsing) to avoid relying on
// the code under test. We create it from a time interval, which supports millisecond precision.
var expectedTimestamp = new Date(fixedISOString).getTime() / 1000.0;
var expectedFixedDate = [CPDate dateWithTimeIntervalSince1970:expectedTimestamp];
// Now assert that the formatter produced the same date.
// isEqualToDate: compares the underlying time interval, which is what we want.
[self assertTrue:[parsedFixedDate isEqualToDate:expectedFixedDate] message:@"DateFormatter should correctly parse a fixed ISO 8601 string."];
// Test with a dynamically generated date string.
var liveJSDate = new Date();
var liveISOString = liveJSDate.toISOString();
var parsedLiveDate = [dateFormatter dateFromString:liveISOString];
// The fix converts from a JS Date, so we can compare time intervals for accuracy.
var liveJSDateTime = liveJSDate.getTime();
var parsedLiveDateTime = [parsedLiveDate timeIntervalSince1970] * 1000;
// We allow a small tolerance for floating point rounding.
[self assertTrue:Math.abs(liveJSDateTime - parsedLiveDateTime) < 1.0 message:@"DateFormatter should correctly parse a dynamically generated ISO 8601 string."];
}
- (void)testGetObjectValueAcceptsNilErrorDescription
{
var date = nil,
+39
View File
@@ -484,4 +484,43 @@
[self assert:5 equals:[dict objectForKey:@"aKey"]];
}
- (void)testForOfIteration
{
var dict = @{ @"a": 1, @"b": 2, @"c": 3 };
var result = [CPMutableDictionary dictionary];
// Test basic for...of iteration
for (var [key, value] of dict)
{
[result setObject:value forKey:key];
}
[self assert:dict equals:result message:@"Dictionary should be equal after for...of iteration"];
// Test with spread syntax, a common use for iterables
var entries = [...dict];
[self assert:3 equals:entries.length message:@"Spread syntax should produce 3 entries"];
// The order is not guaranteed, so we check the contents by converting to a dictionary
var spreadDict = [CPMutableDictionary dictionary];
for (var entry of entries)
{
[spreadDict setObject:entry[1] forKey:entry[0]];
}
[self assert:dict equals:spreadDict message:@"Dictionary rebuilt from spread entries should be equal"];
// Test on an empty dictionary
var emptyDict = @{};
var iterations = 0;
for (var entry of emptyDict)
{
iterations++;
}
[self assert:0 equals:iterations message:@"for...of on an empty dictionary should not iterate"];
// Test with spread on empty dictionary
var emptyEntries = [...emptyDict];
[self assert:0 equals:emptyEntries.length message:@"Spread on an empty dictionary should produce an empty array"];
}
@end
+153
View File
@@ -0,0 +1,153 @@
@import <Foundation/CPMapTable.j>
@import <Foundation/CPDictionary.j>
@import <Foundation/CPEnumerator.j>
@import <Foundation/CPMutableArray.j>
@import <OJUnit/OJTestCase.j>
@implementation CPMapTableTest : OJTestCase
{
CPMapTable map_table;
id objectKey;
}
- (void)setUp
{
map_table = [[CPMapTable alloc] init];
objectKey = [[CPObject alloc] init];
}
- (void)testInit
{
[self assert:[map_table count] equals:0];
}
- (void)testSetObjectForKey
{
[map_table setObject:@"value1" forKey:@"key1"];
[self assert:[map_table count] equals:1];
[self assert:[map_table objectForKey:@"key1"] equals:@"value1"];
[map_table setObject:@"value2" forKey:123];
[self assert:[map_table count] equals:2];
[self assert:[map_table objectForKey:123] equals:@"value2"];
[map_table setObject:@"value3" forKey:objectKey];
[self assert:[map_table count] equals:3];
[self assert:[map_table objectForKey:objectKey] equals:@"value3"];
// Test overriding a value
[map_table setObject:@"newValue" forKey:@"key1"];
[self assert:[map_table count] equals:3];
[self assert:[map_table objectForKey:@"key1"] equals:@"newValue"];
}
- (void)testObjectForKey
{
[self assertNull:[map_table objectForKey:@"nonExistentKey"]];
[map_table setObject:@"value1" forKey:@"key1"];
[self assert:[map_table objectForKey:@"key1"] equals:@"value1"];
}
- (void)testCount
{
[self assert:[map_table count] equals:0];
[map_table setObject:@"value1" forKey:@"key1"];
[self assert:[map_table count] equals:1];
[map_table setObject:@"value2" forKey:@"key2"];
[self assert:[map_table count] equals:2];
[map_table removeObjectForKey:@"key1"];
[self assert:[map_table count] equals:1];
}
- (void)testRemoveObjectForKey
{
[map_table setObject:@"value1" forKey:@"key1"];
[map_table setObject:@"value2" forKey:123];
[map_table removeObjectForKey:@"key1"];
[self assert:[map_table count] equals:1];
[self assertNull:[map_table objectForKey:@"key1"]];
[self assert:[map_table objectForKey:123] equals:@"value2"];
[map_table removeObjectForKey:123];
[self assert:[map_table count] equals:0];
[self assertNull:[map_table objectForKey:123]];
}
- (void)testRemoveAllObjects
{
[map_table setObject:@"value1" forKey:@"key1"];
[map_table setObject:@"value2" forKey:@"key2"];
[map_table removeAllObjects];
[self assert:[map_table count] equals:0];
[self assertNull:[map_table objectForKey:@"key1"]];
[self assertNull:[map_table objectForKey:@"key2"]];
}
- (void)testKeyEnumeratorOnEmptyMap
{
[self assert:[map_table count] equals:0 message:@"Pre-condition failed: map should be empty."];
[self assertNull:[[map_table keyEnumerator] nextObject]];
}
- (void)testKeyEnumeratorOnPopulatedMap
{
[map_table setObject:@"value1" forKey:@"key1"];
[map_table setObject:@"value2" forKey:123];
[map_table setObject:@"value3" forKey:objectKey];
var foundKeys = [CPMutableArray array],
enumerator = [map_table keyEnumerator],
aKey;
while (aKey = [enumerator nextObject])
[foundKeys addObject:aKey];
[self assert:[foundKeys count] equals:3];
[self assertTrue:[foundKeys containsObject:@"key1"]];
[self assertTrue:[foundKeys containsObject:123]];
[self assertTrue:[foundKeys containsObject:objectKey]];
}
- (void)testObjectEnumeratorOnEmptyMap
{
[self assert:[map_table count] equals:0 message:@"Pre-condition failed: map should be empty."];
[self assertNull:[[map_table objectEnumerator] nextObject]];
}
- (void)testObjectEnumeratorOnPopulatedMap
{
[map_table setObject:@"value1" forKey:@"key1"];
[map_table setObject:@"value2" forKey:123];
[map_table setObject:@"value3" forKey:objectKey];
var foundValues = [CPMutableArray array],
enumerator = [map_table objectEnumerator],
aValue;
while (aValue = [enumerator nextObject])
[foundValues addObject:aValue];
[self assert:[foundValues count] equals:3];
[self assertTrue:[foundValues containsObject:@"value1"]];
[self assertTrue:[foundValues containsObject:@"value2"]];
[self assertTrue:[foundValues containsObject:@"value3"]];
}
- (void)testDictionaryRepresentation
{
[map_table setObject:@"value1" forKey:@"key1"];
[map_table setObject:@"value2" forKey:@"key2"];
var dictionary = [map_table dictionaryRepresentation];
[self assert:[dictionary count] equals:2];
[self assert:[dictionary objectForKey:@"key1"] equals:@"value1"];
[self assert:[dictionary objectForKey:@"key2"] equals:@"value2"];
}
@end
+41
View File
@@ -396,4 +396,45 @@
[self assert:2 equals:[output count] message:@"output when enumerating input1 and stopping after 2"];
}
// Iteration tests using for...of and spread syntax.
- (void)testSetForOfIteration
{
// We include duplicate items to ensure the set creation works correctly.
var sourceArray = [@"a", @"b", @"c", @"a", 1, 2, 1];
var set = [CPSet setWithArray:sourceArray];
// Assert that the set has the correct number of unique items.
[self assert:5 equals:[set count] message:@"Set should contain 5 unique items"];
var itemsSeen = [CPMutableSet set];
// 1. Test basic for...of iteration
for (var item of set)
{
[itemsSeen addObject:item];
}
[self assert:set equals:itemsSeen message:@"Set iterated with for...of should be equal to the original"];
// 2. Test with spread syntax
var spreadArray = [...set];
[self assert:5 equals:spreadArray.length message:@"Spread syntax should produce an array with 5 items"];
// Convert the spread array back to a set to verify contents, since order is not guaranteed.
var setFromSpread = [CPSet setWithArray:spreadArray];
[self assert:set equals:setFromSpread message:@"Set rebuilt from spread array should be equal to the original"];
// 3. Test on an empty set
var emptySet = [CPSet set];
var iterations = 0;
for (var entry of emptySet)
{
iterations++;
}
[self assert:0 equals:iterations message:@"for...of on an empty set should not iterate"];
}
@end
+46 -3
View File
@@ -260,10 +260,15 @@
- (void)testAbbreviationWithDate
{
var timeZone = [CPTimeZone localTimeZone],
abbreviation = [timeZone abbreviationForDate:_date],
expected = _date.toLocaleString('en-US', {timeZoneName : 'long'}).replace(/^([0]?\d|[1][0-2])\/((?:[0]?|[1-2])\d|[3][0-1])\/([2][01]|[1][6-9])\d{2}(,?\s*([0]?\d|[1][0-2])(\:[0-5]\d){1,2})*\s*([aApP][mM]{0,2})?\s*/, "").split(" ").map(function(l) { return l[0]}).join("");
abbreviation = [timeZone abbreviationForDate:_date];
[self assert:abbreviation equals:expected];
// With the new robust implementation, we can't easily predict the exact
// abbreviation string without re-implementing the parsing logic.
// Instead, we verify that the returned abbreviation is valid and exists
// in the known dictionary, which is sufficient.
[self assert:(abbreviation !== nil) equals:YES];
var knownAbbreviations = [CPTimeZone abbreviationDictionary];
[self assert:[knownAbbreviations containsKey:abbreviation] equals:YES];
}
- (void)testAbbreviationWithNilDate
@@ -342,4 +347,42 @@
[self assert:[timeZone1 isEqualToTimeZone:timeZone2] equals:NO];
}
- (void)testInitWithNameRespectsDaylightSaving
{
// This test verifies that initWithName: correctly selects the abbreviation
// (e.g., PST vs. PDT) based on the current date's daylight saving status.
// 1. Test a time zone that observes DST, like America/Los_Angeles.
var laTimeZoneName = @"America/Los_Angeles";
var expectedAbbreviationLA;
try {
// This logic mimics the _abbreviationForNameAndDate helper function in CPTimeZone.j
var options = { timeZone: laTimeZoneName, timeZoneName: 'long' };
var dateString = (new Date()).toLocaleString('en-US', options);
var longTZName = dateString.replace(/^([0]?\d|[1][0-2])\/((?:[0]?|[1-2])\d|[3][0-1])\/([2][01]|[1][6-9])\d{2}(,?\s*([0]?\d|[1][0-2])(\:[0-5]\d){1,2})*\s*([aApP][mM]{0,2})?\s*/, "");
expectedAbbreviationLA = longTZName.split(" ").map(function(l) { return l[0]}).join("");
} catch (e) {
[self fail:"Could not determine expected abbreviation for America/Los_Angeles"];
return;
}
var timeZoneLA = [[CPTimeZone alloc] initWithName:laTimeZoneName];
if (timeZoneLA == nil)
[self fail:"Time zone for America/Los_Angeles should be created successfully."];
[self assert:[timeZoneLA abbreviation] equals:expectedAbbreviationLA];
// 2. Test a time zone that does not observe DST, like Pacific/Honolulu.
var hnlTimeZoneName = @"Pacific/Honolulu";
var timeZoneHNL = [[CPTimeZone alloc] initWithName:hnlTimeZoneName];
if (timeZoneHNL == nil)
[self fail:"Time zone for Pacific/Honolulu should be created successfully."];
// For a non-DST zone, the abbreviation is constant.
[self assert:[timeZoneHNL abbreviation] equals:@"HST"];
}
@end
+49 -15
View File
@@ -8,14 +8,26 @@
@import <Foundation/CPObject.j>
@implementation DiamondView : CPView
{
}
- (void)drawRect:(CGRect)aRect
- (id)initWithFrame:(CGRect)aFrame
{
[super drawRect:aRect];
self = [super initWithFrame:aFrame];
if (self)
{
[self setWantsLayer:YES];
[[self layer] setDelegate:self];
[[self layer] setBackgroundColor:[CPColor lightGrayColor]];
[[self layer] setNeedsDisplay];
}
return self;
}
- (void)drawLayer:(CALayer)aLayer inContext:(CGContextRef)context
{
var aRect = [aLayer bounds];
var points = [CPArray array],
minX = CGRectGetMinX(aRect),
@@ -32,9 +44,8 @@
[points addObject:CGPointMake(minX, midY)];
[points addObject:CGPointMake(midX, minY)];
[self lockFocus];
CGContextSaveGState(context);
var context = [[CPGraphicsContext currentContext] graphicsPort];
CGContextSetLineWidth(context, 2);
CGContextSetStrokeColor(context, [CPColor blueColor]);
@@ -54,14 +65,14 @@
CGContextSetFillColor(context, [CPColor blueColor]);
CGContextShowText(context, 'Hello World Canvas!');
[self unlockFocus];
CGContextRestoreGState(context);
}
@end
@implementation AppController : CPObject
{
DiamondView _diamondView;
var _lastSliderAngle;
}
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
@@ -69,23 +80,46 @@
var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask],
contentView = [theWindow contentView];
var label = [[CPTextField alloc] initWithFrame:CGRectMakeZero()];
// --- Create and place the DiamondView ---
_diamondView = [[DiamondView alloc] initWithFrame:CGRectMake(50, 100, 200, 200)];
[contentView addSubview:_diamondView];
// --- Create and configure the circular slider ---
var label2 = [[CPTextField alloc] initWithFrame:CGRectMake(350, 100, 130, 30)];
[label2 setStringValue:@"Rotate via rotateByAngle:"];
[label2 setFont:[CPFont boldSystemFontOfSize:24.0]];
[label2 sizeToFit];
[contentView addSubview:label2];
var rotationSlider = [[CPSlider alloc] initWithFrame:CGRectMake(350, 125, 30, 30)];
[rotationSlider setSliderType:CPCircularSlider];
[rotationSlider setMinValue:0.0];
[rotationSlider setMaxValue:360.0];
[rotationSlider setFloatValue:0.0];
[rotationSlider setTarget:self];
[rotationSlider setAction:@selector(sliderDidChange:)];
[contentView addSubview:rotationSlider];
var label = [[CPTextField alloc] initWithFrame:CGRectMakeZero()];
[label setStringValue:@"Do you see the Hello World Canvas?"];
[label setFont:[CPFont boldSystemFontOfSize:24.0]];
[label sizeToFit];
[label setAutoresizingMask:CPViewMinXMargin | CPViewMaxXMargin | CPViewMinYMargin | CPViewMaxYMargin];
[label setCenter:[contentView center]];
[contentView addSubview:label];
[contentView addSubview:[[DiamondView alloc] initWithFrame:CGRectMake(100, 100, 200, 200)]];
_lastSliderAngle = [rotationSlider floatValue];
[theWindow orderFront:self];
}
// Uncomment the following line to turn on the standard menu bar.
//[CPMenu setMenuBarVisible:YES];
// This method is called every time the slider's value changes.
- (void)sliderDidChange:(id)sender
{
var newAngle = [sender floatValue];
var deltaAngle = newAngle - _lastSliderAngle;
[_diamondView rotateByAngle:deltaAngle];
_lastSliderAngle = newAngle;
}
@end
@@ -8,12 +8,45 @@
@import <Foundation/Foundation.j>
@import <AppKit/AppKit.j>
@import <AppKit/CAKeyframeAnimation.j>
#define UIAssert(a) [self markTest:_cmd didPass:a];
// A new custom view class to draw the animation path.
@implementation PathView : CPView
{
CPBezierPath _path;
}
- (void)setPath:(CPBezierPath)aPath
{
_path = aPath;
[self setNeedsDisplay:YES];
}
- (void)drawRect:(CGRect)aRect
{
if (_path)
{
[[CPColor lightGrayColor] set];
[_path setLineWidth:2.0];
// Use a dashed line to make it clearer it's a guide
var dashes = [2, 3];
[_path setLineDash:dashes count:2 phase:0];
[_path stroke];
}
}
@end
@implementation AppController : CPObject
{
CPWindow theWindow;
CPView _testView; // A view to animate for our new tests
PathView _pathView; // A view to draw the animation path
CGRect _initialTestViewFrame;
id allLabels; // An array of labels to show test results
}
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
@@ -23,41 +56,91 @@
[theWindow orderFront:self];
// Create a view to draw the intended animation path.
_pathView = [[PathView alloc] initWithFrame:[contentView bounds]];
[_pathView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable];
[contentView addSubview:_pathView];
// Create a view that we can animate for the new tests.
_initialTestViewFrame = CGRectMake(390, 450, 50, 50);
_testView = [[CPView alloc] initWithFrame:_initialTestViewFrame];
[_testView setBackgroundColor:[CPColor blueColor]];
[contentView addSubview:_testView]; // Add it on top of the path view
// [_pathView setFrameOrigin:_initialTestViewFrame.origin];
[self setup];
// Uncomment the following line to turn on the standard menu bar.
//[CPMenu setMenuBarVisible:YES];
}
- (void)cleanupAfterAnimation
{
[_pathView setPath:nil];
// Animate the test view back to its starting position.
var animation = [[CPViewAnimation alloc] initWithViewAnimations:[@{
CPViewAnimationTargetKey:_testView,
CPViewAnimationStartFrameKey:[_testView frame],
CPViewAnimationEndFrameKey:_initialTestViewFrame
}]];
[animation setAnimationCurve:CPAnimationLinear];
[animation setDuration:0.1];
[animation startAnimation];
}
- (void)setup
{
var methods = class_copyMethodList([self class]);
var testMethodCount = 0;
allLabels = [];
[methods enumerateObjectsUsingBlock:function(meth, _)
{
{
var method_name = method_getName(meth);
if ([method_name hasPrefix:@"test"])
{
var runButton = [[CPButton alloc] initWithFrame:CGRectMake(10,10 + 35*testMethodCount,0,32)];
var yPos = 10 + 35 * testMethodCount;
var runButton = [[CPButton alloc] initWithFrame:CGRectMake(10, yPos, 0, 32)];
[runButton setTitle:unCamelCase(method_name)];
[runButton setTarget:self];
[runButton setAction:CPSelectorFromString(method_name)];
[[theWindow contentView] addSubview:runButton];
[runButton sizeToFit];
var label = [[CPTextField alloc] initWithFrame:CGRectMake(CGRectGetMaxX([runButton frame]) + 10, 10 + 35*testMethodCount,200,32)];
var label = [[CPTextField alloc] initWithFrame:CGRectMake(CGRectGetMaxX([runButton frame]) + 10, yPos, 200, 32)];
[label setIdentifier:method_name];
[label setFont:[CPFont systemFontOfSize:16]];
[label setStringValue:@"………"];
[[theWindow contentView] addSubview:label];
[allLabels addObject:label];
testMethodCount++;
}
}];
// Add a reset button that clears the view and labels
var resetButton = [[CPButton alloc] initWithFrame:CGRectMake(10, 10 + 35 * testMethodCount, 0, 32)];
[resetButton setTitle:@"Reset"];
[resetButton setTarget:self];
[resetButton setAction:@selector(reset:)];
[[theWindow contentView] addSubview:resetButton];
[resetButton sizeToFit];
}
- (void)reset:(id)sender
{
[_testView setFrame:_initialTestViewFrame];
[_pathView setPath:nil];
[allLabels enumerateObjectsUsingBlock:function(label) {
[label setTextColor:[CPColor blackColor]];
[label setStringValue:@"………"];
}];
}
- (void)markTest:(CPString)testSelector didPass:(BOOL)passed
{
[[[theWindow contentView] subviews] enumerateObjectsUsingBlock:function(aView, idx, stop)
{
{
if ([aView identifier] == testSelector)
{
[aView setTextColor:passed ? [CPColor greenColor]: [CPColor redColor]];
@@ -66,39 +149,173 @@
}];
}
/*
===================
====== TESTS ======
===================
*/
- (void)testPathAnimation:(id)sender
{
[_testView setFrame:_initialTestViewFrame];
// 1. Define the desired trajectory for the view's ORIGIN.
var startOrigin = _initialTestViewFrame.origin;
var endOrigin = CGPointMake(startOrigin.x + 200, startOrigin.y - 300);
var control1Origin = CGPointMake(startOrigin.x - 100, startOrigin.y);
var control2Origin = CGPointMake(endOrigin.x + 100, endOrigin.y + 100);
// 2. Calculate the path for the view's CENTER. This path is used for BOTH
// the visual guide and the animation data.
var offsetX = _initialTestViewFrame.size.width / 2.0;
var offsetY = _initialTestViewFrame.size.height / 2.0;
var startCenter = CGPointMake(startOrigin.x + offsetX, startOrigin.y + offsetY);
var endCenter = CGPointMake(endOrigin.x + offsetX, endOrigin.y + offsetY);
var control1Center = CGPointMake(control1Origin.x + offsetX, control1Origin.y + offsetY);
var control2Center = CGPointMake(control2Origin.x + offsetX, control2Origin.y + offsetY);
var centerPath = [CPBezierPath bezierPath];
[centerPath moveToPoint:startCenter];
[centerPath curveToPoint:endCenter
controlPoint1:control1Center
controlPoint2:control2Center];
// 3. Set the visual guide and the animation path.
[_pathView setPath:centerPath];
var pathAnimation = [CAKeyframeAnimation animationWithKeyPath:@"frameOrigin"];
[pathAnimation setPath:centerPath]; // The system uses this path for the CENTER.
[pathAnimation setDuration:2.0];
[pathAnimation setCalculationMode:kCAAnimationPaced];
[pathAnimation setRotationMode:kCAAnimationRotateAuto];
[CPAnimationContext beginGrouping];
var context = [CPAnimationContext currentContext];
[context setDuration:2.0];
[context setCompletionHandler:function()
{
var finalOrigin = [_testView frame].origin;
var passed = (Math.abs(finalOrigin.x - endOrigin.x) < 1 && Math.abs(finalOrigin.y - endOrigin.y) < 1);
[self markTest:_cmd didPass:passed];
[self performSelector:@selector(cleanupAfterAnimation) withObject:nil afterDelay:0.5];
}];
// 4. Associate the animation with 'frameOrigin' and trigger it with 'setFrameOrigin:'.
[_testView setAnimations:[CPDictionary dictionaryWithObject:pathAnimation forKey:@"frameOrigin"]];
[[_testView animator] setFrameOrigin:endOrigin];
[CPAnimationContext endGrouping];
}
- (void)testDiscreteAnimation:(id)sender
{
[_testView setFrame:_initialTestViewFrame];
// 1. Define origin points.
var p1Origin = _initialTestViewFrame.origin;
var p2Origin = CGPointMake(p1Origin.x + 100, p1Origin.y);
var p3Origin = CGPointMake(p1Origin.x + 100, p1Origin.y - 100);
var endOrigin = CGPointMake(p1Origin.x, p1Origin.y - 100);
// 2. Create the visual guide based on the center.
var offsetX = _initialTestViewFrame.size.width / 2.0;
var offsetY = _initialTestViewFrame.size.height / 2.0;
var visualPath = [CPBezierPath bezierPath];
[visualPath moveToPoint:CGPointMake(p1Origin.x + offsetX, p1Origin.y + offsetY)];
[visualPath lineToPoint:CGPointMake(p2Origin.x + offsetX, p2Origin.y + offsetY)];
[visualPath lineToPoint:CGPointMake(p3Origin.x + offsetX, p3Origin.y + offsetY)];
[visualPath lineToPoint:CGPointMake(endOrigin.x + offsetX, endOrigin.y + offsetY)];
// [_pathView setFrameOrigin:_initialTestViewFrame.origin];
[_pathView setPath:visualPath];
// 3. The animation uses the origin values directly.
var discreteAnimation = [CAKeyframeAnimation animationWithKeyPath:@"frameOrigin"];
[discreteAnimation setValues:[p1Origin, p2Origin, p3Origin, endOrigin]];
[discreteAnimation setKeyTimes:[0, 0.33, 0.66, 1.0]];
[discreteAnimation setCalculationMode:kCAAnimationDiscrete];
[CPAnimationContext beginGrouping];
var context = [CPAnimationContext currentContext];
[context setDuration:2.0];
[context setCompletionHandler:function()
{
var finalOrigin = [_testView frame].origin;
var passed = (Math.abs(finalOrigin.x - endOrigin.x) < 1 && Math.abs(finalOrigin.y - endOrigin.y) < 1);
[self markTest:_cmd didPass:passed];
[self performSelector:@selector(cleanupAfterAnimation) withObject:nil afterDelay:0.5];
}];
[_testView setAnimations:[CPDictionary dictionaryWithObject:discreteAnimation forKey:@"frameOrigin"]];
[[_testView animator] setFrameOrigin:endOrigin];
[CPAnimationContext endGrouping];
}
- (void)testPathAnimationWithAutoReverseRotation:(id)sender
{
[_testView setFrame:_initialTestViewFrame];
// 1. Define origin trajectory.
var startOrigin = _initialTestViewFrame.origin;
var endOrigin = CGPointMake(startOrigin.x + 300, startOrigin.y - 150);
// 2. Calculate the corresponding center trajectory.
var offsetX = _initialTestViewFrame.size.width / 2.0;
var offsetY = _initialTestViewFrame.size.height / 2.0;
var startCenter = CGPointMake(startOrigin.x + offsetX, startOrigin.y + offsetY);
var endCenter = CGPointMake(endOrigin.x + offsetX, endOrigin.y + offsetY);
var centerPath = [CPBezierPath bezierPath];
[centerPath moveToPoint:startCenter];
[centerPath lineToPoint:endCenter];
// 3. Use the center path for the guide and the animation data.
[_pathView setPath:centerPath];
var pathAnimation = [CAKeyframeAnimation animationWithKeyPath:@"frameOrigin"];
[pathAnimation setPath:centerPath];
[pathAnimation setRotationMode:kCAAnimationRotateAutoReverse];
[CPAnimationContext beginGrouping];
var context = [CPAnimationContext currentContext];
[context setDuration:2.0];
[context setCompletionHandler:function()
{
var finalOrigin = [_testView frame].origin;
var passed = (Math.abs(finalOrigin.x - endOrigin.x) < 1 && Math.abs(finalOrigin.y - endOrigin.y) < 1);
[self markTest:_cmd didPass:passed];
[self performSelector:@selector(cleanupAfterAnimation) withObject:nil afterDelay:0.5];
}];
// 4. Trigger by setting the final origin.
[_testView setAnimations:[CPDictionary dictionaryWithObject:pathAnimation forKey:@"frameOrigin"]];
[[_testView animator] setFrameOrigin:endOrigin];
[CPAnimationContext endGrouping];
}
- (void)testCompletionHandlerWithoutAnimator
{
var completions = @[];
var ctx = [CPAnimationContext currentContext];
[ctx setDuration:0.1];
[ctx setCompletionHandler:function()
{
[CPAnimationContext beginGrouping];
var context = [CPAnimationContext currentContext];
[context setDuration:0.01];
[context setCompletionHandler:function()
{
[completions addObject:@"done"];
UIAssert([completions isEqualToArray:@["done"]]);
}];
[CPAnimationContext endGrouping];
}
- (void)testCompletionHandlerWithoutAnimatorWithGrouping
{
var completions = @[];
var ctx = [CPAnimationContext currentContext];
[ctx setDuration:0.1];
[CPAnimationContext beginGrouping];
[ctx setCompletionHandler:function()
{
var context = [CPAnimationContext currentContext];
[context setDuration:0.01];
[context setCompletionHandler:function()
{
[completions addObject:@"done"];
UIAssert([completions isEqualToArray:@["done"]]);
}];
[CPAnimationContext endGrouping];
}
@@ -106,21 +323,24 @@
{
var completions = @[];
var ctx = [CPAnimationContext currentContext];
[ctx setDuration:0.1];
[ctx setCompletionHandler:function()
{
// This test relies on the auto-flushing behavior of the runloop for a single-level context.
// The reference shows that if the stack count is 1, the observer will flush it.
// However, to make it a reliable, self-contained test, we manually group and end.
// The original test's logic about inheritance is tested this way: the outer group's
// completion handler should fire, but the inner group (which inherits duration but not the handler) should not.
[CPAnimationContext beginGrouping];
var outerContext = [CPAnimationContext currentContext];
[outerContext setDuration:0.01];
[outerContext setCompletionHandler:function()
{
[completions addObject:@"done"];
UIAssert([completions isEqualToArray:@["done"]]);
}];
// Cocoa : When grouping begins, the grouping context inherits
// the duration & timingFunction properties from the current context
// but NOT the completionHandler.
// In this test, the completion handler should be performed once as part
// of the current context (with no animations) but not as part of the
// grouping context.
// Inner group
[CPAnimationContext beginGrouping];
[CPAnimationContext endGrouping];
[CPAnimationContext endGrouping];
}
@@ -130,17 +350,15 @@
var completions = @[];
[CPAnimationContext beginGrouping];
var ctx = [CPAnimationContext currentContext];
[ctx setDuration:0.1];
[ctx setCompletionHandler:function()
{
var context = [CPAnimationContext currentContext];
[context setDuration:0.01];
[context setCompletionHandler:function()
{
[completions addObject:@"done"];
UIAssert([completions isEqualToArray:@["done"]]);
}];
[[sender animator] setObjectValue:0];
[[sender animator] setObjectValue:[sender objectValue]];
[CPAnimationContext endGrouping];
}
@@ -149,17 +367,15 @@
var completions = @[];
[CPAnimationContext beginGrouping];
var ctx = [CPAnimationContext currentContext];
[ctx setDuration:0.1];
[ctx setCompletionHandler:function()
{
var context = [CPAnimationContext currentContext];
[context setDuration:0.01];
[context setCompletionHandler:function()
{
[completions addObject:@"done"];
UIAssert([completions isEqualToArray:@["done"]]);
}];
[[sender animator] setFrame:[sender frame]];
[CPAnimationContext endGrouping];
}
@@ -167,29 +383,32 @@
{
var completions = @[];
var ctx = [CPAnimationContext currentContext];
[ctx setDuration:0.1];
[ctx setCompletionHandler:function()
{
CPLog.debug("We should never be here");
[CPAnimationContext beginGrouping];
var context = [CPAnimationContext currentContext];
[context setDuration:0.01];
[context setCompletionHandler:function()
{
// This handler should be replaced and never called.
UIAssert(NO);
}];
[ctx setCompletionHandler:function()
{
// Set the handler again, which should replace the first one.
[context setCompletionHandler:function()
{
[completions addObject:@"done"];
UIAssert([completions isEqualToArray:@["done"]]);
}];
[[sender animator] setFrame:[sender frame]];
[CPAnimationContext endGrouping];
}
@end
var unCamelCase = function(aString)
{
// insert a space before all caps
// insert a space before all caps
return aString.replace(/([A-Z])/g, ' $1')
// uppercase the first character
// uppercase the first character
.replace(/^./, function(str){ return str.toUpperCase(); });
};
@@ -0,0 +1,75 @@
/*
* AppController.j
* CPMenuCALayerTest
*
* Created by Mathieu Monney on December 19, 2014.
* Copyright 2014, Vidinoti SA, All rights reserved.
*/
@import <Foundation/CPObject.j>
@implementation MyLayer : CALayer
{
}
- (void)drawInContext:(CGContext)aContext {
CGContextSetFillColor(aContext, [CPColor blackColor]);
CGContextFillRect(aContext, _bounds);
}
@end
@implementation AppController : CPObject
{
MyLayer layer;
}
-(void)changeSize:(id)sender {
var scale = [[sender selectedItem] title];
scale = scale.substr(0,scale.length-1);
// Change the affine transform of the layer to make sure it is updated due to
// https://github.com/cappuccino/cappuccino/pull/2018
var af = CGAffineTransformMakeScale(scale/100.0,scale/100.0);
[layer setAffineTransform:af];
}
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
{
var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask],
contentView = [theWindow contentView],
popupButton = [[CPPopUpButton alloc] initWithFrame:CGRectMakeZero()];
// Changing the button should change the size of the layer if #2018 is fixed.
[popupButton addItemsWithTitles:[@"100%",@"50%",@"25%"]];
[popupButton sizeToFit];
[popupButton setAction:@selector(changeSize:)];
[popupButton setTarget:self];
[popupButton setAutoresizingMask:CPViewMinXMargin | CPViewMaxXMargin | CPViewMinYMargin | CPViewMaxYMargin];
[popupButton setCenter:[contentView center]];
[contentView addSubview:popupButton];
[theWindow orderFront:self];
var layerRoot = [[CALayer alloc ] init];
[layerRoot setBounds:CGRectMake(0,0,[contentView bounds].size.width,[contentView bounds].size.height)];
[layerRoot setPosition:CGPointMake(0,0)];
[contentView setWantsLayer:YES];
[contentView setLayer:layerRoot];
layer = [[MyLayer alloc ] init];
[layer setBounds:CGRectMake(0,0,100,100)];
[layer setPosition:CGPointMake([contentView bounds].size.width/2,[contentView bounds].size.height/2-100)];
[layer setNeedsDisplay];
[layerRoot addSublayer:layer];
// Uncomment the following line to turn on the standard menu bar.
//[CPMenu setMenuBarVisible:YES];
}
@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>CPMenuCALayerTest</string>
<key>CPPrincipalClass</key>
<string>CPApplication</string>
</dict>
</plist>
+93
View File
@@ -0,0 +1,93 @@
/*
* Jakefile
* CPMenuCALayerTest
*
* Created by Mathieu Monney on December 19, 2014.
* Copyright 2014, Vidinoti SA, 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 ("CPMenuCALayerTest", function(task)
{
task.setBuildIntermediatesPath(FILE.join("Build", "CPMenuCALayerTest.build", configuration));
task.setBuildPath(FILE.join("Build", configuration));
task.setProductName("CPMenuCALayerTest");
task.setIdentifier("com.yourcompany.CPMenuCALayerTest");
task.setVersion("1.0");
task.setAuthor("WireLoad, LLC");
task.setEmail("feedback @nospam@ yourcompany.com");
task.setSummary("CPMenuCALayerTest");
task.setSources((new FileList("**/*.j")).exclude(FILE.join("Build", "**")));
task.setResources(new FileList("Resources/**"));
task.setIndexFilePath("index.html");
task.setInfoPlistPath("Info.plist");
if (configuration === "Debug")
task.setCompilerFlags("-DDEBUG -g");
else
task.setCompilerFlags("-O");
});
task ("default", ["CPMenuCALayerTest"], 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", "CPMenuCALayerTest", "index.html")]);
});
task ("run-release", ["release"], function()
{
OS.system(["open", FILE.join("Build", "Release", "CPMenuCALayerTest", "index.html")]);
});
task ("deploy", ["release"], function()
{
FILE.mkdirs(FILE.join("Build", "Deployment", "CPMenuCALayerTest"));
OS.system(["press", "-f", FILE.join("Build", "Release", "CPMenuCALayerTest"), FILE.join("Build", "Deployment", "CPMenuCALayerTest")]);
printResults("Deployment")
});
task ("desktop", ["release"], function()
{
FILE.mkdirs(FILE.join("Build", "Desktop", "CPMenuCALayerTest"));
require("cappuccino/nativehost").buildNativeHost(FILE.join("Build", "Release", "CPMenuCALayerTest"), FILE.join("Build", "Desktop", "CPMenuCALayerTest", "CPMenuCALayerTest.app"));
printResults("Desktop")
});
task ("run-desktop", ["desktop"], function()
{
OS.system([FILE.join("Build", "Desktop", "CPMenuCALayerTest", "CPMenuCALayerTest.app", "Contents", "MacOS", "NativeHost"), "-i"]);
});
function printResults(configuration)
{
print("----------------------------");
print(configuration+" app built at path: "+FILE.join("Build", configuration, "CPMenuCALayerTest"));
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
CPMenuCALayerTest
Created by Mathieu Monney on December 19, 2014.
Copyright 2014, Vidinoti SA, 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>CPMenuCALayerTest</title>
<script type="text/javascript">
OBJJ_MAIN_FILE = "main.j";
OBJJ_INCLUDE_PATHS = ["Frameworks/Debug", "Frameworks", "SomethingElse"];
</script>
<script src="Frameworks/Debug/Objective-J/Objective-J.js" type="text/javascript" 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 CPMenuCALayerTest...</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>
+78
View File
@@ -0,0 +1,78 @@
<!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.html
CPMenuCALayerTest
Created by Mathieu Monney on December 19, 2014.
Copyright 2014, Vidinoti SA, 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>CPMenuCALayerTest</title>
<script type="text/javascript">
OBJJ_MAIN_FILE = "main.j";
</script>
<script type="text/javascript" src="Frameworks/Objective-J/Objective-J.js" charset="UTF-8"></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 CPMenuCALayerTest...</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>
+18
View File
@@ -0,0 +1,18 @@
/*
* AppController.j
* CPMenuCALayerTest
*
* Created by Mathieu Monney on December 19, 2014.
* Copyright 2014, Vidinoti SA, All rights reserved.
*/
@import <Foundation/Foundation.j>
@import <AppKit/AppKit.j>
@import "AppController.j"
function main(args, namedArgs)
{
CPApplicationMain(args, namedArgs);
}
@@ -0,0 +1,213 @@
/*
* AppController.j
* CPMenuTest
*
* Created by Daniel Boehringer 2025 for submenu constraints on the rightmost end of the screen.
* Updated for Issue #3149 (Immediate menu updates).
* Updated for Issue #3153 (Hide main menu items without submenus).
*/
@import <AppKit/AppKit.j>
@implementation AppController : CPObject
{
CPWindow theWindow;
BOOL _isEnabled;
// Ivars for Live Update Test (#3149)
CPMenuItem _changeTitleItem;
CPMenuItem _changeStateItem;
CPMenuItem _changeEnabledItem;
// Ivars for Hidden Menu Test (#3153)
CPMenuItem _ghostMenuItem;
CPMenu _ghostMenu;
// Ivars for Live Update Test
CPMenuItem _changeTitleItem;
CPMenuItem _changeStateItem;
CPMenuItem _changeEnabledItem;
}
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
{
var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask],
contentView = [theWindow contentView];
mainMenu = [[CPMenu alloc] initWithTitle:@"MainMenu"],
appMenu = [[CPMenu alloc] initWithTitle:@"App"],
fileMenu = [[CPMenu alloc] initWithTitle:@"File"];
_isEnabled = YES;
[CPApp setMainMenu:mainMenu];
// Standard App Menu
[mainMenu addItemWithTitle:@"App" action:nil keyEquivalent:@""];
[mainMenu setSubmenu:appMenu forItem:[mainMenu itemWithTitle:@"App"]];
[appMenu addItemWithTitle:@"About" action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""];
[appMenu addItem:[CPMenuItem separatorItem]];
[appMenu addItemWithTitle:@"Quit" action:@selector(terminate:) keyEquivalent:@"q"];
// Standard File Menu
[mainMenu addItemWithTitle:@"File" action:nil keyEquivalent:@""];
[mainMenu setSubmenu:fileMenu forItem:[mainMenu itemWithTitle:@"File"]];
[fileMenu addItemWithTitle:@"New" action:@selector(newDocument:) keyEquivalent:@"n"];
[fileMenu addItemWithTitle:@"Open" action:@selector(openDocument:) keyEquivalent:@"o"];
[fileMenu addItemWithTitle:@"Close" action:@selector(newDocument:) keyEquivalent:@"w"];
// -------------------------------------------------------------------------
// TEST ADDITION FOR ISSUE #3149: Immediate Updates
// -------------------------------------------------------------------------
var liveUpdateMenu = [[CPMenu alloc] initWithTitle:@"Live Update"],
liveUpdateMenuItem = [mainMenu addItemWithTitle:@"Live Update" action:nil keyEquivalent:@""];
[liveUpdateMenu setAutoenablesItems:NO];
[mainMenu setSubmenu:liveUpdateMenu forItem:liveUpdateMenuItem];
[liveUpdateMenu addItemWithTitle:@"1. Click 'Start Timer' below" action:nil keyEquivalent:@""];
[liveUpdateMenu addItemWithTitle:@"2. Keep this menu OPEN" action:nil keyEquivalent:@""];
[liveUpdateMenu addItem:[CPMenuItem separatorItem]];
_changeTitleItem = [liveUpdateMenu addItemWithTitle:@"Title will change in 3s" action:nil keyEquivalent:@""];
_changeStateItem = [liveUpdateMenu addItemWithTitle:@"State will change in 3s" action:nil keyEquivalent:@""];
_changeEnabledItem = [liveUpdateMenu addItemWithTitle:@"Enabled will change in 3s" action:nil keyEquivalent:@""];
[liveUpdateMenu addItem:[CPMenuItem separatorItem]];
[liveUpdateMenu addItemWithTitle:@"Start 3s Timer" action:@selector(startUpdateTimer:) keyEquivalent:@""];
// -------------------------------------------------------------------------
// TEST ADDITION FOR ISSUE #3153: Hide main menu items with no submenus
// -------------------------------------------------------------------------
// 1. Create a "Ghost" item in the main menu bar.
// We intentionally DO NOT set a submenu for it yet.
// EXPECTATION: "Ghost Item" should NOT be visible in the menu bar.
_ghostMenuItem = [mainMenu addItemWithTitle:@"Ghost Item" action:nil keyEquivalent:@""];
// Prepare the menu that we will attach later
_ghostMenu = [[CPMenu alloc] initWithTitle:@"Ghost Menu"];
[_ghostMenu addItemWithTitle:@"I was hidden!" action:nil keyEquivalent:@""];
// 2. Create a control menu to toggle the submenu
var visibilityMenu = [[CPMenu alloc] initWithTitle:@"Visibility Test"],
visibilityMenuItem = [mainMenu addItemWithTitle:@"Visibility Test" action:nil keyEquivalent:@""];
[mainMenu setSubmenu:visibilityMenu forItem:visibilityMenuItem];
[visibilityMenu addItemWithTitle:@"Toggle 'Ghost Item' Submenu" action:@selector(toggleGhost:) keyEquivalent:@""];
[visibilityMenu addItemWithTitle:@"(If 'Ghost Item' is visible in bar now, bug is present)" action:nil keyEquivalent:@""];
// -------------------------------------------------------------------------
// Layout Testing (Right-side constraints)
// -------------------------------------------------------------------------
// Add some dummy menus to push the test menu further to the right.
var dummyMenu1 = [[CPMenu alloc] initWithTitle:@"Dummy 1"];
[dummyMenu1 addItemWithTitle:@"Dummy Action A" action:nil keyEquivalent:@""];
var dummyMenuItem1 = [mainMenu addItemWithTitle:@"Dummy 1" action:nil keyEquivalent:@""];
[mainMenu setSubmenu:dummyMenu1 forItem:dummyMenuItem1];
// TEST ADDITION FOR ISSUE #3149: Immediate Updates
// -------------------------------------------------------------------------
var liveUpdateMenu = [[CPMenu alloc] initWithTitle:@"Live Update"],
liveUpdateMenuItem = [mainMenu addItemWithTitle:@"Live Update" action:nil keyEquivalent:@""];
// Disable auto-enable so we can manually test setEnabled: on items without actions
[liveUpdateMenu setAutoenablesItems:NO];
[mainMenu setSubmenu:liveUpdateMenu forItem:liveUpdateMenuItem];
[liveUpdateMenu addItemWithTitle:@"1. Click 'Start Timer' below" action:nil keyEquivalent:@""];
[liveUpdateMenu addItemWithTitle:@"2. Keep this menu OPEN" action:nil keyEquivalent:@""];
[liveUpdateMenu addItem:[CPMenuItem separatorItem]];
_changeTitleItem = [liveUpdateMenu addItemWithTitle:@"Title will change in 3s" action:nil keyEquivalent:@""];
_changeStateItem = [liveUpdateMenu addItemWithTitle:@"State will change in 3s" action:nil keyEquivalent:@""];
_changeEnabledItem = [liveUpdateMenu addItemWithTitle:@"Enabled will change in 3s" action:nil keyEquivalent:@""];
[liveUpdateMenu addItem:[CPMenuItem separatorItem]];
[liveUpdateMenu addItemWithTitle:@"Start 3s Timer" action:@selector(startUpdateTimer:) keyEquivalent:@""];
// -------------------------------------------------------------------------
// Create the right-most menu with submenus for testing layout.
var rightTestMenu = [[CPMenu alloc] initWithTitle:@"Right-Side Test"],
rightTestMenuItem = [mainMenu addItemWithTitle:@"Right-Side Test" action:nil keyEquivalent:@""];
[mainMenu setSubmenu:rightTestMenu forItem:rightTestMenuItem];
[rightTestMenu addItemWithTitle:@"Simple Item" action:nil keyEquivalent:@""];
[rightTestMenu addItem:[CPMenuItem separatorItem]];
var submenu1 = [[CPMenu alloc] initWithTitle:@"Submenu 1"],
submenu1Item = [rightTestMenu addItemWithTitle:@"Test First Submenu" action:nil keyEquivalent:@""];
[submenu1 addItemWithTitle:@"Sub-item A" action:nil keyEquivalent:@""];
[rightTestMenu setSubmenu:submenu1 forItem:submenu1Item];
[CPMenu setMenuBarVisible:YES];
}
- (void)toggleEnabled:(id)sender
{
_isEnabled = !_isEnabled;
[self didChangeValueForKey:@"isEnabled"];
}
- (BOOL)validateMenuItem:(CPMenuItem)anItem
{
if ([anItem action] == @selector(toggleEnabled:))
return _isEnabled;
return YES;
}
// -------------------------------------------------------------------------
// Live Update Test Actions (#3149)
// -------------------------------------------------------------------------
- (void)startUpdateTimer:(id)sender
{
// Reset state
[_changeTitleItem setTitle:@"Title will change in 3s"];
[_changeStateItem setState:CPOffState];
[_changeStateItem setTitle:@"State will change in 3s"];
[_changeEnabledItem setEnabled:YES];
[_changeEnabledItem setTitle:@"Enabled will change in 3s"];
// Trigger update
[self performSelector:@selector(performLiveUpdate) withObject:nil afterDelay:3.0];
}
- (void)performLiveUpdate
{
[_changeTitleItem setTitle:@"Title Changed!"];
[_changeStateItem setState:CPOnState];
[_changeStateItem setTitle:@"State Changed! (Checked)"];
[_changeEnabledItem setEnabled:NO];
[_changeEnabledItem setTitle:@"Enabled Changed! (Disabled)"];
}
// -------------------------------------------------------------------------
// Visibility Test Actions (#3153)
// -------------------------------------------------------------------------
- (void)toggleGhost:(id)sender
{
if ([_ghostMenuItem submenu])
{
// Remove submenu -> Item should disappear from the bar
[mainMenu setSubmenu:nil forItem:_ghostMenuItem];
}
else
{
// Add submenu -> Item should appear in the bar
[mainMenu setSubmenu:_ghostMenu forItem:_ghostMenuItem];
}
}
@end
@@ -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>CPMenuTest</string>
<key>CPPrincipalClass</key>
<string>CPApplication</string>
</dict>
</plist>
@@ -0,0 +1,93 @@
/*
* Jakefile
* CPMenuTest
*
* Created by Alexander Ljungberg on August 31, 2010.
* Copyright 2010, WireLoad, LLC 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 ("CPMenuTest", function(task)
{
task.setBuildIntermediatesPath(FILE.join("Build", "CPMenuTest.build", configuration));
task.setBuildPath(FILE.join("Build", configuration));
task.setProductName("CPMenuTest");
task.setIdentifier("com.yourcompany.CPMenuTest");
task.setVersion("1.0");
task.setAuthor("WireLoad, LLC");
task.setEmail("feedback @nospam@ yourcompany.com");
task.setSummary("CPMenuTest");
task.setSources((new FileList("**/*.j")).exclude(FILE.join("Build", "**")));
task.setResources(new FileList("Resources/**"));
task.setIndexFilePath("index.html");
task.setInfoPlistPath("Info.plist");
if (configuration === "Debug")
task.setCompilerFlags("-DDEBUG -g");
else
task.setCompilerFlags("-O");
});
task ("default", ["CPMenuTest"], 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", "CPMenuTest", "index.html")]);
});
task ("run-release", ["release"], function()
{
OS.system(["open", FILE.join("Build", "Release", "CPMenuTest", "index.html")]);
});
task ("deploy", ["release"], function()
{
FILE.mkdirs(FILE.join("Build", "Deployment", "CPMenuTest"));
OS.system(["press", "-f", FILE.join("Build", "Release", "CPMenuTest"), FILE.join("Build", "Deployment", "CPMenuTest")]);
printResults("Deployment")
});
task ("desktop", ["release"], function()
{
FILE.mkdirs(FILE.join("Build", "Desktop", "CPMenuTest"));
require("cappuccino/nativehost").buildNativeHost(FILE.join("Build", "Release", "CPMenuTest"), FILE.join("Build", "Desktop", "CPMenuTest", "CPMenuTest.app"));
printResults("Desktop")
});
task ("run-desktop", ["desktop"], function()
{
OS.system([FILE.join("Build", "Desktop", "CPMenuTest", "CPMenuTest.app", "Contents", "MacOS", "NativeHost"), "-i"]);
});
function printResults(configuration)
{
print("----------------------------");
print(configuration+" app built at path: "+FILE.join("Build", configuration, "CPMenuTest"));
print("----------------------------");
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

@@ -0,0 +1,204 @@
<!DOCTYPE html>
<html lang="en">
<!--
index-debug.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";
OBJJ_INCLUDE_PATHS = ["Frameworks/Debug", "Frameworks"];
// The below will tell the compiler to generate debug symbols, type signatures and not 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.
//
// Debug symbols will give each Objective-J method a Javascript function name. Without a name it will be very hard to find
// the methods in the debugger.
// Type Signatures will give type information to the Objective-J runtime for instance variables and methods.
// Inline objj_msgSend will give a speed increase but decorators will not work. Check below on debug options for
// more information on decorators.
//
// 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/Debug/Objective-J/Objective-J.js" charset="UTF-8"></script>
<script type="text/javascript">
objj_msgSend_reset();
// DEBUG OPTIONS:
// Decorators will only work when the code is compiled without the compiler option 'InlineMsgSend'. Check above.
// 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);
// Tag view DOM elements with a "data-cappuccino-view" attribute that contains
// the class name of the view that created them. Comment this or set to false to disable.
appkit_tag_dom_elements = true;
</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>
@@ -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>
@@ -0,0 +1,18 @@
/*
* AppController.j
* CPMenuTest
*
* Created by Alexander Ljungberg on August 31, 2010.
* Copyright 2010, WireLoad, LLC All rights reserved.
*/
@import <Foundation/Foundation.j>
@import <AppKit/AppKit.j>
@import "AppController.j"
function main(args, namedArgs)
{
CPApplicationMain(args, namedArgs);
}
@@ -0,0 +1,207 @@
/*
* AppController.j
* CPStackViewTest
*
* Created by Daniel Boehringer.
* Copyright 2025, Cappuccino Project.
*/
@import <Foundation/CPObject.j>
@import <AppKit/AppKit.j>
// We import the class to be tested.
// Assuming CPStackView.j is in the same directory or properly included in the build.
@implementation AppController : CPObject
{
CPWindow theWindow;
// We will construct these programmatically for the test
// to avoid needing a .cib file for a new class.
CPStackView stackViewHorizontal;
CPStackView stackViewVertical;
// Control references
CPCheckBox detachHiddenCheckbox;
CPView toggleTargetView;
}
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
{
theWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask];
var contentView = [theWindow contentView];
[contentView setBackgroundColor:[CPColor colorWithWhite:0.95 alpha:1.0]];
// 1. Create a Label
var label = [CPTextField labelWithTitle:@"CPStackView Manual Test"];
[label setFont:[CPFont boldSystemFontOfSize:18]];
[label setFrameOrigin:CGPointMake(20, 20)];
[contentView addSubview:label];
// 2. Create Horizontal Stack View (The primary test subject)
// We frame it in the top half
stackViewHorizontal = [[CPStackView alloc] initWithFrame:CGRectMake(20, 60, 600, 150)];
[stackViewHorizontal setBackgroundColor:[CPColor whiteColor]];
[stackViewHorizontal setOrientation:CPUserInterfaceLayoutOrientationHorizontal];
[stackViewHorizontal setEdgeInsets:CPEdgeInsetsMake(10, 10, 10, 10)];
// Add Views to Horizontal Stack
// Leading
[stackViewHorizontal addView:[self _createBoxColor:[CPColor redColor] size:CGSizeMake(40, 40) label:@"L1"] inGravity:CPStackViewGravityLeading];
[stackViewHorizontal addView:[self _createBoxColor:[CPColor redColor] size:CGSizeMake(60, 80) label:@"L2"] inGravity:CPStackViewGravityLeading]; // Taller to test alignment
// Center
toggleTargetView = [self _createBoxColor:[CPColor greenColor] size:CGSizeMake(50, 50) label:@"C1\n(Toggle)"];
[stackViewHorizontal addView:toggleTargetView inGravity:CPStackViewGravityCenter];
[stackViewHorizontal addView:[self _createBoxColor:[CPColor greenColor] size:CGSizeMake(50, 50) label:@"C2"] inGravity:CPStackViewGravityCenter];
// Trailing
[stackViewHorizontal addView:[self _createBoxColor:[CPColor blueColor] size:CGSizeMake(40, 40) label:@"T1"] inGravity:CPStackViewGravityTrailing];
[stackViewHorizontal addView:[self _createBoxColor:[CPColor blueColor] size:CGSizeMake(40, 40) label:@"T2"] inGravity:CPStackViewGravityTrailing];
// Set Autoresizing to stick to width
[stackViewHorizontal setAutoresizingMask:CPViewWidthSizable];
// Visual border for the stack view itself
var borderView = [[CPView alloc] initWithFrame:CGRectInset([stackViewHorizontal frame], -1, -1)];
[borderView setBackgroundColor:[CPColor grayColor]];
[contentView addSubview:borderView];
[contentView addSubview:stackViewHorizontal];
// 3. Create Vertical Stack View (Secondary test)
stackViewVertical = [[CPStackView alloc] initWithFrame:CGRectMake(20, 230, 200, 300)];
[stackViewVertical setBackgroundColor:[CPColor whiteColor]];
[stackViewVertical setOrientation:CPUserInterfaceLayoutOrientationVertical];
[stackViewVertical setEdgeInsets:CPEdgeInsetsMake(5, 5, 5, 5)];
[stackViewVertical setAlignment:CPLayoutAttributeCenterX]; // Center items horizontally
[stackViewVertical addView:[self _createBoxColor:[CPColor orangeColor] size:CGSizeMake(40, 30) label:@"Top"] inGravity:CPStackViewGravityTop];
[stackViewVertical addView:[self _createBoxColor:[CPColor purpleColor] size:CGSizeMake(80, 40) label:@"Mid"] inGravity:CPStackViewGravityCenter];
[stackViewVertical addView:[self _createBoxColor:[CPColor brownColor] size:CGSizeMake(40, 30) label:@"Bot"] inGravity:CPStackViewGravityBottom];
var borderViewVert = [[CPView alloc] initWithFrame:CGRectInset([stackViewVertical frame], -1, -1)];
[borderViewVert setBackgroundColor:[CPColor grayColor]];
[contentView addSubview:borderViewVert];
[contentView addSubview:stackViewVertical];
// 4. Controls Area
var controlsY = 230;
var controlsX = 250;
var btnToggleHide = [CPButton buttonWithTitle:@"Toggle Center View Hidden"];
[btnToggleHide setFrameOrigin:CGPointMake(controlsX, controlsY)];
[btnToggleHide setTarget:self];
[btnToggleHide setAction:@selector(toggleHidden:)];
[contentView addSubview:btnToggleHide];
controlsY += 40;
detachHiddenCheckbox = [CPCheckBox checkBoxWithTitle:@"Detaches Hidden Views"];
[detachHiddenCheckbox setFrameOrigin:CGPointMake(controlsX, controlsY)];
[detachHiddenCheckbox setState:CPOnState];
[detachHiddenCheckbox setTarget:self];
[detachHiddenCheckbox setAction:@selector(toggleDetaches:)];
[contentView addSubview:detachHiddenCheckbox];
controlsY += 40;
var btnAlignTop = [CPButton buttonWithTitle:@"Align Horizontal: Top"];
[btnAlignTop setFrameOrigin:CGPointMake(controlsX, controlsY)];
[btnAlignTop setTarget:self];
[btnAlignTop setAction:@selector(setAlignmentTop:)];
[contentView addSubview:btnAlignTop];
controlsY += 30;
var btnAlignCenter = [CPButton buttonWithTitle:@"Align Horizontal: CenterY"];
[btnAlignCenter setFrameOrigin:CGPointMake(controlsX, controlsY)];
[btnAlignCenter setTarget:self];
[btnAlignCenter setAction:@selector(setAlignmentCenter:)];
[contentView addSubview:btnAlignCenter];
controlsY += 30;
var btnAlignFill = [CPButton buttonWithTitle:@"Align Horizontal: Height (Fill)"];
[btnAlignFill setFrameOrigin:CGPointMake(controlsX, controlsY)];
[btnAlignFill setTarget:self];
[btnAlignFill setAction:@selector(setAlignmentHeight:)];
[contentView addSubview:btnAlignFill];
controlsY += 40;
var btnSpacing = [CPButton buttonWithTitle:@"Increase Spacing"];
[btnSpacing setFrameOrigin:CGPointMake(controlsX, controlsY)];
[btnSpacing setTarget:self];
[btnSpacing setAction:@selector(changeSpacing:)];
[contentView addSubview:btnSpacing];
[theWindow setFullPlatformWindow:YES];
[theWindow orderFront:self];
}
- (void)awakeFromCib
{
// If we were using a Cib, initialization would happen here.
}
#pragma mark -
#pragma mark Actions
- (@action)toggleHidden:(id)sender
{
var isHidden = [toggleTargetView isHidden];
[toggleTargetView setHidden:!isHidden];
// In standard Cocoa, hiding a view triggers layout if stackView is observing,
// but in this manual implementation, we might need to nudge it or ensure
// setHidden triggers needsLayout on superview.
// The CPStackView provided relies on 'layoutSubviews' being called.
[stackViewHorizontal setNeedsLayout:YES];
}
- (@action)toggleDetaches:(id)sender
{
[stackViewHorizontal setDetachesHiddenViews:([sender state] === CPOnState)];
}
- (@action)setAlignmentTop:(id)sender
{
[stackViewHorizontal setAlignment:CPLayoutAttributeTop];
}
- (@action)setAlignmentCenter:(id)sender
{
[stackViewHorizontal setAlignment:CPLayoutAttributeCenterY];
}
- (@action)setAlignmentHeight:(id)sender
{
[stackViewHorizontal setAlignment:CPLayoutAttributeHeight];
}
- (@action)changeSpacing:(id)sender
{
var current = [stackViewHorizontal spacing];
[stackViewHorizontal setSpacing:(current >= 20.0 ? 8.0 : current + 4.0)];
}
#pragma mark -
#pragma mark Helpers
- (CPView)_createBoxColor:(CPColor)aColor size:(CGSize)aSize label:(CPString)text
{
var view = [[CPView alloc] initWithFrame:CGRectMake(0, 0, aSize.width, aSize.height)];
[view setBackgroundColor:aColor];
var label = [[CPTextField alloc] initWithFrame:CGRectInset([view bounds], 2, 2)];
[label setStringValue:text];
[label setTextColor:[CPColor whiteColor]];
[label setAlignment:CPCenterTextAlignment];
[label setVerticalAlignment:CPCenterVerticalTextAlignment];
[label setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable];
[label setLineBreakMode:CPLineBreakByWordWrapping];
[view addSubview:label];
return view;
}
@end
+10
View File
@@ -0,0 +1,10 @@
<?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>Main cib file base name</key>
<string>MainMenu.cib</string>
<key>CPBundleName</key>
<string>CPStackViewTest</string>
</dict>
</plist>
+94
View File
@@ -0,0 +1,94 @@
/*
* Jakefile
* CPSplitViewTest
*
* Created by Alexander Ljungberg on January 27, 2012.
* Copyright 2012, 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 ("CPSplitViewTest", function(task)
{
task.setBuildIntermediatesPath(FILE.join("Build", "CPSplitViewTest.build", configuration));
task.setBuildPath(FILE.join("Build", configuration));
task.setProductName("CPSplitViewTest");
task.setIdentifier("com.yourcompany.CPSplitViewTest");
task.setVersion("1.0");
task.setAuthor("WireLoad");
task.setEmail("feedback @nospam@ yourcompany.com");
task.setSummary("CPSplitViewTest");
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", ["CPSplitViewTest"], 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", "CPSplitViewTest", "index.html")]);
});
task ("run-release", ["release"], function()
{
OS.system(["open", FILE.join("Build", "Release", "CPSplitViewTest", "index.html")]);
});
task ("deploy", ["release"], function()
{
FILE.mkdirs(FILE.join("Build", "Deployment", "CPSplitViewTest"));
OS.system(["press", "-f", FILE.join("Build", "Release", "CPSplitViewTest"), FILE.join("Build", "Deployment", "CPSplitViewTest")]);
printResults("Deployment")
});
task ("desktop", ["release"], function()
{
FILE.mkdirs(FILE.join("Build", "Desktop", "CPSplitViewTest"));
require("cappuccino/nativehost").buildNativeHost(FILE.join("Build", "Release", "CPSplitViewTest"), FILE.join("Build", "Desktop", "CPSplitViewTest", "CPSplitViewTest.app"));
printResults("Desktop")
});
task ("run-desktop", ["desktop"], function()
{
OS.system([FILE.join("Build", "Desktop", "CPSplitViewTest", "CPSplitViewTest.app", "Contents", "MacOS", "NativeHost"), "-i"]);
});
function printResults(configuration)
{
print("----------------------------");
print(configuration+" app built at path: "+FILE.join("Build", configuration, "CPSplitViewTest"));
print("----------------------------");
}
@@ -0,0 +1 @@
280NPLIST;1.0;D;K;4;$topD;K;18;CPCibObjectDataKeyD;K;6;CP$UIDd;1;2E;E;K;8;$objectsA;S;5;$nullD;K;10;$classnameS;16;_CPCibObjectDataK;8;$classesA;S;16;_CPCibObjectDataS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;1;1E;K;28;_CPCibObjectDataNamesKeysKeyD;K;6;CP$UIDd;1;0E;K;30;_CPCibObjectDataNamesValuesKeyD;K;6;CP$UIDd;1;0E;K;30;_CPCibObjectDataClassesKeysKeyD;K;6;CP$UIDd;1;0E;K;32;_CPCibObjectDataClassesValuesKeyD;K;6;CP$UIDd;1;0E;K;30;_CPCibObjectDataConnectionsKeyD;K;6;CP$UIDd;1;4E;K;28;_CPCibObjectDataFrameworkKeyD;K;6;CP$UIDd;1;0E;K;26;_CPCibObjectDataNextOidKeyD;K;6;CP$UIDd;1;5E;K;30;_CPCibObjectDataObjectsKeysKeyD;K;6;CP$UIDd;1;6E;K;32;_CPCibObjectDataObjectsValuesKeyD;K;6;CP$UIDd;1;7E;K;26;_CPCibObjectDataOidKeysKeyD;K;6;CP$UIDd;1;8E;K;28;_CPCibObjectDataOidValuesKeyD;K;6;CP$UIDd;1;9E;K;28;_CPCibObjectDataFileOwnerKeyD;K;6;CP$UIDd;2;11E;K;33;_CPCibObjectDataVisibleWindowsKeyD;K;6;CP$UIDd;2;13E;E;D;K;10;$classnameS;7;CPArrayK;8;$classesA;S;7;CPArrayS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;D;K;6;CP$UIDd;2;15E;D;K;6;CP$UIDd;2;16E;D;K;6;CP$UIDd;2;17E;D;K;6;CP$UIDd;2;18E;D;K;6;CP$UIDd;2;19E;D;K;6;CP$UIDd;2;20E;D;K;6;CP$UIDd;2;22E;D;K;6;CP$UIDd;2;23E;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;D;K;6;CP$UIDd;2;24E;D;K;6;CP$UIDd;2;26E;D;K;6;CP$UIDd;2;28E;D;K;6;CP$UIDd;2;30E;D;K;6;CP$UIDd;2;32E;D;K;6;CP$UIDd;2;34E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;36E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;37E;D;K;6;CP$UIDd;2;39E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;40E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;41E;D;K;6;CP$UIDd;2;42E;D;K;6;CP$UIDd;2;43E;D;K;6;CP$UIDd;2;44E;D;K;6;CP$UIDd;2;45E;D;K;6;CP$UIDd;2;46E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;47E;D;K;6;CP$UIDd;2;48E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;49E;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;D;K;6;CP$UIDd;2;11E;D;K;6;CP$UIDd;2;11E;D;K;6;CP$UIDd;2;26E;D;K;6;CP$UIDd;2;28E;D;K;6;CP$UIDd;2;30E;D;K;6;CP$UIDd;2;32E;D;K;6;CP$UIDd;2;34E;D;K;6;CP$UIDd;2;32E;D;K;6;CP$UIDd;2;36E;D;K;6;CP$UIDd;2;30E;D;K;6;CP$UIDd;2;37E;D;K;6;CP$UIDd;2;39E;D;K;6;CP$UIDd;2;30E;D;K;6;CP$UIDd;2;40E;D;K;6;CP$UIDd;2;30E;D;K;6;CP$UIDd;2;41E;D;K;6;CP$UIDd;2;42E;D;K;6;CP$UIDd;2;43E;D;K;6;CP$UIDd;2;43E;D;K;6;CP$UIDd;2;45E;D;K;6;CP$UIDd;2;46E;D;K;6;CP$UIDd;2;41E;D;K;6;CP$UIDd;2;47E;D;K;6;CP$UIDd;2;48E;D;K;6;CP$UIDd;2;11E;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;E;E;D;K;10;$classnameS;18;_CPCibCustomObjectK;8;$classesA;S;18;_CPCibCustomObjectS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;2;10E;K;27;_CPCibCustomObjectClassNameD;K;6;CP$UIDd;2;50E;E;D;K;10;$classnameS;5;CPSetK;8;$classesA;S;5;CPSetS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;2;12E;K;15;CPSetObjectsKeyD;K;6;CP$UIDd;2;51E;E;D;K;10;$classnameS;20;CPCibOutletConnectorK;8;$classesA;S;20;CPCibOutletConnectorS;14;CPCibConnectorS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;2;14E;K;24;_CPCibConnectorSourceKeyD;K;6;CP$UIDd;2;11E;K;29;_CPCibConnectorDestinationKeyD;K;6;CP$UIDd;2;49E;K;23;_CPCibConnectorLabelKeyD;K;6;CP$UIDd;2;52E;E;D;K;6;$classD;K;6;CP$UIDd;2;14E;K;24;_CPCibConnectorSourceKeyD;K;6;CP$UIDd;2;49E;K;29;_CPCibConnectorDestinationKeyD;K;6;CP$UIDd;2;30E;K;23;_CPCibConnectorLabelKeyD;K;6;CP$UIDd;2;53E;E;D;K;6;$classD;K;6;CP$UIDd;2;14E;K;24;_CPCibConnectorSourceKeyD;K;6;CP$UIDd;2;49E;K;29;_CPCibConnectorDestinationKeyD;K;6;CP$UIDd;2;41E;K;23;_CPCibConnectorLabelKeyD;K;6;CP$UIDd;2;54E;E;D;K;6;$classD;K;6;CP$UIDd;2;14E;K;24;_CPCibConnectorSourceKeyD;K;6;CP$UIDd;2;49E;K;29;_CPCibConnectorDestinationKeyD;K;6;CP$UIDd;2;43E;K;23;_CPCibConnectorLabelKeyD;K;6;CP$UIDd;2;55E;E;D;K;6;$classD;K;6;CP$UIDd;2;14E;K;24;_CPCibConnectorSourceKeyD;K;6;CP$UIDd;2;49E;K;29;_CPCibConnectorDestinationKeyD;K;6;CP$UIDd;2;26E;K;23;_CPCibConnectorLabelKeyD;K;6;CP$UIDd;2;56E;E;D;K;6;$classD;K;6;CP$UIDd;2;14E;K;24;_CPCibConnectorSourceKeyD;K;6;CP$UIDd;2;30E;K;29;_CPCibConnectorDestinationKeyD;K;6;CP$UIDd;2;49E;K;23;_CPCibConnectorLabelKeyD;K;6;CP$UIDd;2;52E;E;D;K;10;$classnameS;21;CPCibControlConnectorK;8;$classesA;S;21;CPCibControlConnectorS;14;CPCibConnectorS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;2;21E;K;24;_CPCibConnectorSourceKeyD;K;6;CP$UIDd;2;39E;K;29;_CPCibConnectorDestinationKeyD;K;6;CP$UIDd;2;36E;K;23;_CPCibConnectorLabelKeyD;K;6;CP$UIDd;2;57E;E;D;K;6;$classD;K;6;CP$UIDd;2;21E;K;24;_CPCibConnectorSourceKeyD;K;6;CP$UIDd;2;34E;K;29;_CPCibConnectorDestinationKeyD;K;6;CP$UIDd;2;49E;K;23;_CPCibConnectorLabelKeyD;K;6;CP$UIDd;2;58E;E;D;K;6;$classD;K;6;CP$UIDd;2;10E;K;27;_CPCibCustomObjectClassNameD;K;6;CP$UIDd;2;50E;E;D;K;10;$classnameS;20;_CPCibWindowTemplateK;8;$classesA;S;20;_CPCibWindowTemplateS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;2;25E;K;30;_CPCibWindowTemplateMaxSizeKeyD;K;6;CP$UIDd;2;59E;K;32;_CPCibWindowTemplateViewClassKeyD;K;6;CP$UIDd;1;0E;K;34;_CPCibWindowTemplateWindowClassKeyD;K;6;CP$UIDd;2;60E;K;30;_CPCibWindowTemplateWTFlagsKeyD;K;6;CP$UIDd;2;61E;K;33;_CPCibWindowTemplateWindowRectKeyD;K;6;CP$UIDd;2;62E;K;33;_CPCibWindowTemplatLine truncated
@@ -0,0 +1,809 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
<data>
<int key="IBDocument.SystemTarget">1050</int>
<string key="IBDocument.SystemVersion">11E53</string>
<string key="IBDocument.InterfaceBuilderVersion">2182</string>
<string key="IBDocument.AppKitVersion">1138.47</string>
<string key="IBDocument.HIToolboxVersion">569.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="NS.object.0">2182</string>
</object>
<object class="NSArray" key="IBDocument.IntegratedClassDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>NSTextField</string>
<string>NSView</string>
<string>NSWindowTemplate</string>
<string>NSSplitView</string>
<string>NSTextFieldCell</string>
<string>NSSliderCell</string>
<string>NSCustomView</string>
<string>NSSlider</string>
<string>NSButtonCell</string>
<string>NSButton</string>
<string>NSCustomObject</string>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
</object>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
<integer value="1" key="NS.object.0"/>
</object>
<object class="NSMutableArray" key="IBDocument.RootObjects" id="1048">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSCustomObject" id="1021">
<string key="NSClassName">NSApplication</string>
</object>
<object class="NSCustomObject" id="1014">
<string key="NSClassName">FirstResponder</string>
</object>
<object class="NSCustomObject" id="1050">
<string key="NSClassName">NSApplication</string>
</object>
<object class="NSWindowTemplate" id="972006081">
<int key="NSWindowStyleMask">7</int>
<int key="NSWindowBacking">2</int>
<string key="NSWindowRect">{{335, 390}, {480, 360}}</string>
<int key="NSWTFlags">1946157056</int>
<string key="NSWindowTitle">Window</string>
<string key="NSWindowClass">NSWindow</string>
<nil key="NSViewClass"/>
<nil key="NSUserInterfaceItemIdentifier"/>
<object class="NSView" key="NSWindowView" id="439893737">
<reference key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSSplitView" id="980028635">
<reference key="NSNextResponder" ref="439893737"/>
<int key="NSvFlags">274</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSTextField" id="655520722">
<reference key="NSNextResponder" ref="980028635"/>
<int key="NSvFlags">268</int>
<string key="NSFrameSize">{480, 34}</string>
<reference key="NSSuperview" ref="980028635"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="871265355"/>
<string key="NSReuseIdentifierKey">_NS:3944</string>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="295214252">
<int key="NSCellFlags">68288064</int>
<int key="NSCellFlags2">272630784</int>
<string key="NSContents">Label</string>
<object class="NSFont" key="NSSupport" id="611476865">
<string key="NSName">LucidaGrande</string>
<double key="NSSize">13</double>
<int key="NSfFlags">1044</int>
</object>
<string key="NSCellIdentifier">_NS:3944</string>
<reference key="NSControlView" ref="655520722"/>
<object class="NSColor" key="NSBackgroundColor">
<int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string>
<string key="NSColorName">controlColor</string>
<object class="NSColor" key="NSColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes>
</object>
</object>
<object class="NSColor" key="NSTextColor">
<int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string>
<string key="NSColorName">controlTextColor</string>
<object class="NSColor" key="NSColor" id="6106584">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MAA</bytes>
</object>
</object>
</object>
</object>
<object class="NSCustomView" id="871265355">
<reference key="NSNextResponder" ref="980028635"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSButton" id="688798207">
<reference key="NSNextResponder" ref="871265355"/>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{14, 24}, {142, 32}}</string>
<reference key="NSSuperview" ref="871265355"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="160623561"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="676112794">
<int key="NSCellFlags">67239424</int>
<int key="NSCellFlags2">134217728</int>
<string key="NSContents">Delete Autosave</string>
<reference key="NSSupport" ref="611476865"/>
<string key="NSCellIdentifier">_NS:9</string>
<reference key="NSControlView" ref="688798207"/>
<int key="NSButtonFlags">-2038284033</int>
<int key="NSButtonFlags2">129</int>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
<int key="NSPeriodicDelay">200</int>
<int key="NSPeriodicInterval">25</int>
</object>
</object>
<object class="NSTextField" id="160623561">
<reference key="NSNextResponder" ref="871265355"/>
<int key="NSvFlags">301</int>
<string key="NSFrame">{{364, 30}, {96, 22}}</string>
<reference key="NSSuperview" ref="871265355"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="877119126"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="46991665">
<int key="NSCellFlags">-1804468671</int>
<int key="NSCellFlags2">272630784</int>
<string key="NSContents"/>
<reference key="NSSupport" ref="611476865"/>
<reference key="NSControlView" ref="160623561"/>
<bool key="NSDrawsBackground">YES</bool>
<object class="NSColor" key="NSBackgroundColor">
<int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string>
<string key="NSColorName">textBackgroundColor</string>
<object class="NSColor" key="NSColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MQA</bytes>
</object>
</object>
<object class="NSColor" key="NSTextColor">
<int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string>
<string key="NSColorName">textColor</string>
<reference key="NSColor" ref="6106584"/>
</object>
</object>
</object>
</object>
<string key="NSFrame">{{0, 44}, {480, 85}}</string>
<reference key="NSSuperview" ref="980028635"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="688798207"/>
<string key="NSReuseIdentifierKey">_NS:1113</string>
<string key="NSClassName">NSView</string>
</object>
<object class="NSCustomView" id="877119126">
<reference key="NSNextResponder" ref="980028635"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSSlider" id="974764906">
<reference key="NSNextResponder" ref="877119126"/>
<int key="NSvFlags">301</int>
<string key="NSFrame">{{192, 27}, {96, 21}}</string>
<reference key="NSSuperview" ref="877119126"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="105337172"/>
<bool key="NSEnabled">YES</bool>
<object class="NSSliderCell" key="NSCell" id="600801425">
<int key="NSCellFlags">-2079981824</int>
<int key="NSCellFlags2">0</int>
<string key="NSContents"/>
<object class="NSFont" key="NSSupport">
<string key="NSName">Helvetica</string>
<double key="NSSize">12</double>
<int key="NSfFlags">16</int>
</object>
<reference key="NSControlView" ref="974764906"/>
<double key="NSMaxValue">100</double>
<double key="NSMinValue">0.0</double>
<double key="NSValue">50</double>
<double key="NSAltIncValue">0.0</double>
<int key="NSNumberOfTickMarks">0</int>
<int key="NSTickMarkPosition">1</int>
<bool key="NSAllowsTickMarkValuesOnly">NO</bool>
<bool key="NSVertical">NO</bool>
</object>
</object>
</object>
<string key="NSFrame">{{0, 139}, {480, 79}}</string>
<reference key="NSSuperview" ref="980028635"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="974764906"/>
<string key="NSReuseIdentifierKey">_NS:1116</string>
<string key="NSClassName">NSView</string>
</object>
<object class="NSSplitView" id="105337172">
<reference key="NSNextResponder" ref="980028635"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSCustomView" id="600528701">
<reference key="NSNextResponder" ref="105337172"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSSplitView" id="241459165">
<reference key="NSNextResponder" ref="600528701"/>
<int key="NSvFlags">274</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSCustomView" id="309483115">
<reference key="NSNextResponder" ref="241459165"/>
<int key="NSvFlags">256</int>
<string key="NSFrameSize">{246, 51}</string>
<reference key="NSSuperview" ref="241459165"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="858498729"/>
<string key="NSReuseIdentifierKey">_NS:11</string>
<string key="NSClassName">NSView</string>
</object>
<object class="NSCustomView" id="858498729">
<reference key="NSNextResponder" ref="241459165"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSButton" id="290967118">
<reference key="NSNextResponder" ref="858498729"/>
<int key="NSvFlags">256</int>
<string key="NSFrame">{{66, 18}, {114, 32}}</string>
<reference key="NSSuperview" ref="858498729"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="1031367026"/>
<string key="NSReuseIdentifierKey">_NS:687</string>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="825192224">
<int key="NSCellFlags">67239424</int>
<int key="NSCellFlags2">134217728</int>
<string key="NSContents">Bottom Left</string>
<reference key="NSSupport" ref="611476865"/>
<string key="NSCellIdentifier">_NS:687</string>
<reference key="NSControlView" ref="290967118"/>
<int key="NSButtonFlags">-2038284033</int>
<int key="NSButtonFlags2">129</int>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
<int key="NSPeriodicDelay">200</int>
<int key="NSPeriodicInterval">25</int>
</object>
</object>
</object>
<string key="NSFrame">{{0, 60}, {246, 72}}</string>
<reference key="NSSuperview" ref="241459165"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="290967118"/>
<string key="NSReuseIdentifierKey">_NS:13</string>
<string key="NSClassName">NSView</string>
</object>
</object>
<string key="NSFrameSize">{246, 132}</string>
<reference key="NSSuperview" ref="600528701"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="309483115"/>
<string key="NSReuseIdentifierKey">_NS:9</string>
<string key="NSAutosaveName">splitViewC</string>
</object>
</object>
<string key="NSFrameSize">{246, 132}</string>
<reference key="NSSuperview" ref="105337172"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="241459165"/>
<string key="NSReuseIdentifierKey">_NS:1165</string>
<string key="NSClassName">NSView</string>
</object>
<object class="NSCustomView" id="1031367026">
<reference key="NSNextResponder" ref="105337172"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSButton" id="165016153">
<reference key="NSNextResponder" ref="1031367026"/>
<int key="NSvFlags">256</int>
<string key="NSFrame">{{80, 48}, {73, 32}}</string>
<reference key="NSSuperview" ref="1031367026"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
<string key="NSReuseIdentifierKey">_NS:687</string>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="1015466174">
<int key="NSCellFlags">67239424</int>
<int key="NSCellFlags2">134217728</int>
<string key="NSContents">Right</string>
<reference key="NSSupport" ref="611476865"/>
<string key="NSCellIdentifier">_NS:687</string>
<reference key="NSControlView" ref="165016153"/>
<int key="NSButtonFlags">-2038284033</int>
<int key="NSButtonFlags2">129</int>
<string key="NSAlternateContents"/>
<string key="NSKeyEquivalent"/>
<int key="NSPeriodicDelay">200</int>
<int key="NSPeriodicInterval">25</int>
</object>
</object>
</object>
<string key="NSFrame">{{247, 0}, {233, 132}}</string>
<reference key="NSSuperview" ref="105337172"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="165016153"/>
<string key="NSReuseIdentifierKey">_NS:1167</string>
<string key="NSClassName">NSView</string>
</object>
</object>
<string key="NSFrame">{{0, 228}, {480, 132}}</string>
<reference key="NSSuperview" ref="980028635"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="600528701"/>
<string key="NSReuseIdentifierKey">_NS:1163</string>
<bool key="NSIsVertical">YES</bool>
<int key="NSDividerStyle">2</int>
<string key="NSAutosaveName">splitViewB</string>
</object>
</object>
<string key="NSFrameSize">{480, 360}</string>
<reference key="NSSuperview" ref="439893737"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="655520722"/>
<string key="NSReuseIdentifierKey">_NS:1111</string>
<int key="NSDividerStyle">3</int>
<string key="NSAutosaveName">splitViewA</string>
</object>
</object>
<string key="NSFrameSize">{480, 360}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="980028635"/>
</object>
<string key="NSScreenRect">{{0, 0}, {2560, 1418}}</string>
<string key="NSMaxSize">{10000000000000, 10000000000000}</string>
<bool key="NSWindowIsRestorable">YES</bool>
</object>
<object class="NSCustomObject" id="635946545">
<string key="NSClassName">AppController</string>
</object>
</object>
<object class="IBObjectContainer" key="IBDocument.Objects">
<object class="NSMutableArray" key="connectionRecords">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">delegate</string>
<reference key="source" ref="1021"/>
<reference key="destination" ref="635946545"/>
</object>
<int key="connectionID">451</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">theWindow</string>
<reference key="source" ref="635946545"/>
<reference key="destination" ref="972006081"/>
</object>
<int key="connectionID">459</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">splitViewA</string>
<reference key="source" ref="635946545"/>
<reference key="destination" ref="980028635"/>
</object>
<int key="connectionID">479</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">splitViewB</string>
<reference key="source" ref="635946545"/>
<reference key="destination" ref="105337172"/>
</object>
<int key="connectionID">480</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">splitViewC</string>
<reference key="source" ref="635946545"/>
<reference key="destination" ref="241459165"/>
</object>
<int key="connectionID">481</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">deleteAutosave:</string>
<reference key="source" ref="635946545"/>
<reference key="destination" ref="688798207"/>
</object>
<int key="connectionID">482</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">takeDoubleValueFrom:</string>
<reference key="source" ref="160623561"/>
<reference key="destination" ref="974764906"/>
</object>
<int key="connectionID">458</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">delegate</string>
<reference key="source" ref="980028635"/>
<reference key="destination" ref="635946545"/>
</object>
<int key="connectionID">473</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBObjectRecord">
<int key="objectID">0</int>
<object class="NSArray" key="object" id="0">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<reference key="children" ref="1048"/>
<nil key="parent"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">-2</int>
<reference key="object" ref="1021"/>
<reference key="parent" ref="0"/>
<string key="objectName">File's Owner</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-1</int>
<reference key="object" ref="1014"/>
<reference key="parent" ref="0"/>
<string key="objectName">First Responder</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-3</int>
<reference key="object" ref="1050"/>
<reference key="parent" ref="0"/>
<string key="objectName">Application</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">371</int>
<reference key="object" ref="972006081"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="439893737"/>
</object>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">372</int>
<reference key="object" ref="439893737"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="980028635"/>
</object>
<reference key="parent" ref="972006081"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">450</int>
<reference key="object" ref="635946545"/>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">460</int>
<reference key="object" ref="980028635"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="871265355"/>
<reference ref="877119126"/>
<reference ref="655520722"/>
<reference ref="105337172"/>
</object>
<reference key="parent" ref="439893737"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">461</int>
<reference key="object" ref="871265355"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="688798207"/>
<reference ref="160623561"/>
</object>
<reference key="parent" ref="980028635"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">462</int>
<reference key="object" ref="877119126"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="974764906"/>
</object>
<reference key="parent" ref="980028635"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">456</int>
<reference key="object" ref="160623561"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="46991665"/>
</object>
<reference key="parent" ref="871265355"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">457</int>
<reference key="object" ref="46991665"/>
<reference key="parent" ref="160623561"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">452</int>
<reference key="object" ref="974764906"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="600801425"/>
</object>
<reference key="parent" ref="877119126"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">453</int>
<reference key="object" ref="600801425"/>
<reference key="parent" ref="974764906"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">463</int>
<reference key="object" ref="655520722"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="295214252"/>
</object>
<reference key="parent" ref="980028635"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">464</int>
<reference key="object" ref="295214252"/>
<reference key="parent" ref="655520722"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">465</int>
<reference key="object" ref="105337172"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="600528701"/>
<reference ref="1031367026"/>
</object>
<reference key="parent" ref="980028635"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">466</int>
<reference key="object" ref="600528701"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="241459165"/>
</object>
<reference key="parent" ref="105337172"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">467</int>
<reference key="object" ref="1031367026"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="165016153"/>
</object>
<reference key="parent" ref="105337172"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">470</int>
<reference key="object" ref="165016153"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="1015466174"/>
</object>
<reference key="parent" ref="1031367026"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">471</int>
<reference key="object" ref="1015466174"/>
<reference key="parent" ref="165016153"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">474</int>
<reference key="object" ref="241459165"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="309483115"/>
<reference ref="858498729"/>
</object>
<reference key="parent" ref="600528701"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">475</int>
<reference key="object" ref="309483115"/>
<reference key="parent" ref="241459165"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">476</int>
<reference key="object" ref="858498729"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="290967118"/>
</object>
<reference key="parent" ref="241459165"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">468</int>
<reference key="object" ref="290967118"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="825192224"/>
</object>
<reference key="parent" ref="858498729"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">469</int>
<reference key="object" ref="825192224"/>
<reference key="parent" ref="290967118"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">477</int>
<reference key="object" ref="688798207"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="676112794"/>
</object>
<reference key="parent" ref="871265355"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">478</int>
<reference key="object" ref="676112794"/>
<reference key="parent" ref="688798207"/>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>-1.IBPluginDependency</string>
<string>-2.IBPluginDependency</string>
<string>-3.IBPluginDependency</string>
<string>371.IBPluginDependency</string>
<string>371.IBWindowTemplateEditedContentRect</string>
<string>371.NSWindowTemplate.visibleAtLaunch</string>
<string>372.IBPluginDependency</string>
<string>450.IBPluginDependency</string>
<string>452.IBPluginDependency</string>
<string>453.IBPluginDependency</string>
<string>456.IBPluginDependency</string>
<string>457.IBPluginDependency</string>
<string>460.IBPluginDependency</string>
<string>461.IBPluginDependency</string>
<string>462.IBPluginDependency</string>
<string>463.IBPluginDependency</string>
<string>464.IBPluginDependency</string>
<string>465.IBPluginDependency</string>
<string>466.IBPluginDependency</string>
<string>467.IBPluginDependency</string>
<string>468.IBPluginDependency</string>
<string>469.IBPluginDependency</string>
<string>470.IBPluginDependency</string>
<string>471.IBPluginDependency</string>
<string>474.IBPluginDependency</string>
<string>475.IBPluginDependency</string>
<string>476.IBPluginDependency</string>
<string>477.IBPluginDependency</string>
<string>478.IBPluginDependency</string>
</object>
<object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{{303, 221}, {480, 360}}</string>
<integer value="1"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
</object>
</object>
<object class="NSMutableDictionary" key="unlocalizedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
<reference key="dict.values" ref="0"/>
</object>
<nil key="activeLocalization"/>
<object class="NSMutableDictionary" key="localizations">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
<reference key="dict.values" ref="0"/>
</object>
<nil key="sourceID"/>
<int key="maxID">482</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
<string key="className">AppController</string>
<string key="superclassName">NSObject</string>
<object class="NSMutableDictionary" key="actions">
<string key="NS.key.0">deleteAutosave:</string>
<string key="NS.object.0">id</string>
</object>
<object class="NSMutableDictionary" key="actionInfosByName">
<string key="NS.key.0">deleteAutosave:</string>
<object class="IBActionInfo" key="NS.object.0">
<string key="name">deleteAutosave:</string>
<string key="candidateClassName">id</string>
</object>
</object>
<object class="NSMutableDictionary" key="outlets">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>splitViewA</string>
<string>splitViewB</string>
<string>splitViewC</string>
</object>
<object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>NSSplitView</string>
<string>NSSplitView</string>
<string>NSSplitView</string>
</object>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>splitViewA</string>
<string>splitViewB</string>
<string>splitViewC</string>
</object>
<object class="NSArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBToOneOutletInfo">
<string key="name">splitViewA</string>
<string key="candidateClassName">NSSplitView</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">splitViewB</string>
<string key="candidateClassName">NSSplitView</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">splitViewC</string>
<string key="candidateClassName">NSSplitView</string>
</object>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/AppController.h</string>
</object>
</object>
</object>
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string>
<integer value="1050" key="NS.object.0"/>
</object>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3</string>
<integer value="3000" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
</data>
</archive>
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

@@ -0,0 +1,204 @@
<!DOCTYPE html>
<html lang="en">
<!--
index-debug.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";
OBJJ_INCLUDE_PATHS = ["Frameworks/Debug", "Frameworks"];
// The below will tell the compiler to generate debug symbols, type signatures and not 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.
//
// Debug symbols will give each Objective-J method a Javascript function name. Without a name it will be very hard to find
// the methods in the debugger.
// Type Signatures will give type information to the Objective-J runtime for instance variables and methods.
// Inline objj_msgSend will give a speed increase but decorators will not work. Check below on debug options for
// more information on decorators.
//
// 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/Debug/Objective-J/Objective-J.js" charset="UTF-8"></script>
<script type="text/javascript">
objj_msgSend_reset();
// DEBUG OPTIONS:
// Decorators will only work when the code is compiled without the compiler option 'InlineMsgSend'. Check above.
// 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);
// Tag view DOM elements with a "data-cappuccino-view" attribute that contains
// the class name of the view that created them. Comment this or set to false to disable.
appkit_tag_dom_elements = true;
</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>
+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>
+18
View File
@@ -0,0 +1,18 @@
/*
* AppController.j
* CPStackViewTest
*
* Created by Daniel Böhringer on December 26, 2025.
* Copyright 2025, All rights reserved.
*/
@import <Foundation/Foundation.j>
@import <AppKit/AppKit.j>
@import "AppController.j"
function main(args, namedArgs)
{
CPApplicationMain(args, namedArgs);
}
@@ -1,20 +1,21 @@
#!/usr/bin/env bash
#
# NOTE: The working directory should be the main capp directory when this script is run
# Cleans up the temporary files generated by the pre-processor.
# The Current Working Directory (CWD) is the main temporary build directory.
#
# $1 Cappuccino Tools/Documentation directory
# $2 Generated documentation directory
# ARGUMENTS:
# $1 - The absolute path to the project root.
# Do this if you want to use the utility functions
source "$1"/support/processor_setup.sh
# Corrected path to the support script
source "$1/Tools/Documentation/support/processor_setup.sh"
# Cleanup the files we generated to feed to doxygen
processor_msg "Cleaning up generated header files..."
if [ -d AppKit.doc ]; then
# The .doc directories are in our CWD (the temp dir), so we can remove them.
if [ -d "AppKit.doc" ]; then
rm -rf AppKit.doc
fi
if [ -d Foundation.doc ]; then
if [ -d "Foundation.doc" ]; then
rm -rf Foundation.doc
fi
@@ -1,17 +1,16 @@
#!/usr/bin/env bash
#
# NOTE: The working directory should be the main capp directory when this script is run
# A hook for transforming text in the generated HTML files.
# CWD is the main temporary build directory.
#
# $1 Cappuccino Tools/Documentation directory
# $2 Generated documentation directory
# ARGUMENTS:
# $1 - The absolute path to the project root.
# $2 - The absolute path to the generated 'html' directory within the temp dir.
# Do this if you want to use the utility functions
source "$1"/support/processor_setup.sh
# Corrected path to the support script
source "$1/Tools/Documentation/support/processor_setup.sh"
if [ ! -d "$2" ]; then
exit 0
fi
processor_msg 'Massaging text...'
exec "$1"/support/massage_text.py "$2"
# This is a placeholder. If the original script did something specific,
# its logic would go here, operating on files inside the "$2" directory.
# For now, we'll just log that it ran.
processor_msg "Running text transformations..."
@@ -1,10 +1,22 @@
#!/usr/bin/env bash
#
# Remove the generated README.html once the build has finished.
#
# NOTE: The working directory should be the main capp directory when this script is run
#
# $1 Cappuccino documentation directory
# Moves the generated README.html to be the main index page of the documentation.
# NOTE: This step is being skipped to allow the Doxygen-generated index to be the default main page.
#
# ARGUMENTS:
# $1 - The absolute path to the project root.
# $2 - The absolute path to the generated 'html' directory within the temp dir.
rm "$1"/README.html
# Corrected path to the support script
source "$1/Tools/Documentation/support/processor_setup.sh"
processor_msg "Installing custom main documentation page... (SKIPPED)"
# The original build process used the project README as the main index.
# The 'mv' command below is commented out to prevent this from happening.
#
# if [ -f "README.html" ]; then
# mv "README.html" "$2/index.html"
# else
# processor_msg "Warning: README.html not found, cannot create main page." "yellow"
# fi
@@ -1,17 +1,20 @@
#!/usr/bin/env bash
#
# NOTE: The working directory should be the main capp directory when this script is run
# Creates README.html from the main README.markdown in the project root.
# CWD is a temporary build directory.
#
# $1 Cappuccino documentation directory
# ARGUMENTS:
# $1 - The absolute path to the project root.
# Do this if you want to use the utility functions
source "$1"/support/processor_setup.sh
# Do this if you want to use the utility functions. Note the path change.
source "$1/Tools/Documentation/support/processor_setup.sh"
markdown=`which markdown`
if [ -n "$markdown" ]; then
processor_msg "Markdown main page..."
"$markdown" README.markdown > "$1"/README.html
# Read from project root, write to current (temp) directory
"$markdown" "$1/README.markdown" > "README.html"
else
processor_msg "markdown binary is not installed, documentation cannot be generated." "red"
echo "On Mac OS X, install brew with the following command line:"
@@ -1,34 +1,44 @@
#!/usr/bin/env bash
#
# NOTE: The working directory should be the main capp directory when this script is run
# Creates temporary documentation source directories in the CWD (a temp dir).
#
# $1 Cappuccino documentation directory
# ARGUMENTS:
# $1 - The absolute path to the project root.
# Do this if you want to use the utility functions
source "$1"/support/processor_setup.sh
# Do this if you want to use the utility functions. Note the path change.
source "$1/Tools/Documentation/support/processor_setup.sh"
if [ -d AppKit.doc ]; then
rm -rf AppKit.doc
fi
# A function to collect sources. CWD is the temp dir.
# ARGS: $1=Project Root, $2=Framework Name, $3=Output Doc Dir Name
collect_sources() {
local project_root="$1"
local framework_name="$2"
local doc_dir_name="$3"
local tar_file="temp.tar" # Temp tar file in the CWD
if [ -d Foundation.doc ]; then
rm -rf Foundation.doc
fi
processor_msg "--------------------------------------------------"
processor_msg "Processing framework: $framework_name"
# Tar all of the AppKit/*.j files, excluding any files that begin with "_", and replace
# "AppKit" with "AppKit.doc" in the files path within the archive. Then unarchive the result.
# This turns out to be the quickest way I could find to get the correct files and rename them.
processor_msg "Collecting source files..."
bsdtar cf AppKit.doc.tar -s /^AppKit/AppKit.doc/ AppKit/*.j AppKit/**/*.j
bsdtar xf AppKit.doc.tar
rm AppKit.doc.tar
# Find sources relative to the project root
find "$project_root/$framework_name" -name "*.j" | bsdtar -s "|^$project_root/$framework_name/|$doc_dir_name/|" -cnf "$tar_file" -T -
# Now do the same thing with Foundation files.
bsdtar cf Foundation.doc.tar -s /^Foundation/Foundation.doc/ Foundation/*.j Foundation/**/*.j
bsdtar xf Foundation.doc.tar
rm Foundation.doc.tar
if [ -f "$tar_file" ]; then
processor_msg "Extracting archive to CWD..."
bsdtar xf "$tar_file"
rm "$tar_file"
else
processor_msg "ERROR: Failed to create tar archive for $framework_name." "red"
exit 1
fi
}
# Remove @import and @class from the source files, doxygen doesn't know what to do with them
# --- Run Collection ---
collect_sources "$1" "AppKit" "AppKit.doc"
collect_sources "$1" "Foundation" "Foundation.doc"
# --- Post-Process Files ---
processor_msg "--------------------------------------------------"
processor_msg "Removing @import and @class from source files..."
# These directories now exist in our CWD (the temp dir)
find AppKit.doc -name *.j -exec sed -e '/@import.*/ d' -e '/@class.*/ d' -i '' {} \;
find Foundation.doc -name *.j -exec sed -e '/@import.*/ d' -e '/@class.*/ d' -i '' {} \;
+1
View File
@@ -28,6 +28,7 @@
@property IBOutlet XCCMainController *mainWindowController;
@property NSOperationQueue *mainOperationQueue;
@property NSString *version;
@property NSString *copyright;
- (IBAction)openAbout:(id)aSender;
- (IBAction)openPreferences:(id)aSender;
+6 -4
View File
@@ -28,10 +28,10 @@
- (void)_initStatusItem
{
self->imageStatusInactive = [NSImage imageNamed:@"status-icon-inactive"];
self->imageStatusProcessing = [NSImage imageNamed:@"status-icon-working"];
self->imageStatusError = [NSImage imageNamed:@"status-icon-error"];
self->imageStatusInactive = [NSImage imageNamed:@"status-icon-inactive"];
self->imageStatusProcessing = [NSImage imageNamed:@"status-icon-working"];
self->imageStatusError = [NSImage imageNamed:@"status-icon-error"];
self->statusItem = [[NSStatusBar systemStatusBar] statusItemWithLength:NSVariableStatusItemLength];
self->statusItem.menu = self->statusMenu;
self->statusItem.image = self->imageStatusInactive;
@@ -98,6 +98,8 @@
NSLog(@"\n******************************\n** XcodeCapp started **\n******************************\n");
self.version = [NSBundle mainBundle].infoDictionary[@"CFBundleShortVersionString"];
NSString *copyrightString = [NSBundle mainBundle].infoDictionary[@"NSHumanReadableCopyright"];
self.copyright = [NSString stringWithFormat:@"%@\nAll rights reserved", copyrightString];
[self _initUserDefaults];
[self _initOperationQueue];
+112 -115
View File
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="23504" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14490.70"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="23504"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
@@ -350,27 +350,28 @@
</menu>
</menuItem>
</items>
<point key="canvasLocation" x="-225" y="-276"/>
</menu>
<window title="XcodeCapp" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" frameAutosaveName="main-window" animationBehavior="default" id="QvC-M9-y7g">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<windowCollectionBehavior key="collectionBehavior" fullScreenPrimary="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="224" y="158" width="863" height="634"/>
<rect key="screenRect" x="0.0" y="0.0" width="1440" height="877"/>
<rect key="screenRect" x="0.0" y="0.0" width="1920" height="1055"/>
<value key="minSize" type="size" width="800" height="600"/>
<view key="contentView" id="EiT-Mj-1SZ">
<rect key="frame" x="0.0" y="0.0" width="863" height="634"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<splitView autosaveName="main-splitView" dividerStyle="thin" vertical="YES" id="tld-4e-icT">
<splitView fixedFrame="YES" autosaveName="main-splitView" dividerStyle="thin" vertical="YES" translatesAutoresizingMaskIntoConstraints="NO" id="tld-4e-icT">
<rect key="frame" x="0.0" y="0.0" width="863" height="634"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<customView id="EWg-n1-sFa">
<customView fixedFrame="YES" id="EWg-n1-sFa">
<rect key="frame" x="0.0" y="0.0" width="263" height="634"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<scrollView borderType="none" autohidesScrollers="YES" horizontalLineScroll="72" horizontalPageScroll="10" verticalLineScroll="72" verticalPageScroll="10" hasHorizontalScroller="NO" usesPredominantAxisScrolling="NO" id="UZ4-kJ-krj">
<scrollView fixedFrame="YES" borderType="none" autohidesScrollers="YES" horizontalLineScroll="72" horizontalPageScroll="10" verticalLineScroll="72" verticalPageScroll="10" hasHorizontalScroller="NO" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="UZ4-kJ-krj">
<rect key="frame" x="0.0" y="0.0" width="263" height="634"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<clipView key="contentView" drawsBackground="NO" id="Zlj-Y5-TaS">
@@ -379,13 +380,12 @@
<subviews>
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnResizing="NO" multipleSelection="NO" autosaveColumns="NO" typeSelect="NO" rowHeight="72" rowSizeStyle="automatic" viewBased="YES" id="Mss-Tu-7kR">
<rect key="frame" x="0.0" y="0.0" width="263" height="634"/>
<autoresizingMask key="autoresizingMask"/>
<color key="backgroundColor" name="windowBackgroundColor" catalog="System" colorSpace="catalog"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
<color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
<tableColumns>
<tableColumn identifier="MainCell" editable="NO" width="263" minWidth="40" maxWidth="1000" id="UKo-y4-Q5Q">
<tableColumn identifier="MainCell" editable="NO" width="231" minWidth="40" maxWidth="1000" id="UKo-y4-Q5Q">
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="headerColor" catalog="System" colorSpace="catalog"/>
</tableHeaderCell>
@@ -397,11 +397,11 @@
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews>
<tableCellView identifier="MainCell" id="QnM-Kd-OyB" customClass="XCCCappuccinoProjectControllerDataView">
<rect key="frame" x="0.0" y="0.0" width="263" height="72"/>
<rect key="frame" x="10" y="0.0" width="243" height="72"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" allowsExpansionToolTips="YES" id="nss-wl-6TY">
<rect key="frame" x="17" y="49" width="223" height="17"/>
<textField focusRingType="none" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" allowsExpansionToolTips="YES" translatesAutoresizingMaskIntoConstraints="NO" id="nss-wl-6TY">
<rect key="frame" x="17" y="49" width="203" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" lineBreakMode="truncatingMiddle" sendsActionOnEndEditing="YES" title="Table View Cell" id="HCp-It-Jhp">
<font key="font" metaFont="system"/>
@@ -409,7 +409,7 @@
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<box autoresizesSubviews="NO" boxType="custom" borderType="line" borderWidth="0.0" cornerRadius="5" title="Box" titlePosition="noTitle" id="kpw-qm-NQG">
<box autoresizesSubviews="NO" fixedFrame="YES" boxType="custom" borderType="line" borderWidth="0.0" cornerRadius="100" title="Box" titlePosition="noTitle" translatesAutoresizingMaskIntoConstraints="NO" id="kpw-qm-NQG">
<rect key="frame" x="5" y="52" width="10" height="10"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<view key="contentView" id="S9K-TP-K5A">
@@ -419,12 +419,12 @@
<color key="borderColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
<color key="fillColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</box>
<box verticalHuggingPriority="750" boxType="separator" id="MsY-oY-iIn">
<rect key="frame" x="-12" y="-2" width="279" height="5"/>
<box verticalHuggingPriority="750" fixedFrame="YES" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="MsY-oY-iIn">
<rect key="frame" x="-12" y="-2" width="259" height="5"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
</box>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="PN4-Zx-XTz">
<rect key="frame" x="17" y="36" width="223" height="11"/>
<textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="PN4-Zx-XTz">
<rect key="frame" x="17" y="36" width="203" height="11"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" controlSize="mini" lineBreakMode="truncatingMiddle" sendsActionOnEndEditing="YES" title="Label" id="gK0-ds-ocu">
<font key="font" metaFont="miniSystem"/>
@@ -432,11 +432,11 @@
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<customView id="j8y-lz-3wP">
<rect key="frame" x="26" y="9" width="213" height="16"/>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="j8y-lz-3wP">
<rect key="frame" x="15" y="9" width="213" height="16"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<button toolTip="Open In Xcode" verticalHuggingPriority="750" id="0Kk-a1-H2b">
<button toolTip="Open In Xcode" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="0Kk-a1-H2b">
<rect key="frame" x="144" y="0.0" width="33" height="16"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" heightSizable="YES"/>
<buttonCell key="cell" type="bevel" bezelStyle="rounded" image="open-in-xcode" imagePosition="overlaps" alignment="center" controlSize="small" imageScaling="proportionallyDown" inset="2" id="21c-Zh-TSt">
@@ -444,7 +444,7 @@
<font key="font" metaFont="smallSystem"/>
</buttonCell>
</button>
<button toolTip="Switch listening mode" verticalHuggingPriority="750" id="PoH-Du-Pas">
<button toolTip="Switch listening mode" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="PoH-Du-Pas">
<rect key="frame" x="0.0" y="0.0" width="33" height="16"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" heightSizable="YES"/>
<buttonCell key="cell" type="bevel" bezelStyle="rounded" image="run" imagePosition="overlaps" alignment="center" controlSize="small" imageScaling="proportionallyDown" inset="2" id="WLR-K6-Jof">
@@ -452,7 +452,7 @@
<font key="font" metaFont="smallSystem"/>
</buttonCell>
</button>
<button toolTip="Reset the project" verticalHuggingPriority="750" id="7pJ-O0-Sk5">
<button toolTip="Reset the project" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="7pJ-O0-Sk5">
<rect key="frame" x="180" y="0.0" width="33" height="16"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" heightSizable="YES"/>
<buttonCell key="cell" type="bevel" bezelStyle="rounded" image="resync" imagePosition="overlaps" alignment="center" controlSize="small" imageScaling="proportionallyDown" inset="2" id="0lw-E5-col">
@@ -460,7 +460,7 @@
<font key="font" metaFont="smallSystem"/>
</buttonCell>
</button>
<button toolTip="Open in Finder" verticalHuggingPriority="750" id="vsI-jy-i4m">
<button toolTip="Open in Finder" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="vsI-jy-i4m">
<rect key="frame" x="36" y="0.0" width="33" height="16"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" heightSizable="YES"/>
<buttonCell key="cell" type="bevel" bezelStyle="rounded" image="open-in-finder" imagePosition="overlaps" alignment="center" controlSize="small" imageScaling="proportionallyDown" inset="2" id="wlx-b2-lHy">
@@ -468,7 +468,7 @@
<font key="font" metaFont="smallSystem"/>
</buttonCell>
</button>
<button toolTip="Edit in Code Editor" verticalHuggingPriority="750" id="rTo-y9-fQU">
<button toolTip="Edit in Code Editor" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="rTo-y9-fQU">
<rect key="frame" x="72" y="0.0" width="33" height="16"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" heightSizable="YES"/>
<buttonCell key="cell" type="bevel" bezelStyle="rounded" image="open-in-editor" imagePosition="overlaps" alignment="center" controlSize="small" imageScaling="proportionallyDown" inset="2" id="VDo-2A-vaS">
@@ -476,7 +476,7 @@
<font key="font" metaFont="smallSystem"/>
</buttonCell>
</button>
<button toolTip="Open Terminal in Project" verticalHuggingPriority="750" id="dz5-I3-w2h">
<button toolTip="Open Terminal in Project" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="dz5-I3-w2h">
<rect key="frame" x="108" y="0.0" width="33" height="16"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" heightSizable="YES"/>
<buttonCell key="cell" type="bevel" bezelStyle="rounded" image="open-in-terminal" imagePosition="overlaps" alignment="center" controlSize="small" imageScaling="proportionallyDown" inset="2" id="Mwt-yg-Jeo">
@@ -486,8 +486,8 @@
</button>
</subviews>
</customView>
<customView id="kNu-ud-1j8" customClass="YRKSpinningProgressIndicator">
<rect key="frame" x="244" y="28" width="16" height="16"/>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="kNu-ud-1j8" customClass="YRKSpinningProgressIndicator">
<rect key="frame" x="224" y="28" width="16" height="16"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="maxValue">
@@ -521,23 +521,23 @@
</subviews>
<nil key="backgroundColor"/>
</clipView>
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="GIE-ju-XbD">
<scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="GIE-ju-XbD">
<rect key="frame" x="1" y="119" width="223" height="15"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
<scroller key="verticalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="NO" id="pb5-AF-zGg">
<scroller key="verticalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="NO" id="pb5-AF-zGg">
<rect key="frame" x="224" y="17" width="15" height="102"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
</scrollView>
<box autoresizesSubviews="NO" boxType="custom" borderType="line" title="Box" titlePosition="noTitle" transparent="YES" id="atN-bp-ONR">
<box autoresizesSubviews="NO" fixedFrame="YES" boxType="custom" borderType="line" title="Box" titlePosition="noTitle" transparent="YES" translatesAutoresizingMaskIntoConstraints="NO" id="atN-bp-ONR">
<rect key="frame" x="0.0" y="0.0" width="263" height="32"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
<view key="contentView" id="lgd-3C-ZcF">
<rect key="frame" x="1" y="1" width="261" height="30"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<button verticalHuggingPriority="750" id="7QO-xa-9rT">
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="7QO-xa-9rT">
<rect key="frame" x="0.0" y="-2" width="35" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="bevel" bezelStyle="rounded" image="NSAddTemplate" imagePosition="overlaps" alignment="center" imageScaling="proportionallyDown" inset="2" id="ari-l9-Qyx">
@@ -548,7 +548,7 @@
<action selector="addProject:" target="923-ke-ovW" id="WcS-qH-gsc"/>
</connections>
</button>
<button verticalHuggingPriority="750" id="5qE-h2-muz">
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="5qE-h2-muz">
<rect key="frame" x="34" y="-2" width="35" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="bevel" bezelStyle="rounded" image="NSRemoveTemplate" imagePosition="overlaps" alignment="center" imageScaling="proportionallyDown" inset="2" id="Wwg-4A-3Ad">
@@ -566,67 +566,66 @@
</button>
</subviews>
</view>
<color key="borderColor" name="gridColor" catalog="System" colorSpace="catalog"/>
<color key="fillColor" name="windowBackgroundColor" catalog="System" colorSpace="catalog"/>
<color key="borderColor" red="1" green="1" blue="1" alpha="0.41999999999999998" colorSpace="calibratedRGB"/>
<color key="fillColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
</box>
</subviews>
</customView>
<customView id="87a-A4-dGN">
<customView fixedFrame="YES" id="87a-A4-dGN">
<rect key="frame" x="264" y="0.0" width="599" height="634"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<customView id="uJC-CC-9au">
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="uJC-CC-9au">
<rect key="frame" x="0.0" y="0.0" width="599" height="634"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<box autoresizesSubviews="NO" boxType="custom" borderType="line" borderWidth="0.0" title="Box" titlePosition="noTitle" id="SrB-rO-09w">
<box autoresizesSubviews="NO" fixedFrame="YES" boxType="custom" borderType="line" borderWidth="0.0" title="Box" titlePosition="noTitle" translatesAutoresizingMaskIntoConstraints="NO" id="SrB-rO-09w">
<rect key="frame" x="0.0" y="588" width="615" height="46"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<view key="contentView" id="98G-pQ-oIM">
<rect key="frame" x="0.0" y="0.0" width="615" height="46"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<box verticalHuggingPriority="750" boxType="separator" id="QMT-Ui-fxI">
<rect key="frame" x="-1" y="-3" width="613" height="5"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
</box>
<textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" id="krM-95-waf">
<textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="krM-95-waf">
<rect key="frame" x="14" y="24" width="580" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" focusRingType="none" title="Project Name" id="ylH-C3-MHM">
<font key="font" metaFont="system"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<connections>
<binding destination="923-ke-ovW" name="value" keyPath="self.currentCappuccinoProjectController.cappuccinoProject.nickname" id="Teo-iY-bEl"/>
</connections>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="0c3-NS-t4n">
<textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="0c3-NS-t4n">
<rect key="frame" x="14" y="8" width="580" height="14"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" selectable="YES" sendsActionOnEndEditing="YES" title="Project Path" id="NvI-dv-Vcf">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="secondaryLabelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<connections>
<binding destination="923-ke-ovW" name="value" keyPath="self.currentCappuccinoProjectController.cappuccinoProject.projectPath" id="IT9-Ja-icI"/>
</connections>
</textField>
<box verticalHuggingPriority="750" fixedFrame="YES" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="QMT-Ui-fxI">
<rect key="frame" x="-1" y="-3" width="613" height="5"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
</box>
</subviews>
</view>
<color key="borderColor" name="gridColor" catalog="System" colorSpace="catalog"/>
<color key="fillColor" name="windowBackgroundColor" catalog="System" colorSpace="catalog"/>
<color key="borderColor" red="0.96862745098039216" green="0.50588235294117645" blue="0.16470588235294117" alpha="1" colorSpace="calibratedRGB"/>
</box>
<box autoresizesSubviews="NO" boxType="custom" borderType="line" borderWidth="0.0" title="Box" id="ic3-Xg-i5j">
<box autoresizesSubviews="NO" fixedFrame="YES" boxType="custom" borderType="line" borderWidth="0.0" title="Box" translatesAutoresizingMaskIntoConstraints="NO" id="ic3-Xg-i5j">
<rect key="frame" x="0.0" y="562" width="599" height="26"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<view key="contentView" id="Tuy-VW-JIc">
<rect key="frame" x="0.0" y="0.0" width="599" height="26"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<button verticalHuggingPriority="750" id="sNm-EJ-c40">
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="sNm-EJ-c40">
<rect key="frame" x="18" y="2" width="147" height="22"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="square" title="Settings" bezelStyle="shadowlessSquare" alignment="center" refusesFirstResponder="YES" imageScaling="proportionallyDown" inset="2" id="Fel-8z-zmY">
@@ -642,7 +641,7 @@
<action selector="updateSelectedTab:" target="923-ke-ovW" id="WXV-zO-X4G"/>
</connections>
</button>
<button verticalHuggingPriority="750" id="E4i-Ez-bfl">
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="E4i-Ez-bfl">
<rect key="frame" x="227" y="2" width="147" height="22"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="square" title="Errors &amp; Warnings" bezelStyle="shadowlessSquare" alignment="center" refusesFirstResponder="YES" imageScaling="proportionallyDown" inset="2" id="x1c-0h-XNs">
@@ -658,7 +657,7 @@
<action selector="updateSelectedTab:" target="923-ke-ovW" id="YlA-uX-wtA"/>
</connections>
</button>
<button verticalHuggingPriority="750" id="UCo-MK-pOT">
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="UCo-MK-pOT">
<rect key="frame" x="432" y="2" width="147" height="22"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="square" title="Operations" bezelStyle="shadowlessSquare" alignment="center" refusesFirstResponder="YES" imageScaling="proportionallyDown" inset="2" id="ZxW-hd-KKo">
@@ -674,16 +673,15 @@
<action selector="updateSelectedTab:" target="923-ke-ovW" id="V56-Vq-dcX"/>
</connections>
</button>
<box verticalHuggingPriority="750" boxType="separator" id="0Lp-Tm-YXi">
<box verticalHuggingPriority="750" fixedFrame="YES" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="0Lp-Tm-YXi">
<rect key="frame" x="0.0" y="-2" width="599" height="5"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMaxY="YES"/>
</box>
</subviews>
</view>
<color key="borderColor" name="gridColor" catalog="System" colorSpace="catalog"/>
<color key="fillColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
<color key="borderColor" red="0.93725490196078431" green="0.93725490196078431" blue="0.93725490196078431" alpha="1" colorSpace="calibratedRGB"/>
</box>
<tabView drawsBackground="NO" type="noTabsNoBorder" id="00d-fn-q41">
<tabView fixedFrame="YES" drawsBackground="NO" type="noTabsNoBorder" translatesAutoresizingMaskIntoConstraints="NO" id="00d-fn-q41">
<rect key="frame" x="0.0" y="0.0" width="599" height="562"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<font key="font" metaFont="system"/>
@@ -709,43 +707,34 @@
<connections>
<outlet property="initialFirstResponder" destination="Mss-Tu-7kR" id="fe9-ry-0ar"/>
</connections>
<point key="canvasLocation" x="244.5" y="112"/>
<point key="canvasLocation" x="-466" y="549"/>
</window>
<window title="About" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" restorable="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="EMp-Db-uhU" customClass="NSPanel">
<windowStyleMask key="styleMask" titled="YES" closable="YES"/>
<rect key="contentRect" x="196" y="240" width="296" height="191"/>
<rect key="screenRect" x="0.0" y="0.0" width="1440" height="877"/>
<rect key="contentRect" x="196" y="240" width="324" height="200"/>
<rect key="screenRect" x="0.0" y="0.0" width="1920" height="1055"/>
<view key="contentView" id="dj4-iP-S2b">
<rect key="frame" x="0.0" y="0.0" width="296" height="191"/>
<rect key="frame" x="0.0" y="0.0" width="324" height="200"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="3j4-r5-Ybe">
<rect key="frame" x="74" y="64" width="149" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="3j4-r5-Ybe">
<rect key="frame" x="88" y="73" width="149" height="17"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="XcodeCapp" id="qvL-bN-A9R">
<font key="font" metaFont="systemBold" size="15"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" id="IH1-cn-Xc9">
<rect key="frame" x="18" y="20" width="260" height="14"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="Copyright © 2012-2018 Cappuccino Project." id="8lT-Ky-ecV">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" white="0.5" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<imageView id="Q2t-aL-TDg">
<rect key="frame" x="107" y="89" width="82" height="82"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<imageView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Q2t-aL-TDg">
<rect key="frame" x="121" y="98" width="82" height="82"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="logo" id="zF2-py-kAi"/>
</imageView>
<textField verticalHuggingPriority="750" id="vIx-Hh-v8Z">
<rect key="frame" x="108" y="42" width="81" height="14"/>
<textField focusRingType="none" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="vIx-Hh-v8Z">
<rect key="frame" x="18" y="51" width="288" height="14"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="Version 4.0.1" id="WUW-Ut-m7V">
<textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="Value from Info.plist displayed using bindings" id="WUW-Ut-m7V">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
@@ -754,21 +743,33 @@
<binding destination="Voe-Tx-rLC" name="value" keyPath="self.version" id="Nfs-HY-nea"/>
</connections>
</textField>
<textField focusRingType="none" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" textCompletion="NO" translatesAutoresizingMaskIntoConstraints="NO" id="IH1-cn-Xc9">
<rect key="frame" x="18" y="0.0" width="292" height="43"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" controlSize="small" allowsUndo="NO" sendsActionOnEndEditing="YES" alignment="center" title="Set in Info.plist, displayed using bindings" id="8lT-Ky-ecV">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" white="0.5" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<connections>
<binding destination="Voe-Tx-rLC" name="value" keyPath="self.copyright" id="cHX-2a-APu"/>
</connections>
</textField>
</subviews>
</view>
<point key="canvasLocation" x="-218" y="94.5"/>
<point key="canvasLocation" x="-304" y="-20"/>
</window>
<userDefaultsController representsSharedInstance="YES" id="GHK-nR-IEq" userLabel="User Defaults Controller"/>
<window title="XcodeCapp Preferences" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" frameAutosaveName="xcc-prefs" animationBehavior="default" id="ekp-cc-W2F">
<windowStyleMask key="styleMask" titled="YES" closable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" topStrut="YES"/>
<rect key="contentRect" x="534" y="231" width="357" height="132"/>
<rect key="screenRect" x="0.0" y="0.0" width="1440" height="877"/>
<rect key="screenRect" x="0.0" y="0.0" width="1920" height="1055"/>
<view key="contentView" id="79d-AB-fk4">
<rect key="frame" x="0.0" y="0.0" width="357" height="132"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<button toolTip="If this is checked, when a Cappuccino project is opened, the project’s Xcode support project will be opened automatically" id="QGE-Iy-i46">
<button toolTip="If this is checked, when a Cappuccino project is opened, the project’s Xcode support project will be opened automatically" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="QGE-Iy-i46">
<rect key="frame" x="18" y="96" width="321" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" title="Automatically open Projects in Xcode" bezelStyle="regularSquare" imagePosition="left" alignment="left" state="on" inset="2" id="VNE-DB-5fX">
@@ -784,7 +785,7 @@
</binding>
</connections>
</button>
<textField verticalHuggingPriority="750" id="Llm-fD-60A">
<textField focusRingType="none" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Llm-fD-60A">
<rect key="frame" x="18" y="70" width="186" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Maximum parallel operations:" id="feI-Ow-URM">
@@ -793,12 +794,12 @@
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<popUpButton verticalHuggingPriority="750" id="9up-BP-tRE">
<popUpButton verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="9up-BP-tRE">
<rect key="frame" x="229" y="65" width="111" height="26"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<popUpButtonCell key="cell" type="push" title="20" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="UjK-Ie-IaQ" id="niA-cT-acm">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="menu"/>
<font key="font" metaFont="message"/>
<menu key="menu" title="OtherViews" id="lgh-Ml-epM">
<items>
<menuItem title="10" id="eqb-Oz-H0j"/>
@@ -814,7 +815,7 @@
<binding destination="GHK-nR-IEq" name="selectedValue" keyPath="values.XCCUserDefaultsMaxNumberOfConcurrentOperations" id="gpI-YW-A6a"/>
</connections>
</popUpButton>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="axH-wD-X4l">
<textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="axH-wD-X4l">
<rect key="frame" x="18" y="20" width="321" height="42"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" id="NZb-FO-ea5">
@@ -826,25 +827,25 @@
</textField>
</subviews>
</view>
<point key="canvasLocation" x="-156.5" y="-126"/>
<point key="canvasLocation" x="136" y="-20"/>
</window>
<box boxType="custom" borderType="line" borderWidth="0.0" title="Box" titlePosition="noTitle" id="fYW-ua-i1m">
<box boxType="custom" borderType="line" borderWidth="0.0" title="Box" titlePosition="noTitle" id="fYW-ua-i1m" userLabel="Masking View">
<rect key="frame" x="0.0" y="0.0" width="271" height="313"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<view key="contentView" id="oa8-a7-MJz">
<rect key="frame" x="0.0" y="0.0" width="271" height="313"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<customView id="vKu-AP-6l9">
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="vKu-AP-6l9">
<rect key="frame" x="16" y="16" width="239" height="281"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<subviews>
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" id="9iO-X5-hpo">
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="9iO-X5-hpo">
<rect key="frame" x="26" y="75" width="186" height="186"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="logo" id="1zG-V8-6bF"/>
</imageView>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="lpR-ul-R4k">
<textField focusRingType="none" horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="lpR-ul-R4k">
<rect key="frame" x="40" y="42" width="158" height="25"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="XcodeCapp" id="Oar-AW-2i5">
@@ -853,12 +854,12 @@
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" id="fUL-eL-YkQ">
<textField focusRingType="none" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="fUL-eL-YkQ">
<rect key="frame" x="18" y="20" width="203" height="14"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="Version 4.0" id="unR-NY-aap">
<font key="font" metaFont="smallSystem"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
<connections>
@@ -869,9 +870,7 @@
</customView>
</subviews>
</view>
<color key="borderColor" name="gridColor" catalog="System" colorSpace="catalog"/>
<color key="fillColor" name="windowBackgroundColor" catalog="System" colorSpace="catalog"/>
<point key="canvasLocation" x="630" y="-361"/>
<point key="canvasLocation" x="136" y="-641"/>
</box>
<box boxType="custom" borderType="line" borderWidth="0.0" title="Box" titlePosition="noTitle" id="stz-Vu-tYo" customClass="XCCWelcomeView">
<rect key="frame" x="0.0" y="0.0" width="464" height="401"/>
@@ -880,23 +879,23 @@
<rect key="frame" x="0.0" y="0.0" width="464" height="401"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<customView id="3EK-jb-wmc">
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="3EK-jb-wmc">
<rect key="frame" x="15" y="16" width="434" height="369"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<subviews>
<box verticalHuggingPriority="750" boxType="separator" id="FVR-yM-GAZ">
<box verticalHuggingPriority="750" fixedFrame="YES" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="FVR-yM-GAZ">
<rect key="frame" x="40" y="116" width="354" height="5"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
</box>
<box autoresizesSubviews="NO" boxType="custom" borderType="line" cornerRadius="28" title="Box" titlePosition="noTitle" id="Tbj-mM-87j">
<rect key="frame" x="189" y="28" width="56" height="56"/>
<box autoresizesSubviews="NO" fixedFrame="YES" boxType="custom" borderType="line" cornerRadius="100" title="Box" titlePosition="noTitle" translatesAutoresizingMaskIntoConstraints="NO" id="Tbj-mM-87j">
<rect key="frame" x="189" y="28" width="57" height="57"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<view key="contentView" id="aoX-nH-ofv">
<rect key="frame" x="1" y="1" width="54" height="54"/>
<rect key="frame" x="1" y="1" width="55" height="55"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<button focusRingType="none" id="wQo-c7-sD7">
<rect key="frame" x="14" y="14" width="27" height="26"/>
<button focusRingType="none" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="wQo-c7-sD7">
<rect key="frame" x="14" y="15" width="27" height="26"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="NSAddTemplate" imagePosition="only" alignment="center" focusRingType="none" imageScaling="proportionallyDown" inset="2" id="o7j-4e-NNJ">
<behavior key="behavior" lightByContents="YES"/>
@@ -906,16 +905,16 @@
<action selector="addProject:" target="923-ke-ovW" id="YGQ-yu-Glg"/>
</connections>
</button>
<progressIndicator wantsLayer="YES" horizontalHuggingPriority="750" verticalHuggingPriority="750" maxValue="100" bezeled="NO" indeterminate="YES" style="spinning" id="vPH-Iq-Ray">
<rect key="frame" x="11" y="11" width="32" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES"/>
</progressIndicator>
</subviews>
</view>
<color key="borderColor" red="0.97254901959999995" green="0.50196078430000002" blue="0.15686274510000001" alpha="1" colorSpace="custom" customColorSpace="calibratedRGB"/>
<color key="borderColor" red="0.97254901960784312" green="0.50196078431372548" blue="0.15686274509803921" alpha="1" colorSpace="calibratedRGB"/>
<color key="fillColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</box>
<button focusRingType="none" id="wdl-kS-DYD">
<progressIndicator wantsLayer="YES" horizontalHuggingPriority="750" verticalHuggingPriority="750" fixedFrame="YES" maxValue="100" bezeled="NO" indeterminate="YES" style="spinning" translatesAutoresizingMaskIntoConstraints="NO" id="vPH-Iq-Ray">
<rect key="frame" x="201" y="40" width="32" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES"/>
</progressIndicator>
<button focusRingType="none" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="wdl-kS-DYD">
<rect key="frame" x="124" y="150" width="186" height="186"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="logo" imagePosition="only" alignment="center" focusRingType="none" imageScaling="proportionallyDown" inset="2" id="OC7-Ci-3pt">
@@ -930,13 +929,11 @@
</customView>
</subviews>
</view>
<color key="borderColor" name="gridColor" catalog="System" colorSpace="catalog"/>
<color key="fillColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
<connections>
<outlet property="boxImport" destination="Tbj-mM-87j" id="Nly-uI-l8C"/>
<outlet property="loadingIndicator" destination="vPH-Iq-Ray" id="qiU-X4-gPI"/>
</connections>
<point key="canvasLocation" x="262" y="-248.5"/>
<point key="canvasLocation" x="548" y="-487"/>
</box>
<menu id="caT-Aq-Atw">
<items>
@@ -971,8 +968,8 @@
</menu>
</objects>
<resources>
<image name="NSAddTemplate" width="11" height="11"/>
<image name="NSRemoveTemplate" width="11" height="11"/>
<image name="NSAddTemplate" width="18" height="16"/>
<image name="NSRemoveTemplate" width="18" height="4"/>
<image name="logo" width="512" height="512"/>
<image name="open-in-editor" width="16" height="16"/>
<image name="open-in-finder" width="16" height="16"/>
@@ -1,14 +1,14 @@
{
"images" : [
{
"filename" : "status-icon-inactive.png",
"idiom" : "universal",
"scale" : "1x",
"filename" : "status-icon-inactive.png"
"scale" : "1x"
},
{
"filename" : "status-icon-inactive@2x.png",
"idiom" : "universal",
"scale" : "2x",
"filename" : "status-icon-inactive@2x.png"
"scale" : "2x"
},
{
"idiom" : "universal",
@@ -16,7 +16,10 @@
}
],
"info" : {
"version" : 1,
"author" : "xcode"
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}
}
+3 -5
View File
@@ -34,7 +34,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>Version 4.0.1</string>
<string>Version 4.0.3</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
@@ -44,7 +44,7 @@
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2012-2018 Cappuccino Project. All rights reserved.</string>
<string>Copyright © 2012-2024 Cappuccino Project</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>
@@ -56,8 +56,6 @@
<key>XCCLastCappuccinoMasterBranchURL</key>
<string>https://github.com/cappuccino/cappuccino/archive/master.zip</string>
<key>XCCLastCappuccinoReleaseURL</key>
<string>https://github.com/cappuccino/cappuccino/archive/1.0.0.zip</string>
<key>NSRequiresAquaSystemAppearance</key>
<false/>
<string>https://www.cappuccino.dev/downloads/CappuccinoStarter-1.0.0.zip</string>
</dict>
</plist>
@@ -1 +0,0 @@
280NPLIST;1.0;D;K;4;$topD;K;18;CPCibObjectDataKeyD;K;6;CP$UIDd;1;2E;E;K;8;$objectsA;S;5;$nullD;K;10;$classnameS;16;_CPCibObjectDataK;8;$classesA;S;16;_CPCibObjectDataS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;1;1E;K;28;_CPCibObjectDataNamesKeysKeyD;K;6;CP$UIDd;1;0E;K;30;_CPCibObjectDataNamesValuesKeyD;K;6;CP$UIDd;1;0E;K;30;_CPCibObjectDataClassesKeysKeyD;K;6;CP$UIDd;1;0E;K;32;_CPCibObjectDataClassesValuesKeyD;K;6;CP$UIDd;1;0E;K;30;_CPCibObjectDataConnectionsKeyD;K;6;CP$UIDd;1;4E;K;28;_CPCibObjectDataFrameworkKeyD;K;6;CP$UIDd;1;0E;K;26;_CPCibObjectDataNextOidKeyD;K;6;CP$UIDd;1;5E;K;30;_CPCibObjectDataObjectsKeysKeyD;K;6;CP$UIDd;1;6E;K;32;_CPCibObjectDataObjectsValuesKeyD;K;6;CP$UIDd;1;7E;K;26;_CPCibObjectDataOidKeysKeyD;K;6;CP$UIDd;1;8E;K;28;_CPCibObjectDataOidValuesKeyD;K;6;CP$UIDd;1;9E;K;28;_CPCibObjectDataFileOwnerKeyD;K;6;CP$UIDd;2;11E;K;33;_CPCibObjectDataVisibleWindowsKeyD;K;6;CP$UIDd;2;13E;E;D;K;10;$classnameS;7;CPArrayK;8;$classesA;S;7;CPArrayS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;D;K;6;CP$UIDd;2;15E;D;K;6;CP$UIDd;2;16E;D;K;6;CP$UIDd;2;18E;D;K;6;CP$UIDd;2;19E;D;K;6;CP$UIDd;2;20E;D;K;6;CP$UIDd;2;21E;D;K;6;CP$UIDd;2;22E;D;K;6;CP$UIDd;2;23E;D;K;6;CP$UIDd;2;24E;D;K;6;CP$UIDd;2;25E;D;K;6;CP$UIDd;2;26E;D;K;6;CP$UIDd;2;27E;D;K;6;CP$UIDd;2;29E;D;K;6;CP$UIDd;2;30E;D;K;6;CP$UIDd;2;32E;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;D;K;6;CP$UIDd;2;33E;D;K;6;CP$UIDd;2;35E;D;K;6;CP$UIDd;2;37E;D;K;6;CP$UIDd;2;38E;D;K;6;CP$UIDd;2;39E;D;K;6;CP$UIDd;2;41E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;42E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;44E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;46E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;47E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;48E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;49E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;50E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;51E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;52E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;54E;D;K;6;CP$UIDd;2;56E;D;K;6;CP$UIDd;2;58E;D;K;6;CP$UIDd;2;60E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;62E;D;K;6;CP$UIDd;2;63E;D;K;6;CP$UIDd;2;64E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;65E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;66E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;67E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;68E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;69E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;70E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;71E;D;K;6;CP$UIDd;1;0E;D;K;6;CP$UIDd;2;72E;D;K;6;CP$UIDd;2;73E;D;K;6;CP$UIDd;2;74E;D;K;6;CP$UIDd;2;75E;D;K;6;CP$UIDd;1;0E;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;D;K;6;CP$UIDd;2;11E;D;K;6;CP$UIDd;2;11E;D;K;6;CP$UIDd;2;35E;D;K;6;CP$UIDd;2;37E;D;K;6;CP$UIDd;2;38E;D;K;6;CP$UIDd;2;39E;D;K;6;CP$UIDd;2;41E;D;K;6;CP$UIDd;2;39E;D;K;6;CP$UIDd;2;42E;D;K;6;CP$UIDd;2;37E;D;K;6;CP$UIDd;2;44E;D;K;6;CP$UIDd;2;37E;D;K;6;CP$UIDd;2;46E;D;K;6;CP$UIDd;2;37E;D;K;6;CP$UIDd;2;47E;D;K;6;CP$UIDd;2;37E;D;K;6;CP$UIDd;2;48E;D;K;6;CP$UIDd;2;37E;D;K;6;CP$UIDd;2;49E;D;K;6;CP$UIDd;2;37E;D;K;6;CP$UIDd;2;50E;D;K;6;CP$UIDd;2;37E;D;K;6;CP$UIDd;2;51E;D;K;6;CP$UIDd;2;37E;D;K;6;CP$UIDd;2;52E;D;K;6;CP$UIDd;2;37E;D;K;6;CP$UIDd;2;54E;D;K;6;CP$UIDd;2;56E;D;K;6;CP$UIDd;2;58E;D;K;6;CP$UIDd;2;60E;D;K;6;CP$UIDd;2;54E;D;K;6;CP$UIDd;2;54E;D;K;6;CP$UIDd;2;37E;D;K;6;CP$UIDd;2;64E;D;K;6;CP$UIDd;2;37E;D;K;6;CP$UIDd;2;65E;D;K;6;CP$UIDd;2;37E;D;K;6;CP$UIDd;2;66E;D;K;6;CP$UIDd;2;37E;D;K;6;CP$UIDd;2;67E;D;K;6;CP$UIDd;2;37E;D;K;6;CP$UIDd;2;68E;D;K;6;CP$UIDd;2;37E;D;K;6;CP$UIDd;2;69E;D;K;6;CP$UIDd;2;37E;D;K;6;CP$UIDd;2;70E;D;K;6;CP$UIDd;2;37E;D;K;6;CP$UIDd;2;71E;D;K;6;CP$UIDd;2;37E;D;K;6;CP$UIDd;2;37E;D;K;6;CP$UIDd;2;37E;D;K;6;CP$UIDd;2;37E;D;K;6;CP$UIDd;2;75E;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;E;E;D;K;6;$classD;K;6;CP$UIDd;1;3E;K;10;CP.objectsA;E;E;D;K;10;$classnameS;18;_CPCibCustomObjectK;8;$classesA;S;18;_CPCibCustomObjectS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;2;10E;K;27;_CPCibCustomObjectClassNameD;K;6;CP$UIDd;2;76E;E;D;K;10;$classnameS;5;CPSetK;8;$classesA;S;5;CPSetS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;2;12E;K;15;CPSetObjectsKeyD;K;6;CP$UIDd;2;77E;E;D;K;10;$classnameS;31;CPCibRuntimeAttributesConnectorK;8;$classesA;S;31;CPCibRuntimeAttributesConnectorS;14;CPCibConnectorS;8;CPObjectE;E;D;K;6;$classD;K;6;CP$UIDd;2;14E;K;24;_CPCibConnectorSourceKeyD;K;6;CP$UIDd;2;38E;K;29;_CPCibConnectorDestinationKeyD;K;6;CP$UIDd;1;0E;K;23;_CPCibConnectorLabelKeyD;K;6;CP$UIDd;1;0E;K;40;CPCibRuntimeAttributesConnectorObjectKeyD;K;6;CP$UIDd;2;38E;K;42;CPCibRuntimeAttributesConnectorKeyPathsKeyD;K;6;CP$UIDd;2;78E;K;40;CPCibRuntimeAttributesConnectorValuesKeyD;K;6;CP$UIDd;2;79E;E;D;K;6;$classD;K;6;CP$UIDd;2;14E;K;24;_CPCibConnectorSourceKeyD;K;6;CP$UIDd;2;35E;K;29;_CPCibConnectorDestinationKeyD;K;6;CP$UIDd;1;0E;K;23;_CPCibConnectorLabelKeyD;K;6;CP$UIDd;1;0E;K;40;CPCibRuntimeAttributesConnectorObjectKeyD;K;6;CP$UIDd;2;35E;K;42;CPCibRuntimeAttributesConnectorKeyPathsKeyD;K;6;CP$UIDd;2;80E;K;40;CPCibRuntimeAttributesConnectorValuesKeyD;K;6;CP$UIDd;2;81E;E;D;K;10;$classnameS;20;CPCibOutletConnectorK;8;$classesA;S;20;CPCibOutletConnectorS;14;CPCibCLine truncated
@@ -341,8 +341,15 @@ NSString * const XCCCappuccinoProjectLastEventIDKey = @"XCCCappuccinoPro
- (void)_writeSettings
{
NSData *data = [NSPropertyListSerialization dataFromPropertyList:self->settings format:NSPropertyListXMLFormat_v1_0 errorDescription:nil];
# pragma mark -- TODO
// Error should be handled with user interaction,
// although this hasn't previously been so either.
// Immedate concern is with removing noisy deprecation warnings.
NSError* error = nil;
NSData* data = [NSPropertyListSerialization dataWithPropertyList:self->settings format:NSPropertyListBinaryFormat_v1_0 options:0 error:&error];
if(data != nil){
NSLog(@"error %ld",(long)[error code]);
}
[data writeToFile:self.settingsPath atomically:YES];
}
@@ -357,7 +364,7 @@ NSString * const XCCCappuccinoProjectLastEventIDKey = @"XCCCappuccinoPro
self->settings[XCCCappuccinoProcessObjj2ObjcSkeletonKey] = @(self.processObjj2ObjcSkeleton);
self->settings[XCCCappuccinoProcessNib2CibKey] = @(self.processNib2Cib);
self->settings[XCCCappuccinoProjectPreviousStatusKey] = [NSNumber numberWithInt:self.status];
if ([self.lastEventID boolValue])
self->settings[XCCCappuccinoProjectLastEventIDKey] = self.lastEventID;
@@ -370,8 +377,16 @@ NSString * const XCCCappuccinoProjectLastEventIDKey = @"XCCCappuccinoPro
- (void)_writeXcodeCappIgnoreFile
{
NSData *data = [NSPropertyListSerialization dataFromPropertyList:self->settings format:NSPropertyListXMLFormat_v1_0 errorDescription:nil];
# pragma TODO
// More verifiable user notification of error?
NSError *error = nil;
NSData *data = [NSPropertyListSerialization dataWithPropertyList: self->settings
format: NSPropertyListXMLFormat_v1_0
options: 0
error: &error];
if(data != nil){
NSLog(@"error %ld",(long)[error code]);
}
[data writeToFile:self.settingsPath atomically:YES];
NSFileManager *fm = [NSFileManager defaultManager];
@@ -93,15 +93,17 @@ void fsevents_callback(ConstFSEventStreamRef streamRef, void *userData, size_t n
{
[[NSApplication sharedApplication] activateIgnoringOtherApps:YES];
NSRunAlertPanel(
self.cappuccinoProject.nickname,
@"XcodeCapp was unable to find all necessary executables in your environment:\n\n"
@"%@\n\n"
@"You certainly need to change the binary paths in the project settings.",
@"OK",
nil,
nil,
[self->taskLauncher.executables componentsJoinedByString:@", "]);
NSAlert *alert = [[NSAlert alloc] init];
[alert setAlertStyle:NSAlertStyleCritical];
NSString *title = self.cappuccinoProject.nickname;
[alert setMessageText:title];
NSArray *informativeTextArray = @[
@"XcodeCapp was unable to find all necessary executables in current environment:",
@"Please confirm the following executables are in current $PATH:\n",
[self->taskLauncher.executables componentsJoinedByString:@", "]
];
[alert setInformativeText:[informativeTextArray componentsJoinedByString:@"\n"]];
[alert runModal];
[self _reinitializeProjectController];
}
@@ -155,7 +157,12 @@ void fsevents_callback(ConstFSEventStreamRef streamRef, void *userData, size_t n
if (![fm fileExistsAtPath:self.cappuccinoProject.projectPath isDirectory:nil])
{
NSRunAlertPanel(@"The project can’t be located.", @"It seems the project moved while XcodeCapp was not running.", @"Remove Project", nil, nil);
NSAlert *alert = [[NSAlert alloc] init];
[alert setAlertStyle:NSAlertStyleCritical];
[alert setMessageText:@"The project can’t be located"];
NSString *informativeText = [NSString stringWithFormat:@"The project was either moved or deleted outside of the XcodeCapp environment.\nProject will be removed."];
[alert setInformativeText:informativeText];
[alert runModal];
[self.mainXcodeCappController unmanageCappuccinoProjectController:self];
return NO;
@@ -1003,7 +1010,12 @@ void fsevents_callback(ConstFSEventStreamRef streamRef, void *userData, size_t n
- (void)_handleProjectPathChange:(NSString *)path
{
NSRunAlertPanel(self.cappuccinoProject.nickname, @"The project directory changed. This project will be removed", @"OK", nil, nil, nil);
NSAlert *alert = [[NSAlert alloc] init];
[alert setAlertStyle:NSAlertStyleCritical];
[alert setMessageText:@"The project directory changed"];
NSString *informativeText = [NSString stringWithFormat:@"This project will be removed."];
[alert setInformativeText:informativeText];
[alert runModal];
[self.mainXcodeCappController unmanageCappuccinoProjectController:self];
}
@@ -1206,15 +1218,27 @@ void fsevents_callback(ConstFSEventStreamRef streamRef, void *userData, size_t n
if (!exists || !isDirectory || !isOpened)
{
NSString *text;
NSString *projectErrorDescription;
if (!isOpened)
text = @"The project exists, but failed to open.";
projectErrorDescription = @"The project exists, but failed to open.";
else
text = [NSString stringWithFormat:@"%@ %@.", self.cappuccinoProject.XcodeProjectPath, !exists ? @"does not exist" : @"is not an Xcode project"];
projectErrorDescription = [NSString stringWithFormat:@"%@ %@.", self.cappuccinoProject.XcodeProjectPath, !exists ? @"does not exist" : @"is not an Xcode project"];
[[NSApplication sharedApplication] activateIgnoringOtherApps:YES];
NSInteger response = NSRunAlertPanel(@"The project could not be opened.", @"%@\n\nWould you like to regenerate the project?", @"Yes", @"No", nil, text);
NSAlert *alert = [[NSAlert alloc] init];
[alert setAlertStyle:NSAlertStyleCritical];
[alert setMessageText:@"The project could not be opened"];
NSArray *informativeTextArray = @[
projectErrorDescription,
@"Should the project be regenerated?"
];
NSString *informativeText = [informativeTextArray componentsJoinedByString:@"\n"];
[alert setInformativeText:informativeText];
[alert addButtonWithTitle:@"Yes"];
[alert addButtonWithTitle:@"No"];
NSInteger response = [alert runModal];
if (response == NSAlertFirstButtonReturn)
[self resetProject:self];
Loaded 100 of 109 files, more files were not shown because too many files have changed in this diff. Show more