Which delegate methods? The open delegate is okay, since it gets called for each file. For the context menu, the delegate should validate based on selection or change the selection to a single item. So the editor needs to take that into account (is that what you meant?).
On Dec 29, 2007, at 5:55 PM, Christiaan Hofman wrote: > Note that you should now also change the delegate methods and the > actions that are used in it. > > Christiaan > > On 30 Dec 2007, at 2:49 AM, [EMAIL PROTECTED] wrote: > >> Revision: 12109 >> http://bibdesk.svn.sourceforge.net/bibdesk/?rev=12109&view=rev >> Author: amaxwell >> Date: 2007-12-29 17:47:32 -0800 (Sat, 29 Dec 2007) >> >> Log Message: >> ----------- >> Open multiple URLs when selected. Operate on selection instead of >> the URL from the last mouse down, now that selection always changes. >> Change selection in context menu handler before validation; some >> actions are valid when there's a multiple selection. >> >> Modified Paths: >> -------------- >> trunk/bibdesk_vendorsrc/amaxwell/FileView/FileView.m >> >> Modified: trunk/bibdesk_vendorsrc/amaxwell/FileView/FileView.m >> =================================================================== >> --- trunk/bibdesk_vendorsrc/amaxwell/FileView/FileView.m 2007-12-30 >> 01:38:26 UTC (rev 12108) >> +++ trunk/bibdesk_vendorsrc/amaxwell/FileView/FileView.m 2007-12-30 >> 01:47:32 UTC (rev 12109) >> @@ -1350,11 +1350,15 @@ >> return NSNotFound == anIndex ? nil : [self >> iconURLAtIndex:anIndex]; >> } >> >> -- (void)_openURL:(NSURL *)aURL >> +- (void)_openURLs:(NSArray *)URLs >> { >> - if ([[self delegate] >> respondsToSelector:@selector(fileView:shouldOpenURL:)] == NO || >> - [[self delegate] fileView:self shouldOpenURL:aURL] == YES) >> - [[NSWorkspace sharedWorkspace] openURL:aURL]; >> + NSEnumerator *e = [URLs objectEnumerator]; >> + NSURL *aURL; >> + while (aURL = [e nextObject]) { >> + if ([[self delegate] >> respondsToSelector:@selector(fileView:shouldOpenURL:)] == NO || >> + [[self delegate] fileView:self shouldOpenURL:aURL] == >> YES) >> + [[NSWorkspace sharedWorkspace] openURL:aURL]; >> + } >> } >> >> - (NSString *)view:(NSView *)view stringForToolTip: >> (NSToolTipTag)tag point:(NSPoint)point userData:(void *)userData >> @@ -1484,7 +1488,7 @@ >> [FVPreviewer setWebViewContextMenuDelegate:[self >> delegate]]; >> [FVPreviewer previewURL:[self _URLAtPoint:p]]; >> } else { >> - [self _openURL:[self _URLAtPoint:p]]; >> + [self _openURLs:[self _selectedURLs]]; >> } >> } >> >> @@ -1617,11 +1621,6 @@ >> } >> } >> >> -- (NSURL *)URLForLastMouseDown >> -{ >> - return [self _URLAtPoint:_lastMouseDownLocInView]; >> -} >> - >> #pragma mark Drop target >> >> - (BOOL)_isLocalDraggingInfo:(id <NSDraggingInfo>)sender >> @@ -1987,12 +1986,12 @@ >> >> - (IBAction)revealInFinder:(id)sender >> { >> - [[NSWorkspace sharedWorkspace] selectFile:[[self >> URLForLastMouseDown] path] inFileViewerRootedAtPath:nil]; >> + [[NSWorkspace sharedWorkspace] selectFile:[[[self >> _selectedURLs] lastObject] path] inFileViewerRootedAtPath:nil]; >> } >> >> - (IBAction)openURL:(id)sender >> { >> - [self _openURL:[self URLForLastMouseDown]]; >> + [self _openURLs:[self _selectedURLs]]; >> } >> >> - (IBAction)zoomIn:(id)sender; >> @@ -2008,7 +2007,7 @@ >> - (IBAction)previewAction:(id)sender; >> { >> [FVPreviewer setWebViewContextMenuDelegate:[self delegate]]; >> - [FVPreviewer previewURL:[self URLForLastMouseDown]]; >> + [FVPreviewer previewURL:[[self _selectedURLs] lastObject]]; >> } >> >> - (IBAction)delete:(id)sender; >> @@ -2055,12 +2054,12 @@ >> >> - (BOOL)validateMenuItem:(NSMenuItem *)anItem >> { >> - NSURL *aURL = [self URLForLastMouseDown]; >> + NSURL *aURL = [[self _selectedURLs] lastObject]; >> SEL action = [anItem action]; >> if (action == @selector(zoomOut:) || action == >> @selector(zoomIn:)) >> return YES; >> else if (action == @selector(revealInFinder:)) >> - return [aURL isFileURL] && [[NSFileManager defaultManager] >> fileExistsAtPath:[aURL path]]; >> + return [aURL isFileURL] && [_selectedIndexes count] == 1; >> else if (action == @selector(openURL:) && nil != aURL) { >> NSBundle *bundle = [NSBundle bundleForClass:[FileView >> class]]; >> NSString *title; >> @@ -2075,8 +2074,8 @@ >> return [self isEditable] && [_selectedIndexes count] > 0; >> else if (action == @selector(selectAll:)) >> return ([self numberOfIcons] > 0); >> - else if (action == @selector(openURL:) || action == >> @selector(previewAction:)) >> - return (nil != aURL); >> + else if (action == @selector(previewAction:)) >> + return (nil != aURL) && [_selectedIndexes count] == 1; >> else if (action == @selector(paste:)) >> return [self isEditable]; >> // need to handle print: and other actions >> @@ -2092,6 +2091,10 @@ >> if ([self _getGridRow:&r column:&c >> atPoint:_lastMouseDownLocInView]) >> idx = [self _indexForGridRow:r column:c]; >> >> + // Finder changes selection only if the clicked item isn't in >> the current selection >> + if (menu && NO == [_selectedIndexes containsIndex:idx]) >> + [self setSelectionIndexes:idx == NSNotFound ? [NSIndexSet >> indexSet] : [NSIndexSet indexSetWithIndex:idx]]; >> + >> // remove disabled items and double separators >> i = [menu numberOfItems]; >> BOOL wasSeparator = YES; >> @@ -2117,11 +2120,7 @@ >> >> if ([menu numberOfItems] == 0) >> menu = nil; >> - >> - NSIndexSet *newSelectionIndexes = idx == NSNotFound ? >> [NSIndexSet indexSet] : [NSIndexSet indexSetWithIndex:idx]; >> - if ([newSelectionIndexes isEqual:_selectedIndexes] == NO) >> - [self setSelectionIndexes:newSelectionIndexes]; >> - >> + >> return menu; >> } >> >> >> >> This was sent by the SourceForge.net collaborative development >> platform, the world's largest Open Source development site. >> >> ------------------------------------------------------------------------- >> This SF.net email is sponsored by: Microsoft >> Defy all challenges. Microsoft(R) Visual Studio 2005. >> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ >> _______________________________________________ >> Bibdesk-commit mailing list >> [EMAIL PROTECTED] >> https://lists.sourceforge.net/lists/listinfo/bibdesk-commit > ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Bibdesk-develop mailing list Bibdesk-develop@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bibdesk-develop