Compare commits

...

7 Commits

Author SHA1 Message Date
tudnai 29bf3a5da5 Efforts to adjust Screen Wrapping right at the launch 2022-12-20 12:15:35 +01:00
tudnai 38e5a1e634 Better structured DebugView / DisassView 2022-12-20 12:14:18 +01:00
tudnai 84242c680d Memory View Cross Hair 2022-12-16 05:28:55 +01:00
tudnai 3334950cbe Debugger icon size adjustment 2022-12-13 04:33:50 -08:00
tudnai 5f7caa2c25 Debug Icon size adjustments 2022-12-13 04:32:10 -08:00
tudnai 16fc1c3c44 MonitorView size adjust at load time 2022-12-09 20:06:53 -08:00
tudnai bb6b239266 Disass View Select / Deselect 2022-12-09 13:33:51 -08:00
10 changed files with 131 additions and 213 deletions

View File

@ -1197,6 +1197,7 @@
32E3126C24AC033A00E61891 /* ToolBarController.swift */,
32C6995127C5439300D0F25D /* Debugger.swift */,
323D042F24898AB70086A901 /* PreferencesViewController.swift */,
32544194264A6C1600B7E3ED /* DisplayView.swift */,
32D089D7291E1BF800F2B486 /* DisassView.swift */,
32D08A1329219C6A00F2B486 /* HexDigitFormatter.swift */,
327B75D629064FDC00A86A71 /* DebuggerViewController.swift */,
@ -1204,7 +1205,6 @@
323D04312489BFD80086A901 /* PreferencesWindowController.swift */,
32B18435233F10BC00DBB4AB /* Shaders.metal */,
32C4532D233345420000EBA1 /* MonitorView.swift */,
32544194264A6C1600B7E3ED /* DisplayView.swift */,
32C453072331C0910000EBA1 /* NSLayoutManager-Extension.swift */,
32440BA22480D5C0000F9DA1 /* LoRes.swift */,
32DBF7632334657900DD50E7 /* HiRes.swift */,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

View File

