Permalink
Browse files

Merge branch 'master' into scroll_before_focus_text_field

Conflicts:
	AppKit/CPTokenField.j
  • Loading branch information...
2 parents 7bf5f6f + 71b93a2 commit 82337b8baa33c09c8aaf4eb080ccd8ec4825461b @mrcarlberg committed Nov 30, 2012
Showing with 5,321 additions and 2,679 deletions.
  1. +1 −0 AppKit/CPAlert.j
  2. +11 −1 AppKit/CPApplication.j
  3. +35 −0 AppKit/CPBezierPath.j
  4. +20 −0 AppKit/CPBox.j
  5. +4 −0 AppKit/CPCollectionView.j
  6. +8 −0 AppKit/CPColor.j
  7. +15 −0 AppKit/CPFont.j
  8. +10 −0 AppKit/CPGraphics.j
  9. +34 −1 AppKit/CPGraphicsContext.j
  10. +8 −1 AppKit/CPKeyValueBinding.j
  11. +1 −2 AppKit/CPMenu/CPMenu.j
  12. +8 −1 AppKit/CPPopover.j
  13. +5 −5 AppKit/CPRuleEditor/_CPRuleEditorViewSlice.j
  14. +10 −1 AppKit/CPRuleEditor/_CPRuleEditorViewSliceRow.j
  15. +6 −1 AppKit/CPSearchField.j
  16. +35 −2 AppKit/CPStepper.j
  17. +1 −1 AppKit/CPTabViewItem.j
  18. +31 −1 AppKit/CPTableColumn.j
  19. +62 −4 AppKit/CPTableHeaderView.j
  20. +23 −7 AppKit/CPTableView.j
  21. +19 −7 AppKit/CPTextField.j
  22. +52 −24 AppKit/CPTokenField.j
  23. +8 −7 AppKit/CPToolbar.j
  24. +6 −53 AppKit/CPView.j
  25. +5 −0 AppKit/CPWebView.j
  26. +69 −3 AppKit/CPWindow/CPWindow.j
  27. +23 −12 AppKit/CPWindow/_CPAttachedWindowView.j
  28. +0 −32 AppKit/CPWindow/_CPStandardWindowView.j
  29. +24 −2 AppKit/CPWindow/_CPWindowView.j
  30. +1 −1 AppKit/CPWindowController.j
  31. +85 −65 AppKit/Cib/_CPCibWindowTemplate.j
  32. +10 −0 AppKit/CoreGraphics/CGContext.j
  33. +1 −1 AppKit/CoreGraphics/CGContextCanvas.j
  34. +2 −2 AppKit/CoreGraphics/CGContextVML.j
  35. +119 −0 AppKit/CoreGraphics/CGPath.j
  36. +4 −2 AppKit/Platform/DOM/CPPlatformWindow+DOM.j
  37. +3 −2 AppKit/Themes/Aristo/ThemeDescriptors.j
  38. +14 −1 AppKit/_CPAttachedWindow.j
  39. +8 −1 AppKit/_CPAutocompleteMenu.j
  40. +45 −27 AppKit/_CPImageAndTextView.j
  41. +44 −1 AppKit/_CPToolTip.j
  42. +12 −0 Foundation/CPGeometry.j
  43. +11 −13 Tests/Manual/ArrayController1/AppController.j
  44. +1 −0 Tests/Manual/AttachedSheet2/MainMenu.cib
  45. +1 −1 Tests/Manual/AttachedSheet2/Resources/MainMenu.cib
  46. +1 −1 Tests/Manual/AttachedSheet2/Resources/Window.cib
  47. +157 −119 Tests/Manual/AttachedSheet2/Resources/Window.xib
  48. +18 −2 Tests/Manual/AttachedSheet2/SheetWindowController.j
  49. +1 −0 Tests/Manual/AttachedSheet2/Window.cib
  50. +0 −5 Tests/Manual/CPButtonTest/AppController.j
  51. +1 −1 Tests/Manual/CPButtonTest/Resources/MainMenu.cib
  52. +2,256 −2,180 Tests/Manual/CPButtonTest/Resources/MainMenu.xib
  53. +33 −0 Tests/Manual/CPStepperBindings/AppController.j
  54. +10 −0 Tests/Manual/CPStepperBindings/Info.plist
  55. +94 −0 Tests/Manual/CPStepperBindings/Jakefile
  56. +1 −0 Tests/Manual/CPStepperBindings/Resources/MainMenu.cib
  57. +1,487 −0 Tests/Manual/CPStepperBindings/Resources/MainMenu.xib
  58. BIN Tests/Manual/CPStepperBindings/Resources/spinner.gif
  59. +107 −0 Tests/Manual/CPStepperBindings/index-debug.html
  60. +77 −0 Tests/Manual/CPStepperBindings/index.html
  61. +18 −0 Tests/Manual/CPStepperBindings/main.j
  62. +33 −2 Tests/Manual/CPTextField/AppController.j
  63. +1 −1 Tests/Manual/TableTest/TableCibTest/Resources/MainMenu.cib
  64. +86 −66 Tests/Manual/TableTest/TableCibTest/Resources/MainMenu.xib
  65. +1 −0 Tools/XcodeCapp/XcodeCapp.xcodeproj/project.pbxproj
  66. +9 −2 Tools/XcodeCapp/parser.j
  67. +2 −4 Tools/nib2cib/NSButton.j
  68. +5 −0 Tools/nib2cib/NSControl.j
  69. +1 −0 Tools/nib2cib/NSMatrix.j
  70. +2 −1 Tools/nib2cib/NSTableColumn.j
  71. +14 −9 Tools/nib2cib/NSWindowTemplate.j
  72. +11 −1 common.jake
