From 531877b222a4427bcaf643e21137f1c88a5b8c2a Mon Sep 17 00:00:00 2001 From: Matthias Neeracher Date: Sun, 21 Aug 2011 16:05:28 +0200 Subject: [PATCH] Implement dragging out of annotation table --- Medianno/MADragging.mm | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Medianno/MADragging.mm b/Medianno/MADragging.mm index 28fa3a9..1a61c1d 100644 --- a/Medianno/MADragging.mm +++ b/Medianno/MADragging.mm @@ -66,7 +66,19 @@ - (void)registerOurDragTypes { + [annotationTable setDraggingSourceOperationMask:NSDragOperationEvery forLocal:NO]; + [annotationTable setVerticalMotionCanBeginDrag:NO]; + [annotationTable registerForDraggedTypes: + [NSArray arrayWithObjects:kMADragType, kUTTypeUTF8PlainText, nil]]; +} + +- (BOOL)tableView:(NSTableView *)tableView writeRowsWithIndexes:(NSIndexSet *)rowIndexes toPasteboard:(NSPasteboard *)pboard +{ + NSArray * objects = [[annotationController arrangedObjects] objectsAtIndexes:rowIndexes]; + [pboard clearContents]; + [pboard writeObjects:[NSArray arrayWithObject:[MAPasteboardData pasteboardDataWithArray:objects]]]; + return YES; } @end @@ -78,7 +90,7 @@ [tagTable setDraggingSourceOperationMask:NSDragOperationEvery forLocal:NO]; [tagTable setVerticalMotionCanBeginDrag:NO]; [tagTable registerForDraggedTypes: - [NSArray arrayWithObjects:kMADragType, NSStringPboardType, nil]]; + [NSArray arrayWithObjects:kMADragType, kUTTypeUTF8PlainText, nil]]; } - (BOOL)tableView:(NSTableView *)tableView writeRowsWithIndexes:(NSIndexSet *)rowIndexes toPasteboard:(NSPasteboard *)pboard @@ -89,4 +101,5 @@ return YES; } + @end