2006-10-28 09:18:55 +00:00
|
|
|
//
|
|
|
|
// 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";
|
2006-11-13 04:26:09 +00:00
|
|
|
static NSString* sPlayToolbarItemIdentifier = @"Play Toolbar Item Identifier";
|
2007-01-02 07:06:56 +00:00
|
|
|
static NSString* sStopToolbarItemIdentifier = @"Stop Toolbar Item Identifier";
|
2006-12-02 23:05:12 +00:00
|
|
|
static NSString* sZoomInToolbarItemIdentifier = @"Zoom In Toolbar Item Identifier";
|
|
|
|
static NSString* sZoomOutToolbarItemIdentifier = @"Zoom Out Toolbar Item Identifier";
|
2007-04-18 07:05:04 +00:00
|
|
|
static NSString* sProgressToolbarItemIdentifier = @"Progress Toolbar Item Identifier";
|
2006-10-28 09:18:55 +00:00
|
|
|
|
|
|
|
- (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;
|
2006-11-13 04:26:09 +00:00
|
|
|
else if ([itemIdent isEqual: sPlayToolbarItemIdentifier])
|
|
|
|
prototype = playToolItem;
|
2007-01-02 07:06:56 +00:00
|
|
|
else if ([itemIdent isEqual: sStopToolbarItemIdentifier])
|
|
|
|
prototype = stopToolItem;
|
2006-12-02 23:05:12 +00:00
|
|
|
else if ([itemIdent isEqual: sZoomInToolbarItemIdentifier])
|
|
|
|
prototype = zoomInToolItem;
|
|
|
|
else if ([itemIdent isEqual: sZoomOutToolbarItemIdentifier])
|
|
|
|
prototype = zoomOutToolItem;
|
2006-10-28 09:18:55 +00:00
|
|
|
|
|
|
|
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]];
|
2007-04-18 07:05:04 +00:00
|
|
|
} else if ([itemIdent isEqual: sProgressToolbarItemIdentifier]) {
|
|
|
|
toolbarItem = [[[NSToolbarItem alloc] initWithItemIdentifier: itemIdent] autorelease];
|
|
|
|
|
|
|
|
[toolbarItem setView: progressToolItem];
|
2006-10-28 09:18:55 +00:00
|
|
|
} else {
|
|
|
|
toolbarItem = nil;
|
|
|
|
}
|
|
|
|
return toolbarItem;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (NSArray *) toolbarDefaultItemIdentifiers: (NSToolbar *) toolbar {
|
|
|
|
return [NSArray arrayWithObjects:
|
2007-04-18 07:05:04 +00:00
|
|
|
sOutputToolbarItemIdentifier,
|
2007-01-02 07:06:56 +00:00
|
|
|
NSToolbarSeparatorItemIdentifier,
|
2006-11-13 04:26:09 +00:00
|
|
|
sPlayToolbarItemIdentifier,
|
2007-01-02 07:06:56 +00:00
|
|
|
sStopToolbarItemIdentifier,
|
2006-12-02 23:05:12 +00:00
|
|
|
NSToolbarSeparatorItemIdentifier,
|
|
|
|
sZoomInToolbarItemIdentifier,
|
|
|
|
sZoomOutToolbarItemIdentifier,
|
2006-10-28 09:18:55 +00:00
|
|
|
NSToolbarFlexibleSpaceItemIdentifier,
|
2007-04-18 07:05:04 +00:00
|
|
|
sLogToolbarItemIdentifier,
|
|
|
|
sProgressToolbarItemIdentifier,
|
|
|
|
nil];
|
2006-10-28 09:18:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
- (NSArray *) toolbarAllowedItemIdentifiers: (NSToolbar *) toolbar {
|
|
|
|
return [NSArray arrayWithObjects:
|
2006-11-13 04:26:09 +00:00
|
|
|
sPlayToolbarItemIdentifier,
|
2007-01-02 07:06:56 +00:00
|
|
|
sStopToolbarItemIdentifier,
|
2006-12-02 23:05:12 +00:00
|
|
|
sZoomInToolbarItemIdentifier,
|
|
|
|
sZoomOutToolbarItemIdentifier,
|
2006-10-28 09:18:55 +00:00
|
|
|
sOutputToolbarItemIdentifier,
|
|
|
|
sLogToolbarItemIdentifier,
|
2007-04-18 07:05:04 +00:00
|
|
|
sProgressToolbarItemIdentifier,
|
2006-10-28 09:18:55 +00:00
|
|
|
NSToolbarCustomizeToolbarItemIdentifier,
|
|
|
|
NSToolbarFlexibleSpaceItemIdentifier,
|
|
|
|
NSToolbarSpaceItemIdentifier,
|
|
|
|
NSToolbarSeparatorItemIdentifier, nil];
|
|
|
|
}
|
|
|
|
|
2007-04-18 07:05:04 +00:00
|
|
|
- (void) startAnimation
|
|
|
|
{
|
|
|
|
[progressToolItem startAnimation:self];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (void) stopAnimation
|
|
|
|
{
|
|
|
|
[progressToolItem stopAnimation:self];
|
|
|
|
}
|
|
|
|
|
2006-10-28 09:18:55 +00:00
|
|
|
@end
|