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