This is ToyWinPCD.m in view mode; [Download] [Up]
#import <appkit/Application.h> #import <appkit/appkit.h> #import <sys/file.h> #import <stdio.h> #import <stdlib.h> #import <string.h> #import "ToyWinPCD.h" #import "PrefControl.h" #import "strfunc.h" #define pcdCOMMAND "hpcdtoppm" static int prefBase = 0; static int prefBright = 0; @implementation ToyWinPCD + (void)setBase:(int)base bright:(int)bright { prefBase = base; prefBright = bright; } - (commonInfo *)drawToyWin:(const char *)fileName type:(int)type map:(unsigned char **)map err:(int *)err { int x; char buf[256]; static const char *const brightTab[] = { ":+", "", ":-" }; static const char *const baseTab[] = { "B-16", "B-4", "B", "B+4", "B+16", "B+64" }; for (x = 0; execList[x]; x++) ; execList[x] = (char *)fileName; sprintf(buf, "%s(%s%s)", fileName, baseTab[prefBase], brightTab[prefBright]); return [super drawToyWin:buf type:type map:map err:err]; } - setting { int n; char **list; static char buf[128]; static char *brightTab[] = { "-c+", "-c0", "-c-" }; static char *baseTab[] = { "-1", "-2", "-3", "-4", "-5", "-6" }; list = (char **)malloc(sizeof(char *) * 6); n = dircopy(buf, NXArgv[0], YES); list[0] = buf; strcpy(&buf[n], pcdCOMMAND); list[1] = &buf[n]; list[2] = brightTab[prefBright]; list[3] = baseTab[prefBase]; list[4] = NULL; /* filename */ list[5] = NULL; [self setExecList: list ext: "pcd"]; return self; } @end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.