Skip to content

Commit

Permalink
Associate panels with their document windows
Browse files Browse the repository at this point in the history
  • Loading branch information
LIJI32 committed Aug 29, 2024
1 parent 8dda5ee commit d4c715b
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Cocoa/CheatSearch.xib
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<window title="Cheat Search" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="QvC-M9-y7g" customClass="NSPanel">
<window title="Cheat Search" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="QvC-M9-y7g" customClass="GBPanel">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<rect key="contentRect" x="196" y="240" width="480" height="372"/>
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1415"/>
Expand Down
27 changes: 21 additions & 6 deletions Cocoa/Document.xib
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
</connections>
<point key="canvasLocation" x="293" y="347"/>
</window>
<window title="Debug Console" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" restorable="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="21F-Ah-yHX" customClass="NSPanel">
<window title="Debug Console" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" restorable="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="21F-Ah-yHX" customClass="GBPanel">
<windowStyleMask key="styleMask" titled="YES" closable="YES" resizable="YES" utility="YES" HUD="YES"/>
<windowCollectionBehavior key="collectionBehavior" fullScreenAuxiliary="YES"/>
<rect key="contentRect" x="0.0" y="0.0" width="921" height="400"/>
Expand Down Expand Up @@ -318,9 +318,12 @@
</splitView>
</subviews>
</view>
<connections>
<outlet property="ownerWindow" destination="xOd-HO-29H" id="beo-JZ-Ekb"/>
</connections>
<point key="canvasLocation" x="347.5" y="-29"/>
</window>
<window title="Memory" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" restorable="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" toolbarStyle="expanded" id="mRm-dL-mCj" customClass="NSPanel">
<window title="Memory" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" restorable="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" toolbarStyle="expanded" id="mRm-dL-mCj" customClass="GBPanel">
<windowStyleMask key="styleMask" titled="YES" closable="YES" resizable="YES"/>
<windowCollectionBehavior key="collectionBehavior" fullScreenAuxiliary="YES"/>
<rect key="contentRect" x="0.0" y="0.0" width="528" height="320"/>
Expand Down Expand Up @@ -400,10 +403,13 @@
<toolbarItem reference="rLO-D7-zRG"/>
</defaultToolbarItems>
</toolbar>
<connections>
<outlet property="ownerWindow" destination="xOd-HO-29H" id="wCE-dT-kGv"/>
</connections>
<point key="canvasLocation" x="-185" y="61"/>
</window>
<menuItem title="Cartridge RAM" id="ylM-ah-PNQ"/>
<window title="VRAM Viewer" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" restorable="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" toolbarStyle="expanded" id="mbr-db-iZh" customClass="NSPanel">
<window title="VRAM Viewer" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" restorable="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" toolbarStyle="expanded" id="mbr-db-iZh" customClass="GBPanel">
<windowStyleMask key="styleMask" titled="YES" closable="YES"/>
<windowCollectionBehavior key="collectionBehavior" fullScreenAuxiliary="YES"/>
<rect key="contentRect" x="0.0" y="0.0" width="512" height="432"/>
Expand Down Expand Up @@ -667,9 +673,12 @@
</defaultToolbarItems>
</toolbar>
<contentBorderThickness minY="24"/>
<connections>
<outlet property="ownerWindow" destination="xOd-HO-29H" id="hkb-AH-4fo"/>
</connections>
<point key="canvasLocation" x="182" y="760"/>
</window>
<window title="Printer Feed" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" restorable="NO" hidesOnDeactivate="YES" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="NdE-0B-WCf" customClass="NSPanel">
<window title="Printer Feed" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" restorable="NO" hidesOnDeactivate="YES" releasedWhenClosed="NO" visibleAtLaunch="NO" animationBehavior="default" id="NdE-0B-WCf" customClass="GBPanel">
<windowStyleMask key="styleMask" titled="YES" closable="YES" resizable="YES"/>
<rect key="contentRect" x="0.0" y="0.0" width="320" height="288"/>
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1415"/>
Expand Down Expand Up @@ -717,9 +726,12 @@
<toolbarItem reference="L6N-6G-UWl"/>
</defaultToolbarItems>
</toolbar>
<connections>
<outlet property="ownerWindow" destination="xOd-HO-29H" id="8Lk-t1-HNi"/>
</connections>
<point key="canvasLocation" x="-159" y="356"/>
</window>
<window title="Cheats" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" restorable="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" frameAutosaveName="" animationBehavior="default" id="4Yb-Np-JrF" customClass="NSPanel">
<window title="Cheats" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" restorable="NO" releasedWhenClosed="NO" visibleAtLaunch="NO" frameAutosaveName="" animationBehavior="default" id="4Yb-Np-JrF" customClass="GBPanel">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
<rect key="contentRect" x="0.0" y="0.0" width="604" height="400"/>
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1415"/>
Expand Down Expand Up @@ -798,7 +810,7 @@
</subviews>
</clipView>
<scroller key="horizontalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" horizontal="YES" id="3Hg-LL-VqH">
<rect key="frame" x="1" y="119" width="223" height="15"/>
<rect key="frame" x="1" y="242" width="604" height="16"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
<scroller key="verticalScroller" hidden="YES" wantsLayer="YES" verticalHuggingPriority="750" doubleValue="1" horizontal="NO" id="zET-KH-qF4">
Expand Down Expand Up @@ -955,6 +967,9 @@
</box>
</subviews>
</view>
<connections>
<outlet property="ownerWindow" destination="xOd-HO-29H" id="ZQr-6h-iby"/>
</connections>
<point key="canvasLocation" x="210" y="-399"/>
</window>
<customObject id="v7q-gT-jHT" customClass="GBCheatWindowController">
Expand Down
3 changes: 3 additions & 0 deletions Cocoa/GBCheatSearchController.m
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#import "GBCheatSearchController.h"
#import "GBWarningPopover.h"
#import "GBCheatWindowController.h"
#import "GBPanel.h"

@interface GBCheatSearchController() <NSTableViewDelegate, NSTableViewDataSource>
@property IBOutlet NSPopUpButton *dataTypeButton;
Expand All @@ -16,6 +17,7 @@ @implementation GBCheatSearchController
__weak Document *_document;
size_t _resultCount;
GB_cheat_search_result_t *_results;
GBPanel *_window;
}

+ (instancetype)controllerWithDocument:(Document *)document
Expand All @@ -26,6 +28,7 @@ + (instancetype)controllerWithDocument:(Document *)document
[[NSBundle mainBundle] loadNibNamed:@"CheatSearch" owner:ret topLevelObjects:&objects];
ret->_resultsLabel.stringValue = @"";
ret->_resultsLabel.cell.backgroundStyle = NSBackgroundStyleRaised;
ret->_window.ownerWindow = document.mainWindow;
return ret;
}

Expand Down
5 changes: 5 additions & 0 deletions Cocoa/GBPanel.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#import <Cocoa/Cocoa.h>

@interface GBPanel : NSPanel
@property (weak) IBOutlet NSWindow *ownerWindow;
@end
9 changes: 9 additions & 0 deletions Cocoa/GBPanel.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#import "GBPanel.h"

@implementation GBPanel
- (void)becomeKeyWindow
{
[_ownerWindow makeMainWindow];
[super becomeKeyWindow];
}
@end

0 comments on commit d4c715b

Please sign in to comment.