ftp.nice.ch/Attic/openStep/developer/resources/MiscKit.2.0.5.s.gnutar.gz#/MiscKit2/Tests/TestMMA/MiscMMAView.m

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

/*	MiscMMAView.m

	Copyright 1996 Uwe Hoffmann.

	This notice may not be removed from this source code.
	The use and distribution of this software is governed by the
	terms of the MiscKit license agreement.  Refer to the license
	document included with the MiscKit distribution for the terms.

	Version 2 (August 1996)
*/

#import "MiscMMAView.h"

static NSData *psFix = nil;

@implementation MiscMMAView
/*"The MiscMMAView class defines a view that will draw itself using PostScript commands supplied by the Mathematica application.  Mathematica supports the ability to produce a PostScript description of its graphic renderings of mathematical expressions.  The resulting description uses many context dependent PostScript definitions that Mathematica usually handles internally.  The MiscMMAView class supports these definitions and the interpretation of Mathematica's PostScript representations.

MiscMMAView is a subclass of MiscPSView and overrides #writePSPreambleInContext: to declare the Mathematica 
specific Postscript definitions."*/

- (void)writePSPreambleInContext:(NSDPSServerContext *)aContext
{
    	if(!psFix){
            	NSString *filename = [[NSBundle bundleForClass:[self class]] pathForResource:@"MMAPostscriptFix" ofType:@"ps"];
            	if(!filename){
                    	NSLog(@"Could not find MMAPostscriptFix.ps");
                    	return;
                }
                psFix = [[NSData alloc] initWithContentsOfMappedFile:filename];
        }
   	[aContext writePostScriptWithLanguageEncodingConversion:psFix];
}


@end

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