Subversion Repositories filter_foundry

Rev

Rev 2 | Rev 23 | 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-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.  
  20. #include "ff.h"
  21.  
  22. #include "file_compat.h"
  23.  
  24. Boolean readPARMresource(HMODULE hm,char **reason){
  25.         Boolean res = false;
  26.         Handle h;
  27.         if(h = Get1Resource(PARM_TYPE,PARM_ID)){
  28.                 HLock(h);
  29.                 res = readPARM(*h,&gdata->parm,reason);
  30.                 ReleaseResource(h);
  31.         }
  32.         return res;
  33. }
  34.  
  35. Boolean loadfile(StandardFileReply *sfr,char **reason){
  36.         Boolean readok = false;
  37.         FInfo fndrInfo;
  38.         short rrn;
  39.  
  40.         if(!FSpGetFInfo(&sfr->sfFile,&fndrInfo))
  41.                 switch(fndrInfo.fdType){
  42.                 case TEXT_FILETYPE:
  43.                         if(readok = readfile(sfr,reason))
  44.                                 gdata->parmloaded = false;
  45.                         break;
  46.                 case PS_FILTER_FILETYPE:
  47.                         if( (rrn = FSpOpenResFile(&sfr->sfFile,fsRdPerm)) != -1 ){
  48.                                 if(readPARMresource(NULL,reason)){
  49.                                         if(gdata->parm.iProtected)
  50.                                                 *reason = ("The filter is protected.");
  51.                                         else
  52.                                                 readok = gdata->parmloaded = true;
  53.                                 }else *reason = ("It is not a standalone filter made by Filter Factory/Filter Foundry.");
  54.                                 CloseResFile(rrn);
  55.                         }else *reason = "Could not open file.";
  56.                         break;
  57.                 }
  58.  
  59.         return readok;
  60. }
  61.