SameBoy | Accurate GB/GBC emulator |
| download: https://git.y1.nz/archives/sameboy.tar.gz | |
| README | Files | Log | Refs | LICENSE |
commit 352f8d54f850e7726b3c9e9b4ef145c906d63b9c parent 3f7bcb9af2f24af561a6ba4b21a0ae354f074905 Author: Lior Halphon <LIJI32@gmail.com> Date: Sat, 30 Jul 2022 14:31:21 +0300 Add popover descriptions to the color correction and high-pass filter options Diffstat:
| M | Cocoa/GBPreferencesWindow.m | 33 | +++++++++++++++++++++++++++++++++ |
| M | Cocoa/GBWarningPopover.h | 1 | + |
| M | Cocoa/GBWarningPopover.m | 25 | +++++++++++++++++++++---- |
| M | Cocoa/Preferences.xib | 32 | +++++++++++++++++++++++++++----- |
4 files changed, 82 insertions(+), 9 deletions(-)
diff --git a/Cocoa/GBPreferencesWindow.m b/Cocoa/GBPreferencesWindow.m @@ -3,6 +3,7 @@ #import "GBButtons.h" #import "BigSurToolbar.h" #import "GBViewMetal.h" +#import "GBWarningPopover.h" #import <Carbon/Carbon.h> @implementation GBPreferencesWindow @@ -966,4 +967,36 @@ static inline NSString *keyEquivalentString(NSMenuItem *item) } } +- (IBAction)displayColorCorrectionHelp:(id)sender +{ + [GBWarningPopover popoverWithContents: + (NSString * const[]){ + [GB_COLOR_CORRECTION_DISABLED] = @"Colors are directly interpreted as sRGB, resulting in unbalanced colors and inaccurate hues.", + [GB_COLOR_CORRECTION_CORRECT_CURVES] = @"Colors have their brightness corrected, but hues remain unbalanced.", + [GB_COLOR_CORRECTION_MODERN_BALANCED] = @"Emulates a modern display. Blue contrast is moderately enhanced at the cost of slight hue inaccuracy.", + [GB_COLOR_CORRECTION_MODERN_BOOST_CONTRAST] = @"Like Modern – Balanced, but further boosts the contrast of greens and magentas that is lacking on the original hardware.", + [GB_COLOR_CORRECTION_REDUCE_CONTRAST] = @"Slightly reduce the contrast to better represent the tint and contrast of the original display.", + [GB_COLOR_CORRECTION_LOW_CONTRAST] = @"Harshly reduce the contrast to accurately represent the tint low constrast of the original display.", + [GB_COLOR_CORRECTION_MODERN_ACCURATE] = @"Emulates a modern display. Colors have their hues and brightness corrected.", + } [self.colorCorrectionPopupButton.selectedItem.tag] + title:self.colorCorrectionPopupButton.selectedItem.title + onView:sender + timeout:6 + preferredEdge:NSRectEdgeMaxX]; +} + +- (IBAction)displayHighPassHelp:(id)sender +{ + [GBWarningPopover popoverWithContents: + (NSString * const[]){ + [GB_HIGHPASS_OFF] = @"No high-pass filter will be applied. DC offset will be kept, pausing and resuming will trigger audio pops.", + [GB_HIGHPASS_ACCURATE] = @"An accurate high-pass filter will be applied, removing the DC offset while somewhat attenuating the bass.", + [GB_HIGHPASS_REMOVE_DC_OFFSET] = @"A high-pass filter will be applied to the DC offset itself, removing the DC offset while preserving the waveform.", + } [self.highpassFilterPopupButton.indexOfSelectedItem] + title:self.highpassFilterPopupButton.selectedItem.title + onView:sender + timeout:6 + preferredEdge:NSRectEdgeMaxX]; +} + @end diff --git a/Cocoa/GBWarningPopover.h b/Cocoa/GBWarningPopover.h @@ -4,5 +4,6 @@ + (GBWarningPopover *) popoverWithContents:(NSString *)contents onView:(NSView *)view; + (GBWarningPopover *) popoverWithContents:(NSString *)contents onWindow:(NSWindow *)window; ++ (GBWarningPopover *) popoverWithContents:(NSString *)contents title:(NSString *)title onView:(NSView *)view timeout:(double)seconds preferredEdge:(NSRectEdge)preferredEdge; @end diff --git a/Cocoa/GBWarningPopover.m b/Cocoa/GBWarningPopover.m @@ -4,7 +4,7 @@ static GBWarningPopover *lastPopover; @implementation GBWarningPopover -+ (GBWarningPopover *) popoverWithContents:(NSString *)contents onView:(NSView *)view ++ (GBWarningPopover *) popoverWithContents:(NSString *)contents title:(NSString *)title onView:(NSView *)view timeout:(double)seconds preferredEdge:(NSRectEdge)preferredEdge { [lastPopover close]; lastPopover = [[self alloc] init]; @@ -13,7 +13,17 @@ static GBWarningPopover *lastPopover; [lastPopover setAnimates:true]; lastPopover.contentViewController = [[NSViewController alloc] initWithNibName:@"PopoverView" bundle:nil]; NSTextField *field = (NSTextField *)lastPopover.contentViewController.view; - [field setStringValue:contents]; + if (!title) { + [field setStringValue:contents]; + } + else { + NSMutableAttributedString *fullContents = [[NSMutableAttributedString alloc] initWithString:title + attributes:@{NSFontAttributeName: [NSFont boldSystemFontOfSize:[NSFont systemFontSize]]}]; + [fullContents appendAttributedString:[[NSAttributedString alloc] initWithString:[@"\n" stringByAppendingString:contents] + attributes:@{NSFontAttributeName: [NSFont systemFontOfSize:[NSFont systemFontSize]]}]]; + [field setAttributedStringValue:fullContents]; + + } NSSize textSize = [field.cell cellSizeForBounds:[field.cell drawingRectForBounds:NSMakeRect(0, 0, 240, CGFLOAT_MAX)]]; textSize.width = ceil(textSize.width) + 16; textSize.height = ceil(textSize.height) + 12; @@ -25,11 +35,13 @@ static GBWarningPopover *lastPopover; [lastPopover showRelativeToRect:view.bounds ofView:view - preferredEdge:NSMinYEdge]; + preferredEdge:preferredEdge]; NSRect frame = field.frame; frame.origin.x += 8; - frame.origin.y -= 6; + frame.origin.y += 6; + frame.size.width -= 16; + frame.size.height -= 12; field.frame = frame; @@ -38,6 +50,11 @@ static GBWarningPopover *lastPopover; return lastPopover; } ++ (GBWarningPopover *) popoverWithContents:(NSString *)contents onView:(NSView *)view +{ + return [self popoverWithContents:contents title:nil onView:view timeout:3.0 preferredEdge:NSMinYEdge]; +} + + (GBWarningPopover *)popoverWithContents:(NSString *)contents onWindow:(NSWindow *)window { return [self popoverWithContents:contents onView:window.contentView.superview.subviews.lastObject]; diff --git a/Cocoa/Preferences.xib b/Cocoa/Preferences.xib @@ -177,7 +177,7 @@ </textFieldCell> </textField> <popUpButton verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="VEz-N4-uP6"> - <rect key="frame" x="30" y="274" width="262" height="26"/> + <rect key="frame" x="30" y="274" width="229" height="26"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/> <popUpButtonCell key="cell" type="push" title="Disabled" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="D2J-wV-1vu" id="fNJ-Fi-yOm"> <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/> @@ -329,6 +329,17 @@ <action selector="changeOSDEnabled:" target="QvC-M9-y7g" id="xUx-iN-jl6"/> </connections> </button> + <button horizontalHuggingPriority="750" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="qCy-Se-vsG"> + <rect key="frame" x="266" y="273" width="25" height="25"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <buttonCell key="cell" type="help" bezelStyle="helpButton" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="tAH-Lp-v24"> + <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/> + <font key="font" metaFont="system"/> + </buttonCell> + <connections> + <action selector="displayColorCorrectionHelp:" target="QvC-M9-y7g" id="RIB-Qa-Fln"/> + </connections> + </button> </subviews> <point key="canvasLocation" x="-501" y="236.5"/> </customView> @@ -566,7 +577,7 @@ </textFieldCell> </textField> <slider verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="LNs-v1-Eki"> - <rect key="frame" x="30" y="130" width="261" height="28"/> + <rect key="frame" x="30" y="130" width="262" height="28"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/> <sliderCell key="cell" continuous="YES" state="on" alignment="left" maxValue="256" doubleValue="256" tickMarkPosition="below" sliderType="linear" id="Xvk-Vj-NHx"/> <connections> @@ -574,7 +585,7 @@ </connections> </slider> <popUpButton verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="T69-6N-dhT"> - <rect key="frame" x="30" y="74" width="262" height="26"/> + <rect key="frame" x="30" y="74" width="229" height="26"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/> <popUpButtonCell key="cell" type="push" title="Disabled (Keep DC offset)" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="Fgo-0S-zUG" id="om2-Bn-43B"> <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/> @@ -612,15 +623,26 @@ </textFieldCell> </textField> <slider verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="FpE-5i-j5L"> - <rect key="frame" x="30" y="18" width="261" height="28"/> + <rect key="frame" x="30" y="18" width="262" height="28"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/> <sliderCell key="cell" continuous="YES" state="on" alignment="left" maxValue="256" tickMarkPosition="below" sliderType="linear" id="Rbx-DU-xYf"/> <connections> <action selector="interferenceVolumeChanged:" target="QvC-M9-y7g" id="HFU-0q-hj1"/> </connections> </slider> + <button horizontalHuggingPriority="750" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="8Ub-0B-W2H"> + <rect key="frame" x="266" y="74" width="25" height="25"/> + <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/> + <buttonCell key="cell" type="help" bezelStyle="helpButton" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="OUS-fa-Mkv"> + <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/> + <font key="font" metaFont="system"/> + </buttonCell> + <connections> + <action selector="displayHighPassHelp:" target="QvC-M9-y7g" id="yvN-9e-S3J"/> + </connections> + </button> </subviews> - <point key="canvasLocation" x="-854" y="627"/> + <point key="canvasLocation" x="-854" y="626.5"/> </customView> <customView id="8TU-6J-NCg"> <rect key="frame" x="0.0" y="0.0" width="320" height="667"/>
This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.