From 92fcf90edffeb097a06f20e58a6c09723d25af13 Mon Sep 17 00:00:00 2001 From: Damiano Galassi Date: Tue, 3 Oct 2017 14:11:35 +0200 Subject: [PATCH] Store the current track index. --- Classes/SBDocument.m | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Classes/SBDocument.m b/Classes/SBDocument.m index e600447..8240fe6 100644 --- a/Classes/SBDocument.m +++ b/Classes/SBDocument.m @@ -68,6 +68,7 @@ @property (nonatomic, strong) NSWindowController *sheetController; @property (nonatomic, strong, nullable) NSDictionary *currentSaveAttributes; +@property (nonatomic) NSInteger currentTrackIndex; @end @@ -283,6 +284,8 @@ static NSDictionary *_detailMonospacedAttr; self.mp4 = reloadedFile; [self.tracksTable reloadData]; + NSIndexSet *index = [NSIndexSet indexSetWithIndex:self.currentTrackIndex]; + [self.tracksTable selectRowIndexes:index byExtendingSelection:NO]; [self reloadPropertyView]; completionHandler(error); @@ -749,6 +752,9 @@ static NSDictionary *_detailMonospacedAttr; // make sure we automatically resize the controller's view to the current window size propertyView.view.frame = targetView.bounds; propertyView.view.autoresizingMask = (NSViewWidthSizable | NSViewHeightSizable); + + // save the index + self.currentTrackIndex = row; } - (BOOL)tableView:(NSTableView *)tv writeRowsWithIndexes:(NSIndexSet *)rowIndexes toPasteboard:(NSPasteboard *)pboard