From d55ba65c0cb34d8027a6e9538dd5b27ce903a7ad Mon Sep 17 00:00:00 2001 From: Matthias Neeracher Date: Sun, 24 Jul 2011 03:32:13 +0000 Subject: [PATCH] Use UTIs instead of type names throughout --- ...er => org.lilypond.lilypond-source.reader} | 0 Resources/Info.plist | 2 +- Sources/VLAIFFDocument.mm | 4 +-- Sources/VLDocument.h | 12 +++++++- Sources/VLDocument.mm | 30 +++++++++---------- Sources/VLMIDIDocument.mm | 4 +-- Sources/VLMMADocument.mm | 2 +- Sources/VLMP3Document.mm | 5 ++-- Sources/VLPDFDocument.mm | 4 +-- Sources/VLXMLDocument.mm | 6 ++-- VocalEasel.xcodeproj/project.pbxproj | 8 ++--- 11 files changed, 44 insertions(+), 33 deletions(-) rename Filters/{VLLilypondType.reader => org.lilypond.lilypond-source.reader} (100%) diff --git a/Filters/VLLilypondType.reader b/Filters/org.lilypond.lilypond-source.reader similarity index 100% rename from Filters/VLLilypondType.reader rename to Filters/org.lilypond.lilypond-source.reader diff --git a/Resources/Info.plist b/Resources/Info.plist index 72e0f84..85ec2ab 100644 --- a/Resources/Info.plist +++ b/Resources/Info.plist @@ -237,7 +237,7 @@ CFBundleURLTypes CFBundleVersion - 1.3a1 + 1.5a1 NSMainNibFile MainMenu NSPrincipalClass diff --git a/Sources/VLAIFFDocument.mm b/Sources/VLAIFFDocument.mm index f53755c..6525166 100644 --- a/Sources/VLAIFFDocument.mm +++ b/Sources/VLAIFFDocument.mm @@ -5,7 +5,7 @@ // // (MN) Matthias Neeracher // -// Copyright © 2008 Matthias Neeracher +// Copyright © 2008-2011 Matthias Neeracher // #import "VLAIFFDocument.h" @@ -17,7 +17,7 @@ - (NSFileWrapper *)aiffFileWrapperWithError:(NSError **)outError { - [self createTmpFileWithExtension:@"mid" ofType:@"VLMIDIType"]; + [self createTmpFileWithExtension:@"mid" ofType:VLMIDIType]; NSURL * midiURL = [self fileURLWithExtension:@"mid"]; NSURL * aiffURL = [self fileURLWithExtension:@"aiff"]; diff --git a/Sources/VLDocument.h b/Sources/VLDocument.h index d8178ef..b8d278f 100644 --- a/Sources/VLDocument.h +++ b/Sources/VLDocument.h @@ -5,7 +5,7 @@ // // (MN) Matthias Neeracher // -// Copyright © 2005-2007 Matthias Neeracher +// Copyright © 2005-2011 Matthias Neeracher // #import "VLModel.h" @@ -17,6 +17,16 @@ @class VLLogWindow; @class PDFDocument; +#define VLBIABType @"VLBIABType" +#define VLNativeType @"org.aereperennius.vocaleasel-song" +#define VLLilypondType @"org.lilypond.lilypond-source" +#define VLMusicXMLType @"VLMusicXMLType" +#define VLMMAType @"VLMMAType" +#define VLMIDIType @"public.midi" +#define VLPDFType @"com.adobe.pdf" +#define VLAIFFType @"public.aifc-audio" +#define VLMP3Type @"public.mp3" + enum { kVLPlayAccompaniment = 1, kVLPlayMelody = 2, diff --git a/Sources/VLDocument.mm b/Sources/VLDocument.mm index 8438eb3..f20cacc 100644 --- a/Sources/VLDocument.mm +++ b/Sources/VLDocument.mm @@ -5,7 +5,7 @@ // // (MN) Matthias Neeracher // -// Copyright © 2005-2008 Matthias Neeracher +// Copyright © 2005-2011 Matthias Neeracher // #import "VLDocument.h" @@ -403,7 +403,7 @@ forSaveOperation:saveOperation error:outError]; if (!vcsWrapper) vcsWrapper = preservedVCSWrapper; - if ([typeName isEqual:@"VLNativeType"]) + if ([typeName isEqual:VLNativeType]) [validTmpFiles removeAllObjects]; return res; @@ -411,21 +411,21 @@ - (NSFileWrapper *)fileWrapperOfType:(NSString *)typeName error:(NSError **)outError { - if ([typeName isEqual:@"VLNativeType"]) { + if ([typeName isEqual:VLNativeType]) { return [self XMLFileWrapperWithError:outError flat:NO]; - } else if ([typeName isEqual:@"VLMusicXMLType"]) { + } else if ([typeName isEqual:VLMusicXMLType]) { return [self XMLFileWrapperWithError:outError flat:YES]; - } else if ([typeName isEqual:@"VLLilypondType"]) { + } else if ([typeName isEqual:VLLilypondType]) { return [self lilypondFileWrapperWithError:outError]; - } else if ([typeName isEqual:@"VLMMAType"]) { + } else if ([typeName isEqual:VLMMAType]) { return [self mmaFileWrapperWithError:outError]; - } else if ([typeName isEqual:@"VLMIDIType"]) { + } else if ([typeName isEqual:VLMIDIType]) { return [self midiFileWrapperWithError:outError]; - } else if ([typeName isEqual:@"VLAIFFType"]) { + } else if ([typeName isEqual:VLAIFFType]) { return [self aiffFileWrapperWithError:outError]; - } else if ([typeName isEqual:@"VLMP3Type"]) { + } else if ([typeName isEqual:VLMP3Type]) { return [self mp3FileWrapperWithError:outError]; - } else if ([typeName isEqual:@"VLPDFType"]) { + } else if ([typeName isEqual:VLPDFType]) { return [self pdfFileWrapperWithError:outError]; } else { if (outError) @@ -449,9 +449,9 @@ [[doc windowControllers] makeObjectsPerformSelector:@selector(close)]; - if ([typeName isEqual:@"VLNativeType"] || [typeName isEqual:@"VLMusicXMLType"]) { + if ([typeName isEqual:VLNativeType] || [typeName isEqual:VLMusicXMLType]) { return [self readFromXMLFileWrapper:wrapper error:outError]; - } else if ([typeName isEqual:@"VLLilypondType"] || [typeName isEqual:@"VLBIABType"]) { + } else if ([typeName isEqual:VLLilypondType] || [typeName isEqual:VLBIABType]) { if ([self readFromFileWrapper:wrapper withFilter:typeName error:outError]) { [self setFileURL:nil]; return YES; @@ -513,7 +513,7 @@ if (hasMusicSequence) { VLSoundOut::Instance()->PlaySequence(NULL); } else { - [self createTmpFileWithExtension:@"mid" ofType:@"VLMIDIType"]; + [self createTmpFileWithExtension:@"mid" ofType:VLMIDIType]; MusicSequence music; NewMusicSequence(&music); @@ -618,7 +618,7 @@ - (IBAction) showOutput:(id)sender { - [self createTmpFileWithExtension:@"pdf" ofType:@"VLPDFType"]; + [self createTmpFileWithExtension:@"pdf" ofType:VLPDFType]; [[self pdfWin] showWindow:sender]; [pdfWin reloadPDF]; } @@ -626,7 +626,7 @@ - (NSPrintOperation *)printOperationWithSettings:(NSDictionary *)printSettings error:(NSError **)outError { - [self createTmpFileWithExtension:@"pdf" ofType:@"VLPDFType"]; + [self createTmpFileWithExtension:@"pdf" ofType:VLPDFType]; [printDoc autorelease]; printDoc = [[PDFDocument alloc] initWithURL:[self fileURLWithExtension:@"pdf"]]; diff --git a/Sources/VLMIDIDocument.mm b/Sources/VLMIDIDocument.mm index e86f510..3201c13 100644 --- a/Sources/VLMIDIDocument.mm +++ b/Sources/VLMIDIDocument.mm @@ -5,7 +5,7 @@ // // (MN) Matthias Neeracher // -// Copyright © 2006-2007 Matthias Neeracher +// Copyright © 2006-2011 Matthias Neeracher // #import "VLMIDIDocument.h" @@ -17,7 +17,7 @@ { NSBundle * mainBundle = [NSBundle mainBundle]; - [self createTmpFileWithExtension:@"mma" ofType:@"VLMMAType"]; + [self createTmpFileWithExtension:@"mma" ofType:VLMMAType]; NSURL * mmaURL = [self fileURLWithExtension:@"mma"]; NSString * launch = diff --git a/Sources/VLMMADocument.mm b/Sources/VLMMADocument.mm index 18bf59c..3114aff 100644 --- a/Sources/VLMMADocument.mm +++ b/Sources/VLMMADocument.mm @@ -5,7 +5,7 @@ // // (MN) Matthias Neeracher // -// Copyright © 2006-2007 Matthias Neeracher +// Copyright © 2006-2007 Matthias Neeracher // #import "VLMMADocument.h" diff --git a/Sources/VLMP3Document.mm b/Sources/VLMP3Document.mm index 3f3a383..6b080bd 100644 --- a/Sources/VLMP3Document.mm +++ b/Sources/VLMP3Document.mm @@ -5,9 +5,10 @@ // // (MN) Matthias Neeracher // -// Copyright © 2008 Matthias Neeracher +// Copyright © 2008-2011 Matthias Neeracher // +#import "VLAppController.h" #import "VLMP3Document.h" @implementation VLDocument (MP3) @@ -22,7 +23,7 @@ } NSBundle * mainBundle = [NSBundle mainBundle]; - [self createTmpFileWithExtension:@"aiff" ofType:@"VLAIFFType"]; + [self createTmpFileWithExtension:@"aiff" ofType:VLAIFFType]; NSURL * aiffURL = [self fileURLWithExtension:@"aiff"]; NSURL * mp3URL = [self fileURLWithExtension:@"mp3"]; diff --git a/Sources/VLPDFDocument.mm b/Sources/VLPDFDocument.mm index 15c18ac..70deb95 100644 --- a/Sources/VLPDFDocument.mm +++ b/Sources/VLPDFDocument.mm @@ -5,7 +5,7 @@ // // (MN) Matthias Neeracher // -// Copyright © 2006-2007 Matthias Neeracher +// Copyright © 2006-2011 Matthias Neeracher // #import "VLPDFDocument.h" @@ -17,7 +17,7 @@ NSString * base = [self baseName]; NSBundle * mainBundle = [NSBundle mainBundle]; - [self createTmpFileWithExtension:@"ly" ofType:@"VLLilypondType"]; + [self createTmpFileWithExtension:@"ly" ofType:VLLilypondType]; NSString * launch = [mainBundle pathForResource:@"lilyWrapper" ofType:@"" diff --git a/Sources/VLXMLDocument.mm b/Sources/VLXMLDocument.mm index 276c65f..b074e30 100644 --- a/Sources/VLXMLDocument.mm +++ b/Sources/VLXMLDocument.mm @@ -17,7 +17,7 @@ { static NSArray * sPropertyKeys = nil; - NSFileWrapper * contents = [self fileWrapperWithFilter:@"VLMusicXMLType" error:outError]; + NSFileWrapper * contents = [self fileWrapperWithFilter:VLMusicXMLType error:outError]; if (!contents) { return nil; @@ -82,10 +82,10 @@ [self setPrintInfo:pi]; [undoMgr enableUndoRegistration]; } - return [self readFromFileWrapper:[wrappers objectForKey:@"Song"] withFilter:@"VLMusicXMLType" + return [self readFromFileWrapper:[wrappers objectForKey:@"Song"] withFilter:VLMusicXMLType error:outError]; } else { - if ([self readFromFileWrapper:wrapper withFilter:@"VLMusicXMLType" error:outError]) { + if ([self readFromFileWrapper:wrapper withFilter:VLMusicXMLType error:outError]) { [self setFileURL:nil]; return YES; diff --git a/VocalEasel.xcodeproj/project.pbxproj b/VocalEasel.xcodeproj/project.pbxproj index b9e35e0..2a5bbbf 100644 --- a/VocalEasel.xcodeproj/project.pbxproj +++ b/VocalEasel.xcodeproj/project.pbxproj @@ -29,7 +29,7 @@ 95009B830B0EDCD800EB33A4 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 95009B820B0EDCD800EB33A4 /* CoreFoundation.framework */; }; 95049CF30BDC32EB0015EE6E /* installLilypond.scpt in Resources */ = {isa = PBXBuildFile; fileRef = 95049CF20BDC32CD0015EE6E /* installLilypond.scpt */; }; 95049D020BDC436A0015EE6E /* installPython.scpt in Resources */ = {isa = PBXBuildFile; fileRef = 95049D010BDC43510015EE6E /* installPython.scpt */; }; - 95140E3C0C944F7F00966576 /* VLLilypondType.reader in Copy Filters */ = {isa = PBXBuildFile; fileRef = 95140E3B0C944F7F00966576 /* VLLilypondType.reader */; }; + 95140E3C0C944F7F00966576 /* org.lilypond.lilypond-source.reader in Copy Filters */ = {isa = PBXBuildFile; fileRef = 95140E3B0C944F7F00966576 /* org.lilypond.lilypond-source.reader */; }; 9524DAFB0BE569C50002AC03 /* Help in Resources */ = {isa = PBXBuildFile; fileRef = 9524DAF70BE569C50002AC03 /* Help */; }; 9524DB390BE5CA070002AC03 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9524DB380BE5CA070002AC03 /* Carbon.framework */; }; 95297F310C9ADA33007EFD6B /* VLBIABType.reader in Copy Filters */ = {isa = PBXBuildFile; fileRef = 95297F300C9ADA33007EFD6B /* VLBIABType.reader */; }; @@ -150,7 +150,7 @@ dstSubfolderSpec = 7; files = ( 95297F310C9ADA33007EFD6B /* VLBIABType.reader in Copy Filters */, - 95140E3C0C944F7F00966576 /* VLLilypondType.reader in Copy Filters */, + 95140E3C0C944F7F00966576 /* org.lilypond.lilypond-source.reader in Copy Filters */, 95795CE60C88B25D00E4A21F /* vl.rb in Copy Filters */, 95795CE70C88B25D00E4A21F /* VLMusicXMLType.reader in Copy Filters */, 95EF921A0C786CB90093E5F4 /* plistReader.rb in Copy Filters */, @@ -194,7 +194,7 @@ 95009B820B0EDCD800EB33A4 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = /System/Library/Frameworks/CoreFoundation.framework; sourceTree = ""; }; 95049CF20BDC32CD0015EE6E /* installLilypond.scpt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = file; name = installLilypond.scpt; path = Resources/installLilypond.scpt; sourceTree = ""; }; 95049D010BDC43510015EE6E /* installPython.scpt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = file; name = installPython.scpt; path = Resources/installPython.scpt; sourceTree = ""; }; - 95140E3B0C944F7F00966576 /* VLLilypondType.reader */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.ruby; path = VLLilypondType.reader; sourceTree = ""; }; + 95140E3B0C944F7F00966576 /* org.lilypond.lilypond-source.reader */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.ruby; path = "org.lilypond.lilypond-source.reader"; sourceTree = ""; }; 9524DAF70BE569C50002AC03 /* Help */ = {isa = PBXFileReference; lastKnownFileType = folder; name = Help; path = Resources/Help; sourceTree = ""; }; 9524DB380BE5CA070002AC03 /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = ""; }; 95297F300C9ADA33007EFD6B /* VLBIABType.reader */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.ruby; path = VLBIABType.reader; sourceTree = ""; }; @@ -585,7 +585,7 @@ 95795CE50C88B25D00E4A21F /* VLMusicXMLType.reader */, 95297F300C9ADA33007EFD6B /* VLBIABType.reader */, 95EF92270C78E9390093E5F4 /* VLMusicXMLType.writer */, - 95140E3B0C944F7F00966576 /* VLLilypondType.reader */, + 95140E3B0C944F7F00966576 /* org.lilypond.lilypond-source.reader */, 95EF92120C786B2C0093E5F4 /* plistReader.rb */, 95EF92130C786B2C0093E5F4 /* plistWriter.rb */, );