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