Rev 371 | Rev 444 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 371 | Rev 439 | ||
---|---|---|---|
1 | /* |
1 | /* |
2 | This file is part of a common library |
2 | This file is part of a common library |
3 | Copyright (C) 2002-6 Toby Thain, toby@telegraphics.com.au |
3 | Copyright (C) 2002-6 Toby Thain, toby@telegraphics.com.au |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify |
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 |
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 |
7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. |
8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, |
10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. |
13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License |
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 |
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 |
17 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
18 | */ |
18 | */ |
19 | 19 | ||
20 | #ifndef CHOOSEFILE_H |
20 | #ifndef CHOOSEFILE_H_ |
21 | #define CHOOSEFILE_H |
21 | #define CHOOSEFILE_H_ |
22 | 22 | ||
23 | #ifdef macintosh |
23 | #ifdef macintosh |
24 | #ifdef __GNUC__ // FIXME: this isn't the right define |
24 | #ifdef __GNUC__ // FIXME: this isn't the right define |
25 | typedef struct StandardFileReply { |
25 | typedef struct StandardFileReply { |
26 | Boolean sfGood; |
26 | Boolean sfGood; |
27 | Boolean sfReplacing; |
27 | Boolean sfReplacing; |
28 | OSType sfType; |
28 | OSType sfType; |
29 | FSSpec sfFile; |
29 | FSSpec sfFile; |
30 | ScriptCode sfScript; |
30 | ScriptCode sfScript; |
31 | } StandardFileReply; |
31 | } StandardFileReply; |
32 | #else |
32 | #else |
33 | #include <standardfile.h> |
33 | #include <standardfile.h> |
34 | #include <filetypesandcreators.h> |
34 | #include <filetypesandcreators.h> |
35 | #endif |
35 | #endif |
36 | #include <Navigation.h> // this header is not in CW Pro 1 |
36 | #include <Navigation.h> // this header is not in CW Pro 1 |
37 | #else |
37 | #else |
38 | #include "compat_win.h" |
38 | #include "compat_win.h" |
39 | #endif |
39 | #endif |
40 | 40 | ||
41 | #ifndef __NAVIGATION__ |
41 | #ifndef __NAVIGATION__ |
42 | typedef struct NavReplyRecord { |
42 | typedef struct NavReplyRecord { |
43 | ScriptCode keyScript; |
43 | ScriptCode keyScript; |
44 | } NavReplyRecord; |
44 | } NavReplyRecord; |
45 | #endif |
45 | #endif |
46 | 46 | ||
47 | Boolean fileHasExtension(StandardFileReply* sfr, const char* extension); |
47 | Boolean fileHasExtension(StandardFileReply* sfr, const char* extension); |
48 | 48 | ||
49 | Boolean customchoosefile_nav(FSSpec *fss,ScriptCode *script, |
49 | Boolean customchoosefile_nav(FSSpec *fss,ScriptCode *script, |
50 | OSType tlist[], StringPtr extlist[],Boolean *premult); |
50 | OSType tlist[], StringPtr extlist[],Boolean *premult); |
51 | 51 | ||
52 | Boolean choosefiletypes(StringPtr prompt,StandardFileReply *sfr,NavReplyRecord *reply, |
52 | Boolean choosefiletypes(StringPtr prompt,StandardFileReply *sfr,NavReplyRecord *reply, |
53 | OSType types[],int ntypes,const char *lpstrFilter |
53 | OSType types[],int ntypes,const char *lpstrFilter |
54 | #ifdef _WIN32 |
54 | #ifdef _WIN32 |
55 | ,HWND hwndOwner |
55 | ,HWND hwndOwner |
56 | #endif /* _WIN32 */ |
56 | #endif /* _WIN32 */ |
57 | ); |
57 | ); |
58 | 58 | ||
59 | Boolean choosefile(StringPtr prompt,StandardFileReply *sfr, |
59 | Boolean choosefile(StringPtr prompt,StandardFileReply *sfr, |
60 | NavReplyRecord *reply,OSType type,const char *lpstrFilter |
60 | NavReplyRecord *reply,OSType type,const char *lpstrFilter |
61 | #ifdef _WIN32 |
61 | #ifdef _WIN32 |
62 | ,HWND hwndOwner |
62 | ,HWND hwndOwner |
63 | #endif /* _WIN32 */ |
63 | #endif /* _WIN32 */ |
64 | ); |
64 | ); |
65 | 65 | ||
66 | /* http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI/WindowsUserInterface/UserInput/CommonDialogBoxLibrary/CommonDialogBoxReference/CommonDialogBoxStructures/OPENFILENAME.asp |
66 | /* http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI/WindowsUserInterface/UserInput/CommonDialogBoxLibrary/CommonDialogBoxReference/CommonDialogBoxStructures/OPENFILENAME.asp |
67 | lpstrFilter |
67 | lpstrFilter |
68 | Pointer to a buffer containing pairs of null-terminated filter strings. |
68 | Pointer to a buffer containing pairs of null-terminated filter strings. |
69 | The last string in the buffer must be terminated by two NULL characters. |
69 | The last string in the buffer must be terminated by two NULL characters. |
70 | The first string in each pair is a display string that describes the filter |
70 | The first string in each pair is a display string that describes the filter |
71 | (for example, "Text Files"), and the second string specifies the filter pattern |
71 | (for example, "Text Files"), and the second string specifies the filter pattern |
72 | (for example, "*.TXT"). To specify multiple filter patterns for a single display string, |
72 | (for example, "*.TXT"). To specify multiple filter patterns for a single display string, |
73 | use a semicolon to separate the patterns (for example, "*.TXT;*.DOC;*.BAK"). |
73 | use a semicolon to separate the patterns (for example, "*.TXT;*.DOC;*.BAK"). |
74 | A pattern string can be a combination of valid file name characters |
74 | A pattern string can be a combination of valid file name characters |
75 | and the asterisk (*) wildcard character. Do not include spaces in the pattern string. |
75 | and the asterisk (*) wildcard character. Do not include spaces in the pattern string. |
76 | */ |
76 | */ |
77 | 77 | ||
78 | Boolean putfile(StringPtr prompt,StringPtr fname,OSType fileType,OSType fileCreator, |
78 | Boolean putfile(StringPtr prompt,StringPtr fname,OSType fileType,OSType fileCreator, |
79 | NavReplyRecord *reply,StandardFileReply *sfr, |
79 | NavReplyRecord *reply,StandardFileReply *sfr, |
80 | const char *lpstrDefExt, const char *lpstrFilter,int nFilterIndex |
80 | const char *lpstrDefExt, const char *lpstrFilter,int nFilterIndex |
81 | #ifdef _WIN32 |
81 | #ifdef _WIN32 |
82 | ,HWND hwndOwner |
82 | ,HWND hwndOwner |
83 | #endif /* _WIN32 */ |
83 | #endif /* _WIN32 */ |
84 | ); |
84 | ); |
85 | 85 | ||
86 | OSErr completesave(NavReplyRecord *reply); |
86 | OSErr completesave(NavReplyRecord *reply); |
87 | 87 | ||
88 | Boolean choosefile_sf(StringPtr prompt,StandardFileReply *sfr,NavReplyRecord *reply, |
88 | Boolean choosefile_sf(StringPtr prompt,StandardFileReply *sfr,NavReplyRecord *reply, |
89 | OSType type,const char *lpstrFilter); |
89 | OSType type,const char *lpstrFilter); |
90 | 90 | ||
91 | Boolean putfile_sf(StringPtr prompt,StringPtr fname, |
91 | Boolean putfile_sf(StringPtr prompt,StringPtr fname, |
92 | OSType fileType,OSType fileCreator, |
92 | OSType fileType,OSType fileCreator, |
93 | NavReplyRecord *reply,StandardFileReply *sfr); |
93 | NavReplyRecord *reply,StandardFileReply *sfr); |
94 | 94 | ||
95 | OSErr completesave_sf(NavReplyRecord *reply); |
95 | OSErr completesave_sf(NavReplyRecord *reply); |
96 | 96 | ||
97 | Boolean customchoosefile_nav(FSSpec *fss,ScriptCode *script, |
97 | Boolean customchoosefile_nav(FSSpec *fss,ScriptCode *script, |
98 | OSType tlist[], StringPtr extlist[],Boolean *premult); |
98 | OSType tlist[], StringPtr extlist[],Boolean *premult); |
99 | 99 | ||
100 | Boolean choosefile_nav(StringPtr prompt,StandardFileReply *sfr,NavReplyRecord *reply, |
100 | Boolean choosefile_nav(StringPtr prompt,StandardFileReply *sfr,NavReplyRecord *reply, |
101 | OSType type,const char *lpstrFilter); |
101 | OSType type,const char *lpstrFilter); |
102 | 102 | ||
103 | Boolean putfile_nav(StringPtr prompt,StringPtr fname, |
103 | Boolean putfile_nav(StringPtr prompt,StringPtr fname, |
104 | OSType fileType,OSType fileCreator, |
104 | OSType fileType,OSType fileCreator, |
105 | NavReplyRecord *reply,StandardFileReply *sfr); |
105 | NavReplyRecord *reply,StandardFileReply *sfr); |
106 | 106 | ||
107 | OSErr completesave_nav(NavReplyRecord *reply); |
107 | OSErr completesave_nav(NavReplyRecord *reply); |
108 | 108 | ||
109 | #endif |
109 | #endif |
110 | 110 |