Enhancement on selection behavior

This commit is contained in:
michael starke
2013-02-26 12:20:47 +01:00
parent edaf4aa30d
commit 2e8d35a432
10 changed files with 48 additions and 13 deletions

View File

@@ -102,7 +102,7 @@
<int key="NSColorSpace">6</int> <int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string> <string key="NSCatalogName">System</string>
<string key="NSColorName">headerColor</string> <string key="NSColorName">headerColor</string>
<object class="NSColor" key="NSColor" id="266602521"> <object class="NSColor" key="NSColor">
<int key="NSColorSpace">3</int> <int key="NSColorSpace">3</int>
<bytes key="NSWhite">MQA</bytes> <bytes key="NSWhite">MQA</bytes>
</object> </object>
@@ -258,7 +258,20 @@
</array> </array>
<double key="NSIntercellSpacingWidth">3</double> <double key="NSIntercellSpacingWidth">3</double>
<double key="NSIntercellSpacingHeight">2</double> <double key="NSIntercellSpacingHeight">2</double>
<reference key="NSBackgroundColor" ref="266602521"/> <object class="NSColor" key="NSBackgroundColor">
<int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string>
<string key="NSColorName">_sourceListBackgroundColor</string>
<object class="NSColor" key="NSColor">
<int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string>
<string key="NSColorName">alternateSelectedControlColor</string>
<object class="NSColor" key="NSColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MCAwIDEAA</bytes>
</object>
</object>
</object>
<object class="NSColor" key="NSGridColor"> <object class="NSColor" key="NSGridColor">
<int key="NSColorSpace">6</int> <int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string> <string key="NSCatalogName">System</string>
@@ -1547,6 +1560,7 @@
<string key="filterTitleButton">NSButton</string> <string key="filterTitleButton">NSButton</string>
<string key="filterURLButton">NSButton</string> <string key="filterURLButton">NSButton</string>
<string key="filterUsernameButton">NSButton</string> <string key="filterUsernameButton">NSButton</string>
<string key="pathBar">NSView</string>
<string key="tableToBottom">NSLayoutConstraint</string> <string key="tableToBottom">NSLayoutConstraint</string>
<string key="tableToTop">NSLayoutConstraint</string> <string key="tableToTop">NSLayoutConstraint</string>
</dictionary> </dictionary>
@@ -1579,6 +1593,10 @@
<string key="name">filterUsernameButton</string> <string key="name">filterUsernameButton</string>
<string key="candidateClassName">NSButton</string> <string key="candidateClassName">NSButton</string>
</object> </object>
<object class="IBToOneOutletInfo" key="pathBar">
<string key="name">pathBar</string>
<string key="candidateClassName">NSView</string>
</object>
<object class="IBToOneOutletInfo" key="tableToBottom"> <object class="IBToOneOutletInfo" key="tableToBottom">
<string key="name">tableToBottom</string> <string key="name">tableToBottom</string>
<string key="candidateClassName">NSLayoutConstraint</string> <string key="candidateClassName">NSLayoutConstraint</string>

View File

@@ -11,6 +11,7 @@
#import "MPDatabaseController.h" #import "MPDatabaseController.h"
#import "MPDatabaseDocument.h" #import "MPDatabaseDocument.h"
#import "MPIconHelper.h" #import "MPIconHelper.h"
#import "MPMainWindowController.h"
#import "KdbGroup+MPAdditions.h" #import "KdbGroup+MPAdditions.h"
#import <QuartzCore/QuartzCore.h> #import <QuartzCore/QuartzCore.h>
@@ -151,12 +152,13 @@ NSString *const _toggleFilterUsernameButton = @"SearchUsername";
NSTableCellView *view = nil; NSTableCellView *view = nil;
if(isTitleColumn || isGroupColumn) { if(isTitleColumn || isGroupColumn) {
view = [tableView makeViewWithIdentifier:_MPTableImageCellView owner:self]; view = [tableView makeViewWithIdentifier:_MPTableImageCellView owner:self];
[[view imageView] setImage:[MPIconHelper randomIcon]];
if( isTitleColumn ) { if( isTitleColumn ) {
[[view textField] setStringValue:entry.title]; [[view textField] setStringValue:entry.title];
[[view imageView] setImage:[MPIconHelper icon:(MPIconType)entry.image]];
} }
else { else {
[[view textField] setStringValue:entry.parent.name]; [[view textField] setStringValue:entry.parent.name];
[[view imageView] setImage:[MPIconHelper icon:(MPIconType)entry.parent.image]];
} }
} }
else if( isPasswordColum ) { else if( isPasswordColum ) {
@@ -207,6 +209,10 @@ NSString *const _toggleFilterUsernameButton = @"SearchUsername";
} }
} }
- (void)deselectAll:(id)sender {
[self.entryTable deselectAll:self];
}
- (void)clearFilter { - (void)clearFilter {
self.filter = nil; self.filter = nil;
[[self.entryTable tableColumnWithIdentifier:MPEntryTableParentColumnIdentifier] setHidden:YES]; [[self.entryTable tableColumnWithIdentifier:MPEntryTableParentColumnIdentifier] setHidden:YES];
@@ -287,6 +293,7 @@ NSString *const _toggleFilterUsernameButton = @"SearchUsername";
return; // nothign to to return; // nothign to to
} }
[((MPMainWindowController *)[[self.view window] windowController]) clearOutlineSelection:nil];
self.isStatusBarVisible = YES; self.isStatusBarVisible = YES;
self.tableToTop.constant = [self.filterBar frame].size.height; self.tableToTop.constant = [self.filterBar frame].size.height;

