Changeset 787
- Timestamp:
 - Aug 19, 2007, 11:02:37 PM (18 years ago)
 - Location:
 - trunk/dll
 - Files:
 - 
      
- 11 edited
 
- 
          
  dircnrs.c (modified) (3 diffs)
 - 
          
  error.c (modified) (5 diffs)
 - 
          
  fm3dll.h (modified) (6 diffs)
 - 
          
  ipf/notebook.ipf (modified) (1 diff)
 - 
          
  mainwnd.c (modified) (35 diffs)
 - 
          
  misc.c (modified) (25 diffs)
 - 
          
  objcnr.c (modified) (2 diffs)
 - 
          
  seeall.c (modified) (17 diffs)
 - 
          
  select.c (modified) (23 diffs)
 - 
          
  treecnr.c (modified) (8 diffs)
 - 
          
  walkem.c (modified) (3 diffs)
 
 
Legend:
- Unmodified
 - Added
 - Removed
 
- 
      
trunk/dll/dircnrs.c
r775 r787 799 799 if (strlen(dcd->previous) > strlen(dcd->directory) && 800 800 !strnicmp(dcd->directory, dcd->previous, 801 strlen(dcd->directory))) { 802 803 PCNRITEM pci; 804 805 pci = FindCnrRecord(dcd->hwndCnr, 806 dcd->previous, NULL, TRUE, FALSE, TRUE); 801 strlen(dcd->directory))) 802 { 803 PCNRITEM pci = FindCnrRecord(dcd->hwndCnr, 804 dcd->previous, 805 NULL, TRUE, FALSE, TRUE); 807 806 if (pci && (INT) pci != -1) { 808 / * make found item current (cursored) item */807 // make found item current (cursored) item 809 808 WinSendMsg(dcd->hwndCnr, CM_SETRECORDEMPHASIS, MPFROMP(pci), 810 809 MPFROM2SHORT(TRUE, CRA_CURSORED)); … … 3250 3249 else if (*dcd->directory) 3251 3250 OpenObject(dcd->directory, Default, hwnd); 3252 } 3253 break; 3254 } 3251 } // CN_ENTER 3252 break; 3253 } // switch mp1 3255 3254 break; 3256 } 3255 } // if dcd 3257 3256 return 0; 3258 3257 … … 3260 3259 if (dcd && mp2) { 3261 3260 3262 HWND ret; 3263 3264 ret = StartMLEEditor(dcd->hwndParent, 3265 (INT) mp1, (CHAR *) mp2, dcd->hwndFrame); 3261 HWND ret = StartMLEEditor(dcd->hwndParent, 3262 (INT)mp1, (CHAR *)mp2, dcd->hwndFrame); 3266 3263 if (mp2) 3267 free((CHAR *) mp2);3264 free((CHAR *)mp2); 3268 3265 return MRFROMLONG(ret); 3269 3266 }  - 
      
trunk/dll/error.c
r689 r787 25 25 20 Apr 07 SHL Correct IDS_GENERR1TEXT formatting 26 26 23 Apr 07 SHL Add Win_Error_NoMsgBox. Rework others 27 14 Aug 07 SHL Add GetMSecTimer 28 14 Aug 07 SHL Use GetMSecTimer in DbgMsg 27 29 28 30 ***********************************************************************/ … … 42 44 43 45 #pragma data_seg(DATA1) 44 #pragma alloc_text(FMINPUT,Win_Error,Dos_Error,saymsg,showMsg) 46 47 static PSZ pszSrcFile = __FILE__; 45 48 46 49 static VOID formatWinError(PSZ pszBuf, UINT cBufBytes, HWND hwndErr, HWND hwndOwner, … … 55 58 { 56 59 va_list va; 60 61 #if 1 // fixme to be selectable 62 63 static ULONG ul1stMSec; 64 // static ULONG ulLastMSec; 65 66 ULONG msec = GetMSecTimer(); 67 ULONG delta; 68 69 if (!ul1stMSec) { 70 ul1stMSec = msec; 71 // ulLastMSec = msec; // Avoid big delta 1st time 72 } 73 74 delta = msec - ul1stMSec; 75 // ulLastMSec = msec; 76 fprintf(stderr, "%03lu.%03lu ", delta / 1000, delta % 1000); 77 78 #endif 57 79 58 80 // OK for source file name to be null … … 227 249 } // formatWinError 228 250 251 /** 252 * Return millisecond timer value 253 * Resolution is milliseconds, but accuracy will be less 254 * depending on systems settings 255 */ 256 257 ULONG GetMSecTimer(void) 258 { 259 ULONG msec; 260 261 APIRET rc = DosQuerySysInfo(QSV_MS_COUNT, QSV_MS_COUNT, 262 &msec, sizeof(msec)); 263 if (rc) { 264 Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__, 265 "DosQuerySysInfo"); 266 msec = 0; 267 } 268 return msec; 269 } 270 229 271 //== Runtime_Error: report runtime library error using passed message string === 230 272 … … 363 405 364 406 } // Win_Error_NoMsgBox 407 408 #pragma alloc_text(ERROR,Win_Error,Dos_Error,saymsg,showMsg,GetHiresTimeer)  - 
      
trunk/dll/fm3dll.h
r773 r787 54 54 23 Jul 07 SHL More CNRITEM updates (ticket#24) 55 55 01 Aug 07 SHL More CNRITEM and ARCITEM updates (ticket#24) 56 14 Aug 07 SHL Add GetMSecTimer 57 14 Aug 07 SHL Delete obsoletes 58 16 Aug 07 SHL Update for ticket# 109 - status update 59 18 Aug 07 SHL Update for ticket# 31 - states length 56 60 57 61 ***********************************************************************/ … … 657 661 INT Dos_Error2(ULONG mb_type, ULONG ulRC, HWND hwndOwner, PCSZ pszSrcFile, 658 662 UINT uSrcLineNo, UINT idMsg); 663 ULONG GetMSecTimer(void); 659 664 VOID Runtime_Error(PCSZ pszSrcFile, UINT uSrcLineNo, PCSZ pszFmt, ...); 660 665 VOID Runtime_Error2(PCSZ pszSrcFile, UINT uSrcLineNo, UINT idMsg); … … 718 723 CHAR * directory, CHAR * keyroot, DIRCNRDATA * dcd, 719 724 BOOL compare); 720 VOID FreeMallocedMem(VOID * mem);721 VOID FcloseFile(FILE * fp);722 725 VOID SetConditionalCascade(HWND hwndMenu, USHORT id, USHORT def); 723 726 VOID SetSortChecks(HWND hwndMenu, INT sortflags); … … 1028 1031 VOID load_udirs(VOID); 1029 1032 VOID save_udirs(VOID); 1030 BOOL add_udir(BOOL userdirs, CHAR * inpath); 1031 BOOL remove_udir(CHAR * path); 1032 BOOL remove_ldir(CHAR * path); 1033 BOOL add_udir(BOOL userdirs, PSZ inpath); 1034 BOOL remove_udir(PSZ path); 1035 BOOL remove_ldir(PSZ path); 1036 VOID fill_setups_list(VOID); 1033 1037 VOID load_setups(VOID); 1034 1038 VOID save_setups(VOID); 1035 BOOL add_setup(CHAR * name);1036 BOOL remove_setup(CHAR * name);1037 VOID FillPathListBox(HWND hwnd, HWND hwnddrive, HWND hwnddir, CHAR *path,1039 INT add_setup(PSZ stateName); 1040 INT remove_setup(PSZ stateName); 1041 VOID FillPathListBox(HWND hwnd, HWND hwnddrive, HWND hwnddir, PSZ path, 1038 1042 BOOL nounwriteable); 1039 1043 MRESULT EXPENTRY WalkDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2); … … 1362 1366 fNoTreeGap, fDummy, fVTreeOpensWPS, fUseQProcStat, 1363 1367 fStartMinimized, fStartMaximized, fRemoteBug, fReminimize, 1364 fDragndropDlg, fMinOnOpen, fUserComboBox, loadedsetups,1368 fDragndropDlg, fMinOnOpen, fUserComboBox, 1365 1369 fQuickArcFind, fNoRemovableScan, fAutoView, fDataMin, 1366 1370 fDataToFore, fDataShowDrives, fDataInclRemote, … … 1434 1438 #pragma data_seg(GLOBAL3) 1435 1439 #endif 1436 #define MAXNUMSETUPS 1001437 DATADEF CHAR lastsetups[MAXNUMSETUPS][13];1438 DATADEF INT lastsetup;1439 1440 DATADEF LONG standardcolors[16]; 1440 1441  - 
      
trunk/dll/ipf/notebook.ipf
r783 r787 323 323 all expanded branches in the tree before switching because of one of the 324 324 two above switch events. 325 This option is will significantly slow down switching 326 if you a large number of directories in the Drive Tree. 325 327 :p. 326 328 :hp6.Expand curr. after switch:ehp6. causes the Drive Tree to expand  - 
      
trunk/dll/mainwnd.c
r775 r787 37 37 06 Aug 07 GKY Reduce DosSleep times (ticket 148) 38 38 07 Aug 07 SHL Use BldQuotedFileName 39 16 Aug 07 SHL Update IDM_SAVEDIRCNRSTATE logic for ticket# 109 40 18 Aug 07 SHL Rework UM_FILLSETUPLIST for new setups storage 41 19 Aug 07 SHL Move #pragma alloc_text to end of file for OpenWatcom 39 42 40 43 ***********************************************************************/ … … 43 46 #define INCL_WIN 44 47 // #define INCL_WINERRORS 45 #define INCL_SHLERRORS 48 #define INCL_SHLERRORS // PMERR_NOT_IN_IDX 46 49 #define INCL_WINHELP 47 50 #define INCL_GPI … … 66 69 67 70 static PSZ pszSrcFile = __FILE__; 68 69 #pragma alloc_text(MISC8,SetToggleChecks,FindDirCnrByName,TopWindow)70 #pragma alloc_text(MISC8,TopWindowName,CountDirCnrs)71 #pragma alloc_text(MAINWND,AdjustSizeOfClient,FillClient,ChildButtonProc)72 #pragma alloc_text(MAINWND,ToolBackProc,StatusProc)73 #pragma alloc_text(MAINWND,MoveChildrenAwayFromTree,ArrangeIcons,NextChild)74 #pragma alloc_text(MAINWND,ChildFrameButtonProc)75 #pragma alloc_text(MAINWND2,CloseChildren,CountChildren,GetNextWindowPos)76 #pragma alloc_text(MAINWND2,CascadeChildren,TileChildren,ResizeChildren)77 #pragma alloc_text(MAINWND2,MinResChildren,MainFrameWndProc,MainWndProc)78 #pragma alloc_text(MAINWND2,DropDownListProc)79 #pragma alloc_text(MAINWND3,RestoreDirCnrState,SaveDirCnrState)80 #pragma alloc_text(MAINWND3,CloseDirCnrChildren,TransformSwp)81 #pragma alloc_text(MAINWND3,ResizeTools,BuildTools,CommandLineProc)82 #pragma alloc_text(MAINWND4,DriveProc,DriveBackProc,BuildDriveBarButtons,ResizeDrives)83 #pragma alloc_text(MAINWND4,LEDProc,IdealButtonProc)84 #pragma alloc_text(MAINWND5,MainWMOnce)85 #pragma alloc_text(MAINWND6,MainWMCommand)86 #pragma alloc_text(BUBBLE,MakeBubble,BubbleProc,BubbleHelp)87 #pragma alloc_text(MAINOBJ,MainObjectWndProc,MakeMainObjWin)88 71 89 72 static USHORT firsttool = 0; … … 160 143 bd = 3L; 161 144 *s = (CHAR) bd + '@'; 162 WinSendMsg(hwndMain, UM_SETDIR, MPFROMP(s), MPFROMLONG(1 L));145 WinSendMsg(hwndMain, UM_SETDIR, MPFROMP(s), MPFROMLONG(1)); 163 146 if (!mp1) { 164 147 s[3] = 0; 165 148 WinSendMsg(hwndMain, UM_SETDIR, MPFROMP(s), MPVOID); 166 149 } 167 PostMsg(MainObjectHwnd, UM_RESTORE, MPFROMLONG(1 L), MPFROMLONG(1L));150 PostMsg(MainObjectHwnd, UM_RESTORE, MPFROMLONG(1), MPFROMLONG(1)); 168 151 } 169 152 return 0; … … 2654 2637 */ 2655 2638 2639 #define STATE_NAME_MAX_BYTES 256 2640 2656 2641 BOOL SaveDirCnrState(HWND hwndClient, PSZ pszStateName) 2657 2642 { … … 2659 2644 HWND hwndChild, hwndDir, hwndC; 2660 2645 ULONG numsaves = 0, flWindowAttr; 2661 CHAR szPrefix[ 20];2662 CHAR s [80];2646 CHAR szPrefix[STATE_NAME_MAX_BYTES + 1]; 2647 CHAR szKey[STATE_NAME_MAX_BYTES + 80]; 2663 2648 CHAR szDir[CCHMAXPATH]; 2664 2649 SWP swp; … … 2689 2674 if (driveflags[toupper(*szDir) - 'A'] & DRIVE_NOPRESCAN) 2690 2675 continue; 2691 sprintf(s , "%sDirCnrPos.%lu", szPrefix, numsaves);2692 PrfWriteProfileData(fmprof, FM3Str, s , (PVOID) & swp,2676 sprintf(szKey, "%sDirCnrPos.%lu", szPrefix, numsaves); 2677 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & swp, 2693 2678 sizeof(SWP)); 2694 2679 dcd = 2695 2680 WinQueryWindowPtr(WinWindowFromID(hwndC, DIR_CNR), QWL_USER); 2696 2681 if (dcd) { 2697 sprintf(s , "%sDirCnrSort.%lu", szPrefix, numsaves);2698 PrfWriteProfileData(fmprof, FM3Str, s , (PVOID) & dcd->sortFlags,2682 sprintf(szKey, "%sDirCnrSort.%lu", szPrefix, numsaves); 2683 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->sortFlags, 2699 2684 sizeof(INT)); 2700 sprintf(s , "%sDirCnrFilter.%lu", szPrefix, numsaves);2701 PrfWriteProfileData(fmprof, FM3Str, s , (PVOID) & dcd->mask,2685 sprintf(szKey, "%sDirCnrFilter.%lu", szPrefix, numsaves); 2686 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & dcd->mask, 2702 2687 sizeof(MASK)); 2703 sprintf(s , "%sDirCnrView.%lu", szPrefix, numsaves);2688 sprintf(szKey, "%sDirCnrView.%lu", szPrefix, numsaves); 2704 2689 flWindowAttr = dcd->flWindowAttr; 2705 2690 if (!fLeaveTree && (flWindowAttr & CV_TREE)) { … … 2718 2703 flWindowAttr |= CV_NAME; 2719 2704 } 2720 PrfWriteProfileData(fmprof, FM3Str, s , (PVOID) & flWindowAttr,2705 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & flWindowAttr, 2721 2706 sizeof(ULONG)); 2722 2707 } 2723 sprintf(s , "%sDirCnrDir.%lu", szPrefix, numsaves++);2724 PrfWriteProfileString(fmprof, FM3Str, s , szDir);2708 sprintf(szKey, "%sDirCnrDir.%lu", szPrefix, numsaves++); 2709 PrfWriteProfileString(fmprof, FM3Str, szKey, szDir); 2725 2710 fSaved = TRUE; 2726 2711 } … … 2733 2718 if (fSaved) { 2734 2719 if (WinQueryWindowPos(hwndTree, &swp)) { 2735 sprintf(s , "%sLastTreePos", szPrefix);2736 PrfWriteProfileData(fmprof, FM3Str, s , (PVOID) & swp, sizeof(SWP));2737 } 2738 sprintf(s , "%sNumDirsLastTime", szPrefix);2739 PrfWriteProfileData(fmprof, FM3Str, s , (PVOID) & numsaves, sizeof(ULONG));2720 sprintf(szKey, "%sLastTreePos", szPrefix); 2721 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & swp, sizeof(SWP)); 2722 } 2723 sprintf(szKey, "%sNumDirsLastTime", szPrefix); 2724 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & numsaves, sizeof(ULONG)); 2740 2725 WinQueryWindowPos(WinQueryWindow(hwndClient, QW_PARENT), &swp); 2741 sprintf(s , "%sMySizeLastTime", szPrefix);2742 PrfWriteProfileData(fmprof, FM3Str, s , (PVOID) & swp, sizeof(SWP));2726 sprintf(szKey, "%sMySizeLastTime", szPrefix); 2727 PrfWriteProfileData(fmprof, FM3Str, szKey, (PVOID) & swp, sizeof(SWP)); 2743 2728 } 2744 2729 … … 2789 2774 static BOOL RestoreDirCnrState(HWND hwndClient, PSZ pszStateName, BOOL noview) 2790 2775 { 2791 CHAR s [80];2776 CHAR szKey[STATE_NAME_MAX_BYTES + 80]; 2792 2777 CHAR szDir[CCHMAXPATH]; 2793 CHAR szPrefix[ 20];2778 CHAR szPrefix[STATE_NAME_MAX_BYTES + 2]; 2794 2779 HWND hwndDir, hwndC; 2795 2780 SWP swp, swpO, swpN; … … 2810 2795 2811 2796 size = sizeof(SWP); 2812 sprintf(s , "%sMySizeLastTime", szPrefix);2797 sprintf(szKey, "%sMySizeLastTime", szPrefix); 2813 2798 if (!PrfQueryProfileData(fmprof, 2814 2799 FM3Str, 2815 s ,2800 szKey, 2816 2801 (PVOID) & swpO, 2817 2802 &size) || … … 2821 2806 } 2822 2807 if (!pszStateName || !strcmp(pszStateName, GetPString(IDS_FM2TEMPTEXT))) 2823 PrfWriteProfileData(fmprof, FM3Str, s , NULL, 0L);2808 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 2824 2809 WinQueryWindowPos(WinQueryWindow(hwndClient, QW_PARENT), &swpN); 2825 2810 if (swpN.fl & (SWP_MINIMIZE | SWP_HIDE)) … … 2828 2813 ytrans = ((double)swpO.cy * 100.0) / (double)swpN.cy; 2829 2814 size = sizeof(SWP); 2830 sprintf(s , "%sLastTreePos", szPrefix);2831 if (PrfQueryProfileData(fmprof, FM3Str, s , (PVOID) & swp, &size)) {2815 sprintf(szKey, "%sLastTreePos", szPrefix); 2816 if (PrfQueryProfileData(fmprof, FM3Str, szKey, (PVOID) & swp, &size)) { 2832 2817 if (!pszStateName || !strcmp(pszStateName, GetPString(IDS_FM2TEMPTEXT))) 2833 PrfWriteProfileData(fmprof, FM3Str, s , NULL, 0L);2818 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 2834 2819 swp.hwnd = hwndTree; 2835 2820 TransformSwp(&swp, xtrans, ytrans); … … 2859 2844 } 2860 2845 size = sizeof(ULONG); 2861 sprintf(s , "%sNumDirsLastTime", szPrefix);2846 sprintf(szKey, "%sNumDirsLastTime", szPrefix); 2862 2847 if (PrfQueryProfileData(fmprof, 2863 FM3Str, s , (PVOID) & numsaves, &size) && numsaves) {2848 FM3Str, szKey, (PVOID) & numsaves, &size) && numsaves) { 2864 2849 if (!pszStateName || !strcmp(pszStateName, GetPString(IDS_FM2TEMPTEXT))) 2865 PrfWriteProfileData(fmprof, FM3Str, s , NULL, 0L);2850 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 2866 2851 for (x = 0; x < numsaves; x++) { 2867 sprintf(s , "%sDirCnrPos.%lu", szPrefix, x);2852 sprintf(szKey, "%sDirCnrPos.%lu", szPrefix, x); 2868 2853 size = sizeof(SWP); 2869 if (PrfQueryProfileData(fmprof, FM3Str, s , (PVOID) & swp, &size)) {2854 if (PrfQueryProfileData(fmprof, FM3Str, szKey, (PVOID) & swp, &size)) { 2870 2855 if (!pszStateName || !strcmp(pszStateName, GetPString(IDS_FM2TEMPTEXT))) 2871 PrfWriteProfileData(fmprof, FM3Str, s , NULL, 0L);2872 sprintf(s , "%sDirCnrDir.%lu", szPrefix, x);2856 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 2857 sprintf(szKey, "%sDirCnrDir.%lu", szPrefix, x); 2873 2858 size = sizeof(szDir); 2874 if (PrfQueryProfileData(fmprof, FM3Str, s , (PVOID) szDir, &size)) {2859 if (PrfQueryProfileData(fmprof, FM3Str, szKey, (PVOID) szDir, &size)) { 2875 2860 if (!pszStateName || !strcmp(pszStateName, GetPString(IDS_FM2TEMPTEXT))) 2876 PrfWriteProfileData(fmprof, FM3Str, s , NULL, 0L);2861 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 2877 2862 if (driveflags[toupper(*szDir) - 'A'] & DRIVE_NOPRESCAN) { 2878 PrfWriteProfileData(fmprof, FM3Str, s , NULL, 0L);2863 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 2879 2864 continue; 2880 2865 } 2881 2866 hwndDir = (HWND) WinSendMsg(hwndClient, 2882 2867 UM_SETDIR, 2883 MPFROMP(szDir), MPFROMLONG(1 L));2868 MPFROMP(szDir), MPFROMLONG(1)); 2884 2869 if (hwndDir) { 2885 2870 hwndC = WinWindowFromID(hwndDir, FID_CLIENT); … … 2889 2874 if (dcd) { 2890 2875 size = sizeof(INT); 2891 sprintf(s , "%sDirCnrSort.%lu", szPrefix, x);2876 sprintf(szKey, "%sDirCnrSort.%lu", szPrefix, x); 2892 2877 if (PrfQueryProfileData(fmprof, 2893 2878 FM3Str, 2894 s ,2879 szKey, 2895 2880 (PVOID) & dcd->sortFlags, 2896 2881 &size) && size == sizeof(INT)) { … … 2899 2884 } 2900 2885 if (!pszStateName || !strcmp(pszStateName, GetPString(IDS_FM2TEMPTEXT))) 2901 PrfWriteProfileData(fmprof, FM3Str, s , NULL, 0L);2886 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 2902 2887 size = sizeof(MASK); 2903 sprintf(s , "%sDirCnrFilter.%lu", szPrefix, x);2888 sprintf(szKey, "%sDirCnrFilter.%lu", szPrefix, x); 2904 2889 if (PrfQueryProfileData(fmprof, 2905 2890 FM3Str, 2906 s ,2891 szKey, 2907 2892 (PVOID) & dcd->mask, &size) && size) { 2908 2893 if (*dcd->mask.szMask) … … 2912 2897 *(dcd->mask.prompt) = 0; 2913 2898 if (!pszStateName || !strcmp(pszStateName, GetPString(IDS_FM2TEMPTEXT))) 2914 PrfWriteProfileData(fmprof, FM3Str, s , NULL, 0L);2899 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 2915 2900 size = sizeof(ULONG); 2916 sprintf(s , "%sDirCnrView.%lu", szPrefix, x);2901 sprintf(szKey, "%sDirCnrView.%lu", szPrefix, x); 2917 2902 if (!noview) { 2918 2903 if (PrfQueryProfileData(fmprof, 2919 2904 FM3Str, 2920 s ,2905 szKey, 2921 2906 (PVOID) & dcd->flWindowAttr, 2922 2907 &size) && size == sizeof(ULONG)) { … … 2939 2924 } 2940 2925 if (!pszStateName || !strcmp(pszStateName, GetPString(IDS_FM2TEMPTEXT))) 2941 PrfWriteProfileData(fmprof, FM3Str, s , NULL, 0L);2926 PrfWriteProfileData(fmprof, FM3Str, szKey, NULL, 0L); 2942 2927 } 2943 2928 } … … 3013 2998 ulCnt = *ulCntR; 3014 2999 ulNumMinChildren = *ulNumMinChildrenR; 3015 if (ulCnt == (ULONG) - 1 L) {3000 if (ulCnt == (ULONG) - 1) { 3016 3001 ulCnt = CountChildren(hwndClient, &ulNumMinChildren); 3017 3002 /* return these values to the caller for later use */ … … 3121 3106 } 3122 3107 if (!fTileBackwards) { 3123 ulNumCols = ulSquare - 1 L;3108 ulNumCols = ulSquare - 1; 3124 3109 ulNumRows = ulChildCnt / ulNumCols; 3125 3110 } 3126 3111 else { 3127 ulNumRows = ulSquare - 1 L;3112 ulNumRows = ulSquare - 1; 3128 3113 ulNumCols = ulChildCnt / ulNumRows; 3129 3114 } … … 3205 3190 QWS_YRESTORE, 3206 3191 (USHORT) (Rectl.yTop - 3207 (ulHeight * (ulCurRow + 1 L))));3192 (ulHeight * (ulCurRow + 1)))); 3208 3193 WinSetWindowUShort(hwndChild, QWS_CXRESTORE, (USHORT) ulWidth); 3209 3194 WinSetWindowUShort(hwndChild, QWS_CYRESTORE, (USHORT) ulHeight); … … 3213 3198 HWND_TOP, 3214 3199 (ulWidth * ulCurCol) + Rectl.xLeft, 3215 Rectl.yTop - (ulHeight * (ulCurRow + 1 L)),3200 Rectl.yTop - (ulHeight * (ulCurRow + 1)), 3216 3201 ulWidth, 3217 3202 ulHeight, … … 4180 4165 case IDM_DELETEDIRCNRSTATE: 4181 4166 { 4182 CHAR szStateName[ 14];4167 CHAR szStateName[STATE_NAME_MAX_BYTES + 1]; 4183 4168 4184 4169 *szStateName = 0; 4185 WinQueryWindowText(hwndStatelist, 13, szStateName);4170 WinQueryWindowText(hwndStatelist, STATE_NAME_MAX_BYTES, szStateName); 4186 4171 bstrip(szStateName); 4187 4172 // Ignore request if blank or attempting to using illegal name … … 4190 4175 // Save 4191 4176 if (SaveDirCnrState(hwnd, szStateName)) { 4192 if (add_setup(szStateName)) { 4177 INT ret = add_setup(szStateName); 4178 if (ret == 0) { 4193 4179 WinSendMsg(hwndStatelist, LM_INSERTITEM, 4194 4180 MPFROM2SHORT(LIT_SORTASCENDING, 0), MPFROMP(szStateName)); 4195 4181 save_setups(); 4196 4182 } 4197 else {4183 else if (ret != 1) { 4198 4184 saymsg(MB_ENTER | MB_ICONASTERISK, hwnd, 4199 4185 GetPString(IDS_WARNINGTEXT), 4200 GetPString(IDS_EXISTSASATEXT), szStateName, "state name");4186 "\"%s\" state name add failed", szStateName); // 15 Apr 07 SHL failed 4201 4187 WinSetWindowText(hwndStatelist, GetPString(IDS_STATETEXT)); 4202 4188 } … … 4212 4198 // Delete 4213 4199 ULONG numsaves = 0, size, x; 4214 CHAR s[80]; 4215 4216 if (remove_setup(szStateName)) 4200 CHAR s[STATE_NAME_MAX_BYTES + 80]; 4201 4202 INT ret = remove_setup(szStateName); 4203 if (ret == 1) 4217 4204 save_setups(); 4218 4205 sprintf(s, "%s.NumDirsLastTime", szStateName); 4219 4206 size = sizeof(ULONG); 4220 if (!PrfQueryProfileData 4221 (fmprof, FM3Str, s, (PVOID) & numsaves, &size)) { 4207 if (!PrfQueryProfileData(fmprof, 4208 FM3Str, 4209 s, 4210 (PVOID)&numsaves, 4211 &size)) { 4222 4212 saymsg(MB_ENTER | MB_ICONASTERISK, hwnd, 4223 4213 GetPString(IDS_WARNINGTEXT), … … 4565 4555 MPFROMP(pci->pszFileName), 4566 4556 (SHORT1FROMMP(mp1) == IDM_AUTOVIEW) ? 4567 MPVOID : MPFROMLONG(1 L));4557 MPVOID : MPFROMLONG(1)); 4568 4558 } 4569 4559 } … … 5063 5053 EM_SETTEXTLIMIT, MPFROM2SHORT(CCHMAXPATH, 0), MPVOID); 5064 5054 WinSendMsg(WinWindowFromID(hwndStatelist, CBID_EDIT), 5065 EM_SETTEXTLIMIT, MPFROM2SHORT( 13, 0), MPVOID);5055 EM_SETTEXTLIMIT, MPFROM2SHORT(STATE_NAME_MAX_BYTES, 0), MPVOID); 5066 5056 WinSendMsg(WinWindowFromID(hwndDrivelist, CBID_EDIT), 5067 5057 EM_SETREADONLY, MPFROM2SHORT(TRUE, 0), MPVOID); … … 5454 5444 5455 5445 case UM_FILLSETUPLIST: 5456 WinSendMsg(hwndStatelist, LM_DELETEALL, MPVOID, MPVOID); 5457 if (fUserComboBox) { 5458 INT x; 5459 5460 if (!loadedsetups) 5461 load_setups(); 5462 for (x = 0; x < MAXNUMSETUPS; x++) { 5463 if (*lastsetups[x]) 5464 WinSendMsg(hwndStatelist, LM_INSERTITEM, 5465 MPFROM2SHORT(LIT_SORTASCENDING, 0), 5466 MPFROMP(lastsetups[x])); 5467 } 5468 WinSetWindowText(hwndStatelist, GetPString(IDS_STATETEXT)); 5469 } 5446 fill_setups_list(); 5470 5447 return 0; 5471 5448 … … 5483 5460 DosError(FERR_DISABLEHARDERR); 5484 5461 hDir = HDIR_CREATE; 5485 ulSearchCount = 1 L;5462 ulSearchCount = 1; 5486 5463 if (!DosFindFirst("*.TLS", &hDir, FILE_READONLY | FILE_ARCHIVED, 5487 5464 &findbuf, sizeof(FILEFINDBUF3), … … 5543 5520 DosError(FERR_DISABLEHARDERR); 5544 5521 hDir = HDIR_CREATE; 5545 ulSearchCount = 1 L;5522 ulSearchCount = 1; 5546 5523 if (!IsRoot(info->path)) 5547 5524 rc = DosFindFirst(info->path, &hDir, FILE_DIRECTORY | … … 5585 5562 DosError(FERR_DISABLEHARDERR); 5586 5563 hDir = HDIR_CREATE; 5587 ulSearchCount = 1 L;5564 ulSearchCount = 1; 5588 5565 if (!IsRoot(info->path)) 5589 5566 rc = DosFindFirst(info->path, &hDir, FILE_DIRECTORY | … … 5670 5647 SHORT1FROMMP(mp1)); 5671 5648 CHAR path[CCHMAXPATH]; 5649 ULONG ul; 5650 5651 switch (SHORT1FROMMP(mp1)) { 5652 case MAIN_USERLIST: 5653 ul = CCHMAXPATH; 5654 break; 5655 case MAIN_SETUPLIST: 5656 ul = STATE_NAME_MAX_BYTES; 5657 break; 5658 default: 5659 ul = 13; // fixme to not be hardcoded 5660 } 5672 5661 5673 5662 SetShiftState(); 5674 WinQueryWindowText(WinWindowFromID(hwndUL, CBID_EDIT), 5675 ((SHORT1FROMMP(mp1) == MAIN_USERLIST) ? 5676 CCHMAXPATH : 13), path); 5663 WinQueryWindowText(WinWindowFromID(hwndUL, CBID_EDIT), ul, path); 5677 5664 bstrip(path); 5678 5665 if (*path) { … … 5720 5707 else if (SHORT1FROMMP(mp1) == MAIN_SETUPLIST) { 5721 5708 5722 CHAR s [80];5709 CHAR szKey[80]; 5723 5710 ULONG size, numsaves = 0; 5724 5711 5725 5712 SetShiftState(); 5726 5713 size = sizeof(ULONG); 5727 sprintf(s, "%s.NumDirsLastTime", path); // path is state name 5728 if (!PrfQueryProfileData 5729 (fmprof, FM3Str, s, (PVOID) & numsaves, &size)) 5714 sprintf(szKey, "%s.NumDirsLastTime", path); // path is state name 5715 if (!PrfQueryProfileData(fmprof, 5716 FM3Str, 5717 szKey, 5718 (PVOID)&numsaves, 5719 &size)) 5730 5720 { 5731 5721 if ((WinGetLastError(WinQueryAnchorBlock(hwnd)) & 0xffff) == PMERR_NOT_IN_IDX) { … … 5751 5741 if ((shiftstate & KC_SHIFT) != 0 || fAutoTile) 5752 5742 PostMsg(MainObjectHwnd, UM_RESTORE, MPVOID, 5753 MPFROMLONG(1 L));5743 MPFROMLONG(1)); 5754 5744 } 5755 5745 else { … … 5854 5844 return WinDefWindowProc(hwnd, msg, mp1, mp2); 5855 5845 } 5846 5847 #pragma alloc_text(MISC8,SetToggleChecks,FindDirCnrByName,TopWindow) 5848 #pragma alloc_text(MISC8,TopWindowName,CountDirCnrs) 5849 #pragma alloc_text(MAINWND,AdjustSizeOfClient,FillClient,ChildButtonProc) 5850 #pragma alloc_text(MAINWND,ToolBackProc,StatusProc) 5851 #pragma alloc_text(MAINWND,MoveChildrenAwayFromTree,ArrangeIcons,NextChild) 5852 #pragma alloc_text(MAINWND,ChildFrameButtonProc) 5853 #pragma alloc_text(MAINWND2,CloseChildren,CountChildren,GetNextWindowPos) 5854 #pragma alloc_text(MAINWND2,CascadeChildren,TileChildren,ResizeChildren) 5855 #pragma alloc_text(MAINWND2,MinResChildren,MainFrameWndProc,MainWndProc) 5856 #pragma alloc_text(MAINWND2,DropDownListProc) 5857 #pragma alloc_text(MAINWND3,RestoreDirCnrState,SaveDirCnrState) 5858 #pragma alloc_text(MAINWND3,CloseDirCnrChildren,TransformSwp) 5859 #pragma alloc_text(MAINWND3,ResizeTools,BuildTools,CommandLineProc) 5860 #pragma alloc_text(MAINWND4,DriveProc,DriveBackProc,BuildDriveBarButtons,ResizeDrives) 5861 #pragma alloc_text(MAINWND4,LEDProc,IdealButtonProc) 5862 #pragma alloc_text(MAINWND5,MainWMOnce) 5863 #pragma alloc_text(MAINWND6,MainWMCommand) 5864 #pragma alloc_text(BUBBLE,MakeBubble,BubbleProc,BubbleHelp) 5865 #pragma alloc_text(MAINOBJ,MainObjectWndProc,MakeMainObjWin) 5866  - 
      
trunk/dll/misc.c
r775 r787 31 31 06 Aug 07 GKY Increase Subject EA to 1024 32 32 06 Aug 07 GKY Reduce DosSleep times (ticket 148) 33 33 14 Aug 07 SHL Delete obsoletes 34 14 Aug 07 SHL Move #pragma alloc_text to end for OpenWatcom compat 34 35 35 36 ***********************************************************************/ … … 56 57 static PSZ pszSrcFile = __FILE__; 57 58 58 #pragma alloc_text(MAINWND5,SetSysMenu)59 #pragma alloc_text(MISC1,BoxWindow,PaintRecessedWindow,PostMsg,PaintSTextWindow,IsFm2Window)60 #pragma alloc_text(MISC1,FixSwitchList,FindDirCnr,CurrentRecord,SetShiftState,AddToListboxBottom)61 #pragma alloc_text(CNR_MISC1,AdjustCnrColVis,AdjustCnrColsForFSType)62 #pragma alloc_text(CNR_MISC1,AdjustCnrColsForPref,SetCnrCols)63 #pragma alloc_text(CNR_MISC2,CnrDirectEdit,OpenEdit)64 #pragma alloc_text(MISC2,SetMenuCheck,disable_menuitem,SetSortChecks)65 #pragma alloc_text(MISC2,SetDetailsSwitches,SetViewMenu)66 #pragma alloc_text(MISC3,SetupCommandMenu,AdjustDetailsSwitches)67 #pragma alloc_text(MISC3,ViewHelp,GetCmdSpec)68 #pragma alloc_text(MISC3,ExecFile,SetConditionalCascade,LoadDetailsSwitches)69 #pragma alloc_text(MISC3,FreeMallocedMem,FcloseFile)70 #pragma alloc_text(MISC4,PortholeInit,CheckMenu,Broadcast,SetupWinList,SwitchCommand)71 #pragma alloc_text(MISC6,DrawTargetEmphasis,EmphasizeButton)72 #pragma alloc_text(MISC_LIBPATH,LoadLibPath)73 #pragma alloc_text(MISC_SAY,SayView,SaySort,SayFilter)74 75 59 #ifndef BEGIN_LIBPATH 76 60 #define BEGIN_LIBPATH 1 … … 135 119 ptl.y = 1; 136 120 GpiMove(hps, &ptl); 137 GpiSetColor(hps, ((on) ? CLR_BLACK : CLR_PALEGRAY));121 GpiSetColor(hps, on ? CLR_BLACK : CLR_PALEGRAY); 138 122 ptl.x = swp.cx - 2; 139 123 ptl.y = swp.cy - 2; … … 150 134 151 135 if (hps) { 152 BoxWindow(hwnd, hps, ((on) ? CLR_BLACK : CLR_PALEGRAY));136 BoxWindow(hwnd, hps, on ? CLR_BLACK : CLR_PALEGRAY); 153 137 DrgReleasePS(hps); 154 138 } … … 214 198 do { 215 199 GpiQueryTextBox(hps, strlen(p), p, TXTBOX_COUNT, aptl); 216 if (aptl[TXTBOX_TOPRIGHT].x > (rcl.xRight - ( (p != s)? len : 0)))200 if (aptl[TXTBOX_TOPRIGHT].x > (rcl.xRight - (p != s ? len : 0))) 217 201 p++; 218 202 else … … 410 394 hasLongNames = FALSE; 411 395 } 412 pBool = (dcd) ? &dcd->detailsladate : &detailsladate; 413 AdjustCnrColVis(hwndCnr, GetPString(IDS_LADATE), 414 (*pBool) ? hasAccessDT : FALSE, FALSE); 415 pBool = (dcd) ? &dcd->detailslatime : &detailslatime; 416 AdjustCnrColVis(hwndCnr, GetPString(IDS_LATIME), 417 (*pBool) ? hasAccessDT : FALSE, FALSE); 418 pBool = (dcd) ? &dcd->detailscrdate : &detailscrdate; 419 AdjustCnrColVis(hwndCnr, GetPString(IDS_CRDATE), 420 (*pBool) ? hasCreateDT : FALSE, FALSE); 421 pBool = (dcd) ? &dcd->detailscrtime : &detailscrtime; 422 AdjustCnrColVis(hwndCnr, GetPString(IDS_CRTIME), 423 (*pBool) ? hasCreateDT : FALSE, FALSE); 424 pBool = (dcd) ? &dcd->detailslongname : &detailslongname; 425 AdjustCnrColVis(hwndCnr, GetPString(IDS_LNAME), 426 (*pBool) ? hasLongNames : FALSE, FALSE); 396 pBool = dcd ? &dcd->detailsladate : &detailsladate; 397 AdjustCnrColVis(hwndCnr, 398 GetPString(IDS_LADATE), 399 *pBool ? hasAccessDT : FALSE, 400 FALSE); 401 pBool = dcd ? &dcd->detailslatime : &detailslatime; 402 AdjustCnrColVis(hwndCnr, 403 GetPString(IDS_LATIME), 404 *pBool ? hasAccessDT : FALSE, 405 FALSE); 406 pBool = dcd ? &dcd->detailscrdate : &detailscrdate; 407 AdjustCnrColVis(hwndCnr, 408 GetPString(IDS_CRDATE), 409 *pBool ? hasCreateDT : FALSE, 410 FALSE); 411 pBool = dcd ? &dcd->detailscrtime : &detailscrtime; 412 AdjustCnrColVis(hwndCnr, 413 GetPString(IDS_CRTIME), 414 *pBool ? hasCreateDT : FALSE, 415 FALSE); 416 pBool = dcd ? &dcd->detailslongname : &detailslongname; 417 AdjustCnrColVis(hwndCnr, 418 GetPString(IDS_LNAME), 419 *pBool ? hasLongNames : FALSE, 420 FALSE); 427 421 WinSendMsg(hwndCnr, CM_INVALIDATEDETAILFIELDINFO, MPVOID, MPVOID); 428 422 } … … 532 526 pfi->flData |= CFA_FIREADONLY; 533 527 pfi->flTitle = CFA_CENTER | CFA_FITITLEREADONLY; 534 pfi->pTitleData = (isCompCnr)? GetPString(IDS_STATUS) :535 GetPString(IDS_SUBJ);528 pfi->pTitleData = isCompCnr ? GetPString(IDS_STATUS) : 529 GetPString(IDS_SUBJ); 536 530 pfi->offStruct = FIELDOFFSET(CNRITEM, pszSubject); 537 531 … … 701 695 szSubject[retlen + 1] = 0; 702 696 //chop_at_crnl(szSubject); 703 bstrip(szSubject);704 pci->pszSubject = xrealloc(pci->pszSubject, retlen + 1, pszSrcFile, __LINE__);697 bstrip(szSubject); 698 pci->pszSubject = xrealloc(pci->pszSubject, retlen + 1, pszSrcFile, __LINE__); 705 699 WinSetWindowText(hwndMLE, szSubject); 706 700 len = strlen(szSubject); … … 752 746 retlen = WinQueryWindowText(hwndMLE, sizeof(longname), longname); 753 747 longname[retlen + 1] = 0; 754 //chop_at_crnl(longname);755 pci->pszLongName = xrealloc(pci->pszLongName, retlen + 1, pszSrcFile, __LINE__);748 //chop_at_crnl(longname); 749 pci->pszLongName = xrealloc(pci->pszLongName, retlen + 1, pszSrcFile, __LINE__); 756 750 WinSetWindowText(hwndMLE, longname); 757 751 pci->pszFileName = xrealloc(pci->pszFileName, retlen + 1, pszSrcFile, __LINE__); 758 752 return (MRESULT) WriteLongName(pci->pszFileName, longname); 759 753 } 760 else {761 WinQueryWindowText(hwndMLE, sizeof(szData), szData);754 else { 755 WinQueryWindowText(hwndMLE, sizeof(szData), szData); 762 756 if (strchr(szData, '?') || 763 757 strchr(szData, '*') || IsRoot(pci->pszFileName)) … … 774 768 return FALSE; 775 769 if (DosQueryPathInfo(pci->pszFileName, 776 FIL_QUERYFULLNAME, szData, sizeof(szData))){777 pci->pszFileName = xrealloc(pci->pszFileName, sizeof(szData), pszSrcFile, __LINE__);778 strcpy(szData, pci->pszFileName);779 }770 FIL_QUERYFULLNAME, szData, sizeof(szData))){ 771 pci->pszFileName = xrealloc(pci->pszFileName, sizeof(szData), pszSrcFile, __LINE__); 772 strcpy(szData, pci->pszFileName); 773 } 780 774 WinSetWindowText(hwndMLE, szData); 781 775 if (strcmp(szData, testname)) { … … 859 853 { 860 854 if (toggle) { 861 *bool = (*bool)? FALSE : TRUE;855 *bool = *bool ? FALSE : TRUE; 862 856 if (savename && *savename) 863 857 PrfWriteProfileData(fmprof, appname, savename, bool, sizeof(BOOL)); … … 943 937 lastflags = ex.flags; 944 938 return runemf2(ex.flags, hwnd, path, 945 (*ex.environment) ? ex.environment : NULL, "%s", cl) != -1; 939 *ex.environment ? ex.environment : NULL, 940 "%s", cl) != -1; 946 941 } 947 942 else if (ret != 0) … … 1045 1040 } 1046 1041 if (bool) 1047 *bool = (*bool)? FALSE : TRUE;1042 *bool = *bool ? FALSE : TRUE; 1048 1043 if (*s && bool) 1049 1044 PrfWriteProfileData(fmprof, appname, s, bool, sizeof(BOOL)); … … 1118 1113 } 1119 1114 1120 VOID FreeMallocedMem(VOID * mem)1121 {1122 /* for use by apps that don't use the DLLs runtime library */1123 free(mem);1124 }1125 1126 1115 VOID FcloseFile(FILE * fp) 1127 1116 { … … 1167 1156 "%s%s%s", 1168 1157 info->title, 1169 (x < 20)? "\tCtrl + " : NullStr,1170 (x < 20 && x > 9)? "Shift + " : NullStr);1158 x < 20 ? "\tCtrl + " : NullStr, 1159 x < 20 && x > 9 ? "Shift + " : NullStr); 1171 1160 if (x < 20) 1172 1161 sprintf(&s[strlen(s)], "%d", 1173 (( (x % 10) + 1) == 10)? 0 : (x % 10) + 1);1162 ((x % 10) + 1) == 10 ? 0 : (x % 10) + 1); 1174 1163 mi.id = IDM_COMMANDSTART + x; 1175 mi.afAttribute = (((info->flags & ONCE) != 0) ? 1176 MIA_CHECKED : 0) | 1177 (((info->flags & PROMPT) != 0) ? MIA_FRAMED : 0); 1164 mi.afAttribute = (info->flags & ONCE ? MIA_CHECKED : 0) | 1165 (info->flags & PROMPT ? MIA_FRAMED : 0); 1178 1166 mi.afStyle = MIS_TEXT; 1179 1167 if (!(x % 24) && x && info->next) … … 1378 1366 PMINIRECORDCORE CurrentRecord(HWND hwndCnr) 1379 1367 { 1380 SHORT attrib = (fSelectedAlways)? CRA_SELECTED : CRA_CURSORED;1368 SHORT attrib = fSelectedAlways ? CRA_SELECTED : CRA_CURSORED; 1381 1369 PMINIRECORDCORE pmi; 1382 1370 … … 1390 1378 break; 1391 1379 } 1392 return ((INT) pmi == -1) ? NULL : pmi;1380 return ((INT)pmi == -1) ? NULL : pmi; 1393 1381 } 1394 1382 … … 1482 1470 list[0] = filename; 1483 1471 list[1] = NULL; 1484 ExecOnList(hwnd, viewer, WINDOWED | SEPARATE | 1485 ((fViewChild) ? CHILD : 0), NULL, list, NULL); 1472 ExecOnList(hwnd, viewer, 1473 WINDOWED | SEPARATE | (fViewChild ? CHILD : 0), 1474 NULL, list, NULL); 1486 1475 return; 1487 1476 } … … 1608 1597 SetConditionalCascade(DirMenu, IDM_EDITSUBMENU, IDM_ATTRS); 1609 1598 SetConditionalCascade(DirMenu, IDM_DELETESUBMENU, 1610 (fDefaultDeletePerm) ? IDM_PERMDELETE : 1611 IDM_DELETE); 1599 fDefaultDeletePerm ? IDM_PERMDELETE : IDM_DELETE); 1612 1600 SetConditionalCascade(DirMenu, IDM_MISCSUBMENU, IDM_SIZES); 1613 1601 SetConditionalCascade(DirMenu, IDM_OPENSUBMENU, IDM_OPENWINDOW); … … 1653 1641 SetConditionalCascade(FileMenu, IDM_COLLECTMENU, IDM_COLLECT); 1654 1642 SetConditionalCascade(FileMenu, IDM_DELETESUBMENU, 1655 (fDefaultDeletePerm) ? IDM_PERMDELETE : 1656 IDM_DELETE); 1643 fDefaultDeletePerm ? IDM_PERMDELETE : IDM_DELETE); 1657 1644 SetConditionalCascade(FileMenu, IDM_OPENSUBMENU, IDM_OPENDEFAULT); 1658 1645 SetConditionalCascade(FileMenu, IDM_OBJECTSUBMENU, IDM_SHADOW); … … 1699 1686 SetConditionalCascade(CollectorFileMenu, IDM_EDITSUBMENU, IDM_EDIT); 1700 1687 SetConditionalCascade(CollectorFileMenu, IDM_DELETESUBMENU, 1701 (fDefaultDeletePerm) ? IDM_PERMDELETE : 1702 IDM_DELETE); 1688 fDefaultDeletePerm ? IDM_PERMDELETE : IDM_DELETE); 1703 1689 SetConditionalCascade(CollectorFileMenu, IDM_OPENSUBMENU, 1704 1690 IDM_OPENDEFAULT); … … 1722 1708 SetConditionalCascade(CollectorDirMenu, IDM_EDITSUBMENU, IDM_ATTRS); 1723 1709 SetConditionalCascade(CollectorDirMenu, IDM_DELETESUBMENU, 1724 (fDefaultDeletePerm) ? IDM_PERMDELETE : 1725 IDM_DELETE); 1710 fDefaultDeletePerm ? IDM_PERMDELETE : IDM_DELETE); 1726 1711 SetConditionalCascade(CollectorDirMenu, IDM_MISCSUBMENU, IDM_SIZES); 1727 1712 SetConditionalCascade(CollectorDirMenu, IDM_OPENSUBMENU, … … 1895 1880 if (s) { 1896 1881 sprintf(s, "S:%s%s", 1897 (sortflags & SORT_REVERSE) ? "^" : NullStr, 1898 (sortflags & SORT_FIRSTEXTENSION) ? GetPString(IDS_FIRSTX) : 1899 (sortflags & SORT_LASTEXTENSION) ? GetPString(IDS_LASTX) : 1900 (sortflags & SORT_SIZE) ? "Size" : 1901 (sortflags & SORT_EASIZE) ? (archive == 1902 0) ? GetPString(IDS_EASIZE) : 1903 GetPString(IDS_CSIZE) : (sortflags & SORT_LWDATE) ? (archive 1904 == 1905 0) ? 1906 GetPString(IDS_LWDATE) : GetPString(IDS_DATE) : (sortflags & 1907 SORT_LADATE) 1908 ? GetPString(IDS_LADATE) : (sortflags & SORT_CRDATE) ? 1909 GetPString(IDS_CRDATE) : (sortflags & SORT_PATHNAME) ? 1910 GetPString(IDS_PATH) : (sortflags & SORT_NOSORT) ? 1911 GetPString(IDS_NONE) : (sortflags & SORT_SUBJECT) ? 1912 GetPString(IDS_SUBJ) : GetPString(IDS_NAME)); 1882 sortflags & SORT_REVERSE ? "^" : NullStr, 1883 (sortflags & SORT_FIRSTEXTENSION) ? 1884 GetPString(IDS_FIRSTX) : (sortflags & SORT_LASTEXTENSION) ? 1885 GetPString(IDS_LASTX) : (sortflags & SORT_SIZE) ? 1886 "Size" : (sortflags & SORT_EASIZE) ? 1887 (archive == 0) ? 1888 GetPString(IDS_EASIZE) : GetPString(IDS_CSIZE) : 1889 (sortflags & SORT_LWDATE) ? 1890 (archive == 0) ? 1891 GetPString(IDS_LWDATE) : GetPString(IDS_DATE) : 1892 (sortflags & SORT_LADATE) ? 1893 GetPString(IDS_LADATE) : (sortflags & SORT_CRDATE) ? 1894 GetPString(IDS_CRDATE) : 1895 (sortflags & SORT_PATHNAME) ? 1896 GetPString(IDS_PATH) : (sortflags & SORT_NOSORT) ? 1897 GetPString(IDS_NONE) : (sortflags & SORT_SUBJECT) ? 1898 GetPString(IDS_SUBJ) : GetPString(IDS_NAME)); 1913 1899 WinSetWindowText(hwnd, s); 1914 1900 free(s); … … 2049 2035 register INT i; 2050 2036 2051 hwndTopFrame = (hwndTop) ? WinQueryWindow(hwndTop, QW_PARENT) : (HWND)0;2037 hwndTopFrame = hwndTop ? WinQueryWindow(hwndTop, QW_PARENT) : (HWND)0; 2052 2038 /* Get the switch list information */ 2053 2039 x = 0; … … 2169 2155 return ret; 2170 2156 } 2157 2158 #pragma alloc_text(MAINWND5,SetSysMenu) 2159 #pragma alloc_text(MISC1,BoxWindow,PaintRecessedWindow,PostMsg,PaintSTextWindow,IsFm2Window) 2160 #pragma alloc_text(MISC1,FixSwitchList,FindDirCnr,CurrentRecord,SetShiftState,AddToListboxBottom) 2161 #pragma alloc_text(CNR_MISC1,AdjustCnrColVis,AdjustCnrColsForFSType) 2162 #pragma alloc_text(CNR_MISC1,AdjustCnrColsForPref,SetCnrCols) 2163 #pragma alloc_text(CNR_MISC2,CnrDirectEdit,OpenEdit) 2164 #pragma alloc_text(MISC2,SetMenuCheck,disable_menuitem,SetSortChecks) 2165 #pragma alloc_text(MISC2,SetDetailsSwitches,SetViewMenu) 2166 #pragma alloc_text(MISC3,SetupCommandMenu,AdjustDetailsSwitches) 2167 #pragma alloc_text(MISC3,ViewHelp,GetCmdSpec) 2168 #pragma alloc_text(MISC3,ExecFile,SetConditionalCascade,LoadDetailsSwitches) 2169 #pragma alloc_text(MISC4,PortholeInit,CheckMenu,Broadcast,SetupWinList,SwitchCommand) 2170 #pragma alloc_text(MISC6,DrawTargetEmphasis,EmphasizeButton) 2171 #pragma alloc_text(MISC_LIBPATH,LoadLibPath) 2172 #pragma alloc_text(MISC_SAY,SayView,SaySort,SayFilter) 2173  - 
      
trunk/dll/objcnr.c
r783 r787 20 20 13 Aug 07 SHL Avoid realloc - not needed; sanitize code 21 21 13 Aug 07 SHL Move #pragma alloc_text to end for OpenWatcom compat 22 14 Aug 07 SHL Revert ProcessDir DosSleep to 0 22 23 23 24 ***********************************************************************/ … … 185 186 pffbFile = (PFILEFINDBUF3)((PBYTE)pffbFile + pffbFile->oNextEntryOffset); 186 187 } // for 187 DosSleep( 1);188 DosSleep(0); // Let's others at same priority get some work done 188 189 if (*stopflag) 189 190 break;  - 
      
trunk/dll/seeall.c
r783 r787 7 7 8 8 Copyright (c) 1993-98 M. Kimes 9 Copyright (c) 2001, 200 6Steven H. Levine9 Copyright (c) 2001, 2007 Steven H. Levine 10 10 11 11 16 Oct 02 SHL Handle large partitions … … 27 27 13 Aug 07 SHL Sync code with other FilesToGet usage 28 28 13 Aug 07 SHL Move #pragma alloc_text to end for OpenWatcom compat 29 14 Aug 07 SHL Revert to DosSleep(0) to speed up inner loops 30 14 Aug 07 SHL Drop afFilesToGet 29 31 30 32 ***********************************************************************/ … … 108 110 ULONG affiles; 109 111 ULONG afalloc; 110 ULONG afFilesToGet;111 112 ULONG longest; 112 113 ULONG longestw; … … 433 434 FM3ModHandle, 434 435 ASEL_FRAME, (PVOID) & ad.info) || !ad.info) { 435 / * we blew it */436 // we blew it 436 437 FreeList(list); 437 438 break; … … 441 442 !ad.info->createwdirs && 442 443 !ad.info->movewdirs && !ad.info->createrecurse) { 444 // 14 Aug 07 SHL fixme to tell user why we failed 443 445 FreeList(list); 444 446 break; … … 448 450 break; 449 451 } 450 / * build the sucker */452 // Build archiver command line 451 453 strcpy(szBuffer, ad.command); 452 454 strcat(szBuffer, " "); … … 489 491 HWND_DESKTOP, NULL, NULL, 490 492 "%s", szBuffer); 491 DosSleep(1); 493 DosSleep(1); // Let archiver get started 492 494 *p = 0; 493 495 } 494 496 strcat(szBuffer, " "); 495 } 497 } // while 496 498 AddToList(ad.arcname, &files, &numfiles, &numalloc); 497 499 } … … 1062 1064 sprintf(message, 1063 1065 GetPString(IDS_OPSCOMPLETETEXT), 1064 (SHORT1FROMMP(mp1) == IDM_MOVE)?1065 GetPString(IDS_MOVETEXT) :1066 (SHORT1FROMMP(mp1) == IDM_COPY)?1067 GetPString(IDS_COPYTEXT) :1068 (SHORT1FROMMP(mp1) == IDM_WPSMOVE)?1069 GetPString(IDS_WPSMOVETEXT) :1070 (SHORT1FROMMP(mp1) == IDM_WPSCOPY)?1071 GetPString(IDS_WPSCOPYTEXT) :1072 GetPString(IDS_RENAMETEXT),1066 SHORT1FROMMP(mp1) == IDM_MOVE ? 1067 GetPString(IDS_MOVETEXT) : 1068 SHORT1FROMMP(mp1) == IDM_COPY ? 1069 GetPString(IDS_COPYTEXT) : 1070 SHORT1FROMMP(mp1) == IDM_WPSMOVE ? 1071 GetPString(IDS_WPSMOVETEXT) : 1072 SHORT1FROMMP(mp1) == IDM_WPSCOPY ? 1073 GetPString(IDS_WPSCOPYTEXT) : 1074 GetPString(IDS_RENAMETEXT), 1073 1075 &"s"[x == 1], 1074 (SHORT1FROMMP(mp1) == IDM_MOVE || 1075 SHORT1FROMMP(mp1) == IDM_COPY || 1076 SHORT1FROMMP(mp1) == IDM_WPSMOVE || 1077 SHORT1FROMMP(mp1) == IDM_WPSCOPY) ? 1078 GetPString(IDS_TOTEXT) : 1079 NullStr, 1080 (SHORT1FROMMP(mp1) == IDM_MOVE || 1081 SHORT1FROMMP(mp1) == IDM_COPY || 1082 SHORT1FROMMP(mp1) == IDM_WPSMOVE || 1083 SHORT1FROMMP(mp1) == IDM_WPSCOPY) ? 1084 path : 1085 NullStr, 1086 (x != 1) ? GetPString(IDS_ARETEXT) : GetPString(IDS_ISTEXT)); 1076 SHORT1FROMMP(mp1) == IDM_MOVE || 1077 SHORT1FROMMP(mp1) == IDM_COPY || 1078 SHORT1FROMMP(mp1) == IDM_WPSMOVE || 1079 SHORT1FROMMP(mp1) == IDM_WPSCOPY ? 1080 GetPString(IDS_TOTEXT) : NullStr, 1081 SHORT1FROMMP(mp1) == IDM_MOVE || 1082 SHORT1FROMMP(mp1) == IDM_COPY || 1083 SHORT1FROMMP(mp1) == IDM_WPSMOVE || 1084 SHORT1FROMMP(mp1) == IDM_WPSCOPY ? 1085 path : NullStr, 1086 x != 1 ? GetPString(IDS_ARETEXT) : GetPString(IDS_ISTEXT)); 1087 1087 WinSetWindowText(WinWindowFromID(hwndFrame, SEEALL_STATUS), message); 1088 1088 if (toupper(*path) < 'C') 1089 1089 DosBeep(1000, 25); 1090 DosSleep(16); //05 Aug 07 GKY 331090 DosSleep(16); // 05 Aug 07 GKY 33 1091 1091 break; 1092 1092 … … 1623 1623 } 1624 1624 1625 VOID FindDupes (VOID * args)1625 VOID FindDupesThread(VOID * args) 1626 1626 { 1627 1627 register ULONG x, z; … … 1654 1654 } 1655 1655 for (z = 0; z < ad->affiles && !ad->stopflag; z++) { 1656 if (x != z 1657 && !(ad->afhead[z].flags & (AF_DUPE | AF_FILTERED))) { 1656 if (x != z && 1657 !(ad->afhead[z].flags & (AF_DUPE | AF_FILTERED))) 1658 { 1658 1659 if (ad->dupeflags & DP_SIZES) { 1659 1660 if (ad->afhead[x].cbFile != ad->afhead[z].cbFile) … … 1713 1714 goto SkipNonDupe; 1714 1715 } 1715 DosSleep( 1);1716 DosSleep(0); 1716 1717 } 1717 1718 ad->afhead[x].flags |= AF_DUPE; … … 1720 1721 ; 1721 1722 } 1722 } 1723 DosSleep( 1);1724 } 1725 } 1723 } // for 1724 DosSleep(0); 1725 } 1726 } // for 1726 1727 for (x = 0; x < ad->affiles && !ad->stopflag; x++) { 1727 1728 if (!(ad->afhead[x].flags & AF_DUPE)) … … 1735 1736 PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID); 1736 1737 DosReleaseMutexSem(ad->hmtxScan); 1737 } // if got sem1738 } // if got sem 1738 1739 if (hmq2) { 1739 1740 PostMsg(hwnd, UM_CONTAINER_FILLED, MPVOID, MPVOID); … … 1898 1899 return; 1899 1900 1900 ulFindMax = ad->afFilesToGet;1901 ulFindMax = FilesToGet; 1901 1902 if (fRemoteBug && isalpha(*pathname) && pathname[1] == ':' && 1902 1903 pathname[2] == '\\' && … … 2025 2026 WinCancelShutdown(hmq2, TRUE); 2026 2027 IncrThreadUsage(); 2027 ad->afFilesToGet = FilesToGet;2028 2028 if (!*ad->szFindPath) { 2029 2029 DosError(FERR_DISABLEHARDERR); … … 3835 3835 MPFROM2SHORT(pAD->dupeflags, 0)); 3836 3836 if (pAD->dupeflags) { 3837 if (_beginthread(FindDupes , NULL, 65536, (PVOID) hwnd) == -1)3837 if (_beginthread(FindDupesThread, NULL, 65536, (PVOID) hwnd) == -1) 3838 3838 Runtime_Error(pszSrcFile, __LINE__, 3839 3839 GetPString(IDS_COULDNTSTARTTHREADTEXT)); … … 4294 4294 #pragma alloc_text(SEEALL,UpdateList,CollectList,ReSort,Mark) 4295 4295 #pragma alloc_text(SEEALL,BuildAList,RemoveDeleted,SeeFrameWndProc,FilterList) 4296 #pragma alloc_text(SEEALL2,SeeObjWndProc,MakeSeeObjWinThread,FindDupes ,DupeDlgProc)4296 #pragma alloc_text(SEEALL2,SeeObjWndProc,MakeSeeObjWinThread,FindDupesThread,DupeDlgProc) 4297 4297 #pragma alloc_text(SEEALL3,FreeAllFilesList,DoADir,FindAllThread,AFDrvsWndProc) 4298 4298 #pragma alloc_text(SEEALL3,StartSeeAll)  - 
      
trunk/dll/select.c
r769 r787 25 25 not use pszFileName since CNRITEM_EXISTS set implies 26 26 pszFileName not null 27 14 Aug 07 SHL Revert ExpandAll DosSleep to 0 27 28 28 29 ***********************************************************************/ … … 251 252 else 252 253 break; 253 } 254 } // while 254 255 fclose(inputFile); 255 256 } … … 354 355 else 355 356 break; 356 } 357 } // while 357 358 fclose(inputFile); 358 359 } … … 545 546 MPFROM2SHORT(CMA_FIRSTCHILD, CMA_ITEMORDER)); 546 547 if (pci) 547 DosSleep( 1);548 DosSleep(0); 548 549 while (pci && (INT)pci != -1) { 549 550 ExpandAll(hwndCnr, expand, pci); … … 552 553 } 553 554 } 554 DosSleep( 1);555 DosSleep(0); 555 556 } 556 557 … … 638 639 MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); 639 640 if (!(x % 500)) 640 DosSleep(1 L);641 DosSleep(1); 641 642 // else if (!(x % 50)) 642 // DosSleep(0 L);643 // DosSleep(0); 643 644 } // while 644 645 … … 668 669 MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); 669 670 if (!(x % 500)) 670 DosSleep(1 L);671 DosSleep(1); 671 672 // else if (!(x % 50)) 672 // DosSleep(0 L);673 // DosSleep(0); 673 674 } // while 674 675 … … 737 738 } 738 739 if (!(x % 500)) 739 DosSleep(1 L);740 DosSleep(1); 740 741 // else if (!(x % 50)) 741 // DosSleep(0 L);742 // DosSleep(0); 742 743 } // for 743 744 } // if reset … … 760 761 } 761 762 if (!(x % 500)) 762 DosSleep(1 L);763 DosSleep(1); 763 764 // else if (!(x % 50)) 764 // DosSleep(0 L);765 // DosSleep(0); 765 766 } // for 766 767 break; … … 780 781 } 781 782 if (!(x % 500)) 782 DosSleep(1 L);783 DosSleep(1); 783 784 // else if (!(x % 50)) 784 // DosSleep(0 L);785 // DosSleep(0); 785 786 } 786 787 break; … … 866 867 } 867 868 if (!(x % 500)) 868 DosSleep(1 L);869 DosSleep(1); 869 870 // else if (!(x % 50)) 870 // DosSleep(0 L);871 // DosSleep(0); 871 872 } // for 872 873 break; … … 884 885 } 885 886 if (!(x % 500)) 886 DosSleep(1 L);887 DosSleep(1); 887 888 // else if (!(x % 50)) 888 // DosSleep(0 L);889 // DosSleep(0); 889 890 } 890 891 break; … … 906 907 } 907 908 if (!(x % 500)) 908 DosSleep(1 L);909 DosSleep(1); 909 910 // else if (!(x % 50)) 910 // DosSleep(0 L);911 // DosSleep(0); 911 912 } 912 913 break; … … 927 928 } 928 929 if (!(x % 500)) 929 DosSleep(1 L);930 DosSleep(1); 930 931 // else if (!(x % 50)) 931 // DosSleep(0 L);932 // DosSleep(0); 932 933 } 933 934 break; … … 948 949 } 949 950 if (!(x % 500)) 950 DosSleep(1 L);951 DosSleep(1); 951 952 // else if (!(x % 50)) 952 // DosSleep(0 L);953 // DosSleep(0); 953 954 } 954 955 break; … … 969 970 } 970 971 if (!(x % 500)) 971 DosSleep(1 L);972 DosSleep(1); 972 973 // else if (!(x % 50)) 973 // DosSleep(0 L);974 // DosSleep(0); 974 975 } 975 976 break; … … 990 991 } 991 992 if (!(x % 500)) 992 DosSleep(1 L);993 DosSleep(1); 993 994 // else if (!(x % 50)) 994 // DosSleep(0 L);995 // DosSleep(0); 995 996 } 996 997 break; … … 1008 1009 } 1009 1010 if (!(x % 500)) 1010 DosSleep(1 L);1011 DosSleep(1); 1011 1012 // else if (!(x % 50)) 1012 // DosSleep(0 L);1013 // DosSleep(0); 1013 1014 } 1014 1015 break; … … 1029 1030 } 1030 1031 if (!(x % 500)) 1031 DosSleep(1 L);1032 DosSleep(1); 1032 1033 // else if (!(x % 50)) 1033 // DosSleep(0 L);1034 // DosSleep(0); 1034 1035 } 1035 1036 break; … … 1050 1051 } 1051 1052 if (!(x % 500)) 1052 DosSleep(1 L);1053 DosSleep(1); 1053 1054 // else if (!(x % 50)) 1054 // DosSleep(0 L);1055 // DosSleep(0); 1055 1056 } 1056 1057 break; … … 1071 1072 } 1072 1073 if (!(x % 500)) 1073 DosSleep(1 L);1074 DosSleep(1); 1074 1075 // else if (!(x % 50)) 1075 // DosSleep(0 L);1076 // DosSleep(0); 1076 1077 } 1077 1078 break; … … 1092 1093 } 1093 1094 if (!(x % 500)) 1094 DosSleep(1 L);1095 DosSleep(1); 1095 1096 // else if (!(x % 50)) 1096 // DosSleep(0 L);1097 // DosSleep(0); 1097 1098 } 1098 1099 break; … … 1113 1114 } 1114 1115 if (!(x % 500)) 1115 DosSleep(1 L);1116 DosSleep(1); 1116 1117 // else if (!(x % 50)) 1117 // DosSleep(0 L);1118 // DosSleep(0); 1118 1119 } 1119 1120 break;  - 
      
trunk/dll/treecnr.c
r775 r787 19 19 15 Aug 06 SHL Rework SetMask args 20 20 31 Aug 06 JS Add more partitioning menu items 21 22 O CT06 GKY Add NDFS32 support21 22 Oct 06 GKY Add NDFS32 support 22 22 29 Dec 06 GKY Fixed menu gray out for remote drives (added variable "remote") 23 23 29 Dec 06 GKY Enabled edit of drive flags on "not ready" drives … … 36 36 02 Aug 07 SHL Sync with CNRITEM mods 37 37 06 Aug 07 GKY Reduce DosSleep times (ticket 148) 38 14 Aug 07 SHL Revert ShowTreeRec DosSleep to 0 39 14 Aug 07 SHL Optimze ShowTreeRec collapse - was really slow 38 40 39 41 ***********************************************************************/ … … 143 145 } 144 146 145 VOID ShowTreeRec(HWND hwndCnr, CHAR * dirname, BOOL collapsefirst, 147 VOID ShowTreeRec(HWND hwndCnr, 148 CHAR *dirname, 149 BOOL collapsefirst, 146 150 BOOL maketop) 147 151 { … … 153 157 CHAR szDir[CCHMAXPATH], *p; 154 158 155 / * is it already the current record? */159 // already positioned to requested record? 156 160 pci = WinSendMsg(hwndCnr, 157 161 CM_QUERYRECORDEMPHASIS, 158 162 MPFROMLONG(CMA_FIRST), MPFROMSHORT(CRA_CURSORED)); 159 163 if (pci && (INT) pci != -1 && !stricmp(pci->pszFileName, dirname)) { 160 quickbail = TRUE; 161 goto MakeTop; /* skip lookup bullsh*t */ 164 // DbgMsg(pszSrcFile, __LINE__, "already at %s collapse %u maketop %u", dirname, collapsefirst, maketop); // 14 Aug 07 SHL fixme 165 quickbail = TRUE; // Bypass repositioning 166 goto MakeTop; 162 167 } 163 168 WinEnableWindowUpdate(hwndCnr, FALSE); 169 DbgMsg(pszSrcFile, __LINE__, "finding %s collapse %u maketop %u", dirname, collapsefirst, maketop); // 14 Aug 07 SHL fixme 164 170 pci = FindCnrRecord(hwndCnr, dirname, NULL, TRUE, FALSE, TRUE); 165 171 if (!pci || (INT) pci == -1) { … … 168 174 szDir[2] = '\\'; 169 175 szDir[3] = 0; 170 p = szDir + 3; 176 p = szDir + 3; // Point after root backslash 171 177 for (;;) { 172 178 pciP = FindCnrRecord(hwndCnr, szDir, NULL, TRUE, FALSE, TRUE); 173 179 if (pciP && (INT) pciP != -1) { 174 180 if (!stricmp(dirname, pciP->pszFileName)) 175 break; 176 if ( !(pciP->rc.flRecordAttr & CRA_EXPANDED))181 break; // Found it 182 if (~pciP->rc.flRecordAttr & CRA_EXPANDED) 177 183 WinSendMsg(hwndCnr, CM_EXPANDTREE, MPFROMP(pciP), MPVOID); 178 184 strcpy(szDir, dirname); 179 185 if (p - szDir >= strlen(szDir)) 180 break; 186 break; // Not root dir 181 187 p = strchr(p, '\\'); 182 188 if (p) { 183 *p = 0; 189 *p = 0; // fixme? 184 190 p++; 185 191 } … … 189 195 else 190 196 break; 191 DosSleep( 1);192 } 197 DosSleep(0); 198 } // for 193 199 pci = FindCnrRecord(hwndCnr, dirname, NULL, TRUE, FALSE, TRUE); 194 200 } 201 DbgMsg(pszSrcFile, __LINE__, "found"); // 14 Aug 07 SHL fixme 195 202 if (pci && (INT) pci != -1) { 196 if ( !(pci->rc.flRecordAttr & CRA_CURSORED)) {203 if (~pci->rc.flRecordAttr & CRA_CURSORED) { 197 204 if (collapsefirst) { 198 /* collapse top level of all branches */ 205 DbgMsg(pszSrcFile, __LINE__, "collapsing"); // 14 Aug 07 SHL fixme 199 206 pciP = WinSendMsg(hwndCnr, 200 207 CM_QUERYRECORD, 201 208 MPVOID, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER)); 202 209 while (pciP && (INT) pciP != -1) { 203 if (toupper(*pciP->pszFileName) == toupper(*dirname)) 204 /* collapse all levels if branch is our drive */ 205 ExpandAll(hwndCnr, FALSE, pciP); 206 else if (pciP->rc.flRecordAttr & CRA_EXPANDED) 210 #if 1 211 if (pciP->rc.flRecordAttr & CRA_EXPANDED) { 212 // collapse top level of all branches 207 213 WinSendMsg(hwndCnr, CM_COLLAPSETREE, MPFROMP(pciP), MPVOID); 214 } 215 #else // fixme to be gone 216 if (toupper(*pciP->pszFileName) == toupper(*dirname)) { 217 // collapse all levels if branch is our drive 218 if (pciP->rc.flRecordAttr & CRA_EXPANDED) 219 ExpandAll(hwndCnr, FALSE, pciP); 220 } 221 else if (pciP->rc.flRecordAttr & CRA_EXPANDED) { 222 // collapse top level of all branches 223 WinSendMsg(hwndCnr, CM_COLLAPSETREE, MPFROMP(pciP), MPVOID); 224 } 225 #endif 208 226 pciP = WinSendMsg(hwndCnr, 209 227 CM_QUERYRECORD, 210 228 MPFROMP(pciP), 211 229 MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER)); 212 } 230 } // while 213 231 } 214 232 /* expand all parent branches */ 233 DbgMsg(pszSrcFile, __LINE__, "expanding parents"); // 14 Aug 07 SHL fixme 215 234 pciToSelect = pci; 216 235 for (;;) { … … 226 245 else 227 246 break; 228 DosSleep(1); 229 } 247 DosSleep(1); // Let GUI update 248 } // for 230 249 } 231 250 /* make record visible */ 232 251 MakeTop: 252 DbgMsg(pszSrcFile, __LINE__, "moving into view"); // 14 Aug 07 SHL fixme 233 253 pciToSelect = pci; 234 254 if (pciToSelect && (INT) pciToSelect != -1) { 235 if (fTopDir || maketop) 255 if (fTopDir || maketop) { 236 256 ShowCnrRecord(hwndCnr, (PMINIRECORDCORE) pciToSelect); 237 if (fSwitchTreeExpand && !(pciToSelect->rc.flRecordAttr & CRA_EXPANDED)) 257 } 258 if (fSwitchTreeExpand && ~pciToSelect->rc.flRecordAttr & CRA_EXPANDED) { 259 DbgMsg(pszSrcFile, __LINE__, "expanding current"); // 14 Aug 07 SHL fixme 238 260 WinSendMsg(hwndCnr, CM_EXPANDTREE, MPFROMP(pciToSelect), MPVOID); 239 if (quickbail) {240 WinEnableWindowUpdate(hwndCnr, TRUE); 241 return; 242 }243 WinSendMsg(hwndCnr,244 CM_SETRECORDEMPHASIS,245 MPFROMP(pciToSelect),246 MPFROM2SHORT(TRUE, CRA_SELECTED | CRA_CURSORED)); 261 DbgMsg(pszSrcFile, __LINE__, "expanded"); // 14 Aug 07 SHL fixme 262 } 263 if (!quickbail) { 264 WinSendMsg(hwndCnr, 265 CM_SETRECORDEMPHASIS, 266 MPFROMP(pciToSelect), 267 MPFROM2SHORT(TRUE, CRA_SELECTED | CRA_CURSORED)); 268 } 247 269 } 248 270 } 271 DbgMsg(pszSrcFile, __LINE__, "done"); // 14 Aug 07 SHL fixme 249 272 WinEnableWindowUpdate(hwndCnr, TRUE); 273 DosSleep(1); // Let GUI update 250 274 } 251 275 … … 517 541 518 542 case UM_SHOWME: 543 // DbgMsg(pszSrcFile, __LINE__, "UM_SHOWME mp1 %p mp2 %p", mp1, mp2); // 14 Aug 07 SHL fixme 519 544 if (mp1) { 520 545 dcd = INSTDATA(hwnd); 546 // DbgMsg(pszSrcFile, __LINE__, "UM_SHOWME dcd %p", dcd); // 14 Aug 07 SHL fixme 521 547 if (dcd) { 522 548 BOOL tempsusp, tempfollow, temptop;  - 
      
trunk/dll/walkem.c
r766 r787 18 18 22 Mar 07 GKY Use QWL_USER 19 19 20 Apr 07 SHL Avoid spurious add_udir error reports 20 16 Aug 07 SHL Update add_setups for ticket# 109 20 21 21 22 ***********************************************************************/ … … 24 25 #define INCL_DOS 25 26 #define INCL_DOSERRORS 27 #define INCL_SHLERRORS // PMERR_NOT_IN_IDX 26 28 #include <os2.h> 27 29 … … 62 64 static ULONG WalkFontSize = sizeof(WalkFont); 63 65 66 /** 67 * States names management 68 */ 69 70 static BOOL fSetupsLoaded; 71 static LINKDIRS *pFirstSetup; 72 static const PSZ pszLastSetups = "LastSetups"; 73 // // 18 Aug 07 SHL fixme to stop supporting old style 1 year from now? 74 static const ULONG ulOldSetupsBytes = 100 * 13; // Prior to 3.0.7 75 76 /** 77 * Fill States drop down list with known state names 78 */ 79 80 VOID fill_setups_list(VOID) 81 { 82 WinSendMsg(hwndStatelist, LM_DELETEALL, MPVOID, MPVOID); 83 if (fUserComboBox) { 84 LINKDIRS *pld; 85 load_setups(); 86 for (pld = pFirstSetup; pld; pld = pld->next) { 87 // DbgMsg(pszSrcFile, __LINE__, "Inserted %s", pld->path); 88 WinSendMsg(hwndStatelist, 89 LM_INSERTITEM, 90 MPFROM2SHORT(LIT_SORTASCENDING, 0), 91 MPFROMP(pld->path)); 92 } 93 WinSetWindowText(hwndStatelist, GetPString(IDS_STATETEXT)); 94 } 95 } 96 97 /** 98 * Lookup setup and do requested action 99 * @param - action, Support old/new style storage method 100 * @return 1 if found and action OK, 0 if not found and action OK, -1 if error during action 101 */ 102 103 #define LS_FIND 0 104 #define LS_ADD 1 105 #define LS_DELETE 2 106 107 static INT lookup_setup(PSZ name, UINT action) 108 { 109 LINKDIRS *pld; 110 LINKDIRS *pldLast = NULL; 111 112 if (!name || !*name) { 113 Runtime_Error(pszSrcFile, __LINE__, "no data"); 114 return -1; 115 } 116 117 load_setups(); 118 119 for (pld = pFirstSetup; pld; pld = pld->next) { 120 if (!stricmp(pld->path, name)) { 121 if (action == LS_DELETE) { 122 if (pldLast) 123 pldLast->next = pld->next; 124 else 125 pFirstSetup = pld->next; 126 xfree(pld->path); 127 xfree(pld); 128 } 129 return 1; // Found or added 130 } 131 pldLast = pld; // In case deleting 132 } // for 133 134 // Not found 135 if (action == LS_ADD) { 136 pld = xmalloc(sizeof(LINKDIRS), pszSrcFile, __LINE__); 137 if (!pld) 138 return -1; 139 pld->path = xstrdup(name, pszSrcFile, __LINE__); 140 if (!pld->path) { 141 xfree(pld); 142 return -1; 143 } 144 // Insert at front of list - drop down will sort 145 pld->next = pFirstSetup; 146 pFirstSetup = pld; 147 return 0; 148 } 149 150 return FALSE; // Not found 151 } 152 153 /** 154 * Load state names from ini 155 * Support old/new style storage method 156 */ 157 64 158 VOID load_setups(VOID) 65 159 { 66 ULONG len = sizeof(lastsetups); 67 68 memset(lastsetups, 0, len); 69 PrfQueryProfileData(fmprof, FM3Str, "LastSetups", lastsetups, &len); 70 len = sizeof(INT); 71 lastsetup = 0; 72 PrfQueryProfileData(fmprof, FM3Str, "LastSetup", &lastsetup, &len); 73 loadedsetups = TRUE; 160 ULONG ulDataBytes; 161 ULONG l; 162 PSZ pszBuf; 163 PSZ psz; 164 LINKDIRS *pld; 165 166 if (fSetupsLoaded) 167 return; 168 169 if (!PrfQueryProfileSize(fmprof, FM3Str, pszLastSetups, &ulDataBytes)) { 170 // fixme to use generic hab 171 ERRORID eid = WinGetLastError((HAB)0); 172 if ((eid & 0xffff) != PMERR_NOT_IN_IDX) { 173 Runtime_Error(pszSrcFile, __LINE__, "PrfQueryProfileSize returned %u", eid); 174 return; 175 } 176 } 177 178 if (ulDataBytes == 0) { 179 Runtime_Error(pszSrcFile, __LINE__, "PrfQueryProfileSize reported 0 bytes"); 180 return; 181 } 182 183 pszBuf = xmalloc(ulDataBytes + 1, pszSrcFile, __LINE__); // One extra for end marker 184 if (!pszBuf) 185 return; 186 l = ulDataBytes; 187 if (!PrfQueryProfileData(fmprof, FM3Str, pszLastSetups, pszBuf, &l)) { 188 Win_Error(HWND_DESKTOP, HWND_DESKTOP, pszSrcFile, __LINE__, "PrfQueryProfileData"); 189 xfree(pszBuf); 190 return; 191 } 192 193 if (ulDataBytes != l) { 194 Runtime_Error(pszSrcFile, __LINE__, "PrfQueryProfileData reported %u expected %u", l, ulDataBytes); 195 xfree(pszBuf); 196 return; 197 } 198 199 *(pszBuf + ulDataBytes) = 0; // Insert end marker 200 201 psz = pszBuf; 202 if (!*psz && ulDataBytes == ulOldSetupsBytes) 203 psz += 13; // Rarely used 1st fixed width entry prior to 3.0.7 204 205 while (*psz) { 206 pld = xmalloc(sizeof(LINKDIRS), pszSrcFile, __LINE__); 207 if (!pld) { 208 xfree(pszBuf); 209 return; 210 } 211 pld->path = xstrdup(psz, pszSrcFile, __LINE__); 212 if (!pld->path) { 213 xfree(pszBuf); 214 xfree(pld); 215 return; 216 } 217 218 // Insert at front of list - drop down will sort 219 pld->next = pFirstSetup; 220 pFirstSetup = pld; 221 // DbgMsg(pszSrcFile, __LINE__, "Inserted %s", pld->path); 222 223 if (ulDataBytes == ulOldSetupsBytes) 224 psz += 13; // Buffers fixed width prior to 3.0.7 225 else 226 psz += strlen(psz) + 1; 227 } // while 228 229 xfree(pszBuf); 230 231 fSetupsLoaded = TRUE; 74 232 } 75 233 76 234 VOID save_setups(VOID) 77 235 { 78 if (!loadedsetups) 236 ULONG ulBufBytes; 237 ULONG ulFillBytes; 238 ULONG l; 239 PSZ pszBuf; 240 PSZ psz; 241 LINKDIRS *pld; 242 243 if (!fSetupsLoaded) 79 244 return; 80 PrfWriteProfileData(fmprof, 81 FM3Str, 82 "LastSetups", lastsetups, (ULONG) sizeof(lastsetups)); 83 PrfWriteProfileData(fmprof, 84 FM3Str, "LastSetup", &lastsetup, (ULONG) sizeof(INT)); 85 } 86 87 BOOL add_setup(CHAR * name) 88 { 89 INT x; 90 91 if (!name || !*name) 92 return FALSE; 93 if (!loadedsetups) 94 load_setups(); 95 for (x = 0; x < MAXNUMSETUPS; x++) { 96 if (!stricmp(lastsetups[x], name)) 97 return FALSE; 98 } 99 lastsetup++; 100 if (lastsetup >= MAXNUMSETUPS) 101 lastsetup = 0; 102 strcpy(lastsetups[lastsetup], name); 103 return TRUE; 104 } 105 106 BOOL remove_setup(CHAR * name) 107 { 108 INT x, y; 109 110 if (!name || !*name) 111 return FALSE; 112 if (!loadedsetups) 113 load_setups(); 114 for (x = 0; x < MAXNUMSETUPS; x++) { 115 if (!stricmp(lastsetups[x], name)) { 116 *lastsetups[x] = 0; 117 for (y = x + 1; y < MAXNUMSETUPS; y++) 118 strcpy(lastsetups[y - 1], lastsetups[y]); 119 *lastsetups[MAXNUMSETUPS - 1] = 0; 120 if (lastsetup >= x) 121 lastsetup--; 122 return TRUE; 123 } 124 } 125 return FALSE; 245 246 ulBufBytes = 0; 247 for (pld = pFirstSetup; pld; pld = pld->next) { 248 ulBufBytes += strlen(pld->path) + 1; 249 } // for 250 251 if (!ulBufBytes) 252 pszBuf = NULL; 253 else { 254 // Ensure different than size prior to 3.0.7 255 ulFillBytes = ulBufBytes == ulOldSetupsBytes ? 1 : 0; 256 pszBuf = xmalloc(ulBufBytes + ulFillBytes, pszSrcFile, __LINE__); 257 if (!pszBuf) 258 return; 259 260 psz = pszBuf; 261 for (pld = pFirstSetup; pld; pld = pld->next) { 262 l = strlen(pld->path) + 1; 263 memcpy(psz, pld->path, l); 264 psz += l; 265 } // for 266 if (ulFillBytes) 267 *psz = 0; 268 } 269 270 if (!PrfWriteProfileData(fmprof, 271 FM3Str, 272 pszLastSetups, pszBuf, ulBufBytes)) { 273 // Win_Error(pszSrcFile, __LINE__, HWND_DESKTOP, HWND_DESKTOP, "PrfWriteProfileData"); 274 ERRORID eid = WinGetLastError((HAB)0); 275 if ((eid & 0xffff) != PMERR_NOT_IN_IDX) 276 Runtime_Error(pszSrcFile, __LINE__, "PrfWriteProfileData returned %u", eid); 277 } 278 279 // Delete obsolete INI entry 280 PrfWriteProfileData(fmprof, FM3Str, "LastSetup", NULL, 0); 281 } 282 283 /** 284 * Add named state to setups list 285 * @return same as lookup_setup 286 */ 287 288 INT add_setup(PSZ name) 289 { 290 return lookup_setup(name, LS_ADD); 291 } 292 293 /** 294 * Delete named state from setups list 295 * @return same as lookup_setup 296 */ 297 298 INT remove_setup(PSZ name) 299 { 300 return lookup_setup(name, LS_DELETE); 126 301 } 127 302  
  Note:
 See   TracChangeset
 for help on using the changeset viewer.
  