Cocoa Port: Create new DisplayView objects in code instead of creating them implicitly through the nib.

This commit is contained in:
rogerman 2017-09-13 14:48:19 -07:00
parent c94f353f2a
commit d33faecd12
3 changed files with 3048 additions and 3060 deletions

View File

@ -92,7 +92,6 @@ class OGLVideoOutput;
{ {
NSObject *dummyObject; NSObject *dummyObject;
DisplayView *view;
ClientDisplayViewProperties _localViewProps; ClientDisplayViewProperties _localViewProps;
NSView *saveScreenshotPanelAccessoryView; NSView *saveScreenshotPanelAccessoryView;
NSView *outputVolumeControlView; NSView *outputVolumeControlView;
@ -102,6 +101,7 @@ class OGLVideoOutput;
NSSlider *microphoneGainSlider; NSSlider *microphoneGainSlider;
NSButton *microphoneMuteButton; NSButton *microphoneMuteButton;
DisplayView *view;
EmuControllerDelegate *emuControl; EmuControllerDelegate *emuControl;
CocoaDSDisplayVideo *cdsVideoOutput; CocoaDSDisplayVideo *cdsVideoOutput;
NSScreen *assignedScreen; NSScreen *assignedScreen;
@ -123,7 +123,6 @@ class OGLVideoOutput;
@property (readonly) IBOutlet NSObject *dummyObject; @property (readonly) IBOutlet NSObject *dummyObject;
@property (readonly) IBOutlet DisplayView *view;
@property (readonly) IBOutlet NSView *saveScreenshotPanelAccessoryView; @property (readonly) IBOutlet NSView *saveScreenshotPanelAccessoryView;
@property (readonly) IBOutlet NSView *outputVolumeControlView; @property (readonly) IBOutlet NSView *outputVolumeControlView;
@property (readonly) IBOutlet NSView *microphoneGainControlView; @property (readonly) IBOutlet NSView *microphoneGainControlView;
@ -132,6 +131,7 @@ class OGLVideoOutput;
@property (readonly) IBOutlet NSSlider *microphoneGainSlider; @property (readonly) IBOutlet NSSlider *microphoneGainSlider;
@property (readonly) IBOutlet NSButton *microphoneMuteButton; @property (readonly) IBOutlet NSButton *microphoneMuteButton;
@property (retain) DisplayView *view;
@property (retain) EmuControllerDelegate *emuControl; @property (retain) EmuControllerDelegate *emuControl;
@property (retain) CocoaDSDisplayVideo *cdsVideoOutput; @property (retain) CocoaDSDisplayVideo *cdsVideoOutput;
@property (assign) NSScreen *assignedScreen; @property (assign) NSScreen *assignedScreen;

View File

@ -94,6 +94,7 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
return self; return self;
} }
view = nil;
emuControl = [theEmuController retain]; emuControl = [theEmuController retain];
cdsVideoOutput = nil; cdsVideoOutput = nil;
assignedScreen = nil; assignedScreen = nil;
@ -142,6 +143,7 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
[[NSNotificationCenter defaultCenter] removeObserver:self]; [[NSNotificationCenter defaultCenter] removeObserver:self];
[self setEmuControl:nil]; [self setEmuControl:nil];
[self setAssignedScreen:nil]; [self setAssignedScreen:nil];
[self setView:nil];
[self setMasterWindow:nil]; [self setMasterWindow:nil];
[self setCdsVideoOutput:nil]; [self setCdsVideoOutput:nil];
@ -1350,9 +1352,14 @@ static std::unordered_map<NSScreen *, DisplayWindowController *> _screenMap; //
- (void)windowDidLoad - (void)windowDidLoad
{ {
NSRect newViewFrameRect = NSMakeRect(0.0f, (CGFloat)_statusBarHeight, (CGFloat)_localViewProps.clientWidth, (CGFloat)_localViewProps.clientHeight);
DisplayView *newView = [[[DisplayView alloc] initWithFrame:newViewFrameRect] autorelease];
[self setView:newView];
// Set up the master window that is associated with this window controller. // Set up the master window that is associated with this window controller.
[self setMasterWindow:[self window]]; [self setMasterWindow:[self window]];
[masterWindow setTitle:(NSString *)[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"]]; [masterWindow setTitle:(NSString *)[[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleName"]];
[[masterWindow contentView] addSubview:view];
[masterWindow setInitialFirstResponder:view]; [masterWindow setInitialFirstResponder:view];
[[emuControl windowList] addObject:self]; [[emuControl windowList] addObject:self];
[emuControl updateAllWindowTitles]; [emuControl updateAllWindowTitles];