[Visualization] Tear down window vis when not open
When the visualization window is not open, it should not continue to run the scene until the app is quit. Apparently, the windowed mode is really slow on old Intel machines, too. Full screening it is enough to bodge the entire system session until the machine is remotely rebooted. Signed-off-by: Christopher Snowhill <kode54@gmail.com>swiftingly
parent
84eadd1f33
commit
c59d4d0215
|
@ -11,7 +11,7 @@
|
|||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface SpectrumWindowController : NSWindowController {
|
||||
@interface SpectrumWindowController : NSWindowController <NSWindowDelegate> {
|
||||
IBOutlet PlaybackController *playbackController;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,15 +22,33 @@
|
|||
- (void)windowDidLoad {
|
||||
[super windowDidLoad];
|
||||
|
||||
self.spectrumView = [[SpectrumView alloc] initWithFrame:[[self window] frame]];
|
||||
[[self window] setContentView:self.spectrumView];
|
||||
[self startRunning];
|
||||
}
|
||||
|
||||
[self.spectrumView enableCameraControl];
|
||||
- (void)startRunning {
|
||||
if(!self.spectrumView) {
|
||||
self.spectrumView = [[SpectrumView alloc] initWithFrame:[[self window] frame]];
|
||||
[[self window] setContentView:self.spectrumView];
|
||||
|
||||
[self.spectrumView enableCameraControl];
|
||||
}
|
||||
|
||||
if(playbackController.playbackStatus == CogStatusPlaying)
|
||||
[self.spectrumView startPlayback];
|
||||
}
|
||||
|
||||
- (void)stopRunning {
|
||||
[[self window] setContentView:nil];
|
||||
self.spectrumView = nil;
|
||||
}
|
||||
|
||||
- (void)windowWillClose:(NSNotification *)notification {
|
||||
NSWindow *currentWindow = notification.object;
|
||||
if([currentWindow isEqualTo:self.window]) {
|
||||
[self stopRunning];
|
||||
}
|
||||
}
|
||||
|
||||
- (IBAction)toggleWindow:(id)sender {
|
||||
if([[self window] isVisible])
|
||||
[[self window] orderOut:self];
|
||||
|
@ -39,8 +57,7 @@
|
|||
}
|
||||
|
||||
- (IBAction)showWindow:(id)sender {
|
||||
if(self.spectrumView && playbackController.playbackStatus == CogStatusPlaying)
|
||||
[self.spectrumView startPlayback];
|
||||
[self startRunning];
|
||||
return [super showWindow:sender];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue