Subversion Repositories filter_foundry

Rev

Rev 489 | Rev 502 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. /*
  2.     This file is part of "Filter Foundry", a filter plugin for Adobe Photoshop
  3.     Copyright (C) 2003-2009 Toby Thain, toby@telegraphics.com.au
  4.     Copyright (C) 2018-2021 Daniel Marschall, ViaThinkSoft
  5.  
  6.     This program is free software; you can redistribute it and/or modify
  7.     it under the terms of the GNU General Public License as published by
  8.     the Free Software Foundation; either version 2 of the License, or
  9.     (at your option) any later version.
  10.  
  11.     This program is distributed in the hope that it will be useful,
  12.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.     GNU General Public License for more details.
  15.  
  16.     You should have received a copy of the GNU General Public License
  17.     along with this program; if not, write to the Free Software
  18.     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  19. */
  20.  
  21. #ifndef FF_H_
  22. #define FF_H_
  23.  
  24. #include "world.h"
  25.  
  26. #include "PIFilter.h"
  27.  
  28. #include "entry.h"
  29.  
  30. #include "choosefile.h"
  31. #include "ui.h"
  32. #include "file_compat.h"
  33. #include "symtab.h"
  34. #include "PARM.h"
  35. #include "preview.h"
  36. #include "ff_misc.h"
  37. #include "language.h"
  38.  
  39. #define HOSTSIG_GIMP 'PMIG' // sic: NOT 'GIMP'
  40. #define HOSTSIG_IRFANVIEW 'UP20'
  41. #define HOSTSIG_PHOTOSHOP '8BIM'
  42. //#define HOSTSIG_PLUGINCOMMANDER '8BIM' // meh.
  43. //#define HOSTSIG_SERIF_PHOTOPLUS '8BIM' // meh.
  44. #define HOSTSIG_JASC_PAINTSHOP_PRO_X 'PSP9'
  45. #define HOSTSIG_PAINT_NET 'NDP.'
  46. #define HOSTSIG_ADOBE_PREMIERE '8B)M'/*sic*/
  47.  
  48. enum{
  49.         TAB = 011,
  50.         LF  = 012,
  51.         CR  = 015,
  52.  
  53.         CHUNK_ROWS = 64,
  54.  
  55.         TEXT_FILETYPE = 'TEXT',
  56.         SIG_SIMPLETEXT = 'ttxt',
  57.         PS_FILTER_FILETYPE = '8BFM'
  58. };
  59.  
  60. #ifdef _WIN32
  61. typedef struct none_slider_info_ {
  62.         BOOL initialized;
  63. } none_slider_info;
  64.  
  65. typedef struct comctl_slider_info_ {
  66.         BOOL initialized;
  67.         HMODULE hLib;
  68. } comctl_slider_info;
  69.  
  70. typedef struct plugin_dll_slider_info_ {
  71.         BOOL initialized;
  72.         HMODULE hLib;
  73.         DWORD messageId;
  74. } plugin_dll_slider_info;
  75. #endif
  76.  
  77. // size: 0x2090 (8336 Bytes)
  78. typedef struct globals_t_ {
  79.         PARM_T parm;
  80.         Boolean standalone;
  81.         Boolean parmloaded; // this means that the filter is loaded, but without PARM (title, author, etc.)
  82.         Boolean obfusc;
  83.         // (padding of 1 byte here)
  84.         OSType lastKnownBufferVersion;
  85.         OSType lastKnownHandleVersion;
  86. #ifdef _WIN32
  87.         HWND hWndMainDlg;
  88.         none_slider_info noneSliderInfo;
  89.         comctl_slider_info comctlSliderInfo;
  90.         plugin_dll_slider_info pluginDllSliderInfo;
  91. #endif /* _WIN32 */
  92. } globals_t;
  93.  
  94. extern globals_t *gdata;
  95.  
  96. #define NUM_CELLS 0x100
  97.  
  98. extern struct node *tree[4];
  99. extern TCHAR *err[4];
  100. extern int errpos[4],errstart[4];//,nplanes;
  101. extern uint8_t slider[8];
  102. extern value_type cell[NUM_CELLS];
  103. extern char *expr[4];
  104.  
  105. extern int tokpos,tokstart,varused[];
  106. extern TCHAR *errstr;
  107.  
  108. //#define DEBUG
  109.  
  110. typedef struct InternalState_ {
  111.         Boolean bak_obfusc;
  112.         Boolean bak_standalone;
  113.         Boolean bak_parmloaded;
  114.         char* bak_expr[4];
  115.         uint8_t bak_slider[8];
  116.         PARM_T bak_parm;
  117. } InternalState;
  118.  
  119. // from main.c
  120. unsigned long get_parm_hash(PARM_T *parm);
  121. void DoPrepare(FilterRecordPtr epb);
  122. void DoStart(FilterRecordPtr epb);
  123. OSErr DoContinue(FilterRecordPtr epb);
  124. void DoFinish(FilterRecordPtr epb);
  125. void RequestNext(FilterRecordPtr epb);
  126. InternalState saveInternalState();
  127. void restoreInternalState(InternalState state);
  128.  
  129. // from read.c
  130. Boolean readparams_afs_pff(Handle h, TCHAR**reason);
  131. void convert_premiere_to_photoshop(PARM_T* photoshop, PARM_T_PREMIERE* premiere);
  132. Boolean readfile_8bf(StandardFileReply *sfr, TCHAR**reason);
  133. Handle readfileintohandle(FILEREF r);
  134. Boolean readfile_afs_pff(StandardFileReply* sfr, TCHAR** reason);
  135. Boolean readfile_ffx(StandardFileReply* sfr, TCHAR** reason);
  136. Boolean readfile_picotxt(StandardFileReply* sfr, TCHAR** reason);
  137. Boolean readPARM(PARM_T* parm,Ptr h);
  138.  
  139. // from save.c
  140. OSErr saveparams_afs_pff(Handle h);
  141. OSErr saveparams_picotxt(Handle h, Boolean useparm);
  142. OSErr savehandleintofile(Handle h,FILEREF r);
  143. Boolean savefile_afs_pff_picotxt(StandardFileReply *sfr);
  144.  
  145. // from make_*.c
  146. OSErr make_standalone(StandardFileReply *sfr);
  147.  
  148. // from process.c
  149. Boolean setup(FilterRecordPtr pb);
  150. void evalpixel(unsigned char *outp,unsigned char *inp);
  151.  
  152. // from make.c
  153. unsigned long printablehash(unsigned long hash);
  154. size_t fixpipl(PIPropertyList *pipl,size_t origsize,char* title, long *event_id);
  155. size_t aete_generate(void* aeteptr, PARM_T *pparm, long event_id);
  156.  
  157. // from obfusc.c
  158. extern const volatile uint64_t cObfuscSeed; // this value will be manipulated during the building of each individual filter (see make_win.c)
  159. int obfuscation_version(PARM_T* pparm);
  160. uint64_t obfusc(PARM_T* pparm);
  161. void deobfusc(PARM_T* pparm);
  162.  
  163. // from loadfile_*.c
  164. Boolean loadfile(StandardFileReply *sfr, TCHAR**reason);
  165. Boolean readPARMresource(HMODULE hm, TCHAR**reason);
  166.  
  167. // from main.c
  168. int64_t maxspace();
  169. Boolean maxspace_available();
  170. Boolean host_preserves_parameters();
  171.  
  172. // from parser.y
  173. struct node *parseexpr(char *s);
  174.  
  175. // from funcs.c
  176. void factory_initialize_rnd_variables();
  177.  
  178. // Useful macros
  179.  
  180. // Note: "bigDocumentData->PluginUsing32BitCoordinates" will be set by filterSelectorStart, if HAS_BIG_DOC(pb) is true
  181. #define HAS_BIG_DOC(x) ((x)->bigDocumentData != NULL)
  182.  
  183. #define BIGDOC_IMAGE_SIZE(x) ((x)->bigDocumentData->imageSize32)
  184. #define IMAGE_SIZE(x) ((x)->imageSize)
  185.  
  186. #define BIGDOC_FILTER_RECT(x) ((x)->bigDocumentData->filterRect32)
  187. #define FILTER_RECT(x) ((x)->filterRect)
  188.  
  189. #define BIGDOC_IN_RECT(x) ((x)->bigDocumentData->inRect32)
  190. #define IN_RECT(x) ((x)->inRect)
  191.  
  192. #define BIGDOC_OUT_RECT(x) ((x)->bigDocumentData->outRect32)
  193. #define OUT_RECT(x) ((x)->outRect)
  194.  
  195. #define BIGDOC_MASK_RECT(x) ((x)->bigDocumentData->maskRect32)
  196. #define MASK_RECT(x) ((x)->maskRect)
  197.  
  198. #define BIGDOC_FLOAT_COORD(x) ((x)->bigDocumentData->floatCoord32)
  199. #define FLOAT_COORD(x) ((x)->floatCoord)
  200.  
  201. #define BIGDOC_WHOLE_SIZE(x) ((x)->bigDocumentData->wholeSize32)
  202. #define WHOLE_SIZE(x) ((x)->wholeSize)
  203.  
  204. #endif
  205.