Subversion Repositories filter_foundry

Rev

Rev 449 | Blame | Compare with Previous | Last modification | View Log | RSS feed

  1. /*
  2.     This file is part of a common library
  3.     Copyright (C) 2002-2006 Toby Thain, toby@telegraphics.net
  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. #ifndef CHOOSEFILE_H_
  21. #define CHOOSEFILE_H_
  22.  
  23. #include "world.h"
  24.  
  25. #ifdef macintosh
  26.         #ifdef __GNUC__ // FIXME: this isn't the right define
  27.                 typedef struct StandardFileReply {
  28.                         Boolean         sfGood;
  29.                         Boolean         sfReplacing;
  30.                         OSType          sfType;
  31.                         FSSpec          sfFile;
  32.                         ScriptCode      sfScript;
  33.                 } StandardFileReply;
  34.         #else
  35.                 #include <standardfile.h>
  36.                 #include <filetypesandcreators.h>
  37.         #endif
  38.         #include <Navigation.h> // this header is not in CW Pro 1
  39. #else
  40.         #include "compat_win.h"
  41. #endif
  42.  
  43. #ifndef __NAVIGATION__
  44.         typedef struct NavReplyRecord {
  45.                 ScriptCode keyScript;
  46.         } NavReplyRecord;
  47. #endif
  48.  
  49. #ifdef macintosh
  50.     typedef StringPtr PString;
  51. #else
  52.     typedef LPCTSTR PString;
  53. #endif
  54.  
  55. Boolean fileHasExtension(StandardFileReply* sfr, const TCHAR* extension);
  56.  
  57. Boolean customchoosefile_nav(FSSpec *fss,ScriptCode *script,
  58.                              OSType tlist[], PString extlist[],Boolean *premult);
  59.  
  60. Boolean choosefiletypes(PString prompt,StandardFileReply *sfr,NavReplyRecord *reply,
  61.                         OSType types[],int ntypes,const TCHAR *lpstrFilter
  62.                         #ifdef _WIN32
  63.                         ,HWND hwndOwner
  64.                         #endif /* _WIN32 */
  65. );
  66.  
  67. Boolean choosefile(PString prompt,StandardFileReply *sfr,
  68.                    NavReplyRecord *reply,OSType type,const TCHAR *lpstrFilter
  69.                    #ifdef _WIN32
  70.                    ,HWND hwndOwner
  71.                    #endif /* _WIN32 */
  72. );
  73.  
  74. /* http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI/WindowsUserInterface/UserInput/CommonDialogBoxLibrary/CommonDialogBoxReference/CommonDialogBoxStructures/OPENFILENAME.asp
  75. lpstrFilter
  76. Pointer to a buffer containing pairs of null-terminated filter strings.
  77. The last string in the buffer must be terminated by two NULL characters.
  78. The first string in each pair is a display string that describes the filter
  79. (for example, "Text Files"), and the second string specifies the filter pattern
  80. (for example, "*.TXT"). To specify multiple filter patterns for a single display string,
  81. use a semicolon to separate the patterns (for example, "*.TXT;*.DOC;*.BAK").
  82. A pattern string can be a combination of valid file name characters
  83. and the asterisk (*) wildcard character. Do not include spaces in the pattern string.
  84. */
  85.  
  86. Boolean putfile(PString prompt, PString fname,OSType fileType,OSType fileCreator,
  87.                 NavReplyRecord *reply,StandardFileReply *sfr,
  88.                 const TCHAR *lpstrDefExt, const TCHAR *lpstrFilter,int nFilterIndex
  89.                 #ifdef _WIN32
  90.                 ,HWND hwndOwner
  91.                 #endif /* _WIN32 */
  92. );
  93.  
  94. OSErr completesave(NavReplyRecord *reply);
  95.  
  96. Boolean choosefile_sf(PString prompt,StandardFileReply *sfr,NavReplyRecord *reply,
  97.                       OSType type,const TCHAR *lpstrFilter);
  98.  
  99. Boolean putfile_sf(PString prompt, PString fname,
  100.                    OSType fileType,OSType fileCreator,
  101.                    NavReplyRecord *reply,StandardFileReply *sfr);
  102.  
  103. OSErr completesave_sf(NavReplyRecord *reply);
  104.  
  105. Boolean customchoosefile_nav(FSSpec *fss,ScriptCode *script,
  106.                              OSType tlist[], PString extlist[],Boolean *premult);
  107.  
  108. Boolean choosefile_nav(PString prompt,StandardFileReply *sfr,NavReplyRecord *reply,
  109.                        OSType type,const TCHAR *lpstrFilter);
  110.  
  111. Boolean putfile_nav(PString prompt, PString fname,
  112.                     OSType fileType,OSType fileCreator,
  113.                     NavReplyRecord *reply,StandardFileReply *sfr);
  114.  
  115. OSErr completesave_nav(NavReplyRecord *reply);
  116.  
  117. #endif
  118.