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