From eca5ef6f843fa4cfeef3d9355ce43c28b8b17d2f Mon Sep 17 00:00:00 2001 From: cacaodev Date: Sat, 19 Jan 2013 17:08:34 +0100 Subject: [PATCH] Fix textfield in rules croped --- .../CPRuleEditor/_CPRuleEditorViewSliceRow.j | 30 +++++-------------- 1 file changed, 7 insertions(+), 23 deletions(-) diff --git a/AppKit/CPRuleEditor/_CPRuleEditorViewSliceRow.j b/AppKit/CPRuleEditor/_CPRuleEditorViewSliceRow.j index 638f6be84..af9f68572 100644 --- a/AppKit/CPRuleEditor/_CPRuleEditorViewSliceRow.j +++ b/AppKit/CPRuleEditor/_CPRuleEditorViewSliceRow.j @@ -128,15 +128,16 @@ var CONTROL_HEIGHT = 16., - (_CPRuleEditorTextField)_createStaticTextFieldWithStringValue:(CPString)text { - var textField = [[_CPRuleEditorTextField alloc] initWithFrame:CPMakeRect(0, 0, 200, CONTROL_HEIGHT)], - refont = [_ruleEditor font], - font = [CPFont fontWithName:[refont familyName] size:[refont size] + 2], + var textField = [[_CPRuleEditorTextField alloc] initWithFrame:CGRectMakeZero()], + ruleEditorFont = [_ruleEditor font], + font = [CPFont fontWithName:[ruleEditorFont familyName] size:[ruleEditorFont size] + 2], + localizedText = [[_ruleEditor standardLocalizer] localizedStringForString:text], + size = [localizedText sizeWithFont:font]; - localizedText = [[_ruleEditor standardLocalizer] localizedStringForString:text]; + [textField setFrameSize:CGSizeMake(size.width + 4, CONTROL_HEIGHT + 2)]; [textField setValue:font forThemeAttribute:@"font"]; [textField setStringValue:localizedText]; - [textField sizeToFit]; return textField; } @@ -358,14 +359,6 @@ var CONTROL_HEIGHT = 16., 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; @@ -485,13 +478,6 @@ var CONTROL_HEIGHT = 16., return NO; } -- (BOOL)_isRuleStaticTextField:(CPView)view -{ - if ([view isKindOfClass:[_CPRuleEditorTextField class]]) - return YES; - return NO; -} - - (void)_sendRuleAction:(id)sender { [_ruleEditor _updatePredicate]; @@ -513,10 +499,8 @@ var CONTROL_HEIGHT = 16., - (id)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; - if (self != nil) + if (self) { - [self setBordered:NO]; - [self setEditable:NO]; [self setDrawsBackground:NO]; }