Diff for /chimera/BookmarksService.mm between versions 1.12 and 1.13

version 1.12, 2002/02/11 10:28:30 version 1.13, 2002/02/11 15:15:50
Line 227 Line 227
   
 - (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item  - (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item
 {  {
       NSString                                    *columnName = [tableColumn identifier];
     NSMutableAttributedString   *cellValue = [[NSMutableAttributedString alloc] init];      NSMutableAttributedString   *cellValue = [[NSMutableAttributedString alloc] init];
       NSFileWrapper                               *fileWrapper = [[NSFileWrapper alloc] initRegularFileWithContents:nil];
       NSTextAttachment                    *textAttachment = [[NSTextAttachment alloc] initWithFileWrapper:fileWrapper];
     NSMutableAttributedString   *attachmentAttrString = nil;      NSMutableAttributedString   *attachmentAttrString = nil;
    NSString                                    *columnName = [tableColumn identifier];    NSCell                                              *attachmentAttrStringCell;
    NSCell                                              *attachmentCell; 
   
    if ( item ) {    if ([columnName isEqualToString: @"name"]) {
        if ([columnName isEqualToString: @"name"]) {        nsIContent* content = [item contentNode];
            nsIContent* content = [item contentNode];        nsAutoString nameAttr;
            nsAutoString nameAttr;        content->GetAttr(kNameSpaceID_None, BookmarksService::gNameAtom, nameAttr);
            content->GetAttr(kNameSpaceID_None, BookmarksService::gNameAtom, nameAttr);        nsCAutoString cStr; cStr.AssignWithConversion(nameAttr);
            nsCAutoString cStr; cStr.AssignWithConversion(nameAttr);        
                    //Set cell's textual contents
        //set cell's textual contents        [cellValue replaceCharactersInRange:NSMakeRange(0, [cellValue length])
            [cellValue replaceCharactersInRange:NSMakeRange(0, [cellValue length])                                 withString:[NSString stringWithCString: cStr.get()]];
                                     withString:[NSString stringWithCString: cStr.get()]];        
                    //Create an attributed string to hold the empty attachment, then release the components.
        //Add image to cell's text in front of the text.        attachmentAttrString = [[NSMutableAttributedString attributedStringWithAttachment:textAttachment] retain];
            NSFileWrapper *wrapper = [[NSFileWrapper alloc] initRegularFileWithContents:nil];        [textAttachment release];
            NSTextAttachment *attachment = [[NSTextAttachment allocWithZone:NULL] initWithFileWrapper:wrapper];        [fileWrapper release];
            attachmentAttrString = [[NSMutableAttributedString attributedStringWithAttachment:attachment] retain];
            [attachment release];        //Get the cell of the text attachment.
            [wrapper release];        attachmentAttrStringCell = (NSCell *)[(NSTextAttachment *)[attachmentAttrString attribute:NSAttachmentAttributeName
                                                                                          atIndex:0
            attachmentCell = (NSCell *)[(NSTextAttachment *)[attachmentAttrString attribute:NSAttachmentAttributeName                                                                                   effectiveRange:nil] attachmentCell];
                                                                                    atIndex:0        //Figure out which image to add, and set the cell's image.
                                                                             effectiveRange:NULL] attachmentCell];        if ( [self outlineView:outlineView isItemExpandable:item] ) {
            [attachmentAttrStringCell setImage:[NSImage imageNamed:@"folder"]];
            [attachmentCell setImage:[NSImage imageNamed:@"folder"]];        } else {
            [cellValue replaceCharactersInRange:NSMakeRange(0, 0) withAttributedString:attachmentAttrString];            [attachmentAttrStringCell setImage:[NSImage imageNamed:@"smallDocument"]];
            [cellValue addAttribute:NSBaselineOffsetAttributeName 
                              value:[NSNumber numberWithFloat:-3.0] 
                              range:NSMakeRange(0, 1)]; 
        //Done adding image 
         }          }
        return cellValue;        //Insert the image
    } else {        [cellValue replaceCharactersInRange:NSMakeRange(0, 0) withAttributedString:attachmentAttrString];
        return nil;        
         //Tweak the baseline to vertically center the text.
         [cellValue addAttribute:NSBaselineOffsetAttributeName
                           value:[NSNumber numberWithFloat:-3.0]
                           range:NSMakeRange(0, 1)];
     }      }
       return cellValue;
 }  }
   
 - (void)outlineView:(NSOutlineView *)outlineView setObjectValue:(id)object forTableColumn:(NSTableColumn *)tableColumn byItem:(id)item  - (void)outlineView:(NSOutlineView *)outlineView setObjectValue:(id)object forTableColumn:(NSTableColumn *)tableColumn byItem:(id)item

Removed from v.1.12  
changed lines
  Added in v.1.13


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>