Revision: 13760
          http://sourceforge.net/p/skim-app/code/13760
Author:   hofman
Date:     2023-11-14 16:16:55 +0000 (Tue, 14 Nov 2023)
Log Message:
-----------
Don't override annotation toolTip, it is not used anyway. No need for 
linkDestination and linkURL properties. Return NO from isLink for other 
annotation classes.

Modified Paths:
--------------
    trunk/PDFAnnotationButtonWidget_SKExtensions.m
    trunk/PDFAnnotationChoiceWidget_SKExtensions.m
    trunk/PDFAnnotationCircle_SKExtensions.m
    trunk/PDFAnnotationFreeText_SKExtensions.m
    trunk/PDFAnnotationInk_SKExtensions.m
    trunk/PDFAnnotationLine_SKExtensions.m
    trunk/PDFAnnotationLink_SKExtensions.m
    trunk/PDFAnnotationMarkup_SKExtensions.m
    trunk/PDFAnnotationSquare_SKExtensions.m
    trunk/PDFAnnotationTextWidget_SKExtensions.m
    trunk/PDFAnnotationText_SKExtensions.m
    trunk/PDFAnnotation_SKExtensions.h
    trunk/PDFAnnotation_SKExtensions.m
    trunk/SKImageToolTipContext.m
    trunk/SKPDFView.m

Modified: trunk/PDFAnnotationButtonWidget_SKExtensions.m
===================================================================
--- trunk/PDFAnnotationButtonWidget_SKExtensions.m      2023-11-12 23:59:46 UTC 
(rev 13759)
+++ trunk/PDFAnnotationButtonWidget_SKExtensions.m      2023-11-14 16:16:55 UTC 
(rev 13760)
@@ -71,6 +71,8 @@
     return [self controlType] == kPDFWidgetCheckBoxControl || [self 
controlType] == kPDFWidgetRadioButtonControl;
 }
 
