From 514477d6fc36e30b1a42c3de83ffef9c099d5c04 Mon Sep 17 00:00:00 2001 From: michael starke Date: Sun, 28 Jul 2013 14:14:32 +0200 Subject: [PATCH] Iconselection view now shows available icons --- MacPass/Base.lproj/InspectorView.xib | 471 +++++------------------ MacPass/IconSelection.xib | 218 ++++++----- MacPass/MPEntryInspectorViewController.m | 4 - MacPass/MPIconSelectViewController.h | 2 + MacPass/MPIconSelectViewController.m | 8 +- MacPass/MPInspectorViewController.h | 6 +- MacPass/MPInspectorViewController.m | 19 + 7 files changed, 228 insertions(+), 500 deletions(-) diff --git a/MacPass/Base.lproj/InspectorView.xib b/MacPass/Base.lproj/InspectorView.xib index e9503c88..a924845d 100644 --- a/MacPass/Base.lproj/InspectorView.xib +++ b/MacPass/Base.lproj/InspectorView.xib @@ -43,7 +43,7 @@ 268 - + 268 {{57, 409}, {204, 17}} @@ -53,17 +53,17 @@ _NS:1535 {249, 750} YES - + 67108928 272636224 Label - + LucidaGrande 13 1044 _NS:1535 - + 6 System @@ -85,7 +85,7 @@ NO - + 268 @@ -99,10 +99,10 @@ {{20, 401}, {32, 32}} - + _NS:9 YES - + 134217728 33554432 @@ -121,78 +121,11 @@ 268 - - - - 268 - - Apple PDF pasteboard type - Apple PICT pasteboard type - Apple PNG pasteboard type - NSFilenamesPboardType - NeXT Encapsulated PostScript v1.2 pasteboard type - NeXT TIFF v4.0 pasteboard type - - {{20, 7}, {16, 16}} - - - - _NS:9 - YES - - 134217728 - 33554432 - - NSImage - 99_CreatedTemplate - - _NS:9 - 0 - 0 - 0 - NO - - NO - YES - - - - 268 - - Apple PDF pasteboard type - Apple PICT pasteboard type - Apple PNG pasteboard type - NSFilenamesPboardType - NeXT Encapsulated PostScript v1.2 pasteboard type - NeXT TIFF v4.0 pasteboard type - - {{131, 7}, {16, 16}} - - - - _NS:9 - YES - - 134217728 - 33554432 - - NSImage - 07_NotepadTemplate - - _NS:9 - 0 - 0 - 0 - NO - - NO - YES - - + {278, 30} - + _NS:9 HNHGradientView @@ -282,7 +215,7 @@ - + 6 YES YES @@ -294,7 +227,7 @@ {278, 443} - + _NS:9 NSView @@ -309,22 +242,6 @@ 2976 - - - modifiedImageView - - - - 2662 - - - - createdImageView - - - - 2661 - noSelectionInfo @@ -353,7 +270,7 @@ itemImageView - + 3024 @@ -361,10 +278,18 @@ itemNameTextField - + 3025 + + + showImagePopup: + + + + 3095 + @@ -460,11 +385,11 @@ 29 3 - + 6 0 - + 6 1 @@ -476,11 +401,11 @@ 40 3 - - + + 5 0 - + 6 1 @@ -492,11 +417,11 @@ 40 3 - - + + 10 0 - + 10 1 @@ -508,7 +433,7 @@ 24 2 - + 3 0 @@ -556,8 +481,8 @@ 29 3 - - + + 5 0 @@ -572,8 +497,8 @@ 40 3 - - + + 3 0 @@ -590,8 +515,8 @@ - - + + @@ -646,86 +571,6 @@ 2930 - - - 9 - 0 - - 9 - 1 - - 0.0 - - 1000 - - 5 - 22 - 2 - - - - 10 - 0 - - 10 - 1 - - 0.0 - - 1000 - - 5 - 22 - 2 - - - - 4 - 0 - - 4 - 1 - - 0.0 - - 1000 - - 6 - 24 - 2 - - - - 5 - 0 - - 5 - 1 - - 20 - - 1000 - - 8 - 29 - 3 - - - - 3 - 0 - - 3 - 1 - - 0.0 - - 1000 - - 6 - 24 - 2 - 8 @@ -742,8 +587,6 @@ 40 1 - - @@ -784,7 +627,7 @@ 2975 - + 10 0 @@ -820,120 +663,6 @@ - - 2651 - - - - - - 7 - 0 - - 0 - 1 - - 16 - - 1000 - - 3 - 9 - 1 - - - - - - 2654 - - - - - 2652 - - - - - 2979 - - - - - 2632 - - - - - 7 - 0 - - 0 - 1 - - 16 - - 1000 - - 3 - 9 - 1 - - - - 8 - 0 - - 0 - 1 - - 16 - - 1000 - - 3 - 9 - 1 - - - - - - - 2646 - - - - - 2648 - - - - - 2633 - - - - - 2981 - - - - - 2982 - - - - - 2983 - - - - - 2984 - - - 2985 @@ -949,11 +678,11 @@ 2998 - + - - - + + + 8 0 @@ -963,13 +692,13 @@ 32 1000 - + 3 9 1 - - + + 7 0 @@ -979,7 +708,7 @@ 32 1000 - + 9 40 1 @@ -989,21 +718,21 @@ 2999 - - + + 3013 - + - + 3014 - - + + 2991 @@ -1012,47 +741,47 @@ 3023 - + 3027 - - + + 3028 - - + + 3068 - + 3069 - + 3072 - + 3073 - + 3076 - + 3075 - + @@ -1061,31 +790,15 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - - - - - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - - - - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - - + + - - - - + + + + @@ -1110,11 +823,6 @@ com.apple.InterfaceBuilder.CocoaPlugin - - - - - com.apple.InterfaceBuilder.CocoaPlugin @@ -1126,22 +834,17 @@ com.apple.InterfaceBuilder.CocoaPlugin - + com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin MPPopupImageView - - + + com.apple.InterfaceBuilder.CocoaPlugin @@ -1163,7 +866,7 @@ - 3078 + 3095 @@ -1178,13 +881,22 @@ MPInspectorViewController MPViewController + + showImagePopup: + id + + + showImagePopup: + + showImagePopup: + id + + HNHGradientView - NSImageView NSTextField MPPopupImageView NSTextField - NSImageView NSTextField NSTextField NSTabView @@ -1194,10 +906,6 @@ bottomBar HNHGradientView - - createdImageView - NSImageView - createdTextField NSTextField @@ -1210,10 +918,6 @@ itemNameTextField NSTextField - - modifiedImageView - NSImageView - modifiedTextField NSTextField @@ -1262,11 +966,10 @@ IBCocoaFramework YES 3 - - {128, 128} - {128, 128} - {15, 15} - + + NSActionTemplate + {15, 15} + YES diff --git a/MacPass/IconSelection.xib b/MacPass/IconSelection.xib index 6aba471d..b2d06fcf 100644 --- a/MacPass/IconSelection.xib +++ b/MacPass/IconSelection.xib @@ -45,7 +45,7 @@ 268 - {{147, 18}, {118, 25}} + {{182, 18}, {118, 25}} _NS:22 @@ -81,7 +81,7 @@ 4370 - {243, 238} + {300, 250} @@ -105,7 +105,7 @@ 0 - {{1, 1}, {243, 238}} + {300, 250} @@ -151,12 +151,12 @@ 0.63157892227172852 - {{20, 50}, {245, 240}} + {{10, 50}, {300, 250}} _NS:76 - 133682 + 133680 @@ -165,7 +165,7 @@ 1 - {285, 310} + {320, 310} @@ -179,7 +179,7 @@ 268 - {{10, 10}, {40, 40}} + {{9, 9}, {32, 32}} _NS:9 @@ -191,8 +191,8 @@ _NS:9 - -2039201792 - 65 + 141836288 + 66 NSImage NSAddTemplate @@ -205,7 +205,7 @@ NO - {60, 60} + {50, 50} @@ -255,6 +255,22 @@ 128 + + + image: representedObject + + + + + + image: representedObject + image + representedObject + 2 + + + 139 + @@ -286,7 +302,6 @@ 1 - 3 @@ -342,13 +357,13 @@ 5 1 - - 20 + + 10 1000 - 8 - 29 + 9 + 40 3 @@ -358,13 +373,13 @@ 6 1 - - 20 + + 10 1000 - 8 - 29 + 9 + 40 3 @@ -374,16 +389,17 @@ 3 1 - - 20 + + 10 1000 - 8 - 29 + 9 + 40 3 + @@ -417,11 +433,6 @@ - - 88 - - - 101 @@ -450,11 +461,6 @@ - - 111 - - - 112 @@ -464,27 +470,11 @@ 113 - - - 10 - 0 - - 10 - 1 - - 0.0 - - 1000 - - 9 - 40 - 2 - - - + + 9 0 - + 9 1 @@ -492,8 +482,24 @@ 1000 - 9 - 40 + 5 + 22 + 2 + + + + 10 + 0 + + 10 + 1 + + 0.0 + + 1000 + + 5 + 22 2 @@ -505,7 +511,7 @@ - + 8 0 @@ -513,7 +519,7 @@ 0 1 - 40 + 32 1000 @@ -521,7 +527,7 @@ 9 1 - + 7 0 @@ -529,7 +535,7 @@ 0 1 - 40 + 32 1000 @@ -546,23 +552,33 @@ - 121 - + 88 + + + + + 111 + + + + + 148 + - 123 - + 149 + - 126 - + 150 + - 127 - + 151 + @@ -589,21 +605,23 @@ com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - - + + + com.apple.InterfaceBuilder.CocoaPlugin - - - + + + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin - com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + HNHScrollView com.apple.InterfaceBuilder.CocoaPlugin @@ -617,10 +635,18 @@ - 133 + 151 + + HNHScrollView + NSScrollView + + IBProjectSource + ./Classes/HNHScrollView.h + + MPIconSelectViewController MPViewController @@ -635,17 +661,20 @@ id - - iconCollectionView - NSCollectionView - - - iconCollectionView - + + NSCollectionView + NSButton + + + iconCollectionView NSCollectionView - + + imageButton + NSButton + + IBProjectSource ./Classes/MPIconSelectViewController.h @@ -659,27 +688,6 @@ ./Classes/MPViewController.h - - NSCollectionViewItem - - NSImageView - NSTextField - - - - imageView - NSImageView - - - textField - NSTextField - - - - IBProjectSource - ./Classes/NSCollectionViewItem.h - - NSLayoutConstraint NSObject diff --git a/MacPass/MPEntryInspectorViewController.m b/MacPass/MPEntryInspectorViewController.m index e1c9874c..9017afc3 100644 --- a/MacPass/MPEntryInspectorViewController.m +++ b/MacPass/MPEntryInspectorViewController.m @@ -196,10 +196,6 @@ typedef NS_ENUM(NSUInteger, MPEntryTab) { #pragma mark - #pragma mark Popovers -//- (void)_showImagePopup:(id)sender { -// [self _showPopopver:[[MPIconSelectViewController alloc] init] atView:self.itemImageView onEdge:NSMinYEdge]; -//} -// - (IBAction)_popUpPasswordGenerator:(id)sender { [self.generatePasswordButton setEnabled:NO]; [self _showPopopver:[[MPPasswordCreatorViewController alloc] init] atView:self.passwordTextField onEdge:NSMinYEdge]; diff --git a/MacPass/MPIconSelectViewController.h b/MacPass/MPIconSelectViewController.h index bbde1223..af028216 100644 --- a/MacPass/MPIconSelectViewController.h +++ b/MacPass/MPIconSelectViewController.h @@ -11,6 +11,8 @@ @interface MPIconSelectViewController : MPViewController @property (weak) IBOutlet NSCollectionView *iconCollectionView; +@property (weak) IBOutlet NSButton *imageButton; + - (IBAction)useDefault:(id)sender; @end diff --git a/MacPass/MPIconSelectViewController.m b/MacPass/MPIconSelectViewController.m index 336d1d18..2205602c 100644 --- a/MacPass/MPIconSelectViewController.m +++ b/MacPass/MPIconSelectViewController.m @@ -10,7 +10,6 @@ #import "MPIconHelper.h" @interface MPIconSelectViewController () - @end @implementation MPIconSelectViewController @@ -20,19 +19,20 @@ return [self initWithNibName:@"IconSelection" bundle:nil]; } -- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil -{ +- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { - } return self; } - (void)didLoadView { + //[[self.imageButton cell] setBackgroundStyle:NSBackgroundStyleLowered]; + [self.iconCollectionView setBackgroundColors:@[[NSColor clearColor]]]; [self.iconCollectionView setSelectable:YES]; [self.iconCollectionView setAllowsMultipleSelection:NO]; [self.iconCollectionView setContent:[MPIconHelper availableIcons]]; + } - (IBAction)useDefault:(id)sender { diff --git a/MacPass/MPInspectorViewController.h b/MacPass/MPInspectorViewController.h index ee65fc44..a0c2f858 100644 --- a/MacPass/MPInspectorViewController.h +++ b/MacPass/MPInspectorViewController.h @@ -11,17 +11,17 @@ @class HNHGradientView; @class MPPopupImageView; -@interface MPInspectorViewController : MPViewController +@interface MPInspectorViewController : MPViewController @property (weak) IBOutlet HNHGradientView *bottomBar; @property (weak) IBOutlet NSTextField *createdTextField; @property (weak) IBOutlet NSTextField *modifiedTextField; -@property (weak) IBOutlet NSImageView *modifiedImageView; -@property (weak) IBOutlet NSImageView *createdImageView; @property (weak) IBOutlet NSTextField *noSelectionInfo; @property (weak) IBOutlet MPPopupImageView *itemImageView; @property (weak) IBOutlet NSTextField *itemNameTextField; +- (IBAction)showImagePopup:(id)sender; + /* Seperate call to ensure alle registered objects are in place */ - (void)setupNotifications:(NSWindowController *)windowController; diff --git a/MacPass/MPInspectorViewController.m b/MacPass/MPInspectorViewController.m index f7c2a130..7648abf2 100644 --- a/MacPass/MPInspectorViewController.m +++ b/MacPass/MPInspectorViewController.m @@ -12,6 +12,7 @@ #import "MPGroupInspectorViewController.h" #import "MPDocument.h" #import "MPNotifications.h" +#import "MPIconSelectViewController.h" #import "NSDate+Humanized.h" @@ -31,6 +32,7 @@ typedef NS_ENUM(NSUInteger, MPContentTab) { @interface MPInspectorViewController () { MPEntryInspectorViewController *_entryViewController; MPGroupInspectorViewController *_groupViewController; + NSPopover *_popover; } @property (nonatomic, strong) NSDate *modificationDate; @@ -130,6 +132,23 @@ typedef NS_ENUM(NSUInteger, MPContentTab) { } +#pragma mark - +#pragma mark Popup +- (IBAction)showImagePopup:(id)sender { + + NSAssert(_popover == nil, @"Popover hast to be niled out"); + _popover = [[NSPopover alloc] init]; + _popover.delegate = self; + _popover.behavior = NSPopoverBehaviorTransient; + _popover.contentViewController = [[MPIconSelectViewController alloc] init]; + [_popover showRelativeToRect:NSZeroRect ofView:self.itemImageView preferredEdge:NSMinYEdge]; +} + +- (void)popoverDidClose:(NSNotification *)notification { + _popover = nil; +} + + #pragma mark - #pragma mark Item Binding