home *** CD-ROM | disk | FTP | other *** search
- #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"
-
- @implementation ToyWinPCD
-
- - (int)drawToyWin:(const char *)fileName Type:(int)type Num:(int)num
- {
- 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[base], brightTab[bright]);
- return [super drawToyWin: buf Type: type Num: num];
- }
-
- - setPreference: pref
- {
- 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];
- [pref pcdSize: &base bright: &bright];
- list[2] = brightTab[bright];
- list[3] = baseTab[base];
- list[4] = NULL; /* filename */
- list[5] = NULL;
- [self setExecList: list ext: "pcd"];
- return self;
- }
-
- @end
-