diff --git a/Sources/VLDocument.h b/Sources/VLDocument.h index e7c23fa..fa6ae3b 100644 --- a/Sources/VLDocument.h +++ b/Sources/VLDocument.h @@ -53,7 +53,7 @@ enum { float staffPadding; float chordPadding; float lyricPadding; - int playElements; + int playElements; NSURL * tmpURL; NSFileWrapper * vcsWrapper; NSMutableArray* observers; @@ -71,6 +71,8 @@ enum { float baseTempo; } +@property (nonatomic) int playElements; + - (VLSong *) song; - (NSNumber *) songKey; - (NSNumber *) songTime; @@ -94,7 +96,6 @@ enum { - (IBAction) playStop:(id)sender; - (IBAction) playMusic:(id)sender; - (IBAction) adjustTempo:(id)sender; -- (IBAction) togglePlayElements:(id)sender; - (NSURL *) tmpURL; - (NSURL *) workURL; diff --git a/Sources/VLDocument.mm b/Sources/VLDocument.mm index 210dbf3..9fdf04a 100644 --- a/Sources/VLDocument.mm +++ b/Sources/VLDocument.mm @@ -68,6 +68,8 @@ @implementation VLDocument +@synthesize playElements; + + (BOOL)autosavesInPlace { return YES; @@ -84,6 +86,7 @@ songComposer = @""; songArranger = @""; songGroove = @"Swing"; + playElements = kVLPlayAccompaniment|kVLPlayMelody|kVLPlayCountIn; songTempo = [[NSNumber alloc] initWithInt:120]; baseTempo = 120.0f; chordSize = 6.0f; @@ -94,7 +97,6 @@ staffPadding = 3.0f; chordPadding = 1.5f; lyricPadding = 1.0f; - playElements = kVLPlayAccompaniment|kVLPlayMelody|kVLPlayCountIn; sheetWin = nil; pdfWin = nil; logWin = nil; @@ -331,28 +333,19 @@ [validTmpFiles removeObjectForKey:@"pdf"]; } +- (void)setPlayElements:(int)elements +{ + playElements = elements; + [validTmpFiles removeObjectForKey:@"mma"]; + [validTmpFiles removeObjectForKey:@"mid"]; + hasMusicSequence = false; +} + - (int) repeatVolta { return repeatVolta; } -- (IBAction) togglePlayElements:(id)sender -{ - playElements ^= [sender tag]; - [validTmpFiles removeObjectForKey:@"mma"]; - [validTmpFiles removeObjectForKey:@"mid"]; - hasMusicSequence = false; -} - -- (BOOL) validateMenuItem:(NSMenuItem *)menuItem -{ - if ([menuItem action] == @selector(togglePlayElements:)) - if (int tag = [menuItem tag]) - [menuItem setState:(playElements & tag) != 0]; - - return YES; -} - - (bool) brandNew { return brandNew && ![self isDocumentEdited]; diff --git a/Sources/VLSheetWindow.h b/Sources/VLSheetWindow.h index 0d50d82..039078a 100644 --- a/Sources/VLSheetWindow.h +++ b/Sources/VLSheetWindow.h @@ -42,5 +42,6 @@ - (void) startAnimation; - (void) stopAnimation; - (void) willPlaySequence:(MusicSequence)music; +- (IBAction) togglePlayElements:(id)sender; @end diff --git a/Sources/VLSheetWindow.mm b/Sources/VLSheetWindow.mm index 42d6b4b..0a6f94b 100644 --- a/Sources/VLSheetWindow.mm +++ b/Sources/VLSheetWindow.mm @@ -96,4 +96,18 @@ [sheetView willPlaySequence:music]; } +- (IBAction) togglePlayElements:(id)sender +{ + [[self document] setPlayElements:[[self document] playElements] ^ [sender tag]]; +} + +- (BOOL) validateMenuItem:(NSMenuItem *)menuItem +{ + if ([menuItem action] == @selector(togglePlayElements:)) + if (int tag = [menuItem tag]) + [menuItem setState:([[self document] playElements] & tag) != 0]; + + return YES; +} + @end diff --git a/VocalEasel.xcodeproj/project.pbxproj b/VocalEasel.xcodeproj/project.pbxproj index 5843bb0..196ee97 100644 --- a/VocalEasel.xcodeproj/project.pbxproj +++ b/VocalEasel.xcodeproj/project.pbxproj @@ -700,26 +700,26 @@ 95CFA83714091B7800D0DB0D /* VLPitchName.cpp */, 953F4B3A1409AFFA00C627F9 /* VLPitchGrid.h */, 953F4B3C1409B01200C627F9 /* VLPitchGrid.cpp */, - 959A3A6D0DE8CB5B00EF207B /* VLMIDIWriter.h */, - 959A3A6C0DE8CB5B00EF207B /* VLMIDIWriter.cpp */, + 2A37F4AEFDCFA73011CA2CEA /* VLDocument.h */, + 2A37F4ACFDCFA73011CA2CEA /* VLDocument.mm */, 9531F34D0DE2B4CD004F78C2 /* VLAIFFDocument.h */, 9531F34E0DE2B4CD004F78C2 /* VLAIFFDocument.mm */, 9531F34F0DE2B4CD004F78C2 /* VLMP3Document.h */, 9531F3500DE2B4CD004F78C2 /* VLMP3Document.mm */, 9588363A0C6F9C7D004B4162 /* VLPListDocument.h */, 9588363B0C6F9C7D004B4162 /* VLPListDocument.mm */, - 9545C5C10C092F4600251547 /* VLMMAWriter.cpp */, - 9545C5C20C092F4600251547 /* VLMMAWriter.h */, 955DA2940C0551EC008F73B8 /* VLLilypondWriter.cpp */, 955DA2950C0551EC008F73B8 /* VLLilypondWriter.h */, 95A55C520BD5E5760068A203 /* VLPDFDocument.h */, 95A55C530BD5E5770068A203 /* VLPDFDocument.mm */, + 959A3A6D0DE8CB5B00EF207B /* VLMIDIWriter.h */, + 959A3A6C0DE8CB5B00EF207B /* VLMIDIWriter.cpp */, 95EDA5A80B06DE46004D8D6E /* VLMIDIDocument.h */, 95EDA5A90B06DE46004D8D6E /* VLMIDIDocument.mm */, + 9545C5C10C092F4600251547 /* VLMMAWriter.cpp */, + 9545C5C20C092F4600251547 /* VLMMAWriter.h */, 95F820A90AF884A30010963D /* VLMMADocument.h */, 95F820AA0AF884A30010963D /* VLMMADocument.mm */, - 2A37F4AEFDCFA73011CA2CEA /* VLDocument.h */, - 2A37F4ACFDCFA73011CA2CEA /* VLDocument.mm */, 95F5F50D0ADCC433003980B2 /* VLXMLDocument.h */, 95F5F50E0ADCC433003980B2 /* VLXMLDocument.mm */, 953722650AE9F0E100B6E483 /* VLLilypondDocument.h */, @@ -1968,6 +1968,7 @@ 95A7C17F141074AB00833DBE /* Default */, ); defaultConfigurationIsVisible = 0; + defaultConfigurationName = Development; }; 95CFA8571409291500D0DB0D /* Build configuration list for PBXNativeTarget "TVLPitchNames" */ = { isa = XCConfigurationList;