Rev 259 | Rev 369 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 259 | Rev 268 | ||
---|---|---|---|
Line 1... | Line 1... | ||
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 |
Line 29... | Line 29... | ||
29 | #include "str.h" |
29 | #include "str.h" |
30 | #include "dbg.h" |
30 | #include "dbg.h" |
31 | #include "compat_string.h" |
31 | #include "compat_string.h" |
32 | 32 | ||
33 | Boolean choosefiletypes(StringPtr prompt,StandardFileReply *sfr,NavReplyRecord *reply, |
33 | Boolean choosefiletypes(StringPtr prompt,StandardFileReply *sfr,NavReplyRecord *reply, |
34 | OSType types[],int ntypes,const char *lpstrFilter,HWND hwndOwner){ |
34 | OSType types[],int ntypes,const char *lpstrFilter,HWND hwndOwner){ |
35 | return choosefile(prompt,sfr,reply,types[0],lpstrFilter,hwndOwner); |
35 | return choosefile(prompt,sfr,reply,types[0],lpstrFilter,hwndOwner); |
36 | } |
36 | } |
37 | 37 | ||
38 | Boolean choosefile(StringPtr prompt,StandardFileReply *sfr,NavReplyRecord *reply,OSType type,const char *lpstrFilter,HWND hwndOwner){ |
38 | Boolean choosefile(StringPtr prompt,StandardFileReply *sfr,NavReplyRecord *reply,OSType type,const char *lpstrFilter,HWND hwndOwner){ |
39 | OPENFILENAME ofn; |
39 | OPENFILENAME ofn; |
Line 54... | Line 54... | ||
54 | 54 | ||
55 | if(GetOpenFileName(&ofn)){ |
55 | if(GetOpenFileName(&ofn)){ |
56 | myc2pstrcpy(sfr->sfFile.name,file); |
56 | myc2pstrcpy(sfr->sfFile.name,file); |
57 | sfr->nFileExtension = ofn.nFileExtension; |
57 | sfr->nFileExtension = ofn.nFileExtension; |
58 | return sfr->sfGood = true; |
58 | return sfr->sfGood = true; |
59 | } |
59 | }else{ |
60 | #ifdef DEBUG |
60 | #ifdef DEBUG |
61 | else{ |
- | |
62 | char s[0x10]; |
61 | char s[0x10]; |
63 | sprintf(s,"GetOpenFileName(): error %d",CommDlgExtendedError()); |
62 | sprintf(s,"GetOpenFileName(): error %d",CommDlgExtendedError()); |
64 | dbg(s); |
63 | dbg(s); |
- | 64 | #endif |
|
65 | } |
65 | } |
66 | #endif |
- | |
67 | 66 | ||
68 | return sfr->sfGood = false; |
67 | return sfr->sfGood = false; |
69 | } |
68 | } |
70 | 69 | ||
71 | Boolean putfile(StringPtr prompt,StringPtr fname,OSType fileType,OSType fileCreator, |
70 | Boolean putfile(StringPtr prompt,StringPtr fname,OSType fileType,OSType fileCreator, |
72 | NavReplyRecord *reply,StandardFileReply *sfr, |
71 | NavReplyRecord *reply,StandardFileReply *sfr, |
73 | const char *lpstrDefExt,const char *lpstrFilter,int nFilterIndex, |
72 | const char *lpstrDefExt,const char *lpstrFilter,int nFilterIndex, |
74 | HWND hwndOwner){ |
73 | HWND hwndOwner){ |
75 | OPENFILENAME ofn; |
74 | OPENFILENAME ofn; |
76 | char file[MAX_PATH]; |
75 | char file[MAX_PATH]; |
77 | char title[0x100]; |
76 | char title[0x100]; |
78 | 77 | ||
79 | ZeroMemory(&ofn, sizeof(ofn)); |
78 | ZeroMemory(&ofn, sizeof(ofn)); |
Line 89... | Line 88... | ||
89 | ofn.lpstrDefExt = lpstrDefExt; |
88 | ofn.lpstrDefExt = lpstrDefExt; |
90 | 89 | ||
91 | if(GetSaveFileName(&ofn)){ |
90 | if(GetSaveFileName(&ofn)){ |
92 | myc2pstrcpy(sfr->sfFile.name,file); |
91 | myc2pstrcpy(sfr->sfFile.name,file); |
93 | return sfr->sfGood = true; |
92 | return sfr->sfGood = true; |
94 | } |
93 | }else{ |
95 | #ifdef DEBUG |
94 | #ifdef DEBUG |
96 | else{ |
- | |
97 | char s[0x10]; |
95 | char s[0x10]; |
98 | sprintf(s,"GetSaveFileName(): error %d",CommDlgExtendedError()); |
96 | sprintf(s,"GetSaveFileName(): error %d",CommDlgExtendedError()); |
99 | dbg(s); |
97 | dbg(s); |
- | 98 | #endif |
|
100 | } |
99 | } |
101 | #endif |
- | |
102 | 100 | ||
103 | return sfr->sfGood = false; |
101 | return sfr->sfGood = false; |
104 | } |
102 | } |
105 | 103 | ||
106 | OSErr completesave(NavReplyRecord *reply){ |
104 | OSErr completesave(NavReplyRecord *reply){ |