1 #include <Dialogs.h>
2 #include <Fonts.h>
3 #include <Types.h>
4 #include <Gestalt.h>
5 #include <Resources.h>
6 #include <Controls.h>
7 #include <StandardFile.h>
8 #include <Files.h>
9 #include <Folders.h>
10 
11 #include <stdio.h>
12 #include <string.h>
13 #include <stdlib.h>
14 
15 #define NIL nil
16 #define PauseID	301
17 #define ExitID	302
18 #define FileDID 204
19 #define SFileDID 205
20 
21 
22 SFTypeList tlist={'TEXT',0L,0L,0L};
23 
24 extern Point wpos;
25 
FileDlog(prompt,freply)26 FileDlog(prompt,freply)
27 	char *prompt;
28 	StandardFileReply *freply;
29 {
30 	Point dpos={-1,-1};
31 	if (GetResource('DLOG',SFileDID)==NIL) {
32 		fprintf(stderr," cannot load %d DLOG resource\n",SFileDID); exit(1);
33 		}
34 	CtoPstr(prompt);
35 	ParamText((StringPtr)prompt,"\p","\p","\p");
36 /*	SFPGetFile(wpos, (StringPtr)prompt, 0L,(short)1, tlist, 0L, freply, FileDID, NIL); */
37 	CustomGetFile(NIL,
38 				-1,
39 				nil,
40 				freply,
41 				SFileDID,
42 				dpos,
43 				nil,
44 				nil,nil,nil,nil);
45 
46 	ParamText("\p","\p","\p","\p");
47 	PtoCstr((StringPtr)prompt);
48 	}
49 
TFileDlog(prompt,freply,plist,nl)50 TFileDlog(prompt,freply,plist,nl)
51 	char *prompt;
52 	StandardFileReply *freply;
53 	SFTypeList plist;
54 	int nl;
55 {
56 	Point dpos={-1,-1};
57 	if (GetResource('DLOG',SFileDID)==NIL) {
58 		fprintf(stderr," cannot load %d TFile DLOG resource\n",SFileDID); exit(1);
59 		}
60 	CtoPstr(prompt);
61 	ParamText((StringPtr)prompt,"\p","\p","\p");
62 /*	SFPGetFile(wpos,(StringPtr)prompt,0L,(short)nl,plist,0L,freply,FileDID,NIL); */
63 	CustomGetFile(NIL,
64 				nl,
65 				plist,
66 				freply,
67 				SFileDID,
68 				dpos,
69 				nil,
70 				nil,nil,nil,nil);
71 	ParamText("\p","\p","\p","\p");
72 	PtoCstr((StringPtr)prompt);
73 	}
74 
SFileDlog(prompt,freply)75 SFileDlog(prompt,freply)
76 	char *prompt;
77 	StandardFileReply *freply;
78 {
79 	Point dpos={-1,-1};
80 
81 	if (GetResource('DLOG',SFileDID)==NIL) {
82 		fprintf(stderr," cannot load %d DLOG resource\n",SFileDID); exit(1);
83 		}
84 
85 	CtoPstr(prompt);
86 	ParamText((StringPtr)prompt,"\p","\p","\p");
87 
88 /* 	StandardGetFile(NIL,(short)1,tlist,freply); */
89 	CustomGetFile(NIL,
90 				-1,
91 				nil,
92 				freply,
93 				SFileDID,
94 				dpos,
95 				nil,
96 				nil,nil,nil,nil);
97 	ParamText("\p","\p","\p","\p");
98 	PtoCstr((StringPtr)prompt);
99 	}
100 
STFileDlog(prompt,freply,plist,nl)101 STFileDlog(prompt,freply,plist,nl)
102 	char *prompt;
103 	StandardFileReply *freply;
104 	SFTypeList plist;
105 	int nl;
106 {
107 	Point dpos={-1,-1};
108 
109 	if (GetResource('DLOG',SFileDID)==NIL) {
110 		fprintf(stderr," cannot load %d TFile DLOG resource\n",SFileDID); exit(1);
111 		}
112 	CtoPstr(prompt);
113 	ParamText((StringPtr)prompt,"\p","\p","\p");
114 
115 	CustomGetFile(NIL,
116 				-1,
117 				nil,
118 				freply,
119 				SFileDID,
120 				dpos,
121 				nil,
122 				nil,nil,nil,nil);
123 	ParamText("\p","\p","\p","\p");
124 	PtoCstr((StringPtr)prompt);
125 	}
126 
PauseAlert(prompt)127 PauseAlert(prompt)
128 	unsigned char *prompt;
129 {
130 	if (GetResource('DLOG',PauseID)==NIL) {
131 		fprintf(stderr," cannot load %d TFile DLOG resource\n",PauseID); exit(1);
132 		}
133 	CtoPstr((char *)prompt);
134 	ParamText(prompt,"\p","\p","\p");
135 	CautionAlert(PauseID,NULL);
136 	ParamText("\p","\p","\p","\p");
137 	}
138 
IntroDlog(DlogID,prompt)139 IntroDlog(DlogID,prompt)
140 	int DlogID;
141 	unsigned char *prompt;
142 {
143 	short itemHit;
144 	DialogPtr DP;
145 
146 	CtoPstr((char *)prompt);
147 	ParamText(prompt,"\p","\p","\p");
148 
149 	if (GetResource('DLOG',DlogID)==NIL) {
150 		fprintf(stderr," cannot load %d Intro DLOG resource\n",DlogID); exit(1);
151 		}
152 	DP = GetNewDialog(DlogID,NULL,(WindowPtr)-1);
153 	ShowWindow(DP);
154 	SelectWindow(DP);
155 	HiliteDlog(DP);
156 
157 	ModalDialog(0L,&itemHit);
158 	DisposDialog(DP);
159 	ParamText("\p","\p","\p","\p");
160 	PtoCstr(prompt);
161 	}
162 
NIntroDlog(DlogID,p0,p1,p2,p3)163 NIntroDlog(DlogID,p0,p1,p2,p3)
164 	int DlogID;
165 	unsigned char *p0, *p1, *p2, *p3;
166 {
167 	short itemHit;
168 	DialogPtr DP;
169 	unsigned char *p;
170 
171 	for (p=p0; *p; p++) if (*p=='\n') *p=' ';
172 	for (p=p1; *p; p++) if (*p=='\n') *p=' ';
173 	for (p=p2; *p; p++) if (*p=='\n') *p=' ';
174 	for (p=p2; *p; p++) if (*p=='\n') *p=' ';
175 
176 	CtoPstr((char *)p0);
177 	CtoPstr((char *)p1);
178 	CtoPstr((char *)p2);
179 	CtoPstr((char *)p3);
180 	ParamText(p0,p1,p2,p3);
181 
182 	if (GetResource('DLOG',DlogID)==NIL) {
183 		fprintf(stderr," cannot load %d Intro DLOG resource\n",DlogID); exit(1);
184 		}
185 	DP = GetNewDialog(DlogID,NULL,(WindowPtr)-1);
186 	ShowWindow(DP);
187 	SelectWindow(DP);
188 	HiliteDlog(DP);
189 
190 	ModalDialog(0L,&itemHit);
191 	DisposDialog(DP);
192 	ParamText("\p","\p","\p","\p");
193 	PtoCstr(p0);
194 	PtoCstr(p1);
195 	PtoCstr(p2);
196 	PtoCstr(p3);
197 	}
198 
HiliteDlog(DP)199 HiliteDlog(DP)
200 	DialogPtr DP;
201 {
202 	Rect tRect;
203 	short  tType;
204 	Handle tItem;
205 
206 	SetPort(DP);
207 	GetDItem(DP,1,&tType,&tItem,&tRect);
208 	PenSize(3, 3);  					/* Change pen to draw thick default outline */
209 	InsetRect(&tRect, -4, -4);   	/* Draw outside the button by 1 pixel */
210 	FrameRoundRect(&tRect, 16, 16); /* Draw the outline */
211 	PenSize(1, 1);  					/* Restore the pen size to the default value */
212 	}
213