mirror of
https://github.com/microtherion/VocalEasel.git
synced 2024-12-22 11:14:00 +00:00
Implement toolbars, typesetting, titles
This commit is contained in:
parent
992ed818d6
commit
4f92948d6d
6
English.lproj/MainMenu.nib/info.nib
generated
6
English.lproj/MainMenu.nib/info.nib
generated
|
@ -7,16 +7,16 @@
|
|||
<key>IBEditorPositions</key>
|
||||
<dict>
|
||||
<key>29</key>
|
||||
<string>150 476 301 44 0 0 1024 746 </string>
|
||||
<string>214 402 301 44 0 0 1024 746 </string>
|
||||
</dict>
|
||||
<key>IBFramework Version</key>
|
||||
<string>452.0</string>
|
||||
<string>453.0</string>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>29</integer>
|
||||
<integer>217</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>9A283</string>
|
||||
<string>9A294</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
BIN
English.lproj/MainMenu.nib/keyedobjects.nib
generated
BIN
English.lproj/MainMenu.nib/keyedobjects.nib
generated
Binary file not shown.
25
English.lproj/VLDocument.nib/classes.nib
generated
25
English.lproj/VLDocument.nib/classes.nib
generated
|
@ -1,14 +1,37 @@
|
|||
{
|
||||
IBClasses = (
|
||||
{CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
|
||||
{
|
||||
ACTIONS = {engrave = id; showLog = id; showOutput = id; };
|
||||
CLASS = FirstResponder;
|
||||
LANGUAGE = ObjC;
|
||||
SUPERCLASS = NSObject;
|
||||
},
|
||||
{CLASS = VLDocument; LANGUAGE = ObjC; SUPERCLASS = NSDocument; },
|
||||
{CLASS = VLEditable; LANGUAGE = ObjC; SUPERCLASS = NSObject; },
|
||||
{
|
||||
CLASS = VLPDFWindow;
|
||||
LANGUAGE = ObjC;
|
||||
OUTLETS = {
|
||||
nextPageItem = id;
|
||||
pdfView = id;
|
||||
prevPageItem = id;
|
||||
zoomInItem = id;
|
||||
zoomOutItem = id;
|
||||
};
|
||||
SUPERCLASS = NSWindowController;
|
||||
},
|
||||
{
|
||||
ACTIONS = {hideFieldEditor = id; setDivisions = id; setKey = id; setTime = id; };
|
||||
CLASS = VLSheetView;
|
||||
LANGUAGE = ObjC;
|
||||
OUTLETS = {fFieldEditor = id; };
|
||||
SUPERCLASS = NSView;
|
||||
},
|
||||
{
|
||||
CLASS = VLSheetWindow;
|
||||
LANGUAGE = ObjC;
|
||||
OUTLETS = {logToolItem = id; outputToolItem = id; runToolItem = id; };
|
||||
SUPERCLASS = NSWindowController;
|
||||
}
|
||||
);
|
||||
IBVersion = 1;
|
||||
|
|
7
English.lproj/VLDocument.nib/info.nib
generated
7
English.lproj/VLDocument.nib/info.nib
generated
|
@ -3,14 +3,15 @@
|
|||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IBDocumentLocation</key>
|
||||
<string>36 103 356 240 0 0 1024 746 </string>
|
||||
<string>31 27 356 240 0 0 1024 746 </string>
|
||||
<key>IBFramework Version</key>
|
||||
<string>452.0</string>
|
||||
<string>453.0</string>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>144</integer>
|
||||
<integer>5</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>9A283</string>
|
||||
<string>9A294</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
BIN
English.lproj/VLDocument.nib/keyedobjects.nib
generated
BIN
English.lproj/VLDocument.nib/keyedobjects.nib
generated
Binary file not shown.
4
Resources/VLLogWindow.nib/info.nib
generated
4
Resources/VLLogWindow.nib/info.nib
generated
|
@ -5,12 +5,12 @@
|
|||
<key>IBDocumentLocation</key>
|
||||
<string>210 57 356 240 0 0 1024 746 </string>
|
||||
<key>IBFramework Version</key>
|
||||
<string>452.0</string>
|
||||
<string>453.0</string>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>5</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>9A283</string>
|
||||
<string>9A294</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
BIN
Resources/VLLogWindow.nib/keyedobjects.nib
generated
BIN
Resources/VLLogWindow.nib/keyedobjects.nib
generated
Binary file not shown.
3
Resources/VLPDFWindow.nib/classes.nib
generated
3
Resources/VLPDFWindow.nib/classes.nib
generated
|
@ -19,12 +19,13 @@
|
|||
SUPERCLASS = NSWindowController;
|
||||
},
|
||||
{CLASS = LilypondPDFView; LANGUAGE = ObjC; SUPERCLASS = PDFView; },
|
||||
{CLASS = VLPDFView; LANGUAGE = ObjC; SUPERCLASS = PDFView; },
|
||||
{
|
||||
CLASS = VLPDFWindow;
|
||||
LANGUAGE = ObjC;
|
||||
OUTLETS = {
|
||||
PDFView = id;
|
||||
nextPageItem = id;
|
||||
pdfView = id;
|
||||
prevPageItem = id;
|
||||
zoomInItem = id;
|
||||
zoomOutItem = id;
|
||||
|
|
7
Resources/VLPDFWindow.nib/info.nib
generated
7
Resources/VLPDFWindow.nib/info.nib
generated
|
@ -3,14 +3,15 @@
|
|||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>IBDocumentLocation</key>
|
||||
<string>122 105 356 240 0 0 1024 746 </string>
|
||||
<string>57 42 356 240 0 0 1024 746 </string>
|
||||
<key>IBFramework Version</key>
|
||||
<string>452.0</string>
|
||||
<string>453.0</string>
|
||||
<key>IBOpenObjects</key>
|
||||
<array>
|
||||
<integer>11</integer>
|
||||
<integer>5</integer>
|
||||
</array>
|
||||
<key>IBSystem Version</key>
|
||||
<string>9A283</string>
|
||||
<string>9A294</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
|
BIN
Resources/VLPDFWindow.nib/keyedobjects.nib
generated
BIN
Resources/VLPDFWindow.nib/keyedobjects.nib
generated
Binary file not shown.
8
Resources/lilyWrapper
Executable file
8
Resources/lilyWrapper
Executable file
|
@ -0,0 +1,8 @@
|
|||
#!/bin/bash -l
|
||||
|
||||
export PATH=`dirname $1`:$PATH
|
||||
echo PATH=$PATH
|
||||
$*
|
||||
|
||||
|
||||
|
|
@ -59,6 +59,7 @@
|
|||
toolPath = nil;
|
||||
appPath = nil;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (NSString*)getLineFromCommand:(NSString*)command
|
||||
|
@ -82,7 +83,7 @@
|
|||
{
|
||||
NSString * cmd =
|
||||
[NSString stringWithFormat:
|
||||
@"%@ --version | awk '{ print $3 }'",
|
||||
@"%@ --version | head -1 | awk '{ print $3 }'",
|
||||
path];
|
||||
return [self getLineFromCommand:cmd];
|
||||
}
|
||||
|
|
|
@ -9,28 +9,22 @@
|
|||
#import "VLModel.h"
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@interface VLEditable : NSObject
|
||||
{
|
||||
}
|
||||
|
||||
- (NSString *) stringValue;
|
||||
- (void) setStringValue:(NSString*)val;
|
||||
- (BOOL) validValue:(NSString*)val;
|
||||
- (void) moveToNext;
|
||||
- (void) moveToPrev;
|
||||
- (void) highlightCursor;
|
||||
|
||||
@end
|
||||
@class VLSheetWindow;
|
||||
@class VLPDFWindow;
|
||||
@class VLLogWindow;
|
||||
|
||||
@interface VLDocument : NSDocument
|
||||
{
|
||||
VLSong * song;
|
||||
VLEditable *editTarget;
|
||||
NSString * lilypondTemplate;
|
||||
NSString * songTitle;
|
||||
NSString * songLyricist;
|
||||
NSString * songComposer;
|
||||
NSString * songArranger;
|
||||
VLSong * song;
|
||||
NSString * lilypondTemplate;
|
||||
NSString * songTitle;
|
||||
NSString * songLyricist;
|
||||
NSString * songComposer;
|
||||
NSString * songArranger;
|
||||
|
||||
VLSheetWindow * sheetWin;
|
||||
VLLogWindow * logWin;
|
||||
VLPDFWindow * pdfWin;
|
||||
}
|
||||
|
||||
- (VLSong *) song;
|
||||
|
@ -42,4 +36,8 @@
|
|||
- (void) setTimeNum:(int)num denom:(int)denom;
|
||||
- (void) setDivisions:(int)divisions;
|
||||
|
||||
- (IBAction) engrave:(id)sender;
|
||||
- (IBAction) showOutput:(id)sender;
|
||||
- (IBAction) showLog:(id)sender;
|
||||
|
||||
@end
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// MyDocument.m
|
||||
// VLDocument.mm
|
||||
// Vocalese
|
||||
//
|
||||
// Created by Matthias Neeracher on 12/17/05.
|
||||
|
@ -9,36 +9,9 @@
|
|||
#import "VLDocument.h"
|
||||
#import "VLXMLDocument.h"
|
||||
#import "VLLilypondDocument.h"
|
||||
|
||||
@implementation VLEditable
|
||||
|
||||
- (NSString *) stringValue
|
||||
{
|
||||
return @"";
|
||||
}
|
||||
|
||||
- (void) setStringValue:(NSString*)val
|
||||
{
|
||||
}
|
||||
|
||||
- (BOOL) validValue:(NSString*)val
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void) moveToNext
|
||||
{
|
||||
}
|
||||
|
||||
- (void) moveToPrev
|
||||
{
|
||||
}
|
||||
|
||||
- (void) highlightCursor
|
||||
{
|
||||
}
|
||||
|
||||
@end
|
||||
#import "VLPDFWindow.h"
|
||||
#import "VLLogWindow.h"
|
||||
#import "VLSheetWindow.h"
|
||||
|
||||
@implementation VLDocument
|
||||
|
||||
|
@ -46,27 +19,71 @@
|
|||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
|
||||
// Add your subclass-specific initialization here.
|
||||
// If an error occurs here, send a [self release] message and return nil.
|
||||
|
||||
song = new VLSong;
|
||||
editTarget = nil;
|
||||
lilypondTemplate = @"default";
|
||||
songTitle = @"";
|
||||
songLyricist = @"";
|
||||
songComposer = @"";
|
||||
songArranger = @"";
|
||||
sheetWin = nil;
|
||||
pdfWin = nil;
|
||||
logWin = nil;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) close
|
||||
{
|
||||
[logWin close];
|
||||
[pdfWin close];
|
||||
|
||||
[super close];
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
delete song;
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (VLLogWindow *)logWin
|
||||
{
|
||||
if (!logWin) {
|
||||
logWin = [[VLLogWindow alloc] initWithWindowNibName: @"VLLogWindow"];
|
||||
[self addWindowController: logWin];
|
||||
[logWin release];
|
||||
}
|
||||
return logWin;
|
||||
}
|
||||
|
||||
- (VLPDFWindow *)pdfWin
|
||||
{
|
||||
if (!pdfWin) {
|
||||
pdfWin = [[VLPDFWindow alloc] initWithWindowNibName: @"VLPDFWindow"];
|
||||
[self addWindowController: pdfWin];
|
||||
[pdfWin release];
|
||||
}
|
||||
return pdfWin;
|
||||
}
|
||||
|
||||
- (void)makeWindowControllers
|
||||
{
|
||||
sheetWin = [[VLSheetWindow alloc] initWithWindowNibName: @"VLDocument"];
|
||||
[self addWindowController: sheetWin];
|
||||
[sheetWin setShouldCloseDocument:YES];
|
||||
[sheetWin release];
|
||||
}
|
||||
|
||||
- (void)showWindows
|
||||
{
|
||||
[sheetWin showWindow: self];
|
||||
if ([pdfWin isWindowLoaded])
|
||||
[pdfWin showWindow: self];
|
||||
if ([logWin isWindowLoaded])
|
||||
[logWin showWindow: self];
|
||||
}
|
||||
|
||||
- (VLSong *) song
|
||||
{
|
||||
return song;
|
||||
|
@ -124,17 +141,6 @@
|
|||
[self updateChangeCount:NSChangeDone];
|
||||
}
|
||||
|
||||
- (NSString *)windowNibName
|
||||
{
|
||||
return @"VLDocument";
|
||||
}
|
||||
|
||||
- (void)windowControllerDidLoadNib:(NSWindowController *) controller
|
||||
{
|
||||
[super windowControllerDidLoadNib:controller];
|
||||
[controller setShouldCloseDocument:YES];
|
||||
}
|
||||
|
||||
- (NSData *)dataOfType:(NSString *)typeName error:(NSError **)outError
|
||||
{
|
||||
if ([typeName isEqual:@"VLNativeType"]) {
|
||||
|
@ -163,4 +169,81 @@
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
- (IBAction) engrave:(id)sender
|
||||
{
|
||||
NSTask * lilypondTask = [[NSTask alloc] init];
|
||||
NSString * path = [[self fileURL] path];
|
||||
NSString * root =
|
||||
[[path lastPathComponent] stringByDeletingPathExtension];
|
||||
NSString * tmpDir = @"/var/tmp";
|
||||
NSBundle * mainBundle = [NSBundle mainBundle];
|
||||
|
||||
//
|
||||
// Convert to Lilypond format
|
||||
//
|
||||
NSError * err;
|
||||
[self writeToURL:
|
||||
[NSURL fileURLWithPath:
|
||||
[[tmpDir stringByAppendingPathComponent:root]
|
||||
stringByAppendingPathExtension:@"ly"]]
|
||||
ofType:@"VLLilypondType" error:&err];
|
||||
NSPipe * pipe = [NSPipe pipe];
|
||||
NSString * tool =
|
||||
[[NSUserDefaults standardUserDefaults]
|
||||
stringForKey:@"VLLilypondPath"];
|
||||
NSArray * arguments = [NSArray arrayWithObjects:tool, root, nil];
|
||||
|
||||
[[NSNotificationCenter defaultCenter]
|
||||
addObserver:self selector:@selector(engraveDone:)
|
||||
name:NSTaskDidTerminateNotification object:lilypondTask];
|
||||
|
||||
[lilypondTask setCurrentDirectoryPath:tmpDir];
|
||||
[lilypondTask setStandardOutput: pipe];
|
||||
[lilypondTask setStandardError: pipe];
|
||||
[lilypondTask setArguments: arguments];
|
||||
[lilypondTask setLaunchPath:
|
||||
[mainBundle pathForResource:@"lilyWrapper" ofType:@""]];
|
||||
[lilypondTask launch];
|
||||
|
||||
[[self logWin] showWindow: self];
|
||||
|
||||
[NSThread detachNewThreadSelector:@selector(logFromFileHandle:) toTarget:logWin
|
||||
withObject:[pipe fileHandleForReading]];
|
||||
}
|
||||
|
||||
- (void)engraveDone:(NSNotification *)notification {
|
||||
[[NSNotificationCenter defaultCenter] removeObserver: self];
|
||||
int status = [[notification object] terminationStatus];
|
||||
if (!status) {
|
||||
NSFileManager * fileManager = [NSFileManager defaultManager];
|
||||
NSString * path = [[self fileURL] path];
|
||||
NSString * root =
|
||||
[[path lastPathComponent] stringByDeletingPathExtension];
|
||||
NSString * tmpDir = @"/var/tmp";
|
||||
NSString * dstDir = [path stringByDeletingLastPathComponent];
|
||||
NSString * pdf =
|
||||
[root stringByAppendingPathExtension:@"pdf"];
|
||||
[fileManager
|
||||
removeFileAtPath:[dstDir stringByAppendingPathComponent:pdf]
|
||||
handler:nil];
|
||||
[fileManager
|
||||
movePath:[tmpDir stringByAppendingPathComponent:pdf]
|
||||
toPath:[dstDir stringByAppendingPathComponent:pdf]
|
||||
handler:nil];
|
||||
[[self pdfWin] showWindow: self];
|
||||
[pdfWin reloadPDF];
|
||||
}
|
||||
}
|
||||
|
||||
- (IBAction) showOutput:(id)sender
|
||||
{
|
||||
[[self pdfWin] showWindow:sender];
|
||||
}
|
||||
|
||||
- (IBAction) showLog:(id)sender
|
||||
{
|
||||
[[self logWin] showWindow:sender];
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
|
@ -14,8 +14,8 @@
|
|||
|
||||
const int kVLSharpChar = 0x266F;
|
||||
const int kVLFlatChar = 0x266D;
|
||||
const char *kVLSharpStr = "\xE2\x99\xAF";
|
||||
const char *kVLFlatStr = "\xE2\x99\xAD";
|
||||
#define kVLSharpStr "\xE2\x99\xAF"
|
||||
#define kVLFlatStr "\xE2\x99\xAD"
|
||||
|
||||
struct VLFract {
|
||||
uint16_t fNum; // Numerator
|
||||
|
|
|
@ -28,6 +28,11 @@ static NSString* sZoomOutToolbarItemIdentifier = @"Zoom Out Toolbar Item Identif
|
|||
[self reloadPDF];
|
||||
}
|
||||
|
||||
- (IBAction)showWindow:(id)sender
|
||||
{
|
||||
[super showWindow:sender];
|
||||
}
|
||||
|
||||
- (void)reloadPDF
|
||||
{
|
||||
if (pdfView) {
|
||||
|
@ -37,6 +42,7 @@ static NSString* sZoomOutToolbarItemIdentifier = @"Zoom Out Toolbar Item Identif
|
|||
NSURL * pdfURL = [NSURL fileURLWithPath: outString];
|
||||
PDFDocument * pdfDoc = [[[PDFDocument alloc] initWithURL: pdfURL] autorelease];
|
||||
[(PDFView *)pdfView setDocument: pdfDoc];
|
||||
[pdfView setNeedsDisplay:YES];
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -52,6 +52,8 @@ enum VLRecalc {
|
|||
kFirstRecalc
|
||||
};
|
||||
|
||||
@class VLEditable;
|
||||
|
||||
@interface VLSheetView : NSView {
|
||||
VLRecalc fNeedsRecalc;
|
||||
char fClickMode;
|
||||
|
@ -99,6 +101,9 @@ enum VLRecalc {
|
|||
|
||||
- (BOOL)control:(NSControl *)control textShouldEndEditing:(NSText *)fieldEditor;
|
||||
|
||||
- (VLEditable *) editTarget;
|
||||
- (void) setEditTarget:(VLEditable *)editable;
|
||||
|
||||
@end
|
||||
|
||||
// Local Variables:
|
||||
|
|
|
@ -102,6 +102,16 @@ static float sFlatPos[] = {
|
|||
return [[[self window] windowController] document];
|
||||
}
|
||||
|
||||
- (VLEditable *) editTarget
|
||||
{
|
||||
return [[[self window] windowController] editTarget];
|
||||
}
|
||||
|
||||
- (void) setEditTarget:(VLEditable *)editable
|
||||
{
|
||||
[[[self window] windowController] setEditTarget:editable];
|
||||
}
|
||||
|
||||
- (VLSong *) song
|
||||
{
|
||||
return [[self document] song];
|
||||
|
@ -210,7 +220,7 @@ VLMusicElement sSemi2Accidental[12][12] = {
|
|||
fCursorTracking = [self addTrackingRect:r owner:self
|
||||
userData:nil assumeInside:within];
|
||||
[[self window] setAcceptsMouseMovedEvents:within];
|
||||
if (within && ![[self document] valueForKey: @"editTarget"])
|
||||
if (within && ![self editTarget])
|
||||
[[self window] makeFirstResponder:self];
|
||||
}
|
||||
|
||||
|
@ -390,8 +400,7 @@ VLMusicElement sSemi2Accidental[12][12] = {
|
|||
[self drawNotesForSystem:system];
|
||||
[self drawChordsForSystem:system];
|
||||
}
|
||||
VLEditable * editable = [[self document] valueForKey: @"editTarget"];
|
||||
[editable highlightCursor];
|
||||
[[self editTarget] highlightCursor];
|
||||
}
|
||||
|
||||
- (IBAction) setKey:(id)sender
|
||||
|
@ -675,13 +684,12 @@ static int8_t sSharpAcc[] = {
|
|||
|
||||
- (BOOL)control:(NSControl *)control textShouldEndEditing:(NSText *)fieldEditor
|
||||
{
|
||||
VLEditable * editable = [[self document] valueForKey: @"editTarget"];
|
||||
return [editable validValue:[fFieldEditor stringValue]];
|
||||
return [[self editTarget] validValue:[fFieldEditor stringValue]];
|
||||
}
|
||||
|
||||
- (void)controlTextDidEndEditing:(NSNotification *)note
|
||||
{
|
||||
VLEditable * editable = [[self document] valueForKey: @"editTarget"];
|
||||
VLEditable * editable = [self editTarget];
|
||||
switch ([[[note userInfo] objectForKey:@"NSTextMovement"] intValue]) {
|
||||
case NSTabTextMovement:
|
||||
[editable moveToNext];
|
||||
|
@ -693,7 +701,7 @@ static int8_t sSharpAcc[] = {
|
|||
[editable autorelease];
|
||||
editable = nil;
|
||||
}
|
||||
[[self document] setValue:editable forKey: @"editTarget"];
|
||||
[self setEditTarget:editable];
|
||||
if (editable)
|
||||
[fFieldEditor selectText:self];
|
||||
[[self window] performSelectorOnMainThread:@selector(makeFirstResponder:)
|
||||
|
|
|
@ -6,8 +6,7 @@
|
|||
// Copyright 2006 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
|
||||
#import "VLDocument.h"
|
||||
|
||||
#import "VLSheetWindow.h"
|
||||
|
||||
@interface VLChordEditable : VLEditable {
|
||||
VLSheetView * fView;
|
||||
|
|
|
@ -242,14 +242,13 @@ std::string NormalizeName(NSString* rawName)
|
|||
|
||||
- (void) editChord
|
||||
{
|
||||
VLDocument * doc= [self document];
|
||||
VLEditable * e =
|
||||
[[VLChordEditable alloc]
|
||||
initWithView:self
|
||||
song:[self song]
|
||||
measure:fCursorMeasure
|
||||
at:fCursorAt];
|
||||
[doc setValue:e forKey:@"editTarget"];
|
||||
[self setEditTarget:e];
|
||||
[fFieldEditor selectText:self];
|
||||
}
|
||||
|
||||
|
|
|
@ -247,9 +247,6 @@
|
|||
{
|
||||
const VLSong * song = [self song];
|
||||
const VLProperties & prop = song->fProperties.front();
|
||||
BOOL swing= !(prop.fDivisions % 3); // In swing mode?
|
||||
VLFraction swung(3, prop.fDivisions*8, true); // Which notes to swing
|
||||
VLFraction swingGrid(2*swung); // Alignment of swing notes
|
||||
|
||||
float kSystemY = [self systemY:system];
|
||||
for (int m = 0; m<fMeasPerSystem; ++m) {
|
||||
|
|
35
Sources/VLSheetWindow.h
Normal file
35
Sources/VLSheetWindow.h
Normal file
|
@ -0,0 +1,35 @@
|
|||
//
|
||||
// VLSheetWindow.h
|
||||
// Lilypond
|
||||
//
|
||||
// Created by Matthias Neeracher on 5/29/05.
|
||||
// Copyright 2005 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@interface VLEditable : NSObject
|
||||
{
|
||||
}
|
||||
|
||||
- (NSString *) stringValue;
|
||||
- (void) setStringValue:(NSString*)val;
|
||||
- (BOOL) validValue:(NSString*)val;
|
||||
- (void) moveToNext;
|
||||
- (void) moveToPrev;
|
||||
- (void) highlightCursor;
|
||||
|
||||
@end
|
||||
|
||||
@interface VLSheetWindow : NSWindowController {
|
||||
VLEditable * editTarget;
|
||||
|
||||
IBOutlet id runToolItem;
|
||||
IBOutlet id outputToolItem;
|
||||
IBOutlet id logToolItem;
|
||||
}
|
||||
|
||||
- (VLEditable *) editTarget;
|
||||
- (void) setEditTarget:(VLEditable *)editable;
|
||||
|
||||
@end
|
125
Sources/VLSheetWindow.mm
Normal file
125
Sources/VLSheetWindow.mm
Normal file
|
@ -0,0 +1,125 @@
|
|||
//
|
||||
// LilypondInputWin.m
|
||||
// Lilypond
|
||||
//
|
||||
// Created by Matthias Neeracher on 5/29/05.
|
||||
// Copyright 2005 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
|
||||
#import "VLSheetWindow.h"
|
||||
#import "VLDocument.h"
|
||||
|
||||
|
||||
@implementation VLEditable
|
||||
|
||||
- (NSString *) stringValue
|
||||
{
|
||||
return @"";
|
||||
}
|
||||
|
||||
- (void) setStringValue:(NSString*)val
|
||||
{
|
||||
}
|
||||
|
||||
- (BOOL) validValue:(NSString*)val
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void) moveToNext
|
||||
{
|
||||
}
|
||||
|
||||
- (void) moveToPrev
|
||||
{
|
||||
}
|
||||
|
||||
- (void) highlightCursor
|
||||
{
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation VLSheetWindow
|
||||
|
||||
static NSString* sInputToolbarIdentifier = @"Vocalese Sheet Window Toolbar Identifier";
|
||||
static NSString* sOutputToolbarItemIdentifier = @"Output Toolbar Item Identifier";
|
||||
static NSString* sLogToolbarItemIdentifier = @"Log Toolbar Item Identifier";
|
||||
static NSString* sRunToolbarItemIdentifier = @"Run Toolbar Item Identifier";
|
||||
|
||||
- (id)initWithWindow:(NSWindow *)window
|
||||
{
|
||||
if (self = [super initWithWindow:window]) {
|
||||
editTarget = nil;
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
- (VLEditable *)editTarget
|
||||
{
|
||||
return editTarget;
|
||||
}
|
||||
|
||||
- (void)setEditTarget:(VLEditable *)editable
|
||||
{
|
||||
editTarget = editable;
|
||||
}
|
||||
|
||||
- (void)windowDidLoad
|
||||
{
|
||||
NSToolbar *toolbar = [[[NSToolbar alloc] initWithIdentifier: sInputToolbarIdentifier] autorelease];
|
||||
|
||||
[toolbar setAllowsUserCustomization: YES];
|
||||
[toolbar setAutosavesConfiguration: YES];
|
||||
[toolbar setDelegate: self];
|
||||
|
||||
[[self window] setToolbar: toolbar];
|
||||
}
|
||||
|
||||
|
||||
- (NSToolbarItem *) toolbar: (NSToolbar *)toolbar itemForItemIdentifier: (NSString *) itemIdent willBeInsertedIntoToolbar:(BOOL) willBeInserted {
|
||||
NSToolbarItem * toolbarItem = nil;
|
||||
id prototype = nil;
|
||||
|
||||
if ([itemIdent isEqual: sOutputToolbarItemIdentifier])
|
||||
prototype = outputToolItem;
|
||||
else if ([itemIdent isEqual: sLogToolbarItemIdentifier])
|
||||
prototype = logToolItem;
|
||||
else if ([itemIdent isEqual: sRunToolbarItemIdentifier])
|
||||
prototype = runToolItem;
|
||||
|
||||
if (prototype) {
|
||||
toolbarItem = [[[NSToolbarItem alloc] initWithItemIdentifier: itemIdent] autorelease];
|
||||
|
||||
[toolbarItem setLabel: [prototype title]];
|
||||
[toolbarItem setPaletteLabel: [prototype alternateTitle]];
|
||||
[toolbarItem setToolTip: [prototype toolTip]];
|
||||
[toolbarItem setImage: [prototype image]];
|
||||
[toolbarItem setTarget: [prototype target]];
|
||||
[toolbarItem setAction: [prototype action]];
|
||||
} else {
|
||||
toolbarItem = nil;
|
||||
}
|
||||
return toolbarItem;
|
||||
}
|
||||
|
||||
- (NSArray *) toolbarDefaultItemIdentifiers: (NSToolbar *) toolbar {
|
||||
return [NSArray arrayWithObjects:
|
||||
sRunToolbarItemIdentifier,
|
||||
NSToolbarFlexibleSpaceItemIdentifier,
|
||||
sOutputToolbarItemIdentifier,
|
||||
sLogToolbarItemIdentifier, nil];
|
||||
}
|
||||
|
||||
- (NSArray *) toolbarAllowedItemIdentifiers: (NSToolbar *) toolbar {
|
||||
return [NSArray arrayWithObjects:
|
||||
sRunToolbarItemIdentifier,
|
||||
sOutputToolbarItemIdentifier,
|
||||
sLogToolbarItemIdentifier,
|
||||
NSToolbarCustomizeToolbarItemIdentifier,
|
||||
NSToolbarFlexibleSpaceItemIdentifier,
|
||||
NSToolbarSpaceItemIdentifier,
|
||||
NSToolbarSeparatorItemIdentifier, nil];
|
||||
}
|
||||
|
||||
@end
|
|
@ -194,8 +194,45 @@ const char * sSteps = "C DbD EbE F GbG AbA BbB ";
|
|||
}
|
||||
}
|
||||
|
||||
- (NSXMLElement *) identificationElement
|
||||
{
|
||||
NSXMLElement * identification = [NSXMLNode elementWithName:@"identification"];
|
||||
NSXMLElement * composer = [NSXMLNode elementWithName:@"creator"
|
||||
stringValue:songComposer];
|
||||
[composer addAttribute: [NSXMLNode attributeWithName:@"type"
|
||||
stringValue:@"composer"]];
|
||||
[identification addChild:composer];
|
||||
NSXMLElement * poet = [NSXMLNode elementWithName:@"creator"
|
||||
stringValue:songLyricist];
|
||||
[poet addAttribute: [NSXMLNode attributeWithName:@"type"
|
||||
stringValue:@"poet"]];
|
||||
[identification addChild:poet];
|
||||
|
||||
NSXMLElement * encoding = [NSXMLNode elementWithName:@"encoding"];
|
||||
[encoding addChild:
|
||||
[NSXMLNode elementWithName:@"encoding-date"
|
||||
stringValue:
|
||||
[[NSDate date]
|
||||
descriptionWithCalendarFormat:@"%Y-%m-%d"
|
||||
timeZone:nil locale:nil]]];
|
||||
[encoding addChild:
|
||||
[NSXMLNode elementWithName:@"software"
|
||||
stringValue: [NSString stringWithFormat:@"VocalEasel %@",
|
||||
[[NSBundle mainBundle]
|
||||
objectForInfoDictionaryKey:@"CFBundleVersion"]]]];
|
||||
[identification addChild:encoding];
|
||||
|
||||
return identification;
|
||||
}
|
||||
|
||||
- (NSData *)XMLDataWithError:(NSError **)outError
|
||||
{
|
||||
NSXMLElement * work = [NSXMLNode elementWithName:@"work"];
|
||||
[work addChild: [NSXMLNode elementWithName:@"work-title"
|
||||
stringValue:songTitle]];
|
||||
|
||||
NSXMLElement * identification = [self identificationElement];
|
||||
|
||||
NSXMLElement * partList = [NSXMLNode elementWithName:@"part-list"];
|
||||
[partList addChild: [self scorePartWithID:@"HARM" name:@"Chords"]];
|
||||
[partList addChild: [self scorePartWithID:@"MELO" name:@"Melody"]];
|
||||
|
@ -230,8 +267,8 @@ const char * sSteps = "C DbD EbE F GbG AbA BbB ";
|
|||
NSXMLElement * score =
|
||||
[NSXMLNode
|
||||
elementWithName:@"score-partwise"
|
||||
children:[NSArray arrayWithObjects:
|
||||
partList, chords, melody, nil]
|
||||
children:[NSArray arrayWithObjects: work, identification,
|
||||
partList, chords, melody, nil]
|
||||
attributes:[NSArray arrayWithObject:
|
||||
[NSXMLNode attributeWithName:@"version"
|
||||
stringValue:@"1.1"]]];
|
||||
|
@ -368,6 +405,12 @@ int8_t sStepToPitch[] = {
|
|||
// For now, in gross violation of MusicXML spirit, we're only reading
|
||||
// our own input.
|
||||
//
|
||||
songTitle = [[doc stringForXPath:@".//work-title" error:outError] retain];
|
||||
songComposer= [[doc stringForXPath:@".//creator[@type=\"composer\"]"
|
||||
error: outError] retain];
|
||||
songLyricist= [[doc stringForXPath:@".//creator[@type=\"poet\"]"
|
||||
error: outError] retain];
|
||||
|
||||
NSXMLElement * chords = [doc nodeForXPath:@".//part[@id=\"HARM\"]"
|
||||
error:outError];
|
||||
NSXMLElement * melody = [doc nodeForXPath:@".//part[@id=\"MELO\"]"
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
9593E4E90AE0ED1F00035816 /* vocalese.icns in Resources */ = {isa = PBXBuildFile; fileRef = 9593E4E70AE0ED1F00035816 /* vocalese.icns */; };
|
||||
959408AD096922EA007CCCF8 /* TVLEdit.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 959408AC096922EA007CCCF8 /* TVLEdit.cpp */; };
|
||||
959408AE096922F7007CCCF8 /* VLModel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 955E58E4095658AB0045FDA5 /* VLModel.cpp */; };
|
||||
95A1C37C0AF1D4370076597D /* Quartz.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 95A1C37B0AF1D4370076597D /* Quartz.framework */; };
|
||||
95A1C3860AF2ACE20076597D /* VLSheetWindow.mm in Sources */ = {isa = PBXBuildFile; fileRef = 95A1C3850AF2ACE20076597D /* VLSheetWindow.mm */; };
|
||||
95B3E1A70960E58B000E9C0D /* Music in Resources */ = {isa = PBXBuildFile; fileRef = 95B3E1980960E58B000E9C0D /* Music */; };
|
||||
95B66658096BCA1F00FE18C9 /* VLSheetViewNotes.mm in Sources */ = {isa = PBXBuildFile; fileRef = 95B66657096BCA1F00FE18C9 /* VLSheetViewNotes.mm */; };
|
||||
95BDA15909540BF1009F9D65 /* VLSheetView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 95BDA15809540BF1009F9D65 /* VLSheetView.mm */; };
|
||||
|
@ -44,6 +46,7 @@
|
|||
95E04DAB0AEB4886006F30A0 /* VLXMLDocument.mm in Sources */ = {isa = PBXBuildFile; fileRef = 95F5F50E0ADCC433003980B2 /* VLXMLDocument.mm */; };
|
||||
95E04DC70AEB4B57006F30A0 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A7FEA54F5311CA2CBB /* Cocoa.framework */; };
|
||||
95E04DCE0AEB4D9B006F30A0 /* Templates in Resources */ = {isa = PBXBuildFile; fileRef = 95E04DCA0AEB4D9B006F30A0 /* Templates */; };
|
||||
95ECE6590AF3324300FE3E98 /* lilyWrapper in Resources */ = {isa = PBXBuildFile; fileRef = 95ECE6580AF3324300FE3E98 /* lilyWrapper */; };
|
||||
95F5F50F0ADCC433003980B2 /* VLXMLDocument.mm in Sources */ = {isa = PBXBuildFile; fileRef = 95F5F50E0ADCC433003980B2 /* VLXMLDocument.mm */; };
|
||||
95F5F5340ADCCFBB003980B2 /* DTD in Resources */ = {isa = PBXBuildFile; fileRef = 95F5F51E0ADCCFBB003980B2 /* DTD */; };
|
||||
95FC668F0AF0A08C003D9C11 /* VLLogWindow.mm in Sources */ = {isa = PBXBuildFile; fileRef = 95FC668E0AF0A08C003D9C11 /* VLLogWindow.mm */; };
|
||||
|
@ -99,6 +102,9 @@
|
|||
9593E4E70AE0ED1F00035816 /* vocalese.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = vocalese.icns; path = Resources/vocalese.icns; sourceTree = "<group>"; };
|
||||
959408A0096922CA007CCCF8 /* TVLEdit */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = TVLEdit; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
959408AC096922EA007CCCF8 /* TVLEdit.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = TVLEdit.cpp; path = Tests/TVLEdit.cpp; sourceTree = "<group>"; };
|
||||
95A1C37B0AF1D4370076597D /* Quartz.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Quartz.framework; path = /System/Library/Frameworks/Quartz.framework; sourceTree = "<absolute>"; };
|
||||
95A1C3840AF2ACE20076597D /* VLSheetWindow.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = VLSheetWindow.h; path = Sources/VLSheetWindow.h; sourceTree = "<group>"; };
|
||||
95A1C3850AF2ACE20076597D /* VLSheetWindow.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; name = VLSheetWindow.mm; path = Sources/VLSheetWindow.mm; sourceTree = "<group>"; };
|
||||
95B3E1980960E58B000E9C0D /* Music */ = {isa = PBXFileReference; lastKnownFileType = folder; name = Music; path = Resources/Music; sourceTree = "<group>"; };
|
||||
95B66653096BC6A100FE18C9 /* VLSheetViewInternal.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = VLSheetViewInternal.h; path = Sources/VLSheetViewInternal.h; sourceTree = "<group>"; };
|
||||
95B66656096BCA1F00FE18C9 /* VLSheetViewNotes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLSheetViewNotes.h; path = Sources/VLSheetViewNotes.h; sourceTree = "<group>"; };
|
||||
|
@ -108,6 +114,7 @@
|
|||
95E04DA00AEB4837006F30A0 /* TVLLilypond */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = TVLLilypond; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
95E04DA60AEB486E006F30A0 /* TVLLilypond.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; name = TVLLilypond.mm; path = Tests/TVLLilypond.mm; sourceTree = "<group>"; };
|
||||
95E04DCA0AEB4D9B006F30A0 /* Templates */ = {isa = PBXFileReference; lastKnownFileType = folder; name = Templates; path = Resources/Templates; sourceTree = "<group>"; };
|
||||
95ECE6580AF3324300FE3E98 /* lilyWrapper */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.script.sh; name = lilyWrapper; path = Resources/lilyWrapper; sourceTree = "<group>"; };
|
||||
95F5F50D0ADCC433003980B2 /* VLXMLDocument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VLXMLDocument.h; path = Sources/VLXMLDocument.h; sourceTree = "<group>"; };
|
||||
95F5F50E0ADCC433003980B2 /* VLXMLDocument.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = VLXMLDocument.mm; path = Sources/VLXMLDocument.mm; sourceTree = "<group>"; };
|
||||
95F5F51E0ADCCFBB003980B2 /* DTD */ = {isa = PBXFileReference; lastKnownFileType = folder; name = DTD; path = Resources/DTD; sourceTree = "<group>"; };
|
||||
|
@ -136,6 +143,7 @@
|
|||
8D15AC340486D014006FF6A4 /* Cocoa.framework in Frameworks */,
|
||||
95932B91096527700008B0DB /* AudioUnit.framework in Frameworks */,
|
||||
95932B92096527710008B0DB /* AudioToolbox.framework in Frameworks */,
|
||||
95A1C37C0AF1D4370076597D /* Quartz.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -176,6 +184,7 @@
|
|||
1058C7A6FEA54F5311CA2CBB /* Linked Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
95A1C37B0AF1D4370076597D /* Quartz.framework */,
|
||||
1058C7A7FEA54F5311CA2CBB /* Cocoa.framework */,
|
||||
952CBBB2095FD34F00434E43 /* AudioToolbox.framework */,
|
||||
952CBBB3095FD34F00434E43 /* AudioUnit.framework */,
|
||||
|
@ -221,6 +230,8 @@
|
|||
2A37F4ABFDCFA73011CA2CEA /* Classes */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
95A1C3840AF2ACE20076597D /* VLSheetWindow.h */,
|
||||
95A1C3850AF2ACE20076597D /* VLSheetWindow.mm */,
|
||||
95FC66CC0AF0A591003D9C11 /* VLPDFView.mm */,
|
||||
95FC66CD0AF0A591003D9C11 /* VLPDFView.h */,
|
||||
95FC66A40AF0A24C003D9C11 /* VLPDFWindow.h */,
|
||||
|
@ -266,6 +277,7 @@
|
|||
2A37F4B8FDCFA73011CA2CEA /* Resources */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
95ECE6580AF3324300FE3E98 /* lilyWrapper */,
|
||||
95FC66BC0AF0A4D4003D9C11 /* console.icns */,
|
||||
95FC66BD0AF0A4D4003D9C11 /* music.tiff */,
|
||||
95FC66BE0AF0A4D4003D9C11 /* nextpage.tiff */,
|
||||
|
@ -439,6 +451,7 @@
|
|||
95FC66C70AF0A4D5003D9C11 /* run.icns in Resources */,
|
||||
95FC66C80AF0A4D5003D9C11 /* zoomin.tiff in Resources */,
|
||||
95FC66C90AF0A4D5003D9C11 /* zoomout.tiff in Resources */,
|
||||
95ECE6590AF3324300FE3E98 /* lilyWrapper in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -464,6 +477,7 @@
|
|||
95FC668F0AF0A08C003D9C11 /* VLLogWindow.mm in Sources */,
|
||||
95FC66A60AF0A24C003D9C11 /* VLPDFWindow.mm in Sources */,
|
||||
95FC66CE0AF0A591003D9C11 /* VLPDFView.mm in Sources */,
|
||||
95A1C3860AF2ACE20076597D /* VLSheetWindow.mm in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user