From 88920740e4fba9d735a7833f42302dd52bd4a134 Mon Sep 17 00:00:00 2001 From: K8TIY Date: Wed, 5 Dec 2012 17:30:30 -0500 Subject: [PATCH] Use modern NSIndexSet row selection. --- TerminusEstDocument.m | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/TerminusEstDocument.m b/TerminusEstDocument.m index ce59344..a5b47e5 100755 --- a/TerminusEstDocument.m +++ b/TerminusEstDocument.m @@ -656,8 +656,15 @@ -(IBAction)delete:(id)sender NSInteger i; for (i = [_table numberOfRows]; i > 0; i--) if ([_table isRowSelected:i-1]) [self _deleteMachineAtIndex:i-1 withActionName:NSLocalizedString(@"__UNDO_DELETE__", @"Delete Machine")]; + if ([_table isRowSelected:i-1]) + [self _deleteMachineAtIndex:i-1 withActionName:NSLocalizedString(@"__UNDO_DELETE__", @"Delete Machine")]; if ([_table selectedRow] == -1) [_table selectRow:[_table numberOfRows]-1 byExtendingSelection:NO]; + { + NSIndexSet* rows = [[NSIndexSet alloc] initWithIndex:[_table numberOfRows]-1]; + [_table selectRowIndexes:rows byExtendingSelection:NO]; + [rows release]; + } } -(IBAction)machineOp:(id)sender @@ -923,8 +930,12 @@ -(BOOL)tableView:(NSTableView*)table acceptDrop:(id )info BOOL isCopy = (srcMask & NSDragOperationMove) ? NO:YES; dropRow = [self _moveRows:array to:dropRow copying:isCopy]; [table deselectAll:self]; + NSMutableIndexSet* rows = [[NSMutableIndexSet alloc] init]; for (id blah in array) [table selectRow:(dropRow++) byExtendingSelection:YES]; + [rows addIndex:dropRow++]; + [table selectRowIndexes:rows byExtendingSelection:YES]; + [rows release]; accepted = YES; } } @@ -1021,6 +1032,7 @@ -(void)_insertMachine:(TEMachine*)m atIndex:(NSUInteger)i withActionName:(NSStri { [_table reloadData]; [_table selectRow:i byExtendingSelection:NO]; + [_table selectRowIndexes:[NSIndexSet indexSetWithIndex:i] byExtendingSelection:NO]; [_table scrollRowToVisible:i]; [[[self undoManager] prepareWithInvocationTarget:self] _deleteMachineAtIndex:i withActionName:action]; [[self undoManager] setActionName:action];