@ -274,6 +274,56 @@
<color key="backgroundColor" red="0.11372549019607843" green="0.11372549019607843" blue="0.11372549019607843" alpha="1" colorSpace="custom" customColorSpace="calibratedRGB"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="TWP-wN-aCW" userLabel="MemoryBackground">
<rect key="frame" x="382" y="10" width="710" height="252"/>
<textFieldCell key="cell" lineBreakMode="clipping" drawsBackground="YES" id="1Ul-O8-InU">
<font key="font" size="10" name="PrintChar21"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" red="0.1137254902" green="0.1137254902" blue="0.1137254902" alpha="1" colorSpace="custom" customColorSpace="calibratedRGB"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="VVf-7D-pjV" userLabel="MemoryHighlighter Horizontal">
<rect key="frame" x="382" y="199" width="710" height="15"/>
<constraints>
<constraint firstAttribute="height" constant="15" id="DD3-Fv-9rp"/>
</constraints>
<textFieldCell key="cell" lineBreakMode="clipping" drawsBackground="YES" id="wtu-IS-9xa">
<font key="font" size="10" name="PrintChar21"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="0.44" colorSpace="custom" customColorSpace="calibratedRGB"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="f2z-vp-zIf" userLabel="MemoryHighlighter Vertical">
<rect key="frame" x="500" y="10" width="10" height="252"/>
<constraints>
<constraint firstAttribute="width" constant="10" id="sVL-zn-P6J"/>
</constraints>
<textFieldCell key="cell" lineBreakMode="clipping" drawsBackground="YES" id="JbR-PR-wNO">
<font key="font" size="10" name="PrintChar21"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" red="1" green="1" blue="1" alpha="0.33000000000000002" colorSpace="custom" customColorSpace="calibratedRGB"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="kXX-RT-0Bb" userLabel="MemoryCursor">
<rect key="frame" x="498" y="196" width="14" height="20"/>
<constraints>
<constraint firstAttribute="width" constant="14" id="RyF-lI-kBO"/>
<constraint firstAttribute="height" constant="20" id="SPO-SY-K6g"/>
</constraints>
<textFieldCell key="cell" lineBreakMode="clipping" borderStyle="border" drawsBackground="YES" id="2Uj-VZ-SbU">
<font key="font" size="10" name="PrintChar21"/>
<color key="textColor" name="selectedTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" red="0.0" green="0.0" blue="1" alpha="1" colorSpace="calibratedRGB"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="4pW-7e-eaj" userLabel="Memory">
<rect key="frame" x="380" y="10" width="714" height="252"/>
<textFieldCell key="cell" lineBreakMode="clipping" id="iea-16-EtD">
<font key="font" size="10" name="PrintChar21"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" red="0.1137254902" green="0.1137254902" blue="0.1137254902" alpha="1" colorSpace="custom" customColorSpace="calibratedRGB"/>
</textFieldCell>
</textField>
<stackView focusRingType="none" distribution="fill" orientation="vertical" alignment="leading" spacing="4" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="jY7-ZU-I4z" userLabel="Disassebler">
<rect key="frame" x="8" y="10" width="366" height="484"/>
<subviews>
@ -378,7 +428,7 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textView editable="NO" selectable="NO" drawsBackground="NO" importsGraphics="NO" richText="NO" horizontallyResizable="YES" verticallyResizable="YES" baseWritingDirection="leftToRight" findStyle="bar" allowsCharacterPickerTouchBarItem="NO" textCompletion="NO" id="Hwx-Gd-XW1" userLabel="Disass Display" customClass="DisassView" customModule="A2MacTests" customModuleProvider="target">
<rect key="frame" x="0.0" y="-402" width="349" height="510"/>
<rect key="frame" x="0.0" y="-468" width="349" height="510"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" red="0.12549019610000001" green="0.12549019610000001" blue="0.12549019610000001" alpha="0.0" colorSpace="custom" customColorSpace="sRGB"/>
@ -436,7 +486,7 @@
<rect key="frame" x="-100" y="-100" width="225" height="15"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
<scroller key="verticalScroller" verticalHuggingPriority="750" doubleValue="0.076923076923076927" horizontal="NO" id="8wE-fn-MQK">
<scroller key="verticalScroller" verticalHuggingPriority="750" horizontal="NO" id="8wE-fn-MQK">
<rect key="frame" x="350" y="1" width="15" height="458"/>
<autoresizingMask key="autoresizingMask"/>
<connections>
@ -558,7 +608,7 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textView editable="NO" selectable="NO" drawsBackground="NO" importsGraphics="NO" richText="NO" horizontallyResizable="YES" verticallyResizable="YES" baseWritingDirection="leftToRight" findStyle="bar" allowsCharacterPickerTouchBarItem="NO" textCompletion="NO" id="BHr-Q4-rBI" userLabel="Stack Display" customClass="DisplayView" customModule="A2MacTests" customModuleProvider="target">
<rect key="frame" x="0.0" y="-295" width="334" height="165"/>
<rect key="frame" x="0.0" y="-316" width="334" height="165"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" widthSizable="YES" flexibleMaxX="YES" flexibleMinY="YES" heightSizable="YES" flexibleMaxY="YES"/>
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="windowBackgroundColor" catalog="System" colorSpace="catalog"/>
@ -582,7 +632,7 @@
<rect key="frame" x="-100" y="-100" width="349" height="15"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
<scroller key="verticalScroller" verticalHuggingPriority="750" doubleValue="0.14285714285714285" horizontal="NO" id="dcm-z5-VNG">
<scroller key="verticalScroller" verticalHuggingPriority="750" doubleValue="1" horizontal="NO" id="dcm-z5-VNG">
<rect key="frame" x="335" y="1" width="15" height="158"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
@ -712,7 +762,7 @@
</stackView>
<scrollView focusRingType="none" horizontalCompressionResistancePriority="250" verticalCompressionResistancePriority="250" borderType="line" horizontalLineScroll="0.0" horizontalPageScroll="0.0" verticalLineScroll="0.0" verticalPageScroll="0.0" hasHorizontalScroller="NO" hasVerticalScroller="NO" minMagnification="1" translatesAutoresizingMaskIntoConstraints="NO" id="dzC-sA-aHa" userLabel="Memory Scroll" customClass="DisplayScrollView" customModule="A2MacTests" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="710" height="252"/>
<clipView key="contentView" focusRingType="none" copiesOnScroll="NO" id="Jy3-yS-sE4" userLabel="Memory Clip View">
<clipView key="contentView" focusRingType="none" drawsBackground="NO" copiesOnScroll="NO" id="Jy3-yS-sE4" userLabel="Memory Clip View">
<rect key="frame" x="1" y="1" width="708" height="250"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
@ -794,31 +844,48 @@
</subviews>
<constraints>
<constraint firstItem="Mgy-Qm-MWH" firstAttribute="leading" secondItem="lw3-np-MbY" secondAttribute="leading" id="3mY-nW-zNp"/>
<constraint firstItem="VVf-7D-pjV" firstAttribute="leading" secondItem="4pW-7e-eaj" secondAttribute="leading" id="4xV-KN-9i2"/>
<constraint firstItem="4pW-7e-eaj" firstAttribute="trailing" secondItem="dzC-sA-aHa" secondAttribute="trailing" id="77M-hm-zZ0"/>
<constraint firstAttribute="bottom" secondItem="jY7-ZU-I4z" secondAttribute="bottom" constant="10" identifier="Debugger View.Bottom - Disassembler.Bottom" id="8jC-7G-Ofh"/>
<constraint firstItem="uQh-oP-EwQ" firstAttribute="trailing" secondItem="lw3-np-MbY" secondAttribute="trailing" id="8q5-Sd-fZ8"/>
<constraint firstItem="TWP-wN-aCW" firstAttribute="top" secondItem="4pW-7e-eaj" secondAttribute="top" id="BfY-7O-aDg"/>
<constraint firstItem="kXX-RT-0Bb" firstAttribute="top" secondItem="4pW-7e-eaj" secondAttribute="top" constant="46" id="BsB-C0-dQ9"/>
<constraint firstItem="4pW-7e-eaj" firstAttribute="leading" secondItem="dzC-sA-aHa" secondAttribute="leading" id="C5j-QY-Wbm"/>
<constraint firstItem="TWP-wN-aCW" firstAttribute="trailing" secondItem="4pW-7e-eaj" secondAttribute="trailing" id="E1c-lX-VRE"/>
<constraint firstItem="KwD-2D-fNp" firstAttribute="leading" secondItem="lw3-np-MbY" secondAttribute="leading" id="HHi-Vl-G7O"/>
<constraint firstItem="uQh-oP-EwQ" firstAttribute="bottom" secondItem="lw3-np-MbY" secondAttribute="bottom" id="JnX-xB-eor"/>
<constraint firstItem="KwD-2D-fNp" firstAttribute="top" secondItem="lw3-np-MbY" secondAttribute="top" id="KjG-Xt-w0g"/>
<constraint firstItem="KwD-2D-fNp" firstAttribute="trailing" secondItem="lw3-np-MbY" secondAttribute="trailing" id="LYb-x4-eZt"/>
<constraint firstItem="f2z-vp-zIf" firstAttribute="leading" secondItem="4pW-7e-eaj" secondAttribute="leading" constant="118" id="Nz3-Lb-ESq"/>
<constraint firstItem="JUf-qx-iuW" firstAttribute="top" secondItem="Myj-W6-YvY" secondAttribute="top" constant="6" identifier="Debug Side Panel.Top - Debugger View.Top" id="OaJ-lc-b0j"/>
<constraint firstItem="Mgy-Qm-MWH" firstAttribute="trailing" secondItem="lw3-np-MbY" secondAttribute="trailing" id="PdI-W2-UUw"/>
<constraint firstItem="Mgy-Qm-MWH" firstAttribute="top" secondItem="lw3-np-MbY" secondAttribute="top" constant="46" id="R2c-sP-wWP"/>
<constraint firstItem="kXX-RT-0Bb" firstAttribute="leading" secondItem="4pW-7e-eaj" secondAttribute="leading" constant="116" id="Xh5-tR-rGb"/>
<constraint firstAttribute="bottom" secondItem="JUf-qx-iuW" secondAttribute="bottom" constant="10" identifier="Debugger View.Bottom - Sebug Side Panel.Bottom" id="Y4T-sR-Hag"/>
<constraint firstItem="uQh-oP-EwQ" firstAttribute="top" secondItem="lw3-np-MbY" secondAttribute="top" id="YuC-6J-6RS"/>
<constraint firstItem="f2z-vp-zIf" firstAttribute="top" secondItem="4pW-7e-eaj" secondAttribute="top" id="bl4-gs-Kc0"/>
<constraint firstItem="jY7-ZU-I4z" firstAttribute="top" secondItem="Myj-W6-YvY" secondAttribute="top" constant="6" identifier="Disassembler.Top - Debugger View.Top" id="cCh-QQ-pyz"/>
<constraint firstItem="4pW-7e-eaj" firstAttribute="bottom" secondItem="dzC-sA-aHa" secondAttribute="bottom" id="e6d-iV-Mjx"/>
<constraint firstItem="lw3-np-MbY" firstAttribute="bottom" secondItem="Pcn-4j-EEM" secondAttribute="bottom" id="e8j-dQ-6Dc"/>
<constraint firstItem="VVf-7D-pjV" firstAttribute="trailing" secondItem="4pW-7e-eaj" secondAttribute="trailing" id="epT-27-6q6"/>
<constraint firstItem="jY7-ZU-I4z" firstAttribute="leading" secondItem="Myj-W6-YvY" secondAttribute="leading" constant="8" identifier="Disassembler.Leading - Debugger View.Leading" id="gka-CA-9WG"/>
<constraint firstItem="TWP-wN-aCW" firstAttribute="bottom" secondItem="4pW-7e-eaj" secondAttribute="bottom" id="hJE-5H-00a"/>
<constraint firstAttribute="trailing" secondItem="JUf-qx-iuW" secondAttribute="trailing" constant="8" identifier="Debugger View.Trailing - Sebug Side Panel.Trailing" id="kwa-ri-Rtq"/>
<constraint firstItem="f2z-vp-zIf" firstAttribute="bottom" secondItem="4pW-7e-eaj" secondAttribute="bottom" id="kzN-TO-IcO"/>
<constraint firstItem="4pW-7e-eaj" firstAttribute="top" secondItem="dzC-sA-aHa" secondAttribute="top" id="nJg-Ah-5VS"/>
<constraint firstItem="lw3-np-MbY" firstAttribute="leading" secondItem="Pcn-4j-EEM" secondAttribute="leading" constant="4" id="rCO-iJ-DOu"/>
<constraint firstItem="uQh-oP-EwQ" firstAttribute="leading" secondItem="lw3-np-MbY" secondAttribute="leading" id="uRt-lv-mfI"/>
<constraint firstItem="TWP-wN-aCW" firstAttribute="leading" secondItem="4pW-7e-eaj" secondAttribute="leading" id="wIu-cL-8NA"/>
<constraint firstItem="lw3-np-MbY" firstAttribute="trailing" secondItem="Pcn-4j-EEM" secondAttribute="trailing" id="x4p-qF-iKb"/>
<constraint firstItem="lw3-np-MbY" firstAttribute="top" secondItem="Pcn-4j-EEM" secondAttribute="top" constant="5" id="yYL-a5-8xr"/>
<constraint firstItem="VVf-7D-pjV" firstAttribute="top" secondItem="4pW-7e-eaj" secondAttribute="top" constant="48" id="yaq-3g-r5g"/>
</constraints>
</view>
<connections>
<outlet property="CPU_Display" destination="Wrs-Qt-Kmd" id="SUW-Lc-Zv4"/>
<outlet property="DisassAddressField" destination="bwO-w1-hlg" id="tBp-cc-OcF"/>
<outlet property="DisassAddressPC" destination="zov-nz-fce" id="fhe-fN-yPd"/>
<outlet property="DisassBackground" destination="uQh-oP-EwQ" id="Rtn-R5-VDA"/>
<outlet property="DisassCursor" destination="Mgy-Qm-MWH" id="6Pn-wq-woY"/>
<outlet property="DisassCursorContraint" destination="R2c-sP-wWP" id="7vt-Dc-wGf"/>
<outlet property="DisassHighlighter" destination="KwD-2D-fNp" id="bTl-R3-0bK"/>
@ -837,7 +904,7 @@
</scene>
</scenes>
<resources>
<image name="Debugger" width="128" height="128"/>
<image name="Debugger" width="32" height="32"/>
<image name="NSActionTemplate" width="14" height="14"/>
<image name="NSStatusNone" width="16" height="16"/>
<image name="NSStatusPartiallyAvailable" width="16" height="16"/>

