diff --git a/rosapps/winfile/StdAfx.h b/rosapps/winfile/StdAfx.h index 273cb9d0977..7d251c6c7cf 100644 --- a/rosapps/winfile/StdAfx.h +++ b/rosapps/winfile/StdAfx.h @@ -11,8 +11,6 @@ #endif // _MSC_VER > 1000 #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers - - // Windows Header Files: #include #include @@ -22,6 +20,8 @@ #include #include #include +#include +#include // Local Header Files diff --git a/rosapps/winfile/dialogs.c b/rosapps/winfile/dialogs.c index 176f3f55a09..7f89a87aaea 100644 --- a/rosapps/winfile/dialogs.c +++ b/rosapps/winfile/dialogs.c @@ -171,36 +171,24 @@ BOOL CALLBACK ViewFileTypeWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM //////////////////////////////////////////////////////////////////////////////// /* -TotalFileSize -[in] Specifies the total size of the file, in bytes. -TotalBytesTransferred -[in] Specifies the total number of bytes transferred from the source file to the destination file since the copy operation began. -StreamSize -[in] Specifies the total size of the current file stream, in bytes. -StreamBytesTransferred -[in] Specifies the total number of bytes in the current stream that have been transferred from the source file to the destination file since the copy operation began. -dwStreamNumber -[in] Handle to the current stream. The stream number is 1 the first time CopyProgressRoutine is called. -dwCallbackReason -[in] Specifies the reason that CopyProgressRoutine was called. This parameter can be one of the following values. Value Meaning -CALLBACK_CHUNK_FINISHED Another part of the data file was copied. -CALLBACK_STREAM_SWITCH Another stream was created and is about to be copied. This is the callback reason given when the callback routine is first invoked. +TotalFileSize [in] Specifies the total size of the file, in bytes. +TotalBytesTransferred [in] Specifies the total number of bytes transferred from the source file to the destination file since the copy operation began. +StreamSize [in] Specifies the total size of the current file stream, in bytes. +StreamBytesTransferred [in] Specifies the total number of bytes in the current stream that have been transferred from the source file to the destination file since the copy operation began. +dwStreamNumber [in] Handle to the current stream. The stream number is 1 the first time CopyProgressRoutine is called. +dwCallbackReason [in] Specifies the reason that CopyProgressRoutine was called. This parameter can be one of the following values. Value Meaning + CALLBACK_CHUNK_FINISHED Another part of the data file was copied. + CALLBACK_STREAM_SWITCH Another stream was created and is about to be copied. This is the callback reason given when the callback routine is first invoked. +hSourceFile [in] Handle to the source file. +hDestinationFile [in] Handle to the destination file +lpData [in] The argument passed to CopyProgressRoutine by the CopyFileEx or MoveFileWithProgress function. - -hSourceFile -[in] Handle to the source file. -hDestinationFile -[in] Handle to the destination file -lpData -[in] The argument passed to CopyProgressRoutine by the CopyFileEx or MoveFileWithProgress function. -Return Values -The CopyProgressRoutine function should return one of the following values. - -Value Meaning -PROGRESS_CONTINUE Continue the copy operation. -PROGRESS_CANCEL Cancel the copy operation and delete the destination file. -PROGRESS_STOP Stop the copy operation. It can be restarted at a later time. -PROGRESS_QUIET Continue the copy operation, but stop invoking CopyProgressRoutine to report progress. +Return Values The CopyProgressRoutine function should return one of the following values. + Value Meaning + PROGRESS_CONTINUE Continue the copy operation. + PROGRESS_CANCEL Cancel the copy operation and delete the destination file. + PROGRESS_STOP Stop the copy operation. It can be restarted at a later time. + PROGRESS_QUIET Continue the copy operation, but stop invoking CopyProgressRoutine to report progress. */ DWORD CALLBACK CopyProgressRoutine( LARGE_INTEGER TotalFileSize, // file size @@ -251,15 +239,6 @@ BOOL MoveFileWithProgress( LPPROGRESS_ROUTINE lpProgressRoutine, // callback function LPVOID lpData, // parameter for callback DWORD dwFlags // move options -); -DWORD FormatMessage( - DWORD dwFlags, // source and processing options - LPCVOID lpSource, // message source - DWORD dwMessageId, // message identifier - DWORD dwLanguageId, // language identifier - LPTSTR lpBuffer, // message buffer - DWORD nSize, // maximum size of message buffer - va_list *Arguments // array of message inserts ); */ // if (!MoveFileWithProgress(buffer_from, buffer_to, &CopyProgressRoutine, lpData, dwFlags)) { @@ -287,3 +266,267 @@ DWORD FormatMessage( extern TCHAR ViewTypeMaskStr[MAX_TYPE_MASK_LEN]; */ +void ShowFixedFileInfo(HWND hDlg, VS_FIXEDFILEINFO* pFixedFileInfo) +{ + TCHAR* str = NULL; + + switch (pFixedFileInfo->dwFileType) { + case VFT_UNKNOWN: str = _T("The file type is unknown to the system."); break; + case VFT_APP: str = _T("The file contains an application."); break; + case VFT_DLL: str = _T("The file contains a dynamic-link library (DLL)."); break; + case VFT_DRV: + str = _T("The file contains a device driver. If dwFileType is VFT_DRV, dwFileSubtype contains a more specific description of the driver."); + switch (pFixedFileInfo->dwFileSubtype) { + case VFT2_UNKNOWN: str = _T("The driver type is unknown by the system."); break; + case VFT2_DRV_COMM: str = _T("The file contains a communications driver."); break; + case VFT2_DRV_PRINTER: str = _T("The file contains a printer driver."); break; + case VFT2_DRV_KEYBOARD: str = _T("The file contains a keyboard driver"); break; + case VFT2_DRV_LANGUAGE: str = _T("The file contains a language driver"); break; + case VFT2_DRV_DISPLAY: str = _T("The file contains a display driver"); break; + case VFT2_DRV_MOUSE: str = _T("The file contains a mouse driver"); break; + case VFT2_DRV_NETWORK: str = _T("The file contains a network driver"); break; + case VFT2_DRV_SYSTEM: str = _T("The file contains a system driver"); break; + case VFT2_DRV_INSTALLABLE: str = _T("The file contains an installable driver"); break; + case VFT2_DRV_SOUND: str = _T("The file contains a sound driver"); break; + } + break; + case VFT_FONT: + str = _T("The file contains a font. If dwFileType is VFT_FONT, dwFileSubtype contains a more specific description of the font file."); + switch (pFixedFileInfo->dwFileSubtype) { + case VFT2_UNKNOWN: str = _T("The font type is unknown the system."); break; + case VFT2_FONT_RASTER: str = _T("The file contains a raster font."); break; + case VFT2_FONT_VECTOR: str = _T("The file contains a vector font."); break; + case VFT2_FONT_TRUETYPE: str = _T("The file contains a TrueType font."); break; + + } + break; + case VFT_VXD: str = _T("The file contains a virtual device."); break; + case VFT_STATIC_LIB: str = _T("The file contains a static-link library."); break; + } + if (str != NULL) { + SetDlgItemText(hDlg, IDC_STATIC_PROP_VERSION, str); +// SetDlgItemText(hDlg, IDC_STATIC_PROP_COPYRIGHT, pVersionData); + } +} + +// Structure used to store enumerated languages and code pages. +struct LANGANDCODEPAGE { + WORD wLanguage; + WORD wCodePage; +} *lpTranslate; + +void AddFileInfoValue(HWND hDlg, void* pVersionData, struct LANGANDCODEPAGE lpTranslate, UINT i, LPCTSTR info_str) +{ + TCHAR SubBlock[200]; + TCHAR* pVal; + UINT nValLen; + + wsprintf(SubBlock, TEXT("\\StringFileInfo\\%04x%04x\\%s"), + lpTranslate.wLanguage, lpTranslate.wCodePage, info_str); + // Retrieve file description for language and code page "i". + if (VerQueryValue(pVersionData, SubBlock, &pVal, &nValLen)) { + ListBox_InsertItemData(GetDlgItem(hDlg, IDC_LIST_PROP_VERSION_TYPES), i, info_str); +// ListBox_InsertItemData(pane->hwnd, idx, entry); + SendMessage(GetDlgItem(hDlg, IDC_LIST_PROP_VERSION_VALUES), WM_SETTEXT, 0, (LPARAM)pVal); + } +} + +static TCHAR* InfoStrings[] = { + TEXT("Comments"), + TEXT("InternalName"), + TEXT("ProductName"), + TEXT("CompanyName"), + TEXT("LegalCopyright"), + TEXT("ProductVersion"), + TEXT("FileDescription"), + TEXT("LegalTrademarks"), + TEXT("PrivateBuild"), + TEXT("FileVersion"), + TEXT("OriginalFilename"), + TEXT("SpecialBuild"), + TEXT(""), + NULL +}; + +void SelectVersionString(HWND hDlg, LPARAM lParam) +{ + int idx; + +// idx = ListBox_FindItemData(hwnd, , child->left.cur); + idx = ListBox_GetCurSel(GetDlgItem(hDlg, IDC_LIST_PROP_VERSION_TYPES)); + + //Entry* entry = (Entry*) ListBox_GetItemData(GetDlgItem(hDlg, IDC_LIST_PROP_VERSION_TYPES), idx); + +// SendMessage(GetDlgItem(hDlg, IDC_LIST_PROP_VERSION_VALUES), WM_SETTEXT, 0, (LPARAM)pVal); + +// ListBox_SetCurSel(GetDlgItem(hDlg, IDC_LIST_PROP_VERSION_TYPES), idx); + +// ListBox_InsertItemData(GetDlgItem(hDlg, IDC_LIST_PROP_VERSION_TYPES), i, _T("FileDescription")); +// SendMessage(GetDlgItem(hDlg, IDC_LIST_PROP_VERSION_VALUES), WM_SETTEXT, 0, pVal); + +} + +void CheckForFileInfo(HWND hDlg, TCHAR* strFilename) +{ + TCHAR SubBlock[200]; + UINT i; + DWORD dwHandle; + DWORD dwVersionDataLen = GetFileVersionInfoSize(strFilename, &dwHandle); + if (dwVersionDataLen != 0L) { + void* pVersionData = malloc(dwVersionDataLen); + if (GetFileVersionInfo(strFilename, 0, dwVersionDataLen, pVersionData)) { + TCHAR* pVal; + UINT nValLen; +// LPTSTR SubBlock = _T("\\"); + _tcscpy(SubBlock, TEXT("\\")); + if (VerQueryValue(pVersionData, SubBlock, &pVal, &nValLen)) { + if (nValLen == sizeof(VS_FIXEDFILEINFO)) { + ShowFixedFileInfo(hDlg, (VS_FIXEDFILEINFO*)pVal); + } + } +#if 1 + { + + // Read the list of languages and code pages. + _tcscpy(SubBlock, TEXT("\\VarFileInfo\\Translation")); + if (VerQueryValue(pVersionData, SubBlock, (LPVOID*)&pVal, &nValLen)) { + // Read the file description for each language and code page. + for (i = 0; i < (nValLen/sizeof(struct LANGANDCODEPAGE)); i++) { + int j = 0; + TCHAR* pInfoString; + while (pInfoString = InfoStrings[j]) { + if (pInfoString != NULL && _tcslen(pInfoString)) { + struct LANGANDCODEPAGE* lpTranslate = (struct LANGANDCODEPAGE*)pVal; + AddFileInfoValue(hDlg, pVersionData, lpTranslate[i], + j, pInfoString); + } + ++j; + } +// lpTranslate = (struct LANGANDCODEPAGE*)pVal; +/* + wsprintf(SubBlock, TEXT("\\StringFileInfo\\%04x%04x\\FileDescription"), + lpTranslate[i].wLanguage, lpTranslate[i].wCodePage); + // Retrieve file description for language and code page "i". + if (VerQueryValue(pVersionData, SubBlock, &pVal, &nValLen)) { + ListBox_InsertItemData(GetDlgItem(hDlg, IDC_LIST_PROP_VERSION_TYPES), i, _T("FileDescription")); + SendMessage(GetDlgItem(hDlg, IDC_LIST_PROP_VERSION_VALUES), WM_SETTEXT, 0, pVal); + } + */ + } + } + } +#endif + } + free(pVersionData); + } +} + +BOOL CALLBACK PropertiesDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) +{ + static struct PropertiesDialog* dlg; + SYSTEMTIME SystemTime; + FILETIME LocalFileTime; + TCHAR buffer[MAX_PATH]; + TCHAR text[100]; + int id; + int offset; + DWORD dwFileAttributes; + Entry* entry; + + switch (message) { + case WM_INITDIALOG: + dlg = (struct PropertiesDialog*)lParam; + ASSERT(dlg); + entry = ((struct PropertiesDialog*)lParam)->pEntry; + ASSERT(entry); + + GetWindowText(hDlg, text, sizeof(text)); + wsprintf(buffer, text, dlg->pEntry->data.cFileName); + SetWindowText(hDlg, buffer); + SetDlgItemText(hDlg, IDC_STATIC_PROP_FILENAME, dlg->pEntry->data.cFileName); + SetDlgItemText(hDlg, IDC_STATIC_PROP_PATH, dlg->pEntry->data.cAlternateFileName); + + if (entry->bhfi_valid) { + NUMBERFMT numFmt; + memset(&numFmt, 0, sizeof(numFmt)); + numFmt.NumDigits = 0; + numFmt.LeadingZero = 0; + numFmt.Grouping = 3; + numFmt.lpDecimalSep = _T("."); + numFmt.lpThousandSep = _T(","); + numFmt.NegativeOrder = 0; + + //entry->bhfi.nFileSizeLow; + //entry->bhfi.nFileSizeHigh; + //entry->bhfi.ftCreationTime + wsprintf(buffer, _T("%u"), entry->bhfi.nFileSizeLow); + if (GetNumberFormat(LOCALE_USER_DEFAULT, 0, buffer, &numFmt, + buffer + sizeof(buffer)/2, sizeof(buffer)/2)) { + SetDlgItemText(hDlg, IDC_STATIC_PROP_SIZE, buffer + sizeof(buffer)/2); + } else { + SetDlgItemText(hDlg, IDC_STATIC_PROP_SIZE, buffer); + } + } else { + } + + SetDlgItemText(hDlg, IDC_STATIC_PROP_LASTCHANGE, _T("Date?")); + if (FileTimeToLocalFileTime(&entry->bhfi.ftLastWriteTime, &LocalFileTime)) { + if (FileTimeToSystemTime(&LocalFileTime, &SystemTime)) { + if (GetDateFormat(LOCALE_USER_DEFAULT, DATE_SHORTDATE, &SystemTime, NULL, buffer, sizeof(buffer))) { +// SetDlgItemText(hDlg, IDC_STATIC_PROP_LASTCHANGE, buffer); + } + } + } + _tcscat(buffer, _T(" ")); + offset = _tcslen(buffer); + + if (FileTimeToLocalFileTime(&entry->bhfi.ftLastWriteTime, &LocalFileTime)) { + if (FileTimeToSystemTime(&LocalFileTime, &SystemTime)) { + if (GetTimeFormat(LOCALE_USER_DEFAULT, 0, &SystemTime, NULL, buffer + offset, sizeof(buffer) - offset)) { + SetDlgItemText(hDlg, IDC_STATIC_PROP_LASTCHANGE, buffer); + } + } + } + + dwFileAttributes = dlg->pEntry->bhfi.dwFileAttributes; + Button_SetCheck(GetDlgItem(hDlg,IDC_CHECK_READONLY), dwFileAttributes & FILE_ATTRIBUTE_READONLY ? BST_CHECKED : BST_UNCHECKED); + Button_SetCheck(GetDlgItem(hDlg,IDC_CHECK_ARCHIVE), dwFileAttributes & FILE_ATTRIBUTE_ARCHIVE ? BST_CHECKED : BST_UNCHECKED); + Button_SetCheck(GetDlgItem(hDlg,IDC_CHECK_COMPRESSED), dwFileAttributes & FILE_ATTRIBUTE_COMPRESSED ? BST_CHECKED : BST_UNCHECKED); + Button_SetCheck(GetDlgItem(hDlg,IDC_CHECK_HIDDEN), dwFileAttributes & FILE_ATTRIBUTE_HIDDEN ? BST_CHECKED : BST_UNCHECKED); + Button_SetCheck(GetDlgItem(hDlg,IDC_CHECK_SYSTEM), dwFileAttributes & FILE_ATTRIBUTE_SYSTEM ? BST_CHECKED : BST_UNCHECKED); + + CheckForFileInfo(hDlg, dlg->pEntry->data.cFileName); + return 1; + + case WM_COMMAND: + id = (int)wParam; + if (id == IDOK) { +// LPVOID lpData = NULL; // parameter for callback +// DWORD dwFlags = MOVEFILE_COPY_ALLOWED; // move options +// GetDlgItemText(hDlg, , buffer, sizeof(buffer)); +// GetDlgItemText(hDlg, , buffer, sizeof(buffer)); + EndDialog(hDlg, id); + } else if (id == IDCANCEL) { + EndDialog(hDlg, id); + } else { + switch(HIWORD(wParam)) { + case LBN_SELCHANGE: + if (LOWORD(wParam) == IDC_LIST_PROP_VERSION_TYPES) { + SelectVersionString(hDlg, lParam); + } +// { +// int idx = ListBox_GetCurSel(pane->hwnd); +// Entry* entry = (Entry*) ListBox_GetItemData(pane->hwnd, idx); +// if (pane == &child->left) set_curdir(child, entry); +// else pane->cur = entry; +// } + break; + case LBN_DBLCLK: + //activate_entry(child, pane); + break; + } + } + return 1; + } + return 0; +} diff --git a/rosapps/winfile/dialogs.h b/rosapps/winfile/dialogs.h index b60681275a1..d0c98d3f81c 100644 --- a/rosapps/winfile/dialogs.h +++ b/rosapps/winfile/dialogs.h @@ -38,11 +38,23 @@ struct ExecuteDialog { int cmdshow; }; +struct MoveFileDialog { + TCHAR cmd[MAX_PATH]; + int cmdshow; +}; + +struct PropertiesDialog { + TCHAR cmd[MAX_PATH]; + int cmdshow; + Entry* pEntry; +}; + BOOL CALLBACK ExecuteDialogWndProc(HWND, UINT, WPARAM, LPARAM); BOOL CALLBACK ViewFileTypeWndProc(HWND, UINT, WPARAM, LPARAM); BOOL CALLBACK OptionsConfirmationWndProc(HWND, UINT, WPARAM, LPARAM); BOOL CALLBACK MoveFileWndProc(HWND, UINT, WPARAM, LPARAM); +BOOL CALLBACK PropertiesDlgProc(HWND, UINT, WPARAM, LPARAM); #ifdef __cplusplus diff --git a/rosapps/winfile/framewnd.c b/rosapps/winfile/framewnd.c index 6dcfe538d58..06383ac5ebb 100644 --- a/rosapps/winfile/framewnd.c +++ b/rosapps/winfile/framewnd.c @@ -36,7 +36,6 @@ //#include #include -#include #include #define ASSERT assert @@ -44,6 +43,7 @@ #include "about.h" #include "framewnd.h" #include "childwnd.h" +#include "worker.h" #include "utils.h" #include "shell.h" #include "network.h" @@ -58,10 +58,6 @@ BOOL bInMenuLoop = FALSE; // Tells us if we are in the menu loop int nOldWidth; // Holds the previous client area width int nOldHeight; // Holds the previous client area height -static HANDLE hMonitorThreadEvent = NULL; // When this event becomes signaled then we run the monitor thread - -void MonitorThreadProc(void *lpParameter); - //////////////////////////////////////////////////////////////////////////////// // Local module support methods // @@ -81,10 +77,11 @@ static void resize_frame_rect(HWND hWnd, PRECT prect) SendMessage(Globals.hDriveBar, WM_SIZE, 0, 0); GetClientRect(Globals.hDriveBar, &rt); // new_top = --prect->top + rt.bottom+3; - new_top = --prect->top + rt.bottom+1; + new_top = --prect->top + rt.bottom+0; MoveWindow(Globals.hDriveBar, 0, prect->top, rt.right, new_top, TRUE); prect->top = new_top; - prect->bottom -= rt.bottom+2; +// prect->bottom -= rt.bottom+2; + prect->bottom -= rt.bottom-1; } if (IsWindowVisible(Globals.hStatusBar)) { SetupStatusBar(TRUE); @@ -172,7 +169,7 @@ static ChildWnd* alloc_child_window(LPCTSTR path) pChildWnd->pos.rcNormalPosition.right = CW_USEDEFAULT; pChildWnd->pos.rcNormalPosition.bottom = CW_USEDEFAULT; pChildWnd->nFocusPanel = 0; - pChildWnd->nSplitPos = 200; + pChildWnd->nSplitPos = 300; pChildWnd->sortOrder = SORT_NAME; pChildWnd->header_wdths_ok = FALSE; lstrcpy(pChildWnd->szPath, path); @@ -275,6 +272,7 @@ static void OnEnterMenuLoop(HWND hWnd) static void OnExitMenuLoop(HWND hWnd) { +/* RECT rc; int nParts[3]; @@ -286,7 +284,10 @@ static void OnExitMenuLoop(HWND hWnd) nParts[2] = rc.right; SendMessage(Globals.hStatusBar, SB_SETPARTS, 3, (long)nParts); SendMessage(Globals.hStatusBar, SB_SETTEXT, 0, (LPARAM)_T("")); - SetupStatusBar(TRUE); + */ + SendMessage(Globals.hStatusBar, SB_SETTEXT, 0, (LPARAM)_T("")); + bInMenuLoop = FALSE; + SetupStatusBar(TRUE); UpdateStatusBar(); } @@ -722,7 +723,7 @@ LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa } CheckShellAvailable(); CheckNetworkAvailable(); - _beginthread(MonitorThreadProc, 0, NULL); + CreateMonitorThread(hWnd); CreateChildWindow(-1); break; @@ -758,7 +759,7 @@ LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa break; case WM_TIMER: - SetEvent(hMonitorThreadEvent); + SignalMonitorEvent(); break; case WM_SIZE: @@ -775,7 +776,7 @@ LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa break; case WM_DESTROY: WinHelp(hWnd, _T("winfile"), HELP_QUIT, 0); - CloseHandle(hMonitorThreadEvent); + DestryMonitorThread(); PostQuitMessage(0); break; case WM_QUERYENDSESSION: @@ -791,50 +792,3 @@ LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa } - -void MonitorThreadProc(void *lpParameter) -{ -// ULONG OldProcessorUsage = 0; -// ULONG OldProcessCount = 0; - - // Create the event - hMonitorThreadEvent = CreateEvent(NULL, TRUE, TRUE, "Winfile Monitor Event"); - - // If we couldn't create the event then exit the thread - if (!hMonitorThreadEvent) - return; - - while (1) { - DWORD dwWaitVal; - - // Wait on the event - dwWaitVal = WaitForSingleObject(hMonitorThreadEvent, INFINITE); - - // If the wait failed then the event object must have been - // closed and the task manager is exiting so exit this thread - if (dwWaitVal == WAIT_FAILED) - return; - - if (dwWaitVal == WAIT_OBJECT_0) { - // Reset our event - ResetEvent(hMonitorThreadEvent); -#if 0 - TCHAR text[260]; - if ((ULONG)SendMessage(hProcessPageListCtrl, LVM_GETITEMCOUNT, 0, 0) != PerfDataGetProcessCount()) - SendMessage(hProcessPageListCtrl, LVM_SETITEMCOUNT, PerfDataGetProcessCount(), /*LVSICF_NOINVALIDATEALL|*/LVSICF_NOSCROLL); - if (IsWindowVisible(hProcessPage)) - InvalidateRect(hProcessPageListCtrl, NULL, FALSE); - if (OldProcessorUsage != PerfDataGetProcessorUsage()) { - OldProcessorUsage = PerfDataGetProcessorUsage(); - wsprintf(text, _T("CPU Usage: %3d%%"), OldProcessorUsage); - SendMessage(hStatusWnd, SB_SETTEXT, 1, (LPARAM)text); - } - if (OldProcessCount != PerfDataGetProcessCount()) { - OldProcessCount = PerfDataGetProcessCount(); - wsprintf(text, _T("Processes: %d"), OldProcessCount); - SendMessage(hStatusWnd, SB_SETTEXT, 0, (LPARAM)text); - } -#endif - } - } -} diff --git a/rosapps/winfile/listview.c b/rosapps/winfile/listview.c index 02ab11fbb24..359500d7b08 100644 --- a/rosapps/winfile/listview.c +++ b/rosapps/winfile/listview.c @@ -40,6 +40,7 @@ #include "main.h" #include "listview.h" +#include "dialogs.h" #include "run.h" #include "trace.h" @@ -322,7 +323,23 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) case ID_FILE_COPY_CLIPBOARD: case ID_FILE_DELETE: case ID_FILE_RENAME: + break; case ID_FILE_PROPERTIES: + { + LVITEM item; + item.mask = LVIF_PARAM; + item.iItem = ListView_GetNextItem(hWnd, -1, LVNI_SELECTED); + if (item.iItem != -1) { + if (ListView_GetItem(hWnd, &item)) { + Entry* entry = (Entry*)item.lParam; + struct PropertiesDialog dlg = { _T("empty"), 0, entry }; + if (DialogBoxParam(Globals.hInstance, MAKEINTRESOURCE(IDD_DIALOG_PROPERTIES), hWnd, PropertiesDlgProc, (LPARAM)&dlg) == IDOK) { + } + } + } + } + break; + case ID_FILE_COMPRESS: case ID_FILE_UNCOMPRESS: break; diff --git a/rosapps/winfile/main.c b/rosapps/winfile/main.c index 676f90275c5..1b2edad34e2 100644 --- a/rosapps/winfile/main.c +++ b/rosapps/winfile/main.c @@ -374,10 +374,11 @@ void SetupStatusBar(BOOL bResize) // SendMessage(Globals.hStatusBar, SB_SETPARTS, 2, (LPARAM)&parts); // Create the status bar panes - nParts[0] = 150; - nParts[1] = 220; - nParts[2] = 100; - nParts[3] = 100; + nParts[0] = 350; + nParts[1] = 700; + nParts[2] = 800; + nParts[3] = 900; + if (bResize) SendMessage(Globals.hStatusBar, WM_SIZE, 0, 0); SendMessage(Globals.hStatusBar, SB_SETPARTS, 4, (long)nParts); @@ -385,15 +386,15 @@ void SetupStatusBar(BOOL bResize) void UpdateStatusBar(void) { - TCHAR text[260]; - DWORD size; +// TCHAR text[260]; +// DWORD size; // size = sizeof(text)/sizeof(TCHAR); // GetUserName(text, &size); -// SendMessage(Globals.hStatusBar, SB_SETTEXT, 2, (LPARAM)text); - size = sizeof(text)/sizeof(TCHAR); - GetComputerName(text, &size); - SendMessage(Globals.hStatusBar, SB_SETTEXT, 3, (LPARAM)text); +// SendMessage(Globals.hStatusBar, SB_SETTEXT, 0, (LPARAM)text); +// size = sizeof(text)/sizeof(TCHAR); +// GetComputerName(text, &size); +// SendMessage(Globals.hStatusBar, SB_SETTEXT, 1, (LPARAM)text); } diff --git a/rosapps/winfile/resource.h b/rosapps/winfile/resource.h index 836388e506e..9b2665f692e 100644 --- a/rosapps/winfile/resource.h +++ b/rosapps/winfile/resource.h @@ -10,7 +10,6 @@ #define ID_SECURITY_MENU 6 #define ID_WINDOW_MENU 7 #define ID_HELP_MENU 8 - #define IDS_LIST_COLUMN_FIRST 91 #define IDS_LIST_COLUMN_NAME 91 #define IDS_LIST_COLUMN_SIZE 92 @@ -19,6 +18,7 @@ #define IDS_LIST_COLUMN_ATTRIB 95 #define IDS_LIST_COLUMN_DOSNAME 96 #define IDS_LIST_COLUMN_LAST 96 +#define ID_CMD_FIRST 100 #define IDD_ABOUTBOX 104 #define IDS_APP_TITLE 105 #define IDI_WINFILE 107 @@ -38,6 +38,7 @@ #define IDD_DIALOG_VIEW_TYPE 145 #define IDD_DIALOG_OPTIONS_CONFIRMATON 146 #define IDR_ACCELERATOR1 147 +#define IDD_DIALOG_PROPERTIES 148 #define ID_WINDOW_CLOSE 798 #define ID_WINDOW_CLOSEALL 799 #define IDC_VIEW_TYPE_MASK 999 @@ -50,14 +51,25 @@ #define IDC_VIEW_TYPE_SYSFILES 1005 #define IDC_CONFIRMATION_FILE_DELETE 1006 #define IDC_CONFIRMATION_DIR_DELETE 1007 +#define IDC_CHECK_READONLY 1007 #define IDC_CONFIRMATION_FILE_REPLACE 1008 +#define IDC_CHECK_ARCHIVE 1008 #define IDC_CONFIRMATION_MOUSE_ACTIONS 1009 +#define IDC_CHECK_COMPRESSED 1009 #define IDC_CONFIRMATION_DISK_COMMANDS 1010 +#define IDC_CHECK_HIDDEN 1010 #define IDC_CONFIRMATION_MODIFY_SYSTEM 1011 - -#define ID_CMD_FIRST 100 -#define ID_CMD_LAST 32830 - +#define IDC_CHECK_SYSTEM 1011 +#define IDC_LIST_PROP_VERSION_TYPES 1012 +#define IDC_LIST_PROP_VERSION_VALUES 1013 +#define IDC_STATIC_PROP_FILENAME 1015 +#define IDC_STATIC_PROP_PATH 1016 +#define IDC_STATIC_PROP_LASTCHANGE 1017 +#define IDC_STATIC_PROP_VERSION 1018 +#define IDC_STATIC_PROP_COPYRIGHT 1019 +#define IDC_STATIC_PROP_SIZE 1020 +#define IDC_EDIT1 1021 +#define ID_TREE_COLLAPSE_BRANCH 32768 #define ID_FILE_OPEN 32769 #define ID_FILE_MOVE 32770 #define ID_FILE_COPY 32771 @@ -85,7 +97,6 @@ #define ID_TREE_EXPAND_ONE_LEVEL 32793 #define ID_TREE_EXPAND_BRANCH 32794 #define ID_TREE_EXPAND_ALL 32795 -#define ID_TREE_COLLAPSE_BRANCH 32768 #define ID_TREE_INDICATE_EXPANDABLE_BRANCHES 32796 #define ID_VIEW_TREE_DIRECTORY 32797 #define ID_VIEW_TREE_ONLY 32798 @@ -120,6 +131,7 @@ #define ID_HELP_CONTENTS 32827 #define ID_HELP_SEARCH_HELP 32828 #define ID_HELP_HOW_TO_USE_HELP 32829 +#define ID_CMD_LAST 32830 #define ID_HELP_ABOUT 32830 #define IDC_LICENSE_EDIT 32831 #define IDS_LICENSE 32832 @@ -129,9 +141,9 @@ // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 148 +#define _APS_NEXT_RESOURCE_VALUE 149 #define _APS_NEXT_COMMAND_VALUE 32832 -#define _APS_NEXT_CONTROL_VALUE 1007 +#define _APS_NEXT_CONTROL_VALUE 1022 #define _APS_NEXT_SYMED_VALUE 110 #endif #endif diff --git a/rosapps/winfile/sort.c b/rosapps/winfile/sort.c index eb69df50273..ea1a03275c9 100644 --- a/rosapps/winfile/sort.c +++ b/rosapps/winfile/sort.c @@ -34,8 +34,6 @@ #include #endif -#include -//#include #include #include #include diff --git a/rosapps/winfile/treeview.c b/rosapps/winfile/treeview.c index 77d432d0969..42d8dbea14d 100644 --- a/rosapps/winfile/treeview.c +++ b/rosapps/winfile/treeview.c @@ -423,6 +423,44 @@ static BOOL OnSelChanged(NMTREEVIEW* pnmtv) } */ +void UpdateStatus(HWND hWnd, Entry* pEntry) +{ + int file_count = 0; + int files_size = 0; + TCHAR suffix[10]; + TCHAR number[50]; + TCHAR Text[260]; + + while (pEntry) { + if (pEntry->data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { + } else { + ++file_count; + files_size += pEntry->data.nFileSizeLow; + } + pEntry = pEntry->next; + }; + + _tcscpy(suffix, _T(" bytes")); + { + NUMBERFMT numFmt; + memset(&numFmt, 0, sizeof(numFmt)); + numFmt.NumDigits = 0; + numFmt.LeadingZero = 0; + numFmt.Grouping = 3; + numFmt.lpDecimalSep = _T("."); + numFmt.lpThousandSep = _T(","); + numFmt.NegativeOrder = 0; + + wsprintf(Text, _T("%d"), files_size); + if (GetNumberFormat(LOCALE_USER_DEFAULT, 0, Text, &numFmt, number, sizeof(number))) { + wsprintf(Text, _T("Total %d file(s) (%s%s)"), file_count, number, suffix); + } else { + wsprintf(Text, _T("Total %d file(s) (%d%s)"), file_count, files_size, suffix); + } + SendMessage(Globals.hStatusBar, SB_SETTEXT, 1, (LPARAM)Text); + } +} + //////////////////////////////////////////////////////////////////////////////// static WNDPROC g_orgTreeWndProc; @@ -451,6 +489,9 @@ static LRESULT CALLBACK TreeWndProc(HWND hWnd, UINT message, WPARAM wParam, LPAR return OnExpanding(hWnd, (NMTREEVIEW*)lParam); break; case TVN_SELCHANGED: + + UpdateStatus(hWnd, child->left.cur->down); + break; // return OnSelChanged((NMTREEVIEW*)lParam); // break; #if 0 @@ -473,12 +514,7 @@ static LRESULT CALLBACK TreeWndProc(HWND hWnd, UINT message, WPARAM wParam, LPAR //ListBox_SetSel(hWnd, TRUE, 1); //TODO: check menu items if (!child->nFocusPanel) { - int file_count = 50; - int files_size = 1115467; - TCHAR suffix[10]; - TCHAR Text[260]; - wsprintf(Text, _T("Total %d file(s) (%d%s)"), file_count, files_size, suffix); - SendMessage(Globals.hStatusBar, SB_SETTEXT, 2, (LPARAM)Text); + UpdateStatus(hWnd, pane->cur); } break; case WM_KEYDOWN: diff --git a/rosapps/winfile/winfile.rc b/rosapps/winfile/winfile.rc index e2ec87acfba..93151cd569b 100644 --- a/rosapps/winfile/winfile.rc +++ b/rosapps/winfile/winfile.rc @@ -63,7 +63,7 @@ BEGIN , GRAYED MENUITEM "&Delete...\tDel", ID_FILE_DELETE, GRAYED MENUITEM "Re&name...\t", ID_FILE_RENAME, GRAYED - MENUITEM "Proper&ties...\tAlt+Enter", ID_FILE_PROPERTIES, GRAYED + MENUITEM "Proper&ties...\tAlt+Enter", ID_FILE_PROPERTIES MENUITEM SEPARATOR MENUITEM "Compre&ss...\t", ID_FILE_COMPRESS, GRAYED MENUITEM "&Uncompress...\t", ID_FILE_UNCOMPRESS, GRAYED @@ -103,7 +103,6 @@ BEGIN MENUITEM "Expand &Branch\t*", ID_TREE_EXPAND_BRANCH MENUITEM "Expand &All\tCtrl+*", ID_TREE_EXPAND_ALL MENUITEM "Collapse Branch\t-", ID_TREE_COLLAPSE_BRANCH - MENUITEM SEPARATOR MENUITEM "&Indicate Expandable Branches", ID_TREE_INDICATE_EXPANDABLE_BRANCHES @@ -243,6 +242,7 @@ END STRINGTABLE DISCARDABLE BEGIN + ID_TREE_COLLAPSE_BRANCH "Collapses all directories of the selected directory" ID_FILE_OPEN "Opens selected item" ID_FILE_MOVE "Moves selected item" ID_FILE_COPY "Copies files and directories" @@ -274,7 +274,6 @@ BEGIN ID_TREE_EXPAND_ONE_LEVEL "Displays another level of a directory" ID_TREE_EXPAND_BRANCH "Displays all levels of a directory" ID_TREE_EXPAND_ALL "Displays all levels of all directories" - ID_TREE_COLLAPSE_BRANCH "Collapses all directories of the selected directory" ID_TREE_INDICATE_EXPANDABLE_BRANCHES "Indicates directories that have sub-directories" ID_VIEW_TREE_DIRECTORY "Displays the directory tree and the contents of the current directory" @@ -418,6 +417,45 @@ BEGIN WS_TABSTOP,13,71,132,8 END +IDD_DIALOG_PROPERTIES DIALOG DISCARDABLE 0, 0, 248, 215 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Properties for %s" +FONT 8, "MS Sans Serif" +BEGIN + DEFPUSHBUTTON "OK",IDOK,191,83,50,14 + PUSHBUTTON "Cancel",IDCANCEL,191,101,50,14 + LTEXT "&File Name:",IDC_STATIC,7,7,59,9 + LTEXT "Static",IDC_STATIC_PROP_PATH,71,18,162,9 + LTEXT "&Path",IDC_STATIC,7,18,59,9 + LTEXT "Last Change:",IDC_STATIC,7,29,59,9 + LTEXT "Version:",IDC_STATIC,7,40,59,9 + LTEXT "Static",IDC_STATIC_PROP_FILENAME,71,7,162,9,WS_TABSTOP + LTEXT "Cop&yright:",IDC_STATIC,7,51,59,9 + LTEXT "Size:",IDC_STATIC,7,62,59,9 + LTEXT "Static",IDC_STATIC_PROP_LASTCHANGE,71,29,162,9 + GROUPBOX "Attributes",IDC_STATIC,7,79,158,46 + GROUPBOX "&Version Information",IDC_STATIC,7,129,234,79 + CONTROL "&Read Only",IDC_CHECK_READONLY,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,17,91,68,9 + CONTROL "&Archive",IDC_CHECK_ARCHIVE,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,17,101,68,9 + CONTROL "&Compressed",IDC_CHECK_COMPRESSED,"Button", + BS_AUTOCHECKBOX | WS_TABSTOP,17,111,68,9 + CONTROL "H&idden",IDC_CHECK_HIDDEN,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,92,91,68,9 + CONTROL "&System",IDC_CHECK_SYSTEM,"Button",BS_AUTOCHECKBOX | + WS_TABSTOP,92,101,68,9 + LTEXT "Static",IDC_STATIC_PROP_VERSION,71,40,162,9 + LTEXT "Static",IDC_STATIC_PROP_COPYRIGHT,71,51,162,9 + LTEXT "Static",IDC_STATIC_PROP_SIZE,71,62,162,9 + LISTBOX IDC_LIST_PROP_VERSION_TYPES,13,139,107,63,LBS_SORT | + LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP +// LISTBOX IDC_LIST_PROP_VERSION_VALUES,123,139,111,63,LBS_SORT | +// LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP + EDITTEXT IDC_LIST_PROP_VERSION_VALUES,123,139,111,63,ES_MULTILINE | ES_READONLY | + WS_VSCROLL +END + #ifdef APSTUDIO_INVOKED ///////////////////////////////////////////////////////////////////////////// @@ -472,6 +510,14 @@ BEGIN TOPMARGIN, 7 BOTTOMMARGIN, 82 END + + IDD_DIALOG_PROPERTIES, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 241 + TOPMARGIN, 7 + BOTTOMMARGIN, 208 + END END #endif // APSTUDIO_INVOKED @@ -499,18 +545,18 @@ BEGIN BEGIN BLOCK "0c0904b0" BEGIN - VALUE "Comments", "\0" - VALUE "CompanyName", "None\0" - VALUE "FileDescription", "winfile\0" + VALUE "Comments", "Absolutely no warranties whatsoever - Use at your own risk\0" + VALUE "CompanyName", "ReactWare\0" + VALUE "FileDescription", "ReactOS File Manager by Robert Dickenson\0" VALUE "FileVersion", "1, 0, 0, 1\0" VALUE "InternalName", "winfile\0" - VALUE "LegalCopyright", "Copyright © 2002\0" + VALUE "LegalCopyright", "Copyright © 2002 Robert Dickenson\0" VALUE "LegalTrademarks", "\0" VALUE "OriginalFilename", "winfile.exe\0" VALUE "PrivateBuild", "\0" - VALUE "ProductName", "None winfile\0" + VALUE "ProductName", "ReactOS File Manager\0" VALUE "ProductVersion", "1, 0, 0, 1\0" - VALUE "SpecialBuild", "\0" + VALUE "SpecialBuild", "Non-versioned Development Beta Release\0" END END BLOCK "VarFileInfo"