+- (BOOL)tableView:(NSTableView *)tableView
+ acceptDrop:(id <NSDraggingInfo>)info
+ row:(NSInteger)row
+ dropOperation:(NSTableViewDropOperation)dropOperation {
+ NSPasteboard *pboard = [info draggingPasteboard];
+ if ([pboard.types containsObject:PB_ROW]) {
+ NSString *value = [pboard stringForType:PB_ROW];
+ NSUInteger srcRow = [value intValue];
+ [_mappings moveObjectAtIndex:srcRow toIndex:row];
+ [self mappingsChanged];
+ return YES;
+ } else {
+ return NO;
+ }
+}
+
+- (NSDragOperation)tableView:(NSTableView *)tableView_
+ validateDrop:(id <NSDraggingInfo>)info
+ proposedRow:(NSInteger)row
+ proposedDropOperation:(NSTableViewDropOperation)dropOperation {
+ NSPasteboard *pboard = [info draggingPasteboard];
+ if ([pboard.types containsObject:PB_ROW]) {
+ [tableView_ setDropRow:MAX(1, row) dropOperation:NSTableViewDropAbove];
+ return NSDragOperationGeneric;
+ } else {
+ return NSDragOperationNone;
+ }
+}
+
+- (BOOL)tableView:(NSTableView *)tableView
+writeRowsWithIndexes:(NSIndexSet *)rowIndexes
+ toPasteboard:(NSPasteboard *)pboard {
+ if (rowIndexes.count == 1 && rowIndexes.firstIndex != 0) {
+ [pboard declareTypes:@[PB_ROW] owner:nil];
+ [pboard setString:@(rowIndexes.firstIndex).stringValue forType:PB_ROW];
+ return YES;
+ } else {
+ return NO;
+ }
+
+}