Write lyrics, use straight NSDates

This commit is contained in:
Matthias Neeracher 2007-08-18 23:17:27 +00:00
parent a8a0d07295
commit d9d1096dc2

View File

@ -125,6 +125,15 @@ void VLPlistVisitor::VisitMeasure(size_t m, VLProperties & p, VLMeasure & meas)
void VLPlistVisitor::VisitNote(VLLyricsNote & n) void VLPlistVisitor::VisitNote(VLLyricsNote & n)
{ {
NSMutableArray * ly = [NSMutableArray arrayWithCapacity:0];
for (size_t i = 0; i<n.fLyrics.size(); ++i)
[ly addObject:n.fLyrics[i].fText.size()
? [NSDictionary dictionaryWithObjectsAndKeys:
[NSString stringWithUTF8String:n.fLyrics[i].fText.c_str()], @"text",
[NSNumber numberWithInt:n.fLyrics[i].fKind], @"kind",
nil]
: [NSDictionary dictionary]];
NSDictionary * nd = NSDictionary * nd =
[NSDictionary dictionaryWithObjectsAndKeys: [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithInt:n.fDuration.fNum], @"durNum", [NSNumber numberWithInt:n.fDuration.fNum], @"durNum",
@ -132,6 +141,7 @@ void VLPlistVisitor::VisitNote(VLLyricsNote & n)
[NSNumber numberWithInt:n.fPitch], @"pitch", [NSNumber numberWithInt:n.fPitch], @"pitch",
[NSNumber numberWithInt:n.fTied], @"tied", [NSNumber numberWithInt:n.fTied], @"tied",
[NSNumber numberWithInt:n.fVisual], @"visual", [NSNumber numberWithInt:n.fVisual], @"visual",
ly, @"lyrics",
nil]; nil];
[fNotes addObject:nd]; [fNotes addObject:nd];
} }
@ -155,11 +165,7 @@ void VLPlistVisitor::VisitChord(VLChord & c)
[NSMutableDictionary dictionaryWithCapacity:20]; [NSMutableDictionary dictionaryWithCapacity:20];
[plist setObject:songComposer forKey:@"composer"]; [plist setObject:songComposer forKey:@"composer"];
[plist setObject:songLyricist forKey:@"lyricist"]; [plist setObject:songLyricist forKey:@"lyricist"];
[plist setObject: [plist setObject:[NSDate date] forKey:@"saved"];
[[NSDate date]
descriptionWithCalendarFormat:@"%Y-%m-%d"
timeZone:nil locale:nil]
forKey:@"saved"];
[plist setObject: [plist setObject:
[NSString stringWithFormat:@"VocalEasel %@", [NSString stringWithFormat:@"VocalEasel %@",
[[NSBundle mainBundle] [[NSBundle mainBundle]
@ -174,7 +180,12 @@ void VLPlistVisitor::VisitChord(VLChord & c)
- (IBAction)dump:(id)sender - (IBAction)dump:(id)sender
{ {
NSLog(@"%@\n", [self plistInPerformanceOrder:NO]); id plist = [self plistInPerformanceOrder:NO];
if ([sender tag])
plist = [[[NSString alloc] initWithData:
[NSPropertyListSerialization dataFromPropertyList:plist format:NSPropertyListXMLFormat_v1_0 errorDescription:nil]
encoding:NSUTF8StringEncoding] autorelease];
NSLog(@"%@\n", plist);
} }
- (BOOL)readFromPlist:(id)plist error:(NSError **)outError - (BOOL)readFromPlist:(id)plist error:(NSError **)outError