Transfer control of pdf and log windows to VLSheetWindow

This commit is contained in:
Matthias Neeracher 2011-09-04 03:00:38 +02:00
parent 37945f0be1
commit 955dfe411e
10 changed files with 228 additions and 121 deletions

View File

@ -2,10 +2,10 @@
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="8.00"> <archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="8.00">
<data> <data>
<int key="IBDocument.SystemTarget">1070</int> <int key="IBDocument.SystemTarget">1070</int>
<string key="IBDocument.SystemVersion">11B26</string> <string key="IBDocument.SystemVersion">11C48</string>
<string key="IBDocument.InterfaceBuilderVersion">1617</string> <string key="IBDocument.InterfaceBuilderVersion">1617</string>
<string key="IBDocument.AppKitVersion">1138</string> <string key="IBDocument.AppKitVersion">1138.18</string>
<string key="IBDocument.HIToolboxVersion">566.00</string> <string key="IBDocument.HIToolboxVersion">567.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions"> <object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string> <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="NS.object.0">1617</string> <string key="NS.object.0">1617</string>
@ -101,13 +101,10 @@
<string key="NSToolbarItemPaletteLabel">Progress</string> <string key="NSToolbarItemPaletteLabel">Progress</string>
<nil key="NSToolbarItemToolTip"/> <nil key="NSToolbarItemToolTip"/>
<object class="NSProgressIndicator" key="NSToolbarItemView" id="643802566"> <object class="NSProgressIndicator" key="NSToolbarItemView" id="643802566">
<reference key="NSNextResponder"/> <nil key="NSNextResponder"/>
<int key="NSvFlags">1292</int> <int key="NSvFlags">1292</int>
<object class="NSPSMatrix" key="NSDrawMatrix"/> <object class="NSPSMatrix" key="NSDrawMatrix"/>
<string key="NSFrame">{{19, 14}, {16, 16}}</string> <string key="NSFrame">{{19, 14}, {16, 16}}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
<string key="NSReuseIdentifierKey">_NS:3954</string> <string key="NSReuseIdentifierKey">_NS:3954</string>
<int key="NSpiFlags">28938</int> <int key="NSpiFlags">28938</int>
<double key="NSMaxValue">100</double> <double key="NSMaxValue">100</double>
@ -241,12 +238,9 @@
<string key="NSToolbarItemPaletteLabel">&gt;&gt;</string> <string key="NSToolbarItemPaletteLabel">&gt;&gt;</string>
<nil key="NSToolbarItemToolTip"/> <nil key="NSToolbarItemToolTip"/>
<object class="NSButton" key="NSToolbarItemView" id="976019007"> <object class="NSButton" key="NSToolbarItemView" id="976019007">
<reference key="NSNextResponder"/> <nil key="NSNextResponder"/>
<int key="NSvFlags">268</int> <int key="NSvFlags">268</int>
<string key="NSFrame">{{0, 14}, {32, 32}}</string> <string key="NSFrame">{{0, 14}, {32, 32}}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
<string key="NSReuseIdentifierKey">_NS:1491</string> <string key="NSReuseIdentifierKey">_NS:1491</string>
<int key="NSTag">1</int> <int key="NSTag">1</int>
<bool key="NSEnabled">YES</bool> <bool key="NSEnabled">YES</bool>
@ -292,12 +286,9 @@
<string key="NSToolbarItemPaletteLabel">&lt;&lt;</string> <string key="NSToolbarItemPaletteLabel">&lt;&lt;</string>
<nil key="NSToolbarItemToolTip"/> <nil key="NSToolbarItemToolTip"/>
<object class="NSButton" key="NSToolbarItemView" id="9628001"> <object class="NSButton" key="NSToolbarItemView" id="9628001">
<reference key="NSNextResponder"/> <nil key="NSNextResponder"/>
<int key="NSvFlags">268</int> <int key="NSvFlags">268</int>
<string key="NSFrame">{{0, 14}, {32, 32}}</string> <string key="NSFrame">{{0, 14}, {32, 32}}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView"/>
<string key="NSReuseIdentifierKey">_NS:1491</string> <string key="NSReuseIdentifierKey">_NS:1491</string>
<int key="NSTag">-1</int> <int key="NSTag">-1</int>
<bool key="NSEnabled">YES</bool> <bool key="NSEnabled">YES</bool>
@ -412,7 +403,7 @@
</object> </object>
</object> </object>
</dictionary> </dictionary>
<array class="NSMutableArray" key="NSToolbarIBAllowedItems"> <array key="NSToolbarIBAllowedItems">
<reference ref="994417195"/> <reference ref="994417195"/>
<reference ref="376436287"/> <reference ref="376436287"/>
<reference ref="40496700"/> <reference ref="40496700"/>
@ -426,7 +417,7 @@
<reference ref="769048935"/> <reference ref="769048935"/>
<reference ref="60467166"/> <reference ref="60467166"/>
</array> </array>
<array class="NSMutableArray" key="NSToolbarIBDefaultItems"> <array key="NSToolbarIBDefaultItems">
<reference ref="1045675022"/> <reference ref="1045675022"/>
<reference ref="376436287"/> <reference ref="376436287"/>
<reference ref="941963392"/> <reference ref="941963392"/>
@ -3771,6 +3762,12 @@ AAAAAAAAAAAAAHRleHQAAAAAQ29weXJpZ2h0IEFwcGxlIENvbXB1dGVyLCBJbmMuLCAyMDA1AAAAAA</
<string key="NSMaxSize">{10000000000000, 10000000000000}</string> <string key="NSMaxSize">{10000000000000, 10000000000000}</string>
<bool key="NSWindowIsRestorable">YES</bool> <bool key="NSWindowIsRestorable">YES</bool>
</object> </object>
<object class="NSCustomObject" id="225318478">
<string key="NSClassName">VLLogWindow</string>
</object>
<object class="NSCustomObject" id="214031163">
<string key="NSClassName">VLPDFWindow</string>
</object>
<object class="NSCustomObject" id="956734717"> <object class="NSCustomObject" id="956734717">
<string key="NSClassName">NSApplication</string> <string key="NSClassName">NSApplication</string>
</object> </object>
@ -4448,6 +4445,30 @@ AAAAAAAAAAAAAHRleHQAAAAAQ29weXJpZ2h0IEFwcGxlIENvbXB1dGVyLCBJbmMuLCAyMDA1AAAAAA</
</object> </object>
<int key="connectionID">100516</int> <int key="connectionID">100516</int>
</object> </object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">logWin</string>
<reference key="source" ref="911961120"/>
<reference key="destination" ref="225318478"/>
</object>
<int key="connectionID">100519</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">pdfWin</string>
<reference key="source" ref="911961120"/>
<reference key="destination" ref="214031163"/>
</object>
<int key="connectionID">100520</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">sheetWin</string>
<reference key="source" ref="214031163"/>
<reference key="destination" ref="911961120"/>
</object>
<int key="connectionID">100521</int>
</object>
</array> </array>
<object class="IBMutableOrderedSet" key="objectRecords"> <object class="IBMutableOrderedSet" key="objectRecords">
<array key="orderedObjects"> <array key="orderedObjects">
@ -6121,6 +6142,17 @@ AAAAAAAAAAAAAHRleHQAAAAAQ29weXJpZ2h0IEFwcGxlIENvbXB1dGVyLCBJbmMuLCAyMDA1AAAAAA</
<reference key="object" ref="643802566"/> <reference key="object" ref="643802566"/>
<reference key="parent" ref="60467166"/> <reference key="parent" ref="60467166"/>
</object> </object>
<object class="IBObjectRecord">
<int key="objectID">100517</int>
<reference key="object" ref="225318478"/>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">100518</int>
<reference key="object" ref="214031163"/>
<reference key="parent" ref="0"/>
<string key="objectName">PDF Window</string>
</object>
</array> </array>
</object> </object>
<dictionary class="NSMutableDictionary" key="flattenedProperties"> <dictionary class="NSMutableDictionary" key="flattenedProperties">
@ -6278,6 +6310,8 @@ AAAAAAAAAAAAAHRleHQAAAAAQ29weXJpZ2h0IEFwcGxlIENvbXB1dGVyLCBJbmMuLCAyMDA1AAAAAA</
<string key="100509.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> <string key="100509.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="100511.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> <string key="100511.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="100512.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> <string key="100512.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="100517.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="100518.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="101.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> <string key="101.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="102.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> <string key="102.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="114.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string> <string key="114.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
@ -6413,7 +6447,7 @@ AAAAAAAAAAAAAHRleHQAAAAAQ29weXJpZ2h0IEFwcGxlIENvbXB1dGVyLCBJbmMuLCAyMDA1AAAAAA</
<nil key="activeLocalization"/> <nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/> <dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/> <nil key="sourceID"/>
<int key="maxID">100516</int> <int key="maxID">100521</int>
</object> </object>
<object class="IBClassDescriber" key="IBDocument.Classes"> <object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions"> <array class="NSMutableArray" key="referencedPartialClassDescriptions">
@ -6435,6 +6469,65 @@ AAAAAAAAAAAAAHRleHQAAAAAQ29weXJpZ2h0IEFwcGxlIENvbXB1dGVyLCBJbmMuLCAyMDA1AAAAAA</
<string key="minorKey"/> <string key="minorKey"/>
</object> </object>
</object> </object>
<object class="IBPartialClassDescription">
<string key="className">IKImageView</string>
<object class="NSMutableDictionary" key="actions">
<string key="NS.key.0">crop:</string>
<string key="NS.object.0">id</string>
</object>
<object class="NSMutableDictionary" key="actionInfosByName">
<string key="NS.key.0">crop:</string>
<object class="IBActionInfo" key="NS.object.0">
<string key="name">crop:</string>
<string key="candidateClassName">id</string>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/IKImageView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSDocument</string>
<dictionary class="NSMutableDictionary" key="actions">
<string key="printDocument:">id</string>
<string key="revertDocumentToSaved:">id</string>
<string key="runPageLayout:">id</string>
<string key="saveDocument:">id</string>
<string key="saveDocumentAs:">id</string>
<string key="saveDocumentTo:">id</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="actionInfosByName">
<object class="IBActionInfo" key="printDocument:">
<string key="name">printDocument:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo" key="revertDocumentToSaved:">
<string key="name">revertDocumentToSaved:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo" key="runPageLayout:">
<string key="name">runPageLayout:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo" key="saveDocument:">
<string key="name">saveDocument:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo" key="saveDocumentAs:">
<string key="name">saveDocumentAs:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo" key="saveDocumentTo:">
<string key="name">saveDocumentTo:</string>
<string key="candidateClassName">id</string>
</object>
</dictionary>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/NSDocument.h</string>
</object>
</object>
<object class="IBPartialClassDescription"> <object class="IBPartialClassDescription">
<string key="className">VLDocument</string> <string key="className">VLDocument</string>
<string key="superclassName">NSDocument</string> <string key="superclassName">NSDocument</string>
@ -6444,10 +6537,7 @@ AAAAAAAAAAAAAHRleHQAAAAAQ29weXJpZ2h0IEFwcGxlIENvbXB1dGVyLCBJbmMuLCAyMDA1AAAAAA</
<string key="play:">id</string> <string key="play:">id</string>
<string key="playMusic:">id</string> <string key="playMusic:">id</string>
<string key="playStop:">id</string> <string key="playStop:">id</string>
<string key="showLog:">id</string>
<string key="showOutput:">id</string>
<string key="stop:">id</string> <string key="stop:">id</string>
<string key="togglePlayElements:">id</string>
</dictionary> </dictionary>
<dictionary class="NSMutableDictionary" key="actionInfosByName"> <dictionary class="NSMutableDictionary" key="actionInfosByName">
<object class="IBActionInfo" key="adjustTempo:"> <object class="IBActionInfo" key="adjustTempo:">
@ -6470,28 +6560,57 @@ AAAAAAAAAAAAAHRleHQAAAAAQ29weXJpZ2h0IEFwcGxlIENvbXB1dGVyLCBJbmMuLCAyMDA1AAAAAA</
<string key="name">playStop:</string> <string key="name">playStop:</string>
<string key="candidateClassName">id</string> <string key="candidateClassName">id</string>
</object> </object>
<object class="IBActionInfo" key="showLog:">
<string key="name">showLog:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo" key="showOutput:">
<string key="name">showOutput:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo" key="stop:"> <object class="IBActionInfo" key="stop:">
<string key="name">stop:</string> <string key="name">stop:</string>
<string key="candidateClassName">id</string> <string key="candidateClassName">id</string>
</object> </object>
<object class="IBActionInfo" key="togglePlayElements:">
<string key="name">togglePlayElements:</string>
<string key="candidateClassName">id</string>
</object>
</dictionary> </dictionary>
<object class="IBClassDescriptionSource" key="sourceIdentifier"> <object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string> <string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/VLDocument.h</string> <string key="minorKey">./Classes/VLDocument.h</string>
</object> </object>
</object> </object>
<object class="IBPartialClassDescription">
<string key="className">VLLogWindow</string>
<string key="superclassName">NSWindowController</string>
<object class="NSMutableDictionary" key="outlets">
<string key="NS.key.0">log</string>
<string key="NS.object.0">id</string>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
<string key="NS.key.0">log</string>
<object class="IBToOneOutletInfo" key="NS.object.0">
<string key="name">log</string>
<string key="candidateClassName">id</string>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/VLLogWindow.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">VLPDFWindow</string>
<string key="superclassName">NSWindowController</string>
<dictionary class="NSMutableDictionary" key="outlets">
<string key="pdfView">PDFView</string>
<string key="sheetWin">NSWindowController</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
<object class="IBToOneOutletInfo" key="pdfView">
<string key="name">pdfView</string>
<string key="candidateClassName">PDFView</string>
</object>
<object class="IBToOneOutletInfo" key="sheetWin">
<string key="name">sheetWin</string>
<string key="candidateClassName">NSWindowController</string>
</object>
</dictionary>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/VLPDFWindow.h</string>
</object>
</object>
<object class="IBPartialClassDescription"> <object class="IBPartialClassDescription">
<string key="className">VLSheetView</string> <string key="className">VLSheetView</string>
<string key="superclassName">NSView</string> <string key="superclassName">NSView</string>
@ -6646,11 +6765,35 @@ AAAAAAAAAAAAAHRleHQAAAAAQ29weXJpZ2h0IEFwcGxlIENvbXB1dGVyLCBJbmMuLCAyMDA1AAAAAA</
<object class="IBPartialClassDescription"> <object class="IBPartialClassDescription">
<string key="className">VLSheetWindow</string> <string key="className">VLSheetWindow</string>
<string key="superclassName">NSWindowController</string> <string key="superclassName">NSWindowController</string>
<dictionary class="NSMutableDictionary" key="actions">
<string key="showOutput:">id</string>
<string key="togglePlayElements:">id</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="actionInfosByName">
<object class="IBActionInfo" key="showOutput:">
<string key="name">showOutput:</string>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo" key="togglePlayElements:">
<string key="name">togglePlayElements:</string>
<string key="candidateClassName">id</string>
</object>
</dictionary>
<dictionary class="NSMutableDictionary" key="outlets"> <dictionary class="NSMutableDictionary" key="outlets">
<string key="logWin">VLLogWindow</string>
<string key="pdfWin">VLPDFWindow</string>
<string key="progressIndicator">NSProgressIndicator</string> <string key="progressIndicator">NSProgressIndicator</string>
<string key="sheetView">VLSheetView</string> <string key="sheetView">VLSheetView</string>
</dictionary> </dictionary>
<dictionary class="NSMutableDictionary" key="toOneOutletInfosByName"> <dictionary class="NSMutableDictionary" key="toOneOutletInfosByName">
<object class="IBToOneOutletInfo" key="logWin">
<string key="name">logWin</string>
<string key="candidateClassName">VLLogWindow</string>
</object>
<object class="IBToOneOutletInfo" key="pdfWin">
<string key="name">pdfWin</string>
<string key="candidateClassName">VLPDFWindow</string>
</object>
<object class="IBToOneOutletInfo" key="progressIndicator"> <object class="IBToOneOutletInfo" key="progressIndicator">
<string key="name">progressIndicator</string> <string key="name">progressIndicator</string>
<string key="candidateClassName">NSProgressIndicator</string> <string key="candidateClassName">NSProgressIndicator</string>

