From 15d41002449a243364755114c343ef6664a39250 Mon Sep 17 00:00:00 2001 From: Matthias Neeracher Date: Sun, 19 Aug 2012 00:30:50 +0200 Subject: [PATCH] Reset song on mouse click --- Sources/VLDocument.h | 1 + Sources/VLDocument.mm | 5 +++++ Sources/VLSheetView.mm | 2 ++ 3 files changed, 8 insertions(+) diff --git a/Sources/VLDocument.h b/Sources/VLDocument.h index 7383db8..30fd20d 100644 --- a/Sources/VLDocument.h +++ b/Sources/VLDocument.h @@ -86,6 +86,7 @@ enum { - (void) setRepeatVolta:(int)repeatVolta; - (void) playSong; +- (void) endSong; - (NSURL *) tmpURL; - (NSURL *) workURL; diff --git a/Sources/VLDocument.mm b/Sources/VLDocument.mm index 40f5e24..081d749 100644 --- a/Sources/VLDocument.mm +++ b/Sources/VLDocument.mm @@ -490,6 +490,11 @@ [self setPlayElements:[self playElements]]; } +- (void) endSong +{ + musicSequence = nil; +} + - (void) playWithGroove:(NSString *)groove inSections:(NSRange)sections { NSString * savedGroove = songGroove; diff --git a/Sources/VLSheetView.mm b/Sources/VLSheetView.mm index c807b35..fafaf76 100644 --- a/Sources/VLSheetView.mm +++ b/Sources/VLSheetView.mm @@ -834,6 +834,8 @@ const float kSemiFloor = -1.0f*kLineH; - (void) mouseDown:(NSEvent *)event { + [[self document] endSong]; + BOOL extend = ([event modifierFlags] & NSShiftKeyMask) != 0; VLRegion region = [self findRegionForEvent:event]; if (extend && [[self editTarget] canExtendSelection:region])