+- (BOOL)isLnk { return NO; }
+
 - (NSSet *)keysForValuesToObserveForUndo {
     if ([self controlType] != kPDFWidgetCheckBoxControl && [self controlType] 
!= kPDFWidgetRadioButtonControl)
         return nil;

Modified: trunk/PDFAnnotationChoiceWidget_SKExtensions.m
===================================================================
--- trunk/PDFAnnotationChoiceWidget_SKExtensions.m      2023-11-12 23:59:46 UTC 
(rev 13759)
+++ trunk/PDFAnnotationChoiceWidget_SKExtensions.m      2023-11-14 16:16:55 UTC 
(rev 13760)
@@ -69,6 +69,8 @@
 
 - (BOOL)isWidget { return YES; }
 
+- (BOOL)isLnk { return NO; }
+
 - (NSSet *)keysForValuesToObserveForUndo {
     static NSSet *keys = nil;
     if (keys == nil)

Modified: trunk/PDFAnnotationCircle_SKExtensions.m
===================================================================
--- trunk/PDFAnnotationCircle_SKExtensions.m    2023-11-12 23:59:46 UTC (rev 
13759)
+++ trunk/PDFAnnotationCircle_SKExtensions.m    2023-11-14 16:16:55 UTC (rev 
13760)
@@ -70,6 +70,8 @@
 
 - (BOOL)isWidget { return NO; }
 
+- (BOOL)isLnk { return NO; }
+
 - (BOOL)isResizable { return [self isSkimNote]; }
 
 - (BOOL)isMovable { return [self isSkimNote]; }

Modified: trunk/PDFAnnotationFreeText_SKExtensions.m
===================================================================
--- trunk/PDFAnnotationFreeText_SKExtensions.m  2023-11-12 23:59:46 UTC (rev 
13759)
+++ trunk/PDFAnnotationFreeText_SKExtensions.m  2023-11-14 16:16:55 UTC (rev 
13760)
@@ -107,6 +107,8 @@
 
 - (BOOL)isWidget { return NO; }
 
+- (BOOL)isLnk { return NO; }
+
 - (BOOL)isResizable { return [self isSkimNote]; }
 
 - (BOOL)isMovable { return [self isSkimNote]; }

Modified: trunk/PDFAnnotationInk_SKExtensions.m
===================================================================
--- trunk/PDFAnnotationInk_SKExtensions.m       2023-11-12 23:59:46 UTC (rev 
13759)
+++ trunk/PDFAnnotationInk_SKExtensions.m       2023-11-14 16:16:55 UTC (rev 
13760)
@@ -97,6 +97,8 @@
 
 - (BOOL)isWidget { return NO; }
 
+- (BOOL)isLnk { return NO; }
+
 - (BOOL)isResizable { return YES; }
 
 - (BOOL)isMovable { return [self isSkimNote]; }

Modified: trunk/PDFAnnotationLine_SKExtensions.m
===================================================================
--- trunk/PDFAnnotationLine_SKExtensions.m      2023-11-12 23:59:46 UTC (rev 
13759)
+++ trunk/PDFAnnotationLine_SKExtensions.m      2023-11-14 16:16:55 UTC (rev 
13760)
@@ -119,6 +119,8 @@
 
 - (BOOL)isWidget { return NO; }
 
+- (BOOL)isLnk { return NO; }
+
 - (BOOL)isResizable { return [self isSkimNote]; }
 
 - (BOOL)isMovable { return [self isSkimNote]; }

Modified: trunk/PDFAnnotationLink_SKExtensions.m
===================================================================
--- trunk/PDFAnnotationLink_SKExtensions.m      2023-11-12 23:59:46 UTC (rev 
13759)
+++ trunk/PDFAnnotationLink_SKExtensions.m      2023-11-14 16:16:55 UTC (rev 
13760)
@@ -43,22 +43,6 @@
 
 @implementation PDFAnnotationLink (SKExtensions)
 
-// override these Leopard methods to avoid showing the standard tool tips over 
our own
-
-static id (*original_toolTip)(id, SEL) = NULL;
-
-- (NSString *)replacement_toolTip {
-    return ([self destination] || original_toolTip == NULL) ? @"" : 
original_toolTip(self, _cmd);
-}
-
-+ (void)load {
-    original_toolTip = (id (*)(id, 
SEL))SKReplaceInstanceMethodImplementationFromSelector(self, 
@selector(toolTip), @selector(replacement_toolTip));
-}
-
 - (BOOL)isLink { return YES; }
 
-- (PDFDestination *)linkDestination { return [self destination]; }
-
-- (NSURL *)linkURL { return [self URL]; }
-
 @end

Modified: trunk/PDFAnnotationMarkup_SKExtensions.m
===================================================================
--- trunk/PDFAnnotationMarkup_SKExtensions.m    2023-11-12 23:59:46 UTC (rev 
13759)
+++ trunk/PDFAnnotationMarkup_SKExtensions.m    2023-11-14 16:16:55 UTC (rev 
13760)
@@ -258,6 +258,8 @@
 
 - (BOOL)isWidget { return NO; }
 
+- (BOOL)isLnk { return NO; }
+
 - (BOOL)hasBorder { return NO; }
 
 - (BOOL)isConvertibleAnnotation { return YES; }

Modified: trunk/PDFAnnotationSquare_SKExtensions.m
===================================================================
--- trunk/PDFAnnotationSquare_SKExtensions.m    2023-11-12 23:59:46 UTC (rev 
13759)
+++ trunk/PDFAnnotationSquare_SKExtensions.m    2023-11-14 16:16:55 UTC (rev 
13760)
@@ -71,6 +71,8 @@
 
 - (BOOL)isWidget { return NO; }
 
+- (BOOL)isLnk { return NO; }
+
 - (BOOL)isResizable { return [self isSkimNote]; }
 
 - (BOOL)isMovable { return [self isSkimNote]; }

Modified: trunk/PDFAnnotationTextWidget_SKExtensions.m
===================================================================
--- trunk/PDFAnnotationTextWidget_SKExtensions.m        2023-11-12 23:59:46 UTC 
(rev 13759)
+++ trunk/PDFAnnotationTextWidget_SKExtensions.m        2023-11-14 16:16:55 UTC 
(rev 13760)
@@ -69,6 +69,8 @@
 
 - (BOOL)isWidget { return YES; }
 
+- (BOOL)isLnk { return NO; }
+
 - (NSSet *)keysForValuesToObserveForUndo {
     static NSSet *keys = nil;
     if (keys == nil)

Modified: trunk/PDFAnnotationText_SKExtensions.m
===================================================================
--- trunk/PDFAnnotationText_SKExtensions.m      2023-11-12 23:59:46 UTC (rev 
13759)
+++ trunk/PDFAnnotationText_SKExtensions.m      2023-11-14 16:16:55 UTC (rev 
13760)
@@ -55,6 +55,8 @@
 
 - (BOOL)isWidget { return NO; }
 
+- (BOOL)isLnk { return NO; }
+
 - (BOOL)isMovable { return [self isSkimNote]; }
 
 - (BOOL)isConvertibleAnnotation { return YES; }

Modified: trunk/PDFAnnotation_SKExtensions.h
===================================================================
--- trunk/PDFAnnotation_SKExtensions.h  2023-11-12 23:59:46 UTC (rev 13759)
+++ trunk/PDFAnnotation_SKExtensions.h  2023-11-14 16:16:55 UTC (rev 13760)
@@ -106,9 +106,6 @@
 
 - (NSString *)textString;
 
-- (PDFDestination *)linkDestination;
-- (NSURL *)linkURL;
-
 - (BOOL)isMarkup;
 - (BOOL)isNote;
 - (BOOL)isText;

Modified: trunk/PDFAnnotation_SKExtensions.m
===================================================================
--- trunk/PDFAnnotation_SKExtensions.m  2023-11-12 23:59:46 UTC (rev 13759)
+++ trunk/PDFAnnotation_SKExtensions.m  2023-11-14 16:16:55 UTC (rev 13760)
@@ -278,14 +278,6 @@
     return fdfString;
 }
 
-- (PDFDestination *)linkDestination {
-    return [self destination];
-}
-
-- (NSURL *)linkURL {
-    return [self URL];
-}
-
 - (NSUInteger)pageIndex {
     PDFPage *page = [self page];
     return page ? [page pageIndex] : NSNotFound;

Modified: trunk/SKImageToolTipContext.m
===================================================================
--- trunk/SKImageToolTipContext.m       2023-11-12 23:59:46 UTC (rev 13759)
+++ trunk/SKImageToolTipContext.m       2023-11-14 16:16:55 UTC (rev 13760)
@@ -218,9 +218,9 @@
 - (NSImage *)toolTipImageWithScale:(CGFloat)scale {
 
     if ([self isLink]) {
-        NSImage *image = [[self linkDestination] 
toolTipImageWithOffset:NSZeroPoint scale:scale selections:nil label:nil];
+        NSImage *image = [[self destination] 
toolTipImageWithOffset:NSZeroPoint scale:scale selections:nil label:nil];
         if (image == nil) {
-            NSURL *url = [self linkURL];
+            NSURL *url = [self URL];
             if (url) {
                 NSAttributedString *attrString = toolTipAttributedString([url 
absoluteString]);
                 if ([attrString length])

Modified: trunk/SKPDFView.m
===================================================================
--- trunk/SKPDFView.m   2023-11-12 23:59:46 UTC (rev 13759)
+++ trunk/SKPDFView.m   2023-11-14 16:16:55 UTC (rev 13760)
@@ -412,7 +412,7 @@
         
         for (PDFPage *page in [self visiblePages]) {
             for (PDFAnnotation *annotation in [page annotations]) {
-                if ([annotation isNote] || (hasLinkToolTips && [annotation 
linkDestination])) {
+                if ([annotation isNote] || (hasLinkToolTips && [annotation 
destination])) {
                     NSRect rect = NSIntersectionRect([self 
convertRect:[annotation bounds] fromPage:page], visibleRect);
                     if (NSIsEmptyRect(rect) == NO) {
                         rect = [self convertRect:rect toView:docView];
@@ -2835,11 +2835,11 @@
     if ([currentAnnotation isLink]) {
         
         [[SKImageToolTipWindow sharedToolTipWindow] orderOut:self];
-        PDFDestination *dest = [currentAnnotation linkDestination];
+        PDFDestination *dest = [currentAnnotation destination];
         NSURL *url;
         if (dest)
             [self goToDestination:dest];
-        else if ((url = [currentAnnotation linkURL]))
+        else if ((url = [currentAnnotation URL]))
             [[NSWorkspace sharedWorkspace] openURL:url];
         [self setCurrentAnnotation:nil];
         
@@ -4994,7 +4994,7 @@
         
         PDFAnnotation *annotation = [page annotationAtPoint:[self 
convertPoint:point toPage:page]];
         if ([annotation isLink]) {
-            PDFDestination *destination = [annotation linkDestination];
+            PDFDestination *destination = [annotation destination];
             if ([destination page]) {
                 page = [destination page];
                 point = [[destination effectiveDestinationForView:nil] point];

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