1 | #define INCL_WIN
|
---|
2 | #define INCL_DOS
|
---|
3 | #define INCL_DOSERRORS
|
---|
4 |
|
---|
5 | #include <os2.h>
|
---|
6 | #include <stdlib.h>
|
---|
7 | #include <stdio.h>
|
---|
8 | #include <string.h>
|
---|
9 | #include <ctype.h>
|
---|
10 | #include <time.h>
|
---|
11 | #include <share.h>
|
---|
12 | #include "fm3dll.h"
|
---|
13 | #include "fm3dlg.h"
|
---|
14 | #include "fm3str.h"
|
---|
15 |
|
---|
16 | #pragma data_seg(DATA1)
|
---|
17 | #pragma alloc_text(WALKER,FillPathListBox,WalkDlgProc,TextSubProc)
|
---|
18 | #pragma alloc_text(WALKER,WalkAllDlgProc,WalkCopyDlgProc)
|
---|
19 | #pragma alloc_text(WALKER,WalkMoveDlgProc,WalkExtractDlgProc,WalkTargetDlgProc)
|
---|
20 | #pragma alloc_text(WALK2,WalkTwoDlgProc,WalkTwoCmpDlgProc,WalkTwoSetDlgProc)
|
---|
21 | #pragma alloc_text(UDIRS,add_udir,remove_udir,remove_ldir,load_udirs)
|
---|
22 | #pragma alloc_text(UDIRS,save_udirs,load_setup,save_setup,add_setup)
|
---|
23 | #pragma alloc_text(UDIRS,remove_setup)
|
---|
24 |
|
---|
25 | typedef struct {
|
---|
26 | USHORT size;
|
---|
27 | USHORT changed;
|
---|
28 | BOOL nounwriteable;
|
---|
29 | CHAR szCurrentPath[CCHMAXPATH];
|
---|
30 | CHAR *szReturnPath;
|
---|
31 | } WALKER;
|
---|
32 |
|
---|
33 | static CHAR WalkFont[CCHMAXPATH] = "";
|
---|
34 | static ULONG WalkFontSize = sizeof(WalkFont);
|
---|
35 |
|
---|
36 |
|
---|
37 | VOID load_setups (VOID) {
|
---|
38 |
|
---|
39 | ULONG len = sizeof(lastsetups);
|
---|
40 |
|
---|
41 | memset(lastsetups,0,len);
|
---|
42 | PrfQueryProfileData(fmprof,
|
---|
43 | FM3Str,
|
---|
44 | "LastSetups",
|
---|
45 | lastsetups,
|
---|
46 | &len);
|
---|
47 | len = sizeof(INT);
|
---|
48 | lastsetup = 0;
|
---|
49 | PrfQueryProfileData(fmprof,
|
---|
50 | FM3Str,
|
---|
51 | "LastSetup",
|
---|
52 | &lastsetup,
|
---|
53 | &len);
|
---|
54 | loadedsetups = TRUE;
|
---|
55 | }
|
---|
56 |
|
---|
57 |
|
---|
58 | VOID save_setups (VOID) {
|
---|
59 |
|
---|
60 | if(!loadedsetups)
|
---|
61 | return;
|
---|
62 | PrfWriteProfileData(fmprof,
|
---|
63 | FM3Str,
|
---|
64 | "LastSetups",
|
---|
65 | lastsetups,
|
---|
66 | (ULONG)sizeof(lastsetups));
|
---|
67 | PrfWriteProfileData(fmprof,
|
---|
68 | FM3Str,
|
---|
69 | "LastSetup",
|
---|
70 | &lastsetup,
|
---|
71 | (ULONG)sizeof(INT));
|
---|
72 | }
|
---|
73 |
|
---|
74 |
|
---|
75 | BOOL add_setup (CHAR *name) {
|
---|
76 |
|
---|
77 | INT x;
|
---|
78 |
|
---|
79 | if(!name || !*name)
|
---|
80 | return FALSE;
|
---|
81 | if(!loadedsetups)
|
---|
82 | load_setups();
|
---|
83 | for(x = 0;x < MAXNUMSETUPS;x++) {
|
---|
84 | if(!stricmp(lastsetups[x],name))
|
---|
85 | return FALSE;
|
---|
86 | }
|
---|
87 | lastsetup++;
|
---|
88 | if(lastsetup >= MAXNUMSETUPS)
|
---|
89 | lastsetup = 0;
|
---|
90 | strcpy(lastsetups[lastsetup],name);
|
---|
91 | return TRUE;
|
---|
92 | }
|
---|
93 |
|
---|
94 |
|
---|
95 | BOOL remove_setup (CHAR *name) {
|
---|
96 |
|
---|
97 | INT x,y;
|
---|
98 |
|
---|
99 | if(!name || !*name)
|
---|
100 | return FALSE;
|
---|
101 | if(!loadedsetups)
|
---|
102 | load_setups();
|
---|
103 | for(x = 0;x < MAXNUMSETUPS;x++) {
|
---|
104 | if(!stricmp(lastsetups[x],name)) {
|
---|
105 | *lastsetups[x] = 0;
|
---|
106 | for(y = x + 1;y < MAXNUMSETUPS;y++)
|
---|
107 | strcpy(lastsetups[y - 1],lastsetups[y]);
|
---|
108 | *lastsetups[MAXNUMSETUPS - 1] = 0;
|
---|
109 | if(lastsetup >= x)
|
---|
110 | lastsetup--;
|
---|
111 | return TRUE;
|
---|
112 | }
|
---|
113 | }
|
---|
114 | return FALSE;
|
---|
115 | }
|
---|
116 |
|
---|
117 |
|
---|
118 | VOID load_udirs (VOID) {
|
---|
119 |
|
---|
120 | /* load linked list of user directories from USERDIRS.DAT file */
|
---|
121 |
|
---|
122 | FILE *fp;
|
---|
123 | LINKDIRS *info,*last = NULL;
|
---|
124 | CHAR s[CCHMAXPATH + 24];
|
---|
125 |
|
---|
126 | loadedudirs = TRUE;
|
---|
127 | fUdirsChanged = FALSE;
|
---|
128 | save_dir2(s);
|
---|
129 | if(s[strlen(s) - 1] != '\\')
|
---|
130 | strcat(s,"\\");
|
---|
131 | strcat(s,"USERDIRS.DAT");
|
---|
132 | fp = _fsopen(s,"r",SH_DENYWR);
|
---|
133 | if(fp) {
|
---|
134 | while(!feof(fp)) {
|
---|
135 | if(!fgets(s,CCHMAXPATH + 24,fp))
|
---|
136 | break;
|
---|
137 | s[CCHMAXPATH] = 0;
|
---|
138 | stripcr(s);
|
---|
139 | lstrip(rstrip(s));
|
---|
140 | if(*s && *s != ';') {
|
---|
141 | info = malloc(sizeof(LINKDIRS));
|
---|
142 | if(info) {
|
---|
143 | info->path = strdup(s);
|
---|
144 | if(info->path) {
|
---|
145 | info->next = NULL;
|
---|
146 | if(!udirhead)
|
---|
147 | udirhead = info;
|
---|
148 | else
|
---|
149 | last->next = info;
|
---|
150 | last = info;
|
---|
151 | }
|
---|
152 | else
|
---|
153 | free(info);
|
---|
154 | }
|
---|
155 | }
|
---|
156 | }
|
---|
157 | fclose(fp);
|
---|
158 | }
|
---|
159 | }
|
---|
160 |
|
---|
161 |
|
---|
162 | VOID save_udirs (VOID) {
|
---|
163 |
|
---|
164 | FILE *fp;
|
---|
165 | LINKDIRS *info;
|
---|
166 | CHAR s[CCHMAXPATH + 14];
|
---|
167 |
|
---|
168 | if(loadedudirs) {
|
---|
169 | fUdirsChanged = FALSE;
|
---|
170 | if(udirhead) {
|
---|
171 | save_dir2(s);
|
---|
172 | if(s[strlen(s) - 1] != '\\')
|
---|
173 | strcat(s,"\\");
|
---|
174 | strcat(s,"USERDIRS.DAT");
|
---|
175 | fp = fopen(s,"w");
|
---|
176 | if(fp) {
|
---|
177 | fputs(GetPString(IDS_USERDEFDIRSTEXT),fp);
|
---|
178 | info = udirhead;
|
---|
179 | while(info) {
|
---|
180 | fprintf(fp,
|
---|
181 | "%0.*s\n",
|
---|
182 | CCHMAXPATH,
|
---|
183 | info->path);
|
---|
184 | info = info->next;
|
---|
185 | }
|
---|
186 | fclose(fp);
|
---|
187 | }
|
---|
188 | }
|
---|
189 | }
|
---|
190 | }
|
---|
191 |
|
---|
192 |
|
---|
193 | BOOL add_udir (BOOL userdirs,CHAR *inpath) {
|
---|
194 |
|
---|
195 | CHAR path[CCHMAXPATH];
|
---|
196 | LINKDIRS *info,*last = NULL,*temp = NULL;
|
---|
197 |
|
---|
198 | if(inpath &&
|
---|
199 | *inpath) {
|
---|
200 | if(DosQueryPathInfo(inpath,
|
---|
201 | FIL_QUERYFULLNAME,
|
---|
202 | path,
|
---|
203 | sizeof(path)))
|
---|
204 | strcpy(path,inpath);
|
---|
205 | if(!userdirs &&
|
---|
206 | IsRoot(path))
|
---|
207 | return FALSE;
|
---|
208 | if(IsFullName(path)) {
|
---|
209 | if(!loadedudirs)
|
---|
210 | load_udirs();
|
---|
211 | info = (userdirs) ? udirhead : ldirhead;
|
---|
212 | while(info) {
|
---|
213 | if(!stricmp(info->path,path))
|
---|
214 | return FALSE;
|
---|
215 | last = info;
|
---|
216 | info = info->next;
|
---|
217 | }
|
---|
218 | if(!userdirs) {
|
---|
219 | info = udirhead;
|
---|
220 | while(info) {
|
---|
221 | if(!stricmp(info->path,path))
|
---|
222 | return FALSE;
|
---|
223 | info = info->next;
|
---|
224 | }
|
---|
225 | }
|
---|
226 | else { /* if adding manual directory, remove from auto list if present */
|
---|
227 | info = ldirhead;
|
---|
228 | while(info) {
|
---|
229 | if(!stricmp(info->path,path)) {
|
---|
230 | if(temp)
|
---|
231 | temp->next = info->next;
|
---|
232 | else
|
---|
233 | ldirhead = info->next;
|
---|
234 | free(info->path);
|
---|
235 | free(info);
|
---|
236 | break;
|
---|
237 | }
|
---|
238 | temp = info;
|
---|
239 | info = info->next;
|
---|
240 | }
|
---|
241 | }
|
---|
242 | info = malloc(sizeof(LINKDIRS));
|
---|
243 | if(info) {
|
---|
244 | info->path = strdup(path);
|
---|
245 | if(info->path) {
|
---|
246 | info->next = NULL;
|
---|
247 | if(userdirs) {
|
---|
248 | fUdirsChanged = TRUE;
|
---|
249 | if(!udirhead)
|
---|
250 | udirhead = info;
|
---|
251 | else
|
---|
252 | last->next = info;
|
---|
253 | }
|
---|
254 | else {
|
---|
255 | if(!ldirhead)
|
---|
256 | ldirhead = info;
|
---|
257 | else
|
---|
258 | last->next = info;
|
---|
259 | }
|
---|
260 | return TRUE;
|
---|
261 | }
|
---|
262 | else
|
---|
263 | free(info);
|
---|
264 | }
|
---|
265 | }
|
---|
266 | }
|
---|
267 | return FALSE;
|
---|
268 | }
|
---|
269 |
|
---|
270 |
|
---|
271 | BOOL remove_udir (CHAR *path) {
|
---|
272 |
|
---|
273 | LINKDIRS *info,*last = NULL;
|
---|
274 |
|
---|
275 | if(path && *path) {
|
---|
276 | if(!loadedudirs)
|
---|
277 | load_udirs();
|
---|
278 | info = udirhead;
|
---|
279 | while(info) {
|
---|
280 | if(!stricmp(info->path,path)) {
|
---|
281 | if(last)
|
---|
282 | last->next = info->next;
|
---|
283 | else
|
---|
284 | udirhead = info->next;
|
---|
285 | free(info->path);
|
---|
286 | free(info);
|
---|
287 | fUdirsChanged = TRUE;
|
---|
288 | return TRUE;
|
---|
289 | }
|
---|
290 | last = info;
|
---|
291 | info = info->next;
|
---|
292 | }
|
---|
293 | info = ldirhead;
|
---|
294 | while(info) {
|
---|
295 | if(!stricmp(info->path,path)) {
|
---|
296 | if(last)
|
---|
297 | last->next = info->next;
|
---|
298 | else
|
---|
299 | ldirhead = info->next;
|
---|
300 | free(info->path);
|
---|
301 | free(info);
|
---|
302 | return TRUE;
|
---|
303 | }
|
---|
304 | last = info;
|
---|
305 | info = info->next;
|
---|
306 | }
|
---|
307 | }
|
---|
308 | return FALSE;
|
---|
309 | }
|
---|
310 |
|
---|
311 |
|
---|
312 | BOOL remove_ldir (CHAR *path) {
|
---|
313 |
|
---|
314 | LINKDIRS *info,*last = NULL;
|
---|
315 |
|
---|
316 | if(path && *path) {
|
---|
317 | info = ldirhead;
|
---|
318 | while(info) {
|
---|
319 | if(!stricmp(info->path,path)) {
|
---|
320 | if(last)
|
---|
321 | last->next = info->next;
|
---|
322 | else
|
---|
323 | ldirhead = info->next;
|
---|
324 | free(info->path);
|
---|
325 | free(info);
|
---|
326 | return TRUE;
|
---|
327 | }
|
---|
328 | last = info;
|
---|
329 | info = info->next;
|
---|
330 | }
|
---|
331 | }
|
---|
332 | return FALSE;
|
---|
333 | }
|
---|
334 |
|
---|
335 |
|
---|
336 | VOID FillPathListBox (HWND hwnd,HWND hwnddrive,HWND hwnddir,CHAR *path,
|
---|
337 | BOOL nounwriteable) {
|
---|
338 |
|
---|
339 | /*
|
---|
340 | * this function fills one or two list boxes with drive and directory
|
---|
341 | * information showing all available drives and all directories off of
|
---|
342 | * the directory represented by path. This works independently of the
|
---|
343 | * current directory.
|
---|
344 | */
|
---|
345 |
|
---|
346 | CHAR szDrive[] = " :",szTemp[1032];
|
---|
347 | FILEFINDBUF3 findbuf;
|
---|
348 | HDIR hDir = HDIR_CREATE;
|
---|
349 | SHORT sDrive;
|
---|
350 | ULONG ulDriveNum,ulSearchCount = 1L,ulDriveMap;
|
---|
351 |
|
---|
352 | DosError(FERR_DISABLEHARDERR);
|
---|
353 | DosQCurDisk(&ulDriveNum,&ulDriveMap);
|
---|
354 | if(hwnddrive)
|
---|
355 | WinSendMsg(hwnddrive,LM_DELETEALL,MPVOID,MPVOID);
|
---|
356 | if(hwnddrive != hwnddir && hwnddir)
|
---|
357 | WinSendMsg(hwnddir,LM_DELETEALL,MPVOID,MPVOID);
|
---|
358 |
|
---|
359 | if(hwnddrive) {
|
---|
360 | for(sDrive = 0;sDrive < 26;sDrive++) {
|
---|
361 | if(ulDriveMap & (1L << sDrive)) {
|
---|
362 | *szDrive = (CHAR)(sDrive + 'A');
|
---|
363 | if((!nounwriteable || !(driveflags[sDrive] & DRIVE_NOTWRITEABLE)) &&
|
---|
364 | !(driveflags[sDrive] & (DRIVE_IGNORE | DRIVE_INVALID)))
|
---|
365 | WinSendMsg(hwnddrive,LM_INSERTITEM,MPFROM2SHORT(LIT_END,0),
|
---|
366 | MPFROMP(szDrive));
|
---|
367 | }
|
---|
368 | }
|
---|
369 | if(hwnddrive != hwnddir && path && isalpha(*path) && path[1] == ':') {
|
---|
370 | *szDrive = toupper(*path);
|
---|
371 | WinSetWindowText(hwnddrive,szDrive);
|
---|
372 | }
|
---|
373 | }
|
---|
374 |
|
---|
375 | if(hwnddir) {
|
---|
376 | sprintf(szTemp,
|
---|
377 | "%s%s*",
|
---|
378 | path,
|
---|
379 | (path[strlen(path) - 1] == '\\') ? "" : "\\");
|
---|
380 | DosError(FERR_DISABLEHARDERR);
|
---|
381 | if(!DosFindFirst(szTemp,
|
---|
382 | &hDir,
|
---|
383 | FILE_DIRECTORY | MUST_HAVE_DIRECTORY |
|
---|
384 | FILE_READONLY | FILE_ARCHIVED | FILE_SYSTEM |
|
---|
385 | FILE_HIDDEN,
|
---|
386 | &findbuf,
|
---|
387 | sizeof(FILEFINDBUF3),
|
---|
388 | &ulSearchCount,
|
---|
389 | FIL_STANDARD)) {
|
---|
390 | do {
|
---|
391 | if(findbuf.attrFile & FILE_DIRECTORY) {
|
---|
392 | if(strcmp(findbuf.achName,"..") ||
|
---|
393 | strlen(path) > 3 ||
|
---|
394 | path[1] != ':') {
|
---|
395 | if(findbuf.achName[0] != '.' ||
|
---|
396 | findbuf.achName[1])
|
---|
397 | WinSendMsg(hwnddir,
|
---|
398 | LM_INSERTITEM,
|
---|
399 | MPFROM2SHORT(LIT_SORTASCENDING,0),
|
---|
400 | MPFROMP(findbuf.achName));
|
---|
401 | }
|
---|
402 | }
|
---|
403 | ulSearchCount = 1L;
|
---|
404 | } while(!DosFindNext(hDir,
|
---|
405 | &findbuf,
|
---|
406 | sizeof(FILEFINDBUF3),
|
---|
407 | &ulSearchCount));
|
---|
408 | DosFindClose(hDir);
|
---|
409 | }
|
---|
410 | DosError(FERR_DISABLEHARDERR);
|
---|
411 | }
|
---|
412 | }
|
---|
413 |
|
---|
414 |
|
---|
415 | MRESULT EXPENTRY TextSubProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) {
|
---|
416 |
|
---|
417 | PFNWP oldproc = (PFNWP)WinQueryWindowPtr(hwnd,0);
|
---|
418 |
|
---|
419 | switch(msg) {
|
---|
420 | case WM_CHAR:
|
---|
421 | if(SHORT1FROMMP(mp1) & KC_KEYUP) {
|
---|
422 | if((SHORT1FROMMP(mp1) & KC_VIRTUALKEY) &&
|
---|
423 | (SHORT1FROMMP(mp2) & 255) == '\r')
|
---|
424 | PostMsg(WinQueryWindow(hwnd,QW_PARENT),WM_COMMAND,
|
---|
425 | MPFROM2SHORT(DID_OK,0),MPVOID);
|
---|
426 | }
|
---|
427 | break;
|
---|
428 | }
|
---|
429 | return oldproc(hwnd,msg,mp1,mp2);
|
---|
430 | }
|
---|
431 |
|
---|
432 |
|
---|
433 | MRESULT EXPENTRY WalkDlgProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) {
|
---|
434 |
|
---|
435 | WALKER *wa;
|
---|
436 | CHAR szBuff[CCHMAXPATH + 1],szBuffer[CCHMAXPATH + 1],*p;
|
---|
437 | SHORT sSelect;
|
---|
438 | static BOOL okay; /* avoid combobox selecting as filled */
|
---|
439 | static CHAR lastdir[CCHMAXPATH + 1];
|
---|
440 |
|
---|
441 | switch(msg) {
|
---|
442 | case UM_SETUP2:
|
---|
443 | case WM_INITDLG:
|
---|
444 | okay = FALSE;
|
---|
445 | *lastdir = 0;
|
---|
446 | if(!mp2) {
|
---|
447 | WinDismissDlg(hwnd,0);
|
---|
448 | break;
|
---|
449 | }
|
---|
450 | wa = malloc(sizeof(WALKER));
|
---|
451 | if(!wa) {
|
---|
452 | DosBeep(50,100);
|
---|
453 | WinDismissDlg(hwnd,0);
|
---|
454 | break;
|
---|
455 | }
|
---|
456 | memset(wa,0,sizeof(WALKER));
|
---|
457 | wa->size = (USHORT)sizeof(WALKER);
|
---|
458 | WinSetWindowPtr(hwnd,0,(PVOID)wa);
|
---|
459 | wa->szReturnPath = (CHAR *)mp2;
|
---|
460 | {
|
---|
461 | PFNWP oldproc;
|
---|
462 |
|
---|
463 | oldproc = WinSubclassWindow(WinWindowFromID(hwnd,WALK_PATH),
|
---|
464 | (PFNWP)TextSubProc);
|
---|
465 | if(oldproc)
|
---|
466 | WinSetWindowPtr(WinWindowFromID(hwnd,WALK_PATH),
|
---|
467 | 0,
|
---|
468 | (PVOID)oldproc);
|
---|
469 | WinSendDlgItemMsg(WinWindowFromID(hwnd,WALK_RECENT),
|
---|
470 | CBID_EDIT,
|
---|
471 | EM_SETTEXTLIMIT,
|
---|
472 | MPFROM2SHORT(CCHMAXPATH,0),
|
---|
473 | MPVOID);
|
---|
474 | WinSendDlgItemMsg(WinWindowFromID(hwnd,WALK_RECENT),
|
---|
475 | CBID_EDIT,
|
---|
476 | EM_SETREADONLY,
|
---|
477 | MPFROM2SHORT(TRUE,0),
|
---|
478 | MPVOID);
|
---|
479 | }
|
---|
480 | PosOverOkay(hwnd);
|
---|
481 | if(msg == UM_SETUP2)
|
---|
482 | wa->nounwriteable = FALSE;
|
---|
483 | else
|
---|
484 | wa->nounwriteable = TRUE;
|
---|
485 | if(!*wa->szReturnPath)
|
---|
486 | save_dir2(wa->szCurrentPath);
|
---|
487 | else {
|
---|
488 | strcpy(wa->szCurrentPath,
|
---|
489 | wa->szReturnPath);
|
---|
490 | MakeFullName(wa->szCurrentPath);
|
---|
491 | }
|
---|
492 | if(wa->nounwriteable &&
|
---|
493 | (driveflags[toupper(*wa->szCurrentPath) - 'A'] &
|
---|
494 | DRIVE_NOTWRITEABLE)) {
|
---|
495 |
|
---|
496 | ULONG bd;
|
---|
497 |
|
---|
498 | strcpy(wa->szCurrentPath,"C:\\");
|
---|
499 | if(DosQuerySysInfo(QSV_BOOT_DRIVE,
|
---|
500 | QSV_BOOT_DRIVE,
|
---|
501 | (PVOID)&bd,
|
---|
502 | (ULONG)sizeof(ULONG)))
|
---|
503 | bd = 3L;
|
---|
504 | *wa->szCurrentPath = (CHAR)bd + '@';
|
---|
505 | }
|
---|
506 | WinSendDlgItemMsg(hwnd,
|
---|
507 | WALK_PATH,
|
---|
508 | EM_SETTEXTLIMIT,
|
---|
509 | MPFROM2SHORT(CCHMAXPATH,0),
|
---|
510 | MPVOID);
|
---|
511 | WinSetDlgItemText(hwnd,
|
---|
512 | WALK_PATH,
|
---|
513 | wa->szCurrentPath);
|
---|
514 | if(!loadedudirs)
|
---|
515 | load_udirs();
|
---|
516 | { /* fill user list box */
|
---|
517 | ULONG ulDriveNum,ulDriveMap;
|
---|
518 | ULONG ulSearchCount;
|
---|
519 | FILEFINDBUF3 findbuf;
|
---|
520 | HDIR hDir;
|
---|
521 | APIRET rc;
|
---|
522 | LINKDIRS *info,*temp;
|
---|
523 |
|
---|
524 | DosError(FERR_DISABLEHARDERR);
|
---|
525 | DosQCurDisk(&ulDriveNum,&ulDriveMap);
|
---|
526 | info = udirhead;
|
---|
527 | while(info) {
|
---|
528 | if(IsFullName(info->path) &&
|
---|
529 | !(driveflags[toupper(*info->path) - 'A'] &
|
---|
530 | (DRIVE_IGNORE | DRIVE_INVALID))) {
|
---|
531 | DosError(FERR_DISABLEHARDERR);
|
---|
532 | hDir = HDIR_CREATE;
|
---|
533 | ulSearchCount = 1L;
|
---|
534 | if(!IsRoot(info->path))
|
---|
535 | rc = DosFindFirst(info->path,&hDir,FILE_DIRECTORY |
|
---|
536 | MUST_HAVE_DIRECTORY | FILE_READONLY |
|
---|
537 | FILE_ARCHIVED | FILE_SYSTEM | FILE_HIDDEN,
|
---|
538 | &findbuf,sizeof(FILEFINDBUF3),
|
---|
539 | &ulSearchCount, FIL_STANDARD);
|
---|
540 | else {
|
---|
541 | rc = 0;
|
---|
542 | findbuf.attrFile = FILE_DIRECTORY;
|
---|
543 | }
|
---|
544 | if(!rc) {
|
---|
545 | if(!IsRoot(info->path))
|
---|
546 | DosFindClose(hDir);
|
---|
547 | if(findbuf.attrFile & FILE_DIRECTORY)
|
---|
548 | WinSendDlgItemMsg(hwnd,WALK_USERLIST,LM_INSERTITEM,
|
---|
549 | MPFROM2SHORT(LIT_SORTASCENDING,0),
|
---|
550 | MPFROMP(info->path));
|
---|
551 | else {
|
---|
552 | temp = info->next;
|
---|
553 | remove_udir(info->path);
|
---|
554 | info = temp;
|
---|
555 | continue;
|
---|
556 | }
|
---|
557 | }
|
---|
558 | else if(!(ulDriveMap & (1L << (toupper(*info->path) - 'A')))) {
|
---|
559 | temp = info->next;
|
---|
560 | remove_udir(info->path);
|
---|
561 | info = temp;
|
---|
562 | continue;
|
---|
563 | }
|
---|
564 | }
|
---|
565 | info = info->next;
|
---|
566 | }
|
---|
567 | info = ldirhead;
|
---|
568 | while(info) {
|
---|
569 | if(IsFullName(info->path) &&
|
---|
570 | !(driveflags[toupper(*info->path) - 'A'] &
|
---|
571 | (DRIVE_IGNORE | DRIVE_INVALID))) {
|
---|
572 | DosError(FERR_DISABLEHARDERR);
|
---|
573 | hDir = HDIR_CREATE;
|
---|
574 | ulSearchCount = 1L;
|
---|
575 | if(!IsRoot(info->path))
|
---|
576 | rc = DosFindFirst(info->path,&hDir,FILE_DIRECTORY |
|
---|
577 | MUST_HAVE_DIRECTORY | FILE_READONLY |
|
---|
578 | FILE_ARCHIVED | FILE_SYSTEM | FILE_HIDDEN,
|
---|
579 | &findbuf,sizeof(FILEFINDBUF3),
|
---|
580 | &ulSearchCount, FIL_STANDARD);
|
---|
581 | else {
|
---|
582 | rc = 0;
|
---|
583 | findbuf.attrFile = FILE_DIRECTORY;
|
---|
584 | }
|
---|
585 | if(!rc) {
|
---|
586 | if(!IsRoot(info->path))
|
---|
587 | DosFindClose(hDir);
|
---|
588 | if(findbuf.attrFile & FILE_DIRECTORY)
|
---|
589 | WinSendDlgItemMsg(hwnd,WALK_RECENT,LM_INSERTITEM,
|
---|
590 | MPFROM2SHORT(LIT_SORTASCENDING,0),
|
---|
591 | MPFROMP(info->path));
|
---|
592 | else {
|
---|
593 | temp = info->next;
|
---|
594 | remove_ldir(info->path);
|
---|
595 | info = temp;
|
---|
596 | continue;
|
---|
597 | }
|
---|
598 | WinSetDlgItemText(hwnd,WALK_RECENT,
|
---|
599 | GetPString(IDS_WALKRECENTDIRSTEXT));
|
---|
600 | }
|
---|
601 | else if(!(ulDriveMap & (1L << (toupper(*info->path) - 'A')))) {
|
---|
602 | temp = info->next;
|
---|
603 | remove_ldir(info->path);
|
---|
604 | info = temp;
|
---|
605 | continue;
|
---|
606 | }
|
---|
607 | }
|
---|
608 | info = info->next;
|
---|
609 | }
|
---|
610 | }
|
---|
611 | FillPathListBox(hwnd,
|
---|
612 | WinWindowFromID(hwnd,WALK_DRIVELIST),
|
---|
613 | WinWindowFromID(hwnd,WALK_DIRLIST),
|
---|
614 | wa->szCurrentPath,wa->nounwriteable);
|
---|
615 | if(!PostMsg(hwnd,
|
---|
616 | UM_SETUP4,
|
---|
617 | MPVOID,
|
---|
618 | MPVOID))
|
---|
619 | okay = TRUE;
|
---|
620 | {
|
---|
621 | MRESULT ret;
|
---|
622 |
|
---|
623 | ret = WinDefDlgProc(hwnd,WM_INITDLG,mp1,mp2);
|
---|
624 | WinSendMsg(hwnd,UM_SETUP,MPVOID,MPVOID);
|
---|
625 | WinInvalidateRect(WinWindowFromID(hwnd,WALK_PATH),NULL,TRUE);
|
---|
626 | return ret;
|
---|
627 | }
|
---|
628 |
|
---|
629 | case UM_SETUP4:
|
---|
630 | okay = TRUE;
|
---|
631 | return 0;
|
---|
632 |
|
---|
633 | case WM_ADJUSTWINDOWPOS:
|
---|
634 | PostMsg(hwnd,UM_SETDIR,MPVOID,MPVOID);
|
---|
635 | break;
|
---|
636 |
|
---|
637 | case UM_SETDIR:
|
---|
638 | PaintRecessedWindow(WinWindowFromID(hwnd,WALK_HELP),(HPS)0,FALSE,TRUE);
|
---|
639 | return 0;
|
---|
640 |
|
---|
641 | case WM_PRESPARAMCHANGED:
|
---|
642 | {
|
---|
643 | ULONG AttrFound,AttrValue[64],cbRetLen;
|
---|
644 |
|
---|
645 | cbRetLen = WinQueryPresParam(hwnd,(ULONG)mp1,0,&AttrFound,
|
---|
646 | (ULONG)sizeof(AttrValue),
|
---|
647 | &AttrValue,0);
|
---|
648 | if(cbRetLen) {
|
---|
649 | switch(AttrFound) {
|
---|
650 | case PP_FONTNAMESIZE:
|
---|
651 | PrfWriteProfileData(fmprof,
|
---|
652 | appname,
|
---|
653 | "WalkFont",
|
---|
654 | (PVOID)AttrValue,
|
---|
655 | cbRetLen);
|
---|
656 | *WalkFont = 0;
|
---|
657 | WalkFontSize = sizeof(WalkFont);
|
---|
658 | WinInvalidateRect(WinWindowFromID(hwnd,WALK_PATH),
|
---|
659 | NULL,
|
---|
660 | TRUE);
|
---|
661 | break;
|
---|
662 | }
|
---|
663 | }
|
---|
664 | }
|
---|
665 | break;
|
---|
666 |
|
---|
667 | case UM_SETUP3:
|
---|
668 | save_udirs();
|
---|
669 | if(hwndMain)
|
---|
670 | PostMsg(hwndMain,
|
---|
671 | UM_FILLUSERLIST,
|
---|
672 | MPVOID,
|
---|
673 | MPVOID);
|
---|
674 | return 0;
|
---|
675 |
|
---|
676 | case UM_SETUP:
|
---|
677 | {
|
---|
678 | INT x;
|
---|
679 | USHORT id[] = {WALK_PATH,WALK_DIRLIST,WALK_USERLIST,
|
---|
680 | WALK_RECENT,0};
|
---|
681 |
|
---|
682 | if(*WalkFont ||
|
---|
683 | (PrfQueryProfileData(fmprof,
|
---|
684 | appname,
|
---|
685 | "WalkFont",
|
---|
686 | (PVOID)WalkFont,
|
---|
687 | &WalkFontSize) &&
|
---|
688 | WalkFontSize)) {
|
---|
689 | for(x = 0;id[x];x++)
|
---|
690 | WinSetPresParam(WinWindowFromID(hwnd,id[x]),
|
---|
691 | PP_FONTNAMESIZE,
|
---|
692 | WalkFontSize,
|
---|
693 | (PVOID)WalkFont);
|
---|
694 | }
|
---|
695 | }
|
---|
696 | return 0;
|
---|
697 |
|
---|
698 | case UM_CONTROL:
|
---|
699 | case WM_CONTROL:
|
---|
700 | wa = WinQueryWindowPtr(hwnd,0);
|
---|
701 | if(SHORT1FROMMP(mp1) == WALK_DRIVELIST ||
|
---|
702 | SHORT1FROMMP(mp1) == WALK_DIRLIST ||
|
---|
703 | SHORT1FROMMP(mp1) == WALK_USERLIST ||
|
---|
704 | SHORT1FROMMP(mp1) == WALK_RECENT) {
|
---|
705 | sSelect = (USHORT)WinSendDlgItemMsg(hwnd,
|
---|
706 | SHORT1FROMMP(mp1),
|
---|
707 | LM_QUERYSELECTION,
|
---|
708 | MPVOID,MPVOID);
|
---|
709 | *szBuffer = 0;
|
---|
710 | if(sSelect >= 0)
|
---|
711 | WinSendDlgItemMsg(hwnd,SHORT1FROMMP(mp1),LM_QUERYITEMTEXT,
|
---|
712 | MPFROM2SHORT(sSelect,CCHMAXPATH),
|
---|
713 | MPFROMP(szBuffer));
|
---|
714 | }
|
---|
715 | switch(SHORT1FROMMP(mp1)) {
|
---|
716 | case WALK_PATH:
|
---|
717 | if(SHORT2FROMMP(mp1) == EN_SETFOCUS)
|
---|
718 | WinSetDlgItemText(hwnd,WALK_HELP,
|
---|
719 | GetPString(IDS_WALKCURRDIRTEXT));
|
---|
720 | else if(SHORT2FROMMP(mp1) == EN_KILLFOCUS)
|
---|
721 | WinSetDlgItemText(hwnd,WALK_HELP,
|
---|
722 | GetPString(IDS_WALKDEFAULTHELPTEXT));
|
---|
723 | break;
|
---|
724 |
|
---|
725 | case WALK_RECENT:
|
---|
726 | if(okay && SHORT2FROMMP(mp1) == CBN_LBSELECT) {
|
---|
727 |
|
---|
728 | ULONG ulSearchCount;
|
---|
729 | FILEFINDBUF3 findbuf;
|
---|
730 | HDIR hDir;
|
---|
731 | APIRET rc;
|
---|
732 |
|
---|
733 | // *szBuffer = 0;
|
---|
734 | // WinQueryDlgItemText(hwnd,WALK_RECENT,CCHMAXPATH,szBuffer);
|
---|
735 | if(!*szBuffer)
|
---|
736 | break;
|
---|
737 | DosError(FERR_DISABLEHARDERR);
|
---|
738 | hDir = HDIR_CREATE;
|
---|
739 | ulSearchCount = 1L;
|
---|
740 | if(!IsRoot(szBuffer)) {
|
---|
741 | rc = DosFindFirst(szBuffer,&hDir,FILE_DIRECTORY |
|
---|
742 | MUST_HAVE_DIRECTORY | FILE_READONLY |
|
---|
743 | FILE_ARCHIVED | FILE_SYSTEM | FILE_HIDDEN,
|
---|
744 | &findbuf,sizeof(FILEFINDBUF3),
|
---|
745 | &ulSearchCount, FIL_STANDARD);
|
---|
746 | if(!rc)
|
---|
747 | DosFindClose(hDir);
|
---|
748 | }
|
---|
749 | else {
|
---|
750 | findbuf.attrFile = FILE_DIRECTORY;
|
---|
751 | rc = 0;
|
---|
752 | }
|
---|
753 | if(!rc && (findbuf.attrFile & FILE_DIRECTORY)) {
|
---|
754 | strcpy(wa->szCurrentPath,szBuffer);
|
---|
755 | WinSetDlgItemText(hwnd,WALK_PATH,wa->szCurrentPath);
|
---|
756 | WinSetDlgItemText(hwnd,WALK_RECENT,wa->szCurrentPath);
|
---|
757 | FillPathListBox(hwnd,
|
---|
758 | WinWindowFromID(hwnd,WALK_DRIVELIST),
|
---|
759 | WinWindowFromID(hwnd,WALK_DIRLIST),
|
---|
760 | wa->szCurrentPath,FALSE);
|
---|
761 | }
|
---|
762 | else
|
---|
763 | DosBeep(50,100);
|
---|
764 | }
|
---|
765 | else if(SHORT2FROMMP(mp1) == CBN_ENTER)
|
---|
766 | PostMsg(hwnd,WM_COMMAND,MPFROM2SHORT(DID_OK,0),MPVOID);
|
---|
767 | else if(SHORT2FROMMP(mp1) == CBN_SHOWLIST)
|
---|
768 | WinSetDlgItemText(hwnd,WALK_HELP,
|
---|
769 | GetPString(IDS_WALKRECENTDIRSHELPTEXT));
|
---|
770 | break;
|
---|
771 |
|
---|
772 | case WALK_USERLIST:
|
---|
773 | if(okay && *szBuffer && SHORT2FROMMP(mp1) == LN_SELECT) {
|
---|
774 |
|
---|
775 | ULONG ulSearchCount;
|
---|
776 | FILEFINDBUF3 findbuf;
|
---|
777 | HDIR hDir;
|
---|
778 | APIRET rc;
|
---|
779 |
|
---|
780 | DosError(FERR_DISABLEHARDERR);
|
---|
781 | hDir = HDIR_CREATE;
|
---|
782 | ulSearchCount = 1L;
|
---|
783 | if(!IsRoot(szBuffer)) {
|
---|
784 | rc = DosFindFirst(szBuffer,
|
---|
785 | &hDir,
|
---|
786 | FILE_DIRECTORY |
|
---|
787 | MUST_HAVE_DIRECTORY | FILE_READONLY |
|
---|
788 | FILE_ARCHIVED | FILE_SYSTEM | FILE_HIDDEN,
|
---|
789 | &findbuf,
|
---|
790 | sizeof(FILEFINDBUF3),
|
---|
791 | &ulSearchCount,
|
---|
792 | FIL_STANDARD);
|
---|
793 | if(!rc)
|
---|
794 | DosFindClose(hDir);
|
---|
795 | }
|
---|
796 | else {
|
---|
797 | findbuf.attrFile = FILE_DIRECTORY;
|
---|
798 | rc = 0;
|
---|
799 | }
|
---|
800 | if(!rc && (findbuf.attrFile & FILE_DIRECTORY)) {
|
---|
801 | strcpy(wa->szCurrentPath,szBuffer);
|
---|
802 | WinSetDlgItemText(hwnd,WALK_PATH,wa->szCurrentPath);
|
---|
803 | FillPathListBox(hwnd,
|
---|
804 | WinWindowFromID(hwnd,WALK_DRIVELIST),
|
---|
805 | WinWindowFromID(hwnd,WALK_DIRLIST),
|
---|
806 | wa->szCurrentPath,FALSE);
|
---|
807 | }
|
---|
808 | else
|
---|
809 | DosBeep(50,100);
|
---|
810 | }
|
---|
811 | else if(SHORT2FROMMP(mp1) == LN_ENTER)
|
---|
812 | PostMsg(hwnd,
|
---|
813 | WM_COMMAND,
|
---|
814 | MPFROM2SHORT(DID_OK,0),
|
---|
815 | MPVOID);
|
---|
816 | else if(SHORT2FROMMP(mp1) == LN_SETFOCUS)
|
---|
817 | WinSetDlgItemText(hwnd,
|
---|
818 | WALK_HELP,
|
---|
819 | GetPString(IDS_WALKUSERDIRSHELPTEXT));
|
---|
820 | else if(SHORT2FROMMP(mp1) == LN_KILLFOCUS)
|
---|
821 | WinSetDlgItemText(hwnd,
|
---|
822 | WALK_HELP,
|
---|
823 | GetPString(IDS_WALKDEFAULTHELPTEXT));
|
---|
824 | break;
|
---|
825 |
|
---|
826 | case WALK_DRIVELIST:
|
---|
827 | if(okay && *szBuffer && SHORT2FROMMP(mp1) == LN_ENTER) {
|
---|
828 |
|
---|
829 | ULONG ulDirLen = CCHMAXPATH;
|
---|
830 | APIRET rc;
|
---|
831 |
|
---|
832 | rc = DosQCurDir(toupper(*szBuffer) - '@',
|
---|
833 | &szBuff[3],&ulDirLen);
|
---|
834 | if(!rc) {
|
---|
835 | strcpy(wa->szCurrentPath,"C:\\");
|
---|
836 | *wa->szCurrentPath = toupper(*szBuffer);
|
---|
837 | WinSetDlgItemText(hwnd,
|
---|
838 | WALK_PATH,
|
---|
839 | wa->szCurrentPath);
|
---|
840 | FillPathListBox(hwnd,
|
---|
841 | WinWindowFromID(hwnd,WALK_DRIVELIST),
|
---|
842 | WinWindowFromID(hwnd,WALK_DIRLIST),
|
---|
843 | wa->szCurrentPath,FALSE);
|
---|
844 | }
|
---|
845 | }
|
---|
846 | else if(SHORT2FROMMP(mp1) == LN_SETFOCUS)
|
---|
847 | WinSetDlgItemText(hwnd,WALK_HELP,
|
---|
848 | GetPString(IDS_WALKDRIVELISTHELPTEXT));
|
---|
849 | else if(SHORT2FROMMP(mp1) == LN_KILLFOCUS)
|
---|
850 | WinSetDlgItemText(hwnd,WALK_HELP,
|
---|
851 | GetPString(IDS_WALKDEFAULTHELPTEXT));
|
---|
852 | break;
|
---|
853 |
|
---|
854 | case WALK_DIRLIST:
|
---|
855 | if(okay && SHORT2FROMMP(mp1) == LN_ENTER) {
|
---|
856 |
|
---|
857 | ULONG ulSearchCount;
|
---|
858 | FILEFINDBUF3 findbuf;
|
---|
859 | HDIR hDir;
|
---|
860 | APIRET rc;
|
---|
861 |
|
---|
862 | lstrip(rstrip(szBuffer));
|
---|
863 | if(*szBuffer) {
|
---|
864 | strcpy(szBuff,wa->szCurrentPath);
|
---|
865 | if(szBuff[strlen(szBuff) - 1] != '\\')
|
---|
866 | strcat(szBuff,"\\");
|
---|
867 | strcat(szBuff,
|
---|
868 | szBuffer);
|
---|
869 | MakeFullName(szBuff);
|
---|
870 | DosError(FERR_DISABLEHARDERR);
|
---|
871 | hDir = HDIR_CREATE;
|
---|
872 | ulSearchCount = 1L;
|
---|
873 | if(!IsRoot(szBuff)) {
|
---|
874 | rc = DosFindFirst(szBuff,
|
---|
875 | &hDir,
|
---|
876 | FILE_DIRECTORY |
|
---|
877 | MUST_HAVE_DIRECTORY | FILE_READONLY |
|
---|
878 | FILE_ARCHIVED | FILE_SYSTEM | FILE_HIDDEN,
|
---|
879 | &findbuf,
|
---|
880 | sizeof(FILEFINDBUF3),
|
---|
881 | &ulSearchCount,
|
---|
882 | FIL_STANDARD);
|
---|
883 | if(!rc)
|
---|
884 | DosFindClose(hDir);
|
---|
885 | }
|
---|
886 | else {
|
---|
887 | findbuf.attrFile = FILE_DIRECTORY;
|
---|
888 | rc = 0;
|
---|
889 | }
|
---|
890 | if(!rc && (findbuf.attrFile & FILE_DIRECTORY)) {
|
---|
891 | strcpy(wa->szCurrentPath,szBuff);
|
---|
892 | WinSetDlgItemText(hwnd,WALK_PATH,wa->szCurrentPath);
|
---|
893 | FillPathListBox(hwnd,
|
---|
894 | WinWindowFromID(hwnd,WALK_DRIVELIST),
|
---|
895 | WinWindowFromID(hwnd,WALK_DIRLIST),
|
---|
896 | wa->szCurrentPath,FALSE);
|
---|
897 | }
|
---|
898 | }
|
---|
899 | }
|
---|
900 | else if(SHORT2FROMMP(mp1) == LN_SETFOCUS)
|
---|
901 | WinSetDlgItemText(hwnd,WALK_HELP,
|
---|
902 | GetPString(IDS_WALKDIRLISTHELPTEXT));
|
---|
903 | else if(SHORT2FROMMP(mp1) == LN_KILLFOCUS)
|
---|
904 | WinSetDlgItemText(hwnd,WALK_HELP,
|
---|
905 | GetPString(IDS_WALKDEFAULTHELPTEXT));
|
---|
906 | break;
|
---|
907 | }
|
---|
908 | return 0;
|
---|
909 |
|
---|
910 | case WM_COMMAND:
|
---|
911 | wa = WinQueryWindowPtr(hwnd,0);
|
---|
912 | if(!wa)
|
---|
913 | WinDismissDlg(hwnd,0);
|
---|
914 | *szBuff = 0;
|
---|
915 | WinQueryDlgItemText(hwnd,
|
---|
916 | WALK_PATH,
|
---|
917 | CCHMAXPATH,
|
---|
918 | szBuff);
|
---|
919 | lstrip(rstrip(szBuff));
|
---|
920 | while((p = strchr(szBuff,'/')) != NULL)
|
---|
921 | *p = '\\';
|
---|
922 | while(strlen(szBuff) > 3 &&
|
---|
923 | szBuff[strlen(szBuff) - 1] == '\\')
|
---|
924 | szBuff[strlen(szBuff) - 1] = 0;
|
---|
925 | MakeFullName(szBuff);
|
---|
926 | if(*szBuff &&
|
---|
927 | stricmp(szBuff,wa->szCurrentPath)) {
|
---|
928 | if(!SetDir(WinQueryWindow(WinQueryWindow(hwnd,QW_PARENT),
|
---|
929 | QW_OWNER),
|
---|
930 | hwnd,
|
---|
931 | szBuff,
|
---|
932 | 0))
|
---|
933 | strcpy(wa->szCurrentPath,
|
---|
934 | szBuff);
|
---|
935 | else if(SHORT1FROMMP(mp1) != DID_CANCEL)
|
---|
936 | return 0;
|
---|
937 | }
|
---|
938 | WinSetDlgItemText(hwnd,
|
---|
939 | WALK_PATH,
|
---|
940 | wa->szCurrentPath);
|
---|
941 | switch(SHORT1FROMMP(mp1)) {
|
---|
942 | case WALK_ADD:
|
---|
943 | *szBuff = 0;
|
---|
944 | WinQueryDlgItemText(hwnd,
|
---|
945 | WALK_PATH,
|
---|
946 | CCHMAXPATH,
|
---|
947 | szBuff);
|
---|
948 | lstrip(rstrip(szBuff));
|
---|
949 | while((p = strchr(szBuff,'/')) != NULL)
|
---|
950 | *p = '\\';
|
---|
951 | if(*szBuff &&
|
---|
952 | !IsFile(szBuff)) {
|
---|
953 | MakeFullName(szBuff);
|
---|
954 | if(add_udir(TRUE,
|
---|
955 | szBuff)) {
|
---|
956 | WinSendDlgItemMsg(hwnd,
|
---|
957 | WALK_USERLIST,
|
---|
958 | LM_INSERTITEM,
|
---|
959 | MPFROM2SHORT(LIT_SORTASCENDING,0),
|
---|
960 | MPFROMP(szBuff));
|
---|
961 | wa->changed = 1;
|
---|
962 | }
|
---|
963 | else
|
---|
964 | DosBeep(50,100);
|
---|
965 | }
|
---|
966 | break;
|
---|
967 |
|
---|
968 | case WALK_DELETE:
|
---|
969 | *szBuff = 0;
|
---|
970 | WinQueryDlgItemText(hwnd,WALK_PATH,CCHMAXPATH,szBuff);
|
---|
971 | lstrip(rstrip(szBuff));
|
---|
972 | while((p = strchr(szBuff,'/')) != NULL)
|
---|
973 | *p = '\\';
|
---|
974 | if(*szBuff &&
|
---|
975 | !IsFile(szBuff)) {
|
---|
976 | MakeFullName(szBuff);
|
---|
977 | sSelect = (SHORT)WinSendDlgItemMsg(hwnd,
|
---|
978 | WALK_USERLIST,
|
---|
979 | LM_SEARCHSTRING,
|
---|
980 | MPFROM2SHORT(0,LIT_FIRST),
|
---|
981 | MPFROMP(szBuff));
|
---|
982 | if(sSelect >= 0) {
|
---|
983 | WinSendDlgItemMsg(hwnd,
|
---|
984 | WALK_USERLIST,
|
---|
985 | LM_DELETEITEM,
|
---|
986 | MPFROM2SHORT(sSelect,0),
|
---|
987 | MPVOID);
|
---|
988 | remove_udir(szBuff);
|
---|
989 | wa->changed = 1;
|
---|
990 | }
|
---|
991 | }
|
---|
992 | break;
|
---|
993 |
|
---|
994 | case DID_OK:
|
---|
995 | if(*wa->szCurrentPath) {
|
---|
996 | strcpy(wa->szReturnPath,
|
---|
997 | wa->szCurrentPath);
|
---|
998 | MakeValidDir(wa->szReturnPath);
|
---|
999 | if(fAutoAddAllDirs)
|
---|
1000 | add_udir(FALSE,
|
---|
1001 | wa->szReturnPath);
|
---|
1002 | if(fChangeTarget) {
|
---|
1003 | strcpy(targetdir,
|
---|
1004 | wa->szReturnPath);
|
---|
1005 | PrfWriteProfileString(fmprof,
|
---|
1006 | appname,
|
---|
1007 | "Targetdir",
|
---|
1008 | targetdir);
|
---|
1009 | }
|
---|
1010 | }
|
---|
1011 | if(wa->changed)
|
---|
1012 | WinSendMsg(hwnd,
|
---|
1013 | UM_SETUP3,
|
---|
1014 | MPVOID,
|
---|
1015 | MPVOID);
|
---|
1016 | WinDismissDlg(hwnd,1);
|
---|
1017 | break;
|
---|
1018 |
|
---|
1019 | case IDM_HELP:
|
---|
1020 | if(hwndHelp)
|
---|
1021 | WinSendMsg(hwndHelp,
|
---|
1022 | HM_DISPLAY_HELP,
|
---|
1023 | MPFROM2SHORT(HELP_WALKEM,0),
|
---|
1024 | MPFROMSHORT(HM_RESOURCEID));
|
---|
1025 | break;
|
---|
1026 |
|
---|
1027 | case DID_CANCEL:
|
---|
1028 | if(wa->changed)
|
---|
1029 | WinSendMsg(hwnd,
|
---|
1030 | UM_SETUP3,
|
---|
1031 | MPVOID,
|
---|
1032 | MPVOID);
|
---|
1033 | free(wa);
|
---|
1034 | WinDismissDlg(hwnd,0);
|
---|
1035 | break;
|
---|
1036 | }
|
---|
1037 | return 0;
|
---|
1038 |
|
---|
1039 | case WM_CLOSE:
|
---|
1040 | break;
|
---|
1041 | }
|
---|
1042 | return WinDefDlgProc(hwnd,msg,mp1,mp2);
|
---|
1043 | }
|
---|
1044 |
|
---|
1045 |
|
---|
1046 | MRESULT EXPENTRY WalkAllDlgProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) {
|
---|
1047 |
|
---|
1048 | switch(msg) {
|
---|
1049 | case WM_INITDLG:
|
---|
1050 | return WalkDlgProc(hwnd,
|
---|
1051 | UM_SETUP2,
|
---|
1052 | mp1,
|
---|
1053 | mp2);
|
---|
1054 | }
|
---|
1055 | return WalkDlgProc(hwnd,msg,mp1,mp2);
|
---|
1056 | }
|
---|
1057 |
|
---|
1058 |
|
---|
1059 | MRESULT EXPENTRY WalkCopyDlgProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) {
|
---|
1060 |
|
---|
1061 | switch(msg) {
|
---|
1062 | case WM_INITDLG:
|
---|
1063 | WinSetWindowText(hwnd,
|
---|
1064 | GetPString(IDS_WALKCOPYDLGTEXT));
|
---|
1065 | return WalkDlgProc(hwnd,
|
---|
1066 | UM_SETUP2,
|
---|
1067 | mp1,
|
---|
1068 | mp2);
|
---|
1069 | }
|
---|
1070 | return WalkDlgProc(hwnd,msg,mp1,mp2);
|
---|
1071 | }
|
---|
1072 |
|
---|
1073 |
|
---|
1074 | MRESULT EXPENTRY WalkMoveDlgProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) {
|
---|
1075 |
|
---|
1076 | switch(msg) {
|
---|
1077 | case WM_INITDLG:
|
---|
1078 | WinSetWindowText(hwnd,
|
---|
1079 | GetPString(IDS_WALKMOVEDLGTEXT));
|
---|
1080 | return WalkDlgProc(hwnd,
|
---|
1081 | UM_SETUP2,
|
---|
1082 | mp1,
|
---|
1083 | mp2);
|
---|
1084 | }
|
---|
1085 | return WalkDlgProc(hwnd,msg,mp1,mp2);
|
---|
1086 | }
|
---|
1087 |
|
---|
1088 |
|
---|
1089 | MRESULT EXPENTRY WalkExtractDlgProc (HWND hwnd,ULONG msg,MPARAM mp1,
|
---|
1090 | MPARAM mp2) {
|
---|
1091 |
|
---|
1092 | switch(msg) {
|
---|
1093 | case WM_INITDLG:
|
---|
1094 | WinSetWindowText(hwnd,
|
---|
1095 | GetPString(IDS_WALKEXTRACTDLGTEXT));
|
---|
1096 | return WalkDlgProc(hwnd,
|
---|
1097 | UM_SETUP2,
|
---|
1098 | mp1,
|
---|
1099 | mp2);
|
---|
1100 | }
|
---|
1101 | return WalkDlgProc(hwnd,msg,mp1,mp2);
|
---|
1102 | }
|
---|
1103 |
|
---|
1104 |
|
---|
1105 | MRESULT EXPENTRY WalkTargetDlgProc (HWND hwnd,ULONG msg,MPARAM mp1,
|
---|
1106 | MPARAM mp2) {
|
---|
1107 |
|
---|
1108 | switch(msg) {
|
---|
1109 | case WM_INITDLG:
|
---|
1110 | {
|
---|
1111 | char s[CCHMAXPATH + 32];
|
---|
1112 |
|
---|
1113 | sprintf(s,
|
---|
1114 | GetPString(IDS_WALKTARGETDLGTEXT),
|
---|
1115 | (*targetdir) ?
|
---|
1116 | NullStr :
|
---|
1117 | " (",
|
---|
1118 | (*targetdir) ?
|
---|
1119 | NullStr :
|
---|
1120 | GetPString(IDS_NONE),
|
---|
1121 | (*targetdir) ?
|
---|
1122 | NullStr :
|
---|
1123 | ")");
|
---|
1124 | WinSetWindowText(hwnd,s);
|
---|
1125 | }
|
---|
1126 | return WalkDlgProc(hwnd,
|
---|
1127 | UM_SETUP2,
|
---|
1128 | mp1,
|
---|
1129 | mp2);
|
---|
1130 | }
|
---|
1131 | return WalkDlgProc(hwnd,msg,mp1,mp2);
|
---|
1132 | }
|
---|
1133 |
|
---|
1134 |
|
---|
1135 | MRESULT EXPENTRY WalkTwoDlgProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) {
|
---|
1136 |
|
---|
1137 | WALK2 *wa;
|
---|
1138 | CHAR szBuff[CCHMAXPATH + 1],szBuffer[CCHMAXPATH + 1],*p;
|
---|
1139 | SHORT sSelect;
|
---|
1140 | static BOOL okay; /* avoid combobox selecting as filled */
|
---|
1141 |
|
---|
1142 | switch(msg) {
|
---|
1143 | case UM_SETUP2:
|
---|
1144 | case WM_INITDLG:
|
---|
1145 | okay = FALSE;
|
---|
1146 | if(!mp2) {
|
---|
1147 | WinDismissDlg(hwnd,0);
|
---|
1148 | break;
|
---|
1149 | }
|
---|
1150 | WinSetWindowPtr(hwnd,0,mp2);
|
---|
1151 | wa = mp2;
|
---|
1152 | {
|
---|
1153 | PFNWP oldproc;
|
---|
1154 |
|
---|
1155 | oldproc = WinSubclassWindow(WinWindowFromID(hwnd,WALK_PATH),
|
---|
1156 | (PFNWP)TextSubProc);
|
---|
1157 | if(oldproc)
|
---|
1158 | WinSetWindowPtr(WinWindowFromID(hwnd,WALK_PATH),
|
---|
1159 | 0,
|
---|
1160 | (PVOID)oldproc);
|
---|
1161 | oldproc = WinSubclassWindow(WinWindowFromID(hwnd,WALK2_PATH),
|
---|
1162 | (PFNWP)TextSubProc);
|
---|
1163 | if(oldproc)
|
---|
1164 | WinSetWindowPtr(WinWindowFromID(hwnd,WALK2_PATH),
|
---|
1165 | 0,
|
---|
1166 | (PVOID)oldproc);
|
---|
1167 | }
|
---|
1168 | if(!*wa->szCurrentPath1)
|
---|
1169 | save_dir2(wa->szCurrentPath1);
|
---|
1170 | MakeFullName(wa->szCurrentPath1);
|
---|
1171 | if(!*wa->szCurrentPath2)
|
---|
1172 | save_dir2(wa->szCurrentPath2);
|
---|
1173 | MakeFullName(wa->szCurrentPath2);
|
---|
1174 | WinSendDlgItemMsg(hwnd,
|
---|
1175 | WALK_PATH,
|
---|
1176 | EM_SETTEXTLIMIT,
|
---|
1177 | MPFROM2SHORT(CCHMAXPATH,0),
|
---|
1178 | MPVOID);
|
---|
1179 | WinSetDlgItemText(hwnd,WALK_PATH,wa->szCurrentPath1);
|
---|
1180 | WinSendDlgItemMsg(hwnd,WALK2_PATH,EM_SETTEXTLIMIT,
|
---|
1181 | MPFROM2SHORT(CCHMAXPATH,0),MPVOID);
|
---|
1182 | WinSetDlgItemText(hwnd,WALK2_PATH,wa->szCurrentPath2);
|
---|
1183 | FillPathListBox(hwnd,
|
---|
1184 | WinWindowFromID(hwnd,WALK_DRIVELIST),
|
---|
1185 | WinWindowFromID(hwnd,WALK_DIRLIST),
|
---|
1186 | wa->szCurrentPath1,FALSE);
|
---|
1187 | FillPathListBox(hwnd,
|
---|
1188 | WinWindowFromID(hwnd,WALK2_DRIVELIST),
|
---|
1189 | WinWindowFromID(hwnd,WALK2_DIRLIST),
|
---|
1190 | wa->szCurrentPath2,FALSE);
|
---|
1191 | if(!PostMsg(hwnd,UM_SETUP4,MPVOID,MPVOID))
|
---|
1192 | okay = TRUE;
|
---|
1193 | {
|
---|
1194 | MRESULT ret;
|
---|
1195 |
|
---|
1196 | ret = WinDefDlgProc(hwnd,WM_INITDLG,mp1,mp2);
|
---|
1197 | WinSendMsg(hwnd,UM_SETUP,MPVOID,MPVOID);
|
---|
1198 | WinInvalidateRect(WinWindowFromID(hwnd,WALK_PATH),NULL,TRUE);
|
---|
1199 | WinInvalidateRect(WinWindowFromID(hwnd,WALK2_PATH),NULL,TRUE);
|
---|
1200 | return ret;
|
---|
1201 | }
|
---|
1202 |
|
---|
1203 | case UM_SETUP4:
|
---|
1204 | okay = TRUE;
|
---|
1205 | return 0;
|
---|
1206 |
|
---|
1207 | case WM_PRESPARAMCHANGED:
|
---|
1208 | {
|
---|
1209 | ULONG AttrFound,AttrValue[64],cbRetLen;
|
---|
1210 |
|
---|
1211 | cbRetLen = WinQueryPresParam(hwnd,(ULONG)mp1,0,&AttrFound,
|
---|
1212 | (ULONG)sizeof(AttrValue),
|
---|
1213 | &AttrValue,0);
|
---|
1214 | if(cbRetLen) {
|
---|
1215 | switch(AttrFound) {
|
---|
1216 | case PP_FONTNAMESIZE:
|
---|
1217 | PrfWriteProfileData(fmprof,
|
---|
1218 | appname,
|
---|
1219 | "WalkFont",
|
---|
1220 | (PVOID)AttrValue,
|
---|
1221 | cbRetLen);
|
---|
1222 | *WalkFont = 0;
|
---|
1223 | WalkFontSize = sizeof(WalkFont);
|
---|
1224 | WinInvalidateRect(WinWindowFromID(hwnd,WALK_PATH),
|
---|
1225 | NULL,
|
---|
1226 | TRUE);
|
---|
1227 | break;
|
---|
1228 | }
|
---|
1229 | }
|
---|
1230 | }
|
---|
1231 | break;
|
---|
1232 |
|
---|
1233 | case UM_SETUP:
|
---|
1234 | {
|
---|
1235 | INT x;
|
---|
1236 | USHORT id[] = {WALK_PATH,WALK_DIRLIST,
|
---|
1237 | WALK2_PATH,WALK2_DIRLIST,0};
|
---|
1238 |
|
---|
1239 | if(*WalkFont ||
|
---|
1240 | (PrfQueryProfileData(fmprof,
|
---|
1241 | appname,
|
---|
1242 | "WalkFont",
|
---|
1243 | (PVOID)WalkFont,
|
---|
1244 | &WalkFontSize) &&
|
---|
1245 | WalkFontSize)) {
|
---|
1246 | for(x = 0;id[x];x++)
|
---|
1247 | WinSetPresParam(WinWindowFromID(hwnd,id[x]),
|
---|
1248 | PP_FONTNAMESIZE,
|
---|
1249 | WalkFontSize,
|
---|
1250 | (PVOID)WalkFont);
|
---|
1251 | }
|
---|
1252 | }
|
---|
1253 | return 0;
|
---|
1254 |
|
---|
1255 | case UM_CONTROL:
|
---|
1256 | case WM_CONTROL:
|
---|
1257 | wa = WinQueryWindowPtr(hwnd,0);
|
---|
1258 | if(SHORT1FROMMP(mp1) == WALK_DRIVELIST ||
|
---|
1259 | SHORT1FROMMP(mp1) == WALK_DIRLIST ||
|
---|
1260 | SHORT1FROMMP(mp1) == WALK2_DRIVELIST ||
|
---|
1261 | SHORT1FROMMP(mp1) == WALK2_DIRLIST) {
|
---|
1262 | sSelect = (USHORT)WinSendDlgItemMsg(hwnd,
|
---|
1263 | SHORT1FROMMP(mp1),
|
---|
1264 | LM_QUERYSELECTION,
|
---|
1265 | MPVOID,MPVOID);
|
---|
1266 | *szBuffer = 0;
|
---|
1267 | if(sSelect >= 0)
|
---|
1268 | WinSendDlgItemMsg(hwnd,SHORT1FROMMP(mp1),LM_QUERYITEMTEXT,
|
---|
1269 | MPFROM2SHORT(sSelect,CCHMAXPATH),
|
---|
1270 | MPFROMP(szBuffer));
|
---|
1271 | }
|
---|
1272 | switch(SHORT1FROMMP(mp1)) {
|
---|
1273 | case WALK_DRIVELIST:
|
---|
1274 | if(okay && *szBuffer && SHORT2FROMMP(mp1) == LN_ENTER) {
|
---|
1275 |
|
---|
1276 | ULONG ulDirLen = CCHMAXPATH;
|
---|
1277 | APIRET rc;
|
---|
1278 |
|
---|
1279 | rc = DosQCurDir(toupper(*szBuffer) - '@',
|
---|
1280 | &szBuff[3],&ulDirLen);
|
---|
1281 | if(!rc) {
|
---|
1282 | strcpy(wa->szCurrentPath1,"C:\\");
|
---|
1283 | *wa->szCurrentPath1 = toupper(*szBuffer);
|
---|
1284 | WinSetDlgItemText(hwnd,
|
---|
1285 | WALK_PATH,
|
---|
1286 | wa->szCurrentPath1);
|
---|
1287 | FillPathListBox(hwnd,
|
---|
1288 | WinWindowFromID(hwnd,WALK_DRIVELIST),
|
---|
1289 | WinWindowFromID(hwnd,WALK_DIRLIST),
|
---|
1290 | wa->szCurrentPath1,FALSE);
|
---|
1291 | }
|
---|
1292 | }
|
---|
1293 | break;
|
---|
1294 |
|
---|
1295 | case WALK_DIRLIST:
|
---|
1296 | if(okay && SHORT2FROMMP(mp1) == LN_ENTER) {
|
---|
1297 |
|
---|
1298 | ULONG ulSearchCount;
|
---|
1299 | FILEFINDBUF3 findbuf;
|
---|
1300 | HDIR hDir;
|
---|
1301 | APIRET rc;
|
---|
1302 |
|
---|
1303 | lstrip(rstrip(szBuffer));
|
---|
1304 | if(*szBuffer) {
|
---|
1305 | strcpy(szBuff,wa->szCurrentPath1);
|
---|
1306 | if(szBuff[strlen(szBuff) - 1] != '\\')
|
---|
1307 | strcat(szBuff,"\\");
|
---|
1308 | strcat(szBuff,szBuffer);
|
---|
1309 | MakeFullName(szBuff);
|
---|
1310 | DosError(FERR_DISABLEHARDERR);
|
---|
1311 | hDir = HDIR_CREATE;
|
---|
1312 | ulSearchCount = 1L;
|
---|
1313 | if(!IsRoot(szBuff)) {
|
---|
1314 | rc = DosFindFirst(szBuff,
|
---|
1315 | &hDir,
|
---|
1316 | FILE_DIRECTORY |
|
---|
1317 | MUST_HAVE_DIRECTORY | FILE_READONLY |
|
---|
1318 | FILE_ARCHIVED | FILE_SYSTEM | FILE_HIDDEN,
|
---|
1319 | &findbuf,
|
---|
1320 | sizeof(FILEFINDBUF3),
|
---|
1321 | &ulSearchCount,
|
---|
1322 | FIL_STANDARD);
|
---|
1323 | if(!rc)
|
---|
1324 | DosFindClose(hDir);
|
---|
1325 | }
|
---|
1326 | else {
|
---|
1327 | findbuf.attrFile = FILE_DIRECTORY;
|
---|
1328 | rc = 0;
|
---|
1329 | }
|
---|
1330 | if(!rc && (findbuf.attrFile & FILE_DIRECTORY)) {
|
---|
1331 | strcpy(wa->szCurrentPath1,szBuff);
|
---|
1332 | WinSetDlgItemText(hwnd,WALK_PATH,wa->szCurrentPath1);
|
---|
1333 | FillPathListBox(hwnd,
|
---|
1334 | WinWindowFromID(hwnd,WALK_DRIVELIST),
|
---|
1335 | WinWindowFromID(hwnd,WALK_DIRLIST),
|
---|
1336 | wa->szCurrentPath1,FALSE);
|
---|
1337 | }
|
---|
1338 | }
|
---|
1339 | }
|
---|
1340 | break;
|
---|
1341 |
|
---|
1342 | case WALK2_DRIVELIST:
|
---|
1343 | if(okay && *szBuffer && SHORT2FROMMP(mp1) == LN_ENTER) {
|
---|
1344 |
|
---|
1345 | ULONG ulDirLen = CCHMAXPATH;
|
---|
1346 | APIRET rc;
|
---|
1347 |
|
---|
1348 | rc = DosQCurDir(toupper(*szBuffer) - '@',
|
---|
1349 | &szBuff[3],&ulDirLen);
|
---|
1350 | if(!rc) {
|
---|
1351 | strcpy(wa->szCurrentPath2,"C:\\");
|
---|
1352 | *wa->szCurrentPath2 = toupper(*szBuffer);
|
---|
1353 | WinSetDlgItemText(hwnd,
|
---|
1354 | WALK2_PATH,
|
---|
1355 | wa->szCurrentPath2);
|
---|
1356 | FillPathListBox(hwnd,
|
---|
1357 | WinWindowFromID(hwnd,WALK2_DRIVELIST),
|
---|
1358 | WinWindowFromID(hwnd,WALK2_DIRLIST),
|
---|
1359 | wa->szCurrentPath2,FALSE);
|
---|
1360 | }
|
---|
1361 | }
|
---|
1362 | break;
|
---|
1363 |
|
---|
1364 | case WALK2_DIRLIST:
|
---|
1365 | if(okay && SHORT2FROMMP(mp1) == LN_ENTER) {
|
---|
1366 |
|
---|
1367 | ULONG ulSearchCount;
|
---|
1368 | FILEFINDBUF3 findbuf;
|
---|
1369 | HDIR hDir;
|
---|
1370 | APIRET rc;
|
---|
1371 |
|
---|
1372 | lstrip(rstrip(szBuffer));
|
---|
1373 | if(*szBuffer) {
|
---|
1374 | strcpy(szBuff,wa->szCurrentPath2);
|
---|
1375 | if(szBuff[strlen(szBuff) - 1] != '\\')
|
---|
1376 | strcat(szBuff,"\\");
|
---|
1377 | strcat(szBuff,szBuffer);
|
---|
1378 | MakeFullName(szBuff);
|
---|
1379 | DosError(FERR_DISABLEHARDERR);
|
---|
1380 | hDir = HDIR_CREATE;
|
---|
1381 | ulSearchCount = 1L;
|
---|
1382 | if(!IsRoot(szBuff)) {
|
---|
1383 | rc = DosFindFirst(szBuff,
|
---|
1384 | &hDir,
|
---|
1385 | FILE_DIRECTORY |
|
---|
1386 | MUST_HAVE_DIRECTORY | FILE_READONLY |
|
---|
1387 | FILE_ARCHIVED | FILE_SYSTEM | FILE_HIDDEN,
|
---|
1388 | &findbuf,
|
---|
1389 | sizeof(FILEFINDBUF3),
|
---|
1390 | &ulSearchCount,
|
---|
1391 | FIL_STANDARD);
|
---|
1392 | if(!rc)
|
---|
1393 | DosFindClose(hDir);
|
---|
1394 | }
|
---|
1395 | else {
|
---|
1396 | findbuf.attrFile = FILE_DIRECTORY;
|
---|
1397 | rc = 0;
|
---|
1398 | }
|
---|
1399 | if(!rc && (findbuf.attrFile & FILE_DIRECTORY)) {
|
---|
1400 | strcpy(wa->szCurrentPath2,szBuff);
|
---|
1401 | WinSetDlgItemText(hwnd,WALK2_PATH,wa->szCurrentPath2);
|
---|
1402 | FillPathListBox(hwnd,
|
---|
1403 | WinWindowFromID(hwnd,WALK2_DRIVELIST),
|
---|
1404 | WinWindowFromID(hwnd,WALK2_DIRLIST),
|
---|
1405 | wa->szCurrentPath2,FALSE);
|
---|
1406 | }
|
---|
1407 | }
|
---|
1408 | }
|
---|
1409 | break;
|
---|
1410 | }
|
---|
1411 | return 0;
|
---|
1412 |
|
---|
1413 | case WM_COMMAND:
|
---|
1414 | wa = WinQueryWindowPtr(hwnd,0);
|
---|
1415 | if(!wa)
|
---|
1416 | WinDismissDlg(hwnd,0);
|
---|
1417 | *szBuff = 0;
|
---|
1418 | WinQueryDlgItemText(hwnd,
|
---|
1419 | WALK_PATH,
|
---|
1420 | CCHMAXPATH,
|
---|
1421 | szBuff);
|
---|
1422 | lstrip(rstrip(szBuff));
|
---|
1423 | while((p = strchr(szBuff,'/')) != NULL)
|
---|
1424 | *p = '\\';
|
---|
1425 | while(strlen(szBuff) > 3 &&
|
---|
1426 | szBuff[strlen(szBuff) - 1] == '\\')
|
---|
1427 | szBuff[strlen(szBuff) - 1] = 0;
|
---|
1428 | MakeFullName(szBuff);
|
---|
1429 | if(*szBuff &&
|
---|
1430 | stricmp(szBuff,wa->szCurrentPath1)) {
|
---|
1431 | if(!SetDir(WinQueryWindow(WinQueryWindow(hwnd,QW_PARENT),
|
---|
1432 | QW_OWNER),
|
---|
1433 | hwnd,
|
---|
1434 | szBuff,
|
---|
1435 | 0))
|
---|
1436 | strcpy(wa->szCurrentPath1,szBuff);
|
---|
1437 | else if(SHORT1FROMMP(mp1) != DID_CANCEL)
|
---|
1438 | return 0;
|
---|
1439 | }
|
---|
1440 | WinSetDlgItemText(hwnd,
|
---|
1441 | WALK_PATH,
|
---|
1442 | wa->szCurrentPath1);
|
---|
1443 | *szBuff = 0;
|
---|
1444 | WinQueryDlgItemText(hwnd,
|
---|
1445 | WALK2_PATH,
|
---|
1446 | CCHMAXPATH,
|
---|
1447 | szBuff);
|
---|
1448 | lstrip(rstrip(szBuff));
|
---|
1449 | while((p = strchr(szBuff,'/')) != NULL)
|
---|
1450 | *p = '\\';
|
---|
1451 | while(strlen(szBuff) > 3 &&
|
---|
1452 | szBuff[strlen(szBuff) - 1] == '\\')
|
---|
1453 | szBuff[strlen(szBuff) - 1] = 0;
|
---|
1454 | MakeFullName(szBuff);
|
---|
1455 | if(*szBuff &&
|
---|
1456 | stricmp(szBuff,wa->szCurrentPath2)) {
|
---|
1457 | if(!SetDir(WinQueryWindow(WinQueryWindow(hwnd,QW_PARENT),
|
---|
1458 | QW_OWNER),
|
---|
1459 | hwnd,
|
---|
1460 | szBuff,
|
---|
1461 | 0))
|
---|
1462 | strcpy(wa->szCurrentPath2,szBuff);
|
---|
1463 | else if(SHORT1FROMMP(mp1) != DID_CANCEL)
|
---|
1464 | return 0;
|
---|
1465 | }
|
---|
1466 | WinSetDlgItemText(hwnd,
|
---|
1467 | WALK2_PATH,
|
---|
1468 | wa->szCurrentPath2);
|
---|
1469 | switch(SHORT1FROMMP(mp1)) {
|
---|
1470 | case DID_OK:
|
---|
1471 | WinDismissDlg(hwnd,1);
|
---|
1472 | break;
|
---|
1473 |
|
---|
1474 | case IDM_HELP:
|
---|
1475 | if(hwndHelp)
|
---|
1476 | WinSendMsg(hwndHelp,
|
---|
1477 | HM_DISPLAY_HELP,
|
---|
1478 | MPFROM2SHORT(HELP_WALKEM2,0),
|
---|
1479 | MPFROMSHORT(HM_RESOURCEID));
|
---|
1480 | break;
|
---|
1481 |
|
---|
1482 | case DID_CANCEL:
|
---|
1483 | WinDismissDlg(hwnd,0);
|
---|
1484 | break;
|
---|
1485 | }
|
---|
1486 | return 0;
|
---|
1487 |
|
---|
1488 | case WM_CLOSE:
|
---|
1489 | break;
|
---|
1490 | }
|
---|
1491 | return WinDefDlgProc(hwnd,msg,mp1,mp2);
|
---|
1492 | }
|
---|
1493 |
|
---|
1494 |
|
---|
1495 | MRESULT EXPENTRY WalkTwoCmpDlgProc (HWND hwnd,ULONG msg,MPARAM mp1,
|
---|
1496 | MPARAM mp2) {
|
---|
1497 |
|
---|
1498 | switch(msg) {
|
---|
1499 | case WM_INITDLG:
|
---|
1500 | WinSetWindowText(hwnd,
|
---|
1501 | GetPString(IDS_WALKCOMPAREDLGTEXT));
|
---|
1502 | return WalkTwoDlgProc(hwnd,
|
---|
1503 | UM_SETUP2,
|
---|
1504 | mp1,
|
---|
1505 | mp2);
|
---|
1506 | }
|
---|
1507 | return WalkTwoDlgProc(hwnd,msg,mp1,mp2);
|
---|
1508 | }
|
---|
1509 |
|
---|
1510 |
|
---|
1511 | MRESULT EXPENTRY WalkTwoSetDlgProc (HWND hwnd,ULONG msg,MPARAM mp1,
|
---|
1512 | MPARAM mp2) {
|
---|
1513 |
|
---|
1514 | switch(msg) {
|
---|
1515 | case WM_INITDLG:
|
---|
1516 | WinSetWindowText(hwnd,
|
---|
1517 | GetPString(IDS_WALKSETDIRSDLGTEXT));
|
---|
1518 | return WalkTwoDlgProc(hwnd,
|
---|
1519 | UM_SETUP2,
|
---|
1520 | mp1,
|
---|
1521 | mp2);
|
---|
1522 | }
|
---|
1523 | return WalkTwoDlgProc(hwnd,msg,mp1,mp2);
|
---|
1524 | }
|
---|
1525 |
|
---|