Skip to content

Commit 4f5430a

Browse files
authored
feat: selective match flipping (#22)
The "Flip tracks" button in the matching window flipped the tracks of all matches. With this change, it only flips the selected matches when matches are selected, or all matches if none are selected.
1 parent 54c8b94 commit 4f5430a

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

AudioAlign/MatchingWindow.xaml.cs

+11-2
Original file line numberDiff line numberDiff line change
@@ -1108,10 +1108,19 @@ out CrossCorrelation.Result ccr
11081108

11091109
private void FlipTracksButton_Click(object sender, RoutedEventArgs e)
11101110
{
1111-
foreach (Match match in multiTrackViewer.Matches)
1111+
List<Match> matchesToFlip = new();
1112+
1113+
if (matchGrid.SelectedItems.Count > 0)
1114+
{
1115+
matchesToFlip.AddRange(matchGrid.SelectedItems.Cast<Match>());
1116+
}
1117+
else
11121118
{
1113-
match.SwapTracks();
1119+
matchesToFlip.AddRange(multiTrackViewer.Matches);
11141120
}
1121+
1122+
matchesToFlip.ForEach(m => m.SwapTracks());
1123+
11151124
matchGrid.Items.Refresh();
11161125
}
11171126
}

0 commit comments

Comments
 (0)