Revision: 5527
          http://skim-app.svn.sourceforge.net/skim-app/?rev=5527&view=rev
Author:   hofman
Date:     2009-08-09 21:40:09 +0000 (Sun, 09 Aug 2009)

Log Message:
-----------
move shift of tooltip for a PDFDestination to the tooltip window

Modified Paths:
--------------
    trunk/SKMainWindowController_UI.m
    trunk/SKPDFToolTipWindow.m

Modified: trunk/SKMainWindowController_UI.m
===================================================================
--- trunk/SKMainWindowController_UI.m   2009-08-09 15:18:26 UTC (rev 5526)
+++ trunk/SKMainWindowController_UI.m   2009-08-09 21:40:09 UTC (rev 5527)
@@ -107,33 +107,6 @@
 
 @implementation SKMainWindowController (UI)
 
-#pragma mark Support
-
-- (void)showToolTipForDestination:(PDFDestination *)dest {
-    if ([NSApp isActive] && [[NSUserDefaults standardUserDefaults] 
boolForKey:SKDisableTableToolTipsKey] == NO) { 
-        NSPoint point = [dest point];
-        switch ([[dest page] rotation]) {
-            case 0:
-                point.x -= 50.0;
-                point.y += 20.0;
-                break;
-            case 90:
-                point.x -= 20.0;
-                point.y -= 50.0;
-                break;
-            case 180:
-                point.x += 50.0;
-                point.y -= 20.0;
-                break;
-            case 270:
-                point.x += 20.0;
-                point.y += 50.0;
-                break;
-        }
-        [[SKPDFToolTipWindow sharedToolTipWindow] 
showForPDFContext:[[[PDFDestination alloc] initWithPage:[dest page] 
atPoint:point] autorelease] atPoint:NSZeroPoint];
-    }
-}
-
 #pragma mark UI updating
 
 - (void)updateFontPanel {
@@ -533,20 +506,24 @@
 }
 
 - (void)tableView:(NSTableView *)tv mouseEnteredTableColumn:(NSTableColumn 
*)aTableColumn row:(NSInteger)row {
-    if ([tv isEqual:findTableView]) {
-        PDFDestination *dest = [[[findArrayController arrangedObjects] 
objectAtIndex:row] destination];
-        [self showToolTipForDestination:dest];
-    } else if ([tv isEqual:groupedFindTableView]) {
-        PDFDestination *dest = [[[[[groupedFindArrayController 
arrangedObjects] objectAtIndex:row] matches] objectAtIndex:0] destination];
-        [self showToolTipForDestination:dest];
+    if ([NSApp isActive] && [[NSUserDefaults standardUserDefaults] 
boolForKey:SKDisableTableToolTipsKey] == NO) { 
+        if ([tv isEqual:findTableView]) {
+            PDFDestination *dest = [[[findArrayController arrangedObjects] 
objectAtIndex:row] destination];
+            [[SKPDFToolTipWindow sharedToolTipWindow] showForPDFContext:dest 
atPoint:NSZeroPoint];
+        } else if ([tv isEqual:groupedFindTableView]) {
+            PDFDestination *dest = [[[[[groupedFindArrayController 
arrangedObjects] objectAtIndex:row] matches] objectAtIndex:0] destination];
+            [[SKPDFToolTipWindow sharedToolTipWindow] showForPDFContext:dest 
atPoint:NSZeroPoint];
+        }
     }
 }
 
 - (void)tableView:(NSTableView *)tv mouseExitedTableColumn:(NSTableColumn 
*)aTableColumn row:(NSInteger)row {
-    if ([tv isEqual:findTableView]) {
-        [[SKPDFToolTipWindow sharedToolTipWindow] fadeOut];
-    } else if ([tv isEqual:groupedFindTableView]) {
-        [[SKPDFToolTipWindow sharedToolTipWindow] fadeOut];
+    if ([NSApp isActive] && [[NSUserDefaults standardUserDefaults] 
boolForKey:SKDisableTableToolTipsKey] == NO) { 
+        if ([tv isEqual:findTableView]) {
+            [[SKPDFToolTipWindow sharedToolTipWindow] fadeOut];
+        } else if ([tv isEqual:groupedFindTableView]) {
+            [[SKPDFToolTipWindow sharedToolTipWindow] fadeOut];
+        }
     }
 }
 
@@ -912,13 +889,13 @@
 }
 
 - (void)outlineView:(NSOutlineView *)ov mouseEnteredTableColumn:(NSTableColumn 
*)aTableColumn item:(id)item {
-    if ([ov isEqual:outlineView]) {
-        [self showToolTipForDestination:[item destination]];
+    if ([ov isEqual:outlineView] && [NSApp isActive] && [[NSUserDefaults 
standardUserDefaults] boolForKey:SKDisableTableToolTipsKey] == NO) { 
+        [[SKPDFToolTipWindow sharedToolTipWindow] showForPDFContext:[item 
destination] atPoint:NSZeroPoint];
     }
 }
 
 - (void)outlineView:(NSOutlineView *)ov mouseExitedTableColumn:(NSTableColumn 
*)aTableColumn item:(id)item {
-    if ([ov isEqual:outlineView]) {
+    if ([ov isEqual:outlineView] && [NSApp isActive] && [[NSUserDefaults 
standardUserDefaults] boolForKey:SKDisableTableToolTipsKey] == NO) { 
         [[SKPDFToolTipWindow sharedToolTipWindow] fadeOut];
     }
 }

Modified: trunk/SKPDFToolTipWindow.m
===================================================================
--- trunk/SKPDFToolTipWindow.m  2009-08-09 15:18:26 UTC (rev 5526)
+++ trunk/SKPDFToolTipWindow.m  2009-08-09 21:40:09 UTC (rev 5527)
@@ -204,11 +204,14 @@
         
         PDFDestination *dest = nil;
         PDFPage *page;
+        NSPoint offset = NSZeroPoint;
         
-        if ([context isKindOfClass:[PDFDestination class]])
+        if ([context isKindOfClass:[PDFDestination class]]) {
             dest = context;
-        else if ([context isKindOfClass:[PDFAnnotationLink class]])
+            offset = NSMakePoint(-50.0, 20.0);
+        } else if ([context isKindOfClass:[PDFAnnotationLink class]]) {
             dest = [context destination];
+        }
         
         if (page = [dest page]) {
             
@@ -237,9 +240,10 @@
             
             bounds = [transform transformRect:bounds];
             
-            sourceRect.origin = [transform transformPoint:[dest point]];
+            sourceRect.origin = SKAddPoints([transform transformPoint:[dest 
point]], offset);
             sourceRect.origin.y -= NSHeight(sourceRect);
             
+            
             if ([selection string]) {
                 NSRect selBounds = [transform transformRect:[selection 
boundsForPage:page]];
                 CGFloat top = SKCeil(SKMax(NSMaxY(selBounds), 
NSMinX(selBounds) + NSHeight(sourceRect)));


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

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to