mirror of
https://github.com/reactos/reactos.git
synced 2024-12-25 16:50:57 +00:00
Updated treeview and listview functionality.
svn path=/trunk/; revision=3242
This commit is contained in:
parent
1ad1b97103
commit
21214f6b8c
8 changed files with 274 additions and 227 deletions
|
@ -20,8 +20,8 @@
|
|||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef __CHILD_WND_H__
|
||||
#define __CHILD_WND_H__
|
||||
#ifndef __CHILDWND_H__
|
||||
#define __CHILDWND_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -39,4 +39,4 @@ LRESULT CALLBACK ChildWndProc(HWND, UINT, WPARAM, LPARAM);
|
|||
};
|
||||
#endif
|
||||
|
||||
#endif // __CHILD_WND_H__
|
||||
#endif // __CHILDWND_H__
|
||||
|
|
|
@ -166,11 +166,9 @@ void free_entries(Entry* parent)
|
|||
|
||||
if (next) {
|
||||
parent->down = 0;
|
||||
|
||||
do {
|
||||
entry = next;
|
||||
next = entry->next;
|
||||
|
||||
free_entries(entry);
|
||||
free(entry);
|
||||
} while(next);
|
||||
|
@ -180,6 +178,7 @@ void free_entries(Entry* parent)
|
|||
// insert listbox entries after index idx
|
||||
void insert_entries(Pane* pane, Entry* parent, int idx)
|
||||
{
|
||||
/*
|
||||
Entry* entry = parent;
|
||||
|
||||
if (!entry)
|
||||
|
@ -206,12 +205,14 @@ void insert_entries(Pane* pane, Entry* parent, int idx)
|
|||
insert_entries(pane, entry->down, idx);
|
||||
}
|
||||
ShowWindow(pane->hWnd, SW_SHOW);
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
void scan_entry(ChildWnd* child, Entry* entry)
|
||||
{
|
||||
TCHAR path[MAX_PATH];
|
||||
/*
|
||||
int idx = ListBox_GetCurSel(child->left.hWnd);
|
||||
HCURSOR crsrOld = SetCursor(LoadCursor(0, IDC_WAIT));
|
||||
|
||||
|
@ -228,14 +229,14 @@ void scan_entry(ChildWnd* child, Entry* entry)
|
|||
|
||||
// empty right pane
|
||||
ListBox_ResetContent(child->right.hWnd);
|
||||
|
||||
*/
|
||||
// release memory
|
||||
free_entries(entry);
|
||||
|
||||
// read contents from disk
|
||||
get_path(entry, path);
|
||||
read_directory(entry, path, child->sortOrder);
|
||||
|
||||
/*
|
||||
// insert found entries in right pane
|
||||
insert_entries(&child->right, entry->down, -1);
|
||||
calc_widths(&child->right, FALSE);
|
||||
|
@ -246,6 +247,7 @@ void scan_entry(ChildWnd* child, Entry* entry)
|
|||
child->header_wdths_ok = FALSE;
|
||||
|
||||
SetCursor(crsrOld);
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
@ -271,14 +273,14 @@ BOOL expand_entry(ChildWnd* child, Entry* dir)
|
|||
// no subdirectories ?
|
||||
if (!(p->data.dwFileAttributes&FILE_ATTRIBUTE_DIRECTORY))
|
||||
return FALSE;
|
||||
|
||||
/*
|
||||
idx = ListBox_FindItemData(child->left.hWnd, 0, dir);
|
||||
|
||||
*/
|
||||
dir->expanded = TRUE;
|
||||
|
||||
// insert entries in left pane
|
||||
insert_entries(&child->left, p, idx);
|
||||
|
||||
/*
|
||||
if (!child->header_wdths_ok) {
|
||||
if (calc_widths(&child->left, FALSE)) {
|
||||
#ifndef _NO_EXTENSIONS
|
||||
|
@ -288,7 +290,7 @@ BOOL expand_entry(ChildWnd* child, Entry* dir)
|
|||
child->header_wdths_ok = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
|
||||
//#include <shellapi.h>
|
||||
#include <windowsx.h>
|
||||
#include <process.h>
|
||||
#include <assert.h>
|
||||
#define ASSERT assert
|
||||
|
||||
|
@ -57,6 +58,9 @@ 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
|
||||
|
@ -718,6 +722,7 @@ LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
|
|||
}
|
||||
CheckShellAvailable();
|
||||
CheckNetworkAvailable();
|
||||
_beginthread(MonitorThreadProc, 0, NULL);
|
||||
CreateChildWindow(-1);
|
||||
break;
|
||||
|
||||
|
@ -751,6 +756,11 @@ LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
|
|||
return DefFrameProc(hWnd, Globals.hMDIClient, message, wParam, lParam);
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_TIMER:
|
||||
SetEvent(hMonitorThreadEvent);
|
||||
break;
|
||||
|
||||
case WM_SIZE:
|
||||
resize_frame_client(hWnd);
|
||||
break;
|
||||
|
@ -765,6 +775,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);
|
||||
PostQuitMessage(0);
|
||||
break;
|
||||
case WM_QUERYENDSESSION:
|
||||
|
@ -778,3 +789,52 @@ LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,28 +34,20 @@
|
|||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
#include <shellapi.h>
|
||||
//#include <winspool.h>
|
||||
#include <windowsx.h>
|
||||
#include <shellapi.h>
|
||||
#include <ctype.h>
|
||||
#include <assert.h>
|
||||
#define ASSERT assert
|
||||
//#include <assert.h>
|
||||
//#define ASSERT assert
|
||||
|
||||
#include "main.h"
|
||||
#include "listview.h"
|
||||
#include "dialogs.h"
|
||||
#include "utils.h"
|
||||
#include "run.h"
|
||||
#include "trace.h"
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// Global Variables:
|
||||
// Global and Local Variables:
|
||||
//
|
||||
|
||||
extern HINSTANCE hInst;
|
||||
|
||||
static WNDPROC g_orgListWndProc;
|
||||
|
||||
|
||||
|
@ -63,23 +55,6 @@ static WNDPROC g_orgListWndProc;
|
|||
// Local module support methods
|
||||
//
|
||||
|
||||
static void init_output(HWND hWnd)
|
||||
{
|
||||
TCHAR b[16];
|
||||
HFONT old_font;
|
||||
HDC hdc = GetDC(hWnd);
|
||||
|
||||
if (GetNumberFormat(LOCALE_USER_DEFAULT, 0, _T("1000"), 0, b, 16) > 4)
|
||||
Globals.num_sep = b[1];
|
||||
else
|
||||
Globals.num_sep = _T('.');
|
||||
|
||||
old_font = SelectFont(hdc, Globals.hFont);
|
||||
GetTextExtentPoint32(hdc, _T(" "), 1, &Globals.spaceSize);
|
||||
SelectFont(hdc, old_font);
|
||||
ReleaseDC(hWnd, hdc);
|
||||
}
|
||||
|
||||
static void AddEntryToList(HWND hwndLV, int idx, Entry* entry)
|
||||
{
|
||||
LVITEM item;
|
||||
|
@ -116,7 +91,6 @@ static void InsertListEntries(HWND hWnd, Entry* entry, int idx)
|
|||
if (entry->data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
||||
continue;
|
||||
#endif
|
||||
//ListBox_InsertItemData(hWnd, idx, entry);
|
||||
AddEntryToList(hWnd, idx, entry);
|
||||
++idx;
|
||||
}
|
||||
|
@ -150,99 +124,16 @@ static void CreateListColumns(HWND hWndListView)
|
|||
}
|
||||
}
|
||||
|
||||
static HWND CreateListView(HWND hwndParent, int id)
|
||||
{
|
||||
RECT rcClient; // dimensions of client area
|
||||
HWND hwndLV; // handle to list view control
|
||||
|
||||
// Get the dimensions of the parent window's client area, and create the list view control.
|
||||
GetClientRect(hwndParent, &rcClient);
|
||||
hwndLV = CreateWindowEx(0, WC_LISTVIEW, _T("List View"),
|
||||
// WS_VISIBLE | WS_CHILD | WS_BORDER | LVS_REPORT | LVS_NOCOLUMNHEADER,
|
||||
WS_VISIBLE | WS_CHILD | WS_BORDER | LVS_REPORT,
|
||||
0, 0, rcClient.right, rcClient.bottom,
|
||||
hwndParent, (HMENU)id, hInst, NULL);
|
||||
|
||||
// Initialize the image list, and add items to the control.
|
||||
/*
|
||||
if (!InitListViewImageLists(hwndLV) ||
|
||||
!InitListViewItems(hwndLV, lpszPathName)) {
|
||||
DestroyWindow(hwndLV);
|
||||
return FALSE;
|
||||
}
|
||||
*/
|
||||
ListView_SetExtendedListViewStyle(hwndLV, LVS_EX_FULLROWSELECT);
|
||||
CreateListColumns(hwndLV);
|
||||
|
||||
return hwndLV;
|
||||
}
|
||||
|
||||
/*
|
||||
int GetNumberFormat(
|
||||
LCID Locale, // locale
|
||||
DWORD dwFlags, // options
|
||||
LPCTSTR lpValue, // input number string
|
||||
CONST NUMBERFMT *lpFormat, // formatting information
|
||||
LPTSTR lpNumberStr, // output buffer
|
||||
int cchNumber // size of output buffer
|
||||
);
|
||||
*/
|
||||
/*
|
||||
typedef struct _numberfmt {
|
||||
UINT NumDigits;
|
||||
UINT LeadingZero;
|
||||
UINT Grouping;
|
||||
LPTSTR lpDecimalSep;
|
||||
LPTSTR lpThousandSep;
|
||||
UINT NegativeOrder;
|
||||
} NUMBERFMT, *LPNUMBERFMT;
|
||||
*/
|
||||
/*
|
||||
typedef struct _BY_HANDLE_FILE_INFORMATION {
|
||||
DWORD dwFileAttributes;
|
||||
FILETIME ftCreationTime;
|
||||
FILETIME ftLastAccessTime;
|
||||
FILETIME ftLastWriteTime;
|
||||
DWORD dwVolumeSerialNumber;
|
||||
DWORD nFileSizeHigh;
|
||||
DWORD nFileSizeLow;
|
||||
DWORD nNumberOfLinks;
|
||||
DWORD nFileIndexHigh;
|
||||
DWORD nFileIndexLow;
|
||||
} BY_HANDLE_FILE_INFORMATION, *PBY_HANDLE_FILE_INFORMATION;
|
||||
|
||||
GetDriveTypeW
|
||||
GetFileType
|
||||
GetLocaleInfoW
|
||||
GetNumberFormatW
|
||||
|
||||
BOOL FileTimeToLocalFileTime(
|
||||
CONST FILETIME *lpFileTime, // UTC file time to convert
|
||||
LPFILETIME lpLocalFileTime // converted file time
|
||||
);
|
||||
|
||||
BOOL FileTimeToSystemTime(
|
||||
CONST FILETIME *lpFileTime, // file time to convert
|
||||
LPSYSTEMTIME lpSystemTime // receives system time
|
||||
);
|
||||
*/
|
||||
|
||||
// OnGetDispInfo - processes the LVN_GETDISPINFO
|
||||
// notification message.
|
||||
|
||||
// OnGetDispInfo - processes the LVN_GETDISPINFO notification message.
|
||||
static void OnGetDispInfo(NMLVDISPINFO* plvdi)
|
||||
{
|
||||
SYSTEMTIME SystemTime;
|
||||
FILETIME LocalFileTime;
|
||||
static TCHAR buffer[200];
|
||||
|
||||
// LVITEM* pItem = &(plvdi->item);
|
||||
// Entry* entry = (Entry*)pItem->lParam;
|
||||
Entry* entry = (Entry*)plvdi->item.lParam;
|
||||
ASSERT(entry);
|
||||
|
||||
plvdi->item.pszText = NULL;
|
||||
|
||||
switch (plvdi->item.iSubItem) {
|
||||
case 0:
|
||||
plvdi->item.pszText = entry->data.cFileName;
|
||||
|
@ -353,35 +244,6 @@ static BOOL OnEndLabelEdit(NMLVDISPINFO* plvdi)
|
|||
// many characters in the field.
|
||||
}
|
||||
|
||||
/*
|
||||
typedef struct _BY_HANDLE_FILE_INFORMATION {
|
||||
DWORD dwFileAttributes;
|
||||
FILETIME ftCreationTime;
|
||||
FILETIME ftLastAccessTime;
|
||||
FILETIME ftLastWriteTime;
|
||||
DWORD dwVolumeSerialNumber;
|
||||
DWORD nFileSizeHigh;
|
||||
DWORD nFileSizeLow;
|
||||
DWORD nNumberOfLinks;
|
||||
DWORD nFileIndexHigh;
|
||||
DWORD nFileIndexLow;
|
||||
} BY_HANDLE_FILE_INFORMATION, *PBY_HANDLE_FILE_INFORMATION;
|
||||
*/
|
||||
/*
|
||||
typedef struct _WIN32_FIND_DATA {
|
||||
DWORD dwFileAttributes;
|
||||
FILETIME ftCreationTime;
|
||||
FILETIME ftLastAccessTime;
|
||||
FILETIME ftLastWriteTime;
|
||||
DWORD nFileSizeHigh;
|
||||
DWORD nFileSizeLow;
|
||||
DWORD dwReserved0;
|
||||
DWORD dwReserved1;
|
||||
TCHAR cFileName[ MAX_PATH ];
|
||||
TCHAR cAlternateFileName[ 14 ];
|
||||
} WIN32_FIND_DATA, *PWIN32_FIND_DATA;
|
||||
*/
|
||||
|
||||
static int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
|
||||
{
|
||||
Entry* pItem1 = (Entry*)lParam1;
|
||||
|
@ -420,6 +282,17 @@ static void CmdSortItems(HWND hWnd, UINT cmd)
|
|||
CheckMenuItem(Globals.hMenuView, cmd, MF_BYCOMMAND | MF_CHECKED);
|
||||
}
|
||||
|
||||
void RefreshList(HWND hWnd, Entry* entry)
|
||||
{
|
||||
if (hWnd != NULL) {
|
||||
ListView_DeleteAllItems(hWnd);
|
||||
if (entry != NULL) {
|
||||
//TRACE("RefreshList(...) entry name: %s\n", entry->data.cFileName);
|
||||
InsertListEntries(hWnd, entry, -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
UINT cmd = LOWORD(wParam);
|
||||
|
@ -432,7 +305,6 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
LVITEM item;
|
||||
item.mask = LVIF_PARAM;
|
||||
// UINT selected_count = ListView_GetSelectedCount(hWnd);
|
||||
|
||||
item.iItem = ListView_GetNextItem(hWnd, -1, LVNI_SELECTED);
|
||||
if (item.iItem != -1) {
|
||||
if (ListView_GetItem(hWnd, &item)) {
|
||||
|
@ -466,6 +338,9 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
case ID_VIEW_SORT_BY_SIZE:
|
||||
case ID_VIEW_SORT_BY_DATE:
|
||||
CmdSortItems(hWnd, cmd);
|
||||
break;
|
||||
case ID_WINDOW_REFRESH:
|
||||
RefreshList(hWnd, NULL/*entry*/);
|
||||
break;
|
||||
default:
|
||||
return FALSE;
|
||||
|
@ -483,24 +358,18 @@ static LRESULT CALLBACK ListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPAR
|
|||
ASSERT(child);
|
||||
|
||||
switch (message) {
|
||||
/*
|
||||
case WM_CREATE:
|
||||
//CreateListView(hWnd);
|
||||
return 0;
|
||||
*/
|
||||
case WM_COMMAND:
|
||||
if (!_CmdWndProc(hWnd, message, wParam, lParam)) {
|
||||
return CallWindowProc(g_orgListWndProc, hWnd, message, wParam, lParam);
|
||||
if (_CmdWndProc(hWnd, message, wParam, lParam)) {
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
case WM_DISPATCH_COMMAND:
|
||||
return _CmdWndProc(hWnd, message, wParam, lParam);
|
||||
break;
|
||||
case WM_NOTIFY:
|
||||
switch (((LPNMHDR)lParam)->code) {
|
||||
case LVN_GETDISPINFO:
|
||||
OnGetDispInfo((NMLVDISPINFO*)lParam);
|
||||
break;
|
||||
return 0;
|
||||
case NM_DBLCLK:
|
||||
{
|
||||
NMITEMACTIVATE* nmitem = (LPNMITEMACTIVATE)lParam;
|
||||
|
@ -531,86 +400,57 @@ static LRESULT CALLBACK ListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPAR
|
|||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
return 0;
|
||||
case LVN_ENDLABELEDIT:
|
||||
return OnEndLabelEdit((NMLVDISPINFO*)lParam);
|
||||
break;
|
||||
default:
|
||||
return CallWindowProc(g_orgListWndProc, hWnd, message, wParam, lParam);
|
||||
}
|
||||
// return 0;
|
||||
break;
|
||||
/*
|
||||
case WM_SETFOCUS:
|
||||
child->nFocusPanel = pane==&child->right? 1: 0;
|
||||
ListBox_SetSel(hWnd, TRUE, 1);
|
||||
//TODO: check menu items
|
||||
break;
|
||||
case WM_KEYDOWN:
|
||||
if (wParam == VK_TAB) {
|
||||
//TODO: SetFocus(Globals.hDriveBar)
|
||||
SetFocus(child->nFocusPanel? child->left.hWnd: child->right.hWnd);
|
||||
}
|
||||
break;
|
||||
*/
|
||||
default:
|
||||
return CallWindowProc(g_orgListWndProc, hWnd, message, wParam, lParam);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
case WM_SETFOCUS:
|
||||
child->nFocusPanel = pane==&child->right? 1: 0;
|
||||
//ListView_SetSelectionMark(hWnd, 0);
|
||||
//TODO: check menu items
|
||||
break;
|
||||
|
||||
case WM_KEYDOWN:
|
||||
if (wParam == VK_TAB) {
|
||||
//TODO: SetFocus(Globals.hDriveBar)
|
||||
SetFocus(child->nFocusPanel ? child->left.hWnd: child->right.hWnd);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return CallWindowProc(g_orgListWndProc, hWnd, message, wParam, lParam);
|
||||
}
|
||||
|
||||
void CreateListWnd(HWND parent, Pane* pane, int id, LPTSTR lpszPathName)
|
||||
{
|
||||
// static int s_init = 0;
|
||||
RECT rcClient; // dimensions of client area
|
||||
Entry* entry = pane->root;
|
||||
|
||||
pane->treePane = 0;
|
||||
#if 1
|
||||
pane->hWnd = CreateListView(parent, id);
|
||||
#else
|
||||
pane->hWnd = CreateWindow(_T("ListBox"), _T(""), WS_CHILD|WS_VISIBLE|WS_HSCROLL|WS_VSCROLL|
|
||||
LBS_DISABLENOSCROLL|LBS_NOINTEGRALHEIGHT|LBS_OWNERDRAWFIXED|LBS_NOTIFY,
|
||||
0, 0, 0, 0, parent, (HMENU)id, Globals.hInstance, 0);
|
||||
#endif
|
||||
|
||||
GetClientRect(parent, &rcClient);
|
||||
pane->hWnd = CreateWindowEx(0, WC_LISTVIEW, _T("List View"),
|
||||
WS_VISIBLE | WS_CHILD | WS_BORDER | LVS_REPORT/* | LVS_NOCOLUMNHEADER*/,
|
||||
0, 0, rcClient.right, rcClient.bottom,
|
||||
parent, (HMENU)id, hInst, NULL);
|
||||
// Initialize the image list, and add items to the control.
|
||||
/*
|
||||
if (!InitListViewImageLists(pane->hWnd) ||
|
||||
!InitListViewItems(pane->hWnd, lpszPathName)) {
|
||||
DestroyWindow(pane->hWnd);
|
||||
return FALSE;
|
||||
}
|
||||
*/
|
||||
ListView_SetExtendedListViewStyle(pane->hWnd, LVS_EX_FULLROWSELECT);
|
||||
CreateListColumns(pane->hWnd);
|
||||
|
||||
SetWindowLong(pane->hWnd, GWL_USERDATA, (LPARAM)pane);
|
||||
g_orgListWndProc = SubclassWindow(pane->hWnd, ListWndProc);
|
||||
SendMessage(pane->hWnd, WM_SETFONT, (WPARAM)Globals.hFont, FALSE);
|
||||
|
||||
// insert entries into listbox
|
||||
// insert entries into listbox
|
||||
if (entry) {
|
||||
InsertListEntries(pane->hWnd, entry, -1);
|
||||
}
|
||||
|
||||
// calculate column widths
|
||||
// if (!s_init) {
|
||||
// s_init = 1;
|
||||
// init_output(pane->hWnd);
|
||||
// }
|
||||
// calc_widths(pane, TRUE);
|
||||
}
|
||||
|
||||
void RefreshList(HWND hWnd, Entry* entry)
|
||||
{
|
||||
if (hWnd != NULL) {
|
||||
ListView_DeleteAllItems(hWnd);
|
||||
if (entry != NULL) {
|
||||
//TRACE("RefreshList(...) entry name: %s\n", entry->data.cFileName);
|
||||
InsertListEntries(hWnd, entry, -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Pane* pane = (Pane*)GetWindowLong(hWnd, GWL_USERDATA);
|
||||
if (pane != NULL) {
|
||||
// ListBox_RemoveAll(hWnd, TRUE, 1);
|
||||
ListView_DeleteAllItems(pane->hWnd);
|
||||
if (entry) {
|
||||
InsertListEntries(pane->hWnd, entry, -1);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#endif
|
||||
|
||||
#include "main.h"
|
||||
#include "settings.h"
|
||||
#include "framewnd.h"
|
||||
#include "childwnd.h"
|
||||
|
||||
|
@ -459,6 +460,8 @@ int APIENTRY WinMain(HINSTANCE hInstance,
|
|||
// Store instance handle in our global variable
|
||||
hInst = hInstance;
|
||||
|
||||
LoadSettings();
|
||||
|
||||
// Perform application initialization:
|
||||
if (!InitInstance(hInstance, nCmdShow)) {
|
||||
return FALSE;
|
||||
|
@ -477,6 +480,8 @@ int APIENTRY WinMain(HINSTANCE hInstance,
|
|||
DispatchMessage(&msg);
|
||||
}
|
||||
}
|
||||
|
||||
SaveSettings();
|
||||
ExitInstance();
|
||||
return msg.wParam;
|
||||
}
|
||||
|
|
|
@ -44,3 +44,133 @@ TCHAR ViewTypeMaskStr[MAX_TYPE_MASK_LEN];
|
|||
//LPCTSTR lpViewTypeMaskStr;
|
||||
|
||||
|
||||
void LoadSettings(void)
|
||||
{
|
||||
HKEY hKey;
|
||||
char szSubKey[] = "Software\\ReactWare\\FileManager";
|
||||
/*
|
||||
int i;
|
||||
DWORD dwSize;
|
||||
|
||||
// Window size & position settings
|
||||
TaskManagerSettings.Maximized = FALSE;
|
||||
TaskManagerSettings.Left = 0;
|
||||
TaskManagerSettings.Top = 0;
|
||||
TaskManagerSettings.Right = 0;
|
||||
TaskManagerSettings.Bottom = 0;
|
||||
|
||||
// Tab settings
|
||||
TaskManagerSettings.ActiveTabPage = 0;
|
||||
|
||||
// Options menu settings
|
||||
TaskManagerSettings.AlwaysOnTop = FALSE;
|
||||
TaskManagerSettings.MinimizeOnUse = TRUE;
|
||||
TaskManagerSettings.HideWhenMinimized = TRUE;
|
||||
TaskManagerSettings.Show16BitTasks = TRUE;
|
||||
|
||||
// Update speed settings
|
||||
TaskManagerSettings.UpdateSpeed = 2;
|
||||
|
||||
// Applications page settings
|
||||
TaskManagerSettings.View_LargeIcons = FALSE;
|
||||
TaskManagerSettings.View_SmallIcons = FALSE;
|
||||
TaskManagerSettings.View_Details = TRUE;
|
||||
|
||||
// Processes page settings
|
||||
TaskManagerSettings.ShowProcessesFromAllUsers = FALSE; // Server-only?
|
||||
TaskManagerSettings.Column_ImageName = TRUE;
|
||||
TaskManagerSettings.Column_PID = TRUE;
|
||||
TaskManagerSettings.Column_CPUUsage = TRUE;
|
||||
TaskManagerSettings.Column_CPUTime = TRUE;
|
||||
TaskManagerSettings.Column_MemoryUsage = TRUE;
|
||||
TaskManagerSettings.Column_MemoryUsageDelta = FALSE;
|
||||
TaskManagerSettings.Column_PeakMemoryUsage = FALSE;
|
||||
TaskManagerSettings.Column_PageFaults = FALSE;
|
||||
TaskManagerSettings.Column_USERObjects = FALSE;
|
||||
TaskManagerSettings.Column_IOReads = FALSE;
|
||||
TaskManagerSettings.Column_IOReadBytes = FALSE;
|
||||
TaskManagerSettings.Column_SessionID = FALSE; // Server-only?
|
||||
TaskManagerSettings.Column_UserName = FALSE; // Server-only?
|
||||
TaskManagerSettings.Column_PageFaultsDelta = FALSE;
|
||||
TaskManagerSettings.Column_VirtualMemorySize = FALSE;
|
||||
TaskManagerSettings.Column_PagedPool = FALSE;
|
||||
TaskManagerSettings.Column_NonPagedPool = FALSE;
|
||||
TaskManagerSettings.Column_BasePriority = FALSE;
|
||||
TaskManagerSettings.Column_HandleCount = FALSE;
|
||||
TaskManagerSettings.Column_ThreadCount = FALSE;
|
||||
TaskManagerSettings.Column_GDIObjects = FALSE;
|
||||
TaskManagerSettings.Column_IOWrites = FALSE;
|
||||
TaskManagerSettings.Column_IOWriteBytes = FALSE;
|
||||
TaskManagerSettings.Column_IOOther = FALSE;
|
||||
TaskManagerSettings.Column_IOOtherBytes = FALSE;
|
||||
|
||||
for (i = 0; i < 25; i++) {
|
||||
TaskManagerSettings.ColumnOrderArray[i] = i;
|
||||
}
|
||||
TaskManagerSettings.ColumnSizeArray[0] = 105;
|
||||
TaskManagerSettings.ColumnSizeArray[1] = 50;
|
||||
TaskManagerSettings.ColumnSizeArray[2] = 107;
|
||||
TaskManagerSettings.ColumnSizeArray[3] = 70;
|
||||
TaskManagerSettings.ColumnSizeArray[4] = 35;
|
||||
TaskManagerSettings.ColumnSizeArray[5] = 70;
|
||||
TaskManagerSettings.ColumnSizeArray[6] = 70;
|
||||
TaskManagerSettings.ColumnSizeArray[7] = 100;
|
||||
TaskManagerSettings.ColumnSizeArray[8] = 70;
|
||||
TaskManagerSettings.ColumnSizeArray[9] = 70;
|
||||
TaskManagerSettings.ColumnSizeArray[10] = 70;
|
||||
TaskManagerSettings.ColumnSizeArray[11] = 70;
|
||||
TaskManagerSettings.ColumnSizeArray[12] = 70;
|
||||
TaskManagerSettings.ColumnSizeArray[13] = 70;
|
||||
TaskManagerSettings.ColumnSizeArray[14] = 60;
|
||||
TaskManagerSettings.ColumnSizeArray[15] = 60;
|
||||
TaskManagerSettings.ColumnSizeArray[16] = 60;
|
||||
TaskManagerSettings.ColumnSizeArray[17] = 60;
|
||||
TaskManagerSettings.ColumnSizeArray[18] = 60;
|
||||
TaskManagerSettings.ColumnSizeArray[19] = 70;
|
||||
TaskManagerSettings.ColumnSizeArray[20] = 70;
|
||||
TaskManagerSettings.ColumnSizeArray[21] = 70;
|
||||
TaskManagerSettings.ColumnSizeArray[22] = 70;
|
||||
TaskManagerSettings.ColumnSizeArray[23] = 70;
|
||||
TaskManagerSettings.ColumnSizeArray[24] = 70;
|
||||
|
||||
TaskManagerSettings.SortColumn = 1;
|
||||
TaskManagerSettings.SortAscending = TRUE;
|
||||
|
||||
// Performance page settings
|
||||
TaskManagerSettings.CPUHistory_OneGraphPerCPU = TRUE;
|
||||
TaskManagerSettings.ShowKernelTimes = FALSE;
|
||||
*/
|
||||
// Open the key
|
||||
if (RegOpenKeyEx(HKEY_CURRENT_USER, szSubKey, 0, KEY_READ, &hKey) != ERROR_SUCCESS)
|
||||
return;
|
||||
// Read the settings
|
||||
// dwSize = sizeof(TASKMANAGER_SETTINGS);
|
||||
// RegQueryValueEx(hKey, "Preferences", NULL, NULL, (LPBYTE)&TaskManagerSettings, &dwSize);
|
||||
|
||||
// Close the key
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
|
||||
void SaveSettings(void)
|
||||
{
|
||||
HKEY hKey;
|
||||
char szSubKey1[] = "Software";
|
||||
char szSubKey2[] = "Software\\ReactWare";
|
||||
char szSubKey3[] = "Software\\ReactWare\\FileManager";
|
||||
|
||||
// Open (or create) the key
|
||||
hKey = NULL;
|
||||
RegCreateKeyEx(HKEY_CURRENT_USER, szSubKey1, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey, NULL);
|
||||
RegCloseKey(hKey);
|
||||
hKey = NULL;
|
||||
RegCreateKeyEx(HKEY_CURRENT_USER, szSubKey2, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey, NULL);
|
||||
RegCloseKey(hKey);
|
||||
hKey = NULL;
|
||||
if (RegCreateKeyEx(HKEY_CURRENT_USER, szSubKey3, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey, NULL) != ERROR_SUCCESS)
|
||||
return;
|
||||
// Save the settings
|
||||
// RegSetValueEx(hKey, "Preferences", 0, REG_BINARY, (LPBYTE)&TaskManagerSettings, sizeof(TASKMANAGER_SETTINGS));
|
||||
// Close the key
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
|
||||
|
|
|
@ -54,6 +54,8 @@ extern DWORD ViewType;
|
|||
extern TCHAR ViewTypeMaskStr[MAX_TYPE_MASK_LEN];
|
||||
//extern LPCTSTR lpViewTypeMaskStr;
|
||||
|
||||
void LoadSettings(void);
|
||||
void SaveSettings(void);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -472,6 +472,14 @@ static LRESULT CALLBACK TreeWndProc(HWND hWnd, UINT message, WPARAM wParam, LPAR
|
|||
child->nFocusPanel = pane == &child->right? 1: 0;
|
||||
//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);
|
||||
}
|
||||
break;
|
||||
case WM_KEYDOWN:
|
||||
if (wParam == VK_TAB) {
|
||||
|
|
Loading…
Reference in a new issue