Revision: 12901
http://sourceforge.net/p/skim-app/code/12901
Author: hofman
Date: 2022-05-08 21:36:01 +0000 (Sun, 08 May 2022)
Log Message:
-----------
Enum for different styles for top bar backgrounds
Modified Paths:
--------------
trunk/SKMainWindowController_FullScreen.m
trunk/SKSecondaryPDFView.m
trunk/SKSnapshotPDFView.m
trunk/SKTopBarView.h
trunk/SKTopBarView.m
Modified: trunk/SKMainWindowController_FullScreen.m
===================================================================
--- trunk/SKMainWindowController_FullScreen.m 2022-05-08 16:48:07 UTC (rev
12900)
+++ trunk/SKMainWindowController_FullScreen.m 2022-05-08 21:36:01 UTC (rev
12901)
@@ -113,7 +113,7 @@
sideWindow = [[SKSideWindow alloc]
initWithView:leftSideController.view];
if (mwcFlags.fullSizeContent) {
- [leftSideController.topBar applyPresentationBackground];
+ [leftSideController.topBar setStyle:SKTopBarStylePresentation];
[leftSideController setTopInset:0.0];
} else {
[leftSideController.topBar setDrawsBackground:NO];
@@ -132,7 +132,7 @@
if ([[sideWindow firstResponder]
isDescendantOf:leftSideController.view])
[sideWindow makeFirstResponder:nil];
if (mwcFlags.fullSizeContent) {
- [leftSideController.topBar applyDefaultBackground];
+ [leftSideController.topBar setStyle:SKTopBarStyleDefault];
[leftSideController setTopInset:titleBarHeight];
} else {
[leftSideController.topBar setDrawsBackground:YES];
Modified: trunk/SKSecondaryPDFView.m
===================================================================
--- trunk/SKSecondaryPDFView.m 2022-05-08 16:48:07 UTC (rev 12900)
+++ trunk/SKSecondaryPDFView.m 2022-05-08 21:36:01 UTC (rev 12901)
@@ -265,7 +265,7 @@
if (controlView == nil) {
SKTopBarView *topBar = [[SKTopBarView alloc]
initWithFrame:NSMakeRect(0.0, 0.0, CONTROL_HEIGHT, CONTROL_HEIGHT)];
- [topBar applyPdfControlBackground];
+ [topBar setStyle:SKTopBarStylePDFControlBackground];
[toolModeButton setTranslatesAutoresizingMaskIntoConstraints:NO];
[pagePopUpButton setTranslatesAutoresizingMaskIntoConstraints:NO];
Modified: trunk/SKSnapshotPDFView.m
===================================================================
--- trunk/SKSnapshotPDFView.m 2022-05-08 16:48:07 UTC (rev 12900)
+++ trunk/SKSnapshotPDFView.m 2022-05-08 21:36:01 UTC (rev 12901)
@@ -179,7 +179,7 @@
[scalePopUpButton setRefusesFirstResponder:YES];
SKTopBarView *topBar = [[SKTopBarView alloc]
initWithFrame:NSMakeRect(0.0, 0.0, 0.0, CONTROL_HEIGHT)];
- [topBar applyPdfControlBackground];
+ [topBar setStyle:SKTopBarStylePDFControlBackground];
[scalePopUpButton setTranslatesAutoresizingMaskIntoConstraints:NO];
[topBar addSubview:scalePopUpButton];
Modified: trunk/SKTopBarView.h
===================================================================
--- trunk/SKTopBarView.h 2022-05-08 16:48:07 UTC (rev 12900)
+++ trunk/SKTopBarView.h 2022-05-08 21:36:01 UTC (rev 12901)
@@ -38,6 +38,12 @@
#import <Cocoa/Cocoa.h>
+typedef NS_ENUM(NSInteger, SKTopBarStyle) {
+ SKTopBarStyleDefault,
+ SKTopBarStylePDFControlBackground,
+ SKTopBarStylePresentation
+};
+
@class SKBackgroundView;
@interface SKTopBarView : NSView {
@@ -44,14 +50,12 @@
NSView *contentView;
NSVisualEffectView *blurView;
SKBackgroundView *backgroundView;
+ SKTopBarStyle style;
BOOL drawsBackground;
BOOL wantsSubviews;
}
@property (nonatomic) BOOL drawsBackground;
+@property (nonatomic) SKTopBarStyle style;
-- (void)applyDefaultBackground;
-- (void)applyPresentationBackground;
-- (void)applyPdfControlBackground;
-
@end
Modified: trunk/SKTopBarView.m
===================================================================
--- trunk/SKTopBarView.m 2022-05-08 16:48:07 UTC (rev 12900)
+++ trunk/SKTopBarView.m 2022-05-08 21:36:01 UTC (rev 12901)
@@ -57,7 +57,7 @@
@implementation SKTopBarView
-@synthesize drawsBackground;
+@synthesize style, drawsBackground;
- (id)initWithFrame:(NSRect)frame {
wantsSubviews = YES;
@@ -71,7 +71,7 @@
contentView = [[NSView alloc] initWithFrame:[self bounds]];
[super addSubview:contentView];
wantsSubviews = NO;
- [self applyDefaultBackground];
+ [self setStyle:SKTopBarStyleDefault];
}
return self;
}
@@ -122,52 +122,52 @@
}
}
-- (void)applyDefaultBackground {
+- (void)setStyle:(SKTopBarStyle)newStyle {
+ style = newStyle;
+ NSColor *sepColor = nil;
+ switch (style) {
+ case SKTopBarStyleDefault:
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wpartial-availability"
- [blurView setMaterial:RUNNING_AFTER(10_15) || RUNNING_BEFORE(10_13) ?
NSVisualEffectMaterialTitlebar : NSVisualEffectMaterialHeaderView];
+ [blurView setMaterial:RUNNING_AFTER(10_15) ||
RUNNING_BEFORE(10_13) ? NSVisualEffectMaterialTitlebar :
NSVisualEffectMaterialHeaderView];
#pragma clang diagnostic pop
- [blurView setBlendingMode:NSVisualEffectBlendingModeWithinWindow];
- if (RUNNING_AFTER(10_13)) {
+ [blurView setBlendingMode:NSVisualEffectBlendingModeWithinWindow];
+ if (RUNNING_AFTER(10_13)) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wpartial-availability"
- [backgroundView setSeparatorColor:[NSColor separatorColor]];
+ sepColor = [NSColor separatorColor];
#pragma clang diagnostic pop
- } else{
- [backgroundView setBackgroundColor:[NSColor
colorWithGenericGamma22White:1.0 alpha:0.25]];
- [backgroundView setSeparatorColor:[NSColor
colorWithGenericGamma22White:0.8 alpha:0.35]];
- }
- [backgroundView setNeedsDisplay:YES];
-}
-
-- (void)applyPresentationBackground {
- if (RUNNING_AFTER(10_13)) {
+ } else{
+ [backgroundView setBackgroundColor:[NSColor
colorWithGenericGamma22White:1.0 alpha:0.25]];
+ sepColor = [NSColor colorWithGenericGamma22White:0.8
alpha:0.35];
+ }
+ break;
+ case SKTopBarStylePDFControlBackground:
+ if (RUNNING_AFTER(10_13)) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wpartial-availability"
- [blurView setMaterial:NSVisualEffectMaterialSidebar];
+ [blurView setMaterial:RUNNING_AFTER(10_15) ||
RUNNING_BEFORE(10_13) ? NSVisualEffectMaterialTitlebar :
NSVisualEffectMaterialHeaderView];
#pragma clang diagnostic pop
- [blurView setBlendingMode:NSVisualEffectBlendingModeBehindWindow];
- } else {
- [backgroundView setBackgroundColor:[NSColor windowBackgroundColor]];
- }
- [backgroundView setSeparatorColor:nil];
- [backgroundView setNeedsDisplay:YES];
-}
-
-- (void)applyPdfControlBackground {
- if (RUNNING_AFTER(10_13)) {
+ [blurView
setBlendingMode:NSVisualEffectBlendingModeWithinWindow];
+ } else {
+ [blurView setMaterial:NSVisualEffectMaterialLight];
+ [blurView
setBlendingMode:NSVisualEffectBlendingModeWithinWindow];
+ [backgroundView setBackgroundColor:[NSColor
colorWithGenericGamma22White:0.98 alpha:0.5]];
+ }
+ break;
+ case SKTopBarStylePresentation:
+ if (RUNNING_AFTER(10_13)) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wpartial-availability"
- [blurView setMaterial:RUNNING_AFTER(10_15) || RUNNING_BEFORE(10_13) ?
NSVisualEffectMaterialTitlebar : NSVisualEffectMaterialHeaderView];
+ [blurView setMaterial:NSVisualEffectMaterialSidebar];
#pragma clang diagnostic pop
- [blurView setBlendingMode:NSVisualEffectBlendingModeWithinWindow];
- } else {
- [blurView setMaterial:NSVisualEffectMaterialLight];
- [blurView setBlendingMode:NSVisualEffectBlendingModeWithinWindow];
- [backgroundView setBackgroundColor:[NSColor
colorWithGenericGamma22White:0.98 alpha:0.5]];
- [backgroundView setNeedsDisplay:YES];
+ [blurView
setBlendingMode:NSVisualEffectBlendingModeBehindWindow];
+ } else {
+ [backgroundView setBackgroundColor:[NSColor
windowBackgroundColor]];
+ }
+ break;
}
- [backgroundView setSeparatorColor:nil];
+ [backgroundView setSeparatorColor:sepColor];
[backgroundView setNeedsDisplay:YES];
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit