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

version 1.8, 2002/02/10 00:29:08 version 1.13, 2002/02/11 15:15:50
Line 172 Line 172
     }       } 
 }  }
   
   - (BOOL)outlineView:(NSOutlineView *)outlineView shouldEditTableColumn:(NSTableColumn *)tableColumn item:(id)item
   {
       return NO;
   }
   
 - (id)outlineView:(NSOutlineView *)outlineView child:(int)index ofItem:(id)item  - (id)outlineView:(NSOutlineView *)outlineView child:(int)index ofItem:(id)item
 {  {
     if (!mBookmarks)      if (!mBookmarks)
Line 222 Line 227
   
 - (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item  - (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item
 {  {
    if (!item)    NSString                                    *columnName = [tableColumn identifier];
        return nil;    NSMutableAttributedString       *cellValue = [[NSMutableAttributedString alloc] init];
        NSFileWrapper                               *fileWrapper = [[NSFileWrapper alloc] initRegularFileWithContents:nil];
    NSString* columnName = [tableColumn identifier];    NSTextAttachment                    *textAttachment = [[NSTextAttachment alloc] initWithFileWrapper:fileWrapper];
          NSMutableAttributedString   *attachmentAttrString = nil;
     NSCell                                              *attachmentAttrStringCell;
 
     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);
        return [NSString stringWithCString: cStr.get()];        
         //Set cell's textual contents
         [cellValue replaceCharactersInRange:NSMakeRange(0, [cellValue length])
                                  withString:[NSString stringWithCString: cStr.get()]];
         
         //Create an attributed string to hold the empty attachment, then release the components.
         attachmentAttrString = [[NSMutableAttributedString attributedStringWithAttachment:textAttachment] retain];
         [textAttachment release];
         [fileWrapper release];
 
         //Get the cell of the text attachment.
         attachmentAttrStringCell = (NSCell *)[(NSTextAttachment *)[attachmentAttrString attribute:NSAttachmentAttributeName
                                                                                           atIndex:0
                                                                                    effectiveRange:nil] attachmentCell];
         //Figure out which image to add, and set the cell's image.
         if ( [self outlineView:outlineView isItemExpandable:item] ) {
             [attachmentAttrStringCell setImage:[NSImage imageNamed:@"folder"]];
         } else {
             [attachmentAttrStringCell setImage:[NSImage imageNamed:@"smallDocument"]];
         }
         //Insert the image
         [cellValue replaceCharactersInRange:NSMakeRange(0, 0) withAttributedString:attachmentAttrString];
         
         //Tweak the baseline to vertically center the text.
         [cellValue addAttribute:NSBaselineOffsetAttributeName
                           value:[NSNumber numberWithFloat:-3.0]
                           range:NSMakeRange(0, 1)];
     }      }
        return cellValue;
    return nil; 
 }  }
   
 - (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.8  
changed lines
  Added in v.1.13


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