Revision: 2787
          http://skim-app.svn.sourceforge.net/skim-app/?rev=2787&view=rev
Author:   hofman
Date:     2007-08-30 11:11:48 -0700 (Thu, 30 Aug 2007)

Log Message:
-----------
Show tooltip preview in tables offset from item destination. 

Use correct outlineView to select an item for a contextual menu.

Modified Paths:
--------------
    trunk/SKFindTableView.m
    trunk/SKMainWindowController.m

Modified: trunk/SKFindTableView.m
===================================================================
--- trunk/SKFindTableView.m     2007-08-30 17:19:50 UTC (rev 2786)
+++ trunk/SKFindTableView.m     2007-08-30 18:11:48 UTC (rev 2787)
@@ -77,7 +77,7 @@
                for (row = rowRange.location; row < NSMaxRange(rowRange); 
row++) {
             if ([[self delegate] tableView:self 
shouldTrackTableColumn:tableColumn row:row]) {
                 userData = row * [self numberOfColumns] + column;
-                tag = [self addTrackingRect:[self frameOfCellAtColumn:column 
row:row] owner:self userData:NULL assumeInside:NO];
+                tag = [self addTrackingRect:[self frameOfCellAtColumn:column 
row:row] owner:self userData:(void *)userData assumeInside:NO];
                 CFArrayAppendValue(trackingRects, (const void *)tag);
             }
         }
@@ -120,10 +120,8 @@
         int numCols = [self numberOfColumns];
                int column = userData % numCols;
                int row = userData / numCols;
-        if (column != -1 && row != -1) {
-            NSTableColumn *tableColumn = [[self tableColumns] 
objectAtIndex:column];
-            [[self delegate] tableView:self 
mouseEnteredTableColumn:tableColumn row:row];
-        }
+        NSTableColumn *tableColumn = [[self tableColumns] 
objectAtIndex:column];
+        [[self delegate] tableView:self mouseEnteredTableColumn:tableColumn 
row:row];
        }
 }
 
@@ -133,10 +131,8 @@
         int numCols = [self numberOfColumns];
                int column = userData % numCols;
                int row = userData / numCols;
-        if (column != -1 && row != -1) {
-            NSTableColumn *tableColumn = [[self tableColumns] 
objectAtIndex:column];
-            [[self delegate] tableView:self mouseExitedTableColumn:tableColumn 
row:row];
-        }
+        NSTableColumn *tableColumn = [[self tableColumns] 
objectAtIndex:column];
+        [[self delegate] tableView:self mouseExitedTableColumn:tableColumn 
row:row];
        }
 }
 

Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m      2007-08-30 17:19:50 UTC (rev 2786)
+++ trunk/SKMainWindowController.m      2007-08-30 18:11:48 UTC (rev 2787)
@@ -3379,18 +3379,26 @@
     return nil;
 }
 
-- (BOOL)outlineView:(NSOutlineView *)anOutlineView 
shouldTrackTableColumn:(NSTableColumn *)aTableColumn item:(id)item {
+- (BOOL)outlineView:(NSOutlineView *)ov shouldTrackTableColumn:(NSTableColumn 
*)aTableColumn item:(id)item {
     return YES;
 }
 
-- (void)outlineView:(NSOutlineView *)anOutlineView 
mouseEnteredTableColumn:(NSTableColumn *)aTableColumn item:(id)item {
-    PDFAnnotationLink *link = [[[PDFAnnotationLink alloc] 
initWithBounds:NSZeroRect] autorelease];
-    [link setDestination:[item destination]];
-    [[SKPDFHoverWindow sharedHoverWindow] showForAnnotation:link 
atPoint:NSZeroPoint];
+- (void)outlineView:(NSOutlineView *)ov mouseEnteredTableColumn:(NSTableColumn 
*)aTableColumn item:(id)item {
+    if ([ov isEqual:outlineView]) {
+        PDFAnnotationLink *link = [[[PDFAnnotationLink alloc] 
initWithBounds:NSZeroRect] autorelease];
+        PDFDestination *dest = [item destination];
+        NSPoint point = [dest point];
+        point.x -= 50.0;
+        point.y += 20.0;
+        [link setDestination:[[[PDFDestination alloc] initWithPage:[dest page] 
atPoint:point] autorelease]];
+        [[SKPDFHoverWindow sharedHoverWindow] showForAnnotation:link 
atPoint:NSZeroPoint];
+    }
 }
 
-- (void)outlineView:(NSOutlineView *)anOutlineView 
mouseExitedTableColumn:(NSTableColumn *)aTableColumn item:(id)item {
-    [[SKPDFHoverWindow sharedHoverWindow] hide];
+- (void)outlineView:(NSOutlineView *)ov mouseExitedTableColumn:(NSTableColumn 
*)aTableColumn item:(id)item {
+    if ([ov isEqual:outlineView]) {
+        [[SKPDFHoverWindow sharedHoverWindow] hide];
+    }
 }
 
 - (void)deleteNote:(id)sender {
@@ -3417,7 +3425,7 @@
     NSMenuItem *menuItem;
     
     if ([ov isEqual:noteOutlineView]) {
-        [outlineView selectRowIndexes:[NSIndexSet 
indexSetWithIndex:[outlineView rowForItem:item]] byExtendingSelection:NO];
+        [noteOutlineView selectRowIndexes:[NSIndexSet 
indexSetWithIndex:[noteOutlineView rowForItem:item]] byExtendingSelection:NO];
         
         PDFAnnotation *annotation = [item type] ? item : [(SKNoteText *)item 
annotation];
         menu = [[[NSMenu allocWithZone:[NSMenu menuZone]] init] autorelease];
@@ -3571,10 +3579,11 @@
 - (void)tableView:(NSTableView *)tv mouseEnteredTableColumn:(NSTableColumn 
*)aTableColumn row:(int)row {
     if ([tv isEqual:findTableView]) {
         PDFAnnotationLink *link = [[[PDFAnnotationLink alloc] 
initWithBounds:NSZeroRect] autorelease];
-        PDFSelection *selection = [[[findArrayController arrangedObjects] 
objectAtIndex:row] copy];
-        [selection extendSelectionAtStart:10];
-        [link setDestination:[selection destination]];
-        [selection release];
+        PDFDestination *dest = [[[findArrayController arrangedObjects] 
objectAtIndex:row] destination];
+        NSPoint point = [dest point];
+        point.x -= 50.0;
+        point.y += 20.0;
+        [link setDestination:[[[PDFDestination alloc] initWithPage:[dest page] 
atPoint:point] autorelease]];
         [[SKPDFHoverWindow sharedHoverWindow] showForAnnotation:link 
atPoint:NSZeroPoint];
     }
 }


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: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to