Fixes for system colors

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@4777 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 1999-08-31 09:19:39 +00:00
parent 7ecbd8da9d
commit a3c6189002
14 changed files with 1013 additions and 886 deletions

View file

@ -1,3 +1,32 @@
Tue Aug 31 9:45:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
Fixes to remove hard-coded colors from gui. I'm not sure this is
entirely correct - in places where we expect to display white text on
a dark-gray background, I've used windowFrameTextColor and
controlShadowColor, since the MacOS-X documentation doesn't seem to
specify anything exactly for this.
* NSBrowser.m: use windowFrameTextColor for title text and
controlShadowColor for background.
* NSClipView.m: (-init) use controlColor for default background.
* NSColorWell.m: (-drawRect:) use controlColor for background.
* NSFontPanel.m: use windowFrameTextColor for title text and
controlShadowColor for background.
* NSMatrix.m: Use controlBackgroundColor for backgrounds.
* NSMenu.m: ([NSMenuWindowTitleView drawRect:]) use windowFrameColor
and windowFrameTextColor.
* NSMenuItemCell.m: use selectedMenuItemColor or controlColor for
background, and use selectedMenuItemTextColor, controlTextColor, or
disabledControlTextColor for text.
* NSPopUpButtonCell.m: use selectedMenuItemColor or controlColor for
background, and use selectedMenuItemTextColor, controlTextColor for
text.
* NSSplitView.m: ([-initWithFrame:]) use controlShadowColor for the
divider, and controlBackgroundColor for background.
* NSTabViewItem.m: use controlBackgroundColor.
* NSTableHeaderCell.m: use controlShadowColor for header.
* NSTableView.m: use gridColor for the grid.
* NSText.m: Tidied most chunks of code using color.
Fri Aug 27 8:02:00 1999 Richard Frith-Macdonald <richard@brainstorm.co.uk>
Patch from Nicola Pero <n.pero@mi.flashnet.it>

View file

