SameBoy | Accurate GB/GBC emulator |
| download: https://git.y1.nz/archives/sameboy.tar.gz | |
| README | Files | Log | Refs | LICENSE |
commit c2410a4ffc41388fd71aee6d6e308ff269ce9829 parent 5cffdbcd278b0839b5f1369092c606462ff3de75 Author: Lior Halphon <LIJI32@gmail.com> Date: Sat, 22 Aug 2020 03:27:57 +0300 Update UI for Big Sur Diffstat:
| A | Cocoa/BigSurToolbar.h | 30 | ++++++++++++++++++++++++++++++ |
| M | Cocoa/Document.m | 12 | ++++++++++++ |
| M | Cocoa/Document.xib | 10 | ++++------ |
| M | Cocoa/GBPreferencesWindow.m | 6 | ++++++ |
4 files changed, 52 insertions(+), 6 deletions(-)
diff --git a/Cocoa/BigSurToolbar.h b/Cocoa/BigSurToolbar.h @@ -0,0 +1,30 @@ +#import <Cocoa/Cocoa.h> +#ifndef BigSurToolbar_h +#define BigSurToolbar_h + +/* Backport the toolbarStyle property to allow compilation with older SDKs*/ +#ifndef __MAC_10_16 +typedef NS_ENUM(NSInteger, NSWindowToolbarStyle) { + // The default value. The style will be determined by the window's given configuration + NSWindowToolbarStyleAutomatic, + // The toolbar will appear below the window title + NSWindowToolbarStyleExpanded, + // The toolbar will appear below the window title and the items in the toolbar will attempt to have equal widths when possible + NSWindowToolbarStylePreference, + // The window title will appear inline with the toolbar when visible + NSWindowToolbarStyleUnified, + // Same as NSWindowToolbarStyleUnified, but with reduced margins in the toolbar allowing more focus to be on the contents of the window + NSWindowToolbarStyleUnifiedCompact +} API_AVAILABLE(macos(11.0)); + +@interface NSWindow (toolbarStyle) +@property NSWindowToolbarStyle toolbarStyle API_AVAILABLE(macos(11.0)); +@end + +@interface NSImage (SFSymbols) ++ (instancetype)imageWithSystemSymbolName:(NSString *)symbolName accessibilityDescription:(NSString *)description API_AVAILABLE(macos(11.0)); +@end + +#endif + +#endif diff --git a/Cocoa/Document.m b/Cocoa/Document.m @@ -9,6 +9,7 @@ #include "GBWarningPopover.h" #include "GBCheatWindowController.h" #include "GBTerminalTextFieldCell.h" +#include "BigSurToolbar.h" /* Todo: The general Objective-C coding style conflicts with SameBoy's. This file needs a cleanup. */ /* Todo: Split into category files! This is so messy!!! */ @@ -569,6 +570,17 @@ static void rumbleCallback(GB_gameboy_t *gb, double amp) self.consoleWindow.title = [NSString stringWithFormat:@"Debug Console – %@", [[self.fileURL path] lastPathComponent]]; self.debuggerSplitView.dividerColor = [NSColor clearColor]; + if (@available(macOS 11.0, *)) { + self.memoryWindow.toolbarStyle = NSWindowToolbarStyleExpanded; + self.printerFeedWindow.toolbarStyle = NSWindowToolbarStyleUnifiedCompact; + [self.printerFeedWindow.toolbar removeItemAtIndex:1]; + self.printerFeedWindow.toolbar.items.firstObject.image = + [NSImage imageWithSystemSymbolName:@"square.and.arrow.down" + accessibilityDescription:@"Save"]; + self.printerFeedWindow.toolbar.items.lastObject.image = + [NSImage imageWithSystemSymbolName:@"printer" + accessibilityDescription:@"Print"]; + } [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateHighpassFilter) diff --git a/Cocoa/Document.xib b/Cocoa/Document.xib @@ -115,7 +115,7 @@ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <clipView key="contentView" ambiguous="YES" drawsBackground="NO" copiesOnScroll="NO" id="EQe-Ad-L7S"> <rect key="frame" x="0.0" y="0.0" width="591" height="376"/> - <autoresizingMask key="autoresizingMask"/> + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <subviews> <textView ambiguous="YES" editable="NO" drawsBackground="NO" importsGraphics="NO" richText="NO" verticallyResizable="YES" baseWritingDirection="leftToRight" findStyle="bar" allowsNonContiguousLayout="YES" id="doS-dM-hnl"> <rect key="frame" x="0.0" y="0.0" width="591" height="376"/> @@ -152,7 +152,7 @@ <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/> <clipView key="contentView" ambiguous="YES" drawsBackground="NO" copiesOnScroll="NO" id="YHx-TM-zIC"> <rect key="frame" x="0.0" y="0.0" width="329" height="47"/> - <autoresizingMask key="autoresizingMask"/> + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <subviews> <textView ambiguous="YES" drawsBackground="NO" importsGraphics="NO" richText="NO" verticallyResizable="YES" allowsCharacterPickerTouchBarItem="NO" allowsUndo="YES" allowsNonContiguousLayout="YES" textCompletion="NO" spellingCorrection="YES" id="w0g-eK-jM4"> <rect key="frame" x="0.0" y="0.0" width="329" height="47"/> @@ -186,7 +186,7 @@ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <clipView key="contentView" ambiguous="YES" drawsBackground="NO" copiesOnScroll="NO" id="Cs9-3x-ATg"> <rect key="frame" x="0.0" y="0.0" width="329" height="328"/> - <autoresizingMask key="autoresizingMask"/> + <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <subviews> <textView ambiguous="YES" editable="NO" drawsBackground="NO" importsGraphics="NO" richText="NO" verticallyResizable="YES" baseWritingDirection="leftToRight" findStyle="bar" allowsNonContiguousLayout="YES" spellingCorrection="YES" id="JgV-7E-iwp"> <rect key="frame" x="0.0" y="0.0" width="329" height="328"/> @@ -800,13 +800,11 @@ <toolbar key="toolbar" implicitIdentifier="1FF86A2B-6637-4EE6-A25A-7298D79AE84E" autosavesConfiguration="NO" allowsUserCustomization="NO" displayMode="iconAndLabel" sizeMode="regular" id="gH3-SH-7il"> <allowedToolbarItems> <toolbarItem implicitItemIdentifier="15EB8D49-8C6E-42F2-9F7F-F7D7A0BBDAAF" label="Save" paletteLabel="Save" tag="-1" image="NSFolder" id="CBz-1N-o0Q"> - <size key="minSize" width="32" height="32"/> - <size key="maxSize" width="32" height="32"/> <connections> <action selector="savePrinterFeed:" target="-2" id="Dm3-h0-ch4"/> </connections> </toolbarItem> - <toolbarItem implicitItemIdentifier="NSToolbarPrintItem" id="mtd-zS-DXa"/> + <toolbarItem implicitItemIdentifier="NSToolbarPrintItem" explicitItemIdentifier="Print" id="mtd-zS-DXa"/> <toolbarItem implicitItemIdentifier="NSToolbarSpaceItem" id="AoG-LH-J4b"/> <toolbarItem implicitItemIdentifier="NSToolbarFlexibleSpaceItem" id="Q0x-n5-Q2Y"/> </allowedToolbarItems> diff --git a/Cocoa/GBPreferencesWindow.m b/Cocoa/GBPreferencesWindow.m @@ -1,6 +1,7 @@ #import "GBPreferencesWindow.h" #import "NSString+StringForKey.h" #import "GBButtons.h" +#import "BigSurToolbar.h" #import <Carbon/Carbon.h> @implementation GBPreferencesWindow @@ -52,6 +53,11 @@ return filters; } +- (NSWindowToolbarStyle)toolbarStyle +{ + return NSWindowToolbarStylePreference; +} + - (void)close { joystick_configuration_state = -1;
This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.