Revision: 4090
          http://skim-app.svn.sourceforge.net/skim-app/?rev=4090&view=rev
Author:   hofman
Date:     2008-06-28 05:42:48 -0700 (Sat, 28 Jun 2008)

Log Message:
-----------
Implement copy in find table views.

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

Modified: trunk/SKMainWindowController_UI.m
===================================================================
--- trunk/SKMainWindowController_UI.m   2008-06-28 00:07:58 UTC (rev 4089)
+++ trunk/SKMainWindowController_UI.m   2008-06-28 12:42:48 UTC (rev 4090)
@@ -58,6 +58,7 @@
 #import "SKPDFDocument.h"
 #import "PDFPage_SKExtensions.h"
 #import "SKGroupedSearchResult.h"
+#import "PDFSelection_SKExtensions.h"
 #import "NSString_SKExtensions.h"
 #import "SKApplication.h"
 #import "NSMenu_SKExtensions.h"
@@ -271,11 +272,40 @@
             [pboard setData:pdfData forType:NSPDFPboardType];
             [pboard setData:tiffData forType:NSTIFFPboardType];
         }
+    } else if ([tv isEqual:findTableView]) {
+        NSMutableString *string = [NSMutableString string];
+        unsigned int idx = [rowIndexes firstIndex];
+        while (idx != NSNotFound) {
+            PDFSelection *match = [searchResults objectAtIndex:idx];
+            [string appendString:@"* "];
+            [string appendFormat:NSLocalizedString(@"Page %@", @""), [match 
firstPageLabel]];
+            [string appendFormat:@": [EMAIL PROTECTED]", [[match 
contextString] string]];
+            idx = [rowIndexes indexGreaterThanIndex:idx];
+        }
+        NSPasteboard *pboard = [NSPasteboard generalPasteboard];
+        [pboard declareTypes:[NSArray arrayWithObjects:NSStringPboardType, 
nil] owner:nil];
+        [pboard setString:string forType:NSStringPboardType];
+    } else if ([tv isEqual:groupedFindTableView]) {
+        NSMutableString *string = [NSMutableString string];
+        unsigned int idx = [rowIndexes firstIndex];
+        while (idx != NSNotFound) {
+            SKGroupedSearchResult *result = [groupedSearchResults 
objectAtIndex:idx];
+            NSArray *matches = [result matches];
+            [string appendString:@"* "];
+            [string appendFormat:NSLocalizedString(@"Page %@", @""), [[result 
page] label]];
+            [string appendString:@": "];
+            [string appendFormat:NSLocalizedString(@"%i Results", @""), 
[matches count]];
+            [string appendFormat:@":[EMAIL PROTECTED]", [[matches 
valueForKeyPath:@"contextString.string"] componentsJoinedByString:@"\n\t"]];
+            idx = [rowIndexes indexGreaterThanIndex:idx];
+        }
+        NSPasteboard *pboard = [NSPasteboard generalPasteboard];
+        [pboard declareTypes:[NSArray arrayWithObjects:NSStringPboardType, 
nil] owner:nil];
+        [pboard setString:string forType:NSStringPboardType];
     }
 }
 
 - (BOOL)tableView:(NSTableView *)tv canCopyRowsWithIndexes:(NSIndexSet 
*)rowIndexes {
-    if ([tv isEqual:thumbnailTableView]) {
+    if ([tv isEqual:thumbnailTableView] || [tv isEqual:findTableView] || [tv 
isEqual:groupedFindTableView]) {
         return [rowIndexes count] > 0;
     }
     return NO;


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

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to