@ -188,10 +188,10 @@
return [NSBrowserCell class];
}
//
// Instance methods
//
- initWithFrame: (NSRect)rect
/*
* Instance methods
*/
- (id) initWithFrame: (NSRect)rect
{
NSSize bs;
NSRect scroller_rect;
@ -219,7 +219,7 @@
scroller_rect.size.height = [NSScroller scrollerWidth];
_horizontalScroller = [[NSScroller alloc] initWithFrame: scroller_rect];
[_horizontalScroller setTarget: self];
[_horizontalScroller setAction: @selector(scrollViaScroller: )];
[_horizontalScroller setAction: @selector(scrollViaScroller:)];
[self addSubview: _horizontalScroller];
_acceptsArrowKeys = YES;
_sendsActionOnArrowKeys = YES;
@ -229,8 +229,8 @@
_browserColumns = [[NSMutableArray alloc] init];
_titleCell = [NSTextFieldCell new];
[_titleCell setEditable: NO];
[_titleCell setTextColor: [NSColor whiteColor]];
[_titleCell setBackgroundColor: [NSColor darkGrayColor]];
[_titleCell setTextColor: [NSColor windowFrameTextColor]];
[_titleCell setBackgroundColor: [NSColor controlShadowColor]];
//[_titleCell setBordered: YES];
//[_titleCell setBezeled: YES];
[_titleCell setAlignment: NSCenterTextAlignment];
@ -295,20 +295,20 @@
BOOL both = NO;
if (![anObject respondsToSelector:
@selector(browser: willDisplayCell: atRow: column: )])
@selector(browser:willDisplayCell:atRow:column:)])
[NSException raise: NSBrowserIllegalDelegateException
format: @"Delegate does not respond to %s\n",
"browser: willDisplayCell: atRow: column: "];
if ([anObject respondsToSelector:
@selector(browser: numberOfRowsInColumn: )])
@selector(browser:numberOfRowsInColumn:)])
{
_passiveDelegate = YES;
flag = YES;
}
if ([anObject respondsToSelector:
@selector(browser: createRowsForColumn: inMatrix: )])
@selector(browser:createRowsForColumn:inMatrix:)])
{
_passiveDelegate = NO;
@ -611,7 +611,7 @@
// Ask the delegate for the column title
if ([_browserDelegate respondsToSelector:
@selector(browser: titleOfColumn: )])
@selector(browser:titleOfColumn:)])
[self setTitle: [_browserDelegate browser: self
titleOfColumn: column]
ofColumn: column];
@ -786,7 +786,7 @@
// xxx Should we trigger an exception?
if (![_browserDelegate respondsToSelector:
@selector(browser: isColumnValid: )])
@selector(browser:isColumnValid:)])
return;
// Loop through the visible columns
@ -893,7 +893,7 @@
return;
// Notify the delegate
if ([_browserDelegate respondsToSelector: @selector(browserWillScroll: )])
if ([_browserDelegate respondsToSelector: @selector(browserWillScroll:)])
[_browserDelegate browserWillScroll: self];
// Shift
@ -907,7 +907,7 @@
[self updateScroller];
// Notify the delegate
if ([_browserDelegate respondsToSelector: @selector(browserDidScroll: )])
if ([_browserDelegate respondsToSelector: @selector(browserDidScroll:)])
[_browserDelegate browserDidScroll: self];
}
@ -922,7 +922,7 @@
return;
// Notify the delegate
if ([_browserDelegate respondsToSelector: @selector(browserWillScroll: )])
if ([_browserDelegate respondsToSelector: @selector(browserWillScroll:)])
[_browserDelegate browserWillScroll: self];
// Shift
@ -936,7 +936,7 @@
[self updateScroller];
// Notify the delegate
if ([_browserDelegate respondsToSelector: @selector(browserDidScroll: )])
if ([_browserDelegate respondsToSelector: @selector(browserDidScroll:)])
[_browserDelegate browserDidScroll: self];
}
@ -1039,7 +1039,7 @@
// Ask delegate if selection is ok
if ([_browserDelegate respondsToSelector:
@selector(browser: selectRow: inColumn: )])
@selector(browser:selectRow:inColumn:)])
{
int row = [sender selectedRow];
shouldSelect = [_browserDelegate browser: self selectRow: row
@ -1049,7 +1049,7 @@
{
// Try the other method
if ([_browserDelegate respondsToSelector:
@selector(browser: selectCellWithString: inColumn: )])
@selector(browser:selectCellWithString:inColumn:)])
{
id c = [sender selectedCell];
shouldSelect = [_browserDelegate browser: self
@ -1595,8 +1595,8 @@
if (!_allowsMultipleSelection)
[matrix setMode: NSRadioModeMatrix];
[matrix setTarget: self];
[matrix setAction: @selector(doClick: )];
[matrix setDoubleAction: @selector(doDoubleClick: )];
[matrix setAction: @selector(doClick:)];
[matrix setDoubleAction: @selector(doDoubleClick:)];
// set new col matrix and release old
[bc setColumnMatrix: matrix];
@ -1630,8 +1630,8 @@
if (!_allowsMultipleSelection)
[matrix setMode: NSRadioModeMatrix];
[matrix setTarget: self];
[matrix setAction: @selector(doClick: )];
[matrix setDoubleAction: @selector(doDoubleClick: )];
[matrix setAction: @selector(doClick:)];
[matrix setDoubleAction: @selector(doDoubleClick:)];
// set new col matrix and release old
[bc setColumnMatrix: matrix];

View file

@ -36,11 +36,11 @@
@implementation NSClipView
- init
- (id) init
{
[super init];
[self setAutoresizesSubviews: YES];
[self setBackgroundColor: [NSColor lightGrayColor]];
[self setBackgroundColor: [NSColor controlColor]];
_copiesOnScroll = YES;
return self;
}

View file

@ -48,7 +48,7 @@
//
// Instance methods
//
- initWithFrame: (NSRect)frameRect
- (id) initWithFrame: (NSRect)frameRect
{
[super initWithFrame: frameRect];
@ -65,9 +65,9 @@
[super dealloc];
}
//
// Drawing
//
/*
* Drawing
*/
- (void) drawRect: (NSRect)rect
{
NSRect aRect = bounds;
@ -83,10 +83,10 @@
NSDrawButton(aRect, rect);
/*
* Fill in grey.
* Fill in control color.
*/
aRect = NSInsetRect(aRect, 2.0, 2.0);
[[NSColor lightGrayColor] set];
[[NSColor controlColor] set];
NSRectFill(NSIntersectionRect(aRect, rect));
/*

View file

@ -51,7 +51,7 @@
NSDebugLog(@"Initialize NSFontPanel class\n");
// Initial version
[self setVersion:1];
[self setVersion: 1];
}
}
@ -62,7 +62,7 @@
{
NSFontManager *fm = [NSFontManager sharedFontManager];
return [fm fontPanel:YES];
return [fm fontPanel: YES];
}
//
@ -100,82 +100,82 @@
unsigned int style = NSTitledWindowMask | NSClosableWindowMask
| NSMiniaturizableWindowMask | NSResizableWindowMask;
self = [super initWithContentRect:pf
styleMask:style
backing:NSBackingStoreRetained
defer:NO
screen:nil];
[self setTitle:@"Font Panel"];
self = [super initWithContentRect: pf
styleMask: style
backing: NSBackingStoreRetained
defer: NO
screen: nil];
[self setTitle: @"Font Panel"];
v = [self contentView];
topArea = [[NSView alloc] initWithFrame:NSMakeRect(0,50,300,250)];
topArea = [[NSView alloc] initWithFrame: NSMakeRect(0,50,300,250)];
splitView = [[NSSplitView alloc] initWithFrame:NSMakeRect(0,0,300,240)];
[splitView setVertical:NO];
[topArea addSubview:splitView];
splitView = [[NSSplitView alloc] initWithFrame: NSMakeRect(0,0,300,240)];
[splitView setVertical: NO];
[topArea addSubview: splitView];
topSplit = [[NSView alloc] initWithFrame:ts];
topSplit = [[NSView alloc] initWithFrame: ts];
previewArea = [[NSTextField alloc] initWithFrame:pa];
[previewArea setBackgroundColor:[NSColor whiteColor]];
[previewArea setDrawsBackground:YES];
[topSplit addSubview:previewArea];
previewArea = [[NSTextField alloc] initWithFrame: pa];
[previewArea setBackgroundColor: [NSColor textBackgroundColor]];
[previewArea setDrawsBackground: YES];
[topSplit addSubview: previewArea];
bottomSplit = [[NSView alloc] initWithFrame:bs];
bottomSplit = [[NSView alloc] initWithFrame: bs];
l.size.width = 110;
label = [[NSTextField alloc] initWithFrame:l];
label = [[NSTextField alloc] initWithFrame: l];
[label setAlignment: NSCenterTextAlignment];
[label setFont:[NSFont boldSystemFontOfSize:12]];
[label setStringValue:@"Family"];
[label setEditable:NO];
[label setDrawsBackground:YES];
[label setTextColor:[NSColor whiteColor]];
[label setBackgroundColor:[NSColor colorWithCalibratedWhite:NSDarkGray alpha: 1.0]];
[bottomSplit addSubview:label];
[label setFont: [NSFont boldSystemFontOfSize: 12]];
[label setStringValue: @"Family"];
[label setEditable: NO];
[label setDrawsBackground: YES];
[label setTextColor: [NSColor windowFrameTextColor]];
[label setBackgroundColor: [NSColor controlShadowColor]];
[bottomSplit addSubview: label];
[label release];
ss.size.width = 110;
familyScroll = [[NSScrollView alloc] initWithFrame:ss];
[familyScroll setHasVerticalScroller:YES];
[bottomSplit addSubview:familyScroll];
familyScroll = [[NSScrollView alloc] initWithFrame: ss];
[familyScroll setHasVerticalScroller: YES];
[bottomSplit addSubview: familyScroll];
l.size.width = 109;
l.origin.x = 120;
label = [[NSTextField alloc] initWithFrame:l];
[label setFont:[NSFont boldSystemFontOfSize:12]];
[label setEditable:NO];
label = [[NSTextField alloc] initWithFrame: l];
[label setFont: [NSFont boldSystemFontOfSize: 12]];
[label setEditable: NO];
[label setAlignment: NSCenterTextAlignment];
[label setDrawsBackground:YES];
[label setTextColor:[NSColor whiteColor]];
[label setBackgroundColor:[NSColor darkGrayColor]];
[label setStringValue:@"Typeface"];
[bottomSplit addSubview:label];
[label setDrawsBackground: YES];
[label setTextColor: [NSColor windowFrameTextColor]];
[label setBackgroundColor: [NSColor controlShadowColor]];
[label setStringValue: @"Typeface"];
[bottomSplit addSubview: label];
[label release];
ss.size.width = 109;
ss.origin.x = 120;
typeScroll = [[NSScrollView alloc] initWithFrame:ss];
[typeScroll setHasVerticalScroller:YES];
[bottomSplit addSubview:typeScroll];
typeScroll = [[NSScrollView alloc] initWithFrame: ss];
[typeScroll setHasVerticalScroller: YES];
[bottomSplit addSubview: typeScroll];
l.origin.x = 231;
l.size.width = 58;
label = [[NSTextField alloc] initWithFrame:l];
[label setFont:[NSFont boldSystemFontOfSize:12]];
label = [[NSTextField alloc] initWithFrame: l];
[label setFont: [NSFont boldSystemFontOfSize: 12]];
[label setAlignment: NSCenterTextAlignment];
[label setDrawsBackground:YES];
[label setEditable:NO];
[label setTextColor:[NSColor whiteColor]];
[label setBackgroundColor:[NSColor darkGrayColor]];
[label setStringValue:@"Size"];
[bottomSplit addSubview:label];
[label setDrawsBackground: YES];
[label setEditable: NO];
[label setTextColor: [NSColor windowFrameTextColor]];
[label setBackgroundColor: [NSColor controlShadowColor]];
[label setStringValue: @"Size"];
[bottomSplit addSubview: label];
[label release];
// last label, this is the size input. We don't release this one.
@ -183,54 +183,54 @@
l.origin.x = 231;
l.origin.y = 140;
label = [[NSTextField alloc] initWithFrame:l];
[label setDrawsBackground:YES];
[label setBackgroundColor:[NSColor whiteColor]];
[bottomSplit addSubview:label];
label = [[NSTextField alloc] initWithFrame: l];
[label setDrawsBackground: YES];
[label setBackgroundColor: [NSColor windowFrameTextColor]];
[bottomSplit addSubview: label];
ss.origin.x = 231;
ss.size.height = 138;
ss.size.width = 58;
sizeScroll = [[NSScrollView alloc] initWithFrame:ss];
[sizeScroll setHasVerticalScroller:YES];
[bottomSplit addSubview:sizeScroll];
sizeScroll = [[NSScrollView alloc] initWithFrame: ss];
[sizeScroll setHasVerticalScroller: YES];
[bottomSplit addSubview: sizeScroll];
bottomArea = [[NSView alloc] initWithFrame:NSMakeRect(0,0,300,50)];
bottomArea = [[NSView alloc] initWithFrame: NSMakeRect(0,0,300,50)];
slash = [[NSBox alloc] initWithFrame:NSMakeRect(0,40,300,2)];
[slash setBorderType:NSGrooveBorder];
[slash setTitlePosition:NSNoTitle];
[bottomArea addSubview:slash];
slash = [[NSBox alloc] initWithFrame: NSMakeRect(0,40,300,2)];
[slash setBorderType: NSGrooveBorder];
[slash setTitlePosition: NSNoTitle];
[bottomArea addSubview: slash];
[slash release];
revertButton = [[NSButton alloc] initWithFrame:b];
[revertButton setStringValue:@"Revert"];
[bottomArea addSubview:revertButton];
revertButton = [[NSButton alloc] initWithFrame: b];
[revertButton setStringValue: @"Revert"];
[bottomArea addSubview: revertButton];
b.origin.x = 137;
previewButton = [[NSButton alloc] initWithFrame:b];
[previewButton setStringValue:@"Preview"];
[previewButton setButtonType:NSOnOffButton];
[bottomArea addSubview:previewButton];
previewButton = [[NSButton alloc] initWithFrame: b];
[previewButton setStringValue: @"Preview"];
[previewButton setButtonType: NSOnOffButton];
[bottomArea addSubview: previewButton];
b.origin.x = 217;
setButton = [[NSButton alloc] initWithFrame:b];
[setButton setStringValue:@"Set"];
[bottomArea addSubview:setButton];
setButton = [[NSButton alloc] initWithFrame: b];
[setButton setStringValue: @"Set"];
[bottomArea addSubview: setButton];
[splitView addSubview:bottomSplit];
[splitView addSubview:topSplit];
[splitView addSubview: bottomSplit];
[splitView addSubview: topSplit];
[v addSubview:topArea];
[v addSubview:bottomArea];
[v addSubview: topArea];
[v addSubview: bottomArea];
return self;
}
- (NSFont *)panelConvertFont:(NSFont *)fontObject
- (NSFont *)panelConvertFont: (NSFont *)fontObject
{
return panel_font;
}
@ -238,8 +238,8 @@
//
// Setting the Font
//
- (void)setPanelFont:(NSFont *)fontObject
isMultiple:(BOOL)flag
- (void)setPanelFont: (NSFont *)fontObject
isMultiple: (BOOL)flag
{
panel_font = fontObject;
}
@ -257,10 +257,10 @@
return NO;
}
- (void)setAccessoryView:(NSView *)aView
- (void)setAccessoryView: (NSView *)aView
{}
- (void)setEnabled:(BOOL)flag
- (void)setEnabled: (BOOL)flag
{}
- (BOOL)worksWhenModal
@ -271,8 +271,8 @@
//
// Displaying the NSFontPanel
//
- (void)orderWindow:(NSWindowOrderingMode)place
relativeTo:(int)otherWindows
- (void)orderWindow: (NSWindowOrderingMode)place
relativeTo: (int)otherWindows
{}
- (void)display

View file

@ -360,9 +360,9 @@ static int mouseDownFlags = 0;
cellSize = NSMakeSize(DEFAULT_CELL_WIDTH, DEFAULT_CELL_HEIGHT);
intercell = NSMakeSize(1, 1);
[self setBackgroundColor: [NSColor lightGrayColor]];
[self setBackgroundColor: [NSColor controlBackgroundColor]];
[self setDrawsBackground: YES];
[self setCellBackgroundColor: [NSColor lightGrayColor]];
[self setCellBackgroundColor: [NSColor controlBackgroundColor]];
[self setSelectionByRect: YES];
[self setAutosizesCells: YES];
if (mode == NSRadioModeMatrix && numRows && numCols)

View file

@ -961,7 +961,7 @@ NSArray* array;
- (void)setMenu: (NSMenu*)aMenu { menu = aMenu; }
- (NSMenu*)menu { return menu; }
- (void)drawRect: (NSRect)rect
- (void) drawRect: (NSRect)rect
{
NSRect floodRect = rect;
@ -971,10 +971,10 @@ NSArray* array;
floodRect.origin.y += 2;
floodRect.size.height -= 3;
floodRect.size.width -= 3;
[[NSColor blackColor] set];
[[NSColor windowFrameColor] set];
NSRectFill(floodRect);
[[NSColor whiteColor] set];
[[NSColor windowFrameTextColor] set];
[[NSFont boldSystemFontOfSize:12] set];
PSmoveto(rect.origin.x + 5, rect.origin.y + 6);
PSshow([[menu title] cString]);

View file

@ -249,12 +249,12 @@ static BOOL usesUserKeyEquivalents = YES;
{
}
- (void)drawWithFrame:(NSRect)cellFrame
inView:(NSView *)controlView
- (void) drawWithFrame: (NSRect)cellFrame
inView: (NSView *)controlView
{
NSGraphicsContext *ctxt = GSCurrentContext();
NSRect floodRect = cellFrame;
NSString *keyQ = nil;
NSGraphicsContext *ctxt = GSCurrentContext();
NSRect floodRect = cellFrame;
NSString *keyQ = nil;
NSDrawButton(cellFrame, cellFrame);
@ -263,18 +263,31 @@ static BOOL usesUserKeyEquivalents = YES;
floodRect.size.height -= 3;
floodRect.size.width -= 2;
if (cell_highlighted) {
[[NSColor whiteColor] set];
NSRectFill(floodRect);
} else {
[[NSColor lightGrayColor] set];
NSRectFill(floodRect);
}
if (cell_highlighted)
{
[[NSColor selectedMenuItemColor] set];
}
else
{
[[NSColor controlColor] set];
}
NSRectFill(floodRect);
if ([self isEnabled])
[[NSColor blackColor] set];
{
if (cell_highlighted)
{
[[NSColor selectedMenuItemTextColor] set];
}
else
{
[[NSColor controlTextColor] set];
}
}
else
[[NSColor grayColor] set];
{
[[NSColor disabledControlTextColor] set];
}
[[NSFont systemFontOfSize:12] set];
DPSmoveto(ctxt, cellFrame.origin.x + 5, cellFrame.origin.y + 6);

View file

@ -56,8 +56,8 @@
return contents;
}
- (void)drawWithFrame:(NSRect)cellFrame
inView:(NSView*)view
- (void) drawWithFrame: (NSRect)cellFrame
inView: (NSView*)view
{
NSGraphicsContext *ctxt = GSCurrentContext();
NSRect rect = cellFrame;
@ -71,13 +71,15 @@
arect.origin.x += 1;
arect.origin.y += 2;
if (cell_highlighted) {
[[NSColor whiteColor] set];
NSRectFill(arect);
} else {
[[NSColor lightGrayColor] set];
NSRectFill(arect);
}
if (cell_highlighted)
{
[[NSColor selectedMenuItemColor] set];
}
else
{
[[NSColor controlColor] set];
}
NSRectFill(arect);
if (cell_image)
{
@ -96,7 +98,14 @@
point.x = rect.origin.x + xDist;
rect.origin = point;
[[NSColor blackColor] set];
if (cell_highlighted)
{
[[NSColor selectedMenuItemTextColor] set];
}
else
{
[[NSColor controlTextColor] set];
}
// Draw the title.

View file

@ -482,7 +482,7 @@ static inline NSPoint centerSizeInRect(NSSize innerSize, NSRect outerRect)
if ([self isOpaque])
{
[[self backgroundColor] set];
NSRectFill(r);
NSRectFill(r);
}
/* draw the dimples */
@ -529,8 +529,8 @@ static inline NSPoint centerSizeInRect(NSSize innerSize, NSRect outerRect)
dividerWidth = 8;
draggedBarWidth = 8;
isVertical = NO;
[self setDividerColor: [NSColor darkGrayColor]];
[self setBackgroundColor: [NSColor lightGrayColor]];
[self setDividerColor: [NSColor controlShadowColor]];
[self setBackgroundColor: [NSColor controlBackgroundColor]];
[self setDimpleImage:
[NSImage imageNamed: @"common_Dimple.tiff"] resetDividerThickness: YES];
}

View file

@ -130,18 +130,22 @@
fRect = tabRect;
if (item_state == NSSelectedTab) {
fRect.origin.y -= 1;
fRect.size.height += 1;
[[NSColor lightGrayColor] set];
NSRectFill(fRect);
} else if (item_state == NSBackgroundTab) {
[[NSColor lightGrayColor] set];
NSRectFill(fRect);
} else {
[[NSColor lightGrayColor] set];
NSRectFill(fRect);
}
if (item_state == NSSelectedTab)
{
fRect.origin.y -= 1;
fRect.size.height += 1;
[[NSColor controlBackgroundColor] set];
NSRectFill(fRect);
}
else if (item_state == NSBackgroundTab)
{
[[NSColor controlBackgroundColor] set];
NSRectFill(fRect);
}
else
{
[[NSColor controlBackgroundColor] set];
}
lRect = tabRect;
lRect.origin.y += 3;

View file

@ -2,11 +2,11 @@
#include <AppKit/NSColor.h>
@implementation NSTableHeaderCell
- (void)drawInteriorWithFrame:(NSRect)cellFrame
inView:(NSView *)controlView
- (void) drawInteriorWithFrame: (NSRect)cellFrame
inView: (NSView *)controlView
{
[[NSColor darkGrayColor] set];
NSRectFill(cellFrame);
[super drawInteriorWithFrame: cellFrame inView: controlView];
[[NSColor controlShadowColor] set];
NSRectFill(cellFrame);
[super drawInteriorWithFrame: cellFrame inView: controlView];
}
@end

View file

@ -21,7 +21,7 @@
tbv_interCellSpacing = NSMakeSize (3,2);
tbv_rowHeight = 16.0;
tbv_columns = [NSMutableArray new];
tbv_gridColor = [NSColor grayColor];
tbv_gridColor = [NSColor gridColor];
tbv_headerView = nil;
}

File diff suppressed because it is too large Load diff