Merge branch 'master' of github.com:cappuccino/cappuccino
No files matched your search
@@ -978,7 +978,7 @@ CPRunContinuesResponse = -1002;
|
||||
return;
|
||||
}
|
||||
|
||||
[aSheet._windowView _enableSheet:YES];
|
||||
[aSheet._windowView _enableSheet:YES inWindow:aWindow];
|
||||
|
||||
// -dw- if a sheet is already visible, we skip this since it serves no purpose and causes
|
||||
// orderOut: to be called on the sheet, which is not what we want.
|
||||
|
||||
@@ -34,9 +34,6 @@
|
||||
@import "CPPasteboard.j"
|
||||
@import "CPView.j"
|
||||
|
||||
@class CPClipView
|
||||
|
||||
|
||||
/*!
|
||||
@ingroup appkit
|
||||
@class CPCollectionView
|
||||
@@ -175,50 +172,47 @@ var HORIZONTAL_MARGIN = 2;
|
||||
|
||||
/*!
|
||||
Sets the item prototype to \c anItem
|
||||
@param anItem the new item prototype.
|
||||
|
||||
The item prototype should implement the CPCoding protocol
|
||||
because the item is copied by archiving and unarchiving the
|
||||
prototypal view.
|
||||
@note
|
||||
- If anItem is located in an external cib file, representedObject, outlets, and bindings will be automatically restored when an item is created.
|
||||
- If anItem and its view belong to the same cib as the collection view, the item prototype should implement the CPCoding protocol because the item is copied by archiving and unarchiving the prototypal view.
|
||||
@note
|
||||
Bindings won't be restored through archiving, instead you need to subclass the -representedObject: method and update the view there.
|
||||
|
||||
Example:
|
||||
@par Example:
|
||||
|
||||
<pre>
|
||||
@implement MyCustomView : CPCollectionViewItem
|
||||
{
|
||||
CPArray items @accessors;
|
||||
}
|
||||
@code
|
||||
@implementation MyCustomPrototypeItem: CPCollectionViewItem
|
||||
{
|
||||
@outlet CPTextField textField;
|
||||
}
|
||||
|
||||
- (id)initWithFrame:(CGRect)aFrame
|
||||
{
|
||||
self = [super initWithFrame:aFrame];
|
||||
if (self)
|
||||
{
|
||||
items = [];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
- (id)initWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
self = [super initWithCoder:aCoder];
|
||||
|
||||
- (id)initWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
self = [super initWithCoder:aCoder];
|
||||
items = [aCoder decodeObjectForKey:@"KEY"];
|
||||
return self;
|
||||
}
|
||||
textField = [aCoder decodeObjectForKey:@"TextField"];
|
||||
|
||||
- (void)encodeWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
[aCoder encodeObject:items forKey:@"KEY"];
|
||||
[super encodeWithCoder:aCoder];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
</pre>
|
||||
- (void)encodeWithCoder:(CPCoder)aCoder
|
||||
{
|
||||
[super encodeWithCoder:aCoder];
|
||||
[aCoder encodeConditionalObject:textField forKey:@"TextField"];
|
||||
}
|
||||
|
||||
This will allow the collection view to create multiple 'clean' copies
|
||||
of the item prototype which will maintain the original values for item
|
||||
and all of the properties archived by the super class.
|
||||
- (void)setRepresentedObject:(id)anObject
|
||||
{
|
||||
[super setRepresentedObject:anObject];
|
||||
[textField setStringValue:[anObject objectForKey:@"value"]];
|
||||
[[self view] setColor:[anObject objectForKey:@"color"]];
|
||||
}
|
||||
|
||||
@end
|
||||
@endcode
|
||||
|
||||
@param anItem the new item prototype
|
||||
*/
|
||||
- (void)setItemPrototype:(CPCollectionViewItem)anItem
|
||||
{
|
||||
@@ -1216,7 +1210,12 @@ Not supported. Use -collectionView:dataForItemsAtIndexes:fortype:
|
||||
|
||||
- (void)_modifySelectionWithNewIndex:(int)anIndex direction:(int)aDirection expand:(BOOL)shouldExpand
|
||||
{
|
||||
anIndex = MIN(MAX(anIndex, 0), [[self items] count] - 1);
|
||||
var count = [[self items] count];
|
||||
|
||||
if (count === 0)
|
||||
return;
|
||||
|
||||
anIndex = MIN(MAX(anIndex, 0), count - 1);
|
||||
|
||||
if (_allowsMultipleSelection && shouldExpand)
|
||||
{
|
||||
|
||||
@@ -221,9 +221,9 @@ var STICKY_TIME_INTERVAL = 0.4,
|
||||
|
||||
if (_lastMouseOverMenuView != mouseOverMenuView)
|
||||
{
|
||||
[mouseOverMenuView mouseExited:anEvent];
|
||||
[_lastMouseOverMenuView mouseExited:anEvent];
|
||||
// FIXME: Possibly multiple of these?
|
||||
[_lastMouseOverMenuView mouseEntered:anEvent];
|
||||
[mouseOverMenuView mouseEntered:anEvent];
|
||||
|
||||
_lastMouseOverMenuView = mouseOverMenuView;
|
||||
}
|
||||
|
||||
@@ -2319,10 +2319,8 @@ NOT YET IMPLEMENTED
|
||||
|
||||
var heightObject = _cachedRowHeights[_cachedRowHeights.length - 1],
|
||||
height = heightObject.heightAboveRow + heightObject.height + _intercellSpacing.height;
|
||||
|
||||
}
|
||||
|
||||
|
||||
if ([superview isKindOfClass:[CPClipView class]])
|
||||
{
|
||||
var superviewSize = [superview bounds].size;
|
||||
@@ -2456,7 +2454,6 @@ NOT YET IMPLEMENTED
|
||||
@"width": [column width]
|
||||
};
|
||||
|
||||
|
||||
[columnsSetup addObject:metaData];
|
||||
}
|
||||
|
||||
@@ -2498,7 +2495,7 @@ NOT YET IMPLEMENTED
|
||||
Sets the delegate of the receiver.
|
||||
@param aDelegate the delegate object for the tableview.
|
||||
|
||||
The delegate can provide easy notification for user interaction, display behaviour, contextual menus, and more.
|
||||
The delegate can provide notification for user interaction, display behaviour, contextual menus, and more.
|
||||
|
||||
|
||||
@section Providing Views for Rows and Columns:
|
||||
@@ -2520,7 +2517,7 @@ The view's properties should be properly set up before returning the result. The
|
||||
|
||||
When using bindings, this method is optional if at least one identifier has been associated with the table view at design time. If this method is not implemented, the table will automatically call the CPTableView method makeViewWithIdentifier:owner: with the tableColumn parameter’s identifier and the table view’s delegate respectively as parameters, to attempt to reuse a previous view, or automatically unarchive a prototype associated with the table view.
|
||||
|
||||
The autoresizingMask of the returned view will automatically be set to CPViewNotSizable if the data view was created in Interface builder in a table column. Otherwise, for example if the view is created manually in code, this methods expects the data view to have a CPViewNotSizable mask.
|
||||
The autoresizingMask of the returned view will automatically be set to CPViewNotSizable if the data view was created in Interface builder in a table column. Otherwise, for example if the view is created manually in code, this method expects the data view to have a CPViewNotSizable mask.
|
||||
|
||||
|
||||
@section displayingcells Displaying Cells:
|
||||
@@ -2536,8 +2533,6 @@ Group rows are a way to separate a groups of data in a tableview. Return YES if
|
||||
@endcode
|
||||
|
||||
|
||||
|
||||
|
||||
@section editingcells Editing Cells:
|
||||
|
||||
Return YES if the dataview at a given index and column should be edited, otherwise NO.
|
||||
@@ -2546,9 +2541,6 @@ Return YES if the dataview at a given index and column should be edited, otherwi
|
||||
@endcode
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@section sizes Setting Row and Column Size:
|
||||
|
||||
Return the height of the row at a given index. Only implement this if you want variable row heights. Otherwise use setRowHeight: on the tableview.
|
||||
@@ -2557,8 +2549,6 @@ Return the height of the row at a given index. Only implement this if you want v
|
||||
@endcode
|
||||
|
||||
|
||||
|
||||
|
||||
@section selection Selecting in the TableView:
|
||||
@note These methods are only called when the user does something.@endnote
|
||||
|
||||
@@ -2577,7 +2567,7 @@ Return YES if the table column given should be selected, otherwise NO to deny th
|
||||
- (BOOL)tableView:(CPTableView)aTableView shouldSelectTableColumn:(CPTableColumn)aTableColumn;
|
||||
@endcode
|
||||
|
||||
Inform the delegate that the tableview is in the process of chaining the selection.
|
||||
Informs the delegate that the tableview is in the process of chaining the selection.
|
||||
This usually happens when the user is dragging their mouse across rows.
|
||||
@code
|
||||
- (void)tableViewSelectionIsChanging:(CPNotification)aNotification
|
||||
@@ -2589,10 +2579,7 @@ Informs the delegate that the tableview selection has changed.
|
||||
@endcode
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@section movingandresizingcolumsn Moving and Resizing Columns:
|
||||
@section movingandresizingcolumns Moving and Resizing Columns:
|
||||
|
||||
Return YES if the column at a given index should move to a new column index, otherwise NO.
|
||||
@code
|
||||
@@ -2600,13 +2587,13 @@ Return YES if the column at a given index should move to a new column index, oth
|
||||
@endcode
|
||||
|
||||
|
||||
Notifies the delegate that the tableview drag occurred. This is send on mouse up.
|
||||
Notifies the delegate that the tableview drag occurred. This is sent on mouse up.
|
||||
@code
|
||||
- (void)tableView:(CPTableView)tableView didDragTableColumn:(CPTableColumn)tableColumn;
|
||||
@endcode
|
||||
|
||||
|
||||
Notifies the delegate that a tablecolumn was moved by the user.
|
||||
Notifies the delegate that a table column was moved by the user.
|
||||
@code
|
||||
- (void)tableViewColumnDidMove:(CPNotification)aNotification;
|
||||
@endcode
|
||||
@@ -2617,8 +2604,6 @@ Notifies the delegate that the user resized the table column
|
||||
@endcode
|
||||
|
||||
|
||||
|
||||
|
||||
@section mousevents Responding to Mouse Events:
|
||||
|
||||
Sent when the user clicks a table column but doesn't drag.
|
||||
@@ -2627,7 +2612,7 @@ Sent when the user clicks a table column but doesn't drag.
|
||||
@endcode
|
||||
|
||||
|
||||
Notify the delegate that the user click the table header of a column.
|
||||
Notify the delegate that the user has clicked the table header of a column.
|
||||
@code
|
||||
- (void)tableView:(CPTableView)tableView mouseDownInHeaderOfTableColumn:(CPTableColumn)tableColumn;
|
||||
@endcode
|
||||
@@ -2635,15 +2620,15 @@ Notify the delegate that the user click the table header of a column.
|
||||
|
||||
@section contextualmenus Contextual Menus:
|
||||
|
||||
Called when the user right clicks on the tableview. -1 is passed for the row or column if the user doesn't right click on a real row or column
|
||||
Return a CPMenu that should be displayed if the user right clicks. If you do not implement this the tableview will just call super on menuForEvent
|
||||
Called when the user right-clicks on the tableview. -1 is passed for the row or column if the user doesn't right click on a real row or column
|
||||
Return a CPMenu that should be displayed if the user right-clicks. If you do not implement this the tableview will call super on menuForEvent
|
||||
@code
|
||||
- (CPMenu)tableView:(CPTableView)aTableView menuForTableColumn:(CPTableColumn)aColumn row:(int)aRow;
|
||||
@endcode
|
||||
|
||||
|
||||
@section deletekey Delete Key
|
||||
Called when the user presses the delete key. Many times you will want to delete data (or prompt for deletion) when the user hids the delete key.
|
||||
Called when the user presses the delete key. Many times you will want to delete data (or prompt for deletion) when the user presses the delete key.
|
||||
Your delegate can implement this method to avoid subclassing the tableview to add this behaviour.
|
||||
|
||||
@code
|
||||
@@ -3120,7 +3105,6 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
||||
[[CPException exceptionWithName:@"Error" reason:reason userInfo:nil] raise];
|
||||
}
|
||||
|
||||
|
||||
_retargetedDropRow = row;
|
||||
_retargetedDropOperation = operation;
|
||||
}
|
||||
@@ -3307,7 +3291,6 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
||||
// there are multiple views in the clip view?
|
||||
if ([superview isKindOfClass:[CPClipView class]])
|
||||
_exposedRect = [superview bounds];
|
||||
|
||||
else
|
||||
_exposedRect = [self bounds];
|
||||
}
|
||||
@@ -3555,7 +3538,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
||||
if (_contentBindingExpicitelySet)
|
||||
[self _prepareContentBindedDataView:aDataView forRow:aRow];
|
||||
else
|
||||
// For both cell-based and view-based
|
||||
// For both cell-based and view-based
|
||||
[aTableColumn _prepareDataView:aDataView forRow:aRow];
|
||||
}
|
||||
|
||||
@@ -4374,7 +4357,6 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
||||
else
|
||||
_selectionAnchorRow = row;
|
||||
|
||||
|
||||
//set ivars for startTrackingPoint and time...
|
||||
_startTrackingPoint = aPoint;
|
||||
_startTrackingTimestamp = new Date();
|
||||
@@ -4440,7 +4422,6 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
||||
else
|
||||
_draggedRowIndexes = [CPIndexSet indexSetWithIndex:row];
|
||||
|
||||
|
||||
//ask the datasource for the data
|
||||
var pboard = [CPPasteboard pasteboardWithName:CPDragPboard];
|
||||
|
||||
@@ -4647,7 +4628,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
||||
var row = [self _proposedRowAtPoint:theDragPoint],
|
||||
rowRect = [self rectOfRow:row];
|
||||
|
||||
// If there is no (the default) or to little inter cell spacing we create some room for the CPTableViewDropAbove indicator
|
||||
// If there is no (the default) or too little inter-cell spacing we create some room for the CPTableViewDropAbove indicator
|
||||
// This probably doesn't work if the row height is smaller than or around 5.0
|
||||
if ([self intercellSpacing].height < 5.0)
|
||||
rowRect = CGRectInset(rowRect, 0.0, 5.0 - [self intercellSpacing].height);
|
||||
@@ -4667,7 +4648,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
||||
- (CPInteger)_proposedRowAtPoint:(CGPoint)dragPoint
|
||||
{
|
||||
var row = [self rowAtPoint:dragPoint],
|
||||
// Determine if the mouse is currently closer to this row or the row below it
|
||||
// Determine if the mouse is currently closer to this row or the row below it
|
||||
lowerRow = row + 1,
|
||||
rect = [self rectOfRow:row],
|
||||
bottomPoint = _CGRectGetMaxY(rect),
|
||||
@@ -4766,7 +4747,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
||||
- (BOOL)prepareForDragOperation:(id)sender
|
||||
{
|
||||
// FIX ME: is there anything else that needs to happen here?
|
||||
// actual validation is called in dragginUpdated:
|
||||
// actual validation is called in draggingUpdated:
|
||||
[_dropOperationFeedbackView removeFromSuperview];
|
||||
|
||||
return (_implementedDataSourceMethods & CPTableViewDataSource_tableView_validateDrop_proposedRow_proposedDropOperation_);
|
||||
@@ -5003,7 +4984,8 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
||||
|
||||
- (void)_textFieldEditingDidEnd:(CPNotification)aNote
|
||||
{
|
||||
// FIXME: When you edit a text field and hit enter without any text mofification, the CPControlTextDidEndEditingNotification is NOT sent. This is a bug in CPTextField or CPControl according to cocoa.
|
||||
// FIXME: When you edit a text field and hit enter without any text modification, the CPControlTextDidEndEditingNotification
|
||||
// is NOT sent. This is a bug in CPTextField or CPControl according to cocoa.
|
||||
var textField = [aNote object];
|
||||
|
||||
[self _unregisterForEndEditingNote:textField];
|
||||
@@ -5016,7 +4998,8 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
||||
|
||||
- (SEL)_disableActionIfExists:(CPView)aView
|
||||
{
|
||||
// TODO: We disable action to prevent it from beeing sent twice when we resign the FR inside a textEndEditing notification. Check if this is due to a bug in CPTextField.
|
||||
// TODO: We disable action to prevent it from beeing sent twice when we resign the FR inside a textEndEditing notification.
|
||||
// Check if this is due to a bug in CPTextField.
|
||||
var action = nil;
|
||||
if ([aView respondsToSelector:@selector(action)] && (action = [aView action]))
|
||||
[aView setAction:nil];
|
||||
@@ -5111,7 +5094,6 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
||||
if (i >= [self numberOfRows] || i < 0)
|
||||
return;
|
||||
|
||||
|
||||
if (_implementedDelegateMethods & CPTableViewDelegate_tableView_shouldSelectRow_)
|
||||
{
|
||||
|
||||
@@ -5165,6 +5147,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation CPTableView (Bindings)
|
||||
|
||||
+ (id)_binderClassForBinding:(CPString)aBinding
|
||||
@@ -5218,6 +5201,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation CPTableContentBinder : CPBinder
|
||||
{
|
||||
id _content @accessors(property=content);
|
||||
@@ -5235,6 +5219,7 @@ Your delegate can implement this method to avoid subclassing the tableview to ad
|
||||
|
||||
@end
|
||||
|
||||
|
||||
var CPTableViewDataSourceKey = @"CPTableViewDataSourceKey",
|
||||
CPTableViewDelegateKey = @"CPTableViewDelegateKey",
|
||||
CPTableViewHeaderViewKey = @"CPTableViewHeaderViewKey",
|
||||
@@ -5351,6 +5336,7 @@ var CPTableViewDataSourceKey = @"CPTableViewDataSourceKey",
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation CPIndexSet (tableview)
|
||||
|
||||
- (void)removeMatches:(CPIndexSet)otherSet
|
||||
@@ -5481,6 +5467,7 @@ var CPTableViewDataSourceKey = @"CPTableViewDataSourceKey",
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation _CPColumnDragView : CPView
|
||||
{
|
||||
CPColor _lineColor;
|
||||
@@ -5519,6 +5506,7 @@ var CPTableViewDataSourceKey = @"CPTableViewDataSourceKey",
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation CPTableCellView : CPView
|
||||
{
|
||||
id _objectValue @accessors(property=objectValue);
|
||||
|
||||
@@ -1188,20 +1188,28 @@ var CPViewFlags = { },
|
||||
|
||||
var frame = _superview._frame,
|
||||
newFrame = _CGRectMakeCopy(_frame),
|
||||
dX = (_CGRectGetWidth(frame) - aSize.width) /
|
||||
(((mask & CPViewMinXMargin) ? 1 : 0) + (mask & CPViewWidthSizable ? 1 : 0) + (mask & CPViewMaxXMargin ? 1 : 0)),
|
||||
dY = (_CGRectGetHeight(frame) - aSize.height) /
|
||||
((mask & CPViewMinYMargin ? 1 : 0) + (mask & CPViewHeightSizable ? 1 : 0) + (mask & CPViewMaxYMargin ? 1 : 0));
|
||||
dX = frame.size.width - aSize.width,
|
||||
dY = frame.size.height - aSize.height,
|
||||
evenFractionX = 1.0 / ((mask & CPViewMinXMargin ? 1 : 0) + (mask & CPViewWidthSizable ? 1 : 0) + (mask & CPViewMaxXMargin ? 1 : 0)),
|
||||
evenFractionY = 1.0 / ((mask & CPViewMinYMargin ? 1 : 0) + (mask & CPViewHeightSizable ? 1 : 0) + (mask & CPViewMaxYMargin ? 1 : 0)),
|
||||
baseX = (mask & CPViewMinXMargin ? _frame.origin.x : 0) +
|
||||
(mask & CPViewWidthSizable ? _frame.size.width : 0) +
|
||||
(mask & CPViewMaxXMargin ? aSize.width - _frame.size.width - _frame.origin.x : 0),
|
||||
baseY = (mask & CPViewMinYMargin ? _frame.origin.y : 0) +
|
||||
(mask & CPViewHeightSizable ? _frame.size.height : 0) +
|
||||
(mask & CPViewMaxYMargin ? aSize.height - _frame.size.height - _frame.origin.y : 0);
|
||||
|
||||
if (mask & CPViewMinXMargin)
|
||||
newFrame.origin.x += dX;
|
||||
newFrame.origin.x += dX * (baseX > 0 ? _frame.origin.x / baseX : evenFractionX);
|
||||
|
||||
if (mask & CPViewWidthSizable)
|
||||
newFrame.size.width += dX;
|
||||
newFrame.size.width += dX * (baseX > 0 ? _frame.size.width / baseX : evenFractionX);
|
||||
|
||||
if (mask & CPViewMinYMargin)
|
||||
newFrame.origin.y += dY;
|
||||
newFrame.origin.y += dY * (baseY > 0 ? _frame.origin.y / baseY : evenFractionY);
|
||||
|
||||
if (mask & CPViewHeightSizable)
|
||||
newFrame.size.height += dY;
|
||||
newFrame.size.height += dY * (baseY > 0 ? _frame.size.height / baseY : evenFractionY);
|
||||
|
||||
[self setFrame:newFrame];
|
||||
}
|
||||
@@ -1986,9 +1994,6 @@ setFrameOrigin:
|
||||
return;
|
||||
|
||||
_postsFrameChangedNotifications = shouldPostFrameChangedNotifications;
|
||||
|
||||
if (_postsFrameChangedNotifications)
|
||||
[CachedNotificationCenter postNotificationName:CPViewFrameDidChangeNotification object:self];
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -2019,9 +2024,6 @@ setBoundsOrigin:
|
||||
return;
|
||||
|
||||
_postsBoundsChangedNotifications = shouldPostBoundsChangedNotifications;
|
||||
|
||||
if (_postsBoundsChangedNotifications)
|
||||
[CachedNotificationCenter postNotificationName:CPViewBoundsDidChangeNotification object:self];
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -2557,7 +2559,7 @@ setBoundsOrigin:
|
||||
|
||||
- (void)_setPreviousKeyView:(CPView)previous
|
||||
{
|
||||
if ([previous isEqual:self] || ![[previous window] isEqual:[self window]])
|
||||
if ([previous isEqual:self])
|
||||
_previousKeyView = nil;
|
||||
else
|
||||
_previousKeyView = previous;
|
||||
@@ -2565,7 +2567,7 @@ setBoundsOrigin:
|
||||
|
||||
- (void)setNextKeyView:(CPView)next
|
||||
{
|
||||
if ([next isEqual:self] || ![[next window] isEqual:[self window]])
|
||||
if ([next isEqual:self])
|
||||
_nextKeyView = nil;
|
||||
else
|
||||
{
|
||||
|
||||
@@ -1169,7 +1169,7 @@ CPTexturedBackgroundWindowMask
|
||||
|
||||
if (_hasShadow && !_shadowView)
|
||||
{
|
||||
_shadowView = [[_CPShadowWindowView alloc] initWithFrame:CGRectMakeZero()];
|
||||
_shadowView = [[_CPShadowWindowView alloc] initWithFrame:CGRectMakeZero()];
|
||||
|
||||
[_shadowView setWindowView:_windowView];
|
||||
[_shadowView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable];
|
||||
@@ -2473,7 +2473,6 @@ CPTexturedBackgroundWindowMask
|
||||
return CPWindowResizeTime;
|
||||
}
|
||||
|
||||
/* @ignore */
|
||||
- (void)_setAttachedSheetFrameOrigin
|
||||
{
|
||||
// Position the sheet above the contentRect.
|
||||
@@ -2487,7 +2486,7 @@ CPTexturedBackgroundWindowMask
|
||||
[attachedSheet setFrame:sheetFrame display:YES animate:NO];
|
||||
}
|
||||
|
||||
/* @ignore
|
||||
/*
|
||||
Starting point for sheet session, called from CPApplication beginSheet:
|
||||
*/
|
||||
- (void)_attachSheet:(CPWindow)aSheet modalDelegate:(id)aModalDelegate
|
||||
@@ -2503,13 +2502,13 @@ CPTexturedBackgroundWindowMask
|
||||
var sheetFrame = [aSheet frame];
|
||||
|
||||
_sheetContext = {"sheet": aSheet, "modalDelegate": aModalDelegate, "endSelector": aDidEndSelector,
|
||||
"contextInfo": aContextInfo, "frame": _CGRectMakeCopy(sheetFrame), "returnCode": -1,
|
||||
"contextInfo": aContextInfo, "returnCode": -1,
|
||||
"opened": NO};
|
||||
|
||||
[self _attachSheetWindow];
|
||||
}
|
||||
|
||||
/* @ignore
|
||||
/*
|
||||
Called to animate the sheet in. The timer seems to solve a bug where sheets would
|
||||
be partially animated under certain conditions.
|
||||
*/
|
||||
@@ -2525,7 +2524,7 @@ CPTexturedBackgroundWindowMask
|
||||
repeats:NO];
|
||||
}
|
||||
|
||||
/* @ignore
|
||||
/*
|
||||
Called to end the sheet. Note that orderOut: is needed to animate the sheet out, as in Cocoa.
|
||||
The sheet isn't completely gone until _cleanupSheetWindow gets called.
|
||||
*/
|
||||
@@ -2546,7 +2545,7 @@ CPTexturedBackgroundWindowMask
|
||||
}
|
||||
}
|
||||
|
||||
/* @ignore
|
||||
/*
|
||||
Called to animate the sheet out. If called while animating in, schedules an animate
|
||||
out at completion
|
||||
*/
|
||||
@@ -2562,27 +2561,25 @@ CPTexturedBackgroundWindowMask
|
||||
repeats:NO];
|
||||
}
|
||||
|
||||
/* @ignore
|
||||
/*
|
||||
Called to cleanup sheet, when we are definitely done with it
|
||||
*/
|
||||
- (void)_cleanupSheetWindow
|
||||
{
|
||||
var sheet = _sheetContext["sheet"],
|
||||
lastFrame = _sheetContext["frame"],
|
||||
deferDidEnd = _sheetContext["deferDidEndSelector"];
|
||||
|
||||
[sheet setFrame:lastFrame];
|
||||
[self _restoreMasksForView:[sheet contentView]];
|
||||
|
||||
// if the parent window is modal, the sheet started its own modal session
|
||||
// If the parent window is modal, the sheet started its own modal session
|
||||
if (sheet._isModal)
|
||||
[CPApp stopModal];
|
||||
|
||||
// restore the state of window before it was sheetified
|
||||
[sheet._windowView _enableSheet:NO];
|
||||
[self _removeClipForSheet:sheet];
|
||||
|
||||
// close it
|
||||
// Restore the state of window before it was sheetified
|
||||
sheet._isSheet = NO;
|
||||
[sheet._windowView _enableSheet:NO inWindow:self];
|
||||
|
||||
// Close it
|
||||
[sheet orderOut:self];
|
||||
|
||||
[[CPNotificationCenter defaultCenter] postNotificationName:CPWindowDidEndSheetNotification object:self];
|
||||
@@ -2594,7 +2591,7 @@ CPTexturedBackgroundWindowMask
|
||||
returnCode = _sheetContext["returnCode"],
|
||||
contextInfo = _sheetContext["contextInfo"];
|
||||
|
||||
// context must be destroyed, since didEnd might want to attach another sheet
|
||||
// Context must be destroyed, since didEnd might want to attach another sheet
|
||||
_sheetContext = nil;
|
||||
sheet._parentView = nil;
|
||||
|
||||
@@ -2622,31 +2619,20 @@ CPTexturedBackgroundWindowMask
|
||||
repeats:NO];
|
||||
}
|
||||
|
||||
/* @ignore */
|
||||
- (void)_sheetShouldAnimateIn:(CPTimer)timer
|
||||
{
|
||||
// can't open sheet while opening or closing animation is going on
|
||||
// Can't open sheet while opening or closing animation is going on
|
||||
if (_sheetContext["isOpening"] ||
|
||||
_sheetContext["isClosing"])
|
||||
return;
|
||||
|
||||
var sheet = _sheetContext["sheet"],
|
||||
sheetFrame = [sheet frame],
|
||||
frame = [self frame];
|
||||
|
||||
[self _setUpMasksForView:[sheet contentView]];
|
||||
|
||||
var sheet = _sheetContext["sheet"];
|
||||
sheet._isSheet = YES;
|
||||
sheet._parentView = self;
|
||||
|
||||
var originx = frame.origin.x + FLOOR((frame.size.width - sheetFrame.size.width) / 2),
|
||||
originy = frame.origin.y + [_contentView frame].origin.y,
|
||||
startFrame = _CGRectMake(originx, originy, sheetFrame.size.width, 0),
|
||||
endFrame = _CGRectMake(originx, originy, sheetFrame.size.width, sheetFrame.size.height);
|
||||
|
||||
[[CPNotificationCenter defaultCenter] postNotificationName:CPWindowWillBeginSheetNotification object:self];
|
||||
|
||||
// if sheet is attached to a modal window, the sheet runs
|
||||
// If sheet is attached to a modal window, the sheet runs
|
||||
// as if itself and the parent window are modal
|
||||
sheet._isModal = NO;
|
||||
|
||||
@@ -2656,7 +2642,18 @@ CPTexturedBackgroundWindowMask
|
||||
sheet._isModal = YES;
|
||||
}
|
||||
|
||||
// The sheet starts hidden just above the top of a clip rect
|
||||
var sheetFrame = [sheet frame],
|
||||
sheetShadowFrame = sheet._hasShadow ? [sheet._shadowView frame] : sheetFrame,
|
||||
frame = [self frame],
|
||||
originX = frame.origin.x + FLOOR((frame.size.width - sheetFrame.size.width) / 2),
|
||||
startFrame = _CGRectMake(originX, -sheetShadowFrame.size.height, sheetFrame.size.width, sheetFrame.size.height),
|
||||
endY = [_windowView bodyOffset] - [[self contentView] frame].origin.y,
|
||||
endFrame = _CGRectMake(originX, endY, sheetFrame.size.width, sheetFrame.size.height);
|
||||
|
||||
[sheet orderFront:self];
|
||||
|
||||
[self _clipSheet:sheet];
|
||||
[sheet setFrame:startFrame display:YES animate:NO];
|
||||
|
||||
_sheetContext["opened"] = YES;
|
||||
@@ -2671,16 +2668,11 @@ CPTexturedBackgroundWindowMask
|
||||
[sheet makeKeyWindow];
|
||||
}
|
||||
|
||||
/* @ignore */
|
||||
- (void)_sheetShouldAnimateOut:(CPTimer)timer
|
||||
{
|
||||
var sheet = _sheetContext["sheet"],
|
||||
startFrame = [sheet frame],
|
||||
endFrame = _CGRectMakeCopy(startFrame);
|
||||
|
||||
if (_sheetContext["isOpening"])
|
||||
{
|
||||
// allow sheet to be closed while opening, it will close when animate in completes
|
||||
// Allow sheet to be closed while opening, it will close when animate in completes
|
||||
_sheetContext["shouldClose"] = YES;
|
||||
return;
|
||||
}
|
||||
@@ -2689,14 +2681,21 @@ CPTexturedBackgroundWindowMask
|
||||
return;
|
||||
|
||||
_sheetContext["opened"] = NO;
|
||||
_sheetContext["frame"] = startFrame;
|
||||
_sheetContext["isClosing"] = YES;
|
||||
|
||||
// the parent window can be orderedOut to disable the sheet animate out, as in Cocoa
|
||||
// The parent window can be orderedOut to disable the sheet animate out, as in Cocoa
|
||||
if ([self isVisible])
|
||||
{
|
||||
endFrame.size.height = 0;
|
||||
[self _setUpMasksForView:[sheet contentView]];
|
||||
var sheet = _sheetContext["sheet"],
|
||||
sheetFrame = [sheet frame],
|
||||
fullHeight = sheet._hasShadow ? [sheet._shadowView frame].size.height : sheetFrame.size.height,
|
||||
endFrame = _CGRectMakeCopy(sheetFrame),
|
||||
contentOrigin = [self convertBaseToGlobal:[[self contentView] frame].origin];
|
||||
|
||||
[sheet setFrameOrigin:_CGPointMake(sheetFrame.origin.x, sheetFrame.origin.y - contentOrigin.y)];
|
||||
[self _clipSheet:sheet];
|
||||
|
||||
endFrame.origin.y = -fullHeight;
|
||||
[sheet _setFrame:endFrame delegate:self duration:[self animationResizeTime:endFrame] curve:CPAnimationEaseIn];
|
||||
}
|
||||
else
|
||||
@@ -2705,7 +2704,6 @@ CPTexturedBackgroundWindowMask
|
||||
}
|
||||
}
|
||||
|
||||
/* @ignore */
|
||||
- (void)_sheetAnimationDidEnd:(CPTimer)timer
|
||||
{
|
||||
var sheet = _sheetContext["sheet"];
|
||||
@@ -2715,12 +2713,17 @@ CPTexturedBackgroundWindowMask
|
||||
|
||||
if (_sheetContext["opened"] === YES)
|
||||
{
|
||||
// sheet is open and completely visible
|
||||
[self _restoreMasksForView:[sheet contentView]];
|
||||
|
||||
// we wanted to close the sheet while it animated in, do that now
|
||||
if (_sheetContext["shouldClose"] === YES)
|
||||
[self _detachSheetWindow];
|
||||
else
|
||||
{
|
||||
var sheetFrame = [sheet frame],
|
||||
sheetOrigin = _CGPointMakeCopy(sheetFrame.origin);
|
||||
|
||||
[self _removeClipForSheet:sheet];
|
||||
[sheet setFrameOrigin:_CGPointMake(sheetOrigin.x, [sheet frame].origin.y + sheetOrigin.y)];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2729,36 +2732,17 @@ CPTexturedBackgroundWindowMask
|
||||
}
|
||||
}
|
||||
|
||||
- (void)_setUpMasksForView:(CPView)aView
|
||||
- (void)_clipSheet:(CPWindow)aSheet
|
||||
{
|
||||
var views = [aView subviews];
|
||||
var clipRect = [_platformWindow contentBounds];
|
||||
clipRect.origin.y = [self frame].origin.y + [[self contentView] frame].origin.y;
|
||||
|
||||
[views addObject:aView];
|
||||
|
||||
for (var i = 0, count = [views count]; i < count; i++)
|
||||
{
|
||||
var view = [views objectAtIndex:i],
|
||||
mask = [view autoresizingMask],
|
||||
maskToAdd = (mask & CPViewMinYMargin) ? 128 : CPViewMinYMargin;
|
||||
|
||||
[view setAutoresizingMask:(mask | maskToAdd)];
|
||||
}
|
||||
[[_platformWindow layerAtLevel:_level create:NO] clipWindow:aSheet toRect:clipRect];
|
||||
}
|
||||
|
||||
- (void)_restoreMasksForView:(CPView)aView
|
||||
- (void)_removeClipForSheet:(CPWindow)aSheet
|
||||
{
|
||||
var views = [aView subviews];
|
||||
|
||||
[views addObject:aView];
|
||||
|
||||
for (var i = 0, count = [views count]; i < count; i++)
|
||||
{
|
||||
var view = [views objectAtIndex:i],
|
||||
mask = [view autoresizingMask],
|
||||
maskToRemove = (mask & 128) ? 128 : CPViewMinYMargin;
|
||||
|
||||
[view setAutoresizingMask:(mask & (~ maskToRemove))];
|
||||
}
|
||||
[[_platformWindow layerAtLevel:_level create:NO] removeClipForWindow:aSheet];
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -3175,7 +3159,7 @@ var keyViewComparator = function(lhs, rhs, context)
|
||||
if ([self isFullPlatformWindow])
|
||||
return [self setFrame:[_platformWindow visibleFrame]];
|
||||
|
||||
if (_autoresizingMask == CPWindowNotSizable)
|
||||
if (_autoresizingMask === CPWindowNotSizable)
|
||||
return;
|
||||
|
||||
var frame = [_platformWindow contentBounds],
|
||||
@@ -3187,11 +3171,13 @@ var keyViewComparator = function(lhs, rhs, context)
|
||||
|
||||
if (_autoresizingMask & CPWindowMinXMargin)
|
||||
newFrame.origin.x += dX;
|
||||
|
||||
if (_autoresizingMask & CPWindowWidthSizable)
|
||||
newFrame.size.width += dX;
|
||||
|
||||
if (_autoresizingMask & CPWindowMinYMargin)
|
||||
newFrame.origin.y += dY;
|
||||
|
||||
if (_autoresizingMask & CPWindowHeightSizable)
|
||||
newFrame.size.height += dY;
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@
|
||||
@implementation _CPDocModalWindowView : _CPWindowView
|
||||
{
|
||||
CPView _bodyView;
|
||||
CPView _shadowView;
|
||||
}
|
||||
|
||||
+ (CPString)defaultThemeClass
|
||||
@@ -38,7 +37,7 @@
|
||||
{
|
||||
return @{
|
||||
@"body-color": [CPColor whiteColor],
|
||||
@"height-shadow": 8,
|
||||
@"shadow-height": 8,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -61,17 +60,13 @@
|
||||
{
|
||||
var bounds = [self bounds];
|
||||
|
||||
_bodyView = [[CPView alloc] initWithFrame:_CGRectMake(0.0, 0.0, _CGRectGetWidth(bounds), _CGRectGetHeight(bounds))];
|
||||
_bodyView = [[CPView alloc] initWithFrame:_CGRectMake(0.0, 0.0, _CGRectGetWidth(bounds), _CGRectGetHeight(bounds))];
|
||||
|
||||
[_bodyView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable];
|
||||
[_bodyView setHitTests:NO];
|
||||
|
||||
[self addSubview:_bodyView];
|
||||
|
||||
_shadowView = [[CPView alloc] initWithFrame:CGRectMake(0, 0, _CGRectGetWidth(bounds), [self valueForThemeAttribute:@"height-shadow"])];
|
||||
[_shadowView setAutoresizingMask:CPViewWidthSizable];
|
||||
[self addSubview:_shadowView];
|
||||
}
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
@@ -86,11 +81,6 @@
|
||||
return [[self class] frameRectForContentRect:aContentRect];
|
||||
}
|
||||
|
||||
- (void)_enableSheet:(BOOL)enable
|
||||
{
|
||||
// do nothing, already a sheet
|
||||
}
|
||||
|
||||
- (void)layoutSubviews
|
||||
{
|
||||
[super layoutSubviews];
|
||||
@@ -98,9 +88,11 @@
|
||||
var bounds = [self bounds];
|
||||
|
||||
[_bodyView setBackgroundColor:[self valueForThemeAttribute:@"body-color"]];
|
||||
}
|
||||
|
||||
[_shadowView setFrame:CGRectMake(0,0, _CGRectGetWidth(bounds), [self valueForThemeAttribute:@"height-shadow"])];
|
||||
[_shadowView setBackgroundColor:[self valueForThemeAttribute:@"attached-sheet-shadow-color"]];
|
||||
- (int)bodyOffset
|
||||
{
|
||||
return [_bodyView frame].origin.y;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@@ -149,9 +149,9 @@
|
||||
[[theWindow contentView] setFrame:contentRect];
|
||||
}
|
||||
|
||||
- (void)_enableSheet:(BOOL)enable
|
||||
- (void)_enableSheet:(BOOL)enable inWindow:(CPWindow)parentWindow
|
||||
{
|
||||
[super _enableSheet:enable];
|
||||
// No need to call super, it just deals with the shadow view, which we don't want
|
||||
|
||||
[_closeButton setHidden:enable];
|
||||
[_titleField setHidden:enable];
|
||||
@@ -173,6 +173,8 @@
|
||||
[self tile];
|
||||
[theWindow setFrame:frame display:NO animate:NO];
|
||||
[theWindow setMovableByWindowBackground:!enable];
|
||||
|
||||
[self setNeedsLayout];
|
||||
}
|
||||
|
||||
- (void)layoutSubviews
|
||||
|
||||
@@ -130,7 +130,6 @@ var _CPStandardWindowViewDividerViewHeight = 1.0;
|
||||
The top coordinate has already been adjusted by _CPTitleableWindowView.
|
||||
*/
|
||||
var contentRect = [super contentRectForFrameRect:aFrameRect];
|
||||
|
||||
contentRect.origin.x += 1;
|
||||
contentRect.size.width -= 2;
|
||||
contentRect.size.height -= 1;
|
||||
@@ -165,7 +164,7 @@ var _CPStandardWindowViewDividerViewHeight = 1.0;
|
||||
|
||||
[self addSubview:_dividerView];
|
||||
|
||||
var y = _CGRectGetMaxY([_dividerView frame]);
|
||||
var y = _CGRectGetMinY([_dividerView frame]);
|
||||
|
||||
_bodyView = [[CPView alloc] initWithFrame:_CGRectMake(0.0, y, _CGRectGetWidth(bounds), _CGRectGetHeight(bounds) - y)];
|
||||
|
||||
@@ -226,18 +225,15 @@ var _CPStandardWindowViewDividerViewHeight = 1.0;
|
||||
headHeight = [self toolbarMaxY];
|
||||
|
||||
[_headView setFrameSize:_CGSizeMake(width, headHeight)];
|
||||
[_dividerView setFrame:_CGRectMake(0.0, headHeight, width, 1.0)];
|
||||
[_dividerView setFrame:_CGRectMake(0.0, headHeight, width, _CPStandardWindowViewDividerViewHeight)];
|
||||
|
||||
var dividerMaxY = 0,
|
||||
dividerMinY = 0;
|
||||
var dividerMinY = 0,
|
||||
dividerFrame = [_dividerView frame];
|
||||
|
||||
if (![_dividerView isHidden])
|
||||
{
|
||||
dividerMinY = _CGRectGetMinY([_dividerView frame]);
|
||||
dividerMaxY = _CGRectGetMaxY([_dividerView frame]);
|
||||
}
|
||||
dividerMinY = _CGRectGetMinY(dividerFrame);
|
||||
|
||||
[_bodyView setFrame:_CGRectMake(0.0, dividerMaxY, width, _CGRectGetHeight(bounds) - dividerMaxY)];
|
||||
[_bodyView setFrame:_CGRectMake(0.0, dividerMinY, width, _CGRectGetHeight(bounds) - dividerMinY)];
|
||||
|
||||
var leftOffset = 8;
|
||||
|
||||
@@ -248,9 +244,8 @@ var _CPStandardWindowViewDividerViewHeight = 1.0;
|
||||
|
||||
[_titleField setFrame:_CGRectMake(leftOffset, 0, width - leftOffset * 2.0, [self valueForThemeAttribute:@"title-bar-height"])];
|
||||
|
||||
var contentRect = _CGRectMake(0.0, dividerMaxY, width, _CGRectGetHeight([_bodyView frame]));
|
||||
|
||||
[[theWindow contentView] setFrame:contentRect];
|
||||
var contentFrame = [_bodyView frame];
|
||||
[[theWindow contentView] setFrame:_CGRectInset(contentFrame, 1.0, 1.0)];
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -313,9 +308,9 @@ var _CPStandardWindowViewDividerViewHeight = 1.0;
|
||||
return [super couldBeMoveEvent:anEvent];
|
||||
}
|
||||
|
||||
- (void)_enableSheet:(BOOL)enable
|
||||
- (void)_enableSheet:(BOOL)enable inWindow:(CPWindow)parentWindow
|
||||
{
|
||||
[super _enableSheet:enable];
|
||||
[super _enableSheet:enable inWindow:parentWindow];
|
||||
|
||||
[_headView setHidden:enable];
|
||||
[_dividerView setHidden:enable];
|
||||
@@ -324,22 +319,29 @@ var _CPStandardWindowViewDividerViewHeight = 1.0;
|
||||
[_titleField setHidden:enable];
|
||||
|
||||
if (enable)
|
||||
{
|
||||
[_bodyView setBackgroundColor:[[CPTheme defaultTheme] valueForAttributeWithName:@"body-color" forClass:_CPDocModalWindowView]];
|
||||
|
||||
// Move the shadow view down so it is inside the content border
|
||||
var shadowFrame = [_sheetShadowView frame];
|
||||
[_sheetShadowView setFrameOrigin:_CGPointMake(shadowFrame.origin.x, shadowFrame.origin.y + 1)];
|
||||
}
|
||||
else
|
||||
[_bodyView setBackgroundColor:[self valueForThemeAttribute:@"body-color"]];
|
||||
|
||||
// resize the window
|
||||
var theWindow = [self window],
|
||||
frame = [theWindow frame],
|
||||
dividerHeight = [_dividerView frame].size.height,
|
||||
dy;
|
||||
|
||||
if (enable)
|
||||
dy = -(_CGRectGetHeight([_headView frame]) + _CGRectGetHeight([_dividerView frame]));
|
||||
dy = -[_headView frame].size.height;
|
||||
else
|
||||
dy = [self toolbarMaxY] + 1.0;
|
||||
dy = [self toolbarMaxY] + dividerHeight;
|
||||
|
||||
var newHeight = _CGRectGetMaxY(frame) + dy,
|
||||
newWidth = _CGRectGetMaxX(frame);
|
||||
var newHeight = _CGRectGetHeight(frame) + dy,
|
||||
newWidth = _CGRectGetWidth(frame);
|
||||
|
||||
frame.size.height += dy;
|
||||
|
||||
@@ -380,4 +382,9 @@ var _CPStandardWindowViewDividerViewHeight = 1.0;
|
||||
return size;
|
||||
}
|
||||
|
||||
- (int)bodyOffset
|
||||
{
|
||||
return [_bodyView frame].origin.y;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -121,4 +121,9 @@
|
||||
return size;
|
||||
}
|
||||
|
||||
- (int)bodyOffset
|
||||
{
|
||||
return [self contentRectForFrameRect:[self frame]].origin.y;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -91,6 +91,7 @@ _CPWindowViewResizeSlop = 3;
|
||||
@"size-indicator": CGSizeMakeZero(),
|
||||
@"resize-indicator": [CPNull null],
|
||||
@"attached-sheet-shadow-color": [CPColor blackColor],
|
||||
@"shadow-height": 8,
|
||||
@"close-image-origin": [CPNull null],
|
||||
@"close-image-size": [CPNull null],
|
||||
@"close-image": [CPNull null],
|
||||
@@ -245,6 +246,8 @@ _CPWindowViewResizeSlop = 3;
|
||||
rects are the same size. So to save calculations, we can just create
|
||||
3 rects and move them around to do hit testing. Start with the corners
|
||||
and then do left/right and top/bottom.
|
||||
|
||||
NOTE: If the window is a sheet, the top is never eligible for resizing.
|
||||
*/
|
||||
var wind = [self window],
|
||||
frame = [wind frame],
|
||||
@@ -252,7 +255,8 @@ _CPWindowViewResizeSlop = 3;
|
||||
minSize = [wind minSize],
|
||||
maxSize = [wind maxSize],
|
||||
isFixedWidth = minSize.width === maxSize.width,
|
||||
isFixedHeight = minSize.height === maxSize.height;
|
||||
isFixedHeight = minSize.height === maxSize.height,
|
||||
isSheet = wind._isSheet;
|
||||
|
||||
if (isFixedWidth)
|
||||
{
|
||||
@@ -262,7 +266,7 @@ _CPWindowViewResizeSlop = 3;
|
||||
_CPWindowViewResizeSlop * 2);
|
||||
|
||||
if (_CGRectContainsPoint(rect, aPoint))
|
||||
return _CPWindowViewResizeRegionTop;
|
||||
return isSheet ? _CPWindowViewResizeRegionNone : _CPWindowViewResizeRegionTop;
|
||||
|
||||
rect.origin.y = _CGRectGetMaxY(frame) - _CPWindowViewResizeSlop;
|
||||
|
||||
@@ -292,12 +296,12 @@ _CPWindowViewResizeSlop = 3;
|
||||
_CPWindowViewCornerResizeRectWidth + _CPWindowViewResizeSlop);
|
||||
|
||||
if (_CGRectContainsPoint(rect, aPoint))
|
||||
return _CPWindowViewResizeRegionTopLeft;
|
||||
return isSheet ? _CPWindowViewResizeRegionNone : _CPWindowViewResizeRegionTopLeft;
|
||||
|
||||
rect.origin.x = _CGRectGetMaxX(frame) - _CPWindowViewCornerResizeRectWidth;
|
||||
|
||||
if (_CGRectContainsPoint(rect, aPoint))
|
||||
return _CPWindowViewResizeRegionTopRight;
|
||||
return isSheet ? _CPWindowViewResizeRegionNone : _CPWindowViewResizeRegionTopRight;
|
||||
|
||||
rect.origin.y = _CGRectGetMaxY(frame) - _CPWindowViewCornerResizeRectWidth;
|
||||
|
||||
@@ -328,7 +332,7 @@ _CPWindowViewResizeSlop = 3;
|
||||
_CPWindowViewResizeSlop * 2);
|
||||
|
||||
if (_CGRectContainsPoint(rect, aPoint))
|
||||
return _CPWindowViewResizeRegionTop;
|
||||
return isSheet ? _CPWindowViewResizeRegionNone : _CPWindowViewResizeRegionTop;
|
||||
|
||||
rect.origin.y = _CGRectGetMaxY(frame) - _CPWindowViewResizeSlop;
|
||||
|
||||
@@ -450,7 +454,10 @@ _CPWindowViewResizeSlop = 3;
|
||||
var type = [anEvent type];
|
||||
|
||||
if (type === CPLeftMouseUp)
|
||||
{
|
||||
_cachedScreenFrame = nil;
|
||||
return;
|
||||
}
|
||||
|
||||
var location = [anEvent locationInWindow],
|
||||
theWindow = [self window],
|
||||
@@ -459,10 +466,10 @@ _CPWindowViewResizeSlop = 3;
|
||||
|
||||
if (type === CPLeftMouseDown)
|
||||
{
|
||||
_mouseDraggedPoint = _CGPointMakeCopy(globalLocation);
|
||||
_mouseDraggedPoint = _CGPointMake(globalLocation.x, globalLocation.y);
|
||||
_resizeFrame = _CGRectMakeCopy(frame);
|
||||
_cachedScreenFrame = [[CPPlatformWindow primaryPlatformWindow] visibleFrame];
|
||||
}
|
||||
|
||||
else if (type === CPLeftMouseDragged)
|
||||
{
|
||||
var deltaX = globalLocation.x - _mouseDraggedPoint.x,
|
||||
@@ -475,13 +482,16 @@ _CPWindowViewResizeSlop = 3;
|
||||
newY,
|
||||
newWidth,
|
||||
newHeight,
|
||||
platformFrame = [[theWindow platformWindow] usableContentFrame],
|
||||
resizeMinSize = [self _minimumResizeSize],
|
||||
minSize = [theWindow minSize],
|
||||
maxSize = [theWindow maxSize];
|
||||
|
||||
minSize = _CGSizeMake(MAX(minSize.width, resizeMinSize.width), MAX(minSize.height, resizeMinSize.height));
|
||||
|
||||
// If it's a sheet, horizontal resizing is symmetrical, so the movement is effectively doubled
|
||||
if (theWindow._isSheet)
|
||||
deltaX *= 2;
|
||||
|
||||
// Calculate x and width first
|
||||
switch (_resizeRegion)
|
||||
{
|
||||
@@ -498,8 +508,24 @@ _CPWindowViewResizeSlop = 3;
|
||||
else if (deltaX < 0)
|
||||
deltaX = -MIN(maxSize.width - startWidth, ABS(deltaX));
|
||||
|
||||
// When resizing from the left, we change the origin and the width
|
||||
if (theWindow._isSheet)
|
||||
deltaX = FLOOR(deltaX / 2);
|
||||
|
||||
newX = startX + deltaX;
|
||||
|
||||
// Pin the left edge to the usable screen left edge
|
||||
var pinnedX = MAX(newX, _CGRectGetMinX(_cachedScreenFrame));
|
||||
|
||||
if (pinnedX !== newX)
|
||||
{
|
||||
deltaX += pinnedX - newX;
|
||||
newX = pinnedX;
|
||||
}
|
||||
|
||||
// When resizing from the left, we change the origin and the width
|
||||
if (theWindow._isSheet)
|
||||
deltaX *= 2;
|
||||
|
||||
newWidth = startWidth - deltaX;
|
||||
break;
|
||||
|
||||
@@ -516,9 +542,26 @@ _CPWindowViewResizeSlop = 3;
|
||||
else if (deltaX < 0)
|
||||
deltaX = -MIN(startWidth - minSize.width, ABS(deltaX));
|
||||
|
||||
// When resizing from the right, change only the width
|
||||
newX = startX;
|
||||
newWidth = startWidth + deltaX;
|
||||
if (theWindow._isSheet)
|
||||
deltaX = FLOOR(deltaX / 2);
|
||||
|
||||
// Pin the right edge to the usable screen right edge
|
||||
var newMaxX = startX + startWidth + deltaX,
|
||||
pinnedX = MIN(newMaxX, _CGRectGetMaxX(_cachedScreenFrame));
|
||||
|
||||
if (pinnedX !== newMaxX)
|
||||
deltaX += pinnedX - newMaxX;
|
||||
|
||||
if (theWindow._isSheet)
|
||||
{
|
||||
newWidth = startWidth + (deltaX * 2);
|
||||
newX = startX - FLOOR((newWidth - startWidth) / 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
newWidth = startWidth + deltaX;
|
||||
newX = startX;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -542,8 +585,18 @@ _CPWindowViewResizeSlop = 3;
|
||||
else if (deltaY < 0)
|
||||
deltaY = -MIN(maxSize.height - startHeight, ABS(deltaY));
|
||||
|
||||
// When resizing from the top, change the origin and the height
|
||||
newY = startY + deltaY;
|
||||
|
||||
// Pin the top edge to the usable screen top edge
|
||||
var pinnedY = MAX(newY, _CGRectGetMinY(_cachedScreenFrame));
|
||||
|
||||
if (pinnedY !== newY)
|
||||
{
|
||||
deltaY += pinnedY - newY;
|
||||
newY = pinnedY;
|
||||
}
|
||||
|
||||
// When resizing from the top, change the origin and the height
|
||||
newHeight = startHeight - deltaY;
|
||||
break;
|
||||
|
||||
@@ -560,8 +613,16 @@ _CPWindowViewResizeSlop = 3;
|
||||
else if (deltaY < 0)
|
||||
deltaY = -MIN(startHeight - minSize.height, ABS(deltaY));
|
||||
|
||||
// When resizing from the bottom, change only the height
|
||||
newY = startY;
|
||||
|
||||
// Pin the bottom edge to the usable screen bottom edge
|
||||
var newMaxY = startY + startHeight + deltaY,
|
||||
pinnedY = MIN(newMaxY, _CGRectGetMaxY(_cachedScreenFrame));
|
||||
|
||||
if (pinnedY !== newMaxY)
|
||||
deltaY += pinnedY - newMaxY;
|
||||
|
||||
// When resizing from the bottom, change only the height
|
||||
newHeight = startHeight + deltaY;
|
||||
break;
|
||||
|
||||
@@ -570,13 +631,7 @@ _CPWindowViewResizeSlop = 3;
|
||||
newHeight = startHeight;
|
||||
}
|
||||
|
||||
if (theWindow._isSheet && theWindow._parentView && (frame.size.width !== newWidth))
|
||||
[theWindow._parentView _setAttachedSheetFrameOrigin];
|
||||
|
||||
// Constrain resize to fit within the platform window.
|
||||
var newFrame = CGRectIntersection(_CGRectMake(newX, newY, newWidth, newHeight), platformFrame);
|
||||
|
||||
[theWindow setFrame:newFrame];
|
||||
[theWindow setFrame:_CGRectMake(newX, newY, newWidth, newHeight)];
|
||||
[self setCursorForLocation:location resizing:YES];
|
||||
}
|
||||
|
||||
@@ -594,15 +649,10 @@ _CPWindowViewResizeSlop = 3;
|
||||
if (!visibleFrame)
|
||||
visibleFrame = [[CPPlatformWindow primaryPlatformWindow] visibleFrame];
|
||||
|
||||
var minPointY = 0;
|
||||
|
||||
if ([CPMenu menuBarVisible])
|
||||
minPointY = [[CPApp mainMenu] menuBarHeight];
|
||||
|
||||
var restrictedPoint = _CGPointMake(0, 0);
|
||||
|
||||
restrictedPoint.x = MIN(MAX(aPoint.x, -_frame.size.width + 4.0), _CGRectGetMaxX(visibleFrame) - 4.0);
|
||||
restrictedPoint.y = MIN(MAX(aPoint.y, minPointY), _CGRectGetMaxY(visibleFrame) - 8.0);
|
||||
restrictedPoint.y = MIN(MAX(aPoint.y, _CGRectGetMinY(visibleFrame)), _CGRectGetMaxY(visibleFrame) - 8.0);
|
||||
|
||||
return restrictedPoint;
|
||||
}
|
||||
@@ -650,6 +700,8 @@ _CPWindowViewResizeSlop = 3;
|
||||
|
||||
if ([theWindow attachedSheet])
|
||||
[theWindow _setAttachedSheetFrameOrigin];
|
||||
else if (theWindow._isSheet)
|
||||
[self _adjustShadowViewSize];
|
||||
}
|
||||
|
||||
- (void)setShowsResizeIndicator:(BOOL)shouldShowResizeIndicator
|
||||
@@ -829,22 +881,36 @@ _CPWindowViewResizeSlop = 3;
|
||||
[self addSubview:_resizeIndicator];
|
||||
}
|
||||
|
||||
- (void)_enableSheet:(BOOL)enable
|
||||
- (void)_enableSheet:(BOOL)enable inWindow:(CPWindow)parentWindow
|
||||
{
|
||||
if (enable)
|
||||
{
|
||||
_sheetShadowView = [[CPView alloc] initWithFrame:_CGRectMake(0, 0, _CGRectGetWidth([self bounds]), 8)];
|
||||
// Clip the shadow view width to the parent's content view
|
||||
var myWidth = [self bounds].size.width,
|
||||
shadowWidth = [self _shadowViewWidthForParentWindow:parentWindow],
|
||||
shadowHeight = [self currentValueForThemeAttribute:@"shadow-height"];
|
||||
|
||||
_sheetShadowView = [[CPView alloc] initWithFrame:_CGRectMake(FLOOR((myWidth - shadowWidth) / 2), 0, shadowWidth, shadowHeight)];
|
||||
[_sheetShadowView setAutoresizingMask:CPViewWidthSizable];
|
||||
[self addSubview:_sheetShadowView];
|
||||
}
|
||||
else
|
||||
{
|
||||
[_sheetShadowView removeFromSuperview];
|
||||
_sheetShadowView = nil;
|
||||
}
|
||||
|
||||
[self setNeedsLayout];
|
||||
}
|
||||
|
||||
- (CGRect)_shadowViewWidthForParentWindow:(CPWindow)parentWindow
|
||||
{
|
||||
var myWidth = [self bounds].size.width,
|
||||
parentWidth = [[parentWindow contentView] bounds].size.width;
|
||||
|
||||
return MIN(myWidth, parentWidth);
|
||||
}
|
||||
|
||||
- (void)layoutSubviews
|
||||
{
|
||||
[super layoutSubviews];
|
||||
@@ -861,9 +927,28 @@ _CPWindowViewResizeSlop = 3;
|
||||
}
|
||||
}
|
||||
|
||||
- (void)_adjustShadowViewSize
|
||||
{
|
||||
if (!_sheetShadowView)
|
||||
return;
|
||||
|
||||
var myWidth = [self frame].size.width,
|
||||
shadowFrame = [_sheetShadowView frame],
|
||||
shadowWidth = [self _shadowViewWidthForParentWindow:_window._parentView];
|
||||
|
||||
shadowFrame.origin.x = FLOOR((myWidth - shadowWidth) / 2);
|
||||
shadowFrame.size.width = shadowWidth;
|
||||
[_sheetShadowView setFrame:shadowFrame];
|
||||
}
|
||||
|
||||
- (CGSize)_minimumResizeSize
|
||||
{
|
||||
return _CGSizeMake(0, _CPWindowViewMinContentHeight);
|
||||
}
|
||||
|
||||
- (int)bodyOffset
|
||||
{
|
||||
return [self frame].origin.y;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -130,4 +130,52 @@
|
||||
return _windows;
|
||||
}
|
||||
|
||||
/*!
|
||||
Places \c aWindow within an element that clips it to the global rect \c clipRect.
|
||||
|
||||
NOTE: This is only meant for temporary usage during animation and should be balanced
|
||||
with a call to removeClipForWindow:. No attempt is made to make the clipping element follow
|
||||
changes to the window.
|
||||
*/
|
||||
- (void)clipWindow:(CPWindow)aWindow toRect:(CGRect)clipRect
|
||||
{
|
||||
// First check to see if the window is already clipped.
|
||||
// If so, just update its rect.
|
||||
var windowElement = aWindow._DOMElement,
|
||||
clip = document.createElement("div"),
|
||||
style = clip.style;
|
||||
|
||||
style = clip.style;
|
||||
style.className = "cpwindowclip";
|
||||
style.position = "absolute";
|
||||
style.overflow = "hidden";
|
||||
|
||||
style.left = clipRect.origin.x + "px";
|
||||
style.top = clipRect.origin.y + "px";
|
||||
style.width = clipRect.size.width + "px";
|
||||
style.height = clipRect.size.height + "px";
|
||||
|
||||
// Replace the window with the clip element, then put it inside the clip
|
||||
var parent = windowElement.parentNode;
|
||||
CPDOMDisplayServerInsertBefore(parent, clip, windowElement);
|
||||
CPDOMDisplayServerRemoveChild(parent, windowElement);
|
||||
CPDOMDisplayServerAppendChild(clip, windowElement);
|
||||
}
|
||||
|
||||
/*!
|
||||
Unclips a window that was previously clipped with clipWindow:toWindow:.
|
||||
If the window was not clipped, a warning is logged.
|
||||
*/
|
||||
- (void)removeClipForWindow:(CPWindow)aWindow
|
||||
{
|
||||
var windowElement = aWindow._DOMElement,
|
||||
clip = windowElement.parentNode,
|
||||
parent = clip.parentNode;
|
||||
|
||||
CPDOMDisplayServerRemoveChild(clip, windowElement);
|
||||
[aWindow setFrameOrigin:_CGPointMake([aWindow frame].origin.x, clip.offsetTop)];
|
||||
CPDOMDisplayServerInsertBefore(parent, windowElement, clip);
|
||||
CPDOMDisplayServerRemoveChild(parent, clip);
|
||||
}
|
||||
|
||||
@end
|
||||
|
Before Width: | Height: | Size: 106 B After Width: | Height: | Size: 616 B |
@@ -2327,7 +2327,7 @@ var themedButtonValues = nil,
|
||||
{
|
||||
var windowView = [[_CPWindowView alloc] initWithFrame:CGRectMakeZero()],
|
||||
|
||||
sheetShadow = PatternColor(@"window-attached-sheet-shadow.png", 9, 8),
|
||||
sheetShadow = PatternColor(@"window-attached-sheet-shadow.png", 1, 8),
|
||||
resizeIndicator = PatternImage(@"window-resize-indicator.png", 12, 12),
|
||||
|
||||
shadowColor = PatternColor(
|
||||
@@ -2350,6 +2350,7 @@ var themedButtonValues = nil,
|
||||
[@"window-shadow-color", shadowColor],
|
||||
[@"resize-indicator", resizeIndicator],
|
||||
[@"attached-sheet-shadow-color", sheetShadow],
|
||||
[@"shadow-height", 8],
|
||||
[@"size-indicator", CGSizeMake(12, 12)]
|
||||
];
|
||||
|
||||
@@ -2457,7 +2458,6 @@ var themedButtonValues = nil,
|
||||
minimizeButtonImage = PatternImage(@"window-standard-minimize-button.png",16, 16),
|
||||
minimizeButtonImageHighlighted = PatternImage(@"window-standard-minimize-button-highlighted.png",16, 16),
|
||||
|
||||
sheetShadow = PatternColor(@"window-attached-sheet-shadow.png", 9, 8),
|
||||
resizeIndicator = PatternImage(@"window-resize-indicator.png", 12, 12),
|
||||
|
||||
themeValues =
|
||||
@@ -2492,7 +2492,6 @@ var themedButtonValues = nil,
|
||||
[@"close-image-origin", CGPointMake(8.0, 10.0)],
|
||||
|
||||
[@"resize-indicator", resizeIndicator],
|
||||
[@"attached-sheet-shadow-color", sheetShadow],
|
||||
[@"size-indicator", CGSizeMake(12, 12)]
|
||||
];
|
||||
|
||||
@@ -2503,7 +2502,7 @@ var themedButtonValues = nil,
|
||||
|
||||
+ (_CPDocModalWindowView)themedDocModalWindowView
|
||||
{
|
||||
var docModalWindowView = [[_CPDocModalWindowView alloc] initWithFrame:CGRectMake(0,0,200,200) styleMask:nil],
|
||||
var docModalWindowView = [[_CPDocModalWindowView alloc] initWithFrame:CGRectMake(0, 0, 200, 200) styleMask:nil],
|
||||
|
||||
bezelColor = PatternColor(
|
||||
[
|
||||
@@ -2518,13 +2517,9 @@ var themedButtonValues = nil,
|
||||
[@"window-standard-bottom-right.png", 2.0, 2.0]
|
||||
]),
|
||||
|
||||
sheetShadow = PatternColor(@"window-attached-sheet-shadow.png", 9, 8),
|
||||
|
||||
themeValues =
|
||||
[
|
||||
[@"body-color", bezelColor],
|
||||
[@"height-shadow", 8],
|
||||
[@"attached-sheet-shadow-color", sheetShadow]
|
||||
[@"body-color", bezelColor]
|
||||
];
|
||||
|
||||
[self registerThemeValues:themeValues forView:docModalWindowView inherit:themedWindowViewValues];
|
||||
|
||||
|
Before Width: | Height: | Size: 106 B After Width: | Height: | Size: 616 B |
|
Before Width: | Height: | Size: 75 B After Width: | Height: | Size: 616 B |
|
Before Width: | Height: | Size: 114 B After Width: | Height: | Size: 649 B |
|
Before Width: | Height: | Size: 114 B After Width: | Height: | Size: 650 B |
|
Before Width: | Height: | Size: 82 B After Width: | Height: | Size: 607 B |
|
Before Width: | Height: | Size: 76 B After Width: | Height: | Size: 611 B |
|
Before Width: | Height: | Size: 76 B After Width: | Height: | Size: 611 B |
|
Before Width: | Height: | Size: 79 B After Width: | Height: | Size: 617 B |
|
Before Width: | Height: | Size: 79 B After Width: | Height: | Size: 621 B |
@@ -1773,7 +1773,7 @@ var themedButtonValues = nil,
|
||||
{
|
||||
var windowView = [[_CPWindowView alloc] initWithFrame:CGRectMakeZero(0.0, 0.0, 200, 200)],
|
||||
|
||||
sheetShadow = PatternColor(@"window-attached-sheet-shadow.png", 9, 8),
|
||||
sheetShadow = PatternColor(@"window-attached-sheet-shadow.png", 1, 8),
|
||||
resizeIndicator = PatternImage(@"window-resize-indicator.png", 12, 12),
|
||||
|
||||
shadowColor = PatternColor(
|
||||
@@ -1794,6 +1794,7 @@ var themedButtonValues = nil,
|
||||
[@"window-shadow-color", shadowColor],
|
||||
[@"resize-indicator", resizeIndicator],
|
||||
[@"attached-sheet-shadow-color", sheetShadow],
|
||||
[@"shadow-height", 8],
|
||||
[@"size-indicator", CGSizeMake(12, 12)]
|
||||
];
|
||||
|
||||
@@ -1890,7 +1891,6 @@ var themedButtonValues = nil,
|
||||
minimizeButtonImage = PatternImage(@"window-standard-minimize-button.png", 16, 16),
|
||||
minimizeButtonImageHighlighted = PatternImage(@"window-standard-minimize-button-highlighted.png", 16, 16),
|
||||
|
||||
sheetShadow = PatternColor(@"window-attached-sheet-shadow.png", 9, 8),
|
||||
resizeIndicator = PatternImage(@"window-resize-indicator.png", 12, 12),
|
||||
|
||||
themeValues =
|
||||
@@ -1930,7 +1930,6 @@ var themedButtonValues = nil,
|
||||
[@"close-image-origin", CGPointMake(8.0, 10.0)],
|
||||
|
||||
[@"resize-indicator", resizeIndicator],
|
||||
[@"attached-sheet-shadow-color", sheetShadow],
|
||||
[@"size-indicator", CGSizeMake(12, 12)]
|
||||
];
|
||||
|
||||
@@ -1951,13 +1950,9 @@ var themedButtonValues = nil,
|
||||
height: 5.0
|
||||
}),
|
||||
|
||||
sheetShadow = PatternColor(@"window-attached-sheet-shadow.png", 9, 8),
|
||||
|
||||
themeValues =
|
||||
[
|
||||
[@"body-color", bezelColor],
|
||||
[@"height-shadow", 8],
|
||||
[@"attached-sheet-shadow-color", sheetShadow]
|
||||
[@"body-color", bezelColor]
|
||||
];
|
||||
|
||||
[self registerThemeValues:themeValues forView:docModalWindowView inherit:themedWindowViewValues];
|
||||
|
||||
@@ -33,43 +33,127 @@ Some things are difficult to unit test in a way that's worthwhile. For instance
|
||||
|
||||
The style and format of your commit messages are very important to the health of the project. A good commit message helps not only users reading the release notes, but also your fellow Cappuccino developers as they review `git log` or `git blame` to figure out what you were doing.
|
||||
|
||||
This is the preferred format of commit messages for complex changes:
|
||||
Commit messages should be in the following format:
|
||||
|
||||
[New:] <what's new.>
|
||||
<type>: <summary>
|
||||
|
||||
[OPTIONAL DESCRIPTION ABOUT WHAT THIS THING DOES.]
|
||||
<body>
|
||||
|
||||
Or for fixes:
|
||||
<footer>
|
||||
|
||||
Fixed: <what was fixed.>
|
||||
### Types
|
||||
|
||||
BEFORE
|
||||
Allowed `type` values are:
|
||||
|
||||
AFTER
|
||||
* **New** — A new feature has been implemented
|
||||
* **Fixed** — A bug has been fixed
|
||||
* **Docs** — Documentation has been added or tweaked
|
||||
* **Formatting** — Code has been reformatted to conform to style guidelines
|
||||
* **Test** — Test cases have been added
|
||||
* **Task** — A build task has been added or updated
|
||||
|
||||
**Example:**
|
||||
### Message summary
|
||||
|
||||
nib2cib support for table view background colour.
|
||||
The summary is one of the most important parts of the commit message, because that is what we see when scanning through a list of commits, and it is also what we use to generate change logs.
|
||||
|
||||
**Example:**
|
||||
The summary should be a **concise** description of the commit, preferably 72 characters or less (so we can see the entire description in github), beginning with a lowercase letter and with a terminating period. It should describe only the core issue addressed by the commit. If you find that the summary needs to be very long, your commit is probably too big! Smaller commits are better.
|
||||
|
||||
For a `New` commit, the summary should answer the question, “What is new and where?” For a `Fixed` commit, the summary should answer the question, “What was fixed?”, for example “Window content view overlapped frame”. It should **not** answer the question, “What was done to fix it?” That belongs in the body.
|
||||
|
||||
Do **not** simply reference another issue or pull request by number in the summary. First of all, we want to know what was actually changed and why, which may not be fully explained in the referenced issue. Second, github will not create a link to the referenced issue in the commit summary.
|
||||
|
||||
### Message body
|
||||
|
||||
The details of the commit go in the body. Specifically, the body should include the motivation for the change for `New`, `Fixed` and `Task` types. For `Fixed` commits, you should also contrast behavior before the commit with behavior after the commit.
|
||||
|
||||
If the summary can completely express everything, there is no need for a message body.
|
||||
|
||||
### Message footer
|
||||
|
||||
If the commit closes an issue by fixing the bug, implementing a feature, or rendering it obsolete, or if it references an issue without closing it, that should be indicated in the message footer.
|
||||
|
||||
Issues closed by a commit should be listed on a separate line in the footer with an appropriate prefix:
|
||||
|
||||
- "Fixes" for `Fixed` commit types
|
||||
- "Closes" for all other commit types
|
||||
|
||||
For example:
|
||||
|
||||
Fixes #1234
|
||||
|
||||
or in the case of multiple issues, like this:
|
||||
|
||||
Fixes #1234, #2345
|
||||
|
||||
Issues that a commit references without closing them should be listed on a separate line in the footer with the prefix "Refs", like this:
|
||||
|
||||
Refs #1234
|
||||
|
||||
or in the case of multiple issues, like this:
|
||||
|
||||
Refs #1234, #2345
|
||||
|
||||
If a commit changes the API or behavior in such a way that existing code may break, a description of the change, what might break, and how existing code should be modified **must** be noted in the footer like this:
|
||||
|
||||
BREAKING CHANGE:
|
||||
The scroller orientation is no longer calculated from the size,
|
||||
but is read from the xib during nib2cib.
|
||||
|
||||
All existing xibs should be regenerated by executing the following
|
||||
within a project directory: `find . -name *.xib -exec nib2cib {} \;`
|
||||
|
||||
### Examples
|
||||
|
||||
New: custom rendered pattern fill/stroke.
|
||||
|
||||
Canvas supports using another canvas as the source for a pattern fill
|
||||
or stroke. We needed an API for this that fit into the rest of the
|
||||
CGContext API.
|
||||
|
||||
CGContextCreatePatternContext returns a context into which any arbitrary
|
||||
drawing can be done. This context can then be passed to CGContextSetFillPattern
|
||||
or CGContextSetStrokePattern to render the drawing into the current drawing context.
|
||||
|
||||
Test app in Tests/Manual/PatternFillTest.
|
||||
|
||||
***
|
||||
|
||||
Fixed: CPAlert was a CPView.
|
||||
|
||||
Before this fix, CPAlert subclassed CPView, causing an API mismatch with Cocoa and exposing unexpected methods in the public API which made no sense for a CPAlert such as autoresizing masks. It also lead to CPAlert mistakingly shadowing _window from its CPView superclass.
|
||||
Previously, CPAlert subclassed CPView, causing an API mismatch
|
||||
with Cocoa and exposing unexpected methods in the public API which
|
||||
made no sense for a CPAlert, such as autoresizing masks. It also led
|
||||
to CPAlert mistakingly shadowing _window from its CPView superclass.
|
||||
|
||||
This fix makes CPAlert inherit from CPObject as it should. The theming, which needs to be applied to a view, was moved to an internal view.
|
||||
This commit makes CPAlert inherit from CPObject as it should. The theming,
|
||||
which needs to be applied to a view, was moved to an internal view.
|
||||
|
||||
The summary line concisely says what was fixed or improved by the commit. If it's an improvement or something new it optionally starts with "New:". If it's a bug fix it starts with "Fixed:".
|
||||
Fixes #307
|
||||
|
||||
For a 'new' change, the rest of the summary line answers the question *"What is new and where?"*. Optionally the summary can be followed with more detail about what's new and why it's great.
|
||||
***
|
||||
|
||||
If the summary starts with "Fixed:" the rest of the summary line answers the question *"What was fixed?"*. E.g. "Fixed: the blargh had too many blurghs."
|
||||
Fixed: CPScroller did not retrieve orientation from the xib.
|
||||
|
||||
(Note it does NOT answer the question *"what was done to fix it?"* E.g. **WRONG:** "Fixed: removed 2 blurghs from the blargh." That would imply that your very change was what was fixed by itself, causing an infinite loop in the universe and ending the world as we know it.)
|
||||
Previously, CPScrollers created from cibs calculated their orientation
|
||||
(horizontal/vertical) based on their size. Unfortunately this did not
|
||||
account for the unlikely case where a horizontal scroller's width < height,
|
||||
and vice versa.
|
||||
|
||||
The rest of the fix message is in a before / after form. The first part describes what the situation was before the fix and says why the fix was needed. The after part describes what change was made to rectify the situation and any implementation notes that might be useful to know for people reviewing it in the future.
|
||||
Now the CPScroller's orientation is read from the xib and is guaranteed
|
||||
to be correct.
|
||||
|
||||
Naturally small or unimportant commits have less rigid requirements. If you can comfortably and easily describe the whole change in the summary only, go ahead. Maybe you fixed a tiny typo or did a minor refactoring.
|
||||
Fixes #1027
|
||||
|
||||
BREAKING CHANGE:
|
||||
The scroller orientation is no longer calculated from the size,
|
||||
but is read from the xib during nib2cib.
|
||||
|
||||
All existing xibs should be regenerated by executing the following
|
||||
within a project directory: `find . -name *.xib -exec nib2cib {} \;`
|
||||
|
||||
***
|
||||
|
||||
Docs: Typo in CPWindow -minSize.
|
||||
|
||||
## Cappuccino Coding Style Guidelines
|
||||
|
||||
@@ -106,7 +190,7 @@ A case label should be indented once from its switch statement. The case stateme
|
||||
case barCondition:
|
||||
i++;
|
||||
break;
|
||||
|
||||
|
||||
case bazCondition:
|
||||
i += 2;
|
||||
break;
|
||||
@@ -123,7 +207,7 @@ A case label should be indented once from its switch statement. The case stateme
|
||||
i++;
|
||||
break;
|
||||
case bazCondition: i += 2;
|
||||
break;
|
||||
break;
|
||||
default:
|
||||
i--;
|
||||
}
|
||||
@@ -220,7 +304,7 @@ Each statement should get its own line.
|
||||
y;
|
||||
x++;
|
||||
y++;
|
||||
|
||||
|
||||
if (condition)
|
||||
doIt();
|
||||
|
||||
@@ -236,10 +320,10 @@ There should be blank lines around bracketed code blocks and control structures,
|
||||
|
||||
var x,
|
||||
y;
|
||||
|
||||
|
||||
x++;
|
||||
y++;
|
||||
|
||||
|
||||
if (condition)
|
||||
doIt();
|
||||
else
|
||||
@@ -247,7 +331,7 @@ There should be blank lines around bracketed code blocks and control structures,
|
||||
doSomethingElse();
|
||||
doMore();
|
||||
}
|
||||
|
||||
|
||||
return x;
|
||||
|
||||
##### Wrong:
|
||||
@@ -263,7 +347,7 @@ There should be blank lines around bracketed code blocks and control structures,
|
||||
doSomethingElse();
|
||||
doMore();
|
||||
}
|
||||
return x;
|
||||
return x;
|
||||
|
||||
### Braces
|
||||
|
||||
@@ -382,12 +466,12 @@ Variable declarations should be created as needed, rather than up front ("hoiste
|
||||
- (BOOL)doSomething:(id)aFoo
|
||||
{
|
||||
var importantVariable = [aFoo message];
|
||||
|
||||
|
||||
if (!importantVariable)
|
||||
return;
|
||||
|
||||
var index = [aFoo count];
|
||||
|
||||
|
||||
while (index--)
|
||||
{
|
||||
var innerVariable = [aFoo objectAtIndex:index];
|
||||
@@ -457,7 +541,7 @@ Precede boolean values with words like "is" and "did".
|
||||
|
||||
var isValid,
|
||||
didSendData;
|
||||
|
||||
|
||||
- (BOOL)isEditable;
|
||||
- (BOOL)didReceiveResponse;
|
||||
|
||||
@@ -465,7 +549,7 @@ Precede boolean values with words like "is" and "did".
|
||||
|
||||
var valid,
|
||||
sentData;
|
||||
|
||||
|
||||
- (BOOL)editable;
|
||||
- (BOOL)receivedResponse;
|
||||
|
||||
|
||||
@@ -22,7 +22,8 @@
|
||||
[wind setTitle:@"Untitled"];
|
||||
|
||||
sheet = [[CPWindow alloc] initWithContentRect:CGRectMake(0, 0, 300, 100) styleMask:CPDocModalWindowMask | CPResizableWindowMask];
|
||||
[sheet setMinSize:CGSizeMake(300,100)];
|
||||
[sheet setMinSize:CGSizeMake(300, 100)];
|
||||
[sheet setMaxSize:CGSizeMake(600, 300)];
|
||||
|
||||
var sheetContent = [sheet contentView];
|
||||
|
||||
|
||||