Revision: 27987 http://sourceforge.net/p/bibdesk/svn/27987 Author: hofman Date: 2022-10-03 14:23:45 +0000 (Mon, 03 Oct 2022) Log Message: ----------- combined class for button as subview of text field
Modified Paths: -------------- trunk/bibdesk/BDSKAddressTextField.m trunk/bibdesk/BDSKEditorTextField.h trunk/bibdesk/BDSKEditorTextField.m trunk/bibdesk/BDSKSecureTextField.m trunk/bibdesk/Bibdesk.xcodeproj/project.pbxproj Added Paths: ----------- trunk/bibdesk/BDSKEmbeddedButton.h trunk/bibdesk/BDSKEmbeddedButton.m Modified: trunk/bibdesk/BDSKAddressTextField.m =================================================================== --- trunk/bibdesk/BDSKAddressTextField.m 2022-10-03 14:16:52 UTC (rev 27986) +++ trunk/bibdesk/BDSKAddressTextField.m 2022-10-03 14:23:45 UTC (rev 27987) @@ -39,6 +39,7 @@ #import "BDSKAddressTextField.h" #import "BDSKAddressTextFieldCell.h" #import "BDSKDragImageView.h" +#import "BDSKEmbeddedButton.h" #import "NSLayoutConstraint_BDSKExtensions.h" #import "NSView_BDSKExtensions.h" @@ -45,9 +46,6 @@ #define CONTROL_SIZE 16.0 #define CONTROL_MARGIN 3.0 -@interface BDSKAddressButton : NSButton -@end - @interface BDSKAddressImageView : BDSKDragImageView @end @@ -80,7 +78,7 @@ [NSLayoutConstraint constraintWithCenterYOffset:0.0 forItem:imageView toItem:self], nil]]; } if (button == nil) { - button = [[BDSKAddressButton alloc] init]; + button = [[BDSKEmbeddedButton alloc] init]; [button setButtonType:NSMomentaryChangeButton]; [button setBordered:NO]; [button setImagePosition:NSImageOnly]; @@ -199,21 +197,6 @@ @end -@implementation BDSKAddressButton - -- (id)accessibilityParent { - return NSAccessibilityUnignoredAncestor([(NSControl *)[self superview] cell]); -} - -- (id)accessibilityAttributeValue:(NSString *)attribute { - if ([attribute isEqualToString:NSAccessibilityParentAttribute]) - return NSAccessibilityUnignoredAncestor([(NSControl *)[self superview] cell]); - return [super accessibilityAttributeValue:attribute]; -} - -@end - - @implementation BDSKAddressImageView - (id)accessibilityParent { Modified: trunk/bibdesk/BDSKEditorTextField.h =================================================================== --- trunk/bibdesk/BDSKEditorTextField.h 2022-10-03 14:16:52 UTC (rev 27986) +++ trunk/bibdesk/BDSKEditorTextField.h 2022-10-03 14:23:45 UTC (rev 27987) @@ -38,6 +38,7 @@ #import <Cocoa/Cocoa.h> #import "BDSKComplexStringCell.h" +#import "BDSKEmbeddedButton.h" @class BDSKDragButton; @@ -57,7 +58,7 @@ @end -@interface BDSKDragButton : NSButton <NSDraggingSource> +@interface BDSKDragButton : BDSKEmbeddedButton <NSDraggingSource> @end @interface BDSKDragButtonCell : NSButtonCell Modified: trunk/bibdesk/BDSKEditorTextField.m =================================================================== --- trunk/bibdesk/BDSKEditorTextField.m 2022-10-03 14:16:52 UTC (rev 27986) +++ trunk/bibdesk/BDSKEditorTextField.m 2022-10-03 14:23:45 UTC (rev 27987) @@ -214,7 +214,7 @@ @end -@implementation BDSKDragButton : NSButton +@implementation BDSKDragButton + (Class)cellClass { return [BDSKDragButtonCell class]; } @@ -224,16 +224,6 @@ return NSDragOperationGeneric; } -- (id)accessibilityParent { - return NSAccessibilityUnignoredAncestor([(NSControl *)[self superview] cell]); -} - -- (id)accessibilityAttributeValue:(NSString *)attribute { - if ([attribute isEqualToString:NSAccessibilityParentAttribute]) - return NSAccessibilityUnignoredAncestor([(NSControl *)[self superview] cell]); - return [super accessibilityAttributeValue:attribute]; -} - @end Added: trunk/bibdesk/BDSKEmbeddedButton.h =================================================================== --- trunk/bibdesk/BDSKEmbeddedButton.h (rev 0) +++ trunk/bibdesk/BDSKEmbeddedButton.h 2022-10-03 14:23:45 UTC (rev 27987) @@ -0,0 +1,43 @@ +// +// BDSKEmbeddedButton.h +// BibDesk +// +// Created by Christiaan Hofman on 03/10/2022. +/* + This software is Copyright (c) 2022 + Christiaan Hofman. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + - Neither the name of Christiaan Hofman nor the names of any + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import <Cocoa/Cocoa.h> + + +@interface BDSKEmbeddedButton : NSButton +@end Added: trunk/bibdesk/BDSKEmbeddedButton.m =================================================================== --- trunk/bibdesk/BDSKEmbeddedButton.m (rev 0) +++ trunk/bibdesk/BDSKEmbeddedButton.m 2022-10-03 14:23:45 UTC (rev 27987) @@ -0,0 +1,53 @@ +// +// BDSKEmbeddedButton.m +// BibDesk +// +// Created by Christiaan Hofman on 03/10/2022. +/* + This software is Copyright (c) 2022 + Christiaan Hofman. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + + - Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + - Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + + - Neither the name of Christiaan Hofman nor the names of any + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#import "BDSKEmbeddedButton.h" + +@implementation BDSKEmbeddedButton + +- (id)accessibilityParent { + return NSAccessibilityUnignoredAncestor([(NSControl *)[self superview] cell]); +} + +- (id)accessibilityAttributeValue:(NSString *)attribute { + if ([attribute isEqualToString:NSAccessibilityParentAttribute]) + return NSAccessibilityUnignoredAncestor([(NSControl *)[self superview] cell]); + return [super accessibilityAttributeValue:attribute]; +} + +@end Modified: trunk/bibdesk/BDSKSecureTextField.m =================================================================== --- trunk/bibdesk/BDSKSecureTextField.m 2022-10-03 14:16:52 UTC (rev 27986) +++ trunk/bibdesk/BDSKSecureTextField.m 2022-10-03 14:23:45 UTC (rev 27987) @@ -40,13 +40,9 @@ #import "NSLayoutConstraint_BDSKExtensions.h" #import "NSGeometry_BDSKExtensions.h" #import "NSView_BDSKExtensions.h" +#import "BDSKEmbeddedButton.h" -@interface BDSKSecureTextFieldButton : NSButton -@end - -#pragma mark - - @implementation BDSKSecureTextField @synthesize showsText, button; @@ -91,7 +87,7 @@ - (void)commonInit { if (button == nil) { - button = [[BDSKSecureTextFieldButton alloc] init]; + button = [[BDSKEmbeddedButton alloc] init]; [button setButtonType:NSToggleButton]; [button setBordered:NO]; [button setImagePosition:NSImageOnly]; @@ -273,19 +269,3 @@ } @end - -#pragma mark - - -@implementation BDSKSecureTextFieldButton - -- (id)accessibilityParent { - return NSAccessibilityUnignoredAncestor([(NSControl *)[self superview] cell]); -} - -- (id)accessibilityAttributeValue:(NSString *)attribute { - if ([attribute isEqualToString:NSAccessibilityParentAttribute]) - return NSAccessibilityUnignoredAncestor([(NSControl *)[self superview] cell]); - return [super accessibilityAttributeValue:attribute]; -} - -@end Modified: trunk/bibdesk/Bibdesk.xcodeproj/project.pbxproj =================================================================== --- trunk/bibdesk/Bibdesk.xcodeproj/project.pbxproj 2022-10-03 14:16:52 UTC (rev 27986) +++ trunk/bibdesk/Bibdesk.xcodeproj/project.pbxproj 2022-10-03 14:23:45 UTC (rev 27987) @@ -128,6 +128,8 @@ CE24B35510C3E9E100818EDF /* BDSKLastImportGroup.m in Sources */ = {isa = PBXBuildFile; fileRef = CE24B35310C3E9E100818EDF /* BDSKLastImportGroup.m */; }; CE24BA69143F2A1900B3216B /* BDSKRichTextForCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = CEC3158B0F24D0B9008D2C75 /* BDSKRichTextForCommand.m */; }; CE26481D0B5AB4B800D4B5B8 /* BDSKDragTextField.m in Sources */ = {isa = PBXBuildFile; fileRef = CE26481B0B5AB4B700D4B5B8 /* BDSKDragTextField.m */; }; + CE27A0E928EB269F003D752C /* BDSKEmbeddedButton.h in Headers */ = {isa = PBXBuildFile; fileRef = CE27A0E728EB269F003D752C /* BDSKEmbeddedButton.h */; }; + CE27A0EA28EB269F003D752C /* BDSKEmbeddedButton.m in Sources */ = {isa = PBXBuildFile; fileRef = CE27A0E828EB269F003D752C /* BDSKEmbeddedButton.m */; }; CE27D95C0AF92BFD00419879 /* BDSKZoomableTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = CE27D95A0AF92BFD00419879 /* BDSKZoomableTextView.m */; }; CE280D4816C6C51600344CC8 /* BDSKSaveAccessoryViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = CE280D4616C6C51600344CC8 /* BDSKSaveAccessoryViewController.m */; }; CE280D6D16C6CB8700344CC8 /* BDSKSaveAccessoryView.xib in Resources */ = {isa = PBXBuildFile; fileRef = CE280D6C16C6CB8700344CC8 /* BDSKSaveAccessoryView.xib */; }; @@ -1396,6 +1398,8 @@ CE24B35310C3E9E100818EDF /* BDSKLastImportGroup.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BDSKLastImportGroup.m; sourceTree = "<group>"; }; CE26481A0B5AB4B700D4B5B8 /* BDSKDragTextField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BDSKDragTextField.h; sourceTree = "<group>"; }; CE26481B0B5AB4B700D4B5B8 /* BDSKDragTextField.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BDSKDragTextField.m; sourceTree = "<group>"; }; + CE27A0E728EB269F003D752C /* BDSKEmbeddedButton.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BDSKEmbeddedButton.h; sourceTree = "<group>"; }; + CE27A0E828EB269F003D752C /* BDSKEmbeddedButton.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BDSKEmbeddedButton.m; sourceTree = "<group>"; }; CE27D9590AF92BFD00419879 /* BDSKZoomableTextView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BDSKZoomableTextView.h; sourceTree = "<group>"; }; CE27D95A0AF92BFD00419879 /* BDSKZoomableTextView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BDSKZoomableTextView.m; sourceTree = "<group>"; }; CE280D4516C6C51600344CC8 /* BDSKSaveAccessoryViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BDSKSaveAccessoryViewController.h; sourceTree = "<group>"; }; @@ -2618,6 +2622,7 @@ CEE882B826697C0500574E12 /* BDSKControlTableCellView.m */, CEEC70E0093B6EC200A64F54 /* BDSKDragImageView.m */, CE26481B0B5AB4B700D4B5B8 /* BDSKDragTextField.m */, + CE27A0E828EB269F003D752C /* BDSKEmbeddedButton.m */, F9022C410758027800C3F701 /* BDSKMainTableView.m */, CE2837400917D31D006B4C63 /* BDSKEdgeView.m */, CE4241340D0EAE0B00F824E7 /* BDSKEditorTableView.m */, @@ -3253,6 +3258,7 @@ CE4241330D0EAE0B00F824E7 /* BDSKEditorTableView.h */, CE4241420D0EAEFE00F824E7 /* BDSKEditorTextField.h */, F941135209B549BF00EE8463 /* BDSKEditorTextView.h */, + CE27A0E728EB269F003D752C /* BDSKEmbeddedButton.h */, CE129A150B44088900416D19 /* BDSKEntrezGroupServer.h */, CE35DCE70A99B1A700029B66 /* BDSKErrorEditor.h */, CE15C0D50AA5B9A3002C555F /* BDSKErrorManager.h */, @@ -3821,6 +3827,7 @@ CE2A09C12245997A00A8F31C /* BDSKBibTeXWebParser.h in Headers */, CE2A0A7D22459A3100A8F31C /* BDSKStringConstants.h in Headers */, CE2A09DE224599B300A8F31C /* BDSKDBLPGroupServer.h in Headers */, + CE27A0E928EB269F003D752C /* BDSKEmbeddedButton.h in Headers */, CE2A0AD422459A4B00A8F31C /* NSInvocation_BDSKExtensions.h in Headers */, CE2A09ED224599DB00A8F31C /* BDSKEntrezGroupServer.h in Headers */, CE1E01D7267115A500F39954 /* BDSKComplexStringCell.h in Headers */, @@ -4675,6 +4682,7 @@ CE38FB89091D946A00BCB69D /* BDSKConditionController.m in Sources */, CE38FB8F091D94A100BCB69D /* BDSKFilter.m in Sources */, CE38FB91091D94A100BCB69D /* BDSKFilterController.m in Sources */, + CE27A0EA28EB269F003D752C /* BDSKEmbeddedButton.m in Sources */, CEE882BA26697C0500574E12 /* BDSKControlTableCellView.m in Sources */, F9E07C8509202309007BCDD4 /* BibDocument_Groups.m in Sources */, CEE09F1C216147E1009CE63D /* BDSKFieldInfo.m in Sources */, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. _______________________________________________ Bibdesk-commit mailing list Bibdesk-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bibdesk-commit