Revision: 27717
          http://sourceforge.net/p/bibdesk/svn/27717
Author:   hofman
Date:     2022-07-09 23:00:22 +0000 (Sat, 09 Jul 2022)
Log Message:
-----------
implement show menu accessibility action in fileview

Modified Paths:
--------------
    trunk/bibdesk_vendorsrc/amaxwell/FileView/FVAccessibilityIconElement.h
    trunk/bibdesk_vendorsrc/amaxwell/FileView/FVAccessibilityIconElement.m
    trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m

Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVAccessibilityIconElement.h
===================================================================
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVAccessibilityIconElement.h      
2022-07-09 06:30:13 UTC (rev 27716)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVAccessibilityIconElement.h      
2022-07-09 23:00:22 UTC (rev 27717)
@@ -55,4 +55,5 @@
 - (BOOL)isIconElementSelected:(FVAccessibilityIconElement *)element;
 - (void)setSelected:(BOOL)selected forIconElement:(FVAccessibilityIconElement 
*)element;
 - (void)openIconElement:(FVAccessibilityIconElement *)element;
+- (void)showMenuForIconElement:(FVAccessibilityIconElement *)element;
 @end

Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVAccessibilityIconElement.m
===================================================================
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVAccessibilityIconElement.m      
2022-07-09 06:30:13 UTC (rev 27716)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVAccessibilityIconElement.m      
2022-07-09 23:00:22 UTC (rev 27717)
@@ -154,7 +154,7 @@
 }
 
 - (NSArray *)accessibilityActionNames {
-    return [NSArray arrayWithObjects:NSAccessibilityPressAction, nil];
+    return [NSArray arrayWithObjects:NSAccessibilityPressAction, 
NSAccessibilityShowMenuAction, nil];
 }
 
 - (NSString *)accessibilityActionDescription:(NSString *)anAction {
@@ -164,6 +164,8 @@
 - (void)accessibilityPerformAction:(NSString *)anAction {
     if ([anAction isEqualToString:NSAccessibilityPressAction])
         [_parent openIconElement:self];
+    else if ([anAction isEqualToString:NSAccessibilityShowMenuAction])
+        [_parent showMenuForIconElement:self];
 }
 
 - (BOOL)isAccessibilityElement {
@@ -243,4 +245,8 @@
     [_parent openIconElement:self];
 }
 
+- (void)accessibilityPerformShowMenu {
+    [_parent showMenuForIconElement:self];
+}
+
 @end

Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m
===================================================================
--- trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m      2022-07-09 
06:30:13 UTC (rev 27716)
+++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FVFileView.m      2022-07-09 
23:00:22 UTC (rev 27717)
@@ -3980,13 +3980,10 @@
     return (action && [self respondsToSelector:action]);
 }
 
-- (NSMenu *)menuForEvent:(NSEvent *)event
+- (NSMenu *)menuForIconAtIndex:(NSUInteger)idx
 {
-    _lastMouseDownLocInView = [self convertPoint:[event locationInWindow] 
fromView:nil];
     NSMenu *menu = [[[[self class] defaultMenu] copyWithZone:[NSMenu 
menuZone]] autorelease];
     
-    NSUInteger idx = [self _indexAtPoint:_lastMouseDownLocInView 
dropOperation:NULL];
-    
     // Finder changes selection only if the clicked item isn't in the current 
selection
     if (menu && NO == [_selectionIndexes containsIndex:idx])
         [self _setSelectionIndexes:idx == NSNotFound ? [NSIndexSet indexSet] : 
[NSIndexSet indexSetWithIndex:idx]];
@@ -4029,6 +4026,15 @@
     return menu;
 }
 
+- (NSMenu *)menuForEvent:(NSEvent *)event
+{
+    _lastMouseDownLocInView = [self convertPoint:[event locationInWindow] 
fromView:nil];
+    
+    NSUInteger idx = [self _indexAtPoint:_lastMouseDownLocInView 
dropOperation:NULL];
+    
+    return [self menuForIconAtIndex:idx];
+}
+
 // sender must respond to -tag, and may respond to -enclosingMenuItem
 - (IBAction)changeFinderLabel:(id)sender;
 {
@@ -4664,6 +4670,16 @@
         [self _openURLs:[NSArray arrayWithObjects:[self URLAtIndex:[element 
index]], nil]];
 }
 
+- (void)showMenuForIconElement:(FVAccessibilityIconElement *)element {
+    if ([element index] < [_orderedURLs count]) {
+        NSUInteger r, c;
+        [self _getGridRow:&r column:&c ofIndex:[element index]];
+        NSRect rect = [self _rectOfIconInRow:r column:c];
+        NSPoint p = NSMakePoint(NSMidX(rect), NSMidY(rect));
+        [[self menuForIconAtIndex:[element index]] 
popUpMenuPositioningItem:nil atLocation:p inView:self];
+    }
+}
+
 @end
 
 #pragma mark -

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