From: <ho...@us...> - 2011-04-30 11:27:40
|
Revision: 17866 http://bibdesk.svn.sourceforge.net/bibdesk/?rev=17866&view=rev Author: hofman Date: 2011-04-30 11:27:33 +0000 (Sat, 30 Apr 2011) Log Message: ----------- don't bother registering for key status notifications when complex string editor is not enabled Modified Paths: -------------- trunk/bibdesk/BDSKComplexStringEditor.m Modified: trunk/bibdesk/BDSKComplexStringEditor.m =================================================================== --- trunk/bibdesk/BDSKComplexStringEditor.m 2011-04-30 10:19:47 UTC (rev 17865) +++ trunk/bibdesk/BDSKComplexStringEditor.m 2011-04-30 11:27:33 UTC (rev 17866) @@ -89,7 +89,8 @@ [tableView scrollRowToVisible:row]; [self setExpandedValue:aString]; - [self cellWindowDidBecomeKey:nil]; //draw the focus ring we are covering + if (enabled) + [self cellWindowDidBecomeKey:nil]; //draw the focus ring we are covering [self cellFrameDidChange:nil]; // reset the frame and show the window // track changes in the text, the frame and the window's key status of the tableView [self registerForNotifications]; @@ -107,7 +108,6 @@ - (void)registerForNotifications { NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; - NSWindow *tableViewWindow = [tableView window]; NSView *contentView = (NSView *)[[tableView enclosingScrollView] contentView] ?: (NSView *)tableView; [nc addObserver:self @@ -129,14 +129,6 @@ selector:@selector(cellFrameDidChange:) name:NSViewBoundsDidChangeNotification object:contentView]; - [nc addObserver:self - selector:@selector(cellWindowDidBecomeKey:) - name:NSWindowDidBecomeKeyNotification - object:tableViewWindow]; - [nc addObserver:self - selector:@selector(cellWindowDidResignKey:) - name:NSWindowDidResignKeyNotification - object:tableViewWindow]; [nc addObserver:self selector:@selector(tableViewColumnDidResize:) name:NSTableViewColumnDidResizeNotification @@ -145,21 +137,34 @@ selector:@selector(tableViewColumnDidMove:) name:NSTableViewColumnDidMoveNotification object:tableView]; + if (enabled) { + NSWindow *tableViewWindow = [tableView window]; + [nc addObserver:self + selector:@selector(cellWindowDidBecomeKey:) + name:NSWindowDidBecomeKeyNotification + object:tableViewWindow]; + [nc addObserver:self + selector:@selector(cellWindowDidResignKey:) + name:NSWindowDidResignKeyNotification + object:tableViewWindow]; + } } - (void)unregisterForNotifications { NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; - NSWindow *tableViewWindow = [tableView window]; NSView *contentView = (NSView *)[[tableView enclosingScrollView] contentView] ?: (NSView *)tableView; [nc removeObserver:self name:NSControlTextDidChangeNotification object:tableView]; [nc removeObserver:self name:NSControlTextDidEndEditingNotification object:tableView]; [nc removeObserver:self name:NSViewFrameDidChangeNotification object:contentView]; [nc removeObserver:self name:NSViewBoundsDidChangeNotification object:contentView]; - [nc removeObserver:self name:NSWindowDidBecomeKeyNotification object:tableViewWindow]; - [nc removeObserver:self name:NSWindowDidResignKeyNotification object:tableViewWindow]; [nc removeObserver:self name:NSTableViewColumnDidResizeNotification object:tableView]; [nc removeObserver:self name:NSTableViewColumnDidMoveNotification object:tableView]; + if (enabled) { + NSWindow *tableViewWindow = [tableView window]; + [nc removeObserver:self name:NSWindowDidBecomeKeyNotification object:tableViewWindow]; + [nc removeObserver:self name:NSWindowDidResignKeyNotification object:tableViewWindow]; + } } - (void)remove { @@ -226,7 +231,7 @@ } - (void)cellWindowDidBecomeKey:(NSNotification *)notification { - [backgroundView setShowFocusRing:enabled]; + [backgroundView setShowFocusRing:YES]; } - (void)cellWindowDidResignKey:(NSNotification *)notification { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |