From 7e502fffe6b328f2491991466d3d4713a143af07 Mon Sep 17 00:00:00 2001 From: Alexandre Wilhelm Date: Mon, 14 Jan 2013 15:07:40 -0800 Subject: [PATCH 1/2] Fixed bug in CPStepper for the automatic size of it when calling a static constructor --- AppKit/CPStepper.j | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/AppKit/CPStepper.j b/AppKit/CPStepper.j index 76c7a3c9d..78dcce919 100644 --- a/AppKit/CPStepper.j +++ b/AppKit/CPStepper.j @@ -55,11 +55,15 @@ */ + (CPStepper)stepperWithInitialValue:(float)aValue minValue:(float)aMinValue maxValue:(float)aMaxValue { - var stepper = [[CPStepper alloc] initWithFrame:_CGRectMake(0, 0, 19, 25)]; + var stepper = [[CPStepper alloc] initWithFrame:_CGRectMakeZero()]; + [stepper setDoubleValue:aValue]; [stepper setMinValue:aMinValue]; [stepper setMaxValue:aMaxValue]; + // _sizeToFit will put the good size for the stepper depending of the current theme + [stepper _sizeToFit]; + return stepper; } @@ -155,7 +159,7 @@ - (void)setFrame:(CGRect)aFrame { - var upSize = [self valueForThemeAttribute:@"up-button-size"], + var upSize = [self valueForThemeAttribute:@"up-button-size"], downSize = [self valueForThemeAttribute:@"down-button-size"], minSize = _CGSizeMake(upSize.width, upSize.height + downSize.height), frame = _CGRectMakeCopy(aFrame); @@ -184,6 +188,11 @@ [_buttonDown setValue:[self valueForThemeAttribute:@"bezel-color-down-button" inState:CPThemeStateBordered | CPThemeStateHighlighted] forThemeAttribute:@"bezel-color" inState:CPThemeStateBordered | CPThemeStateHighlighted]; } +- (void)_sizeToFit +{ + [self setFrame:CGRectMake([self frameOrigin].x, [self frameOrigin].y, 0, 0)]; +} + /*! Set if CPStepper should autorepeat. @param shouldAutoRepeat if YES, the first mouse down does one increment (decrement) and, after each delay of 0.5 seconds From 2a80ad834433a971b6c04f6815eaca324cb5a25b Mon Sep 17 00:00:00 2001 From: Antoine Mercadal Date: Mon, 14 Jan 2013 17:34:09 -0800 Subject: [PATCH 2/2] Fix bezel inset of focused textfields --- AppKit/Themes/Aristo2/ThemeDescriptors.j | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AppKit/Themes/Aristo2/ThemeDescriptors.j b/AppKit/Themes/Aristo2/ThemeDescriptors.j index af88adbdd..31acce05f 100644 --- a/AppKit/Themes/Aristo2/ThemeDescriptors.j +++ b/AppKit/Themes/Aristo2/ThemeDescriptors.j @@ -631,7 +631,7 @@ var themedButtonValues = nil, [@"content-inset", CGInsetMake(8.0, 7.0, 5.0, 8.0), CPThemeStateBezeled], [@"content-inset", CGInsetMake(8.0, 7.0, 5.0, 8.0), CPThemeStateBezeled | CPThemeStateEditing], [@"bezel-inset", CGInsetMake(3.0, 4.0, 3.0, 4.0), CPThemeStateBezeled], - [@"bezel-inset", CGInsetMake(1.0, 1.0, 1.0, 1.0), CPThemeStateBezeled | CPThemeStateEditing], + [@"bezel-inset", CGInsetMake(0.0, 1.0, 0.0, 1.0), CPThemeStateBezeled | CPThemeStateEditing], [@"text-color", placeholderColor, CPTextFieldStatePlaceholder],