Revision: 3652
          http://skim-app.svn.sourceforge.net/skim-app/?rev=3652&view=rev
Author:   hofman
Date:     2008-04-06 08:55:52 -0700 (Sun, 06 Apr 2008)

Log Message:
-----------
Use method swizzling to replace methods in a category rather than super.

Modified Paths:
--------------
    trunk/PDFAnnotation_SKExtensions.m

Modified: trunk/PDFAnnotation_SKExtensions.m
===================================================================
--- trunk/PDFAnnotation_SKExtensions.m  2008-04-06 14:58:44 UTC (rev 3651)
+++ trunk/PDFAnnotation_SKExtensions.m  2008-04-06 15:55:52 UTC (rev 3652)
@@ -51,6 +51,7 @@
 #import "NSUserDefaultsController_SKExtensions.h"
 #import "NSGeometry_SKExtensions.h"
 #import "NSString_SKExtensions.h"
+#import "OBUtilities.h"
 
 
 unsigned long SKScriptingBorderStyleFromBorderStyle(int borderStyle) {
@@ -538,8 +539,23 @@
 @implementation PDFAnnotationLink (SKExtensions)
 
 // override these Leopard methods to avoid showing the standard tool tips over 
our own
-- (NSString *)toolTip {
-    return ([self URL] || [self destination]) ? nil : [super toolTip];
+
+static IMP originalToolTip = NULL;
+static IMP originalToolTipNoLabel = NULL;
+
+- (NSString *)replacementToolTip {
+    return ([self URL] || [self destination]) ? nil : originalToolTip(self, 
_cmd);
 }
 
+- (NSString *)replacementToolTipNoLabel {
+    return ([self URL] || [self destination]) ? nil : 
originalToolTipNoLabel(self, _cmd);
+}
+
++ (void)load {
+    if ([self instancesRespondToSelector:@selector(toolTip)])
+        originalToolTip = OBReplaceMethodImplementationWithSelector(self, 
@selector(toolTip), @selector(replacementToolTip));
+    if ([self instancesRespondToSelector:@selector(toolTipNoLabel)])
+        originalToolTip = OBReplaceMethodImplementationWithSelector(self, 
@selector(toolTipNoLabel), @selector(replacementToolTipNoLabel));
+}
+
 @end


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Register now and save $200. Hurry, offer ends at 11:59 p.m., 
Monday, April 7! Use priority code J8TLD2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to