diff --git a/English.lproj/VLDocument.xib b/English.lproj/VLDocument.xib index 0d21ef9..afd9ea9 100644 --- a/English.lproj/VLDocument.xib +++ b/English.lproj/VLDocument.xib @@ -2,10 +2,10 @@ 1070 - 11B26 + 11C48 1617 - 1138 - 566.00 + 1138.18 + 567.00 com.apple.InterfaceBuilder.CocoaPlugin 1617 @@ -101,13 +101,10 @@ Progress - + 1292 {{19, 14}, {16, 16}} - - - _NS:3954 28938 100 @@ -241,12 +238,9 @@ >> - + 268 {{0, 14}, {32, 32}} - - - _NS:1491 1 YES @@ -292,12 +286,9 @@ << - + 268 {{0, 14}, {32, 32}} - - - _NS:1491 -1 YES @@ -412,7 +403,7 @@ - + @@ -426,7 +417,7 @@ - + @@ -3771,6 +3762,12 @@ AAAAAAAAAAAAAHRleHQAAAAAQ29weXJpZ2h0IEFwcGxlIENvbXB1dGVyLCBJbmMuLCAyMDA1AAAAAA{10000000000000, 10000000000000} YES + + VLLogWindow + + + VLPDFWindow + NSApplication @@ -4448,6 +4445,30 @@ AAAAAAAAAAAAAHRleHQAAAAAQ29weXJpZ2h0IEFwcGxlIENvbXB1dGVyLCBJbmMuLCAyMDA1AAAAAA 100516 + + + logWin + + + + 100519 + + + + pdfWin + + + + 100520 + + + + sheetWin + + + + 100521 + @@ -6121,6 +6142,17 @@ AAAAAAAAAAAAAHRleHQAAAAAQ29weXJpZ2h0IEFwcGxlIENvbXB1dGVyLCBJbmMuLCAyMDA1AAAAAA + + 100517 + + + + + 100518 + + + PDF Window + @@ -6278,6 +6310,8 @@ AAAAAAAAAAAAAHRleHQAAAAAQ29weXJpZ2h0IEFwcGxlIENvbXB1dGVyLCBJbmMuLCAyMDA1AAAAAAcom.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin + com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin com.apple.InterfaceBuilder.CocoaPlugin @@ -6413,7 +6447,7 @@ AAAAAAAAAAAAAHRleHQAAAAAQ29weXJpZ2h0IEFwcGxlIENvbXB1dGVyLCBJbmMuLCAyMDA1AAAAAA - 100516 + 100521 @@ -6435,6 +6469,65 @@ AAAAAAAAAAAAAHRleHQAAAAAQ29weXJpZ2h0IEFwcGxlIENvbXB1dGVyLCBJbmMuLCAyMDA1AAAAAA + + IKImageView + + crop: + id + + + crop: + + crop: + id + + + + IBProjectSource + ./Classes/IKImageView.h + + + + NSDocument + + id + id + id + id + id + id + + + + printDocument: + id + + + revertDocumentToSaved: + id + + + runPageLayout: + id + + + saveDocument: + id + + + saveDocumentAs: + id + + + saveDocumentTo: + id + + + + IBProjectSource + ./Classes/NSDocument.h + + VLDocument NSDocument @@ -6444,10 +6537,7 @@ AAAAAAAAAAAAAHRleHQAAAAAQ29weXJpZ2h0IEFwcGxlIENvbXB1dGVyLCBJbmMuLCAyMDA1AAAAAAid id id - id - id id - id @@ -6470,28 +6560,57 @@ AAAAAAAAAAAAAHRleHQAAAAAQ29weXJpZ2h0IEFwcGxlIENvbXB1dGVyLCBJbmMuLCAyMDA1AAAAAAplayStop: id - - showLog: - id - - - showOutput: - id - stop: id - - togglePlayElements: - id - IBProjectSource ./Classes/VLDocument.h + + VLLogWindow + NSWindowController + + log + id + + + log + + log + id + + + + IBProjectSource + ./Classes/VLLogWindow.h + + + + VLPDFWindow + NSWindowController + + PDFView + NSWindowController + + + + pdfView + PDFView + + + sheetWin + NSWindowController + + + + IBProjectSource + ./Classes/VLPDFWindow.h + + VLSheetView NSView @@ -6646,11 +6765,35 @@ AAAAAAAAAAAAAHRleHQAAAAAQ29weXJpZ2h0IEFwcGxlIENvbXB1dGVyLCBJbmMuLCAyMDA1AAAAAA VLSheetWindow NSWindowController + + id + id + + + + showOutput: + id + + + togglePlayElements: + id + + + VLLogWindow + VLPDFWindow NSProgressIndicator VLSheetView + + logWin + VLLogWindow + + + pdfWin + VLPDFWindow + progressIndicator NSProgressIndicator diff --git a/Sources/VLDocument.h b/Sources/VLDocument.h index 00feb3d..8a8522a 100644 --- a/Sources/VLDocument.h +++ b/Sources/VLDocument.h @@ -13,8 +13,6 @@ #import "VLKeyValueUndo.h" @class VLSheetWindow; -@class VLPDFWindow; -@class VLLogWindow; #define VLBIABType @"VLBIABType" #define VLNativeType @"org.aereperennius.vocaleasel-song" @@ -61,8 +59,6 @@ enum { bool brandNew; bool hasMusicSequence; VLSheetWindow * sheetWin; - VLLogWindow * logWin; - VLPDFWindow * pdfWin; VLKeyValueUndo* undo; NSRange previewRange; float playRate; @@ -87,8 +83,6 @@ enum { - (void) setRepeatVolta:(int)repeatVolta; -- (IBAction) showOutput:(id)sender; -- (IBAction) showLog:(id)sender; - (IBAction) play:(id)sender; - (IBAction) stop:(id)sender; - (IBAction) playStop:(id)sender; @@ -105,7 +99,6 @@ enum { - (void) willChangeSong; - (void) didChangeSong; - (void) addObserver:(id)observer; -- (VLLogWindow *)logWin; @end diff --git a/Sources/VLDocument.mm b/Sources/VLDocument.mm index 0372b37..26efbfe 100644 --- a/Sources/VLDocument.mm +++ b/Sources/VLDocument.mm @@ -98,8 +98,6 @@ chordPadding = 1.5f; lyricPadding = 1.0f; sheetWin = nil; - pdfWin = nil; - logWin = nil; tmpURL = nil; vcsWrapper = nil; repeatVolta = 2; @@ -144,6 +142,8 @@ - (void) dealloc { + VLSoundOut::Instance()->Stop(); + delete song; [lilypondTemplate release]; @@ -163,38 +163,6 @@ [super dealloc]; } -- (void)removeWindowController:(NSWindowController *)win -{ - if (win == logWin) - logWin = nil; - else if (win == pdfWin) - pdfWin = nil; - else if (win == sheetWin) - sheetWin = nil; - - [super removeWindowController:win]; -} - -- (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"]; @@ -203,15 +171,6 @@ [sheetWin release]; } -- (void)showWindows -{ - [sheetWin showWindow: self]; - if ([pdfWin isWindowLoaded]) - [pdfWin showWindow: self]; - if ([logWin isWindowLoaded]) - [logWin showWindow: self]; -} - - (VLSong *) song { return song; @@ -500,9 +459,8 @@ [task setStandardError: pipe]; [task setArguments: args]; [task setLaunchPath: launch]; - [[self logWin] window]; // Load but don't show - [NSThread detachNewThreadSelector:@selector(logFromFileHandle:) toTarget:logWin + [NSThread detachNewThreadSelector:@selector(logFromFileHandle:) toTarget:[sheetWin logWin] withObject:[pipe fileHandleForReading]]; return task; @@ -600,13 +558,6 @@ [self setSongTempo:[songTempo intValue]+[sender tag]]; } -- (IBAction) showOutput:(id)sender -{ - [self createTmpFileWithExtension:@"pdf" ofType:VLPDFType]; - [[self pdfWin] showWindow:sender]; - [pdfWin reloadPDF]; -} - - (NSPrintOperation *)printOperationWithSettings:(NSDictionary *)printSettings error:(NSError **)outError { @@ -625,11 +576,6 @@ return printOperation; } -- (IBAction) showLog:(id)sender -{ - [[self logWin] showWindow:sender]; -} - - (void) willChangeSong { [self willChangeValueForKey:@"song"]; diff --git a/Sources/VLLogWindow.mm b/Sources/VLLogWindow.mm index 06bdfdc..05e78ce 100644 --- a/Sources/VLLogWindow.mm +++ b/Sources/VLLogWindow.mm @@ -12,9 +12,9 @@ @implementation VLLogWindow -- (id)initWithWindow:(NSWindow *)window +- (id)init { - self = [super initWithWindow:window]; + self = [super initWithWindowNibName:@"VLLogWindow"]; logText = [[NSMutableString alloc] initWithCapacity:1000]; return self; diff --git a/Sources/VLMIDIDocument.mm b/Sources/VLMIDIDocument.mm index 3201c13..4d2e1ac 100644 --- a/Sources/VLMIDIDocument.mm +++ b/Sources/VLMIDIDocument.mm @@ -10,6 +10,7 @@ #import "VLMIDIDocument.h" #import "VLMIDIWriter.h" +#import "VLSheetWindow.h" @implementation VLDocument (MIDI) @@ -53,13 +54,8 @@ - (void)mmaDone:(NSNotification *)notification { [[NSNotificationCenter defaultCenter] removeObserver: self name:NSTaskDidTerminateNotification object:[notification object]]; - int status = [[notification object] terminationStatus]; - if (!status) { - ; - } else { - [logWin showWindow: self]; - NSBeep(); - } + if ([[notification object] terminationStatus]) + [sheetWin showLogAndBeep]; } @end diff --git a/Sources/VLPDFDocument.mm b/Sources/VLPDFDocument.mm index 70deb95..d3c8960 100644 --- a/Sources/VLPDFDocument.mm +++ b/Sources/VLPDFDocument.mm @@ -9,6 +9,7 @@ // #import "VLPDFDocument.h" +#import "VLSheetWindow.h" @implementation VLDocument (PDF) @@ -55,13 +56,8 @@ - (void)pdfDone:(NSNotification *)notification { [[NSNotificationCenter defaultCenter] removeObserver: self name:NSTaskDidTerminateNotification object:[notification object]]; - int status = [[notification object] terminationStatus]; - if (!status) { - ; - } else { - [[self logWin] showWindow: self]; - NSBeep(); - } + if ([[notification object] terminationStatus]) + [sheetWin showLogAndBeep]; } @end diff --git a/Sources/VLPDFWindow.h b/Sources/VLPDFWindow.h index e8969bf..3126aec 100644 --- a/Sources/VLPDFWindow.h +++ b/Sources/VLPDFWindow.h @@ -12,7 +12,8 @@ #import @interface VLPDFWindow : NSWindowController { - IBOutlet PDFView * pdfView; + IBOutlet NSWindowController * sheetWin; + IBOutlet PDFView * pdfView; } - (void)reloadPDF; diff --git a/Sources/VLPDFWindow.mm b/Sources/VLPDFWindow.mm index e8b247c..0c53bc3 100644 --- a/Sources/VLPDFWindow.mm +++ b/Sources/VLPDFWindow.mm @@ -14,6 +14,11 @@ @implementation VLPDFWindow +- (id)init +{ + return self = [super initWithWindowNibName:@"VLPDFWindow"]; +} + - (NSString *)windowTitleForDocumentDisplayName:(NSString *)displayName { return [displayName stringByAppendingString: @" - Output"]; @@ -33,7 +38,7 @@ - (void)reloadPDF { if (pdfView) { - VLDocument *doc = [self document]; + VLDocument *doc = [sheetWin document]; NSURL * pdfURL = [doc fileURLWithExtension:@"pdf"]; if (!pdfURL) { NSURL * workURL = [doc workURL]; diff --git a/Sources/VLSheetWindow.h b/Sources/VLSheetWindow.h index 039078a..7a9c754 100644 --- a/Sources/VLSheetWindow.h +++ b/Sources/VLSheetWindow.h @@ -25,10 +25,15 @@ @end @class VLSheetView; +@class VLLogWindow; +@class VLPDFWindow; @interface VLSheetWindow : NSWindowController { IBOutlet VLSheetView * sheetView; IBOutlet NSProgressIndicator * progressIndicator; + IBOutlet VLLogWindow * logWin; + IBOutlet VLPDFWindow * pdfWin; + VLEditable * editTarget; @@ -37,11 +42,16 @@ int editNumStanzas; } +@property (nonatomic,readonly) VLLogWindow * logWin; + +- (IBAction) togglePlayElements:(id)sender; +- (IBAction) showOutput:(id)sender; + - (VLEditable *) editTarget; - (void) setEditTarget:(VLEditable *)editable; - (void) startAnimation; - (void) stopAnimation; - (void) willPlaySequence:(MusicSequence)music; -- (IBAction) togglePlayElements:(id)sender; +- (void) showLogAndBeep; @end diff --git a/Sources/VLSheetWindow.mm b/Sources/VLSheetWindow.mm index 0a6f94b..6619f90 100644 --- a/Sources/VLSheetWindow.mm +++ b/Sources/VLSheetWindow.mm @@ -10,7 +10,8 @@ #import "VLSheetWindow.h" #import "VLDocument.h" - +#import "VLPDFWindow.h" +#import "VLLogWindow.h" @implementation VLEditable @@ -44,6 +45,8 @@ @implementation VLSheetWindow +@synthesize logWin; + - (id)initWithWindow:(NSWindow *)window { if (self = [super initWithWindow:window]) { @@ -62,10 +65,6 @@ editTarget = editable; } -- (void)windowDidLoad -{ -} - - (void) startAnimation { [progressIndicator startAnimation:self]; @@ -110,4 +109,22 @@ 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