Transfer playElements manipulation to VLSheetWindow

This commit is contained in:
Matthias Neeracher 2011-09-04 02:00:26 +02:00
parent 3567608c0c
commit fba1d2c9f6
5 changed files with 36 additions and 26 deletions

View File

@ -53,7 +53,7 @@ enum {
float staffPadding; float staffPadding;
float chordPadding; float chordPadding;
float lyricPadding; float lyricPadding;
int playElements; int playElements;
NSURL * tmpURL; NSURL * tmpURL;
NSFileWrapper * vcsWrapper; NSFileWrapper * vcsWrapper;
NSMutableArray* observers; NSMutableArray* observers;
@ -71,6 +71,8 @@ enum {
float baseTempo; float baseTempo;
} }
@property (nonatomic) int playElements;
- (VLSong *) song; - (VLSong *) song;
- (NSNumber *) songKey; - (NSNumber *) songKey;
- (NSNumber *) songTime; - (NSNumber *) songTime;
@ -94,7 +96,6 @@ enum {
- (IBAction) playStop:(id)sender; - (IBAction) playStop:(id)sender;
- (IBAction) playMusic:(id)sender; - (IBAction) playMusic:(id)sender;
- (IBAction) adjustTempo:(id)sender; - (IBAction) adjustTempo:(id)sender;
- (IBAction) togglePlayElements:(id)sender;
- (NSURL *) tmpURL; - (NSURL *) tmpURL;
- (NSURL *) workURL; - (NSURL *) workURL;

View File

@ -68,6 +68,8 @@
@implementation VLDocument @implementation VLDocument
@synthesize playElements;
+ (BOOL)autosavesInPlace + (BOOL)autosavesInPlace
{ {
return YES; return YES;
@ -84,6 +86,7 @@
songComposer = @""; songComposer = @"";
songArranger = @""; songArranger = @"";
songGroove = @"Swing"; songGroove = @"Swing";
playElements = kVLPlayAccompaniment|kVLPlayMelody|kVLPlayCountIn;
songTempo = [[NSNumber alloc] initWithInt:120]; songTempo = [[NSNumber alloc] initWithInt:120];
baseTempo = 120.0f; baseTempo = 120.0f;
chordSize = 6.0f; chordSize = 6.0f;
@ -94,7 +97,6 @@
staffPadding = 3.0f; staffPadding = 3.0f;
chordPadding = 1.5f; chordPadding = 1.5f;
lyricPadding = 1.0f; lyricPadding = 1.0f;
playElements = kVLPlayAccompaniment|kVLPlayMelody|kVLPlayCountIn;
sheetWin = nil; sheetWin = nil;
pdfWin = nil; pdfWin = nil;
logWin = nil; logWin = nil;
@ -331,28 +333,19 @@
[validTmpFiles removeObjectForKey:@"pdf"]; [validTmpFiles removeObjectForKey:@"pdf"];
} }
- (void)setPlayElements:(int)elements
{
playElements = elements;
[validTmpFiles removeObjectForKey:@"mma"];
[validTmpFiles removeObjectForKey:@"mid"];
hasMusicSequence = false;
}
- (int) repeatVolta - (int) repeatVolta
{ {
return 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 - (bool) brandNew
{ {
return brandNew && ![self isDocumentEdited]; return brandNew && ![self isDocumentEdited];

View File

@ -42,5 +42,6 @@
- (void) startAnimation; - (void) startAnimation;
- (void) stopAnimation; - (void) stopAnimation;
- (void) willPlaySequence:(MusicSequence)music; - (void) willPlaySequence:(MusicSequence)music;
- (IBAction) togglePlayElements:(id)sender;
@end @end

View File

@ -96,4 +96,18 @@
[sheetView willPlaySequence:music]; [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 @end

View File

@ -700,26 +700,26 @@
95CFA83714091B7800D0DB0D /* VLPitchName.cpp */, 95CFA83714091B7800D0DB0D /* VLPitchName.cpp */,
953F4B3A1409AFFA00C627F9 /* VLPitchGrid.h */, 953F4B3A1409AFFA00C627F9 /* VLPitchGrid.h */,
953F4B3C1409B01200C627F9 /* VLPitchGrid.cpp */, 953F4B3C1409B01200C627F9 /* VLPitchGrid.cpp */,
959A3A6D0DE8CB5B00EF207B /* VLMIDIWriter.h */, 2A37F4AEFDCFA73011CA2CEA /* VLDocument.h */,
959A3A6C0DE8CB5B00EF207B /* VLMIDIWriter.cpp */, 2A37F4ACFDCFA73011CA2CEA /* VLDocument.mm */,
9531F34D0DE2B4CD004F78C2 /* VLAIFFDocument.h */, 9531F34D0DE2B4CD004F78C2 /* VLAIFFDocument.h */,
9531F34E0DE2B4CD004F78C2 /* VLAIFFDocument.mm */, 9531F34E0DE2B4CD004F78C2 /* VLAIFFDocument.mm */,
9531F34F0DE2B4CD004F78C2 /* VLMP3Document.h */, 9531F34F0DE2B4CD004F78C2 /* VLMP3Document.h */,
9531F3500DE2B4CD004F78C2 /* VLMP3Document.mm */, 9531F3500DE2B4CD004F78C2 /* VLMP3Document.mm */,
9588363A0C6F9C7D004B4162 /* VLPListDocument.h */, 9588363A0C6F9C7D004B4162 /* VLPListDocument.h */,
9588363B0C6F9C7D004B4162 /* VLPListDocument.mm */, 9588363B0C6F9C7D004B4162 /* VLPListDocument.mm */,
9545C5C10C092F4600251547 /* VLMMAWriter.cpp */,
9545C5C20C092F4600251547 /* VLMMAWriter.h */,
955DA2940C0551EC008F73B8 /* VLLilypondWriter.cpp */, 955DA2940C0551EC008F73B8 /* VLLilypondWriter.cpp */,
955DA2950C0551EC008F73B8 /* VLLilypondWriter.h */, 955DA2950C0551EC008F73B8 /* VLLilypondWriter.h */,
95A55C520BD5E5760068A203 /* VLPDFDocument.h */, 95A55C520BD5E5760068A203 /* VLPDFDocument.h */,
95A55C530BD5E5770068A203 /* VLPDFDocument.mm */, 95A55C530BD5E5770068A203 /* VLPDFDocument.mm */,
959A3A6D0DE8CB5B00EF207B /* VLMIDIWriter.h */,
959A3A6C0DE8CB5B00EF207B /* VLMIDIWriter.cpp */,
95EDA5A80B06DE46004D8D6E /* VLMIDIDocument.h */, 95EDA5A80B06DE46004D8D6E /* VLMIDIDocument.h */,
95EDA5A90B06DE46004D8D6E /* VLMIDIDocument.mm */, 95EDA5A90B06DE46004D8D6E /* VLMIDIDocument.mm */,
9545C5C10C092F4600251547 /* VLMMAWriter.cpp */,
9545C5C20C092F4600251547 /* VLMMAWriter.h */,
95F820A90AF884A30010963D /* VLMMADocument.h */, 95F820A90AF884A30010963D /* VLMMADocument.h */,
95F820AA0AF884A30010963D /* VLMMADocument.mm */, 95F820AA0AF884A30010963D /* VLMMADocument.mm */,
2A37F4AEFDCFA73011CA2CEA /* VLDocument.h */,
2A37F4ACFDCFA73011CA2CEA /* VLDocument.mm */,
95F5F50D0ADCC433003980B2 /* VLXMLDocument.h */, 95F5F50D0ADCC433003980B2 /* VLXMLDocument.h */,
95F5F50E0ADCC433003980B2 /* VLXMLDocument.mm */, 95F5F50E0ADCC433003980B2 /* VLXMLDocument.mm */,
953722650AE9F0E100B6E483 /* VLLilypondDocument.h */, 953722650AE9F0E100B6E483 /* VLLilypondDocument.h */,
@ -1968,6 +1968,7 @@
95A7C17F141074AB00833DBE /* Default */, 95A7C17F141074AB00833DBE /* Default */,
); );
defaultConfigurationIsVisible = 0; defaultConfigurationIsVisible = 0;
defaultConfigurationName = Development;
}; };
95CFA8571409291500D0DB0D /* Build configuration list for PBXNativeTarget "TVLPitchNames" */ = { 95CFA8571409291500D0DB0D /* Build configuration list for PBXNativeTarget "TVLPitchNames" */ = {
isa = XCConfigurationList; isa = XCConfigurationList;