ftp.nice.ch/pub/next/text/tex/apps/Bibliography.1.2a.s.tar.gz#/Bibliography.1.2a/FindCell.m

This is FindCell.m in view mode; [Download] [Up]

#import "FindCell.h"

@implementation FindCell


- setObject:obj inFile:fileObj
{
	myObj = obj;
	myFile = fileObj;
	[self setEditable:NO];
	return self;
}


- object
{
	return myObj;
}


- fileObject
{
	return myFile;
}


//	adopted from ScrollDoodScroll

- XXXdrawInside:(const NXRect *)cellFrame inView:controlView
{
	NXRect rect = *cellFrame;
    static id sharedTextCell = nil;

	/* erase the cell */
	PSsetgray((cFlags1.state || cFlags1.highlighted) ? NX_WHITE : NX_LTGRAY);
	NXRectFill(cellFrame);

	if (!sharedTextCell) {
		sharedTextCell = [[Cell alloc] init];
		[sharedTextCell setWrap:NO];
	}
	[sharedTextCell setFont:[self font]];
	[sharedTextCell setStringValue:[self stringValue]];
	[sharedTextCell drawInside:&rect inView:controlView];
	
	/* all drawing from now on will be in dark gray */
	PSsetgray(NX_DKGRAY);

	/* draw the two dark gray lines above and below the cell */
    if (cFlags1.state || cFlags1.highlighted) {
		NXRect rectArray[2];
		/*
		 * draw 1-pixel tall rectangles instead of lines (this is faster than
		 * PSmoveto(); PSlineto()).
		 */
		NXSetRect(&(rectArray[0]), NX_X(cellFrame), NX_Y(cellFrame),
		NX_WIDTH(cellFrame), 1.0);
		NXSetRect(&(rectArray[1]), NX_X(cellFrame), NX_MAXY(cellFrame) - 1.0,
			NX_WIDTH(cellFrame), 1.0);

		/* using NXRectFillList is faster than separate calls to NXRectFill */
		NXRectFillList(rectArray, 2);
	}

	return self;
}


- drawInside:(const NXRect *)cellFrame inView:controlView
{
	NXRect rect = *cellFrame;

	[super drawInside:cellFrame inView:controlView];

	/* all drawing from now on will be in dark gray */
	PSsetgray(NX_DKGRAY);

	/* draw the two dark gray lines above and below the cell */
    if (cFlags1.state || cFlags1.highlighted) {
		NXRect rectArray[2];
		/*
		 * draw 1-pixel tall rectangles instead of lines (this is faster than
		 * PSmoveto(); PSlineto()).
		 */
		NXSetRect(&(rectArray[0]), NX_X(cellFrame), NX_Y(cellFrame),
		NX_WIDTH(cellFrame), 1.0);
		NXSetRect(&(rectArray[1]), NX_X(cellFrame), NX_MAXY(cellFrame) - 1.0,
			NX_WIDTH(cellFrame), 1.0);

		/* using NXRectFillList is faster than separate calls to NXRectFill */
		NXRectFillList(rectArray, 2);
	}

	return self;
}


- highlight:(const NXRect *)cellFrame inView:controlView lit:(BOOL)flag
{
	if (cFlags1.highlighted != flag) {
		cFlags1.highlighted = flag;
		[self drawInside:cellFrame inView:controlView];
	}
	return self;
}


@end

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.