Revision: 13563
          http://sourceforge.net/p/skim-app/code/13563
Author:   hofman
Date:     2023-08-06 14:31:42 +0000 (Sun, 06 Aug 2023)
Log Message:
-----------
Add HUD window to change the cursor in presentation. Acccessible by button in 
navigation window. Add option to use fake laser pointer cursor to remove shadow 
added by Night Mode, and use regular laser pointer cursor by default.

Modified Paths:
--------------
    trunk/NSCursor_SKExtensions.h
    trunk/NSCursor_SKExtensions.m
    trunk/SKNavigationWindow.h
    trunk/SKNavigationWindow.m
    trunk/SKPDFView.h
    trunk/SKPDFView.m
    trunk/de.lproj/Localizable.strings
    trunk/en.lproj/Localizable.strings
    trunk/es.lproj/Localizable.strings
    trunk/fr.lproj/Localizable.strings
    trunk/it.lproj/Localizable.strings
    trunk/ja.lproj/Localizable.strings
    trunk/nl.lproj/Localizable.strings
    trunk/pl.lproj/Localizable.strings
    trunk/ru.lproj/Localizable.strings
    trunk/zh_CN.lproj/Localizable.strings
    trunk/zh_TW.lproj/Localizable.strings

Modified: trunk/NSCursor_SKExtensions.h
===================================================================
--- trunk/NSCursor_SKExtensions.h       2023-08-04 15:30:17 UTC (rev 13562)
+++ trunk/NSCursor_SKExtensions.h       2023-08-06 14:31:42 UTC (rev 13563)
@@ -60,5 +60,6 @@
 + (NSCursor *)emptyCursor;
 
 + (NSCursor *)laserPointerCursorWithColor:(NSInteger)color;
++ (NSCursor *)safeLaserPointerCursorWithColor:(NSInteger)color;
 
 @end

Modified: trunk/NSCursor_SKExtensions.m
===================================================================
--- trunk/NSCursor_SKExtensions.m       2023-08-04 15:30:17 UTC (rev 13562)
+++ trunk/NSCursor_SKExtensions.m       2023-08-06 14:31:42 UTC (rev 13563)
@@ -231,6 +231,21 @@
     NSCursor *cursor = (id)[laserPointerCursors pointerAtIndex:color % 7];
     if (nil == cursor) {
         NSImage *cursorImage = [NSImage laserPointerImageWithColor:color];
+        cursor = [[[NSCursor alloc] initWithImage:cursorImage 
hotSpot:NSMakePoint(0.5 * [cursorImage size].width, 0.5 * [cursorImage 
size].height)] autorelease];
+        [laserPointerCursors insertPointer:cursor atIndex:color % 7];
+    }
+    return cursor;
+}
+
++ (NSCursor *)safeLaserPointerCursorWithColor:(NSInteger)color {
+    static NSPointerArray *laserPointerCursors = nil;
+    if (laserPointerCursors == nil) {
+        laserPointerCursors = [[NSPointerArray strongObjectsPointerArray] 
retain];
+        [laserPointerCursors setCount:7];
+    }
+    NSCursor *cursor = (id)[laserPointerCursors pointerAtIndex:color % 7];
+    if (nil == cursor) {
+        NSImage *cursorImage = [NSImage laserPointerImageWithColor:color];
         cursor = [[[SKLaserPointerCursor alloc] initWithImage:cursorImage 
hotSpot:NSMakePoint(0.5 * [cursorImage size].width, 0.5 * [cursorImage 
size].height)] autorelease];
         [laserPointerCursors insertPointer:cursor atIndex:color % 7];
     }

Modified: trunk/SKNavigationWindow.h
===================================================================
--- trunk/SKNavigationWindow.h  2023-08-04 15:30:17 UTC (rev 13562)
+++ trunk/SKNavigationWindow.h  2023-08-06 14:31:42 UTC (rev 13563)
@@ -41,21 +41,32 @@
 
 @class SKPDFView, SKNavigationToolTipView, SKNavigationButton;
 
-@interface SKNavigationWindow : SKAnimatedBorderlessWindow {
+@interface SKHUDWindow : SKAnimatedBorderlessWindow
+- (id)initWithPDFView:(SKPDFView *)pdfView;
+- (void)showForWindow:(NSWindow *)window;
+@end
+    
+
+@interface SKNavigationWindow : SKHUDWindow {
     SKNavigationButton *previousButton;
     SKNavigationButton *nextButton;
     SKNavigationButton *zoomButton;
+    SKNavigationButton *cursorButton;
     SKNavigationButton *closeButton;
 }
-- (id)initWithPDFView:(SKPDFView *)pdfView;
 - (void)handleScaleChangedNotification:(NSNotification *)notification;
 - (void)handlePageChangedNotification:(NSNotification *)notification;
 - (void)handleParentWindowDidResizeNotification:(NSNotification *)notification;
-- (void)showForWindow:(NSWindow *)window;
 @end
 
 
-@interface SKNavigationContentView : NSView;
+@interface SKCursorStyleWindow : SKHUDWindow {
+    NSSegmentedControl *styleButton;
+    NSButton *removeShadowButton;
+    NSButton *closeButton;
+}
+- (void)selectCursorStyle:(NSInteger)style;
+- (void)removeShadow:(BOOL)removeShadow;
 @end
 
 
@@ -100,3 +111,11 @@
 
 @interface SKNavigationSeparator : NSView
 @end
+
+
+@interface SKStyleSegmentedControl : NSSegmentedControl
+@end
+
+
+@interface SKStyleSegmentedCell : NSSegmentedCell
+@end

Modified: trunk/SKNavigationWindow.m
===================================================================
--- trunk/SKNavigationWindow.m  2023-08-04 15:30:17 UTC (rev 13562)
+++ trunk/SKNavigationWindow.m  2023-08-06 14:31:42 UTC (rev 13563)
@@ -64,13 +64,14 @@
 static inline NSBezierPath *previousButtonPath(NSSize size);
 static inline NSBezierPath *zoomButtonPath(NSSize size);
 static inline NSBezierPath *alternateZoomButtonPath(NSSize size);
+static inline NSBezierPath *cursorButtonPath(NSSize size);
 static inline NSBezierPath *closeButtonPath(NSSize size);
 
-@implementation SKNavigationWindow
+@implementation SKHUDWindow
 
 - (id)initWithPDFView:(SKPDFView *)pdfView {
     NSScreen *screen = [[pdfView window] screen] ?: [NSScreen mainScreen];
-    CGFloat width = 4 * BUTTON_WIDTH + 2 * SEP_WIDTH + 2 * BUTTON_MARGIN;
+    CGFloat width = 5 * BUTTON_WIDTH + 3 * SEP_WIDTH + 2 * BUTTON_MARGIN;
     NSRect contentRect = NSMakeRect(NSMidX([screen frame]) - 0.5 * width, 
NSMinY([screen frame]) + WINDOW_OFFSET, width, BUTTON_HEIGHT + 2 * 
BUTTON_MARGIN);
     self = [super initWithContentRect:contentRect];
     if (self) {
@@ -94,6 +95,50 @@
         
         SKSetHasDarkAppearance(self);
         
+    }
+    return self;
+}
+
+- (void)showForWindow:(NSWindow *)window {
+    NSRect frame = [window frame];
+    CGFloat width = NSWidth([self frame]);
+    frame = NSMakeRect(NSMidX(frame) - 0.5 * width, NSMinY(frame) + 
WINDOW_OFFSET, width, NSHeight([self frame]));
+    [self setFrame:frame display:NO];
+    if ([self parentWindow] == nil) {
+        [self setAlphaValue:0.0];
+        [window addChildWindow:self ordered:NSWindowAbove];
+    }
+    [self fadeIn];
+    
+    [[NSNotificationCenter defaultCenter] addObserver:self 
selector:@selector(handleParentWindowDidResizeNotification:) 
name:NSWindowDidResizeNotification object:window];
+}
+
+- (void)remove {
+    if ([self parentWindow]) {
+        [[NSNotificationCenter defaultCenter] removeObserver:self 
name:NSWindowDidResizeNotification object:[self parentWindow]];
+        [[self parentWindow] removeChildWindow:self];
+    }
+    [super remove];
+}
+
+- (BOOL)isAccessibilityElement {
+    return YES;
+}
+
+- (NSArray *)accessibilityChildren {
+    return NSAccessibilityUnignoredChildren([[self contentView] subviews]);
+}
+
+@end
+
+#pragma mark -
+
+@implementation SKNavigationWindow
+
+- (id)initWithPDFView:(SKPDFView *)pdfView {
+    self = [super initWithPDFView:pdfView];
+    if (self) {
+        
         NSRect rect = NSMakeRect(BUTTON_MARGIN, BUTTON_MARGIN, BUTTON_WIDTH, 
BUTTON_HEIGHT);
         previousButton = [[SKNavigationButton alloc] initWithFrame:rect];
         [previousButton setTarget:pdfView];
@@ -139,6 +184,19 @@
         
         rect.origin.x = NSMaxX(rect);
         rect.size.width = BUTTON_WIDTH;
+        cursorButton = [[SKNavigationButton alloc] initWithFrame:rect];
+        [cursorButton setTarget:pdfView];
+        [cursorButton setAction:@selector(showCursorStyleWindow:)];
+        [cursorButton setToolTip:NSLocalizedString(@"Cursor", @"Tool tip 
message")];
+        [cursorButton setPath:cursorButtonPath(rect.size)];
+        [[self contentView] addSubview:cursorButton];
+        
+        rect.origin.x = NSMaxX(rect);
+        rect.size.width = SEP_WIDTH;
+        [[self contentView] addSubview:[[[SKNavigationSeparator alloc] 
initWithFrame:rect] autorelease]];
+        
+        rect.origin.x = NSMaxX(rect);
+        rect.size.width = BUTTON_WIDTH;
         closeButton = [[SKNavigationButton alloc] initWithFrame:rect];
         [closeButton setTarget:pdfView];
         [closeButton setAction:@selector(exitPresentation:)];
@@ -154,32 +212,11 @@
     SKDESTROY(previousButton);
     SKDESTROY(nextButton);
     SKDESTROY(zoomButton);
+    SKDESTROY(cursorButton);
     SKDESTROY(closeButton);
     [super dealloc];
 }
 
-- (void)showForWindow:(NSWindow *)window {
-    NSRect frame = [window frame];
-    CGFloat width = NSWidth([self frame]);
-    frame = NSMakeRect(NSMidX(frame) - 0.5 * width, NSMinY(frame) + 
WINDOW_OFFSET, width, BUTTON_HEIGHT + 2 * BUTTON_MARGIN);
-    [self setFrame:frame display:NO];
-    if ([self parentWindow] == nil) {
-        [self setAlphaValue:0.0];
-        [window addChildWindow:self ordered:NSWindowAbove];
-    }
-    [self fadeIn];
-    
-    [[NSNotificationCenter defaultCenter] addObserver:self 
selector:@selector(handleParentWindowDidResizeNotification:) 
name:NSWindowDidResizeNotification object:window];
-}
-
-- (void)remove {
-    if ([self parentWindow]) {
-        [[NSNotificationCenter defaultCenter] removeObserver:self 
name:NSWindowDidResizeNotification object:[self parentWindow]];
-        [[self parentWindow] removeChildWindow:self];
-    }
-    [super remove];
-}
-
 - (void)orderOut:(id)sender {
     [[SKNavigationToolTipWindow sharedToolTipWindow] orderOut:nil];
     [super orderOut:sender];
@@ -202,30 +239,95 @@
     [self setFrame:frame display:YES];
 }
 
-- (BOOL)isAccessibilityElement {
-    return YES;
-}
-
-- (NSArray *)accessibilityChildren {
-    return NSAccessibilityUnignoredChildren([[self contentView] subviews]);
-}
-
 @end
 
 #pragma mark -
 
-@implementation SKNavigationContentView
+@implementation SKCursorStyleWindow
 
-- (void)drawRect:(NSRect)rect {
-    [NSGraphicsContext saveGraphicsState];
-    [[NSColor colorWithDeviceWhite:0.0 alpha:0.5] setFill];
-    [[NSColor colorWithDeviceWhite:1.0 alpha:0.2] setStroke];
-    [NSBezierPath setDefaultLineWidth:1.0];
-    [[NSBezierPath bezierPathWithRoundedRect:NSInsetRect([self bounds], 1.0, 
1.0) xRadius:CORNER_RADIUS yRadius:CORNER_RADIUS] fill];
-    [[NSBezierPath bezierPathWithRoundedRect:NSInsetRect([self bounds], 0.5, 
0.5) xRadius:CORNER_RADIUS yRadius:CORNER_RADIUS] stroke];
-    [NSGraphicsContext restoreGraphicsState];
+- (id)initWithPDFView:(SKPDFView *)pdfView {
+    self = [super initWithPDFView:pdfView];
+    if (self) {
+        
+        NSRect rect;
+        
+        styleButton = [[SKStyleSegmentedControl alloc] init];
+        [styleButton setSegmentCount:8];
+        [styleButton setTrackingMode:NSSegmentSwitchTrackingSelectOne];
+        NSInteger i;
+        for (i = 0; i < 8; i++) {
+            [styleButton setWidth:24.0 forSegment:i];
+            [[styleButton cell] setTag:i - 1 forSegment:i];
+            [styleButton setImage:i > 0 ? [NSImage 
laserPointerImageWithColor:i - 1] : [[NSCursor arrowCursor] image] 
forSegment:i];
+        }
+        [styleButton sizeToFit];
+        rect = [styleButton frame];
+        rect.origin.x = rect.origin.y = BUTTON_MARGIN;
+        [styleButton setFrame:rect];
+        [[styleButton cell] selectSegmentWithTag:[pdfView cursorStyle]];
+        [styleButton setTarget:pdfView];
+        [styleButton setAction:@selector(changeCursorStyle:)];
+        if (RUNNING_BEFORE(10_14))
+            [[styleButton cell] setBackgroundStyle:NSBackgroundStyleDark];
+        [[self contentView] addSubview:styleButton];
+        
+        rect.origin.x = NSMaxX(rect);
+        rect.size.width = SEP_WIDTH;
+        [[self contentView] addSubview:[[[SKNavigationSeparator alloc] 
initWithFrame:rect] autorelease]];
+        
+        rect.origin.x = NSMaxX(rect);
+        rect.size.width = NSHeight(rect);
+        removeShadowButton = [[NSButton alloc] initWithFrame:rect];
+        [removeShadowButton setButtonType:NSSwitchButton];
+        [removeShadowButton setTitle:NSLocalizedString(@"Remove shadow", 
@"Button title")];
+        [removeShadowButton setState:[pdfView removeCursorShadow] ? NSOnState 
: NSOffState];
+        [removeShadowButton setTarget:pdfView];
+        [removeShadowButton setAction:@selector(toggleRemoveCursorShadow:)];
+        if (RUNNING_BEFORE(10_14))
+            [[removeShadowButton cell] 
setBackgroundStyle:NSBackgroundStyleDark];
+        [removeShadowButton sizeToFit];
+        rect.size.width = NSWidth([removeShadowButton frame]);
+        [removeShadowButton setFrameOrigin:NSMakePoint(NSMinX(rect), 
NSMidY(rect) - 0.5 * NSHeight([removeShadowButton frame]))];
+        [[self contentView] addSubview:removeShadowButton];
+        
+        rect.origin.x = NSMaxX(rect);
+        rect.size.width = SEP_WIDTH;
+        [[self contentView] addSubview:[[[SKNavigationSeparator alloc] 
initWithFrame:rect] autorelease]];
+        
+        rect.origin.x = NSMaxX(rect);
+        rect.size.width = NSHeight(rect);
+        closeButton = [[NSButton alloc] initWithFrame:rect];
+        [closeButton setBordered:NO];
+        [closeButton setImage:[NSImage 
imageNamed:NSImageNameStopProgressTemplate]];
+        [closeButton setTarget:pdfView];
+        [closeButton setAction:@selector(closeCursorStyleWindow:)];
+        if (RUNNING_BEFORE(10_14))
+            [[closeButton cell] setBackgroundStyle:NSBackgroundStyleDark];
+        [[self contentView] addSubview:closeButton];
+        
+        NSScreen *screen = [[pdfView window] screen] ?: [NSScreen mainScreen];
+        NSRect frame = NSMakeRect(NSMidX([screen frame]) - 0.5 * 
NSWidth(frame), NSMinY([screen frame]) + WINDOW_OFFSET, NSWidth([styleButton 
frame]) + NSWidth([removeShadowButton frame]) + NSHeight(rect) + 2.0 * 
BUTTON_MARGIN + 2.0 * SEP_WIDTH, NSHeight(rect) + 2.0 * BUTTON_MARGIN);
+        [self setFrame:frame display:NO];
+        [(NSVisualEffectView *)[self contentView] setMaskImage:[NSImage 
maskImageWithSize:frame.size cornerRadius:CORNER_RADIUS]];
+    }
+    return self;
 }
 
+- (void)dealloc {
+    SKDESTROY(styleButton);
+    SKDESTROY(removeShadowButton);
+    SKDESTROY(closeButton);
+    [super dealloc];
+}
+
+- (void)selectCursorStyle:(NSInteger)style {
+    [[styleButton cell] selectSegmentWithTag:style];
+}
+
+- (void)removeShadow:(BOOL)removeShadow {
+    [removeShadowButton setState:removeShadow ? NSOnState : NSOffState];
+}
+
 @end
 
 #pragma mark -
@@ -494,6 +596,10 @@
     }
 }
 
+- (NSString *)accessibilityLabel {
+    return [self state] == NSOnState && alternateToolTip ? alternateToolTip : 
toolTip;
+}
+
 @end
 
 #pragma mark -
@@ -508,6 +614,40 @@
 
 @end
 
+#pragma mark -
+
+@implementation SKStyleSegmentedControl
+
++ (Class)cellClass { return [SKStyleSegmentedCell class]; }
+
+- (BOOL)allowsVibrancy { return NO; }
+
+@end
+
+#pragma mark -
+
+@implementation SKStyleSegmentedCell
+
+- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView {
+    [self drawInteriorWithFrame:cellFrame inView:controlView];
+}
+
+- (void)drawSegment:(NSInteger)segment inFrame:(NSRect)frame withView:(NSView 
*)controlView {
+    if ([(NSSegmentedControl *)[self controlView] selectedSegment] == segment) 
{
+        NSRect rect = frame;
+        rect.size.width -= 1.0;
+        rect.size.height -= 1.0;
+        rect.origin.y += 1.0;
+        [NSGraphicsContext saveGraphicsState];
+        [[NSColor colorWithGenericGamma22White:1.0 alpha:0.5] setFill];
+        [[NSBezierPath bezierPathWithRoundedRect:rect xRadius:5.0 yRadius:5.0] 
fill];
+        [NSGraphicsContext restoreGraphicsState];
+    }
+    [super drawSegment:segment inFrame:frame withView:controlView];
+}
+
+@end
+
 #pragma mark Button paths
 
 static inline NSBezierPath *nextButtonPath(NSSize size) {
@@ -606,6 +746,29 @@
     return path;
 }
 
+static inline NSBezierPath *cursorButtonPath(NSSize size) {
+    NSRect bounds = {NSZeroPoint, size};
+    NSRect rect = NSInsetRect(bounds, 10.0, 10.0);
+    NSBezierPath *path = [NSBezierPath bezierPath];
+    [path moveToPoint:NSMakePoint(NSMidX(rect) - 2.0, NSMaxY(rect))];
+    [path lineToPoint:NSMakePoint(NSMidX(rect) + 2.0, NSMaxY(rect))];
+    [path lineToPoint:NSMakePoint(NSMidX(rect) + 2.0, NSMidY(rect) + 3.0)];
+    [path lineToPoint:NSMakePoint(NSMidX(rect) + 9.0, NSMidY(rect) + 5.0)];
+    [path lineToPoint:NSMakePoint(NSMidX(rect), NSMinY(rect))];
+    [path lineToPoint:NSMakePoint(NSMidX(rect) - 9.0, NSMidY(rect) + 5.0)];
+    [path lineToPoint:NSMakePoint(NSMidX(rect) - 2.0, NSMidY(rect) + 3.0)];
+    [path closePath];
+    
+    NSAffineTransform *transform = [[[NSAffineTransform alloc] init] 
autorelease];
+    CGFloat centerX = NSMidX(bounds), centerY = NSMidY(bounds);
+    [transform translateXBy:centerX yBy:centerY];
+    [transform rotateByDegrees:-20.0];
+    [transform translateXBy:-centerX yBy:-centerY];
+    [path transformUsingAffineTransform:transform];
+    
+    return path;
+}
+
 static inline NSBezierPath *closeButtonPath(NSSize size) {
     NSRect bounds = {NSZeroPoint, size};
     NSBezierPath *path = [NSBezierPath bezierPath];

Modified: trunk/SKPDFView.h
===================================================================
--- trunk/SKPDFView.h   2023-08-04 15:30:17 UTC (rev 13562)
+++ trunk/SKPDFView.h   2023-08-06 14:31:42 UTC (rev 13563)
@@ -116,7 +116,7 @@
 
 @protocol SKPDFViewDelegate;
 
-@class SKReadingBar, SKTransitionController, SKTypeSelectHelper, 
SKNavigationWindow, SKTextNoteEditor, SKSyncDot, SKLoupeController, 
SKLayerController;
+@class SKReadingBar, SKTransitionController, SKTypeSelectHelper, 
SKNavigationWindow, SKCursorStyleWindow, SKTextNoteEditor, SKSyncDot, 
SKLoupeController, SKLayerController;
 
 @interface SKPDFView : SKBasePDFView {
     SKToolMode toolMode;
@@ -127,6 +127,8 @@
     NSInteger navigationMode;
     SKNavigationWindow *navWindow;
     
+    SKCursorStyleWindow *cursorWindow;
+    
     SKReadingBar *readingBar;
     
     NSTimer *pacerTimer;
@@ -170,6 +172,7 @@
         unsigned int wantsNewUndoGroup:1;
         unsigned int cursorHidden:1;
         unsigned int useArrowCursorInPresentation:1;
+        unsigned int removeLaserPointerShadow:1;
     } pdfvFlags;
 }
 
@@ -222,6 +225,13 @@
 - (void)toggleAutoActualSize:(id)sender;
 - (void)exitPresentation:(id)sender;
 
+- (void)showCursorStyleWindow:(id)sender;
+- (void)closeCursorStyleWindow:(id)sender;
+- (NSInteger)cursorStyle;
+- (void)changeCursorStyle:(id)sender;
+- (BOOL)removeCursorShadow;
+- (void)toggleRemoveCursorShadow:(id)sender;
+
 - (void)addAnnotationForContext:(id)sender;
 - (void)addAnnotationWithType:(SKNoteType)annotationType;
 - (void)addAnnotation:(PDFAnnotation *)annotation toPage:(PDFPage *)page;

Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m   2023-08-04 15:30:17 UTC (rev 13562)
+++ trunk/SKPDFView.m   2023-08-06 14:31:42 UTC (rev 13563)
@@ -80,6 +80,7 @@
 #import "NSObject_SKExtensions.h"
 #import "SKLoupeController.h"
 #import "PDFDestination_SKExtensions.h"
+#import "NSSegmentedControl_SKExtensions.h"
 
 #define ANNOTATION_MODE_COUNT 9
 #define TOOL_MODE_COUNT 5
@@ -140,6 +141,7 @@
 #define SKPacerSpeedKey @"SKPacerSpeed"
 #define SKUseArrowCursorInPresentationKey @"SKUseArrowCursorInPresentation"
 #define SKLaserPointerColorKey @"SKLaserPointerColor"
+#define SKRemoveLaserPointerShadowKey @"SKRemoveLaserPointerShadows"
 
 #define SKAnnotationKey @"SKAnnotation"
 
@@ -313,6 +315,7 @@
     pdfvFlags.wantsNewUndoGroup = 0;
     pdfvFlags.cursorHidden = 0;
     pdfvFlags.useArrowCursorInPresentation = [[NSUserDefaults 
standardUserDefaults] boolForKey:SKUseArrowCursorInPresentationKey];
+    pdfvFlags.removeLaserPointerShadow = [[NSUserDefaults 
standardUserDefaults] boolForKey:SKRemoveLaserPointerShadowKey];
     inKeyWindow = NO;
     
     laserPointerColor = [[NSUserDefaults standardUserDefaults] 
integerForKey:SKLaserPointerColorKey];
@@ -376,6 +379,7 @@
     SKDESTROY(typeSelectHelper);
     SKDESTROY(transitionController);
     SKDESTROY(navWindow);
+    SKDESTROY(cursorWindow);
     SKDESTROY(readingBar);
     SKDESTROY(editor);
     SKDESTROY(highlightAnnotation);
@@ -1696,6 +1700,7 @@
     pdfvFlags.useArrowCursorInPresentation = 
pdfvFlags.useArrowCursorInPresentation == NO;
     [self setCursorForMouse:nil];
     [[NSUserDefaults standardUserDefaults] 
setBool:pdfvFlags.useArrowCursorInPresentation 
forKey:SKUseArrowCursorInPresentationKey];
+    [cursorWindow selectCursorStyle:[self cursorStyle]];
 }
 
 - (void)nextLaserPointerColor:(id)sender {
@@ -1704,6 +1709,7 @@
     [self setCursorForMouse:nil];
     [self performSelectorOnce:@selector(doAutoHide) 
afterDelay:AUTO_HIDE_DELAY];
     [[NSUserDefaults standardUserDefaults] setInteger:laserPointerColor 
forKey:SKLaserPointerColorKey];
+    [cursorWindow selectCursorStyle:[self cursorStyle]];
 }
 
 - (void)previousLaserPointerColor:(id)sender {
@@ -1712,6 +1718,7 @@
     [self setCursorForMouse:nil];
     [self performSelectorOnce:@selector(doAutoHide) 
afterDelay:AUTO_HIDE_DELAY];
     [[NSUserDefaults standardUserDefaults] setInteger:laserPointerColor 
forKey:SKLaserPointerColorKey];
+    [cursorWindow selectCursorStyle:[self cursorStyle]];
 }
 
 - (void)nextToolMode:(id)sender {
@@ -3506,6 +3513,10 @@
         [navWindow remove];
         SKDESTROY(navWindow);
     }
+    if (cursorWindow) {
+        [cursorWindow remove];
+        SKDESTROY(cursorWindow);
+    }
 }
 
 - (void)doAutoHide {
@@ -3525,6 +3536,46 @@
     }
 }
 
+- (void)showCursorStyleWindow:(id)sender {
+    if ([cursorWindow isVisible] == NO) {
+        if (cursorWindow == nil)
+            cursorWindow = [[SKCursorStyleWindow alloc] initWithPDFView:self];
+        [navWindow fadeOut];
+        [cursorWindow showForWindow:[self window]];
+        
NSAccessibilityPostNotificationWithUserInfo(NSAccessibilityUnignoredAncestor([self
 documentView]), NSAccessibilityLayoutChangedNotification, [NSDictionary 
dictionaryWithObjectsAndKeys:NSAccessibilityUnignoredChildrenForOnlyChild(cursorWindow),
 NSAccessibilityUIElementsKey, nil]);
+    }
+}
+
+- (void)closeCursorStyleWindow:(id)sender {
+    [cursorWindow fadeOut];
+}
+
+- (NSInteger)cursorStyle {
+    return pdfvFlags.useArrowCursorInPresentation ? -1 : laserPointerColor;
+}
+
+- (void)changeCursorStyle:(id)sender {
+    NSInteger style = [sender selectedTag];
+    if (style < 0) {
+        pdfvFlags.useArrowCursorInPresentation = 1;
+        [[NSUserDefaults standardUserDefaults] setBool:YES 
forKey:SKUseArrowCursorInPresentationKey];
+    } else {
+        pdfvFlags.useArrowCursorInPresentation = 0;
+        laserPointerColor = style % 7;
+        [[NSUserDefaults standardUserDefaults] setBool:NO 
forKey:SKUseArrowCursorInPresentationKey];
+        [[NSUserDefaults standardUserDefaults] setInteger:laserPointerColor 
forKey:SKLaserPointerColorKey];
+    }
+}
+
+- (BOOL)removeCursorShadow {
+    return pdfvFlags.removeLaserPointerShadow;
+}
+
+- (void)toggleRemoveCursorShadow:(id)sender {
+    pdfvFlags.removeLaserPointerShadow = pdfvFlags.removeLaserPointerShadow == 
NO;
+    [[NSUserDefaults standardUserDefaults] 
setBool:pdfvFlags.removeLaserPointerShadow 
forKey:SKRemoveLaserPointerShadowKey];
+}
+
 #pragma mark Event handling
 
 - (void)doMoveCurrentAnnotationForKey:(unichar)eventChar 
byAmount:(CGFloat)delta {
@@ -5221,7 +5272,7 @@
     NSInteger modifiers = [theEvent standardModifierFlags];
     
     if ([[self document] isLocked]) {
-    } else if (NSPointInRect(p, [self convertRect:[self visibleContentRect] 
toView:nil]) == NO || ([navWindow isVisible] && NSPointInRect([theEvent 
locationOnScreen], [navWindow frame]))) {
+    } else if (NSPointInRect(p, [self convertRect:[self visibleContentRect] 
toView:nil]) == NO || ([navWindow isVisible] && NSPointInRect([theEvent 
locationOnScreen], [navWindow frame])) || ([cursorWindow isVisible] && 
NSPointInRect([theEvent locationOnScreen], [cursorWindow frame]))) {
         area = kPDFNoArea;
     } else if (interactionMode == SKPresentationMode) {
         area = (area & kPDFLinkArea) | kPDFPageArea;
@@ -5290,9 +5341,16 @@
 - (void)setCursorForAreaOfInterest:(PDFAreaOfInterest)area {
     if ((area & kPDFLinkArea))
         [[NSCursor pointingHandCursor] set];
-    else if (interactionMode == SKPresentationMode)
-        [pdfvFlags.cursorHidden ? [NSCursor emptyCursor] : 
pdfvFlags.useArrowCursorInPresentation || area == kPDFNoArea ? [NSCursor 
arrowCursor] : [NSCursor laserPointerCursorWithColor:laserPointerColor] set];
-    else if ((area & SKSpecialToolArea))
+    else if (interactionMode == SKPresentationMode) {
+        if (pdfvFlags.cursorHidden)
+            [[NSCursor emptyCursor] set];
+        else if (pdfvFlags.useArrowCursorInPresentation || area == kPDFNoArea)
+            [[NSCursor arrowCursor] set];
+        else if (pdfvFlags.removeLaserPointerShadow)
+            [[NSCursor safeLaserPointerCursorWithColor:laserPointerColor] set];
+        else
+            [[NSCursor laserPointerCursorWithColor:laserPointerColor] set];
+    } else if ((area & SKSpecialToolArea))
         [[NSCursor arrowCursor] set];
     else if ((area & SKTemporaryToolArea))
         [[self cursorForTemporaryToolMode] set];
@@ -5396,6 +5454,10 @@
             [navWindow fadeOut];
             
NSAccessibilityPostNotificationWithUserInfo(NSAccessibilityUnignoredAncestor([self
 documentView]), NSAccessibilityLayoutChangedNotification, nil);
         }
+        if ([cursorWindow isVisible]) {
+            [cursorWindow fadeOut];
+            
NSAccessibilityPostNotificationWithUserInfo(NSAccessibilityUnignoredAncestor([self
 documentView]), NSAccessibilityLayoutChangedNotification, nil);
+        }
     } else if ([[self delegate] 
respondsToSelector:@selector(PDFViewPerformHideFind:)]) {
         [[self delegate] PDFViewPerformHideFind:self];
         return YES;

Modified: trunk/de.lproj/Localizable.strings
===================================================================
(Binary files differ)

Modified: trunk/en.lproj/Localizable.strings
===================================================================
(Binary files differ)

Modified: trunk/es.lproj/Localizable.strings
===================================================================
(Binary files differ)

Modified: trunk/fr.lproj/Localizable.strings
===================================================================
(Binary files differ)

Modified: trunk/it.lproj/Localizable.strings
===================================================================
(Binary files differ)

Modified: trunk/ja.lproj/Localizable.strings
===================================================================
(Binary files differ)

Modified: trunk/nl.lproj/Localizable.strings
===================================================================
(Binary files differ)

Modified: trunk/pl.lproj/Localizable.strings
===================================================================
(Binary files differ)

Modified: trunk/ru.lproj/Localizable.strings
===================================================================
(Binary files differ)

Modified: trunk/zh_CN.lproj/Localizable.strings
===================================================================
(Binary files differ)

Modified: trunk/zh_TW.lproj/Localizable.strings
===================================================================
(Binary files differ)

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

Reply via email to