View File

@@ -12,6 +12,9 @@
+ (NSImage *)icon:(MPIconType)type { + (NSImage *)icon:(MPIconType)type {
NSDictionary *icons = [MPIconHelper availableIcons]; NSDictionary *icons = [MPIconHelper availableIcons];
if(type >= [icons count]) {
return [NSImage imageNamed:NSImageNameActionTemplate];
}
NSString *imageName = icons[@(type)]; NSString *imageName = icons[@(type)];
return [[NSBundle mainBundle] imageForResource:imageName]; return [[NSBundle mainBundle] imageForResource:imageName];
} }

View File

@@ -15,6 +15,8 @@
- (void)showEntries; - (void)showEntries;
- (void)showMainWindow:(id)sender; - (void)showMainWindow:(id)sender;
- (void)performFindPanelAction:(id)sender; - (void)performFindPanelAction:(id)sender;
- (void)clearOutlineSelection:(id)sender;
/* /*
Sets the content View controller Sets the content View controller
@param viewController - use nil to reset to welcome screen @param viewController - use nil to reset to welcome screen

View File

@@ -192,6 +192,10 @@
[self.entryViewController clearFilter]; [self.entryViewController clearFilter];
} }
- (void)clearOutlineSelection:(id)sender {
[self.outlineViewController clearSelection];
}
- (NSSearchField *)locateToolbarSearchField { - (NSSearchField *)locateToolbarSearchField {
for(NSToolbarItem *toolbarItem in [[self.window toolbar] items]) { for(NSToolbarItem *toolbarItem in [[self.window toolbar] items]) {
NSView *view = [toolbarItem view]; NSView *view = [toolbarItem view];

View File

@@ -11,6 +11,7 @@
@interface MPOutlineViewController : MPViewController @interface MPOutlineViewController : MPViewController
@property (retain, readonly) NSMenu *menu; @property (retain, readonly) NSMenu *menu;
- (void)deselectAll;
- (void)clearSelection;
@end @end

View File

@@ -73,8 +73,8 @@
} }
} }
- (void)deselectAll { - (void)clearSelection {
[self.outlineView deselectAll:self]; [self.outlineView deselectAll:nil];
} }
- (void)setupMenu { - (void)setupMenu {

View File

@@ -32,9 +32,7 @@ NSString *const _MPOutlinveViewHeaderViewIdentifier = @"HeaderCell";
} }
else { else {
view = [outlineView makeViewWithIdentifier:_MPOutlineViewDataViewIdentifier owner:self]; view = [outlineView makeViewWithIdentifier:_MPOutlineViewDataViewIdentifier owner:self];
NSDictionary *availableIcons = [MPIconHelper availableIcons]; NSImage *icon = [MPIconHelper icon:(MPIconType)[group image]];
NSInteger randomIndex = rand() % [availableIcons count];
NSImage *icon = [MPIconHelper icon:(MPIconType)randomIndex];
[view.imageView setImage:icon]; [view.imageView setImage:icon];
[view.textField setStringValue:[group name]]; [view.textField setStringValue:[group name]];

View File

@@ -85,9 +85,7 @@ NSString *const MPToolbarItemSearch = @"Search";
Cleanup Cleanup
*/ */
[menuItem release]; [menuItem release];
[menu release]; [menu release];
[item setView:popupButton]; [item setView:popupButton];
[popupButton release]; [popupButton release];
} }
@@ -101,6 +99,10 @@ NSString *const MPToolbarItemSearch = @"Search";
[button setImage:image]; [button setImage:image];
[button setImagePosition:NSImageOnly]; [button setImagePosition:NSImageOnly];
[button sizeToFit]; [button sizeToFit];
if([itemIdentifier isEqualToString:MPToolbarItemDelete]) {
[button setTarget:nil];
[button setAction:@selector(clearOutlineSelection:)];
}
NSRect fittingRect = [button frame]; NSRect fittingRect = [button frame];
fittingRect.size.width = MAX( (CGFloat)32.0,fittingRect.size.width); fittingRect.size.width = MAX( (CGFloat)32.0,fittingRect.size.width);

View File

@@ -21,7 +21,7 @@
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>????</string> <string>????</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>304</string> <string>310</string>
<key>LSMinimumSystemVersion</key> <key>LSMinimumSystemVersion</key>
<string>${MACOSX_DEPLOYMENT_TARGET}</string> <string>${MACOSX_DEPLOYMENT_TARGET}</string>
<key>NSHumanReadableCopyright</key> <key>NSHumanReadableCopyright</key>