Hello.

I wrote some codes which will enable drag&drop from my application to FCP's project. Before implementing it, I tried dragging and dropping a file from a Finder to an FCP's project which was opened with the FCP. After confirming that the FCP supports drag&drop from the Finder, I started implementing codes like below.

In awakeFromNib
  /////////////////////////////////////////////////////
  // Registering the drag type for Drag & Drop support
[mClipTable registerForDraggedTypes:[NSArray arrayWithObjects:NSFilenamesPboardType,NSURLPboardType, nil]];

  // Allow that the drag target or where it drops is other application,
  // especially the Final Cut Pro.
[mClipTable setDraggingSourceOperationMask:NSDragOperationEvery forLocal:NO];
  ////////////////////////////////////////////////////

- (BOOL)tableView:(NSTableView *)aTableView writeRowsWithIndexes:(NSIndexSet *)rowIndexes toPasteboard:(NSPasteboard *)pboard
{
  JALog(@"--[Initiation of Drag]--");
  JALog(@"rowIndexes : %@", rowIndexes);
NSMutableArray *fileNamesArray = [NSMutableArray array];
  NSURL *draggedFileURL;

  // The pasteboard is for NSFilenamesPboard
[pboard declareTypes:[NSArray arrayWithObjects:NSFilenamesPboardType, NSURLPboardType, nil] owner:self]; NSString *configPath = [preferenceSetting configPath];
  NSIndexSet *selectedRowsIndexSet = [mClipTable selectedRowIndexes];
  unsigned int anIndex;
  int indexInClipsArray;
  NSString *fileName;
anIndex = [selectedRowsIndexSet firstIndex];
  while( anIndex != NSNotFound )
  {
       // For NSFilenamesPboardType
       indexInClipsArray = [self getClipsArrayIndex:anIndex];
fileName = [NSString stringWithFormat:@"%@/%@", configPath, [[mClipArray objectAtIndex:indexInClipsArray] longName]];
       [fileNamesArray addObject:fileName];

        // For NSURLPboardType
        draggedFileURL = [[NSURL alloc] initFileURLWithPath:fileName];
        [draggedFileURL writeToPasteboard:pboard];
        [draggedFileURL release];

       // next index
       anIndex = [selectedRowsIndexSet indexGreaterThanIndex:anIndex];
  }

  [pboard setPropertyList:fileNamesArray forType:NSFilenamesPboardType];

  return YES;

}

When I drag and dropped a file which is shown in my application to the FCP, the FCP displayed a dialog box which said "File Error: Unknown file.". Because the paste board type to use is NSFilenamesPboardType, I populate file names with its path prefixed. But it didn't work.
Also, I tried NSURLPboardType, but it didn't work also.
Two options left are "file content" and "File Promise", but I am not sure if 
which one will work.

Can anyone tell me what paste board type the FCP can accept?

Thank you.


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to