Revision: 30111
          http://sourceforge.net/p/bibdesk/svn/30111
Author:   hofman
Date:     2026-03-04 23:36:20 +0000 (Wed, 04 Mar 2026)
Log Message:
-----------
consistently pass array of parent groups

Modified Paths:
--------------
    trunk/bibdesk/BDSKGroupsArray.m
    trunk/bibdesk/BibDocument_Groups.h
    trunk/bibdesk/BibDocument_Groups.m

Modified: trunk/bibdesk/BDSKGroupsArray.m
===================================================================
--- trunk/bibdesk/BDSKGroupsArray.m     2026-03-04 17:29:28 UTC (rev 30110)
+++ trunk/bibdesk/BDSKGroupsArray.m     2026-03-04 23:36:20 UTC (rev 30111)
@@ -196,7 +196,7 @@
         [[[self undoManager] prepareWithInvocationTarget:self] 
removeChildGroup:group];
     NSArray *selectedGroups = [[self document] selectedGroups];
     [parent addChildGroup:group];
-    [[self document] reloadParentGroup:parent withSelection:selectedGroups];
+    [[self document] reloadParentGroups:@[parent] 
withSelection:selectedGroups];
 }
 
 - (void)removeChildGroup:(__kindof BDSKGroup *)group {
@@ -210,7 +210,7 @@
     [[self document] willRemoveGroups:groupsToRemove];
     NSArray *selectedGroups = [[self document] selectedGroups];
     [parent removeChildGroup:group];
-    [[self document] reloadParentGroup:parent withSelection:selectedGroups];
+    [[self document] reloadParentGroups:@[parent] 
withSelection:selectedGroups];
     groupsToRemove = nil;
 }
 

Modified: trunk/bibdesk/BibDocument_Groups.h
===================================================================
--- trunk/bibdesk/BibDocument_Groups.h  2026-03-04 17:29:28 UTC (rev 30110)
+++ trunk/bibdesk/BibDocument_Groups.h  2026-03-04 23:36:20 UTC (rev 30111)
@@ -83,7 +83,7 @@
 - (void)handleExternalGroupUpdatedNotification:(NSNotification *)notification;
 
 - (void)willRemoveGroups:(NSArray<BDSKGroup *> *)groupsToRemove;
-- (void)reloadParentGroup:(nullable BDSKParentGroup *)parentGroup 
withSelection:(NSArray<__kindof BDSKGroup *> *)selectedGroups;
+- (void)reloadParentGroups:(nullable NSArray<BDSKParentGroup *> *)parentGroup 
withSelection:(NSArray<__kindof BDSKGroup *> *)selectedGroups;
 
 - (nullable BDSKGroupCellView *)viewForGroup:(BDSKGroup *)group;
 - (void)updateCountBubbleForGroup:(BDSKGroup *)group inView:(nullable 
BDSKGroupCellView *)view;

Modified: trunk/bibdesk/BibDocument_Groups.m
===================================================================
--- trunk/bibdesk/BibDocument_Groups.m  2026-03-04 17:29:28 UTC (rev 30110)
+++ trunk/bibdesk/BibDocument_Groups.m  2026-03-04 23:36:20 UTC (rev 30111)
@@ -371,7 +371,7 @@
                                                             object:self 
userInfo:@{BDSKDocumentGroupsKey:groupsToRemove}];
     
     [[groups externalParent] setSharedGroups:sharedGroups];
-    [self reloadParentGroup:[groups externalParent] 
withSelection:selectedGroups];
+    [self reloadParentGroups:@[[groups externalParent]] 
withSelection:selectedGroups];
 }
 
 - (void)handleExternalGroupUpdatedNotification:(NSNotification *)notification{
@@ -412,7 +412,7 @@
 }
 
 // reload (a section of) the outlineview and preserve the selection
