Revision: 15268
          http://bibdesk.svn.sourceforge.net/bibdesk/?rev=15268&view=rev
Author:   hofman
Date:     2009-05-05 12:04:25 +0000 (Tue, 05 May 2009)

Log Message:
-----------
use the row selection method to remove single selection items from selectAll in 
group outline, no need to do this twice

Modified Paths:
--------------
    trunk/bibdesk/BDSKGroupOutlineView.m

Modified: trunk/bibdesk/BDSKGroupOutlineView.m
===================================================================
--- trunk/bibdesk/BDSKGroupOutlineView.m        2009-05-05 10:13:13 UTC (rev 
15267)
+++ trunk/bibdesk/BDSKGroupOutlineView.m        2009-05-05 12:04:25 UTC (rev 
15268)
@@ -229,10 +229,10 @@
             [[self delegate] outlineView:self isSingleSelectionItem:[self 
itemAtRow:[[self selectedRowIndexes] firstIndex]]])
             return;
         // remove single selection rows from multiple selections
-        if (shouldExtend || [indexes count] > 1) { 
+        if (shouldExtend || [indexes count] > 1) {
             NSMutableIndexSet *mutableIndexes = [NSMutableIndexSet indexSet];
             NSUInteger row = [indexes firstIndex];
-            while (row != NSNotFound) {
+            while (NSNotFound != row) {
                 if ([[self delegate] outlineView:self 
isSingleSelectionItem:[self itemAtRow:row]] == NO)
                     [mutableIndexes addIndex:row];
                 row = [indexes indexGreaterThanIndex:row];
@@ -240,10 +240,8 @@
             indexes = mutableIndexes;
         }
     }
-    if ([indexes count] == 0) 
-        return;
-    
-    [super selectRowIndexes:indexes byExtendingSelection:shouldExtend];
+    if ([indexes count]) 
+        [super selectRowIndexes:indexes byExtendingSelection:shouldExtend];
 }
 
 - (void)textDidEndEditing:(NSNotification *)notification {
@@ -268,32 +266,7 @@
 
 // the default implementation is broken with the above modifications, and 
would be invalid anyway
 - (IBAction)selectAll:(id)sender {
-    BOOL hasSingle = [[self delegate] 
respondsToSelector:@selector(outlineView:isSingleSelectionItem:)];
-    BOOL hasUnselectable = [[self delegate] 
respondsToSelector:@selector(outlineView:shouldSelectItem:)];
-    NSMutableIndexSet *indexes = [NSMutableIndexSet 
indexSetWithIndexesInRange:NSMakeRange(0, [self numberOfRows])];
-    
-    if (hasSingle || hasUnselectable) {
-        NSUInteger row = [indexes firstIndex];
-        while (NSNotFound != row) {
-            id item = [self itemAtRow:row];
-            if ((hasSingle && [[self delegate] outlineView:self 
isSingleSelectionItem:item]) ||
-                (hasUnselectable && [[self delegate] outlineView:self 
shouldSelectItem:item] == NO))
-                [indexes removeIndex:row];
-            row = [indexes indexGreaterThanIndex:row];
-        }
-    }
-    
-    if ([indexes count] == 0) {
-        return;
-    } else if ([indexes count] == 1) {
-        [self selectRowIndexes:indexes byExtendingSelection:NO];
-    } else {
-        // this follows the default implementation: do it in 2 steps to make 
sure the selectedRow will be the last one
-        NSIndexSet *lastIndex = [NSIndexSet indexSetWithIndex:[indexes 
lastIndex]];
-        [indexes removeIndex:[indexes lastIndex]];
-        [self selectRowIndexes:indexes byExtendingSelection:NO];
-        [self selectRowIndexes:lastIndex byExtendingSelection:YES];
-    }
+    [self selectRowIndexes:[NSIndexSet 
indexSetWithIndexesInRange:NSMakeRange(0, [self numberOfRows])] 
byExtendingSelection:NO];    
 }
 
 // the default implementation would be meaningless anyway as we don't allow 
empty selection


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to