Subversion Repositories filter_foundry

Rev

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

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