-- (void)reloadParentGroup:(BDSKParentGroup *)parentGroup 
withSelection:(NSArray *)selectedGroups {
+- (void)reloadParentGroups:(NSArray<BDSKParentGroup *> *)parentGroup 
withSelection:(NSArray *)selectedGroups {
     if ([parentGroup isKindOfClass:[BDSKParentGroup class]] && 
[groupOutlineView isItemExpanded:parentGroup] == NO)
         return;
     
@@ -424,8 +424,6 @@
     
     if (parentGroup == nil) {
         [groupOutlineView reloadData];
-    } else if ([parentGroup isKindOfClass:[BDSKParentGroup class]]) {
-        [groupOutlineView reloadItem:parentGroup reloadChildren:YES];
     } else {
         for (BDSKParentGroup *parent in (NSArray *)parentGroup)
             [groupOutlineView reloadItem:parent reloadChildren:YES];
@@ -562,7 +560,7 @@
         [self rebuildCategoryGroups:parent];
     }
     
-    [self reloadParentGroup:nil withSelection:selectedGroups];
+    [self reloadParentGroups:nil withSelection:selectedGroups];
 }
 
 - (BOOL)updateCategoryGroups:(BOOL)updateCategoryGroups 
smartGroups:(BOOL)updateSmartGroups {
@@ -594,10 +592,8 @@
     }
     
     BOOL didReload = YES;
-    if ([parentsToReload count] == 1) {
-        [self reloadParentGroup:[parentsToReload firstObject] 
withSelection:selectedGroups];
-    } else if ([parentsToReload count]) {
-        [self reloadParentGroup:(id)parentsToReload 
withSelection:selectedGroups];
+    if ([parentsToReload count]) {
+        [self reloadParentGroups:parentsToReload withSelection:selectedGroups];
     } else if (isSelected) {
         // fix for bug #1362191: after changing a checkbox that removed an 
item from a smart group, the table scrolled to the top
         NSPoint scrollPoint = [tableView scrollPositionAsPercentage];
@@ -745,7 +741,7 @@
         BDSKCategoryParentGroup *group = [[BDSKCategoryParentGroup alloc] 
initWithKey:newField];
         [self rebuildCategoryGroups:group];
         [groups addCategoryParent:group];
-        [self reloadParentGroup:nil withSelection:selectedGroups];
+        [self reloadParentGroups:nil withSelection:selectedGroups];
         // this is to set the sort descriptors and sorts the children
         [groupOutlineView expandItem:group];
         [[NSUserDefaults standardUserDefaults] setObject:[self 
currentGroupFields] forKey:BDSKCurrentGroupFieldsKey];
@@ -757,7 +753,7 @@
     for (BDSKCategoryParentGroup *group in [groups categoryParents]) {
         if ([[group key] isEqualToString:oldField]) {
             [groups removeCategoryParent:group];
-            [self reloadParentGroup:nil withSelection:selectedGroups];
+            [self reloadParentGroups:nil withSelection:selectedGroups];
             [[NSUserDefaults standardUserDefaults] setObject:[self 
currentGroupFields] forKey:BDSKCurrentGroupFieldsKey];
             break;
         }
@@ -770,7 +766,7 @@
         [group setKey:newField];
         [self willRemoveGroups:[group children]];
         [self rebuildCategoryGroups:group];
-        [self reloadParentGroup:group withSelection:selectedGroups];
+        [self reloadParentGroups:@[group] withSelection:selectedGroups];
         [[NSUserDefaults standardUserDefaults] setObject:[self 
currentGroupFields] forKey:BDSKCurrentGroupFieldsKey];
     }
 }
@@ -1218,7 +1214,7 @@
     [groupOutlineView deselectAll:nil];
     
     [self rebuildCategoryGroups:parent];
-    [self reloadParentGroup:parent withSelection:selectedGroups];
+    [self reloadParentGroups:@[parent] withSelection:selectedGroups];
     
     dispatch_async(dispatch_get_main_queue(), ^{
         NSUInteger realIdx = [[parent categoryGroups] indexOfObject:group];
@@ -1562,7 +1558,7 @@
         if ([groupOutlineView isItemExpanded:parent])
             [parent sortUsingDescriptors:sortDescriptors];
     }
-    [self reloadParentGroup:nil withSelection:selectedGroups];
+    [self reloadParentGroups:nil withSelection:selectedGroups];
 }
 
 static inline BOOL identicalArrays(NSArray *array1, NSArray *array2) {
@@ -1583,7 +1579,7 @@
     [parentGroup resort];
     BOOL unchanged = identicalArrays(children, [parentGroup children]);
     if (unchanged == NO)
-        [self reloadParentGroup:parentGroup withSelection:selectedGroups];
+        [self reloadParentGroups:@[parentGroup] withSelection:selectedGroups];
     return unchanged == NO;
 }
 

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



_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit

Reply via email to