From 8c4383b4d1e9a5e663ffa9bca995da48b0e88cb5 Mon Sep 17 00:00:00 2001 From: michael starke Date: Sun, 2 Jun 2013 19:12:09 +0200 Subject: [PATCH] Improvements on rounded textviews. Indentation seems broken --- MacPass/InspectorView.xib | 11 ++++- MacPass/MPRoundedTextFieldCell.m | 38 ++++++++++++++--- MacPass/MPSeparator.m | 1 - MacPass/MacPass-Info.plist | 2 +- MacPass/PasswordInputView.xib | 73 +------------------------------- 5 files changed, 43 insertions(+), 82 deletions(-) diff --git a/MacPass/InspectorView.xib b/MacPass/InspectorView.xib index 834bf910..dd571ac5 100644 --- a/MacPass/InspectorView.xib +++ b/MacPass/InspectorView.xib @@ -107,6 +107,7 @@ _NS:9 YES + 1 6 System @@ -295,7 +296,6 @@ {{199, 289}, {32, 25}} - _NS:22 YES @@ -1553,6 +1553,7 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + MPRoundedTextFieldCell com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -1680,6 +1681,14 @@ ./Classes/MPPopupImageView.h + + MPRoundedTextFieldCell + NSTextFieldCell + + IBProjectSource + ./Classes/MPRoundedTextFieldCell.h + + MPSeparator NSView diff --git a/MacPass/MPRoundedTextFieldCell.m b/MacPass/MPRoundedTextFieldCell.m index d0c6027c..a90fb017 100644 --- a/MacPass/MPRoundedTextFieldCell.m +++ b/MacPass/MPRoundedTextFieldCell.m @@ -8,20 +8,44 @@ #import "MPRoundedTextFieldCell.h" -#define CORNER_RADIUS 10.0 +#define CORNER_RADIUS 3.0 @implementation MPRoundedTextFieldCell - (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView { - NSBezierPath *path = [NSBezierPath bezierPathWithRoundedRect:cellFrame xRadius:CORNER_RADIUS yRadius:CORNER_RADIUS]; - [[NSColor clearColor] set]; - NSRectFill(cellFrame); - [[NSColor blackColor] setStroke]; + NSRect pathRect = NSInsetRect(cellFrame, 0.5, 0.5); + NSBezierPath *path = [NSBezierPath bezierPathWithRoundedRect:pathRect xRadius:CORNER_RADIUS yRadius:CORNER_RADIUS]; + [([self isEnabled] ? [NSColor colorWithCalibratedWhite:0.55 alpha:1] : [NSColor colorWithCalibratedWhite:0.75 alpha:1]) setStroke]; [[NSColor whiteColor] setFill]; [path fill]; - [path stroke]; - //[super drawWithFrame:cellFrame inView:controlView]; + [NSGraphicsContext saveGraphicsState]; + NSShadow *shadow = [[NSShadow alloc] init]; + [shadow setShadowColor:[NSColor colorWithCalibratedWhite:0.8 alpha:1]]; + [shadow setShadowOffset:NSMakeSize(0, -1)]; + [shadow setShadowBlurRadius:2]; + [shadow set]; + [path setClip]; + [path stroke]; + [shadow release]; + + [NSGraphicsContext restoreGraphicsState]; + [path stroke]; + //[shadow release]; + [super drawInteriorWithFrame:cellFrame inView:controlView]; } +- (void)drawFocusRingMaskWithFrame:(NSRect)cellFrame inView:(NSView *)controlView { + NSLog(@"drawFocusRing"); + //NSBezierPath *path = [NSBezierPath bezierPathWithRoundedRect:cellFrame xRadius:CORNER_RADIUS yRadius:CORNER_RADIUS]; + //[path stroke]; + [super drawFocusRingMaskWithFrame:cellFrame inView:controlView]; +} + +- (NSRect)focusRingMaskBoundsForFrame:(NSRect)cellFrame inView:(NSView *)controlView { + return [controlView bounds]; +} + + + @end diff --git a/MacPass/MPSeparator.m b/MacPass/MPSeparator.m index 679bb827..32657653 100644 --- a/MacPass/MPSeparator.m +++ b/MacPass/MPSeparator.m @@ -11,7 +11,6 @@ @implementation MPSeparator - (void)drawRect:(NSRect)dirtyRect { - NSRect bounds = [self bounds]; [[NSColor lightGrayColor] set]; NSRectFill(NSMakeRect(0, 1, NSWidth(bounds), 1)); diff --git a/MacPass/MacPass-Info.plist b/MacPass/MacPass-Info.plist index 921e3425..93c20cbc 100644 --- a/MacPass/MacPass-Info.plist +++ b/MacPass/MacPass-Info.plist @@ -46,7 +46,7 @@ CFBundleSignature ???? CFBundleVersion - 796 + 7F1 LSMinimumSystemVersion ${MACOSX_DEPLOYMENT_TARGET} NSHumanReadableCopyright diff --git a/MacPass/PasswordInputView.xib b/MacPass/PasswordInputView.xib index d2b7bb3b..7bc03951 100644 --- a/MacPass/PasswordInputView.xib +++ b/MacPass/PasswordInputView.xib @@ -51,7 +51,6 @@ 268 {{96, 175}, {184, 17}} - _NS:1535 YES @@ -100,7 +99,6 @@ {{157, 200}, {48, 48}} - _NS:9 YES @@ -125,7 +123,6 @@ 268 {{127, 50}, {82, 32}} - _NS:9 YES @@ -154,7 +151,6 @@ {{83, 94}, {197, 22}} - _NS:9 YES @@ -179,7 +175,6 @@ 268 {{86, 123}, {191, 22}} - _NS:9 YES @@ -217,7 +212,6 @@ 268 {{17, 126}, {64, 17}} - _NS:1535 YES @@ -238,7 +232,6 @@ 268 {{35, 99}, {46, 17}} - _NS:1535 YES @@ -259,7 +252,6 @@ 268 {{209, 50}, {74, 32}} - _NS:9 {250, 250} YES @@ -282,7 +274,6 @@ {362, 268} - {751, 750} NSView @@ -1096,69 +1087,7 @@ 295 - - - - MPPasswordInputController - MPViewController - - _decrypt: - id - - - _decrypt: - - _decrypt: - id - - - - NSImageView - NSTextField - NSPathControl - NSSecureTextField - - - - errorImageView - NSImageView - - - errorInfoTextField - NSTextField - - - keyPathControl - NSPathControl - - - passwordTextField - NSSecureTextField - - - - IBProjectSource - ./Classes/MPPasswordInputController.h - - - - MPViewController - NSViewController - - IBProjectSource - ./Classes/MPViewController.h - - - - NSLayoutConstraint - NSObject - - IBProjectSource - ./Classes/NSLayoutConstraint.h - - - - + 0 IBCocoaFramework YES