mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-14 16:22:21 +00:00
Extracted RoundedTextFieldCell
This commit is contained in:
@@ -2,9 +2,9 @@
|
||||
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="8.00">
|
||||
<data>
|
||||
<int key="IBDocument.SystemTarget">1080</int>
|
||||
<string key="IBDocument.SystemVersion">12D78</string>
|
||||
<string key="IBDocument.SystemVersion">12E55</string>
|
||||
<string key="IBDocument.InterfaceBuilderVersion">3084</string>
|
||||
<string key="IBDocument.AppKitVersion">1187.37</string>
|
||||
<string key="IBDocument.AppKitVersion">1187.39</string>
|
||||
<string key="IBDocument.HIToolboxVersion">626.00</string>
|
||||
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
|
||||
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
@@ -107,7 +107,6 @@
|
||||
<string key="NSCellIdentifier">_NS:9</string>
|
||||
<reference key="NSControlView" ref="290763686"/>
|
||||
<bool key="NSDrawsBackground">YES</bool>
|
||||
<int key="NSTextBezelStyle">1</int>
|
||||
<object class="NSColor" key="NSBackgroundColor" id="955209345">
|
||||
<int key="NSColorSpace">6</int>
|
||||
<string key="NSCatalogName">System</string>
|
||||
@@ -296,6 +295,7 @@
|
||||
<string key="NSFrame">{{199, 289}, {32, 25}}</string>
|
||||
<reference key="NSSuperview" ref="87082330"/>
|
||||
<reference key="NSWindow"/>
|
||||
<reference key="NSNextKeyView"/>
|
||||
<string key="NSReuseIdentifierKey">_NS:22</string>
|
||||
<bool key="NSEnabled">YES</bool>
|
||||
<object class="NSButtonCell" key="NSCell" id="353877023">
|
||||
@@ -1531,6 +1531,7 @@
|
||||
<string key="462.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<boolean value="NO" key="463.IBNSViewMetadataTranslatesAutoresizingMaskIntoConstraints"/>
|
||||
<string key="463.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="464.CustomClassName">MPTextField</string>
|
||||
<boolean value="NO" key="464.IBNSViewMetadataTranslatesAutoresizingMaskIntoConstraints"/>
|
||||
<string key="464.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<boolean value="NO" key="465.IBNSViewMetadataTranslatesAutoresizingMaskIntoConstraints"/>
|
||||
@@ -1553,7 +1554,7 @@
|
||||
<string key="493.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="494.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="495.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="496.CustomClassName">MPRoundedTextFieldCell</string>
|
||||
<string key="496.CustomClassName">HNHRoundedTextFieldCell</string>
|
||||
<string key="496.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="497.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
<string key="498.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
|
||||
@@ -1605,6 +1606,14 @@
|
||||
</object>
|
||||
<object class="IBClassDescriber" key="IBDocument.Classes">
|
||||
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">HNHRoundedTextFieldCell</string>
|
||||
<string key="superclassName">NSTextFieldCell</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
<string key="minorKey">./Classes/HNHRoundedTextFieldCell.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">MPInspectorViewController</string>
|
||||
<string key="superclassName">MPViewController</string>
|
||||
@@ -1681,14 +1690,6 @@
|
||||
<string key="minorKey">./Classes/MPPopupImageView.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">MPRoundedTextFieldCell</string>
|
||||
<string key="superclassName">NSTextFieldCell</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
<string key="minorKey">./Classes/MPRoundedTextFieldCell.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">MPSeparator</string>
|
||||
<string key="superclassName">NSView</string>
|
||||
@@ -1697,6 +1698,14 @@
|
||||
<string key="minorKey">./Classes/MPSeparator.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">MPTextField</string>
|
||||
<string key="superclassName">NSTextField</string>
|
||||
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||
<string key="majorKey">IBProjectSource</string>
|
||||
<string key="minorKey">./Classes/MPTextField.h</string>
|
||||
</object>
|
||||
</object>
|
||||
<object class="IBPartialClassDescription">
|
||||
<string key="className">MPViewController</string>
|
||||
<string key="superclassName">NSViewController</string>
|
||||
|
||||
@@ -12,12 +12,15 @@ APPKIT_EXTERN NSString *const MPGroupNameUndoableKey;
|
||||
|
||||
@interface KdbGroup (Undo)
|
||||
|
||||
+ (NSUndoManager *)undoManager;
|
||||
- (NSUndoManager *)undoManager;
|
||||
|
||||
- (NSString *)nameUndoable;
|
||||
- (void)setNameUndoable:(NSString *)newName;
|
||||
|
||||
- (void)removeEntryUndoable:(KdbEntry *)entry;
|
||||
|
||||
- (void)addEntryUndoable:(KdbEntry *)entry;
|
||||
- (void)addGroupUndoable:(KdbGroup *)group;
|
||||
- (void)removeGroupUndoable:(KdbGroup *)group;
|
||||
- (void)removeEntryUndoable:(KdbEntry *)entry;
|
||||
|
||||
@end
|
||||
|
||||
@@ -12,7 +12,7 @@ NSString *const MPGroupNameUndoableKey = @"nameUndoable";
|
||||
|
||||
@implementation KdbGroup (Undo)
|
||||
|
||||
+ (NSUndoManager *)undoManager {
|
||||
- (NSUndoManager *)undoManager {
|
||||
return [[[NSDocumentController sharedDocumentController] currentDocument] undoManager];
|
||||
}
|
||||
|
||||
@@ -21,21 +21,32 @@ NSString *const MPGroupNameUndoableKey = @"nameUndoable";
|
||||
}
|
||||
|
||||
- (void)setNameUndoable:(NSString *)newName {
|
||||
[[KdbGroup undoManager] registerUndoWithTarget:self selector:@selector(setNameUndoable:) object:self.name];
|
||||
[[KdbGroup undoManager] setActionName:NSLocalizedString(@"UNDO_SET_NAME", "Undo set name")];
|
||||
[[self undoManager] registerUndoWithTarget:self selector:@selector(setNameUndoable:) object:self.name];
|
||||
[[self undoManager] setActionName:NSLocalizedString(@"UNDO_SET_NAME", "Undo set name")];
|
||||
self.name = newName;
|
||||
}
|
||||
|
||||
- (void)removeEntryUndoable:(KdbEntry *)entry {
|
||||
[[KdbGroup undoManager] registerUndoWithTarget:self selector:@selector(addEntryUndoable:) object:entry];
|
||||
[[KdbGroup undoManager] setActionName:NSLocalizedString(@"UNDO_DELETE_ENTRY", "Undo deleting of entry")];
|
||||
[self removeEntry:entry];
|
||||
}
|
||||
|
||||
- (void)addEntryUndoable:(KdbEntry *)entry {
|
||||
[[KdbGroup undoManager] registerUndoWithTarget:self selector:@selector(removeEntryUndoable:) object:entry];
|
||||
[[KdbGroup undoManager] setActionName:NSLocalizedString(@"UNDO_ADD_ENTRY", "Undo adding of entry")];
|
||||
[[self undoManager] registerUndoWithTarget:self selector:@selector(removeEntryUndoable:) object:entry];
|
||||
[[self undoManager] setActionName:NSLocalizedString(@"UNDO_ADD_ENTRY", "Undo adding of entry")];
|
||||
[self addEntry:entry];
|
||||
}
|
||||
|
||||
- (void)addGroupUndoable:(KdbGroup *)group {
|
||||
[[self undoManager] registerUndoWithTarget:self selector:@selector(removeGroupUndoable:) object:group];
|
||||
[[self undoManager] setActionName:NSLocalizedString(@"UNDO_ADD_GROUP", @"Create Group Undo")];
|
||||
[self addGroup:group];
|
||||
}
|
||||
|
||||
- (void)removeEntryUndoable:(KdbEntry *)entry {
|
||||
[[self undoManager] registerUndoWithTarget:self selector:@selector(addEntryUndoable:) object:entry];
|
||||
[[self undoManager] setActionName:NSLocalizedString(@"UNDO_DELETE_ENTRY", "Undo deleting of entry")];
|
||||
[self removeEntry:entry];
|
||||
}
|
||||
|
||||
- (void)removeGroupUndoable:(KdbGroup *)group {
|
||||
[[self undoManager] registerUndoWithTarget:self selector:@selector(addGroupUndoable:) object:group];
|
||||
[[self undoManager] setActionName:NSLocalizedString(@"UNDO_DELETE_GROUP", @"Create Group Undo")];
|
||||
[group.parent removeGroup:group];
|
||||
}
|
||||
@end
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#import "MPActionHelper.h"
|
||||
#import "MPSettingsHelper.h"
|
||||
#import "NSString+MPPasswordCreation.h"
|
||||
#import "MPUppercaseStringValueTransformer.h"
|
||||
|
||||
@interface MPAppDelegate ()
|
||||
|
||||
@@ -28,6 +29,7 @@
|
||||
|
||||
+ (void)initialize {
|
||||
[MPSettingsHelper setupDefaults];
|
||||
[MPUppercaseStringValueTransformer registerTransformer];
|
||||
}
|
||||
|
||||
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
|
||||
|
||||
APPKIT_EXTERN NSString *const MPDocumentDidAddGroupNotification;
|
||||
APPKIT_EXTERN NSString *const MPDocumentDidDelteGroupNotification;
|
||||
APPKIT_EXTERN NSString *const MPDocumentWillDelteGroupNotification;
|
||||
APPKIT_EXTERN NSString *const MPDocumentDidAddEntryNotification;
|
||||
APPKIT_EXTERN NSString *const MPDocumentDidDeleteEntryNotification;
|
||||
APPKIT_EXTERN NSString *const MPDocumentWillDeleteEntryNotification;
|
||||
|
||||
APPKIT_EXTERN NSString *const MPDocumentEntryKey;
|
||||
APPKIT_EXTERN NSString *const MPDocumentGroupKey;
|
||||
@@ -36,7 +36,6 @@ APPKIT_EXTERN NSString *const MPDocumentGroupKey;
|
||||
- (KdbGroup *)createGroup:(KdbGroup *)parent;
|
||||
- (KdbEntry *)createEntry:(KdbGroup *)parent;
|
||||
|
||||
- (void)addGroup:(NSArray *)groupAndParent;
|
||||
- (void)deleteEntry:(KdbEntry *)entry;
|
||||
- (void)deleteGroup:(KdbGroup *)group;
|
||||
|
||||
|
||||
@@ -13,11 +13,13 @@
|
||||
#import "Kdb4Node.h"
|
||||
#import "KdbPassword.h"
|
||||
#import "MPDatabaseVersion.h"
|
||||
#import "KdbGroup+Undo.h"
|
||||
#import "KdbEntry+Undo.h"
|
||||
|
||||
NSString *const MPDocumentDidAddGroupNotification = @"MPDocumentDidAddGroupNotification";
|
||||
NSString *const MPDocumentDidDelteGroupNotification = @"MPDocumentDidDelteGroupNotification";
|
||||
NSString *const MPDocumentWillDelteGroupNotification = @"MPDocumentDidDelteGroupNotification";
|
||||
NSString *const MPDocumentDidAddEntryNotification = @"MPDocumentDidAddEntryNotification";
|
||||
NSString *const MPDocumentDidDeleteEntryNotification = @"MPDocumentDidDeleteEntryNotification";
|
||||
NSString *const MPDocumentWillDeleteEntryNotification = @"MPDocumentDidDeleteEntryNotification";
|
||||
|
||||
NSString *const MPDocumentEntryKey = @"MPDocumentEntryKey";
|
||||
NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey";
|
||||
@@ -30,7 +32,6 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey";
|
||||
@property (nonatomic, readonly) KdbPassword *passwordHash;
|
||||
@property (assign) MPDatabaseVersion version;
|
||||
@property (assign) BOOL isDecrypted;
|
||||
@property (assign) BOOL isDirty;
|
||||
|
||||
@end
|
||||
|
||||
@@ -138,50 +139,34 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGroupKey";
|
||||
- (KdbEntry *)createEntry:(KdbGroup *)parent {
|
||||
KdbEntry *newEntry = [self.tree createEntry:parent];
|
||||
newEntry.title = NSLocalizedString(@"DEFAULT_ENTRY_TITLE", @"Title for a newly created entry");
|
||||
[[self undoManager] registerUndoWithTarget:self selector:@selector(deleteEntry:) object:newEntry];
|
||||
[[self undoManager] setActionName:NSLocalizedString(@"UNDO_ADD_ENTRY", @"Create Entry Undo")];
|
||||
[parent addEntry:newEntry];
|
||||
[parent addEntryUndoable:newEntry];
|
||||
NSDictionary *userInfo = @{ MPDocumentEntryKey : newEntry };
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:MPDocumentDidAddEntryNotification object:self userInfo:userInfo];
|
||||
return newEntry;
|
||||
}
|
||||
|
||||
- (KdbGroup *)createGroup:(KdbGroup *)parent {
|
||||
KdbGroup *newGroup = [self.tree createGroup:parent];
|
||||
newGroup.name = NSLocalizedString(@"DEFAULT_GROUP_NAME", @"Title for a newly created group");
|
||||
|
||||
[[self undoManager] registerUndoWithTarget:self selector:@selector(deleteGroup:) object:newGroup];
|
||||
[[self undoManager] setActionName:NSLocalizedString(@"UNDO_ADD_GROUP", @"Create Group Undo")];
|
||||
[parent addGroup:newGroup];
|
||||
NSDictionary *userInfo = @{ MPDocumentGroupKey:newGroup };
|
||||
[parent addGroupUndoable:newGroup];
|
||||
NSDictionary *userInfo = @{ MPDocumentGroupKey : newGroup };
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:MPDocumentDidAddGroupNotification object:self userInfo:userInfo];
|
||||
self.isDirty = YES;
|
||||
|
||||
return newGroup;
|
||||
}
|
||||
|
||||
- (void)addGroup:(NSArray *)groupAndParent{
|
||||
KdbGroup *parent = groupAndParent[0];
|
||||
KdbGroup *group = groupAndParent[1];
|
||||
NSDictionary *userInfo = @{ MPDocumentGroupKey:group };
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:MPDocumentDidAddGroupNotification object:self userInfo:userInfo];
|
||||
[parent addGroup:group];
|
||||
}
|
||||
|
||||
- (void)deleteEntry:(KdbEntry *)entry {
|
||||
if(entry.parent) {
|
||||
[entry.parent removeEntry:entry];
|
||||
self.isDirty = YES;
|
||||
NSDictionary *userInfo = @{ MPDocumentEntryKey : entry };
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:MPDocumentWillDeleteEntryNotification object:self userInfo:userInfo];
|
||||
[entry.parent removeEntryUndoable:entry];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)deleteGroup:(KdbGroup *)group {
|
||||
if(group.parent) {
|
||||
[[self undoManager] registerUndoWithTarget:self selector:@selector(addGroup:) object:@[group.parent, group]];
|
||||
[[self undoManager] setActionName:NSLocalizedString(@"UNDO_DELETE_GROUP", @"Create Group Undo")];
|
||||
[group.parent removeGroup:group];
|
||||
NSDictionary *userInfo = @{ MPDocumentEntryKey:group };
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:MPDocumentDidDelteGroupNotification object:self userInfo:userInfo];
|
||||
|
||||
self.isDirty = YES;
|
||||
NSDictionary *userInfo = @{ MPDocumentEntryKey : group };
|
||||
[[NSNotificationCenter defaultCenter] postNotificationName:MPDocumentWillDelteGroupNotification object:self userInfo:userInfo];
|
||||
[group.parent removeGroupUndoable:group];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#import "MPPasteBoardController.h"
|
||||
#import "MPOverlayWindowController.h"
|
||||
#import "KdbGroup+MPAdditions.h"
|
||||
#import "KdbGroup+Undo.h"
|
||||
#import "KdbEntry+Undo.h"
|
||||
|
||||
NSString *const MPDidChangeSelectedEntryNotification = @"com.macpass.MPDidChangeSelectedEntryNotification";
|
||||
@@ -136,6 +137,7 @@ NSString *const _toggleFilterUsernameButton = @"SearchUsername";
|
||||
name:MPOutlineViewDidChangeGroupSelection
|
||||
object:windowController.outlineViewController.outlineDelegate];
|
||||
|
||||
//[[NSNotificationCenter defaultCenter] addObserver:self.entryTable selector:@selector(reloadData) name:MPDocumentDidAddEntryNotification object:nil];
|
||||
|
||||
[self.entryTable setDelegate:self];
|
||||
[self.entryTable setDoubleAction:@selector(_columnDoubleClick:)];
|
||||
@@ -244,14 +246,13 @@ NSString *const _toggleFilterUsernameButton = @"SearchUsername";
|
||||
[self.filterSearchField setStringValue:@""];
|
||||
}
|
||||
MPOutlineViewDelegate *delegate = [notification object];
|
||||
KdbGroup *group = delegate.selectedGroup;
|
||||
//[self.entryTable deselectAll:nil];
|
||||
if(group) {
|
||||
[self.entryArrayController setContent:nil];
|
||||
[self.entryArrayController addObjects:group.entries];
|
||||
self.activeGroup = delegate.selectedGroup;
|
||||
|
||||
if(_activeGroup) {
|
||||
[self.entryArrayController bind:NSContentArrayBinding toObject:_activeGroup withKeyPath:@"entries" options:nil];
|
||||
}
|
||||
else {
|
||||
[self.entryArrayController setContent:nil];
|
||||
[self.entryArrayController unbind:NSContentArrayBinding];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -478,7 +479,11 @@ NSString *const _toggleFilterUsernameButton = @"SearchUsername";
|
||||
}
|
||||
|
||||
- (void)createEntry:(id)sender {
|
||||
// TODO:
|
||||
if(!_activeGroup) {
|
||||
return; // Entries are not allowed in root group
|
||||
}
|
||||
MPDocument *document = [[NSDocumentController sharedDocumentController] currentDocument];
|
||||
[document createEntry:_activeGroup];
|
||||
}
|
||||
|
||||
- (void)deleteEntry:(id)sender {
|
||||
|
||||
@@ -9,12 +9,14 @@
|
||||
#import "MPViewController.h"
|
||||
|
||||
@class MPOutlineViewDelegate;
|
||||
@class KdbGroup;
|
||||
|
||||
@interface MPOutlineViewController : MPViewController
|
||||
|
||||
@property (retain, readonly) MPOutlineViewDelegate *outlineDelegate;
|
||||
@property (assign, nonatomic) BOOL isVisible;
|
||||
|
||||
|
||||
- (void)clearSelection;
|
||||
- (void)showOutline;
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self
|
||||
selector:@selector(_didUpdateData:)
|
||||
name:MPDocumentDidDelteGroupNotification
|
||||
name:MPDocumentWillDelteGroupNotification
|
||||
object:[[self windowController] document]];
|
||||
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
|
||||
#import "MPOutlineViewDelegate.h"
|
||||
#import "MPIconHelper.h"
|
||||
#import "MPUppercaseStringValueTransformer.h"
|
||||
#import "KdbLib.h"
|
||||
|
||||
NSString *const MPOutlineViewDidChangeGroupSelection = @"com.macpass.MPOutlineViewDidChangeGroupSelection";
|
||||
@@ -27,8 +28,9 @@ NSString *const _MPOutlinveViewHeaderViewIdentifier = @"HeaderCell";
|
||||
KdbGroup *group = item;
|
||||
NSTableCellView *view;
|
||||
if(![group parent]) {
|
||||
NSDictionary *options = @{ NSValueTransformerBindingOption : [NSValueTransformer valueTransformerForName:MPUppsercaseStringValueTransformerName] };
|
||||
view = [outlineView makeViewWithIdentifier:_MPOutlinveViewHeaderViewIdentifier owner:self];
|
||||
[view.textField bind:NSValueBinding toObject:group withKeyPath:@"name" options:nil];
|
||||
[view.textField bind:NSValueBinding toObject:group withKeyPath:@"name" options:options];
|
||||
}
|
||||
else {
|
||||
view = [outlineView makeViewWithIdentifier:_MPOutlineViewDataViewIdentifier owner:self];
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
//
|
||||
// MPRoundedTextFieldCell.h
|
||||
// MacPass
|
||||
//
|
||||
// Created by Michael Starke on 01.06.13.
|
||||
// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@interface MPRoundedTextFieldCell : NSTextFieldCell
|
||||
|
||||
|
||||
@end
|
||||
@@ -1,51 +0,0 @@
|
||||
//
|
||||
// MPRoundedTextFieldCell.m
|
||||
// MacPass
|
||||
//
|
||||
// Created by Michael Starke on 01.06.13.
|
||||
// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved.
|
||||
//
|
||||
|
||||
#import "MPRoundedTextFieldCell.h"
|
||||
|
||||
#define CORNER_RADIUS 3.0
|
||||
|
||||
@implementation MPRoundedTextFieldCell
|
||||
|
||||
- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView {
|
||||
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];
|
||||
|
||||
[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
|
||||
@@ -7,33 +7,19 @@
|
||||
//
|
||||
|
||||
#import "MPTextField.h"
|
||||
#import "MPRoundedTextFieldCell.h"
|
||||
#import "HNHRoundedTextFieldCell.h"
|
||||
|
||||
@implementation MPTextField
|
||||
|
||||
+ (Class)cellClass {
|
||||
return [MPRoundedTextFieldCell class];
|
||||
return [HNHRoundedTextFieldCell class];
|
||||
}
|
||||
|
||||
- (id)initWithCoder:(NSCoder *)aDecoder {
|
||||
self = [super initWithCoder:aDecoder];
|
||||
if(self) {
|
||||
MPRoundedTextFieldCell *newCell = [[MPRoundedTextFieldCell alloc] init];
|
||||
NSTextFieldCell *cell = [self cell];
|
||||
[newCell setBackgroundStyle:[cell backgroundStyle]];
|
||||
[newCell setBezeled:[cell isBezeled]];
|
||||
[newCell setBordered:[cell isBordered]];
|
||||
[newCell setBackgroundColor:[cell backgroundColor]];
|
||||
[newCell setTextColor:[cell textColor]];
|
||||
[newCell setDrawsBackground:[cell drawsBackground]];
|
||||
[newCell setAction:[cell action]];
|
||||
[newCell setTarget:[cell target]];
|
||||
[newCell setEditable:[cell isEditable]];
|
||||
[newCell setEnabled:[cell isEnabled]];
|
||||
[self setCell:newCell];
|
||||
[newCell release];
|
||||
- (void)awakeFromNib {
|
||||
[[self class] setCellClass:[HNHRoundedTextFieldCell class]];
|
||||
if([[super class] instanceMethodForSelector:@selector(awakeFromNib)]) {
|
||||
[super awakeFromNib];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
17
MacPass/MPUppercaseStringValueTransformer.h
Normal file
17
MacPass/MPUppercaseStringValueTransformer.h
Normal file
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// MPUppercaseStringValueTransformer.h
|
||||
// MacPass
|
||||
//
|
||||
// Created by Michael Starke on 03.06.13.
|
||||
// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved.
|
||||
//
|
||||
|
||||
APPKIT_EXTERN NSString *const MPUppsercaseStringValueTransformerName;
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface MPUppercaseStringValueTransformer : NSValueTransformer
|
||||
|
||||
+ (void)registerTransformer;
|
||||
|
||||
@end
|
||||
37
MacPass/MPUppercaseStringValueTransformer.m
Normal file
37
MacPass/MPUppercaseStringValueTransformer.m
Normal file
@@ -0,0 +1,37 @@
|
||||
//
|
||||
// MPUppercaseStringValueTransformer.m
|
||||
// MacPass
|
||||
//
|
||||
// Created by Michael Starke on 03.06.13.
|
||||
// Copyright (c) 2013 HicknHack Software GmbH. All rights reserved.
|
||||
//
|
||||
|
||||
#import "MPUppercaseStringValueTransformer.h"
|
||||
|
||||
NSString *const MPUppsercaseStringValueTransformerName = @"StringToUppercaseStringTransformer";
|
||||
|
||||
@implementation MPUppercaseStringValueTransformer
|
||||
|
||||
+ (Class)transformedValueClass {
|
||||
return [NSString class];
|
||||
}
|
||||
|
||||
+ (BOOL)allowsReverseTransformation {
|
||||
return NO;
|
||||
}
|
||||
|
||||
+ (void)registerTransformer {
|
||||
MPUppercaseStringValueTransformer *transformer = [[MPUppercaseStringValueTransformer alloc] init];
|
||||
[NSValueTransformer setValueTransformer:transformer
|
||||
forName:MPUppsercaseStringValueTransformerName];
|
||||
[transformer release];
|
||||
}
|
||||
|
||||
- (id)transformedValue:(id)value {
|
||||
if([value respondsToSelector:@selector(uppercaseString)]) {
|
||||
return [value uppercaseString];
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -46,7 +46,7 @@
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>7F1</string>
|
||||
<string>863</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>${MACOSX_DEPLOYMENT_TARGET}</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
|
||||
@@ -20,7 +20,6 @@ static NSUInteger randomInteger(NSUInteger minimum, NSUInteger maximum) {
|
||||
return maximum;
|
||||
}
|
||||
if( delta < 0 ) {
|
||||
maximum = minimum;
|
||||
minimum -= delta;
|
||||
delta = -delta;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user