Silently transpose between major and minor modes

This commit is contained in:
Matthias Neeracher 2008-01-16 13:16:53 +00:00
parent 5423e65457
commit bd59e9b4ab

View File

@ -599,19 +599,31 @@ const char * sBreak[3] = {"", "\xE2\xA4\xBE", "\xE2\x8E\x98"};
- (IBAction) setKey:(id)sender - (IBAction) setKey:(id)sender
{ {
if ([self song]->IsNonEmpty()) if ([self song]->IsNonEmpty()) {
[[NSAlert alertWithMessageText:@"Transpose Song?" int newKey = [[sender selectedItem] tag] >> 8;
defaultButton:@"Transpose" NSRange sections= [self sectionsInSelection];
alternateButton:@"Cancel" VLSong *song = [self song];
otherButton:@"Change Key" bool plural = sections.length > 1;
informativeTextWithFormat:
@"Do you want to transpose the song into the new key?"] while (sections.length-- > 0)
beginSheetModalForWindow:[self window] if (song->fProperties[sections.location++].fKey != newKey) {
modalDelegate:self [[NSAlert alertWithMessageText:@"Transpose Song?"
didEndSelector:@selector(setKey:returnCode:contextInfo:) defaultButton:@"Transpose"
contextInfo:sender]; alternateButton:@"Cancel"
else otherButton:@"Change Key"
[self setKey:nil returnCode:NSAlertOtherReturn contextInfo:sender]; informativeTextWithFormat:
@"Do you want to transpose the %@ into the new key?",
(fSelEnd > -1 && song->fProperties.size() > 1)
? (plural ? @"sections" : @"section") : @"song"
]
beginSheetModalForWindow:[self window]
modalDelegate:self
didEndSelector:@selector(setKey:returnCode:contextInfo:)
contextInfo:sender];
return;
}
}
[self setKey:nil returnCode:NSAlertOtherReturn contextInfo:sender];
} }
- (IBAction) setTime:(id)sender - (IBAction) setTime:(id)sender