Rev 392 | Rev 444 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 392 | Rev 393 | ||
---|---|---|---|
Line 31... | Line 31... | ||
31 | void builddlginit(DIALOGREF dp){ |
31 | void builddlginit(DIALOGREF dp){ |
32 | int i; |
32 | int i; |
33 | char s[0x100]; |
33 | char s[0x100]; |
34 | 34 | ||
35 | if(gdata->parmloaded){ |
35 | if(gdata->parmloaded){ |
36 | SetDlgItemText(dp,CATEGORYITEM, INPLACEP2CSTR(gdata->parm.category)); |
36 | SetDlgItemText(dp,CATEGORYITEM, gdata->parm.szCategory); |
37 | SetDlgItemText(dp,TITLEITEM, INPLACEP2CSTR(gdata->parm.title)); |
37 | SetDlgItemText(dp,TITLEITEM, gdata->parm.szTitle); |
38 | SetDlgItemText(dp,COPYRIGHTITEM,INPLACEP2CSTR(gdata->parm.copyright)); |
38 | SetDlgItemText(dp,COPYRIGHTITEM,gdata->parm.szCopyright); |
39 | SetDlgItemText(dp,AUTHORITEM, INPLACEP2CSTR(gdata->parm.author)); |
39 | SetDlgItemText(dp,AUTHORITEM, gdata->parm.szAuthor); |
40 | for(i=0;i<4;++i){ |
40 | for(i=0;i<4;++i){ |
41 | SetDlgItemText(dp,FIRSTMAPNAMEITEM+i,INPLACEP2CSTR(gdata->parm.map[i])); |
41 | SetDlgItemText(dp,FIRSTMAPNAMEITEM+i,gdata->parm.szMap[i]); |
42 | } |
42 | } |
43 | for(i=0;i<8;++i){ |
43 | for(i=0;i<8;++i){ |
44 | SetDlgItemText(dp,FIRSTCTLNAMEITEM+i,INPLACEP2CSTR(gdata->parm.ctl[i])); |
44 | SetDlgItemText(dp,FIRSTCTLNAMEITEM+i,gdata->parm.szCtl[i]); |
45 | } |
45 | } |
46 | }else{ |
46 | }else{ |
47 | /* strictly speaking this is not needed on the Mac, |
47 | /* strictly speaking this is not needed on the Mac, |
48 | we can set initial values statically in the rez description */ |
48 | we can set initial values statically in the rez description */ |
49 | SetDlgItemText(dp,CATEGORYITEM, "Filter Foundry"); |
49 | SetDlgItemText(dp,CATEGORYITEM, "Filter Foundry"); |
Line 93... | Line 93... | ||
93 | 93 | ||
94 | Boolean builddlgitem(DIALOGREF dp,int item){ |
94 | Boolean builddlgitem(DIALOGREF dp,int item){ |
95 | enum{MAXFIELD=0x100}; |
95 | enum{MAXFIELD=0x100}; |
96 | char s[MAXFIELD+1]; |
96 | char s[MAXFIELD+1]; |
97 | int i,needui; |
97 | int i,needui; |
98 | Str255 fname; |
98 | char fname[256]; |
99 | StandardFileReply sfr; |
99 | StandardFileReply sfr; |
100 | NavReplyRecord reply; |
100 | NavReplyRecord reply; |
101 | 101 | ||
102 | switch(item){ |
102 | switch(item){ |
103 | #ifdef MAC_ENV |
103 | #ifdef MAC_ENV |
Line 117... | Line 117... | ||
117 | return true; // don't continue (i.e. don't call EndDialog). Let the user correct the input |
117 | return true; // don't continue (i.e. don't call EndDialog). Let the user correct the input |
118 | } |
118 | } |
119 | 119 | ||
120 | // Now begin |
120 | // Now begin |
121 | memset(&gdata->parm,0,sizeof(PARM_T)); |
121 | memset(&gdata->parm,0,sizeof(PARM_T)); |
122 | GetDlgItemText(dp,CATEGORYITEM,s,MAXFIELD); myc2pstrcpy(gdata->parm.category,s); |
122 | GetDlgItemText(dp,CATEGORYITEM,gdata->parm.szCategory,MAXFIELD-4/*ProtectFlag*/); |
123 | GetDlgItemText(dp,TITLEITEM,s,MAXFIELD); myc2pstrcpy(gdata->parm.title,s); |
123 | GetDlgItemText(dp,TITLEITEM,gdata->parm.szTitle,MAXFIELD); |
124 | GetDlgItemText(dp,COPYRIGHTITEM,s,MAXFIELD); myc2pstrcpy(gdata->parm.copyright,s); |
124 | GetDlgItemText(dp,COPYRIGHTITEM,gdata->parm.szCopyright,MAXFIELD); |
125 | GetDlgItemText(dp,AUTHORITEM,s,MAXFIELD); myc2pstrcpy(gdata->parm.author,s); |
125 | GetDlgItemText(dp,AUTHORITEM,gdata->parm.szAuthor,MAXFIELD); |
126 | gdata->parm.cbSize = PARM_SIZE; |
126 | gdata->parm.cbSize = PARM_SIZE; |
127 | gdata->parm.standalone = 1; //0=original FF, 1=standalone filter |
127 | gdata->parm.standalone = 1; //0=original FF, 1=standalone filter |
128 | needui = 0; |
128 | needui = 0; |
129 | // Sliders |
129 | // Sliders |
130 | for(i = 0; i < 8; ++i){ |
130 | for(i = 0; i < 8; ++i){ |
131 | gdata->parm.val[i] = slider[i]; |
131 | gdata->parm.val[i] = slider[i]; |
132 | gdata->parm.ctl_used[i] = ctls[i] || (checksliders_result & CHECKSLIDERS_CTL_AMBIGUOUS); |
132 | gdata->parm.ctl_used[i] = ctls[i] || (checksliders_result & CHECKSLIDERS_CTL_AMBIGUOUS); |
133 | needui |= gdata->parm.ctl_used[i]; |
133 | needui |= gdata->parm.ctl_used[i]; |
134 | GetDlgItemText(dp,FIRSTCTLNAMEITEM+i,s,MAXFIELD); myc2pstrcpy(gdata->parm.ctl[i],s); |
134 | GetDlgItemText(dp,FIRSTCTLNAMEITEM+i, gdata->parm.szCtl[i],MAXFIELD); |
135 | } |
135 | } |
136 | // Maps |
136 | // Maps |
137 | for (i = 0; i < 4; ++i) { |
137 | for (i = 0; i < 4; ++i) { |
138 | gdata->parm.map_used[i] = maps[i] || (checksliders_result & CHECKSLIDERS_MAP_AMBIGUOUS); |
138 | gdata->parm.map_used[i] = maps[i] || (checksliders_result & CHECKSLIDERS_MAP_AMBIGUOUS); |
139 | needui |= gdata->parm.map_used[i]; |
139 | needui |= gdata->parm.map_used[i]; |
140 | GetDlgItemText(dp, FIRSTMAPNAMEITEM + i, s, MAXFIELD); myc2pstrcpy(gdata->parm.map[i], s); |
140 | GetDlgItemText(dp, FIRSTMAPNAMEITEM + i, gdata->parm.szMap[i], MAXFIELD); |
141 | } |
141 | } |
142 | // Expressions |
142 | // Expressions |
143 | for (i = 0; i < 4; ++i) { |
143 | for (i = 0; i < 4; ++i) { |
144 | if (!expr[i]) { |
144 | if (!expr[i]) { |
145 | simplealert(_strdup("Bug! see builddlgitem")); |
145 | simplealert(_strdup("Bug! see builddlgitem")); |
146 | return true; // keep going. Let the user try again |
146 | return true; // keep going. Let the user try again |
147 | } |
147 | } |
148 | if (strlen(expr[i]) >= sizeof(gdata->parm.formula[i])) { |
148 | if (strlen(expr[i]) >= sizeof(gdata->parm.szFormula[i])) { |
149 | if (i == 0) { |
149 | if (i == 0) { |
150 | simplealert(_strdup("Attention! The formula for channel R was too long (longer than 1023 characters) and was truncated.")); |
150 | simplealert(_strdup("Attention! The formula for channel R was too long (longer than 1023 characters) and was truncated.")); |
151 | } |
151 | } |
152 | else if (i == 1) { |
152 | else if (i == 1) { |
153 | simplealert(_strdup("Attention! The formula for channel G was too long (longer than 1023 characters) and was truncated.")); |
153 | simplealert(_strdup("Attention! The formula for channel G was too long (longer than 1023 characters) and was truncated.")); |
Line 156... | Line 156... | ||
156 | simplealert(_strdup("Attention! The formula for channel B was too long (longer than 1023 characters) and was truncated.")); |
156 | simplealert(_strdup("Attention! The formula for channel B was too long (longer than 1023 characters) and was truncated.")); |
157 | } |
157 | } |
158 | else if (i == 3) { |
158 | else if (i == 3) { |
159 | simplealert(_strdup("Attention! The formula for channel A was too long (longer than 1023 characters) and was truncated.")); |
159 | simplealert(_strdup("Attention! The formula for channel A was too long (longer than 1023 characters) and was truncated.")); |
160 | } |
160 | } |
161 | expr[i][sizeof(gdata->parm.formula[i]) - 1] = '\0'; |
161 | expr[i][sizeof(gdata->parm.szFormula[i]) - 1] = '\0'; |
162 | } |
162 | } |
163 | strcpy((char*)gdata->parm.formula[i], expr[i]); // Attention! This is not a Pascal string! |
163 | strcpy(gdata->parm.szFormula[i], expr[i]); |
164 | } |
164 | } |
165 | gdata->parm.popDialog = needui; //true if need to pop a parameter dialog |
165 | gdata->parm.popDialog = needui; //true if need to pop a parameter dialog |
166 | gdata->parm.unknown1 = gdata->parm.unknown2 = gdata->parm.unknown3 = 0; |
166 | gdata->parm.unknown1 = gdata->parm.unknown2 = gdata->parm.unknown3 = 0; |
167 | gdata->parm.iProtected = ISDLGBUTTONCHECKED(dp,PROTECTITEM); // == 1 means protected |
167 | gdata->parm.iProtected = ISDLGBUTTONCHECKED(dp,PROTECTITEM); // == 1 means protected |
168 | gdata->obfusc = ISDLGBUTTONCHECKED(dp,PROTECTITEM); |
168 | gdata->obfusc = ISDLGBUTTONCHECKED(dp,PROTECTITEM); |
169 | 169 | ||
170 | PLstrcpy(fname, gdata->parm.title); |
170 | strcpy(fname, gdata->parm.szTitle); |
171 | #ifdef MACMACHO |
171 | #ifdef MACMACHO |
172 | PLstrcat(fname, (StringPtr)"\p.plugin"); // "\p" means "Pascal string" |
172 | strcat(fname, ".plugin"); |
173 | #endif |
173 | #endif |
174 | if (putfile( |
174 | if (putfile( |
175 | #ifdef MAC_ENV |
175 | #ifdef MAC_ENV |
176 | (StringPtr)_strdup("\pMake standalone filter"), // "\p" means "Pascal string" |
176 | (StringPtr)_strdup("\pMake standalone filter"), // "\p" means "Pascal string" |
177 | #else |
177 | #else |
178 | (StringPtr)_strdup("\026Make standalone filter"), |
178 | (StringPtr)_strdup("\026Make standalone filter"), |
179 | #endif |
179 | #endif |
180 | fname, |
180 | (StringPtr)myc2pstr(_strdup(fname)), |
181 | PS_FILTER_FILETYPE, kPhotoshopSignature, &reply, &sfr, |
181 | PS_FILTER_FILETYPE, kPhotoshopSignature, &reply, &sfr, |
182 | "8bf", "Filter plugin file (.8bf)\0*.8bf\0\0", 1 |
182 | "8bf", "Filter plugin file (.8bf)\0*.8bf\0\0", 1 |
183 | #ifdef _WIN32 |
183 | #ifdef _WIN32 |
184 | , (HWND)dp |
184 | , (HWND)dp |
185 | #endif /* _WIN32 */ |
185 | #endif /* _WIN32 */ |