wrt reloadItem:reloadChildren: redisplaying all the rows

saw this discussed athttp://savannah.gnu.org/bugs/?func=detailitem&item_id=9487

this seems to work... not sure what happens if the item isn't in the outline view
it might want to test that...

also, not sure how much of an optimization it would be... could see rowOfItem: being rather slow on large outline views as it has to isEqual: every item in the _items array...

<foo.diff>

Index: NSOutlineView.m
===================================================================
--- NSOutlineView.m     (revision 24482)
+++ NSOutlineView.m     (working copy)
@@ -449,6 +449,7 @@
   id object = (item == nil) ? (id)[NSNull null] : (id)item;
   NSArray *allKeys = NSAllMapTableKeys(_itemDict);
   NSEnumerator *en = [allKeys objectEnumerator];
+  NSRect rectOfItem, rectOfLastRow;
 
   expanded = [self isItemExpanded: item];
 
@@ -485,8 +486,19 @@
          [self _openItem: dsobj];
          [self noteNumberOfRowsChanged];
        }
-    }      
-  [self setNeedsDisplay: YES];
+    }     
+  
+  rectOfItem = [self rectOfRow:[self rowForItem:item]];
+
+  if (reloadChildren && expanded)
+    {
+      rectOfLastRow = [self rectOfRow:_numberOfRows - 1];
+      [self setNeedsDisplayInRect:NSUnionRect(rectOfItem, rectOfLastRow)];
+    }
+  else
+    {
+      [self setNeedsDisplayInRect: rectOfItem];
+    }
 }
 
 /**
_______________________________________________
Gnustep-dev mailing list
Gnustep-dev@gnu.org
http://lists.gnu.org/mailman/listinfo/gnustep-dev

Reply via email to