mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 20:00:48 +00:00
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:
parent
0a3131548c
commit
a0c915eeb0
14 changed files with 1013 additions and 886 deletions
29
ChangeLog
29
ChangeLog
|
@ -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>
|
||||
|
|
|
@ -188,10 +188,10 @@
|
|||
return [NSBrowserCell class];
|
||||
}
|
||||
|
||||
//
|
||||
// Instance methods
|
||||
//
|
||||
- initWithFrame: (NSRect)rect
|
||||
/*
|
||||
* Instance methods
|
||||
*/
|
||||
- (id) initWithFrame: (NSRect)rect
|
||||
{
|
||||
NSSize bs;
|
||||
NSRect scroller_rect;
|
||||
|
@ -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];
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
|
||||
/*
|
||||
|
|
|
@ -118,7 +118,7 @@
|
|||
topSplit = [[NSView alloc] initWithFrame: ts];
|
||||
|
||||
previewArea = [[NSTextField alloc] initWithFrame: pa];
|
||||
[previewArea setBackgroundColor:[NSColor whiteColor]];
|
||||
[previewArea setBackgroundColor: [NSColor textBackgroundColor]];
|
||||
[previewArea setDrawsBackground: YES];
|
||||
[topSplit addSubview: previewArea];
|
||||
|
||||
|
@ -132,8 +132,8 @@
|
|||
[label setStringValue: @"Family"];
|
||||
[label setEditable: NO];
|
||||
[label setDrawsBackground: YES];
|
||||
[label setTextColor:[NSColor whiteColor]];
|
||||
[label setBackgroundColor:[NSColor colorWithCalibratedWhite:NSDarkGray alpha: 1.0]];
|
||||
[label setTextColor: [NSColor windowFrameTextColor]];
|
||||
[label setBackgroundColor: [NSColor controlShadowColor]];
|
||||
[bottomSplit addSubview: label];
|
||||
[label release];
|
||||
|
||||
|
@ -151,8 +151,8 @@
|
|||
[label setEditable: NO];
|
||||
[label setAlignment: NSCenterTextAlignment];
|
||||
[label setDrawsBackground: YES];
|
||||
[label setTextColor:[NSColor whiteColor]];
|
||||
[label setBackgroundColor:[NSColor darkGrayColor]];
|
||||
[label setTextColor: [NSColor windowFrameTextColor]];
|
||||
[label setBackgroundColor: [NSColor controlShadowColor]];
|
||||
[label setStringValue: @"Typeface"];
|
||||
[bottomSplit addSubview: label];
|
||||
[label release];
|
||||
|
@ -172,8 +172,8 @@
|
|||
[label setAlignment: NSCenterTextAlignment];
|
||||
[label setDrawsBackground: YES];
|
||||
[label setEditable: NO];
|
||||
[label setTextColor:[NSColor whiteColor]];
|
||||
[label setBackgroundColor:[NSColor darkGrayColor]];
|
||||
[label setTextColor: [NSColor windowFrameTextColor]];
|
||||
[label setBackgroundColor: [NSColor controlShadowColor]];
|
||||
[label setStringValue: @"Size"];
|
||||
[bottomSplit addSubview: label];
|
||||
[label release];
|
||||
|
@ -185,7 +185,7 @@
|
|||
|
||||
label = [[NSTextField alloc] initWithFrame: l];
|
||||
[label setDrawsBackground: YES];
|
||||
[label setBackgroundColor:[NSColor whiteColor]];
|
||||
[label setBackgroundColor: [NSColor windowFrameTextColor]];
|
||||
[bottomSplit addSubview: label];
|
||||
|
||||
ss.origin.x = 231;
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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]);
|
||||
|
|
|
@ -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 grayColor] set];
|
||||
{
|
||||
[[NSColor controlTextColor] set];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
[[NSColor disabledControlTextColor] set];
|
||||
}
|
||||
|
||||
[[NSFont systemFontOfSize:12] set];
|
||||
DPSmoveto(ctxt, cellFrame.origin.x + 5, cellFrame.origin.y + 6);
|
||||
|
|
|
@ -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.
|
||||
|
||||
|
|
|
@ -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];
|
||||
}
|
||||
|
|
|
@ -130,18 +130,22 @@
|
|||
|
||||
fRect = tabRect;
|
||||
|
||||
if (item_state == NSSelectedTab) {
|
||||
if (item_state == NSSelectedTab)
|
||||
{
|
||||
fRect.origin.y -= 1;
|
||||
fRect.size.height += 1;
|
||||
[[NSColor lightGrayColor] set];
|
||||
[[NSColor controlBackgroundColor] set];
|
||||
NSRectFill(fRect);
|
||||
} else if (item_state == NSBackgroundTab) {
|
||||
[[NSColor lightGrayColor] set];
|
||||
NSRectFill(fRect);
|
||||
} else {
|
||||
[[NSColor lightGrayColor] set];
|
||||
}
|
||||
else if (item_state == NSBackgroundTab)
|
||||
{
|
||||
[[NSColor controlBackgroundColor] set];
|
||||
NSRectFill(fRect);
|
||||
}
|
||||
else
|
||||
{
|
||||
[[NSColor controlBackgroundColor] set];
|
||||
}
|
||||
|
||||
lRect = tabRect;
|
||||
lRect.origin.y += 3;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
- (void) drawInteriorWithFrame: (NSRect)cellFrame
|
||||
inView: (NSView *)controlView
|
||||
{
|
||||
[[NSColor darkGrayColor] set];
|
||||
[[NSColor controlShadowColor] set];
|
||||
NSRectFill(cellFrame);
|
||||
[super drawInteriorWithFrame: cellFrame inView: controlView];
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
200
Source/NSText.m
200
Source/NSText.m
|
@ -293,11 +293,12 @@ static NSRange MakeRangeFromAbs(int a1,int a2)
|
|||
}
|
||||
}
|
||||
|
||||
-(void) drawRange:(NSRange) aRange inRect:(NSRect) aRect;
|
||||
- (void) drawRange: (NSRange)aRange inRect: (NSRect)aRect
|
||||
{
|
||||
NSString *substring = [[self string] substringWithRange: aRange];
|
||||
|
||||
[substring drawInRect:aRect withAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
[substring drawInRect: aRect
|
||||
withAttributes: [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
[NSFont systemFontOfSize: 12.0], NSFontAttributeName,
|
||||
[NSColor blueColor], NSForegroundColorAttributeName,
|
||||
nil]];
|
||||
|
@ -410,13 +411,14 @@ nil]];
|
|||
// Initialization
|
||||
//
|
||||
|
||||
- init
|
||||
- (id) init
|
||||
{
|
||||
return [self initWithFrame: NSMakeRect(0,0,100,100)];
|
||||
}
|
||||
|
||||
- initWithFrame:(NSRect)frameRect
|
||||
{ [super initWithFrame:frameRect];
|
||||
- (id) initWithFrame: (NSRect)frameRect
|
||||
{
|
||||
[super initWithFrame: frameRect];
|
||||
|
||||
alignment = NSLeftTextAlignment;
|
||||
is_editable = YES;
|
||||
|
@ -429,12 +431,14 @@ nil]];
|
|||
is_ruler_visible = NO;
|
||||
is_field_editor = NO;
|
||||
draws_background = YES;
|
||||
[self setBackgroundColor:[NSColor whiteColor]];
|
||||
[self setTextColor:[NSColor blackColor]];
|
||||
[self setBackgroundColor: [NSColor textBackgroundColor]];
|
||||
[self setTextColor: [NSColor textColor]];
|
||||
default_font = [NSFont userFontOfSize: 12];
|
||||
|
||||
[self setSelectionWordGranularitySet:[NSCharacterSet characterSetWithCharactersInString:@" "]]; //[NSCharacterSet whitespaceCharacterSet]
|
||||
[self setSelectionParagraphGranularitySet:[NSCharacterSet characterSetWithCharactersInString:[[self class] newlineString]]];
|
||||
[self setSelectionWordGranularitySet:
|
||||
[NSCharacterSet characterSetWithCharactersInString: @" "]]; //[NSCharacterSet whitespaceCharacterSet]
|
||||
[self setSelectionParagraphGranularitySet:
|
||||
[NSCharacterSet characterSetWithCharactersInString: [[self class] newlineString]]];
|
||||
|
||||
[self setMinSize: frameRect.size];
|
||||
[self setMaxSize: NSMakeSize(HUGE,HUGE)];
|
||||
|
@ -446,12 +450,10 @@ nil]];
|
|||
|
||||
- (NSDictionary*) defaultTypingAttributes
|
||||
{
|
||||
|
||||
return [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
default_font, NSFontAttributeName,
|
||||
text_color, NSForegroundColorAttributeName,
|
||||
nil];
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -499,16 +501,23 @@ nil];
|
|||
- (BOOL) performPasteOperation: (NSPasteboard*)pboard
|
||||
{
|
||||
// color accepting
|
||||
if([pboard availableTypeFromArray:[NSArray arrayWithObject:NSColorPboardType]])
|
||||
{ NSColor *color=[NSColor colorFromPasteboard:pboard];
|
||||
if ([pboard availableTypeFromArray:
|
||||
[NSArray arrayWithObject: NSColorPboardType]])
|
||||
{
|
||||
NSColor *color = [NSColor colorFromPasteboard: pboard];
|
||||
|
||||
if ([self isRichText])
|
||||
{ [self setTextColor:color range:[self selectedRange]];
|
||||
} else [self setTextColor:color];
|
||||
{
|
||||
[self setTextColor: color range: [self selectedRange]];
|
||||
}
|
||||
else
|
||||
[self setTextColor: color];
|
||||
return YES;
|
||||
}
|
||||
|
||||
if ([self importsGraphics])
|
||||
{ NSArray *types=[NSArray arrayWithObjects:NSFileContentsPboardType, NSRTFDPboardType, NSRTFPboardType, NSStringPboardType, NSTIFFPboardType, nil];
|
||||
{
|
||||
NSArray *types=[NSArray arrayWithObjects: NSFileContentsPboardType, NSRTFDPboardType, NSRTFPboardType, NSStringPboardType, NSTIFFPboardType, nil];
|
||||
if ([[pboard availableTypeFromArray: types] isEqualToString: NSRTFDPboardType])
|
||||
{ [self insertText: [[self class] attributedStringForData: [pboard dataForType: NSRTFDPboardType]]];
|
||||
} else if ([[pboard availableTypeFromArray: types] isEqualToString: NSRTFPboardType])
|
||||
|
@ -553,8 +562,10 @@ nil];
|
|||
}
|
||||
|
||||
- (BOOL) performDragOperation: (id <NSDraggingInfo>)sender
|
||||
{ return [self performPasteOperation:[sender draggingPasteboard]];
|
||||
{
|
||||
return [self performPasteOperation: [sender draggingPasteboard]];
|
||||
}
|
||||
|
||||
-(void) concludeDragOperation: (id <NSDraggingInfo>)sender
|
||||
{
|
||||
}
|
||||
|
@ -573,10 +584,13 @@ nil];
|
|||
}
|
||||
|
||||
-(NSArray*) acceptableDragTypes
|
||||
{ NSMutableArray *ret=[NSMutableArray arrayWithObjects:NSStringPboardType, NSColorPboardType, nil];
|
||||
{
|
||||
NSMutableArray *ret=[NSMutableArray arrayWithObjects: NSStringPboardType, NSColorPboardType, nil];
|
||||
|
||||
if([self isRichText]) [ret addObject:NSRTFPboardType];
|
||||
if([self importsGraphics]) [ret addObject:NSRTFDPboardType];
|
||||
if ([self isRichText])
|
||||
[ret addObject: NSRTFPboardType];
|
||||
if ([self importsGraphics])
|
||||
[ret addObject: NSRTFDPboardType];
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -726,13 +740,28 @@ nil];
|
|||
if (!flag) is_editable = NO; // If we are not selectable then we must not be editable
|
||||
}
|
||||
|
||||
//
|
||||
// Managing Font and Color
|
||||
//
|
||||
-(NSColor*) backgroundColor { return background_color; }
|
||||
-(NSFont*) font { return default_font; }
|
||||
-(NSColor*) textColor { return text_color; }
|
||||
-(BOOL) usesFontPanel { return uses_font_panel; }
|
||||
/*
|
||||
* Managing Font and Color
|
||||
*/
|
||||
- (NSColor*) backgroundColor
|
||||
{
|
||||
return background_color;
|
||||
}
|
||||
|
||||
- (NSFont*) font
|
||||
{
|
||||
return default_font;
|
||||
}
|
||||
|
||||
- (NSColor*) textColor
|
||||
{
|
||||
return text_color;
|
||||
}
|
||||
|
||||
- (BOOL) usesFontPanel
|
||||
{
|
||||
return uses_font_panel;
|
||||
}
|
||||
|
||||
|
||||
// This action method changes the font of the selection for a rich text object, or of all text for a plain text object. If the receiver doesn't use the Font Panel, however, this method does nothing.
|
||||
|
@ -764,8 +793,10 @@ nil];
|
|||
|
||||
|
||||
- (void) setBackgroundColor: (NSColor *)color
|
||||
{ ASSIGN(background_color, color);
|
||||
{
|
||||
ASSIGN(background_color, color);
|
||||
}
|
||||
|
||||
-(void) setTypingAttributes: (NSDictionary*) dict
|
||||
{ if (![dict isKindOfClass: [NSMutableDictionary class]])
|
||||
{ [typingAttributes autorelease];
|
||||
|
@ -778,17 +809,24 @@ nil];
|
|||
}
|
||||
|
||||
- (void) setTextColor: (NSColor*)color range: (NSRange)range
|
||||
{ if([self isRichText])
|
||||
{ if(color) [rtfContent addAttribute:NSForegroundColorAttributeName value:color range:range];
|
||||
} else {}
|
||||
|
||||
{
|
||||
if ([self isRichText])
|
||||
{
|
||||
if (color)
|
||||
[rtfContent addAttribute: NSForegroundColorAttributeName
|
||||
value: color
|
||||
range: range];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) setColor: (NSColor*)color ofRange: (NSRange)range
|
||||
{ [self setTextColor:color range:range];
|
||||
{
|
||||
[self setTextColor: color range: range];
|
||||
}
|
||||
|
||||
- (void)setFont: (NSFont*)obj
|
||||
{ ASSIGN(default_font, obj);
|
||||
{
|
||||
ASSIGN(default_font, obj);
|
||||
}
|
||||
|
||||
- (void)setFont: (NSFont *)font ofRange: (NSRange)range
|
||||
|
@ -802,9 +840,10 @@ NSLog(@"did set font");
|
|||
}
|
||||
|
||||
- (void) setTextColor: (NSColor *)color
|
||||
{ ASSIGN(text_color,color);
|
||||
|
||||
if(![self isRichText]) [self setNeedsDisplay:YES];
|
||||
{
|
||||
ASSIGN(text_color,color);
|
||||
if (![self isRichText])
|
||||
[self setNeedsDisplay: YES];
|
||||
}
|
||||
|
||||
- (void)setUsesFontPanel: (BOOL)flag
|
||||
|
@ -821,34 +860,52 @@ NSLog(@"did set font");
|
|||
-(BOOL) shouldDrawInsertionPoint
|
||||
{ return ([self selectedRange].length==0) && [self isEditable];
|
||||
}
|
||||
-(void) drawInsertionPointInRect:(NSRect)rect color:(NSColor *)color turnedOn:(BOOL)flag
|
||||
{ BOOL didLock=NO;
|
||||
|
||||
- (void) drawInsertionPointInRect: (NSRect)rect
|
||||
color: (NSColor *)color
|
||||
turnedOn: (BOOL)flag
|
||||
{
|
||||
BOOL didLock = NO;
|
||||
|
||||
if (![self window])
|
||||
return;
|
||||
|
||||
if ([self window] && [[self class] focusView] != self)
|
||||
{ [self lockFocus];
|
||||
{
|
||||
[self lockFocus];
|
||||
didLock = YES;
|
||||
}
|
||||
|
||||
if(flag) {
|
||||
if (flag)
|
||||
{
|
||||
[color set];
|
||||
NSRectFill(rect);
|
||||
} else {
|
||||
[[self backgroundColor] set]; NSRectFill(rect);
|
||||
}
|
||||
else
|
||||
{
|
||||
[[self backgroundColor] set];
|
||||
NSRectFill(rect);
|
||||
}
|
||||
|
||||
if (didLock)
|
||||
{ [self unlockFocus];
|
||||
{
|
||||
[self unlockFocus];
|
||||
[[self window] flushWindow];
|
||||
}
|
||||
}
|
||||
-(void) drawInsertionPointAtIndex:(unsigned)index color:(NSColor *)color turnedOn:(BOOL)flag
|
||||
{ NSRect startRect=[self rectForCharacterIndex:index];
|
||||
// [self drawInsertionPointInRect:NSMakeRect(startRect.origin.x, startRect.origin.y,0.5,startRect.size.height)
|
||||
[self drawInsertionPointInRect:NSMakeRect(startRect.origin.x, startRect.origin.y,1,startRect.size.height)
|
||||
color:[NSColor blackColor] turnedOn:flag];
|
||||
|
||||
- (void) drawInsertionPointAtIndex: (unsigned)index
|
||||
color: (NSColor*)color
|
||||
turnedOn: (BOOL)flag
|
||||
{
|
||||
NSRect startRect = [self rectForCharacterIndex: index];
|
||||
NSRect drawRect;
|
||||
|
||||
drawRect = NSMakeRect(startRect.origin.x, startRect.origin.y,
|
||||
1, startRect.size.height);
|
||||
[self drawInsertionPointInRect: drawRect
|
||||
color: [NSColor blackColor]
|
||||
turnedOn: flag];
|
||||
}
|
||||
|
||||
|
||||
|
@ -868,10 +925,19 @@ NSLog(@"did set font");
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (void) drawSelectionAsRange: (NSRange) aRange
|
||||
{ if(aRange.length)
|
||||
{ [self drawSelectionAsRangeNoCaret:aRange];
|
||||
} else [self drawInsertionPointAtIndex:aRange.location color:[NSColor blackColor] turnedOn:YES];
|
||||
{
|
||||
if (aRange.length)
|
||||
{
|
||||
[self drawSelectionAsRangeNoCaret: aRange];
|
||||
}
|
||||
else
|
||||
{
|
||||
[self drawInsertionPointAtIndex: aRange.location
|
||||
color: [NSColor blackColor]
|
||||
turnedOn: YES];
|
||||
}
|
||||
}
|
||||
|
||||
// low level selection setting including delegation
|
||||
|
@ -1542,19 +1608,21 @@ NSLog(@"keycode:%x",keyCode);
|
|||
else return NO;
|
||||
}
|
||||
|
||||
//
|
||||
// Managing the Delegate
|
||||
//
|
||||
- delegate { return delegate; }
|
||||
/*
|
||||
* Managing the Delegate
|
||||
*/
|
||||
- (id) delegate
|
||||
{
|
||||
return delegate;
|
||||
}
|
||||
|
||||
-(void) setDelegate:anObject
|
||||
- (void) setDelegate: (id)anObject
|
||||
{
|
||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||
|
||||
if (delegate)
|
||||
[nc removeObserver: delegate name: nil object: self];
|
||||
ASSIGN(delegate, anObject);
|
||||
// delegate = anObject;
|
||||
|
||||
#define SET_DELEGATE_NOTIFICATION(notif_name) \
|
||||
if ([delegate respondsToSelector: @selector(text##notif_name:)]) \
|
||||
|
@ -1568,9 +1636,9 @@ NSLog(@"keycode:%x",keyCode);
|
|||
SET_DELEGATE_NOTIFICATION(DidEndEditing);
|
||||
}
|
||||
|
||||
//
|
||||
// Implemented by the Delegate
|
||||
//
|
||||
/*
|
||||
* Implemented by the Delegate
|
||||
*/
|
||||
|
||||
- (void) textDidBeginEditing: (NSNotification *)aNotification
|
||||
{ if ([delegate respondsToSelector: @selector(textDidBeginEditing: )])
|
||||
|
@ -2144,15 +2212,19 @@ NSLog(@"opti hook 2");
|
|||
|
||||
|
||||
- (void) paste: sender
|
||||
{ [self performPasteOperation:[NSPasteboard generalPasteboard]];
|
||||
{
|
||||
[self performPasteOperation: [NSPasteboard generalPasteboard]];
|
||||
}
|
||||
|
||||
- (void) pasteFont: sender
|
||||
{ [self performPasteOperation:[NSPasteboard pasteboardWithName:NSFontPboard]];
|
||||
{
|
||||
[self performPasteOperation: [NSPasteboard pasteboardWithName: NSFontPboard]];
|
||||
}
|
||||
|
||||
- (void) pasteRuler: sender
|
||||
{ [self performPasteOperation:[NSPasteboard pasteboardWithName:NSRulerPboard]];
|
||||
{
|
||||
[self performPasteOperation:
|
||||
[NSPasteboard pasteboardWithName: NSRulerPboard]];
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue