Hello all,

NSMenuItemCell

pico ./Bundles/Camaelon/NSMenuItemCell.m

- (void)drawKeyEquivalentWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
{
cellFrame = [self keyEquivalentRectForBounds:cellFrame];


if ([_menuItem hasSubmenu])
{
NSSize size;
NSPoint position;

+ if (!arrowImageCurrent) return; // <-------- add this


size = [arrowImageCurrent size];
...
}


NSBrowserCell

pico ./Bundles/Camaelon/NSBrowserCell.m

- (void) drawInteriorWithFrame: (NSRect)cellFrame inView: (NSView *)controlView
{
NSRect title_rect = cellFrame;
NSImage *branch_image = nil;
NSImage *cell_image = nil;
NSColor *backColor;
NSWindow *cvWin = [controlView window];
BOOL showsFirstResponder;

// if (!cvWin) return;


if (_cell.is_highlighted || _cell.state)
{
// backColor = [self highlightColorInView: controlView];
backColor = [NSColor selectedRowBackgroundColor]; // <---------
[backColor set];
if (!_browsercell_is_leaf)
branch_image = [isa highlightedBranchImage];
cell_image = [self image];
}
else
{
backColor = [NSColor rowBackgroundColor];
[backColor set];
if (!_browsercell_is_leaf)
branch_image = [isa branchImage];
cell_image = [self image];
}
// Clear the background
// NSRectFill(cellFrame);

NSRectFill(cellFrame);

showsFirstResponder = _cell.shows_first_responder;

// Draw the branch image if there is one
if (branch_image)
{
NSSize size;
NSPoint position;

size = [branch_image size];
position.x = MAX(NSMaxX(title_rect) - size.width - 4.0, 0.);
position.y = MAX(NSMidY(title_rect) - (size.height/2.), 0.);
/*
* Images are always drawn with their bottom-left corner at the origin
* so we must adjust the position to take account of a flipped view.
*/
if ([controlView isFlipped])
position.y += size.height;
[branch_image compositeToPoint: position operation: NSCompositeSourceOver];

title_rect.size.width -= size.width + 8;
}
/*{
NSRect image_rect;

image_rect.origin = cellFrame.origin;
image_rect.size = [image size];
image_rect.origin.x += cellFrame.size.width - image_rect.size.width - 4.0;
image_rect.origin.y
+= (cellFrame.size.height - image_rect.size.height) / 2.0;


// * Images are always drawn with their bottom-left corner at the origin
// * so we must adjust the position to take account of a flipped view.


if ([controlView isFlipped])
image_rect.origin.y += image_rect.size.height;
[branch_image compositeToPoint: image_rect.origin
operation: NSCompositeSourceOver];

title_rect.size.width -= image_rect.size.width + 8;
}*/

// Skip 2 points from the left border
title_rect.origin.x += 2;
title_rect.size.width -= 2;

// Draw the cell image if there is one
if (cell_image)
{
NSSize size;
NSPoint position;


size = [cell_image size];
position.x = NSMinX(title_rect);
position.y = MAX(NSMidY(title_rect) - (size.height/2.),0.);
if ([controlView isFlipped])
position.y += size.height;
[cell_image compositeToPoint: position operation: NSCompositeSourceOver];

title_rect.origin.x += size.width + 4;
title_rect.size.width -= size.width + 4;
}





// Draw the body of the cell
[self _drawAttributedText: [self attributedStringValue]
inFrame: title_rect];

if (_cell.shows_first_responder == YES)
NSDottedFrameRect(cellFrame);

/* // Draw the body of the cell
if ((_cell.type == NSImageCellType)
&& (_cell.is_highlighted || _cell.state)
&& _alternateImage)
{
// Draw the alternateImage
NSSize size;
NSPoint position;

size = [_alternateImage size];
position.x = MAX(NSMidX(title_rect) - (size.width/2.),0.);
position.y = MAX(NSMidY(title_rect) - (size.height/2.),0.);
if ([controlView isFlipped])
position.y += size.height;
[_alternateImage compositeToPoint: position
operation: NSCompositeSourceOver];
}
else
{
// Draw image, or text
_cell.shows_first_responder = NO;

[super drawInteriorWithFrame: title_rect inView: controlView];
}

if (showsFirstResponder == YES)
{
NSBezierPath* path = [NSBezierPath bezierPath];
NSRect rect = NSMakeRect (cellFrame.origin.x + 1, cellFrame.origin.y + 1, cellFrame.size.width - 2, cellFrame.size.height - 2);
[path appendBezierPathWithRoundedRectangle: rect withRadius: 4.0];
[[NSColor colorWithCalibratedRed: 0.4 green: 0.4 blue: 0.4 alpha: 1.0] set];
[path setLineWidth: 2];
// [path stroke];
// NSDottedFrameRect(cellFrame);
}*/
_cell.shows_first_responder = showsFirstResponder;
}

NSTableView
Comment out the setTexColor: lines to reenable - (void)tableView:(NSTableView *)tableView willDisplayCell:(id)cell forTableColumn:(NSTableColumn *)tableColumn object:(SOObject *)object.

- (void) drawRow: (int)rowIndex clipRect: (NSRect)clipRect
{
...

for (i = startingColumn; i <= endingColumn; i++)
{
if (i != _editedColumn || rowIndex != _editedRow)
{
tb = [_tableColumns objectAtIndex: i];
cell = [tb dataCellForRow: rowIndex];
[self _willDisplayCell: cell
forTableColumn: tb
row: rowIndex];
[cell setObjectValue: [_dataSource tableView: self
objectValueForTableColumn: tb
row: rowIndex]];
drawingRect = [self frameOfCellAtColumn: i
row: rowIndex];
if ([_selectedRows containsIndex: rowIndex])
{
if ([cell respondsToSelector: @selector(setTextColor:)])
{
[cell setHighlighted: YES];
// [cell setTextColor: [NSColor selectedRowTextColor]]; // <-- don't do this
}
}
else
{
[cell setHighlighted: NO];
// if ([cell respondsToSelector: @selector(setTextColor:)]) // <--- don't do this
// [cell setTextColor: [NSColor rowTextColor]];
}
[cell drawWithFrame: drawingRect inView: self];
}
}
}

NSColor
selectedRowBackgroundColor and selectedTextBackgroundColor should not be the same.

+ (NSColor*) selectedTextBackgroundColor
{

if (selectedTextBackgroundColor == nil)
{
selectedTextBackgroundColor = [GraphicToolbox readColorFromImage:
[NSImage imageNamed: @"Colors/Colors-selected-text-background.tiff"]];
// [selectedTextBackgroundColor retain];

float red, green, blue, alpha, factor = 1.4;
[selectedTextBackgroundColor getRed:&red green:&green blue:&blue alpha:&alpha];
red = MIN(1.0, factor * red);
green = MIN(1.0, factor * green);
blue = MIN(1.0, factor * blue);
selectedTextBackgroundColor = [[NSColor colorWithDeviceRed:red green:green blue:blue alpha:alpha] retain];
}
return selectedTextBackgroundColor;
}


Regards,

Andreas
_______________________________________________
Etoile-discuss mailing list
[email protected]
https://mail.gna.org/listinfo/etoile-discuss

Répondre à