Cell modifications to remove unecessary images/color changes.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@17406 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
michael 2003-07-31 20:47:00 +00:00
parent 97c4ec53d8
commit 766b747938
10 changed files with 27 additions and 39 deletions

View file

@ -1,3 +1,24 @@
2003-07-31 Michael Hanni <mhanni@yahoo.com>
* Source/NSBrowserCell.m (drawInteriorWithFrame:inView:): Remove
unnecessary code to set the background of an image.
* Source/NSButtonCell.m: ditto.
* Source/NSMenuItemCell.m: remove usage of system image
"common_3DArrowRightH" as it is unneeded.
(drawImageWithFrame:inView:): remove unnecessary code to set the
background of an image.
(drawKeyEquivalentWithFrame:inView:): ditto.
(drawStateImageWithFrame:inView:): ditto.
* Source/NSScroller.m: remove usage of system images
(common_ArrowUpH, common_ArrowDownH, common_ArrowLeftH,
common_ArrowRightH) as they are unnecessary.
(drawParts): reset HighlightsBy: code for all the cells, remove
all the alternate images.
* Source/NSTableHeaderCell.m (drawInteriorWithFrame:inView:):
remove unnecessary call to set the background of an image.
* Images/(common_ArrowUpH, common_ArrowDownH, common_ArrowLeftH,
common_ArrowRightH).tiff: removed.
2003-07-31 Yen-Ju Chen <yjchenx@hotmail.com> 2003-07-31 Yen-Ju Chen <yjchenx@hotmail.com>
* Documentation/Gui/LanguageSetup.gsdoc: Updated. * Documentation/Gui/LanguageSetup.gsdoc: Updated.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -260,7 +260,6 @@ static NSFont *_leafFont;
image_rect.origin.x += cellFrame.size.width - image_rect.size.width - 4.0; image_rect.origin.x += cellFrame.size.width - image_rect.size.width - 4.0;
image_rect.origin.y image_rect.origin.y
+= (cellFrame.size.height - image_rect.size.height) / 2.0; += (cellFrame.size.height - image_rect.size.height) / 2.0;
[image setBackgroundColor: backColor];
/* /*
* Images are always drawn with their bottom-left corner at the origin * 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. * so we must adjust the position to take account of a flipped view.

View file

@ -718,12 +718,6 @@
if (imageToDisplay) if (imageToDisplay)
{ {
/* FIXME - the following is a hack! Because we don't seem to be
getting alpha composing of images right, we use this hack of
hard-setting manually the background color of the image to
the wanted background color ... this should go away when
alpha composing of images works 100%. */
[imageToDisplay setBackgroundColor: backgroundColor];
imageSize = [imageToDisplay size]; imageSize = [imageToDisplay size];
} }

View file

