Changeset 1155 for trunk/dirsize.c
- Timestamp:
- Sep 5, 2008, 11:38:38 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dirsize.c
r1055 r1155 24 24 #include "dirsize.h" 25 25 #include "dll\fm3dll.h" 26 #include "dll\dirsize.h" // DirSizeProc 26 27 27 28 MRESULT EXPENTRY DirMainProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) … … 49 50 50 51 for (x = 2; x < 26; x++) { 51 52 53 54 55 56 57 58 59 60 52 if ((ulDriveMap & (1L << x)) && !(driveflags[x] & DRIVE_IGNORE)) { 53 *dirname = (CHAR) x + 'A'; 54 WinSendDlgItemMsg(hwnd, DIRSIZE_LISTBOX, LM_INSERTITEM, 55 MPFROM2SHORT(LIT_END, 0), MPFROMP(dirname)); 56 if (first) { 57 WinSendDlgItemMsg(hwnd, DIRSIZE_LISTBOX, LM_SELECTITEM, 58 MPFROMSHORT(0), MPFROMSHORT(TRUE)); 59 first = FALSE; 60 } 61 } 61 62 } 62 63 } … … 73 74 struct 74 75 { 75 76 77 76 ULONG serial; 77 CHAR volumelength; 78 CHAR volumelabel[CCHMAXPATH]; 78 79 } 79 80 volser; … … 90 91 WinSetDlgItemText(hwnd, DIRSIZE_LOCAL, ""); 91 92 WinSendDlgItemMsg(hwnd, DIRSIZE_SLIDER, SLM_SETSLIDERINFO, 92 93 93 MPFROM2SHORT(SMA_SLIDERARMPOSITION, 94 SMA_INCREMENTVALUE), MPFROMSHORT(0)); 94 95 removable = CheckDrive(toupper(*curdir), FileSystem, &type); 95 96 if (removable != -1) { 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 percentfree = fsa.cUnit ? (USHORT)((fsa.cUnitAvail * 100) / fsa.cUnit) : 0;// 27 May 08 SHL120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 97 if (type & DRIVE_ZIPSTREAM) 98 WinSetDlgItemText(hwnd, DIRSIZE_LOCAL, "Zipstream drive"); 99 else if (type & DRIVE_REMOTE) 100 WinSetDlgItemText(hwnd, DIRSIZE_LOCAL, "Remote drive"); 101 else if (type & DRIVE_VIRTUAL) 102 WinSetDlgItemText(hwnd, DIRSIZE_LOCAL, "Virtual drive"); 103 else if (type & DRIVE_RAMDISK) 104 WinSetDlgItemText(hwnd, DIRSIZE_LOCAL, "Ramdisk"); 105 else { 106 sprintf(s, "Local drive%s", (removable) ? " (removable)" : ""); 107 WinSetDlgItemText(hwnd, DIRSIZE_LOCAL, s); 108 } 109 sprintf(s, "IFS: %s", FileSystem); 110 WinSetDlgItemText(hwnd, DIRSIZE_IFS, s); 111 memset(&volser, 0, sizeof(volser)); 112 DosError(FERR_DISABLEHARDERR); 113 if (!DosQueryFSInfo(toupper(*curdir) - '@', FSIL_VOLSER, 114 &volser, (ULONG) sizeof(volser))) { 115 sprintf(s, "Label: %s", volser.volumelabel); 116 WinSetDlgItemText(hwnd, DIRSIZE_LABEL, s); 117 } 118 if (!DosQueryFSInfo(toupper(*curdir) - '@', 119 FSIL_ALLOC, &fsa, sizeof(FSALLOCATE))) { 120 percentfree = fsa.cUnit ? (USHORT)((fsa.cUnitAvail * 100) / fsa.cUnit) : 0; // 27 May 08 SHL 121 if (!percentfree && fsa.cUnitAvail) 122 percentfree = 1; 123 percentused = 100 - percentfree; 124 sprintf(s, "Units free: %lu", fsa.cUnitAvail); 125 WinSetDlgItemText(hwnd, DIRSIZE_UNITSFREE, s); 126 sprintf(s, "Unit size: %lu x %u = %lu", 127 fsa.cSectorUnit, 128 fsa.cbSector, fsa.cSectorUnit * fsa.cbSector); 129 WinSetDlgItemText(hwnd, DIRSIZE_UNITSIZE, s); 130 sprintf(s, "Units used: %lu", fsa.cUnit - fsa.cUnitAvail); 131 WinSetDlgItemText(hwnd, DIRSIZE_UNITSUSED, s); 132 sprintf(s, "Bytes free: %.0f", 133 (float)fsa.cUnitAvail * (fsa.cSectorUnit * fsa.cbSector)); 134 WinSetDlgItemText(hwnd, DIRSIZE_BYTESFREE, s); 135 sprintf(s, "Bytes used: %.0f", 136 (float)(fsa.cUnit - fsa.cUnitAvail) * 137 (fsa.cSectorUnit * fsa.cbSector)); 138 WinSetDlgItemText(hwnd, DIRSIZE_BYTESUSED, s); 139 sprintf(s, "Percent used: %u%%", percentused); 140 WinSetDlgItemText(hwnd, DIRSIZE_PERCENT, s); 141 WinSendDlgItemMsg(hwnd, DIRSIZE_SLIDER, SLM_SETSLIDERINFO, 142 MPFROM2SHORT(SMA_SLIDERARMPOSITION, 143 SMA_INCREMENTVALUE), 144 MPFROMSHORT(percentused)); 145 WinShowWindow(WinWindowFromID(hwnd, DIRSIZE_SLIDER), TRUE); 146 } 146 147 } 147 148 else { 148 149 149 WinSetDlgItemText(hwnd, DIRSIZE_LOCAL, "Drive not ready."); 150 WinShowWindow(WinWindowFromID(hwnd, DIRSIZE_SLIDER), FALSE); 150 151 } 151 152 } … … 157 158 switch (SHORT2FROMMP(mp1)) { 158 159 case LN_ENTER: 159 160 160 WinPostMsg(hwnd, WM_COMMAND, MPFROM2SHORT(DID_OK, 0), MPVOID); 161 break; 161 162 case LN_SELECT: 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 163 { 164 SHORT x; 165 166 x = (SHORT) WinSendDlgItemMsg(hwnd, DIRSIZE_LISTBOX, 167 LM_QUERYSELECTION, 168 MPFROMSHORT(LIT_FIRST), MPVOID); 169 if (x >= 0) { 170 WinSendDlgItemMsg(hwnd, DIRSIZE_LISTBOX, 171 LM_QUERYITEMTEXT, 172 MPFROM2SHORT(x, sizeof(curdir)), 173 MPFROMP(curdir)); 174 WinPostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID); 175 } 176 } 177 break; 177 178 } 178 179 break; … … 188 189 case DID_OK: 189 190 if (*curdir) { 190 191 192 193 191 WinSetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, SWP_HIDE); 192 WinDlgBox(HWND_DESKTOP, hwnd, 193 DirSizeProc, FM3ModHandle, DSZ_FRAME, curdir); 194 WinSetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, SWP_SHOW); 194 195 } 195 196 else 196 197 DosBeep(50, 100); 197 198 break; 198 199 } 199 200 return 0; 200 } 201 } // switch 201 202 return WinDefDlgProc(hwnd, msg, mp1, mp2); 202 203 } 203 204 204 #ifdef NEVER 205 #ifdef NEVER // 05 Jan 08 SHL fixme to be gone? 205 206 206 207 VOID APIENTRY deinit(ULONG why) … … 229 230 for (x = 1; x < argc; x++) { 230 231 if (!strchr("/;,`\'", *argv[x]) && 231 232 !*fullname && (IsRoot(argv[x]) || IsFile(argv[x]) == 0)) { 232 233 if (IsRoot(argv[x])) 233 234 strcpy(fullname, argv[x]); 234 235 else if (DosQueryPathInfo(argv[x], 235 236 237 236 FIL_QUERYFULLNAME, 237 fullname, sizeof(fullname))) 238 *fullname = 0; 238 239 } 239 240 } … … 248 249 if (hmq) { 249 250 if (InitFM3DLL(hab, argc, argv)) { 250 251 252 253 254 255 256 257 258 251 if (!*fullname) 252 rcl = WinDlgBox(HWND_DESKTOP, 253 HWND_DESKTOP, DirMainProc, 0, DIRSIZE_FRAME, NULL); 254 else 255 rcl = WinDlgBox(HWND_DESKTOP, 256 HWND_DESKTOP, 257 DirSizeProc, FM3ModHandle, DSZ_FRAME, fullname); 258 if (rcl == DID_ERROR) 259 rcl = WinGetLastError(hab); 259 260 } 260 261 WinDestroyMsgQueue(hmq); … … 264 265 return 0; 265 266 266 } 267 } // main
Note:
See TracChangeset
for help on using the changeset viewer.