Rev 53 | Rev 85 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2 | toby | 1 | /* |
18 | toby | 2 | This file is part of "Filter Foundry", a filter plugin for Adobe Photoshop |
2 | toby | 3 | Copyright (C) 2003-5 Toby Thain, toby@telegraphics.com.au |
4 | |||
5 | This program is free software; you can redistribute it and/or modify |
||
6 | it under the terms of the GNU General Public License as published by |
||
7 | the Free Software Foundation; either version 2 of the License, or |
||
8 | (at your option) any later version. |
||
9 | |||
10 | This program is distributed in the hope that it will be useful, |
||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
13 | GNU General Public License for more details. |
||
14 | |||
15 | You should have received a copy of the GNU General Public License |
||
16 | along with this program; if not, write to the Free Software |
||
17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
||
18 | */ |
||
19 | |||
8 | toby | 20 | #include "world.h" |
2 | toby | 21 | |
22 | #include "PIFilter.h" |
||
23 | |||
24 | #include "entry.h" |
||
8 | toby | 25 | |
2 | toby | 26 | #include "choosefile.h" |
27 | #include "ui.h" |
||
28 | #include "file_compat.h" |
||
29 | #include "symtab.h" |
||
30 | #include "PARM.h" |
||
31 | |||
32 | enum{ |
||
33 | TAB = 011, |
||
8 | toby | 34 | LF = 012, |
35 | CR = 015, |
||
2 | toby | 36 | |
37 | CHUNK_ROWS = 64, |
||
38 | |||
39 | PARM_TYPE = 'PARM', |
||
40 | PARM_ID = 16000, |
||
41 | TEXT_FILETYPE = 'TEXT', |
||
42 | SIG_SIMPLETEXT = 'ttxt', |
||
43 | PS_FILTER_FILETYPE = '8BFM' |
||
44 | }; |
||
45 | |||
46 | typedef struct{ |
||
47 | Boolean standalone,parmloaded; |
||
48 | PARM_T parm; |
||
49 | } globals_t; |
||
50 | |||
51 | extern globals_t *gdata; |
||
52 | extern FilterRecordPtr gpb; |
||
53 | |||
54 | extern struct node *tree[4]; |
||
55 | extern char *err[4]; |
||
56 | extern int errpos[4],errstart[4],nplanes; |
||
57 | extern value_type slider[8],cell[0x100],map[4][0x100]; |
||
58 | extern char *expr[4]; |
||
37 | toby | 59 | extern long maxSpace; |
2 | toby | 60 | |
61 | extern int tokpos,tokstart,varused[]; |
||
62 | extern char *errstr; |
||
63 | |||
64 | #if 1 |
||
65 | #define PINEWHANDLE gpb->handleProcs->newProc |
||
66 | #define PIDISPOSEHANDLE gpb->handleProcs->disposeProc |
||
67 | #define PIGETHANDLESIZE gpb->handleProcs->getSizeProc |
||
68 | #define PISETHANDLESIZE gpb->handleProcs->setSizeProc |
||
69 | #define PILOCKHANDLE gpb->handleProcs->lockProc |
||
70 | #define PIUNLOCKHANDLE gpb->handleProcs->unlockProc |
||
71 | #else |
||
72 | // avoid host callbacks for AE |
||
73 | #define PINEWHANDLE NewHandle |
||
74 | #define PIDISPOSEHANDLE DisposeHandle |
||
75 | #define PIGETHANDLESIZE GetHandleSize |
||
76 | #define PISETHANDLESIZE(h,s) ( SetHandleSize(h,s),MemError() ) |
||
77 | #define PILOCKHANDLE(h,f) ( HLock(h),*(h) ) |
||
78 | #define PIUNLOCKHANDLE HUnlock |
||
79 | #endif |
||
80 | |||
81 | #define MIN(a,b) ((a) < (b) ? (a) : (b)) |
||
82 | #define MAX(a,b) ((a) > (b) ? (a) : (b)) |
||
83 | |||
84 | #define DBG(x) |
||
85 | //#define DEBUG |
||
86 | |||
87 | |||
88 | DLLEXPORT MACPASCAL |
||
89 | void ENTRYPOINT(short selector,FilterRecordPtr epb,long *data,short *result); |
||
90 | |||
91 | void DoPrepare (FilterRecordPtr epb); |
||
92 | void DoStart (FilterRecordPtr epb); |
||
93 | OSErr DoContinue (FilterRecordPtr epb); |
||
94 | void DoFinish (FilterRecordPtr epb); |
||
95 | void RequestNext (FilterRecordPtr epb,long); |
||
96 | |||
97 | Boolean readparams(Handle h,Boolean alerts,char **reason); |
||
98 | Handle readfileintohandle(FILEREF r); |
||
99 | Boolean readfile(StandardFileReply *sfr,char **reason); |
||
45 | toby | 100 | Boolean readPARM(Ptr h,PARM_T *parm,char **reasonstr,int fromwin); |
2 | toby | 101 | |
102 | OSErr saveparams(Handle h); |
||
103 | OSErr savehandleintofile(Handle h,FILEREF r); |
||
104 | Boolean savefile(StandardFileReply *sfr); |
||
105 | |||
106 | OSErr make_standalone(StandardFileReply *sfr); |
||
107 | |||
108 | Boolean setup(FilterRecordPtr pb); |
||
109 | void evalpixel(unsigned char *outp,unsigned char *inp); |
||
53 | toby | 110 | OSErr process_scaled(FilterRecordPtr pb, Boolean progress, |
62 | toby | 111 | Rect *filterRect, Rect *outRect, |
112 | void *outData, long outRowBytes, double zoom); |
||
2 | toby | 113 | |
114 | unsigned long printablehash(unsigned long hash); |
||
115 | long fixpipl(PIPropertyList *pipl,long origsize,StringPtr title); |
||
116 | long fixaete(unsigned char *p,long origsize,StringPtr title); |
||
117 | |||
118 | Boolean loadfile(StandardFileReply *sfr,char **reason); |
||
119 | Boolean readPARMresource(HMODULE hm,char **reason); |
||
120 | |||
121 | void dbglasterror(char*); |
||
13 | toby | 122 | |
123 | // from parser.y |
||
124 | struct node *parseexpr(char *s); |