1 | /*
|
---|
2 | * About dialog
|
---|
3 | */
|
---|
4 |
|
---|
5 | #define INCL_DOS
|
---|
6 | #define INCL_WIN
|
---|
7 |
|
---|
8 | #include <os2.h>
|
---|
9 | #include <stdlib.h>
|
---|
10 | #include <stdio.h>
|
---|
11 | #include <string.h>
|
---|
12 | #include <time.h>
|
---|
13 | #include <ctype.h>
|
---|
14 | #include "fm3dll.h"
|
---|
15 | #include "fm3dlg.h"
|
---|
16 | #include "fm3str.h"
|
---|
17 | #include "version.h"
|
---|
18 |
|
---|
19 | #pragma data_seg(DATA1)
|
---|
20 | #pragma alloc_text(ABOUT,AboutDlgProc,AuthorDlgProc)
|
---|
21 |
|
---|
22 |
|
---|
23 | MRESULT EXPENTRY AuthorDlgProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) {
|
---|
24 |
|
---|
25 | return WinDefDlgProc(hwnd,msg,mp1,mp2);
|
---|
26 | }
|
---|
27 |
|
---|
28 |
|
---|
29 | MRESULT EXPENTRY AboutDlgProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) {
|
---|
30 |
|
---|
31 | SWP swp;
|
---|
32 | static HAB hab = 0;
|
---|
33 | BOOL no = FALSE;
|
---|
34 | static BOOL pause = FALSE;
|
---|
35 | static INT width,direction,ticktock,counter = 0;
|
---|
36 | static HPOINTER stick1,stick2,stick3,stick4,stick12,stick22,stick32,stick42,
|
---|
37 | stick5,stick52;
|
---|
38 |
|
---|
39 | switch(msg) {
|
---|
40 | case WM_INITDLG:
|
---|
41 | if(hab) {
|
---|
42 | WinDismissDlg(hwnd,0);
|
---|
43 | break;
|
---|
44 | }
|
---|
45 | if(mp2)
|
---|
46 | pause = TRUE;
|
---|
47 | else
|
---|
48 | pause = FALSE;
|
---|
49 | AboutBox = hwnd;
|
---|
50 | hab = WinQueryAnchorBlock(hwnd);
|
---|
51 | WinQueryWindowPos(hwnd,&swp);
|
---|
52 | width = swp.cx;
|
---|
53 | {
|
---|
54 | CHAR s[81];
|
---|
55 |
|
---|
56 | sprintf(s,
|
---|
57 | "%s %d.%02d%s",
|
---|
58 | GetPString(IDS_VERSIONTEXT),
|
---|
59 | VERMAJOR,
|
---|
60 | VERMINOR,
|
---|
61 | VERREALMINOR);
|
---|
62 | WinSetDlgItemText(hwnd,
|
---|
63 | ABT_VERSION,
|
---|
64 | s);
|
---|
65 | }
|
---|
66 | if(!strcmp(realappname,"FM/4"))
|
---|
67 | WinSetDlgItemText(hwnd,
|
---|
68 | ABT_PROGNAME,
|
---|
69 | GetPString(IDS_FM2LITETEXT));
|
---|
70 | if(!pause) {
|
---|
71 | stick1 = WinLoadPointer(HWND_DESKTOP,FM3ModHandle,ID_STICK1);
|
---|
72 | stick2 = WinLoadPointer(HWND_DESKTOP,FM3ModHandle,ID_STICK2);
|
---|
73 | stick3 = WinLoadPointer(HWND_DESKTOP,FM3ModHandle,ID_STICK3);
|
---|
74 | stick4 = WinLoadPointer(HWND_DESKTOP,FM3ModHandle,ID_STICK4);
|
---|
75 | stick5 = WinLoadPointer(HWND_DESKTOP,FM3ModHandle,ID_STICK5);
|
---|
76 | stick12 = WinLoadPointer(HWND_DESKTOP,FM3ModHandle,ID_STICK12);
|
---|
77 | stick22 = WinLoadPointer(HWND_DESKTOP,FM3ModHandle,ID_STICK22);
|
---|
78 | stick32 = WinLoadPointer(HWND_DESKTOP,FM3ModHandle,ID_STICK32);
|
---|
79 | stick42 = WinLoadPointer(HWND_DESKTOP,FM3ModHandle,ID_STICK42);
|
---|
80 | stick52 = WinLoadPointer(HWND_DESKTOP,FM3ModHandle,ID_STICK52);
|
---|
81 | direction = 2;
|
---|
82 | ticktock = 0;
|
---|
83 | WinStartTimer(hab,
|
---|
84 | hwnd,
|
---|
85 | ID_TIMER,
|
---|
86 | 164);
|
---|
87 | PostMsg(hwnd,
|
---|
88 | UM_SETUP,
|
---|
89 | MPVOID,
|
---|
90 | MPVOID);
|
---|
91 | }
|
---|
92 | break;
|
---|
93 |
|
---|
94 | case UM_SETUP:
|
---|
95 | if(counter++ > 1) {
|
---|
96 |
|
---|
97 | HPOINTER hbm,sk0,sk1,sk2,sk3,sk4,sk5,sk6,sk7,sk8,sk9;
|
---|
98 |
|
---|
99 | hbm = (HPOINTER)WinSendDlgItemMsg(hwnd,
|
---|
100 | ABT_ICON,
|
---|
101 | SM_QUERYHANDLE,
|
---|
102 | MPVOID,
|
---|
103 | MPVOID);
|
---|
104 | if(hbm) {
|
---|
105 | sk0 = WinLoadPointer(HWND_DESKTOP,FM3ModHandle,SKULL0);
|
---|
106 | sk1 = WinLoadPointer(HWND_DESKTOP,FM3ModHandle,SKULL1);
|
---|
107 | sk2 = WinLoadPointer(HWND_DESKTOP,FM3ModHandle,SKULL2);
|
---|
108 | sk3 = WinLoadPointer(HWND_DESKTOP,FM3ModHandle,SKULL3);
|
---|
109 | sk4 = WinLoadPointer(HWND_DESKTOP,FM3ModHandle,SKULL4);
|
---|
110 | sk5 = WinLoadPointer(HWND_DESKTOP,FM3ModHandle,SKULL5);
|
---|
111 | sk6 = WinLoadPointer(HWND_DESKTOP,FM3ModHandle,SKULL6);
|
---|
112 | sk7 = WinLoadPointer(HWND_DESKTOP,FM3ModHandle,SKULL7);
|
---|
113 | sk8 = WinLoadPointer(HWND_DESKTOP,FM3ModHandle,SKULL8);
|
---|
114 | sk9 = WinLoadPointer(HWND_DESKTOP,FM3ModHandle,SKULL9);
|
---|
115 | if(sk0 && sk1 && sk2 && sk3 && sk4 && sk5 && sk6 && sk7 &&
|
---|
116 | sk8 && sk9) {
|
---|
117 | WinShowWindow(WinWindowFromID(hwnd,ABT_ICON),FALSE);
|
---|
118 | WinSendDlgItemMsg(hwnd,ABT_ICON,SM_SETHANDLE,
|
---|
119 | MPFROMLONG(sk0),MPVOID);
|
---|
120 | WinShowWindow(WinWindowFromID(hwnd,ABT_ICON),TRUE);
|
---|
121 | DosSleep(33L);
|
---|
122 | WinSendDlgItemMsg(hwnd,ABT_ICON,SM_SETHANDLE,
|
---|
123 | MPFROMLONG(sk1),MPVOID);
|
---|
124 | DosSleep(33L);
|
---|
125 | WinSendDlgItemMsg(hwnd,ABT_ICON,SM_SETHANDLE,
|
---|
126 | MPFROMLONG(sk2),MPVOID);
|
---|
127 | DosSleep(33L);
|
---|
128 | WinSendDlgItemMsg(hwnd,ABT_ICON,SM_SETHANDLE,
|
---|
129 | MPFROMLONG(sk3),MPVOID);
|
---|
130 | DosSleep(33L);
|
---|
131 | WinSendDlgItemMsg(hwnd,ABT_ICON,SM_SETHANDLE,
|
---|
132 | MPFROMLONG(sk4),MPVOID);
|
---|
133 | DosSleep(33L);
|
---|
134 | WinSendDlgItemMsg(hwnd,ABT_ICON,SM_SETHANDLE,
|
---|
135 | MPFROMLONG(sk5),MPVOID);
|
---|
136 | DosSleep(33L);
|
---|
137 | WinSendDlgItemMsg(hwnd,ABT_ICON,SM_SETHANDLE,
|
---|
138 | MPFROMLONG(sk6),MPVOID);
|
---|
139 | DosSleep(33L);
|
---|
140 | WinSendDlgItemMsg(hwnd,ABT_ICON,SM_SETHANDLE,
|
---|
141 | MPFROMLONG(sk7),MPVOID);
|
---|
142 | DosSleep(33L);
|
---|
143 | WinSendDlgItemMsg(hwnd,ABT_ICON,SM_SETHANDLE,
|
---|
144 | MPFROMLONG(sk8),MPVOID);
|
---|
145 | DosSleep(33L);
|
---|
146 | WinSendDlgItemMsg(hwnd,ABT_ICON,SM_SETHANDLE,
|
---|
147 | MPFROMLONG(sk9),MPVOID);
|
---|
148 | DosSleep(257L);
|
---|
149 | WinSendDlgItemMsg(hwnd,ABT_ICON,SM_SETHANDLE,
|
---|
150 | MPFROMLONG(sk8),MPVOID);
|
---|
151 | DosSleep(33L);
|
---|
152 | WinSendDlgItemMsg(hwnd,ABT_ICON,SM_SETHANDLE,
|
---|
153 | MPFROMLONG(sk7),MPVOID);
|
---|
154 | DosSleep(33L);
|
---|
155 | WinSendDlgItemMsg(hwnd,ABT_ICON,SM_SETHANDLE,
|
---|
156 | MPFROMLONG(sk6),MPVOID);
|
---|
157 | DosSleep(33L);
|
---|
158 | WinSendDlgItemMsg(hwnd,ABT_ICON,SM_SETHANDLE,
|
---|
159 | MPFROMLONG(sk5),MPVOID);
|
---|
160 | DosSleep(33L);
|
---|
161 | WinSendDlgItemMsg(hwnd,ABT_ICON,SM_SETHANDLE,
|
---|
162 | MPFROMLONG(sk4),MPVOID);
|
---|
163 | DosSleep(33L);
|
---|
164 | WinSendDlgItemMsg(hwnd,ABT_ICON,SM_SETHANDLE,
|
---|
165 | MPFROMLONG(sk3),MPVOID);
|
---|
166 | DosSleep(33L);
|
---|
167 | WinSendDlgItemMsg(hwnd,ABT_ICON,SM_SETHANDLE,
|
---|
168 | MPFROMLONG(sk2),MPVOID);
|
---|
169 | DosSleep(33L);
|
---|
170 | WinSendDlgItemMsg(hwnd,ABT_ICON,SM_SETHANDLE,
|
---|
171 | MPFROMLONG(sk1),MPVOID);
|
---|
172 | DosSleep(33L);
|
---|
173 | WinSendDlgItemMsg(hwnd,ABT_ICON,SM_SETHANDLE,
|
---|
174 | MPFROMLONG(sk0),MPVOID);
|
---|
175 | DosSleep(33L);
|
---|
176 | WinShowWindow(WinWindowFromID(hwnd,ABT_ICON),FALSE);
|
---|
177 | WinSendDlgItemMsg(hwnd,ABT_ICON,SM_SETHANDLE,
|
---|
178 | MPFROMLONG(hbm),MPVOID);
|
---|
179 | WinShowWindow(WinWindowFromID(hwnd,ABT_ICON),TRUE);
|
---|
180 | }
|
---|
181 | if(sk0)
|
---|
182 | WinDestroyPointer(sk0);
|
---|
183 | if(sk1)
|
---|
184 | WinDestroyPointer(sk1);
|
---|
185 | if(sk2)
|
---|
186 | WinDestroyPointer(sk2);
|
---|
187 | if(sk3)
|
---|
188 | WinDestroyPointer(sk3);
|
---|
189 | if(sk4)
|
---|
190 | WinDestroyPointer(sk4);
|
---|
191 | if(sk5)
|
---|
192 | WinDestroyPointer(sk5);
|
---|
193 | if(sk6)
|
---|
194 | WinDestroyPointer(sk6);
|
---|
195 | if(sk7)
|
---|
196 | WinDestroyPointer(sk7);
|
---|
197 | if(sk8)
|
---|
198 | WinDestroyPointer(sk8);
|
---|
199 | if(sk9)
|
---|
200 | WinDestroyPointer(sk9);
|
---|
201 | }
|
---|
202 | }
|
---|
203 | if(counter > 4)
|
---|
204 | WinDlgBox(HWND_DESKTOP,
|
---|
205 | hwnd,
|
---|
206 | AuthorDlgProc,
|
---|
207 | FM3ModHandle,
|
---|
208 | AUTHOR_FRAME,
|
---|
209 | NULL);
|
---|
210 | return 0;
|
---|
211 |
|
---|
212 | case UM_SETDIR:
|
---|
213 | WinSetFocus(HWND_DESKTOP,HWND_DESKTOP);
|
---|
214 | DosSleep(2500L);
|
---|
215 | return 0;
|
---|
216 |
|
---|
217 | case WM_TIMER:
|
---|
218 | WinQueryWindowPos(WinWindowFromID(hwnd,ABT_STICK1),&swp);
|
---|
219 | if(swp.x + (swp.cx * 3) > width - 3) {
|
---|
220 | direction = -2;
|
---|
221 | WinShowWindow(WinWindowFromID(hwnd,ABT_STICK1),FALSE);
|
---|
222 | WinSendDlgItemMsg(hwnd,
|
---|
223 | ABT_STICK1,
|
---|
224 | SM_SETHANDLE,
|
---|
225 | MPFROMLONG(stick3),
|
---|
226 | MPVOID);
|
---|
227 | WinShowWindow(WinWindowFromID(hwnd,ABT_STICK1),
|
---|
228 | TRUE);
|
---|
229 | WinShowWindow(WinWindowFromID(hwnd,ABT_STICK2),
|
---|
230 | FALSE);
|
---|
231 | WinSendDlgItemMsg(hwnd,
|
---|
232 | ABT_STICK2,
|
---|
233 | SM_SETHANDLE,
|
---|
234 | MPFROMLONG(stick32),
|
---|
235 | MPVOID);
|
---|
236 | WinShowWindow(WinWindowFromID(hwnd,ABT_STICK2),
|
---|
237 | TRUE);
|
---|
238 | no = TRUE;
|
---|
239 | }
|
---|
240 | else if(swp.x < 3) {
|
---|
241 | direction = 2;
|
---|
242 | WinShowWindow(WinWindowFromID(hwnd,ABT_STICK2),
|
---|
243 | FALSE);
|
---|
244 | WinSendDlgItemMsg(hwnd,ABT_STICK2,
|
---|
245 | SM_SETHANDLE,
|
---|
246 | MPFROMLONG(stick32),
|
---|
247 | MPVOID);
|
---|
248 | WinShowWindow(WinWindowFromID(hwnd,ABT_STICK2),
|
---|
249 | TRUE);
|
---|
250 | WinShowWindow(WinWindowFromID(hwnd,ABT_STICK1),
|
---|
251 | FALSE);
|
---|
252 | WinSendDlgItemMsg(hwnd,
|
---|
253 | ABT_STICK1,
|
---|
254 | SM_SETHANDLE,
|
---|
255 | MPFROMLONG(stick3),
|
---|
256 | MPVOID);
|
---|
257 | WinShowWindow(WinWindowFromID(hwnd,ABT_STICK1),
|
---|
258 | TRUE);
|
---|
259 | no = TRUE;
|
---|
260 | }
|
---|
261 | swp.x += direction;
|
---|
262 | WinSetWindowPos(WinWindowFromID(hwnd,ABT_STICK1),
|
---|
263 | HWND_TOP,
|
---|
264 | swp.x,
|
---|
265 | swp.y,
|
---|
266 | swp.cx,
|
---|
267 | swp.cy,
|
---|
268 | SWP_MOVE);
|
---|
269 | WinSetWindowPos(WinWindowFromID(hwnd,ABT_ICON),
|
---|
270 | HWND_TOP,
|
---|
271 | swp.x + swp.cx,
|
---|
272 | swp.y,
|
---|
273 | swp.cx,
|
---|
274 | swp.cy,
|
---|
275 | SWP_MOVE);
|
---|
276 | WinSetWindowPos(WinWindowFromID(hwnd,ABT_STICK2),
|
---|
277 | HWND_TOP,
|
---|
278 | swp.x + (swp.cx * 2),
|
---|
279 | swp.y,
|
---|
280 | swp.cx,
|
---|
281 | swp.cy,
|
---|
282 | SWP_MOVE);
|
---|
283 | if(!no) {
|
---|
284 | if(direction > 0) {
|
---|
285 | WinShowWindow(WinWindowFromID(hwnd,ABT_STICK1),
|
---|
286 | FALSE);
|
---|
287 | WinSendDlgItemMsg(hwnd,
|
---|
288 | ABT_STICK1,
|
---|
289 | SM_SETHANDLE,
|
---|
290 | MPFROMLONG((ticktock) ?
|
---|
291 | stick1 : stick2),
|
---|
292 | MPVOID);
|
---|
293 | WinShowWindow(WinWindowFromID(hwnd,ABT_STICK1),
|
---|
294 | TRUE);
|
---|
295 | WinShowWindow(WinWindowFromID(hwnd,ABT_STICK2),
|
---|
296 | FALSE);
|
---|
297 | WinSendDlgItemMsg(hwnd,
|
---|
298 | ABT_STICK2,
|
---|
299 | SM_SETHANDLE,
|
---|
300 | MPFROMLONG((ticktock) ?
|
---|
301 | stick42 : stick52),
|
---|
302 | MPVOID);
|
---|
303 | WinShowWindow(WinWindowFromID(hwnd,ABT_STICK2),
|
---|
304 | TRUE);
|
---|
305 | }
|
---|
306 | else {
|
---|
307 | WinShowWindow(WinWindowFromID(hwnd,ABT_STICK2),
|
---|
308 | FALSE);
|
---|
309 | WinSendDlgItemMsg(hwnd,
|
---|
310 | ABT_STICK2,
|
---|
311 | SM_SETHANDLE,
|
---|
312 | MPFROMLONG((ticktock) ?
|
---|
313 | stick12 : stick22),
|
---|
314 | MPVOID);
|
---|
315 | WinShowWindow(WinWindowFromID(hwnd,ABT_STICK2),
|
---|
316 | TRUE);
|
---|
317 | WinShowWindow(WinWindowFromID(hwnd,ABT_STICK1),
|
---|
318 | FALSE);
|
---|
319 | WinSendDlgItemMsg(hwnd,
|
---|
320 | ABT_STICK1,
|
---|
321 | SM_SETHANDLE,
|
---|
322 | MPFROMLONG((ticktock) ?
|
---|
323 | stick4 : stick5),
|
---|
324 | MPVOID);
|
---|
325 | WinShowWindow(WinWindowFromID(hwnd,ABT_STICK1),
|
---|
326 | TRUE);
|
---|
327 | }
|
---|
328 | }
|
---|
329 | ticktock = (ticktock) ? 0 : 1;
|
---|
330 | break;
|
---|
331 |
|
---|
332 | case WM_COMMAND:
|
---|
333 | switch(SHORT1FROMMP(mp1)) {
|
---|
334 | case ABT_VERSION:
|
---|
335 | case DID_CANCEL:
|
---|
336 | WinDismissDlg(hwnd,0);
|
---|
337 | break;
|
---|
338 | }
|
---|
339 | return 0;
|
---|
340 |
|
---|
341 | case WM_CLOSE:
|
---|
342 | WinDestroyWindow(hwnd);
|
---|
343 | return 0;
|
---|
344 |
|
---|
345 | case WM_DESTROY:
|
---|
346 | if(hab) {
|
---|
347 | if(!pause) {
|
---|
348 | WinStopTimer(hab,
|
---|
349 | hwnd,
|
---|
350 | ID_TIMER);
|
---|
351 | WinDestroyPointer(stick1);
|
---|
352 | WinDestroyPointer(stick2);
|
---|
353 | WinDestroyPointer(stick3);
|
---|
354 | WinDestroyPointer(stick4);
|
---|
355 | WinDestroyPointer(stick5);
|
---|
356 | WinDestroyPointer(stick12);
|
---|
357 | WinDestroyPointer(stick22);
|
---|
358 | WinDestroyPointer(stick32);
|
---|
359 | WinDestroyPointer(stick42);
|
---|
360 | WinDestroyPointer(stick52);
|
---|
361 | }
|
---|
362 | hab = 0;
|
---|
363 | }
|
---|
364 | AboutBox = (HWND)0;
|
---|
365 | break;
|
---|
366 | }
|
---|
367 | return WinDefDlgProc(hwnd,msg,mp1,mp2);
|
---|
368 | }
|
---|