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,18 +599,30 @@ const char * sBreak[3] = {"", "\xE2\xA4\xBE", "\xE2\x8E\x98"};
- (IBAction) setKey:(id)sender
{
if ([self song]->IsNonEmpty())
if ([self song]->IsNonEmpty()) {
int newKey = [[sender selectedItem] tag] >> 8;
NSRange sections= [self sectionsInSelection];
VLSong *song = [self song];
bool plural = sections.length > 1;
while (sections.length-- > 0)
if (song->fProperties[sections.location++].fKey != newKey) {
[[NSAlert alertWithMessageText:@"Transpose Song?"
defaultButton:@"Transpose"
alternateButton:@"Cancel"
otherButton:@"Change Key"
informativeTextWithFormat:
@"Do you want to transpose the song into the new key?"]
@"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];
else
return;
}
}
[self setKey:nil returnCode:NSAlertOtherReturn contextInfo:sender];
}