View File

@ -1833,8 +1833,8 @@ Gw
</subviews>
</clipView>
<constraints>
<constraint firstAttribute="height" priority="100" constant="768" identifier="Test Display Scroller.Height" id="gJW-J5-XwT"/>
<constraint firstAttribute="width" priority="100" constant="1130" identifier="Test Display Scroller.Width" id="mjo-jE-tPG"/>
<constraint firstAttribute="height" priority="1" constant="768" identifier="Test Display Scroller.Height" id="gJW-J5-XwT"/>
<constraint firstAttribute="width" priority="1" constant="1130" identifier="Test Display Scroller.Width" id="mjo-jE-tPG"/>
</constraints>
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="nV1-lT-ewY">
<rect key="frame" x="-100" y="-100" width="225" height="15"/>
@ -2368,6 +2368,7 @@ Gw
<connections>
<outlet property="scanlinesView" destination="dGn-a4-c1t" id="eqJ-YB-9cU"/>
<outlet property="textDisplay" destination="ccC-Wu-3za" id="PB1-X7-azr"/>
<outlet property="textDisplayScroller" destination="ss1-M1-nGn" id="q4m-aP-Io6"/>
</connections>
</view>
<connections>
@ -2387,6 +2388,7 @@ Gw
<outlet property="leadingEdgeLabel" destination="aIi-wV-21w" id="fbe-gk-pI0"/>
<outlet property="ledingInitEdgeLabel" destination="Eaz-eQ-aTu" id="jsG-f0-dad"/>
<outlet property="lores" destination="Gqh-qw-fjy" id="vOE-5m-Jfi"/>
<outlet property="monitorView" destination="m2S-Jp-Qdl" id="YvI-gz-pgi"/>
<outlet property="scanLines" destination="dGn-a4-c1t" id="3Xy-Ku-95P"/>
<outlet property="soundGapLabel" destination="yIR-MN-Hdl" id="aRe-Mw-oH1"/>
<outlet property="soundGapSlider" destination="64O-qO-cQV" id="2dt-yL-0Pq"/>
@ -2410,7 +2412,7 @@ Gw
<image name="Chip" width="32" height="32"/>
<image name="Color" width="32" height="32"/>
<image name="Copy" width="32" height="32"/>
<image name="Debugger" width="128" height="128"/>
<image name="Debugger" width="32" height="32"/>
<image name="Green" width="32" height="32"/>
<image name="Joystick" width="32" height="32"/>
<image name="NSActionTemplate" width="14" height="14"/>

