Use UTIs instead of type names throughout

This commit is contained in:
Matthias Neeracher 2011-07-24 03:32:13 +00:00
parent ecd3593a04
commit d55ba65c0c
11 changed files with 44 additions and 33 deletions

View File

@ -237,7 +237,7 @@
<key>CFBundleURLTypes</key>
<array/>
<key>CFBundleVersion</key>
<string>1.3a1</string>
<string>1.5a1</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>

View File

@ -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"];

View File

@ -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,

View File

@ -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"]];

View File

@ -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 =

View File

@ -5,7 +5,7 @@
//
// (MN) Matthias Neeracher
//
// Copyright © 2006-2007 Matthias Neeracher
// Copyright © 2006-2007 Matthias Neeracher
//
#import "VLMMADocument.h"

View File

@ -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"];

View File

@ -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:@""

View File

@ -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;

View File

@ -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 = "<absolute>"; };
95049CF20BDC32CD0015EE6E /* installLilypond.scpt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = file; name = installLilypond.scpt; path = Resources/installLilypond.scpt; sourceTree = "<group>"; };
95049D010BDC43510015EE6E /* installPython.scpt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = file; name = installPython.scpt; path = Resources/installPython.scpt; sourceTree = "<group>"; };
95140E3B0C944F7F00966576 /* VLLilypondType.reader */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.ruby; path = VLLilypondType.reader; sourceTree = "<group>"; };
95140E3B0C944F7F00966576 /* org.lilypond.lilypond-source.reader */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.ruby; path = "org.lilypond.lilypond-source.reader"; sourceTree = "<group>"; };
9524DAF70BE569C50002AC03 /* Help */ = {isa = PBXFileReference; lastKnownFileType = folder; name = Help; path = Resources/Help; sourceTree = "<group>"; };
9524DB380BE5CA070002AC03 /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = "<absolute>"; };
95297F300C9ADA33007EFD6B /* VLBIABType.reader */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.ruby; path = VLBIABType.reader; sourceTree = "<group>"; };
@ -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 */,
);