mirror of
https://github.com/TomHarte/CLK.git
synced 2024-08-25 15:28:58 +00:00
Causes the machine picker to show as a sheet.
Albeit with some user experience issues lingering.
This commit is contained in:
parent
cde2faeda6
commit
7dac791290
@ -25,7 +25,7 @@
|
|||||||
<rect key="frame" x="0.0" y="0.0" width="400" height="300"/>
|
<rect key="frame" x="0.0" y="0.0" width="400" height="300"/>
|
||||||
<autoresizingMask key="autoresizingMask"/>
|
<autoresizingMask key="autoresizingMask"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<openGLView useAuxiliaryDepthBufferStencil="NO" allowOffline="YES" wantsBestResolutionOpenGLSurface="YES" translatesAutoresizingMaskIntoConstraints="NO" id="DEG-fq-cjd" customClass="CSOpenGLView">
|
<openGLView hidden="YES" useAuxiliaryDepthBufferStencil="NO" allowOffline="YES" wantsBestResolutionOpenGLSurface="YES" translatesAutoresizingMaskIntoConstraints="NO" id="DEG-fq-cjd" customClass="CSOpenGLView">
|
||||||
<rect key="frame" x="0.0" y="0.0" width="400" height="300"/>
|
<rect key="frame" x="0.0" y="0.0" width="400" height="300"/>
|
||||||
</openGLView>
|
</openGLView>
|
||||||
</subviews>
|
</subviews>
|
||||||
|
@ -52,12 +52,16 @@ class MachineDocument:
|
|||||||
aController.window?.contentAspectRatio = self.aspectRatio()
|
aController.window?.contentAspectRatio = self.aspectRatio()
|
||||||
setupMachineOutput()
|
setupMachineOutput()
|
||||||
|
|
||||||
// If there's no machine but the NIB has loaded, show the new machine dialogue
|
}
|
||||||
if self.machine == nil {
|
|
||||||
|
// Attempting to show a sheet before the window is visible (such as when the NIB is loaded) results in
|
||||||
|
// a sheet mysteriously floating on its own. For now, use windowDidUpdate as a proxy to know that the window
|
||||||
|
// is visible, though it's a little premature.
|
||||||
|
func windowDidUpdate(_ notification: Notification) {
|
||||||
|
if self.shouldShowNewMachinePanel {
|
||||||
|
self.shouldShowNewMachinePanel = false
|
||||||
Bundle.main.loadNibNamed(NSNib.Name(rawValue: "MachinePicker"), owner: self, topLevelObjects: nil)
|
Bundle.main.loadNibNamed(NSNib.Name(rawValue: "MachinePicker"), owner: self, topLevelObjects: nil)
|
||||||
aController.window?.beginSheet(self.machinePickerPanel!, completionHandler: { (response) in
|
self.windowControllers[0].window?.beginSheet(self.machinePickerPanel!, completionHandler: nil)
|
||||||
Swift.print("\(response)")
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -87,8 +91,9 @@ class MachineDocument:
|
|||||||
|
|
||||||
setupAudioQueueClockRate()
|
setupAudioQueueClockRate()
|
||||||
|
|
||||||
// bring OpenGL view-holding window on top of the options panel
|
// bring OpenGL view-holding window on top of the options panel and show the content
|
||||||
openGLView.window!.makeKeyAndOrderFront(self)
|
openGLView.window!.makeKeyAndOrderFront(self)
|
||||||
|
openGLView.isHidden = false
|
||||||
|
|
||||||
// start accepting best effort updates
|
// start accepting best effort updates
|
||||||
self.bestEffortUpdater!.delegate = self
|
self.bestEffortUpdater!.delegate = self
|
||||||
@ -143,6 +148,7 @@ class MachineDocument:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fileprivate var shouldShowNewMachinePanel = false
|
||||||
override func read(from url: URL, ofType typeName: String) throws {
|
override func read(from url: URL, ofType typeName: String) throws {
|
||||||
if let analyser = CSStaticAnalyser(fileAt: url) {
|
if let analyser = CSStaticAnalyser(fileAt: url) {
|
||||||
self.displayName = analyser.displayName
|
self.displayName = analyser.displayName
|
||||||
@ -155,6 +161,7 @@ class MachineDocument:
|
|||||||
convenience init(type typeName: String) throws {
|
convenience init(type typeName: String) throws {
|
||||||
self.init()
|
self.init()
|
||||||
self.fileType = typeName
|
self.fileType = typeName
|
||||||
|
self.shouldShowNewMachinePanel = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: the pasteboard
|
// MARK: the pasteboard
|
||||||
@ -237,7 +244,7 @@ class MachineDocument:
|
|||||||
|
|
||||||
// MARK: New machine creation
|
// MARK: New machine creation
|
||||||
@IBOutlet var machinePicker: MachinePicker?
|
@IBOutlet var machinePicker: MachinePicker?
|
||||||
@IBOutlet var machinePickerPanel: NSPanel?
|
@IBOutlet var machinePickerPanel: NSWindow?
|
||||||
@IBAction func createMachine(_ sender: NSButton?) {
|
@IBAction func createMachine(_ sender: NSButton?) {
|
||||||
self.configureAs(machinePicker!.selectedMachine())
|
self.configureAs(machinePicker!.selectedMachine())
|
||||||
machinePicker = nil
|
machinePicker = nil
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
</customObject>
|
</customObject>
|
||||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||||
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
||||||
<window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" showsToolbarButton="NO" visibleAtLaunch="NO" animationBehavior="default" titleVisibility="hidden" id="QvC-M9-y7g" customClass="NSPanel">
|
<window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" showsToolbarButton="NO" visibleAtLaunch="NO" animationBehavior="default" titleVisibility="hidden" id="QvC-M9-y7g">
|
||||||
<windowStyleMask key="styleMask" documentModal="YES"/>
|
<windowStyleMask key="styleMask" documentModal="YES"/>
|
||||||
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
|
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
|
||||||
<rect key="contentRect" x="196" y="240" width="562" height="203"/>
|
<rect key="contentRect" x="196" y="240" width="562" height="203"/>
|
||||||
@ -63,7 +63,7 @@
|
|||||||
<rect key="frame" x="10" y="33" width="516" height="92"/>
|
<rect key="frame" x="10" y="33" width="516" height="92"/>
|
||||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||||
<subviews>
|
<subviews>
|
||||||
<popUpButton verticalHuggingPriority="750" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="00d-sg-Krh">
|
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="00d-sg-Krh">
|
||||||
<rect key="frame" x="54" y="65" width="94" height="26"/>
|
<rect key="frame" x="54" y="65" width="94" height="26"/>
|
||||||
<popUpButtonCell key="cell" type="push" title="CPC6128" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" tag="6128" imageScaling="proportionallyDown" inset="2" selectedItem="klh-ZE-Agp" id="hVJ-h6-iea">
|
<popUpButtonCell key="cell" type="push" title="CPC6128" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" tag="6128" imageScaling="proportionallyDown" inset="2" selectedItem="klh-ZE-Agp" id="hVJ-h6-iea">
|
||||||
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
|
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
|
||||||
@ -77,7 +77,7 @@
|
|||||||
</menu>
|
</menu>
|
||||||
</popUpButtonCell>
|
</popUpButtonCell>
|
||||||
</popUpButton>
|
</popUpButton>
|
||||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" ambiguous="YES" translatesAutoresizingMaskIntoConstraints="NO" id="q9q-sl-J0q">
|
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="q9q-sl-J0q">
|
||||||
<rect key="frame" x="8" y="70" width="42" height="17"/>
|
<rect key="frame" x="8" y="70" width="42" height="17"/>
|
||||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Model" id="Cw3-q5-1bC">
|
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Model" id="Cw3-q5-1bC">
|
||||||
<font key="font" metaFont="system"/>
|
<font key="font" metaFont="system"/>
|
||||||
@ -85,28 +85,14 @@
|
|||||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||||
</textFieldCell>
|
</textFieldCell>
|
||||||
</textField>
|
</textField>
|
||||||
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="9cx-CH-kPM">
|
|
||||||
<rect key="frame" x="54" y="65" width="94" height="26"/>
|
|
||||||
<popUpButtonCell key="cell" type="push" title="CPC6128" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" tag="6128" imageScaling="proportionallyDown" inset="2" selectedItem="hwp-gt-NhT" id="lIW-5k-ov2">
|
|
||||||
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
|
|
||||||
<font key="font" metaFont="menu"/>
|
|
||||||
<menu key="menu" id="xIy-eq-osh">
|
|
||||||
<items>
|
|
||||||
<menuItem title="CPC464" tag="464" id="R8h-sQ-JeY"/>
|
|
||||||
<menuItem title="CPC664" tag="664" id="iUo-zD-y6x"/>
|
|
||||||
<menuItem title="CPC6128" state="on" tag="6128" id="hwp-gt-NhT"/>
|
|
||||||
</items>
|
|
||||||
</menu>
|
|
||||||
</popUpButtonCell>
|
|
||||||
</popUpButton>
|
|
||||||
</subviews>
|
</subviews>
|
||||||
<constraints>
|
<constraints>
|
||||||
<constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="9cx-CH-kPM" secondAttribute="bottom" constant="17" id="0ut-dE-cZI"/>
|
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="00d-sg-Krh" secondAttribute="trailing" constant="17" id="4AF-5C-2IF"/>
|
||||||
<constraint firstItem="9cx-CH-kPM" firstAttribute="leading" secondItem="q9q-sl-J0q" secondAttribute="trailing" constant="8" id="Fum-4i-8f0"/>
|
<constraint firstItem="00d-sg-Krh" firstAttribute="top" secondItem="5zS-Nj-Ynx" secondAttribute="top" constant="3" id="4U2-iE-UFM"/>
|
||||||
<constraint firstItem="q9q-sl-J0q" firstAttribute="leading" secondItem="5zS-Nj-Ynx" secondAttribute="leading" constant="10" id="Wof-5h-gfD"/>
|
<constraint firstItem="q9q-sl-J0q" firstAttribute="leading" secondItem="5zS-Nj-Ynx" secondAttribute="leading" constant="10" id="Wof-5h-gfD"/>
|
||||||
|
<constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="00d-sg-Krh" secondAttribute="bottom" constant="17" id="enU-LN-Nep"/>
|
||||||
|
<constraint firstItem="00d-sg-Krh" firstAttribute="leading" secondItem="q9q-sl-J0q" secondAttribute="trailing" constant="8" id="mA8-US-ndo"/>
|
||||||
<constraint firstItem="q9q-sl-J0q" firstAttribute="centerY" secondItem="00d-sg-Krh" secondAttribute="centerY" id="vA8-IA-Uwf"/>
|
<constraint firstItem="q9q-sl-J0q" firstAttribute="centerY" secondItem="00d-sg-Krh" secondAttribute="centerY" id="vA8-IA-Uwf"/>
|
||||||
<constraint firstItem="9cx-CH-kPM" firstAttribute="top" secondItem="5zS-Nj-Ynx" secondAttribute="top" constant="3" id="wuW-it-Nfe"/>
|
|
||||||
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="9cx-CH-kPM" secondAttribute="trailing" constant="17" id="yrI-ve-pP2"/>
|
|
||||||
</constraints>
|
</constraints>
|
||||||
</view>
|
</view>
|
||||||
</tabViewItem>
|
</tabViewItem>
|
||||||
|
Loading…
Reference in New Issue
Block a user