--- trunk/reactos/subsys/system/winefile/winefile.c 2005-05-13 15:35:55 UTC (rev 15264)
+++ trunk/reactos/subsys/system/winefile/winefile.c 2005-05-13 17:11:16 UTC (rev 15265)
@@ -2446,6 +2446,40 @@
}
+static void format_bytes(LPTSTR buffer, LONGLONG bytes)
+{
+ const static TCHAR sFmtGB[] = {'%', '.', '1', 'f', ' ', 'G', 'B', '\0'};
+ const static TCHAR sFmtMB[] = {'%', '.', '1', 'f', ' ', 'M', 'B', '\0'};
+ const static TCHAR sFmtkB[] = {'%', '.', '1', 'f', ' ', 'k', 'B', '\0'};
+
+ float fBytes = (float)bytes;
+
+ if (bytes >= 1073741824) // 1 GB
+ _stprintf(buffer, sFmtGB, fBytes/1073741824.f+.5f);
+ else if (bytes >= 1048576) // 1 MB
+ _stprintf(buffer, sFmtMB, fBytes/1048576.f+.5f);
+ else if (bytes >= 1024) // 1 kB
+ _stprintf(buffer, sFmtMB, fBytes/1024.f+.5f);
+ else
+ _stprintf(buffer, sLongNumFmt, bytes);
+}
+
+static void set_space_status()
+{
+ ULARGE_INTEGER ulFreeBytesToCaller, ulTotalBytes, ulFreeBytes;
+ TCHAR fmt[64], b1[64], b2[64], buffer[BUFFER_LEN];
+
+ if (GetDiskFreeSpaceEx(NULL, &ulFreeBytesToCaller, &ulTotalBytes, &ulFreeBytes)) {
+ format_bytes(b1, ulFreeBytesToCaller.QuadPart);
+ format_bytes(b2, ulTotalBytes.QuadPart);
+ _stprintf(buffer, RS(fmt,IDS_FREE_SPACE_FMT), b1, b2);
+ } else
+ _tcscpy(buffer, sQMarks);
+
+ SendMessage(Globals.hstatusbar, SB_SETTEXT, 0, (LPARAM)buffer);
+}
+
+
static WNDPROC g_orgTreeWndProc;
static void create_tree_window(HWND parent, Pane* pane, int id, int id_header)
@@ -2755,13 +2789,13 @@
#endif
)
LineTo(dis->hDC, x, dis->rcItem.bottom);
-
+/*@@
if (entry->down && entry->expanded) {
x += IMAGE_WIDTH+TREE_LINE_DX;
MoveToEx(dis->hDC, x, dis->rcItem.top+IMAGE_HEIGHT, 0);
LineTo(dis->hDC, x, dis->rcItem.bottom);
}
-
+*/
SelectClipRgn(dis->hDC, hrgn_org);
if (hrgn_org) DeleteObject(hrgn_org);
/* SelectObject(dis->hDC, holdPen); */
@@ -3299,7 +3333,8 @@
SetWindowText(child->hwnd, path);
if (path[0])
- SetCurrentDirectory(path);
+ if (SetCurrentDirectory(path))
+ set_space_status();
}
@@ -3728,7 +3763,8 @@
#endif /* _NO_EXTENSIONS */
case WM_SETFOCUS:
- SetCurrentDirectory(child->path);
+ if (SetCurrentDirectory(child->path))
+ set_space_status();
SetFocus(child->focus_pane? child->right.hwnd: child->left.hwnd);
break;