VocalEasel/Sources/VLSheetWindow.mm
2011-09-04 03:00:38 +02:00

131 lines
1.9 KiB
Plaintext

//
// File: VLSheetWindow.mm - Control lead sheet editing window
//
// Author(s):
//
// (MN) Matthias Neeracher
//
// Copyright © 2005-2011 Matthias Neeracher
//
#import "VLSheetWindow.h"
#import "VLDocument.h"
#import "VLPDFWindow.h"
#import "VLLogWindow.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
@synthesize logWin;
- (id)initWithWindow:(NSWindow *)window
{
if (self = [super initWithWindow:window]) {
editTarget = nil;
}
return self;
}
- (VLEditable *)editTarget
{
return editTarget;
}
- (void)setEditTarget:(VLEditable *)editable
{
editTarget = editable;
}
- (void) startAnimation
{
[progressIndicator startAnimation:self];
}
- (void) stopAnimation
{
[progressIndicator stopAnimation:self];
}
- (IBAction) zoomIn: (id) sender
{
[sheetView zoomIn:sender];
}
- (IBAction) zoomOut: (id) sender
{
[sheetView zoomOut:sender];
}
- (void) mouseMoved:(NSEvent *)event
{
[sheetView mouseMoved:event];
}
- (void) willPlaySequence:(MusicSequence)music
{
[sheetView willPlaySequence:music];
}
- (IBAction) togglePlayElements:(id)sender
{
[[self document] setPlayElements:[[self document] playElements] ^ [sender tag]];
}
- (BOOL) validateMenuItem:(NSMenuItem *)menuItem
{
if ([menuItem action] == @selector(togglePlayElements:))
if (int tag = [menuItem tag])
[menuItem setState:([[self document] playElements] & tag) != 0];
return YES;
}
- (IBAction) showLog:(id)sender
{
[logWin showWindow:sender];
}
- (void) showLogAndBeep
{
[logWin showWindow:self];
NSBeep();
}
- (IBAction) showOutput:(id)sender
{
[[self document] createTmpFileWithExtension:@"pdf" ofType:VLPDFType];
[pdfWin showWindow:self];
[pdfWin reloadPDF];
}
@end