ftp.nice.ch/pub/next/tools/frontends/PostScriptHelper.0.8.NIHS.bsd.tar.gz#/PostScriptHelper.0.8.NIHS.bsd/Source/PHOddPageTool.m

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

/* --------------------------------------------------------------------------

Class:			PHOddPageTool
Version:		0.1
File:			PHOddPageTool.m				 

Written by:		Thomas Engel
Created:		17.05.1995	(Copyleft)
Last modified:	17.05.1995


Note:	For a detailed description please read the class documentation.

 ------------------------------------------------------------------------- */

#import < PHOddPageTool.h>
#import <misckit/MiscString.h>

@implementation PHOddPageTool

- image
{
	return [NXImage findImageNamed:"OddPageTool"];
}

- (BOOL)canProcess:aFile for:aController
{
	id	filetype;
	BOOL	result;
	
	// Let super store some data...but we don't care if it can open it or not.

	[super canProcess:aFile for:aController];

	result = NO;
	filetype = [aFile fileExtension];

	if( [filetype cmp:"ps"] == 0 )
		result = YES;
	[filetype free];

	return result;
}

- revert:sender
{
	if( !view )
	{
		if( [NXApp loadNibSection:"OddPageTool.nib" owner:self] == nil )
			NXRunAlertPanel( NULL, "Couldn't load OddPageTool.nib",
							 "OK", NULL, NULL );

	}
	// Tell the processController about the filetype we will create. That is 
	// always the packed .bit

	[processController setOutputExtension:
		[MiscString newWithString:"odd.ps"]];
	
	return [super view];
}

- processInput:inPath forOutput:outPath
{
	id	execString;

	execString = [MiscString new];

	[execString setStringValue:"cd $mainBundle; "];
	[execString cat:"psselect -o \""];
	[execString concatenate:inPath];
	[execString cat:"\""];

	// If the outfile is missing we are in deep trouble IMHO.

	[execString cat:" \""];
	[execString concatenate:outPath];
	[execString cat:"\""];

	NXLogError( [execString stringValue] );
	[activeShell executeFromStringValue:execString];

	[execString free];
	return self;
}

- startProcessing:sender
{
	if( ![super startProcessing:sender] )
		return nil;

	[startButton setImage:[NXImage findImageNamed:"StopProcess"]];
	[startButton setAction:@selector(stopProcessing:)];

	return self;
}

- stopProcessing:sender
{
	[super stopProcessing:sender];

	[startButton setImage:[NXImage findImageNamed:"StartFilterProcess"]];
	[startButton setAction:@selector(startProcessing:)];

	return self;
}

@end

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