diff --git a/Cocoa/GBPreferencesWindow.m b/Cocoa/GBPreferencesWindow.m index 2b6b070..a9c2c91 100644 --- 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 @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 index 1d695b1..953aa3c 100644 --- 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 index 74f6444..b66186b 100644 --- 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 index 464de27..57a4755 100644 --- a/Cocoa/Preferences.xib +++ b/Cocoa/Preferences.xib @@ -177,7 +177,7 @@ - + @@ -329,6 +329,17 @@ + @@ -566,7 +577,7 @@ - + @@ -574,7 +585,7 @@ - + @@ -612,15 +623,26 @@ - + + - +