Fix behavior for songs with time signature changes

This commit is contained in:
Matthias Neeracher 2017-11-24 06:26:48 +01:00
parent 5a5810fdf4
commit 6d7383b324

View File

@ -5,7 +5,7 @@
// //
// (MN) Matthias Neeracher // (MN) Matthias Neeracher
// //
// Copyright © 2006-2007 Matthias Neeracher // Copyright © 2006-2017 Matthias Neeracher
// //
#import "VLSheetView.h" #import "VLSheetView.h"
@ -140,7 +140,7 @@ std::string NormalizeName(NSString* rawName)
- (void) moveToNext - (void) moveToNext
{ {
const VLProperties & prop = fSong->fProperties.front(); const VLProperties & prop = fSong->Properties(fSelection.fMeasure);
fSelection.fAt = fSelection.fAt+VLFraction(1,4); fSelection.fAt = fSelection.fAt+VLFraction(1,4);
if (fSelection.fAt >= prop.fTime) { if (fSelection.fAt >= prop.fTime) {
@ -153,10 +153,10 @@ std::string NormalizeName(NSString* rawName)
- (void) moveToPrev - (void) moveToPrev
{ {
if (fSelection.fAt < VLFraction(1,4)) { if (fSelection.fAt < VLFraction(1,4)) {
const VLProperties & prop = fSong->fProperties.front(); fSelection.fMeasure =
(fSelection.fMeasure+fSong->CountMeasures()-1) % fSong->CountMeasures();
const VLProperties & prop = fSong->Properties(fSelection.fMeasure);
fSelection.fAt = prop.fTime - VLFraction(1,4); fSelection.fAt = prop.fTime - VLFraction(1,4);
fSelection.fMeasure =
(fSelection.fMeasure+fSong->CountMeasures()-1) % fSong->CountMeasures();
[fView scrollMeasureToVisible:fSelection.fMeasure]; [fView scrollMeasureToVisible:fSelection.fMeasure];
} else } else
fSelection.fAt = fSelection.fAt-VLFraction(1,4); fSelection.fAt = fSelection.fAt-VLFraction(1,4);
@ -256,7 +256,7 @@ std::string NormalizeName(NSString* rawName)
- (void) highlightChord:(VLLocation)at - (void) highlightChord:(VLLocation)at
{ {
const VLProperties & prop = [self song]->fProperties.front(); const VLProperties & prop = [self song]->Properties(at.fMeasure);
const float kSystemY = [self systemY:fLayout->SystemForMeasure(at.fMeasure)]; const float kSystemY = [self systemY:fLayout->SystemForMeasure(at.fMeasure)];
NSRect r = NSRect r =
NSMakeRect([self noteXAt:at]-kNoteW*0.5f, NSMakeRect([self noteXAt:at]-kNoteW*0.5f,