From bb6b23926605dfb02e3ab2e448b838828dccc84e Mon Sep 17 00:00:00 2001 From: tudnai Date: Fri, 9 Dec 2022 13:33:51 -0800 Subject: [PATCH] Disass View Select / Deselect --- A2Mac.xcodeproj/project.pbxproj | 2 +- A2Mac/Base.lproj/Debugger.storyboard | 7 ++++--- A2Mac/DebuggerViewController.swift | 14 ++++++++++++++ A2Mac/DisassView.swift | 6 ++++-- 4 files changed, 23 insertions(+), 6 deletions(-) diff --git a/A2Mac.xcodeproj/project.pbxproj b/A2Mac.xcodeproj/project.pbxproj index 124c632..8a0b9b7 100644 --- a/A2Mac.xcodeproj/project.pbxproj +++ b/A2Mac.xcodeproj/project.pbxproj @@ -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 */, diff --git a/A2Mac/Base.lproj/Debugger.storyboard b/A2Mac/Base.lproj/Debugger.storyboard index bb19ad2..69325eb 100644 --- a/A2Mac/Base.lproj/Debugger.storyboard +++ b/A2Mac/Base.lproj/Debugger.storyboard @@ -378,7 +378,7 @@ - + @@ -436,7 +436,7 @@ - + @@ -558,7 +558,7 @@ - + @@ -819,6 +819,7 @@ + diff --git a/A2Mac/DebuggerViewController.swift b/A2Mac/DebuggerViewController.swift index 0042b99..2e6f7c7 100644 --- a/A2Mac/DebuggerViewController.swift +++ b/A2Mac/DebuggerViewController.swift @@ -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 { diff --git a/A2Mac/DisassView.swift b/A2Mac/DisassView.swift index 7b0e140..ebdd0e8 100644 --- a/A2Mac/DisassView.swift +++ b/A2Mac/DisassView.swift @@ -53,9 +53,11 @@ class DisassView: NSTextView { override func mouseDown(with event: NSEvent) { // print(#function + "DisassView") - DebuggerViewController.shared?.mouseDown(with: event) - + if let dbgVC = DebuggerViewController.shared { + dbgVC.mouseDown(with: event) + dbgVC.DisassBackground.backgroundColor = dbgVC.selectedBackground // debugDisplayContraints() + } } // override func mouseUp(with event: NSEvent) {