Revision: 29950
          http://sourceforge.net/p/bibdesk/svn/29950
Author:   hofman
Date:     2026-01-16 16:48:31 +0000 (Fri, 16 Jan 2026)
Log Message:
-----------
set tooltip for add/remove search field buttons frrom document category

Modified Paths:
--------------
    trunk/bibdesk/BDSKButtonBar.h
    trunk/bibdesk/BDSKButtonBar.m
    trunk/bibdesk/BibDocument_Search.m

Modified: trunk/bibdesk/BDSKButtonBar.h
===================================================================
--- trunk/bibdesk/BDSKButtonBar.h       2026-01-16 16:27:28 UTC (rev 29949)
+++ trunk/bibdesk/BDSKButtonBar.h       2026-01-16 16:48:31 UTC (rev 29950)
@@ -60,6 +60,9 @@
 
 @property (nonatomic, readonly) NSArray<NSButton *> *buttons;
 
+@property (nonatomic, nullable, readonly) NSButton *addButton;
+@property (nonatomic, nullable, readonly) NSButton *removeButton;
+
 - (void)addButtonWithIdentifier:(NSString *)identifier title:(NSString *)title;
 - (void)removeButtonWithIdentifier:(NSString *)identifier reuse:(BOOL)reuse;
 

Modified: trunk/bibdesk/BDSKButtonBar.m
===================================================================
--- trunk/bibdesk/BDSKButtonBar.m       2026-01-16 16:27:28 UTC (rev 29949)
+++ trunk/bibdesk/BDSKButtonBar.m       2026-01-16 16:48:31 UTC (rev 29950)
@@ -52,7 +52,7 @@
 
 @implementation BDSKButtonBar
 
-@synthesize target, action, addAction, removeAction, buttons, hasAddButton, 
hasRemoveButton;
+@synthesize target, action, addAction, removeAction, buttons, hasAddButton, 
hasRemoveButton, addButton, removeButton;
 @dynamic selectedIdentifier;
 
 // @@ Dark mode
@@ -241,10 +241,8 @@
     NSButton *previousButton = nil;
     BOOL wantsOverflowButton = NO;
     if ([self hasAddButton]) {
-        if (addButton == nil) {
+        if (addButton == nil)
             addButton = [self newButtonWithImageName:NSImageNameAddTemplate];
-            [addButton setToolTip:NSLocalizedString(@"Add a search field", 
@"Tool tip meessage")];
-        }
         origin.x = NSMaxX(bounds) - NSWidth([addButton frame]) - BUTTON_MARGIN;
         origin.y = floor(0.5 * (NSHeight(bounds) - NSHeight([addButton 
frame])));
         [addButton setFrameOrigin:origin];
@@ -255,10 +253,8 @@
         [addButton removeFromSuperview];
     }
     if ([self hasRemoveButton]) {
-        if (removeButton == nil) {
+        if (removeButton == nil)
             removeButton = [self 
newButtonWithImageName:NSImageNameRemoveTemplate];
-            [removeButton setToolTip:NSLocalizedString(@"Remove a search 
field", @"Tool tip meessage")];
-        }
         if ([self hasAddButton])
             origin.x -= NSWidth([removeButton frame]) + BUTTON_SEPARATION;
         else

Modified: trunk/bibdesk/BibDocument_Search.m
===================================================================
--- trunk/bibdesk/BibDocument_Search.m  2026-01-16 16:27:28 UTC (rev 29949)
+++ trunk/bibdesk/BibDocument_Search.m  2026-01-16 16:48:31 UTC (rev 29950)
@@ -313,6 +313,8 @@
         if ([field isEqualToString:BDSKFileContentSearchString] == NO && 
[field isEqualToString:BDSKSkimNotesString] == NO)
             [searchButtonBar addButtonWithIdentifier:field 
title:titleForSearchField(field)];
     }
+    
+    [[searchButtonBar addButton] setToolTip:NSLocalizedString(@"Add a search 
field", @"Tool tip meessage")];
 }
 
 - (BOOL)addFileSearchItems {
@@ -345,6 +347,8 @@
         NSArray *buttons = [searchButtonBar buttons];
         BOOL canRemove = [buttons count] > 2 || ([buttons count] == 2 && 
[[[buttons lastObject] identifier] isEqualToString:BDSKFileContentSearchString] 
== NO);
         [searchButtonBar setHasRemoveButton:canRemove];
+        if (canRemove)
+            [[searchButtonBar removeButton] 
setToolTip:NSLocalizedString(@"Remove a search field", @"Tool tip meessage")];
         
         [self addControlView:BDSKControlViewSearch];
         
@@ -404,6 +408,8 @@
             NSArray *buttons = [searchButtonBar buttons];
             BOOL canRemove = [buttons count] > 2 || ([buttons count] == 2 && 
[[[buttons lastObject] identifier] isEqualToString:BDSKFileContentSearchString] 
== NO);
             [searchButtonBar setHasRemoveButton:canRemove];
+            if (canRemove)
+                [[searchButtonBar removeButton] 
setToolTip:NSLocalizedString(@"Remove a search field", @"Tool tip meessage")];
             
             [searchButtonBar setAction:NULL];
             [searchButtonBar setSelectedIdentifier:selectedSearchButton];

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