View File

@ -13,8 +13,6 @@
#import "VLKeyValueUndo.h" #import "VLKeyValueUndo.h"
@class VLSheetWindow; @class VLSheetWindow;
@class VLPDFWindow;
@class VLLogWindow;
#define VLBIABType @"VLBIABType" #define VLBIABType @"VLBIABType"
#define VLNativeType @"org.aereperennius.vocaleasel-song" #define VLNativeType @"org.aereperennius.vocaleasel-song"
@ -61,8 +59,6 @@ enum {
bool brandNew; bool brandNew;
bool hasMusicSequence; bool hasMusicSequence;
VLSheetWindow * sheetWin; VLSheetWindow * sheetWin;
VLLogWindow * logWin;
VLPDFWindow * pdfWin;
VLKeyValueUndo* undo; VLKeyValueUndo* undo;
NSRange previewRange; NSRange previewRange;
float playRate; float playRate;
@ -87,8 +83,6 @@ enum {
- (void) setRepeatVolta:(int)repeatVolta; - (void) setRepeatVolta:(int)repeatVolta;
- (IBAction) showOutput:(id)sender;
- (IBAction) showLog:(id)sender;
- (IBAction) play:(id)sender; - (IBAction) play:(id)sender;
- (IBAction) stop:(id)sender; - (IBAction) stop:(id)sender;
- (IBAction) playStop:(id)sender; - (IBAction) playStop:(id)sender;
@ -105,7 +99,6 @@ enum {
- (void) willChangeSong; - (void) willChangeSong;
- (void) didChangeSong; - (void) didChangeSong;
- (void) addObserver:(id)observer; - (void) addObserver:(id)observer;
- (VLLogWindow *)logWin;
@end @end

View File

@ -98,8 +98,6 @@
chordPadding = 1.5f; chordPadding = 1.5f;
lyricPadding = 1.0f; lyricPadding = 1.0f;
sheetWin = nil; sheetWin = nil;
pdfWin = nil;
logWin = nil;
tmpURL = nil; tmpURL = nil;
vcsWrapper = nil; vcsWrapper = nil;
repeatVolta = 2; repeatVolta = 2;
@ -144,6 +142,8 @@
- (void) dealloc - (void) dealloc
{ {
VLSoundOut::Instance()->Stop();
delete song; delete song;
[lilypondTemplate release]; [lilypondTemplate release];
@ -163,38 +163,6 @@
[super dealloc]; [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 - (void)makeWindowControllers
{ {
sheetWin = [[VLSheetWindow alloc] initWithWindowNibName: @"VLDocument"]; sheetWin = [[VLSheetWindow alloc] initWithWindowNibName: @"VLDocument"];
@ -203,15 +171,6 @@
[sheetWin release]; [sheetWin release];
} }
- (void)showWindows
{
[sheetWin showWindow: self];
if ([pdfWin isWindowLoaded])
[pdfWin showWindow: self];
if ([logWin isWindowLoaded])
[logWin showWindow: self];
}
- (VLSong *) song - (VLSong *) song
{ {
return song; return song;
@ -500,9 +459,8 @@
[task setStandardError: pipe]; [task setStandardError: pipe];
[task setArguments: args]; [task setArguments: args];
[task setLaunchPath: launch]; [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]]; withObject:[pipe fileHandleForReading]];
return task; return task;
@ -600,13 +558,6 @@
[self setSongTempo:[songTempo intValue]+[sender tag]]; [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 - (NSPrintOperation *)printOperationWithSettings:(NSDictionary *)printSettings
error:(NSError **)outError error:(NSError **)outError
{ {
@ -625,11 +576,6 @@
return printOperation; return printOperation;
} }
- (IBAction) showLog:(id)sender
{
[[self logWin] showWindow:sender];
}
- (void) willChangeSong - (void) willChangeSong
{ {
[self willChangeValueForKey:@"song"]; [self willChangeValueForKey:@"song"];

View File

@ -12,9 +12,9 @@
@implementation VLLogWindow @implementation VLLogWindow
- (id)initWithWindow:(NSWindow *)window - (id)init
{ {
self = [super initWithWindow:window]; self = [super initWithWindowNibName:@"VLLogWindow"];
logText = [[NSMutableString alloc] initWithCapacity:1000]; logText = [[NSMutableString alloc] initWithCapacity:1000];
return self; return self;

View File

@ -10,6 +10,7 @@
#import "VLMIDIDocument.h" #import "VLMIDIDocument.h"
#import "VLMIDIWriter.h" #import "VLMIDIWriter.h"
#import "VLSheetWindow.h"
@implementation VLDocument (MIDI) @implementation VLDocument (MIDI)
@ -53,13 +54,8 @@
- (void)mmaDone:(NSNotification *)notification { - (void)mmaDone:(NSNotification *)notification {
[[NSNotificationCenter defaultCenter] removeObserver: self [[NSNotificationCenter defaultCenter] removeObserver: self
name:NSTaskDidTerminateNotification object:[notification object]]; name:NSTaskDidTerminateNotification object:[notification object]];
int status = [[notification object] terminationStatus]; if ([[notification object] terminationStatus])
if (!status) { [sheetWin showLogAndBeep];
;
} else {
[logWin showWindow: self];
NSBeep();
}
} }
@end @end

View File

@ -9,6 +9,7 @@
// //
#import "VLPDFDocument.h" #import "VLPDFDocument.h"
#import "VLSheetWindow.h"
@implementation VLDocument (PDF) @implementation VLDocument (PDF)
@ -55,13 +56,8 @@
- (void)pdfDone:(NSNotification *)notification { - (void)pdfDone:(NSNotification *)notification {
[[NSNotificationCenter defaultCenter] removeObserver: self [[NSNotificationCenter defaultCenter] removeObserver: self
name:NSTaskDidTerminateNotification object:[notification object]]; name:NSTaskDidTerminateNotification object:[notification object]];
int status = [[notification object] terminationStatus]; if ([[notification object] terminationStatus])
if (!status) { [sheetWin showLogAndBeep];
;
} else {
[[self logWin] showWindow: self];
NSBeep();
}
} }
@end @end

View File

@ -12,6 +12,7 @@
#import <Quartz/Quartz.h> #import <Quartz/Quartz.h>
@interface VLPDFWindow : NSWindowController <NSToolbarDelegate> { @interface VLPDFWindow : NSWindowController <NSToolbarDelegate> {
IBOutlet NSWindowController * sheetWin;
IBOutlet PDFView * pdfView; IBOutlet PDFView * pdfView;
} }

View File

@ -14,6 +14,11 @@
@implementation VLPDFWindow @implementation VLPDFWindow
- (id)init
{
return self = [super initWithWindowNibName:@"VLPDFWindow"];
}
- (NSString *)windowTitleForDocumentDisplayName:(NSString *)displayName - (NSString *)windowTitleForDocumentDisplayName:(NSString *)displayName
{ {
return [displayName stringByAppendingString: @" - Output"]; return [displayName stringByAppendingString: @" - Output"];
@ -33,7 +38,7 @@
- (void)reloadPDF - (void)reloadPDF
{ {
if (pdfView) { if (pdfView) {
VLDocument *doc = [self document]; VLDocument *doc = [sheetWin document];
NSURL * pdfURL = [doc fileURLWithExtension:@"pdf"]; NSURL * pdfURL = [doc fileURLWithExtension:@"pdf"];
if (!pdfURL) { if (!pdfURL) {
NSURL * workURL = [doc workURL]; NSURL * workURL = [doc workURL];

View File

@ -25,10 +25,15 @@
@end @end
@class VLSheetView; @class VLSheetView;
@class VLLogWindow;
@class VLPDFWindow;
@interface VLSheetWindow : NSWindowController <NSToolbarDelegate> { @interface VLSheetWindow : NSWindowController <NSToolbarDelegate> {
IBOutlet VLSheetView * sheetView; IBOutlet VLSheetView * sheetView;
IBOutlet NSProgressIndicator * progressIndicator; IBOutlet NSProgressIndicator * progressIndicator;
IBOutlet VLLogWindow * logWin;
IBOutlet VLPDFWindow * pdfWin;
VLEditable * editTarget; VLEditable * editTarget;
@ -37,11 +42,16 @@
int editNumStanzas; int editNumStanzas;
} }
@property (nonatomic,readonly) VLLogWindow * logWin;
- (IBAction) togglePlayElements:(id)sender;
- (IBAction) showOutput:(id)sender;
- (VLEditable *) editTarget; - (VLEditable *) editTarget;
- (void) setEditTarget:(VLEditable *)editable; - (void) setEditTarget:(VLEditable *)editable;
- (void) startAnimation; - (void) startAnimation;
- (void) stopAnimation; - (void) stopAnimation;
- (void) willPlaySequence:(MusicSequence)music; - (void) willPlaySequence:(MusicSequence)music;
- (IBAction) togglePlayElements:(id)sender; - (void) showLogAndBeep;
@end @end

View File

@ -10,7 +10,8 @@
#import "VLSheetWindow.h" #import "VLSheetWindow.h"
#import "VLDocument.h" #import "VLDocument.h"
#import "VLPDFWindow.h"
#import "VLLogWindow.h"
@implementation VLEditable @implementation VLEditable
@ -44,6 +45,8 @@
@implementation VLSheetWindow @implementation VLSheetWindow
@synthesize logWin;
- (id)initWithWindow:(NSWindow *)window - (id)initWithWindow:(NSWindow *)window
{ {
if (self = [super initWithWindow:window]) { if (self = [super initWithWindow:window]) {
@ -62,10 +65,6 @@
editTarget = editable; editTarget = editable;
} }
- (void)windowDidLoad
{
}
- (void) startAnimation - (void) startAnimation
{ {
[progressIndicator startAnimation:self]; [progressIndicator startAnimation:self];
@ -110,4 +109,22 @@
return YES; 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 @end