View File

@ -39,6 +39,7 @@ class DebuggerViewController: NSViewController {
@IBOutlet weak var DisassHightlighterContriant: NSLayoutConstraint!
@IBOutlet weak var DisassCursor: NSTextField!
@IBOutlet weak var DisassCursorContraint: NSLayoutConstraint!
@IBOutlet weak var DisassBackground: NSTextField!
let textFont : NSFont = NSFont(name: "Print Char 21", size: 10.0)!
@ -531,11 +532,24 @@ N V - B D I Z C
}
}
let normalBackground = NSColor(red: 38/255, green: 38/255, blue: 38/255, alpha: 1)
let selectedBackground = NSColor(red: 38/255, green: 38/255, blue: 64/255, alpha: 1.0)
func unselectViews() {
DisassBackground.backgroundColor = normalBackground
}
func selectView(view: NSTextView) {
unselectViews()
view.backgroundColor = normalBackground
}
let leftSideSize = CGFloat(30)
// select disassembly line
override func mouseDown(with event: NSEvent) {
unselectViews()
let location = convertMouseCoordinates(scrollView: Disass_Scroll, display: Disass_Display, mouseLocation: event.locationInWindow)
if location.x < leftSideSize {

View File

@ -8,80 +8,16 @@
import Cocoa
class DisassView: NSTextView {
override var acceptsFirstResponder: Bool {
get {
return true
}
}
var trackingArea: NSTrackingArea?
func debugDisplayContraints() {
print( "debugDisplayContraints ----------------------------------" )
if let view = window?.contentView {
for constraint in view.constraints {
print( "debugDisplayContraints:", constraint.identifier ?? "{Constaint has no identifier}", constraint.constant )
}
}
}
/// Install tracking area if window is set, remove previous one if needed.
func installTrackingArea() {
guard let window = window else { return }
window.acceptsMouseMovedEvents = true
if trackingArea != nil { removeTrackingArea(trackingArea!) }
let trackingOptions : NSTrackingArea.Options = [.activeAlways, .mouseEnteredAndExited, .mouseMoved]
trackingArea = NSTrackingArea(rect: bounds,
options: trackingOptions,
owner: self, userInfo: nil)
self.addTrackingArea(trackingArea!)
}
// Called when layout is modified
override func updateTrackingAreas() {
super.updateTrackingAreas()
installTrackingArea()
}
override func acceptsFirstMouse(for event: NSEvent?) -> Bool {
return true
}
class DisassView: DisplayView {
override func mouseDown(with event: NSEvent) {
// print(#function + "DisassView")
DebuggerViewController.shared?.mouseDown(with: event)
// print(#function + "DisassView")
if let dbgVC = DebuggerViewController.shared {
dbgVC.mouseDown(with: event)
dbgVC.DisassBackground.backgroundColor = dbgVC.selectedBackground
// debugDisplayContraints()
}
}
// override func mouseUp(with event: NSEvent) {
// // print(#function + "DisassView")
// DebuggerViewController.shared?.mouseUp(with: event)
// }
override func rightMouseDown(with event: NSEvent) {
// print(#function + "DisassView")
DebuggerViewController.shared?.rightMouseDown(with: event)
}
// override func rightMouseUp(with event: NSEvent) {
// // print(#function + "DisassView")
// DebuggerViewController.shared?.rightMouseUp(with: event)
// }
// override func otherMouseDown(with event: NSEvent) {
// // print(#function + "DisassView")
// DebuggerViewController.shared?.otherMouseDown(with: event)
// }
//
// override func otherMouseUp(with event: NSEvent) {
// // print(#function + "DisassView")
// DebuggerViewController.shared?.otherMouseUp(with: event)
// }
}

View File

@ -10,11 +10,11 @@ import Cocoa
class DisplayView: NSTextView {
// override var acceptsFirstResponder: Bool {
// get {
// return true
// }
// }
override var acceptsFirstResponder: Bool {
get {
return true
}
}
var trackingArea: NSTrackingArea?
@ -53,142 +53,30 @@ class DisplayView: NSTextView {
override func mouseDown(with event: NSEvent) {
// print(#function + "DisplayView")
ViewController.shared?.mouseDown(with: event)
// debugDisplayContraints()
}
override func mouseUp(with event: NSEvent) {
// print(#function + "DisplayView")
ViewController.shared?.mouseUp(with: event)
if let dbgVC = DebuggerViewController.shared {
dbgVC.mouseDown(with: event)
}
}
override func rightMouseDown(with event: NSEvent) {
// print(#function + "DisplayView")
ViewController.shared?.rightMouseDown(with: event)
}
override func rightMouseUp(with event: NSEvent) {
// print(#function + "DisplayView")
ViewController.shared?.rightMouseUp(with: event)
}
override func otherMouseDown(with event: NSEvent) {
// print(#function + "DisplayView")
ViewController.shared?.otherMouseDown(with: event)
}
override func otherMouseUp(with event: NSEvent) {
// print(#function + "DisplayView")
ViewController.shared?.otherMouseUp(with: event)
DebuggerViewController.shared?.rightMouseDown(with: event)
}
// static let overscan_h = CGFloat(25)
// static let textViewBounds = NSSize(width: 280 * 4 + overscan_h, height: 192 * 4)
// let textDisplay_frameSize = NSSize(width: 1120 + overscan_h, height: 768)
//
// var textDisplay_width_diff : CGFloat?
// var textDisplay_height_diff : CGFloat?
//
// var locked = false
//
// func adjustTextDisplaySize() {
// var textFrameSize = frame.size
//
// if locked
// || frame.size.width > 8192
// || frame.size.width < 200
// || frame.size.height > 8192
// || frame.size.height < 200 {
// return
// }
//
// locked = true
//
// if textDisplay_width_diff == nil {
// textDisplay_width_diff = textFrameSize.width - textDisplay_frameSize.width
// textDisplay_height_diff = textFrameSize.height - textDisplay_frameSize.height
// }
//
// textFrameSize.width -= textDisplay_width_diff!
// textFrameSize.height -= textDisplay_height_diff!
//
//// print( String(
//// format: "DisplayView fw:%.2f fh:%.2f bw:%.2f bh:%.2f to fw:%.2f fh:%.2f bw:%.2f bh:%.2f",
//// frame.size.width,
//// frame.size.height,
//// textFrameSize.width,
//// textFrameSize.height,
//// bounds.size.width,
//// bounds.size.height,
//// MonitorView.textViewBounds.width,
//// MonitorView.textViewBounds.height
//// ))
//
// // BUGFIX: I am not sure why but if I do not adjust the frame and bounds size
// // couple of times, Cocoa miscalculates them
//// for _ in 0...15 {
//// self.setFrameSize(textFrameSize)
// self.setFrameSize(textDisplay_frameSize)
// self.setBoundsSize(MonitorView.textViewBounds)
//// }
//
// locked = false
// override func rightMouseUp(with event: NSEvent) {
// // print(#function + "DisplayView")
// DebuggerViewController.shared?.rightMouseUp(with: event)
// }
// override func viewDidEndLiveResize() {
// NSLog("DisplayView:viewDidEndLiveResize")
// print( String(
// format: "DisplayView fw:%.2f fh:%.2f bw:%.2f bh:%.2f",
// frame.size.width,
// frame.size.height,
// bounds.size.width,
// bounds.size.height
// ))
// override func otherMouseDown(with event: NSEvent) {
// // print(#function + "DisplayView")
// DebuggerViewController.shared?.otherMouseDown(with: event)
// }
//
// @objc func frameDidChange(notification: NSNotification) {
// NSLog("DisplayView:frameDidChange")
//// adjustTextDisplaySize()
// print( String(
// format: "DisplayView fw:%.2f fh:%.2f bw:%.2f bh:%.2f",
// frame.size.width,
// frame.size.height,
// bounds.size.width,
// bounds.size.height
// ))
// }
// @objc func globalFrameDidChange(notification: NSNotification) {
// NSLog("DisplayView:globalFrameDidChange")
// print( String(
// format: "DisplayView fw:%.2f fh:%.2f bw:%.2f bh:%.2f",
// self.frame.size.width,
// self.frame.size.height,
// self.bounds.size.width,
// self.bounds.size.height
// ))
// }
// @objc func boundsDidChange(notification: NSNotification) {
// NSLog("DisplayView:boundsDidChange")
// print( String(
// format: "DisplayView fw:%.2f fh:%.2f bw:%.2f bh:%.2f",
// self.frame.size.width,
// self.frame.size.height,
// self.bounds.size.width,
// self.bounds.size.height
// ))
// }
// required init?(coder: NSCoder) {
// super.init(coder: coder)
//
// postsFrameChangedNotifications = true
// NotificationCenter.default.addObserver(self, selector: #selector(frameDidChange), name: NSView.frameDidChangeNotification, object: self)
// NotificationCenter.default.addObserver(self, selector: #selector(globalFrameDidChange), name: NSView.globalFrameDidChangeNotification, object: self)
// NotificationCenter.default.addObserver(self, selector: #selector(boundsDidChange), name: NSView.boundsDidChangeNotification, object: self)
// override func otherMouseUp(with event: NSEvent) {
// // print(#function + "DisplayView")
// DebuggerViewController.shared?.otherMouseUp(with: event)
// }
}

View File

@ -25,6 +25,7 @@ import Cocoa
class MonitorView: NSView {
@IBOutlet weak var textDisplayScroller: DisplayScrollView!
@IBOutlet var textDisplay: DisplayView!
@IBOutlet weak var scanlinesView: NSImageView!
@ -43,6 +44,8 @@ class MonitorView: NSView {
}
func adjustTextDisplaySize() {
textDisplayScroller.updateConstraints()
var textFrameSize = frame.size
if textDisplay_width_diff == nil {
@ -92,7 +95,10 @@ class MonitorView: NSView {
// BUGFIX: I am not sure why but if I do not adjust the frame and bounds size
// couple of times, Cocoa miscalculates them
if let textDisplay = textDisplay {
for _ in 0...15 {
textDisplay.setFrameSize(textFrameSize)
textDisplay.setBoundsSize(MonitorView.textViewBounds)
DispatchQueue.main.async() {
// for _ in 0...15 {
textDisplay.setFrameSize(textFrameSize)
// textDisplay.setBoundsSize(MonitorView.textViewBounds)
// textDisplay.setFrameSize(scanlinesView.frame.size)

View File

@ -81,6 +81,7 @@ class ViewController: NSViewController {
var displayLink: CVDisplayLink?
@IBOutlet var monitorView: MonitorView!
@IBOutlet weak var textDisplayScroller: NSScrollView!
@IBOutlet var textDisplay: NSTextView!
@IBOutlet weak var speedometer: NSTextFieldCell!
@ -1732,6 +1733,10 @@ class ViewController: NSViewController {
// self.displayField.window?.makeFirstResponder(self)
textDisplay.setSelectedRange(NSRange())
textDisplay.window?.makeFirstResponder(self)
DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) {
self.monitorView.adjustTextDisplaySize()
}
}