Revision: 27712
http://sourceforge.net/p/bibdesk/svn/27712
Author: hofman
Date: 2022-07-08 16:04:15 +0000 (Fri, 08 Jul 2022)
Log Message:
-----------
set accessibility description for images displayed in main table
Modified Paths:
--------------
trunk/bibdesk/BDSKMainTableView.m
trunk/bibdesk/BibDocument_DataSource.m
trunk/bibdesk/BibItem.m
trunk/bibdesk/NSImage_BDSKExtensions.h
trunk/bibdesk/NSImage_BDSKExtensions.m
trunk/bibdesk/de.lproj/Localizable.strings
trunk/bibdesk/en.lproj/Localizable.strings
trunk/bibdesk/fr.lproj/Localizable.strings
Modified: trunk/bibdesk/BDSKMainTableView.m
===================================================================
--- trunk/bibdesk/BDSKMainTableView.m 2022-07-08 15:42:46 UTC (rev 27711)
+++ trunk/bibdesk/BDSKMainTableView.m 2022-07-08 16:04:15 UTC (rev 27712)
@@ -360,6 +360,7 @@
if (cellImageCache == nil) {
NSImage *text = [[NSWorkspace sharedWorkspace]
iconForFileType:NSFileTypeForHFSTypeCode(kClippingTextTypeIcon)];
+ [text setAccessibilityDescription:NSLocalizedString(@"text",
@"Accessibility description")];
NSMutableDictionary *tmpDict = [[NSMutableDictionary alloc]
initWithObjectsAndKeys:text, BDSKAbstractString, text, BDSKAnnoteString, text,
BDSKRssDescriptionString, nil];
NSDictionary *imagePaths = [[NSUserDefaults standardUserDefaults]
objectForKey:BDSKTableCellImagesKey];
[imagePaths enumerateKeysAndObjectsUsingBlock:^(NSString *key,
NSString *imagePath, BOOL *stop){
Modified: trunk/bibdesk/BibDocument_DataSource.m
===================================================================
--- trunk/bibdesk/BibDocument_DataSource.m 2022-07-08 15:42:46 UTC (rev
27711)
+++ trunk/bibdesk/BibDocument_DataSource.m 2022-07-08 16:04:15 UTC (rev
27712)
@@ -157,12 +157,16 @@
// URL field
[imageView setToolTip:[value isFileURL] ? [[value path]
stringByAbbreviatingWithTildeInPath] : [value absoluteString]];
if (image == nil) {
- if ([value isFileURL] == NO)
+ if ([value isFileURL] == NO) {
image = [NSImage imageForURL:value];
- else if ((value = [value
fileURLByStrictlyResolvingAliases]))
- image = [[NSWorkspace sharedWorkspace]
iconForFileType:[value pathExtension]];
- else
+ } else if ((value = [value
fileURLByStrictlyResolvingAliases])) {
+ NSWorkspace *ws = [NSWorkspace sharedWorkspace];
+ NSString *type = [ws typeOfFile:[value path]
error:NULL];
+ image = [ws iconForFileType:type ?: [value
pathExtension]];
+ [image setAccessibilityDescription:[ws
localizedDescriptionForType:type] ?: NSLocalizedString(@"file", @"Accessibility
description")];
+ } else {
image = [NSImage missingFileImage];
+ }
}
} else {
// field with custom cell image, e.g. a note field
Modified: trunk/bibdesk/BibItem.m
===================================================================
--- trunk/bibdesk/BibItem.m 2022-07-08 15:42:46 UTC (rev 27711)
+++ trunk/bibdesk/BibItem.m 2022-07-08 16:04:15 UTC (rev 27712)
@@ -1477,7 +1477,7 @@
if (count > 0) {
NSString *label = 1 == count ? NSLocalizedString(@"1 item", @"") :
[NSString stringWithFormat:NSLocalizedString(@"%ld items", @""), (long)count];
NSString *toolTip = [[self remoteURLs]
valueForKeyPath:@"URL.absoluteString.@componentsJoinedByComma"];
- cellDictionary = [NSDictionary
dictionaryWithObjectsAndKeys:[[NSWorkspace sharedWorkspace]
iconForFileType:NSFileTypeForHFSTypeCode(kGenericURLIcon)], @"image", label,
@"string", toolTip, @"toolTip", nil];
+ cellDictionary = [NSDictionary
dictionaryWithObjectsAndKeys:[NSImage URLImage], @"image", label, @"string",
toolTip, @"toolTip", nil];
}
return cellDictionary;
} else if ([field isEqualToString:BDSKColorString] || [field
isEqualToString:BDSKColorLabelString]) {
Modified: trunk/bibdesk/NSImage_BDSKExtensions.h
===================================================================
--- trunk/bibdesk/NSImage_BDSKExtensions.h 2022-07-08 15:42:46 UTC (rev
27711)
+++ trunk/bibdesk/NSImage_BDSKExtensions.h 2022-07-08 16:04:15 UTC (rev
27712)
@@ -70,6 +70,7 @@
+ (NSImage *)redPaperclipImage;
+ (NSImage *)annotatedPaperclipImage;
+ (NSImage *)redAnnotatedPaperclipImage;
++ (NSImage *)URLImage;
+ (NSImage *)menuIcon;
+ (NSImage *)overflowImage;
Modified: trunk/bibdesk/NSImage_BDSKExtensions.m
===================================================================
--- trunk/bibdesk/NSImage_BDSKExtensions.m 2022-07-08 15:42:46 UTC (rev
27711)
+++ trunk/bibdesk/NSImage_BDSKExtensions.m 2022-07-08 16:04:15 UTC (rev
27712)
@@ -509,7 +509,8 @@
[genericDocImage drawInRect:rect fromRect:NSZeroRect
operation:NSCompositeCopy fraction:0.7];
[questionMark drawInRect:rect fromRect:NSZeroRect
operation:NSCompositeSourceOver fraction:0.7];
}];
- }
+ [image setAccessibilityDescription:NSLocalizedString(@"missing file",
@"Accessibility description")];
+ }
return image;
}
@@ -551,7 +552,9 @@
else if([scheme isCaseInsensitiveEqual:@"news"])
typeCode = kInternetLocationNewsIcon;
- return [[NSWorkspace sharedWorkspace]
iconForFileType:NSFileTypeForHFSTypeCode(typeCode)];
+ NSImage *image = [[NSWorkspace sharedWorkspace]
iconForFileType:NSFileTypeForHFSTypeCode(typeCode)];
+ [image setAccessibilityDescription:NSLocalizedString(@"URL",
@"Accessibility description")];
+ return image;
}
static NSImage *createPaperclipImageWithColor(NSColor *color, BOOL annotated) {
@@ -596,6 +599,7 @@
if(image == nil) {
image = createPaperclipImageWithColor([NSColor
colorWithGenericGamma22White:0.0 alpha:0.9], NO);
[image setTemplate:YES];
+ [image setAccessibilityDescription:NSLocalizedString(@"attachment",
@"Accessibility description")];
}
return image;
}
@@ -609,6 +613,7 @@
BDSKRunWithAppearance(NSApp, ^{
img = createPaperclipImageWithColor([NSColor systemRedColor], NO);
});
+ [img setAccessibilityDescription:NSLocalizedString(@"missing
attachment", @"Accessibility description")];
image[i] = img;
}
return image[i];
@@ -623,6 +628,7 @@
BDSKRunWithAppearance(NSApp, ^{
img = createPaperclipImageWithColor([NSColor systemRedColor], YES);
});
+ [img setAccessibilityDescription:NSLocalizedString(@"missing
attachment with notes", @"Accessibility description")];
image[i] = img;
}
return image[i];
@@ -634,10 +640,21 @@
if(image == nil) {
image = createPaperclipImageWithColor([NSColor
colorWithGenericGamma22White:0.0 alpha:0.9], YES);
[image setTemplate:YES];
+ [image setAccessibilityDescription:NSLocalizedString(@"attachment with
notes", @"Accessibility description")];
}
return image;
}
++ (NSImage *)URLImage;
+{
+ static NSImage *image = nil;
+ if(image == nil) {
+ image = [[[NSWorkspace sharedWorkspace]
iconForFileType:NSFileTypeForHFSTypeCode(kGenericURLIcon)] retain];
+ [image setAccessibilityDescription:NSLocalizedString(@"URL",
@"Accessibility description")];
+ }
+ return image;
+}
+
- (NSImage *)dragImageWithCount:(NSInteger)count;
{
return [self dragImageWithCount:count inside:NO size:NSMakeSize(32.0,
32.0)];
Modified: trunk/bibdesk/de.lproj/Localizable.strings
===================================================================
(Binary files differ)
Modified: trunk/bibdesk/en.lproj/Localizable.strings
===================================================================
(Binary files differ)
Modified: trunk/bibdesk/fr.lproj/Localizable.strings
===================================================================
(Binary files differ)
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