View
@@ -595,6 +595,7 @@ CPCriticalAlertStyle = 2;
frame.size = [self currentValueForThemeAttribute:@"size"];
_window = [[CPWindow alloc] initWithContentRect:frame styleMask:forceStyle || _defaultWindowStyle];
+ [_window setLevel:CPStatusWindowLevel];
if (_title)
[_window setTitle:_title];
View
@@ -1218,7 +1218,17 @@ function CPApplicationMain(args, namedArgs)
#if PLATFORM(DOM)
// hook to allow recorder, etc to manipulate things before starting AppKit
if (window.parent !== window && typeof window.parent._childAppIsStarting === "function")
- window.parent._childAppIsStarting(window);
+ {
+ try
+ {
+ window.parent._childAppIsStarting(window);
+ }
+ catch(err)
+ {
+ // This could happen if we're in an iframe without access to the parent frame.
+ CPLog.warn("Failed to call parent frame's _childAppIsStarting().");
+ }
+ }
#endif
var mainBundle = [CPBundle mainBundle],
View
@@ -165,6 +165,19 @@ var DefaultLineWidth = 1.0;
CGPathAddCurveToPoint(_path, nil, controlPoint1.x, controlPoint1.y, controlPoint2.x, controlPoint2.y, endPoint.x, endPoint.y);
}
+- (CGRect)bounds
+{
+ // TODO: this should return this. The controlPointBounds is not a tight fit.
+ // return CGPathGetPathBoundingBox(_path);
+
+ return [self controlPointBounds];
+}
+
+- (CGRect)controlPointBounds
+{
+ return CGPathGetBoundingBox(_path);
+}
+
/*!
Create a line segment between the first and last points in the subpath, closing it.
*/
@@ -272,6 +285,11 @@ var DefaultLineWidth = 1.0;
CGPathAddPath(_path, nil, CGPathWithRoundedRectangleInRect(rect, xRadius, yRadius, YES, YES, YES, YES));
}
+- (void)appendBezierPathWithArcFromPoint:(CGPoint)fromPoint toPoint:(CGPoint)toPoint radius:(float)radius
+{
+ CGPathAddArcToPoint(_path, null, fromPoint.x, fromPoint.y, toPoint.x, toPoint.y, radius);
+}
+
/*!
Append the contents of a CPBezierPath object.
*/
@@ -288,4 +306,21 @@ var DefaultLineWidth = 1.0;
_path = CGPathCreateMutable();
}
+- (void)addClip
+{
+ var ctx = [[CPGraphicsContext currentContext] graphicsPort];
+
+ CGContextAddPath(ctx, _path);
+ CGContextClip(ctx);
+}
+
+- (void)setClip
+{
+ var ctx = [[CPGraphicsContext currentContext] graphicsPort];
+
+ CGContextBeginPath(ctx);
+ CGContextAddPath(ctx, _path);
+ CGContextClip(ctx);
+}
+
@end
View
@@ -322,6 +322,26 @@ CPBelowBottom = 6;
[self _manageTitlePositioning];
}
+- (CPFont)titleFont
+{
+ return [_titleView font];
+}
+
+- (void)setTitleFont:(CPFont)aFont
+{
+ [_titleView setFont:aFont];
+}
+
+/*!
+ Return the text field used to display the receiver's title.
+
+ This is the Cappuccino equivalent to the `titleCell` method.
+*/
+- (CPTextField)titleView
+{
+ return _titleView;
+}
+
- (void)_manageTitlePositioning
{
if (_titlePosition == CPNoTitle)
@@ -690,6 +690,10 @@
- (void)mouseDragged:(CPEvent)anEvent
{
+ // Don't crash if we never registered the intial click.
+ if (!_mouseDownEvent)
+ return;
+
var locationInWindow = [anEvent locationInWindow],
mouseDownLocationInWindow = [_mouseDownEvent locationInWindow];
View
@@ -612,6 +612,14 @@ function CPColorWithImages()
}
/*!
+ Returns the receiver. This method is a placeholder that does nothing but may be implemented in the future.
+*/
+- (CPColor)colorUsingColorSpaceName:(id)aColorSpaceName
+{
+ return self;
+}
+
+/*!
Returns an array with the HSB values for this color.
The index values are ordered as:
<pre>
View
@@ -174,6 +174,21 @@ following:
return _CPFontSystemFontSize;
}
++ (float)systemFontSizeForControlSize:(CPControlSize)aSize
+{
+ // TODO These sizes should be themable or made less arbitrary in some other way.
+ switch (aSize)
+ {
+ case CPSmallControlSize:
+ return _CPFontSystemFontSize - 1;
+ case CPMiniControlSize:
+ return _CPFontSystemFontSize - 2;
+ case CPRegularControlSize:
+ default:
+ return _CPFontSystemFontSize;
+ }
+}
+
/*!
Sets the default system font size.
*/
View
@@ -23,6 +23,16 @@
@import "CPColor.j"
@import "CPGraphicsContext.j"
+CPCalibratedWhiteColorSpace = @"CalibratedWhiteColorSpace";
+CPCalibratedBlackColorSpace = @"CalibratedBlackColorSpace";
+CPCalibratedRGBColorSpace = @"CalibratedRGBColorSpace";
+CPDeviceWhiteColorSpace = @"DeviceWhiteColorSpace";
+CPDeviceBlackColorSpace = @"DeviceBlackColorSpace";
+CPDeviceRGBColorSpace = @"DeviceRGBColorSpace";
+CPDeviceCMYKColorSpace = @"DeviceCMYKColorSpace";
+CPNamedColorSpace = @"NamedColorSpace";
+CPPatternColorSpace = @"PatternColorSpace";
+CPCustomColorSpace = @"CustomColorSpace";
function CPDrawTiledRects(
/* CGRect */ boundsRect,
View
@@ -25,7 +25,8 @@
@import "CGContext.j"
-var CPGraphicsContextCurrent = nil;
+var CPGraphicsContextCurrent = nil,
+ CPGraphicsContextThreadStack = nil;
/*!
@ingroup appkit
@@ -52,6 +53,28 @@ var CPGraphicsContextCurrent = nil;
CPGraphicsContextCurrent = aGraphicsContext;
}
++ (void)saveGraphicsState
+{
+ if (!CPGraphicsContextCurrent)
+ return;
+
+ if (!CPGraphicsContextThreadStack)
+ CPGraphicsContextThreadStack = [CPMutableArray array];
+
+ [CPGraphicsContextThreadStack addObject:CPGraphicsContextCurrent];
+ [CPGraphicsContextCurrent saveGraphicsState];
+}
+
++ (void)restoreGraphicsState
+{
+ var lastContext = [CPGraphicsContextThreadStack lastObject];
+ if (lastContext)
+ {
+ [lastContext restoreGraphicsState];
+ [CPGraphicsContextThreadStack removeLastObject];
+ }
+}
+
/*!
Creates a graphics context with a provided port.
@param aContext the context to initialize with
@@ -99,4 +122,14 @@ var CPGraphicsContextCurrent = nil;
return YES;
}
+- (void)saveGraphicsState
+{
+ CGContextSaveGState(_graphicsPort);
+}
+
+- (void)restoreGraphicsState
+{
+ CGContextRestoreGState(_graphicsPort);
+}
+
@end
@@ -131,7 +131,7 @@ var CPBindingOperationAnd = 0,
if (options)
[_info setObject:options forKey:CPOptionsKey];
- [self _updatePlaceholdersWithOptions:options];
+ [self _updatePlaceholdersWithOptions:options forBinding:aName];
[aDestination addObserver:self forKeyPath:aKeyPath options:CPKeyValueObservingOptionNew context:aBinding];
@@ -321,6 +321,11 @@ var CPBindingOperationAnd = 0,
}
}
+- (void)_updatePlaceholdersWithOptions:(CPDictionary)options forBinding:(CPString)aBinding
+{
+ [self _updatePlaceholdersWithOptions:options];
+}
+
- (void)_placeholderForMarker:aMarker
{
var placeholder = _placeholderForMarker[aMarker];
@@ -564,6 +569,8 @@ CPFontNameBinding = @"fontName";
CPFontBoldBinding = @"fontBold";
CPHiddenBinding = @"hidden";
CPFilterPredicateBinding = @"filterPredicate";
+CPMaxValueBinding = @"maxValue";
+CPMinValueBinding = @"minValue";
CPPredicateBinding = @"predicate";
CPSelectedIndexBinding = @"selectedIndex";
CPSelectedLabelBinding = @"selectedLabel";
View
@@ -976,8 +976,7 @@ var _CPMenuBarVisible = NO,
for (; index < count; ++index)
{
- var item = _items[index],
- modifierMask = [item keyEquivalentModifierMask];
+ var item = _items[index];
if ([anEvent _triggersKeyEquivalent:[item keyEquivalent] withModifierMask:[item keyEquivalentModifierMask]])
{
View
@@ -234,7 +234,7 @@ Set the behavior of the CPPopover. It can be:
[_attachedWindow setContentView:[_contentViewController view]];
[_attachedWindow positionRelativeToRect:positioningRect ofView:positioningView preferredEdge:preferredEdge];
- if (_implementedDelegateMethods & CPPopoverDelegate_popover_didShow_)
+ if (!_animates && _implementedDelegateMethods & CPPopoverDelegate_popover_didShow_)
[_delegate popoverDidShow:self];
}
@@ -311,6 +311,13 @@ Set the behavior of the CPPopover. It can be:
[_delegate popoverDidClose:self];
}
+/*! @ignore */
+- (void)attachedWindowDidShow:(_CPAttachedWindow)anAttachedWindow
+{
+ if (_implementedDelegateMethods & CPPopoverDelegate_popover_didShow_)
+ [_delegate popoverDidShow:self];
+}
+
#pragma mark -
#pragma mark Notifications
@@ -45,7 +45,7 @@
{
var context = [[CPGraphicsContext currentContext] graphicsPort],
bounds = [self bounds],
- maxX = CGRectGetWidth(bounds) - 2,
+ maxX = CGRectGetWidth(bounds),
maxY = CGRectGetHeight(bounds);
// Draw background
@@ -63,16 +63,16 @@
// Draw Top Border
CGContextBeginPath(context);
- CGContextMoveToPoint(context, 1, 0);
+ CGContextMoveToPoint(context, 0, 0);
CGContextAddLineToPoint(context, maxX, 0);
CGContextClosePath(context);
CGContextSetStrokeColor(context, [_ruleEditor _sliceTopBorderColor]);
CGContextStrokePath(context);
// Draw Bottom Border
CGContextBeginPath(context);
- CGContextMoveToPoint(context, 1, maxY - 0.5);
- CGContextAddLineToPoint(context, maxX, maxY - 0.5);
+ CGContextMoveToPoint(context, 0, maxY);
+ CGContextAddLineToPoint(context, maxX, maxY);
CGContextClosePath(context);
var bottomColor = (_rowIndex == [_ruleEditor _lastRow]) ? [_ruleEditor _sliceLastBottomBorderColor] : [_ruleEditor _sliceBottomBorderColor];
CGContextSetStrokeColor(context, bottomColor);
@@ -106,4 +106,4 @@
return [CPString stringWithFormat:@"<%@ %p index:%d indentation:%d>",[self className],self,[self rowIndex],[self indentation]];
}
-@end
+@end
@@ -121,7 +121,7 @@ var CONTROL_HEIGHT = 16.,
return [CPMenuItem separatorItem];
}
-- (_CPRuleEditorTextField)_createStaticTextFieldWithStringValue:(CPString )text
+- (_CPRuleEditorTextField)_createStaticTextFieldWithStringValue:(CPString)text
{
var textField = [[_CPRuleEditorTextField alloc] initWithFrame:CPMakeRect(0, 0, 200, CONTROL_HEIGHT)],
refont = [_ruleEditor font],
@@ -352,6 +352,15 @@ var CONTROL_HEIGHT = 16.,
optionFrame = _ruleOptionFrames[i];
optionFrame.origin.y = (rowHeight - CGRectGetHeight(optionFrame)) / 2 - 2;
+
+ // small positioning fix
+ if ([ruleOptionView isKindOfClass:CPTextField])
+ {
+ optionFrame.origin.y += 2;
+ [_ruleOptionViews[i] setValue:CGInsetMake(7, 7, 7, 8) forThemeAttribute:@"content-inset"];
+ }
+
+
if (widthChanged)
{
optionFrame.origin.x = optionViewOriginX;
View
@@ -501,7 +501,12 @@ var RECENT_SEARCH_PREFIX = @" ";
if (_CGRectContainsPoint([self searchButtonRectForBounds:[self bounds]], point))
{
if (_searchMenuTemplate == nil)
- [self _sendAction:self];
+ {
+ if ([_searchButton target] && [_searchButton action])
+ [_searchButton mouseDown:anEvent];
+ else
+ [self _sendAction:self];
+ }
else
[self _showMenu];
}
Oops, something went wrong.

0 comments on commit 82337b8

Please sign in to comment.