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