Revision: 3592 http://skim-app.svn.sourceforge.net/skim-app/?rev=3592&view=rev Author: hofman Date: 2008-04-02 04:44:29 -0700 (Wed, 02 Apr 2008)
Log Message: ----------- Use key "text" for attributed string of note text proxy object. Modified Paths: -------------- trunk/SKMainWindowController.m trunk/SKPDFAnnotationNote.h trunk/SKPDFAnnotationNote.m Modified: trunk/SKMainWindowController.m =================================================================== --- trunk/SKMainWindowController.m 2008-04-02 11:19:14 UTC (rev 3591) +++ trunk/SKMainWindowController.m 2008-04-02 11:44:29 UTC (rev 3592) @@ -3847,7 +3847,7 @@ } else if ([ov isEqual:noteOutlineView]) { NSString *tcID = [tableColumn identifier]; if ([tcID isEqualToString:@"note"]) { - return [item string]; + return [item type] ? (id)[item text] : (id)[item string]; } else if([tcID isEqualToString:@"type"]) { return [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:item == [pdfView activeAnnotation]], @"active", [item type], @"type", nil]; } else if([tcID isEqualToString:@"page"]) { @@ -3860,7 +3860,7 @@ - (void)outlineView:(NSOutlineView *)ov setObjectValue:(id)object forTableColumn:(NSTableColumn *)tableColumn byItem:(id)item{ if ([ov isEqual:noteOutlineView]) { if ([[tableColumn identifier] isEqualToString:@"note"]) { - if ([object isEqualToString:[item string]] == NO) + if ([item type] && [object isEqualToString:[item string]] == NO) [item setString:object]; } } @@ -3931,7 +3931,7 @@ - (NSString *)outlineView:(NSOutlineView *)ov toolTipForCell:(NSCell *)cell rect:(NSRectPointer)rect tableColumn:(NSTableColumn *)tableColumn item:(id)item mouseLocation:(NSPoint)mouseLocation { if ([ov isEqual:noteOutlineView] && [[tableColumn identifier] isEqualToString:@"note"]) { - return [item type] ? [(PDFAnnotation *)item string] : [[(SKNoteText *)item string] string]; + return [item string]; } return nil; } @@ -4034,13 +4034,11 @@ [string appendString:@"\n\n"]; if ([attrString length]) [attrString replaceCharactersInRange:NSMakeRange([attrString length], 0) withString:@"\n\n"]; - if ([item type]) { - [string appendString:[item string]]; + [string appendString:[item string]]; + if ([item type]) [attrString replaceCharactersInRange:NSMakeRange([attrString length], 0) withString:[item string]]; - } else { - [string appendString:[[(SKNoteText *)item string] string]]; - [attrString appendAttributedString:[(SKNoteText *)item string]]; - } + else + [attrString appendAttributedString:[(SKNoteText *)item text]]; } if (noteData) [types addObject:SKSkimNotePboardType]; @@ -4140,7 +4138,7 @@ for (i = 0; i < count; i++) { item = [items objectAtIndex:i]; - [cell setObjectValue:[item string]]; + [cell setObjectValue:[item type] ? (id)[item string] : (id)[item text]]; NSAttributedString *attrString = [cell attributedStringValue]; NSRect rect = [attrString boundingRectWithSize:[item type] ? size : smallSize options:NSStringDrawingUsesLineFragmentOrigin]; float height = fmaxf(NSHeight(rect) + 3.0, rowHeight + 2.0); @@ -4428,7 +4426,7 @@ NSMutableArray *texts = [NSMutableArray arrayWithCapacity:count]; for (i = 0; i < count; i++) { id item = [noteOutlineView itemAtRow:i]; - NSString *string = [item type] ? [(PDFAnnotation *)item string] : [[(SKNoteText *)item string] string]; + NSString *string = [item string]; [texts addObject:string ? string : @""]; } return texts; Modified: trunk/SKPDFAnnotationNote.h =================================================================== --- trunk/SKPDFAnnotationNote.h 2008-04-02 11:19:14 UTC (rev 3591) +++ trunk/SKPDFAnnotationNote.h 2008-04-02 11:44:29 UTC (rev 3592) @@ -101,6 +101,7 @@ - (NSString *)type; - (PDFPage *)page; - (unsigned int)pageIndex; -- (NSAttributedString *)string; +- (NSString *)string; +- (NSAttributedString *)text; @end Modified: trunk/SKPDFAnnotationNote.m =================================================================== --- trunk/SKPDFAnnotationNote.m 2008-04-02 11:19:14 UTC (rev 3591) +++ trunk/SKPDFAnnotationNote.m 2008-04-02 11:44:29 UTC (rev 3592) @@ -235,11 +235,11 @@ - (void)textStorageDidProcessEditing:(NSNotification *)notification; { [self willChangeValueForKey:SKPDFAnnotationTextKey]; - [texts makeObjectsPerformSelector:@selector(willChangeValueForKey:) withObject:SKPDFAnnotationStringKey]; + [texts makeObjectsPerformSelector:@selector(willChangeValueForKey:) withObject:SKPDFAnnotationTextKey]; [text release]; text = [[NSAttributedString allocWithZone:[self zone]] initWithAttributedString:textStorage]; [self didChangeValueForKey:SKPDFAnnotationTextKey]; - [texts makeObjectsPerformSelector:@selector(didChangeValueForKey:) withObject:SKPDFAnnotationStringKey]; + [texts makeObjectsPerformSelector:@selector(didChangeValueForKey:) withObject:SKPDFAnnotationTextKey]; [self updateContents]; } @@ -350,8 +350,10 @@ - (PDFPage *)page { return nil; } +- (NSString *)string { return [[self text] string]; } + - (unsigned int)pageIndex { return [annotation pageIndex]; } -- (NSAttributedString *)string { return [annotation text]; } +- (NSAttributedString *)text { return [annotation text]; } @end 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 Skim-app-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/skim-app-commit