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