Changeset 773 for trunk/dll/comp.c
- Timestamp:
- Aug 7, 2007, 11:23:27 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/comp.c
r771 r773 28 28 01 Aug 07 SHL Rework to remove vast amount of duplicate code 29 29 03 Aug 07 GKY Enlarged and made setable everywhere Findbuf (speed file loading) 30 06 Aug 07 SHL Move BldFullPathName here to be near primary caller 31 07 Aug 07 SHL COMP_COLLECT: Avoid collecting empty entries when nothing selected 30 32 31 33 ***********************************************************************/ … … 49 51 #include "fm3str.h" 50 52 51 #pragma alloc_text(COMPAREDIR,FillCnrsThread,FillDirList,CompNames )53 #pragma alloc_text(COMPAREDIR,FillCnrsThread,FillDirList,CompNames,BldFullPathName) 52 54 #pragma alloc_text(COMPAREDIR1,CompareDlgProc) 53 55 #pragma alloc_text(COMPAREDIR2,SelectCnrsThread,ActionCnrThread) … … 64 66 65 67 static PSZ pszSrcFile = __FILE__; 68 69 /** 70 * Build full path name in callers buffer given directory 71 * name and filename 72 * @param pszPathName points to drive/directory if not NULL 73 * @returns pointer to full path name in caller's buffer 74 * @note OK for pszFullPathName and pszPathName to point to same buffer 75 * 76 */ 77 78 PSZ BldFullPathName(PSZ pszFullPathName, PSZ pszPathName, PSZ pszFileName) 79 { 80 UINT c = pszPathName ? strlen(pszPathName) : 0; 81 if (c > 0) { 82 memcpy(pszFullPathName, pszPathName, c); 83 if (pszFullPathName[c - 1] != '\\') 84 pszFullPathName[c++] = '\\'; 85 } 86 strcpy(pszFullPathName + c, pszFileName); 87 return pszFullPathName; 88 } 66 89 67 90 //=== SnapShot() Write directory tree to file and recurse if requested === … … 361 384 362 385 if (!cmp) { 363 Runtime_Error (pszSrcFile, __LINE__, "no data");386 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT); 364 387 return; 365 388 } … … 458 481 case IDM_MOVE: 459 482 if (hwndCnrS == WinWindowFromID(cmp->hwnd, COMP_RIGHTDIR)) 460 // 02 Aug 07 SHL fixme to replace this kind of stuff with _makepath or equivalent461 483 BldFullPathName(szNewName, cmp->leftdir, pci->pszDisplayName); 462 484 //sprintf(szNewName, "%s%s%s", … … 716 738 717 739 if (!str || !*str) { 718 Runtime_Error (pszSrcFile, __LINE__, "no data");740 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT); 719 741 return; 720 742 } … … 818 840 819 841 if (!cmp) { 820 Runtime_Error (pszSrcFile, __LINE__, "no data");842 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT); 821 843 _endthread(); 822 844 } … … 1136 1158 if (x >= 0) { 1137 1159 // File appears on right side 1138 BldFullPathName(szBuf, cmp->rightdir, files l[r]->fname);1160 BldFullPathName(szBuf, cmp->rightdir, filesr[r]->fname); 1139 1161 //sprintf(szBuf, "%s%s%s", cmp->rightdir, 1140 1162 // (cmp->rightdir[strlen(cmp->rightdir) - 1] == '\\') ? … … 1360 1382 } 1361 1383 1362 #define hwndLeft (WinWindowFromID(hwnd,COMP_LEFTDIR)) 1363 #define hwndRight (WinWindowFromID(hwnd,COMP_RIGHTDIR)) 1384 // fixme to be gone - use variable 1385 #define hwndLeft (WinWindowFromID(hwnd,COMP_LEFTDIR)) 1386 #define hwndRight (WinWindowFromID(hwnd,COMP_RIGHTDIR)) 1364 1387 1365 1388 //=== CompareDlgProc() Compare directories dialog procedure === … … 1368 1391 { 1369 1392 COMPARE *cmp; 1370 1371 static HPOINTER hptr = (HPOINTER) 0; 1393 BOOL temp; 1394 1395 static HPOINTER hptr; 1372 1396 1373 1397 switch (msg) { … … 2376 2400 case COMP_COLLECT: 2377 2401 cmp = INSTDATA(hwnd); 2378 if (cmp) { 2379 2380 CHAR **listl, **listr = NULL; 2381 2402 if (!cmp) 2403 Runtime_Error2(pszSrcFile, __LINE__, IDS_NODATATEXT); 2404 else { 2405 CHAR **listl; 2406 CHAR **listr = NULL; 2382 2407 if (!Collector) { 2383 2384 2408 SWP swp; 2385 2409 HWND hwndC; 2386 2387 if (!fAutoTile && !ParentIsDesktop(hwnd, cmp->hwndParent) && 2388 (!fExternalCollector && !strcmp(realappname, FM3Str))) 2410 if (!fAutoTile && 2411 !ParentIsDesktop(hwnd, cmp->hwndParent) && 2412 !fExternalCollector && 2413 !strcmp(realappname, FM3Str)) { 2389 2414 GetNextWindowPos(cmp->hwndParent, &swp, NULL, NULL); 2390 hwndC = StartCollector((fExternalCollector || 2391 strcmp(realappname, FM3Str)) ? 2392 HWND_DESKTOP : cmp->hwndParent, 4); 2415 } 2416 hwndC = StartCollector(fExternalCollector || 2417 strcmp(realappname, FM3Str) ? 2418 HWND_DESKTOP : 2419 cmp->hwndParent, 2420 4); 2393 2421 if (hwndC) { 2394 if (!fAutoTile && !ParentIsDesktop(hwnd, cmp->hwndParent) && 2395 (!fExternalCollector && !strcmp(realappname, FM3Str))) 2396 WinSetWindowPos(hwndC, HWND_TOP, swp.x, swp.y, 2397 swp.cx, swp.cy, SWP_MOVE | SWP_SIZE | 2398 SWP_SHOW | SWP_ZORDER); 2399 else if (!ParentIsDesktop(hwnd, cmp->hwndParent) && fAutoTile && 2400 !strcmp(realappname, FM3Str)) 2422 if (!fAutoTile && 2423 !ParentIsDesktop(hwnd, cmp->hwndParent) && 2424 !fExternalCollector && 2425 !strcmp(realappname, FM3Str)) { 2426 WinSetWindowPos(hwndC, HWND_TOP, 2427 swp.x, swp.y, swp.cx, swp.cy, 2428 SWP_MOVE | SWP_SIZE | SWP_SHOW | SWP_ZORDER); 2429 } 2430 else if (!ParentIsDesktop(hwnd, cmp->hwndParent) && 2431 fAutoTile && 2432 !strcmp(realappname, FM3Str)) { 2401 2433 TileChildren(cmp->hwndParent, TRUE); 2402 DosSleep(32); //05 Aug 07 GKY 64 2434 } 2435 DosSleep(32); // 05 Aug 07 GKY 64 2403 2436 PostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(COMP_COLLECT, 0), MPVOID); 2404 2437 break; … … 2407 2440 else 2408 2441 StartCollector(cmp->hwndParent, 4); 2409 { 2410 BOOL temp; 2411 2412 temp = fSelectedAlways; 2413 fSelectedAlways = TRUE; 2414 listl = BuildList(hwndLeft); 2415 if (!*cmp->rightlist) 2416 listr = BuildList(hwndRight); 2417 fSelectedAlways = temp; 2418 } 2442 2443 temp = fSelectedAlways; 2444 fSelectedAlways = TRUE; 2445 listl = BuildList(hwndLeft); 2446 if (!*cmp->rightlist) 2447 listr = BuildList(hwndRight); 2448 fSelectedAlways = temp; 2449 2419 2450 if (listl || listr) { 2420 2451 if (Collector) { 2421 if (listl) { 2422 if (!PostMsg(Collector, WM_COMMAND, 2423 MPFROM2SHORT(IDM_COLLECTOR, 0), MPFROMP(listl))) 2424 FreeList(listl); 2425 } 2426 if (listr) { 2427 if (!PostMsg(Collector, WM_COMMAND, 2428 MPFROM2SHORT(IDM_COLLECTOR, 0), MPFROMP(listr))) 2429 FreeList(listr); 2452 // 07 Aug 07 SHL Avoid collected from empty list 2453 if (listl && listl[0] && *listl[0]) { 2454 if (PostMsg(Collector, WM_COMMAND, 2455 MPFROM2SHORT(IDM_COLLECTOR, 0), MPFROMP(listl))) 2456 listl = NULL; // Collector will free 2457 } 2458 if (listr && listr[0] && *listr[0]) { 2459 if (PostMsg(Collector, WM_COMMAND, 2460 MPFROM2SHORT(IDM_COLLECTOR, 0), MPFROMP(listr))) 2461 listr = NULL; // Collector will free 2430 2462 } 2431 2463 WinSetWindowPos(WinQueryWindow(WinQueryWindow(Collector, 2432 2464 QW_PARENT), 2433 QW_PARENT), HWND_TOP, 0, 0, 0, 0, 2465 QW_PARENT), 2466 HWND_TOP, 0, 0, 0, 0, 2434 2467 SWP_ACTIVATE); 2435 2468 } 2436 else { 2437 FreeList(listl); 2438 FreeList(listr); 2439 } 2469 FreeList(listl); 2470 FreeList(listr); 2440 2471 } 2441 2472 }
Note:
See TracChangeset
for help on using the changeset viewer.