ftp.nice.ch/pub/next/text/tex/apps/TeXfig.0.1.N.b.tar.gz#/TeXfig/TeXfigImageView.m

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


#import "TeXfigImageView.h"

@implementation TeXfigImageView


static char textbuffer[1024]="blah I hope this works";


-initFrame:(const NXRect*)r
{
	[super initFrame: r];

	// select a font for the text
	font = [Font newFont: "Times-Bold"
                        size:15
                      matrix:NX_IDENTITYMATRIX];
	imageid = 0;
	pb = [Pasteboard new];

	return self;
}

- newImage:(id) image
{
	imageid = image;
	[self display];
	return self;
}



- drawSelf:(const NXRect *)rects :(int)rectCount
{
	NXRect aRect=rects[0];

	// if the image is null, then simplay clear
	// the background, and write something	
	// useful
	if(imageid==0){
		PSgsave();
		NXSetColor(NX_COLORWHITE);
		NXRectFill(rects);		
		PSmoveto(0.0,0.0);
		[font set];
		PSshow("No image to display");
		PSgrestore();
	} else {
		// clear what's there
		NXPoint pt = {0.0, 0.0};   
		PSgsave(); 
		NXSetColor(NX_COLORWHITE);
 		NXRectFill(rects);
    		[imageid composite:NX_SOVER  toPoint:&pt];
		PSgrestore();
	}
	return self;
}

- copy: sender 
{
	NXStream *stream;
	int length, maxlength=10000;
	char *data;
	id aList, anImageRep;
	int i;

	aList = [imageid representationList];
	anImageRep = nil;
	for(i=0;i<[aList count]; i++)
		if([[aList objectAt: i] class] == [NXEPSImageRep class])
			anImageRep = [aList objectAt: i];

	if(anImageRep==nil) return self;
	[pb declareTypes: &NXPostScriptPboardType num: 1 owner: sender];
	[anImageRep getEPS: &data length: &length];
	[pb writeType:NXPostScriptPboardType data:data length:length];
	return self;
}
@end

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