mirror of
https://github.com/microtherion/VocalEasel.git
synced 2024-12-22 19:23:59 +00:00
Edit per-section groove
This commit is contained in:
parent
cda0deee12
commit
cb78a2ba75
|
@ -55,10 +55,12 @@ enum {
|
||||||
- (int) repeatVolta;
|
- (int) repeatVolta;
|
||||||
- (bool) brandNew;
|
- (bool) brandNew;
|
||||||
|
|
||||||
- (void) setKey:(int)key transpose:(BOOL)transpose inSections:(NSRange)sections;
|
- (void) setKey:(int)key transpose:(BOOL)transpose inSections:(NSRange)sections;
|
||||||
- (void) setTimeNum:(int)num denom:(int)denom inSections:(NSRange)sections;
|
- (void) setTimeNum:(int)num denom:(int)denom inSections:(NSRange)sections;
|
||||||
- (void) setDivisions:(int)divisions inSections:(NSRange)sections;
|
- (void) setDivisions:(int)divisions inSections:(NSRange)sections;
|
||||||
- (void) setRepeatVolta:(int)repeatVolta;
|
- (void) setGroove:(NSString *)groove inSections:(NSRange)sections;
|
||||||
|
|
||||||
|
- (void) setRepeatVolta:(int)repeatVolta;
|
||||||
|
|
||||||
- (IBAction) showOutput:(id)sender;
|
- (IBAction) showOutput:(id)sender;
|
||||||
- (IBAction) showLog:(id)sender;
|
- (IBAction) showLog:(id)sender;
|
||||||
|
|
|
@ -241,13 +241,23 @@
|
||||||
{
|
{
|
||||||
[self willChangeSong];
|
[self willChangeSong];
|
||||||
[self willChangeValueForKey:@"songDivisions"];
|
[self willChangeValueForKey:@"songDivisions"];
|
||||||
[self willChangeSong];
|
|
||||||
while (sections.length-- > 0)
|
while (sections.length-- > 0)
|
||||||
song->ChangeDivisions(sections.location++, divisions);
|
song->ChangeDivisions(sections.location++, divisions);
|
||||||
[self didChangeValueForKey:@"songDivisions"];
|
[self didChangeValueForKey:@"songDivisions"];
|
||||||
[self didChangeSong];
|
[self didChangeSong];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) setGroove:(NSString *)groove inSections:(NSRange)sections
|
||||||
|
{
|
||||||
|
const char * grv = [groove UTF8String];
|
||||||
|
[self willChangeSong];
|
||||||
|
[self willChangeValueForKey:@"songGroove"];
|
||||||
|
while (sections.length-- > 0)
|
||||||
|
song->fProperties[sections.location++].fGroove = grv;
|
||||||
|
[self didChangeValueForKey:@"songGroove"];
|
||||||
|
[self didChangeSong];
|
||||||
|
}
|
||||||
|
|
||||||
- (int) repeatVolta
|
- (int) repeatVolta
|
||||||
{
|
{
|
||||||
return repeatVolta;
|
return repeatVolta;
|
||||||
|
|
|
@ -58,8 +58,6 @@
|
||||||
[fDocument stop:self];
|
[fDocument stop:self];
|
||||||
if (returnCode == NSAlertFirstButtonReturn)
|
if (returnCode == NSAlertFirstButtonReturn)
|
||||||
[(VLSheetView *)contextInfo setGroove:[[fBrowser selectedCellInColumn:1] stringValue]];
|
[(VLSheetView *)contextInfo setGroove:[[fBrowser selectedCellInColumn:1] stringValue]];
|
||||||
else
|
|
||||||
[(VLSheetView *)contextInfo setGroove:nil];
|
|
||||||
|
|
||||||
[[self window] orderOut:self];
|
[[self window] orderOut:self];
|
||||||
}
|
}
|
||||||
|
|
|
@ -517,4 +517,4 @@ advanceAt:
|
||||||
return [self readFromPlist:outPlist error:outError];
|
return [self readFromPlist:outPlist error:outError];
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
|
@ -998,13 +998,15 @@ static int8_t sSharpAcc[] = {
|
||||||
[doc addObserver:self forKeyPath:@"songTime" options:0 context:nil];
|
[doc addObserver:self forKeyPath:@"songTime" options:0 context:nil];
|
||||||
[doc addObserver:self forKeyPath:@"songDivisions" options:0 context:nil];
|
[doc addObserver:self forKeyPath:@"songDivisions" options:0 context:nil];
|
||||||
[doc addObserver:self forKeyPath:@"songGroove" options:0 context:nil];
|
[doc addObserver:self forKeyPath:@"songGroove" options:0 context:nil];
|
||||||
[self setGrooveMenu:[doc valueForKey:@"songGroove"]];
|
|
||||||
|
|
||||||
VLSong * song = [self song];
|
VLSong * song = [self song];
|
||||||
fNumTopLedgers = std::max<int>(song->CountTopLedgers(), 1);
|
fNumTopLedgers = std::max<int>(song->CountTopLedgers(), 1);
|
||||||
fNumBotLedgers = std::max<int>(song->CountBotLedgers(), 1);
|
fNumBotLedgers = std::max<int>(song->CountBotLedgers(), 1);
|
||||||
fNumStanzas = std::max<int>(song->CountStanzas(), 2);
|
fNumStanzas = std::max<int>(song->CountStanzas(), 2);
|
||||||
|
|
||||||
|
[fGrooveMenu addItemsWithTitles:
|
||||||
|
[[NSUserDefaults standardUserDefaults] arrayForKey:@"VLGrooves"]];
|
||||||
|
|
||||||
[self updateMenus];
|
[self updateMenus];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1030,7 +1032,7 @@ static int8_t sSharpAcc[] = {
|
||||||
} else if ([keyPath isEqual:@"songDivisions"]) {
|
} else if ([keyPath isEqual:@"songDivisions"]) {
|
||||||
[self updateDivisionMenu];
|
[self updateDivisionMenu];
|
||||||
} else if ([keyPath isEqual:@"songGroove"]) {
|
} else if ([keyPath isEqual:@"songGroove"]) {
|
||||||
[self setGrooveMenu:[[self document] valueForKey:@"songGroove"]];
|
[self updateGrooveMenu];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1049,26 +1051,7 @@ static int8_t sSharpAcc[] = {
|
||||||
|
|
||||||
- (void)setGroove:(NSString *)groove
|
- (void)setGroove:(NSString *)groove
|
||||||
{
|
{
|
||||||
if (groove) {
|
[[self document] setGroove:groove inSections:[self sectionsInSelection]];
|
||||||
[[self document] setValue:groove forKey:@"songGroove"];
|
|
||||||
[self setGrooveMenu:groove];
|
|
||||||
} else {
|
|
||||||
[fGrooveMenu selectItemAtIndex:2];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)setGrooveMenu:(NSString *)groove
|
|
||||||
{
|
|
||||||
int removeIndex = [fGrooveMenu indexOfItemWithTitle:groove];
|
|
||||||
if (removeIndex < 0 && [fGrooveMenu numberOfItems] > 11)
|
|
||||||
removeIndex = 11;
|
|
||||||
if (removeIndex >= 0)
|
|
||||||
[fGrooveMenu removeItemAtIndex:removeIndex];
|
|
||||||
[fGrooveMenu insertItemWithTitle:groove atIndex:2];
|
|
||||||
[fGrooveMenu selectItemAtIndex:2];
|
|
||||||
NSArray * grooves = [fGrooveMenu itemTitles];
|
|
||||||
grooves = [grooves subarrayWithRange:NSMakeRange(2, [grooves count]-2)];
|
|
||||||
[[NSUserDefaults standardUserDefaults] setObject:grooves forKey:@"VLGrooves"];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)editDisplayOptions:(id)sender
|
- (IBAction)editDisplayOptions:(id)sender
|
||||||
|
|
|
@ -29,6 +29,8 @@
|
||||||
- (void)updateKeyMenu;
|
- (void)updateKeyMenu;
|
||||||
- (void)updateTimeMenu;
|
- (void)updateTimeMenu;
|
||||||
- (void)updateDivisionMenu;
|
- (void)updateDivisionMenu;
|
||||||
|
- (void)updateGrooveMenu;
|
||||||
|
|
||||||
- (void)updateMenus;
|
- (void)updateMenus;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -406,11 +406,41 @@ inline int TimeTag(const VLProperties & prop)
|
||||||
[[menu itemWithTag:firstTag] setState:firstState];
|
[[menu itemWithTag:firstTag] setState:firstState];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)updateGrooveMenu
|
||||||
|
{
|
||||||
|
NSRange sections = [self sectionsInSelection];
|
||||||
|
VLSong * song = [self song];
|
||||||
|
NSMutableArray* grooves = [NSMutableArray array];
|
||||||
|
|
||||||
|
while (sections.length-- > 0) {
|
||||||
|
NSString * groove =
|
||||||
|
[NSString stringWithUTF8String:
|
||||||
|
song->fProperties[sections.location++].fGroove.c_str()];
|
||||||
|
if (![grooves containsObject:groove])
|
||||||
|
[grooves addObject:groove];
|
||||||
|
}
|
||||||
|
int selected = [grooves count];
|
||||||
|
int history = [fGrooveMenu numberOfItems]-2;
|
||||||
|
while (history-- > 0) {
|
||||||
|
NSString * groove = [fGrooveMenu itemTitleAtIndex:2];
|
||||||
|
[fGrooveMenu removeItemAtIndex:2];
|
||||||
|
if (![grooves containsObject:groove])
|
||||||
|
[grooves addObject:groove];
|
||||||
|
}
|
||||||
|
[fGrooveMenu addItemsWithTitles:grooves];
|
||||||
|
[fGrooveMenu selectItemAtIndex:2];
|
||||||
|
if (selected > 1)
|
||||||
|
while (selected-- > 0)
|
||||||
|
[[fGrooveMenu itemAtIndex:selected+2] setState:NSMixedState];
|
||||||
|
[[NSUserDefaults standardUserDefaults] setObject:grooves forKey:@"VLGrooves"];
|
||||||
|
}
|
||||||
|
|
||||||
- (void)updateMenus
|
- (void)updateMenus
|
||||||
{
|
{
|
||||||
[self updateKeyMenu];
|
[self updateKeyMenu];
|
||||||
[self updateTimeMenu];
|
[self updateTimeMenu];
|
||||||
[self updateDivisionMenu];
|
[self updateDivisionMenu];
|
||||||
|
[self updateGrooveMenu];
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
Loading…
Reference in New Issue
Block a user