@ -47,7 +47,6 @@
static Class colorClass = 0; /* Cache color class. */ static Class colorClass = 0; /* Cache color class. */
static NSImage *arrowImage = nil; /* Cache arrow image. */ static NSImage *arrowImage = nil; /* Cache arrow image. */
static NSImage *arrowImageH = nil;
+ (void) initialize + (void) initialize
@ -57,7 +56,6 @@ static NSImage *arrowImageH = nil;
[self setVersion: 2]; [self setVersion: 2];
colorClass = [NSColor class]; colorClass = [NSColor class];
arrowImage = [[NSImage imageNamed: @"common_3DArrowRight"] copy]; arrowImage = [[NSImage imageNamed: @"common_3DArrowRight"] copy];
arrowImageH = [[NSImage imageNamed: @"common_3DArrowRightH"] copy];
} }
} }
@ -387,8 +385,6 @@ static NSImage *arrowImageH = nil;
if ([controlView isFlipped]) if ([controlView isFlipped])
position.y += size.height; position.y += size.height;
if (nil != _backgroundColor)
[_imageToDisplay setBackgroundColor: _backgroundColor];
[_imageToDisplay compositeToPoint: position operation: NSCompositeSourceOver]; [_imageToDisplay compositeToPoint: position operation: NSCompositeSourceOver];
} }
@ -401,13 +397,8 @@ static NSImage *arrowImageH = nil;
{ {
NSSize size; NSSize size;
NSPoint position; NSPoint position;
NSImage *imageToDraw;
if (_cell.is_highlighted) size = [arrowImage size];
imageToDraw = arrowImageH;
else
imageToDraw = arrowImage;
size = [imageToDraw size];
position.x = cellFrame.origin.x + cellFrame.size.width - size.width; position.x = cellFrame.origin.x + cellFrame.size.width - size.width;
position.y = MAX(NSMidY(cellFrame) - (size.height/2.), 0.); position.y = MAX(NSMidY(cellFrame) - (size.height/2.), 0.);
/* /*
@ -417,9 +408,7 @@ static NSImage *arrowImageH = nil;
if ([controlView isFlipped]) if ([controlView isFlipped])
position.y += size.height; position.y += size.height;
if (nil != _backgroundColor) [arrowImage compositeToPoint: position operation: NSCompositeSourceOver];
[imageToDraw setBackgroundColor: _backgroundColor];
[imageToDraw compositeToPoint: position operation: NSCompositeSourceOver];
} }
/* FIXME/TODO here - decide a consistent policy for images. /* FIXME/TODO here - decide a consistent policy for images.
* *
@ -490,10 +479,6 @@ static NSImage *arrowImageH = nil;
position.y += size.height; position.y += size.height;
} }
if (nil != _backgroundColor)
{
[imageToDisplay setBackgroundColor: _backgroundColor];
}
[imageToDisplay compositeToPoint: position operation: NSCompositeSourceOver]; [imageToDisplay compositeToPoint: position operation: NSCompositeSourceOver];
} }

View file

@ -242,36 +242,32 @@ static NSColor *scrollBarColor = nil;
return; return;
upCell = [NSButtonCell new]; upCell = [NSButtonCell new];
[upCell setHighlightsBy: NSChangeBackgroundCellMask|NSContentsCellMask]; [upCell setHighlightsBy: NSChangeBackgroundCellMask];
[upCell setImage: [NSImage imageNamed: @"common_ArrowUp"]]; [upCell setImage: [NSImage imageNamed: @"common_ArrowUp"]];
[upCell setAlternateImage: [NSImage imageNamed: @"common_ArrowUpH"]];
[upCell setImagePosition: NSImageOnly]; [upCell setImagePosition: NSImageOnly];
[upCell setContinuous: YES]; [upCell setContinuous: YES];
[upCell sendActionOn: (NSLeftMouseDownMask | NSPeriodicMask)]; [upCell sendActionOn: (NSLeftMouseDownMask | NSPeriodicMask)];
[upCell setPeriodicDelay: 0.3 interval: 0.03]; [upCell setPeriodicDelay: 0.3 interval: 0.03];
downCell = [NSButtonCell new]; downCell = [NSButtonCell new];
[downCell setHighlightsBy: NSChangeBackgroundCellMask|NSContentsCellMask]; [downCell setHighlightsBy: NSChangeBackgroundCellMask];
[downCell setImage: [NSImage imageNamed: @"common_ArrowDown"]]; [downCell setImage: [NSImage imageNamed: @"common_ArrowDown"]];
[downCell setAlternateImage: [NSImage imageNamed: @"common_ArrowDownH"]];
[downCell setImagePosition: NSImageOnly]; [downCell setImagePosition: NSImageOnly];
[downCell setContinuous: YES]; [downCell setContinuous: YES];
[downCell sendActionOn: (NSLeftMouseDownMask | NSPeriodicMask)]; [downCell sendActionOn: (NSLeftMouseDownMask | NSPeriodicMask)];
[downCell setPeriodicDelay: 0.3 interval: 0.03]; [downCell setPeriodicDelay: 0.3 interval: 0.03];
leftCell = [NSButtonCell new]; leftCell = [NSButtonCell new];
[leftCell setHighlightsBy: NSChangeBackgroundCellMask|NSContentsCellMask]; [leftCell setHighlightsBy: NSChangeBackgroundCellMask];
[leftCell setImage: [NSImage imageNamed: @"common_ArrowLeft"]]; [leftCell setImage: [NSImage imageNamed: @"common_ArrowLeft"]];
[leftCell setAlternateImage: [NSImage imageNamed: @"common_ArrowLeftH"]];
[leftCell setImagePosition: NSImageOnly]; [leftCell setImagePosition: NSImageOnly];
[leftCell setContinuous: YES]; [leftCell setContinuous: YES];
[leftCell sendActionOn: (NSLeftMouseDownMask | NSPeriodicMask)]; [leftCell sendActionOn: (NSLeftMouseDownMask | NSPeriodicMask)];
[leftCell setPeriodicDelay: 0.3 interval: 0.03]; [leftCell setPeriodicDelay: 0.3 interval: 0.03];
rightCell = [NSButtonCell new]; rightCell = [NSButtonCell new];
[rightCell setHighlightsBy: NSChangeBackgroundCellMask|NSContentsCellMask]; [rightCell setHighlightsBy: NSChangeBackgroundCellMask];
[rightCell setImage: [NSImage imageNamed: @"common_ArrowRight"]]; [rightCell setImage: [NSImage imageNamed: @"common_ArrowRight"]];
[rightCell setAlternateImage: [NSImage imageNamed: @"common_ArrowRightH"]];
[rightCell setImagePosition: NSImageOnly]; [rightCell setImagePosition: NSImageOnly];
[rightCell setContinuous: YES]; [rightCell setContinuous: YES];
[rightCell sendActionOn: (NSLeftMouseDownMask | NSPeriodicMask)]; [rightCell sendActionOn: (NSLeftMouseDownMask | NSPeriodicMask)];

View file

@ -165,13 +165,6 @@ static NSColor *clearCol = nil;
bg = hbgCol; bg = hbgCol;
[bg set]; [bg set];
NSRectFill (cellFrame); NSRectFill (cellFrame);
if (_cell_image)
[_cell_image setBackgroundColor: bg];
}
else
{
if (_cell_image)
[_cell_image setBackgroundColor: clearCol];
} }
// Draw the image // Draw the image
if (_cell_image) if (_cell_image)