Revision: 3576
http://skim-app.svn.sourceforge.net/skim-app/?rev=3576&view=rev
Author: hofman
Date: 2008-03-29 04:18:14 -0700 (Sat, 29 Mar 2008)
Log Message:
-----------
Copy text for all selected notes.
Modified Paths:
--------------
trunk/SKMainWindowController.m
Modified: trunk/SKMainWindowController.m
===================================================================
--- trunk/SKMainWindowController.m 2008-03-29 04:05:25 UTC (rev 3575)
+++ trunk/SKMainWindowController.m 2008-03-29 11:18:14 UTC (rev 3576)
@@ -3876,29 +3876,49 @@
- (void)outlineView:(NSOutlineView *)ov copyItems:(NSArray *)items {
if ([ov isEqual:noteOutlineView] && [items count]) {
- NSEnumerator *itemEnum = [[self noteItems:items] objectEnumerator];
- PDFAnnotation *item = nil;
- id firstItem = [items objectAtIndex:0];
- while (item = [itemEnum nextObject])
- if ([item isMovable]) break;
NSPasteboard *pboard = [NSPasteboard generalPasteboard];
NSMutableArray *types = [NSMutableArray array];
- NSData *noteData = item ? [NSKeyedArchiver
archivedDataWithRootObject:[item dictionaryValue]] : nil;
- NSAttributedString *attrString = [firstItem type] ? nil : [(SKNoteText
*)firstItem string];
- NSString *string = [firstItem type] ? [firstItem string] : [attrString
string];
+ NSData *noteData = nil;
+ NSMutableAttributedString *attrString = [[items valueForKey:@"type"]
containsObject:[NSNull null]] ? [[[NSMutableAttributedString alloc] init]
autorelease] : nil;
+ NSMutableString *string = [NSMutableString string];
+ NSEnumerator *itemEnum;
+ id item;
+
+ itemEnum = [[self noteItems:items] objectEnumerator];
+ while (item = [itemEnum nextObject]) {
+ if ([item isMovable]) {
+ noteData = [NSKeyedArchiver archivedDataWithRootObject:[item
dictionaryValue]];
+ [types addObject:SKSkimNotePboardType];
+ break;
+ }
+ }
+ itemEnum = [items objectEnumerator];
+ while (item = [itemEnum nextObject]) {
+ if ([string length])
+ [string appendString:@"\n\n"];
+ if ([attrString length])
+ [attrString replaceCharactersInRange:NSMakeRange([attrString
length], 0) withString:@"\n\n"];
+ if ([item type]) {
+ [string appendString:[item string]];
+ [attrString replaceCharactersInRange:NSMakeRange([attrString
length], 0) withString:[item string]];
+ } else {
+ [string appendString:[[(SKNoteText *)item string] string]];
+ [attrString appendAttributedString:[(SKNoteText *)item
string]];
+ }
+ }
if (noteData)
[types addObject:SKSkimNotePboardType];
- if (string)
+ if ([string length])
[types addObject:NSStringPboardType];
- if (attrString)
+ if ([attrString length])
[types addObject:NSRTFPboardType];
if ([types count])
[pboard declareTypes:types owner:nil];
if (noteData)
[pboard setData:noteData forType:SKSkimNotePboardType];
- if (string)
+ if ([string length])
[pboard setString:string forType:NSStringPboardType];
- if (attrString)
+ if ([attrString length])
[pboard setData:[attrString RTFFromRange:NSMakeRange(0, [string
length]) documentAttributes:nil] forType:NSRTFPboardType];
}
}
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://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit