Author: weiden
Date: Fri Aug 3 11:35:39 2007
New Revision: 28114
URL:
http://svn.reactos.org/svn/reactos?rev=28114&view=rev
Log:
Patch by Carlo Bramix <carlo.bramix(a)libero.it>
- Get rid of some code duplication
See issue #2517 for more details.
Modified:
trunk/reactos/base/applications/taskmgr/column.c
trunk/reactos/base/applications/taskmgr/column.h
trunk/reactos/base/applications/taskmgr/precomp.h
trunk/reactos/base/applications/taskmgr/taskmgr.c
trunk/reactos/base/applications/taskmgr/taskmgr.h
Modified: trunk/reactos/base/applications/taskmgr/column.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/taskmgr/…
==============================================================================
--- trunk/reactos/base/applications/taskmgr/column.c (original)
+++ trunk/reactos/base/applications/taskmgr/column.c Fri Aug 3 11:35:39 2007
@@ -23,8 +23,39 @@
#include <precomp.h>
-UINT ColumnDataHints[25];
+UINT ColumnDataHints[COLUMN_NMAX];
TCHAR szTemp[256];
+
+#define DECLARE_COLUMN_PRESET(_name, _size, _state) \
+ { IDS_TAB_##_name, IDC_##_name, _size, _state },
+
+const PresetColumnEntry ColumnPresets[COLUMN_NMAX] = {
+ DECLARE_COLUMN_PRESET(IMAGENAME, 105, TRUE)
+ DECLARE_COLUMN_PRESET(PID, 50, TRUE)
+ DECLARE_COLUMN_PRESET(USERNAME, 107, FALSE)
+ DECLARE_COLUMN_PRESET(SESSIONID, 70, FALSE)
+ DECLARE_COLUMN_PRESET(CPUUSAGE, 35, TRUE)
+ DECLARE_COLUMN_PRESET(CPUTIME, 70, TRUE)
+ DECLARE_COLUMN_PRESET(MEMORYUSAGE, 70, TRUE)
+ DECLARE_COLUMN_PRESET(PEAKMEMORYUSAGE, 100, FALSE)
+ DECLARE_COLUMN_PRESET(MEMORYUSAGEDELTA, 70, FALSE)
+ DECLARE_COLUMN_PRESET(PAGEFAULTS, 70, FALSE)
+ DECLARE_COLUMN_PRESET(PAGEFAULTSDELTA, 70, FALSE)
+ DECLARE_COLUMN_PRESET(VIRTUALMEMORYSIZE, 70, FALSE)
+ DECLARE_COLUMN_PRESET(PAGEDPOOL, 70, FALSE)
+ DECLARE_COLUMN_PRESET(NONPAGEDPOOL, 70, FALSE)
+ DECLARE_COLUMN_PRESET(BASEPRIORITY, 60, FALSE)
+ DECLARE_COLUMN_PRESET(HANDLECOUNT, 60, FALSE)
+ DECLARE_COLUMN_PRESET(THREADCOUNT, 60, FALSE)
+ DECLARE_COLUMN_PRESET(USEROBJECTS, 60, FALSE)
+ DECLARE_COLUMN_PRESET(GDIOBJECTS, 60, FALSE)
+ DECLARE_COLUMN_PRESET(IOREADS, 70, FALSE)
+ DECLARE_COLUMN_PRESET(IOWRITES, 70, FALSE)
+ DECLARE_COLUMN_PRESET(IOOTHER, 70, FALSE)
+ DECLARE_COLUMN_PRESET(IOREADBYTES, 70, FALSE)
+ DECLARE_COLUMN_PRESET(IOWRITEBYTES, 70, FALSE)
+ DECLARE_COLUMN_PRESET(IOOTHERBYTES, 70, FALSE)
+};
int InsertColumn(int nCol, LPCTSTR lpszColumnHeading, int nFormat, int
nWidth, int nSubItem);
INT_PTR CALLBACK ColumnsDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM
lParam);
@@ -32,126 +63,14 @@
void AddColumns(void)
{
LRESULT size;
-
- if (TaskManagerSettings.Column_ImageName) {
- LoadString(hInst, IDS_TAB_IMAGENAME, szTemp, 256);
- InsertColumn(0, szTemp, LVCFMT_LEFT, TaskManagerSettings.ColumnSizeArray[0],
-1);
- }
- if (TaskManagerSettings.Column_PID) {
- LoadString(hInst, IDS_TAB_PID, szTemp, 256);
- InsertColumn(1, szTemp, LVCFMT_LEFT, TaskManagerSettings.ColumnSizeArray[1],
-1);
- }
- if (TaskManagerSettings.Column_UserName) {
- LoadString(hInst, IDS_TAB_USERNAME, szTemp, 256);
- InsertColumn(2, szTemp, LVCFMT_LEFT, TaskManagerSettings.ColumnSizeArray[2],
-1);
- }
- if (TaskManagerSettings.Column_SessionID) {
- LoadString(hInst, IDS_TAB_SESSIONID, szTemp, 256);
- InsertColumn(3, szTemp, LVCFMT_LEFT, TaskManagerSettings.ColumnSizeArray[3],
-1);
- }
- if (TaskManagerSettings.Column_CPUUsage) {
- LoadString(hInst, IDS_TAB_CPU, szTemp, 256);
- InsertColumn(4, szTemp, LVCFMT_LEFT, TaskManagerSettings.ColumnSizeArray[4],
-1);
- }
-
- if (TaskManagerSettings.Column_CPUTime) {
- LoadString(hInst, IDS_TAB_CPUTIME, szTemp, 256);
- InsertColumn(5, szTemp, LVCFMT_LEFT, TaskManagerSettings.ColumnSizeArray[5],
-1);
- }
-
- if (TaskManagerSettings.Column_MemoryUsage) {
- LoadString(hInst, IDS_TAB_MEMUSAGE, szTemp, 256);
- InsertColumn(6, szTemp, LVCFMT_LEFT, TaskManagerSettings.ColumnSizeArray[6],
-1);
- }
-
- if (TaskManagerSettings.Column_PeakMemoryUsage) {
- LoadString(hInst, IDS_TAB_PEAKMEMUSAGE, szTemp, 256);
- InsertColumn(7, szTemp, LVCFMT_LEFT, TaskManagerSettings.ColumnSizeArray[7],
-1);
- }
-
- if (TaskManagerSettings.Column_MemoryUsageDelta) {
- LoadString(hInst, IDS_TAB_MEMDELTA, szTemp, 256);
- InsertColumn(8, szTemp, LVCFMT_LEFT, TaskManagerSettings.ColumnSizeArray[8],
-1);
- }
-
- if (TaskManagerSettings.Column_PageFaults) {
- LoadString(hInst, IDS_TAB_PAGEFAULT, szTemp, 256);
- InsertColumn(9, szTemp, LVCFMT_LEFT, TaskManagerSettings.ColumnSizeArray[9],
-1);
- }
-
- if (TaskManagerSettings.Column_PageFaultsDelta) {
- LoadString(hInst, IDS_TAB_PFDELTA, szTemp, 256);
- InsertColumn(10, szTemp, LVCFMT_LEFT, TaskManagerSettings.ColumnSizeArray[10],
-1);
- }
-
- if (TaskManagerSettings.Column_VirtualMemorySize) {
- LoadString(hInst, IDS_TAB_VMSIZE, szTemp, 256);
- InsertColumn(11, szTemp, LVCFMT_LEFT, TaskManagerSettings.ColumnSizeArray[11],
-1);
- }
-
- if (TaskManagerSettings.Column_PagedPool) {
- LoadString(hInst, IDS_TAB_PAGEDPOOL, szTemp, 256);
- InsertColumn(12, szTemp, LVCFMT_LEFT, TaskManagerSettings.ColumnSizeArray[12],
-1);
- }
-
- if (TaskManagerSettings.Column_NonPagedPool) {
- LoadString(hInst, IDS_TAB_NPPOOL, szTemp, 256);
- InsertColumn(13, szTemp, LVCFMT_LEFT, TaskManagerSettings.ColumnSizeArray[13],
-1);
- }
-
- if (TaskManagerSettings.Column_BasePriority) {
- LoadString(hInst, IDS_TAB_BASEPRI, szTemp, 256);
- InsertColumn(14, szTemp, LVCFMT_LEFT, TaskManagerSettings.ColumnSizeArray[14],
-1);
- }
-
- if (TaskManagerSettings.Column_HandleCount) {
- LoadString(hInst, IDS_TAB_HANDLES, szTemp, 256);
- InsertColumn(15, szTemp, LVCFMT_LEFT, TaskManagerSettings.ColumnSizeArray[15],
-1);
- }
-
- if (TaskManagerSettings.Column_ThreadCount) {
- LoadString(hInst, IDS_TAB_THREADS, szTemp, 256);
- InsertColumn(16, szTemp, LVCFMT_LEFT, TaskManagerSettings.ColumnSizeArray[16],
-1);
- }
-
- if (TaskManagerSettings.Column_USERObjects) {
- LoadString(hInst, IDS_TAB_USERPBJECTS, szTemp, 256);
- InsertColumn(17, szTemp, LVCFMT_LEFT, TaskManagerSettings.ColumnSizeArray[17],
-1);
- }
-
- if (TaskManagerSettings.Column_GDIObjects) {
- LoadString(hInst, IDS_TAB_GDIOBJECTS, szTemp, 256);
- InsertColumn(18, szTemp, LVCFMT_LEFT, TaskManagerSettings.ColumnSizeArray[18],
-1);
- }
-
- if (TaskManagerSettings.Column_IOReads) {
- LoadString(hInst, IDS_TAB_IOREADS, szTemp, 256);
- InsertColumn(19, szTemp, LVCFMT_LEFT, TaskManagerSettings.ColumnSizeArray[19],
-1);
- }
-
- if (TaskManagerSettings.Column_IOWrites) {
- LoadString(hInst, IDS_TAB_IOWRITES, szTemp, 256);
- InsertColumn(20, szTemp, LVCFMT_LEFT, TaskManagerSettings.ColumnSizeArray[20],
-1);
- }
-
- if (TaskManagerSettings.Column_IOOther) {
- LoadString(hInst, IDS_TAB_IOOTHER, szTemp, 256);
- InsertColumn(21, szTemp, LVCFMT_LEFT, TaskManagerSettings.ColumnSizeArray[21],
-1);
- }
-
- if (TaskManagerSettings.Column_IOReadBytes) {
- LoadString(hInst, IDS_TAB_IOREADBYTES, szTemp, 256);
- InsertColumn(22, szTemp, LVCFMT_LEFT, TaskManagerSettings.ColumnSizeArray[22],
-1);
- }
-
- if (TaskManagerSettings.Column_IOWriteBytes) {
- LoadString(hInst, IDS_TAB_IOWRITESBYTES, szTemp, 256);
- InsertColumn(23, szTemp, LVCFMT_LEFT, TaskManagerSettings.ColumnSizeArray[23],
-1);
- }
-
- if (TaskManagerSettings.Column_IOOtherBytes) {
- LoadString(hInst, IDS_TAB_IOOTHERBYTES, szTemp, 256);
- InsertColumn(24, szTemp, LVCFMT_LEFT, TaskManagerSettings.ColumnSizeArray[24],
-1);
+ TCHAR szTemp[256];
+ unsigned int n;
+
+ for (n=0; n<COLUMN_NMAX; n++) {
+ if (TaskManagerSettings.Columns[n]) {
+ LoadString(hInst, ColumnPresets[n].dwIdsName, szTemp,
sizeof(szTemp)/sizeof(TCHAR));
+ InsertColumn(n, szTemp, LVCFMT_LEFT, TaskManagerSettings.ColumnSizeArray[n],
-1);
+ }
}
size = SendMessage(hProcessPageHeaderCtrl, HDM_GETITEMCOUNT, 0, 0);
@@ -186,64 +105,16 @@
void SaveColumnSettings(void)
{
HDITEM hditem;
- int i;
+ unsigned int i, n;
TCHAR text[260];
LRESULT size;
/* Reset column data */
- for (i=0; i<25; i++)
+ for (i=0; i<COLUMN_NMAX; i++) {
TaskManagerSettings.ColumnOrderArray[i] = i;
-
- TaskManagerSettings.Column_ImageName = FALSE;
- TaskManagerSettings.Column_PID = FALSE;
- TaskManagerSettings.Column_CPUUsage = FALSE;
- TaskManagerSettings.Column_CPUTime = FALSE;
- TaskManagerSettings.Column_MemoryUsage = FALSE;
- 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;
- TaskManagerSettings.Column_UserName = FALSE;
- 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;
- 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.Columns[i] = FALSE;
+ TaskManagerSettings.ColumnSizeArray[i] = ColumnPresets[i].size;
+ }
/* Get header order */
size = SendMessage(hProcessPageHeaderCtrl, HDM_GETITEMCOUNT, 0, 0);
@@ -259,179 +130,13 @@
SendMessage(hProcessPageHeaderCtrl, HDM_GETITEM, i, (LPARAM) &hditem);
- LoadString(hInst, IDS_TAB_IMAGENAME, szTemp, 256);
- if (_tcsicmp(text, szTemp) == 0)
- {
- TaskManagerSettings.Column_ImageName = TRUE;
- TaskManagerSettings.ColumnSizeArray[0] = hditem.cxy;
- }
-
- LoadString(hInst, IDS_TAB_PID, szTemp, 256);
- if (_tcsicmp(text, szTemp) == 0)
- {
- TaskManagerSettings.Column_PID = TRUE;
- TaskManagerSettings.ColumnSizeArray[1] = hditem.cxy;
- }
-
- LoadString(hInst, IDS_TAB_USERNAME, szTemp, 256);
- if (_tcsicmp(text, szTemp) == 0)
- {
- TaskManagerSettings.Column_UserName = TRUE;
- TaskManagerSettings.ColumnSizeArray[2] = hditem.cxy;
- }
-
- LoadString(hInst, IDS_TAB_SESSIONID, szTemp, 256);
- if (_tcsicmp(text, szTemp) == 0)
- {
- TaskManagerSettings.Column_SessionID = TRUE;
- TaskManagerSettings.ColumnSizeArray[3] = hditem.cxy;
- }
-
- LoadString(hInst, IDS_TAB_CPU, szTemp, 256);
- if (_tcsicmp(text, szTemp) == 0)
- {
- TaskManagerSettings.Column_CPUUsage = TRUE;
- TaskManagerSettings.ColumnSizeArray[4] = hditem.cxy;
- }
-
- LoadString(hInst, IDS_TAB_CPUTIME, szTemp, 256);
- if (_tcsicmp(text, szTemp) == 0)
- {
- TaskManagerSettings.Column_CPUTime = TRUE;
- TaskManagerSettings.ColumnSizeArray[5] = hditem.cxy;
- }
-
- LoadString(hInst, IDS_TAB_MEMUSAGE, szTemp, 256);
- if (_tcsicmp(text, szTemp) == 0)
- {
- TaskManagerSettings.Column_MemoryUsage = TRUE;
- TaskManagerSettings.ColumnSizeArray[6] = hditem.cxy;
- }
-
- LoadString(hInst, IDS_TAB_PEAKMEMUSAGE, szTemp, 256);
- if (_tcsicmp(text, szTemp) == 0)
- {
- TaskManagerSettings.Column_PeakMemoryUsage = TRUE;
- TaskManagerSettings.ColumnSizeArray[7] = hditem.cxy;
- }
-
- LoadString(hInst, IDS_TAB_MEMDELTA, szTemp, 256);
- if (_tcsicmp(text, szTemp) == 0)
- {
- TaskManagerSettings.Column_MemoryUsageDelta = TRUE;
- TaskManagerSettings.ColumnSizeArray[8] = hditem.cxy;
- }
-
- LoadString(hInst, IDS_TAB_PAGEFAULT, szTemp, 256);
- if (_tcsicmp(text, szTemp) == 0)
- {
- TaskManagerSettings.Column_PageFaults = TRUE;
- TaskManagerSettings.ColumnSizeArray[9] = hditem.cxy;
- }
-
- LoadString(hInst, IDS_TAB_PFDELTA, szTemp, 256);
- if (_tcsicmp(text, szTemp) == 0)
- {
- TaskManagerSettings.Column_PageFaultsDelta = TRUE;
- TaskManagerSettings.ColumnSizeArray[10] = hditem.cxy;
- }
-
- LoadString(hInst, IDS_TAB_VMSIZE, szTemp, 256);
- if (_tcsicmp(text, szTemp) == 0)
- {
- TaskManagerSettings.Column_VirtualMemorySize = TRUE;
- TaskManagerSettings.ColumnSizeArray[11] = hditem.cxy;
- }
-
- LoadString(hInst, IDS_TAB_PAGEDPOOL, szTemp, 256);
- if (_tcsicmp(text, szTemp) == 0)
- {
- TaskManagerSettings.Column_PagedPool = TRUE;
- TaskManagerSettings.ColumnSizeArray[12] = hditem.cxy;
- }
-
- LoadString(hInst, IDS_TAB_NPPOOL, szTemp, 256);
- if (_tcsicmp(text, szTemp) == 0)
- {
- TaskManagerSettings.Column_NonPagedPool = TRUE;
- TaskManagerSettings.ColumnSizeArray[13] = hditem.cxy;
- }
-
- LoadString(hInst, IDS_TAB_BASEPRI, szTemp, 256);
- if (_tcsicmp(text, szTemp) == 0)
- {
- TaskManagerSettings.Column_BasePriority = TRUE;
- TaskManagerSettings.ColumnSizeArray[14] = hditem.cxy;
- }
-
- LoadString(hInst, IDS_TAB_HANDLES, szTemp, 256);
- if (_tcsicmp(text, szTemp) == 0)
- {
- TaskManagerSettings.Column_HandleCount = TRUE;
- TaskManagerSettings.ColumnSizeArray[15] = hditem.cxy;
- }
-
- LoadString(hInst, IDS_TAB_THREADS, szTemp, 256);
- if (_tcsicmp(text, szTemp) == 0)
- {
- TaskManagerSettings.Column_ThreadCount = TRUE;
- TaskManagerSettings.ColumnSizeArray[16] = hditem.cxy;
- }
-
- LoadString(hInst, IDS_TAB_USERPBJECTS, szTemp, 256);
- if (_tcsicmp(text, szTemp) == 0)
- {
- TaskManagerSettings.Column_USERObjects = TRUE;
- TaskManagerSettings.ColumnSizeArray[17] = hditem.cxy;
- }
-
- LoadString(hInst, IDS_TAB_GDIOBJECTS, szTemp, 256);
- if (_tcsicmp(text, szTemp) == 0)
- {
- TaskManagerSettings.Column_GDIObjects = TRUE;
- TaskManagerSettings.ColumnSizeArray[18] = hditem.cxy;
- }
-
- LoadString(hInst, IDS_TAB_IOREADS, szTemp, 256);
- if (_tcsicmp(text, szTemp) == 0)
- {
- TaskManagerSettings.Column_IOReads = TRUE;
- TaskManagerSettings.ColumnSizeArray[19] = hditem.cxy;
- }
-
- LoadString(hInst, IDS_TAB_IOWRITES, szTemp, 256);
- if (_tcsicmp(text, szTemp) == 0)
- {
- TaskManagerSettings.Column_IOWrites = TRUE;
- TaskManagerSettings.ColumnSizeArray[20] = hditem.cxy;
- }
-
- LoadString(hInst, IDS_TAB_IOOTHER, szTemp, 256);
- if (_tcsicmp(text, szTemp) == 0)
- {
- TaskManagerSettings.Column_IOOther = TRUE;
- TaskManagerSettings.ColumnSizeArray[21] = hditem.cxy;
- }
-
- LoadString(hInst, IDS_TAB_IOREADBYTES, szTemp, 256);
- if (_tcsicmp(text, szTemp) == 0)
- {
- TaskManagerSettings.Column_IOReadBytes = TRUE;
- TaskManagerSettings.ColumnSizeArray[22] = hditem.cxy;
- }
-
- LoadString(hInst, IDS_TAB_IOWRITESBYTES, szTemp, 256);
- if (_tcsicmp(text, szTemp) == 0)
- {
- TaskManagerSettings.Column_IOWriteBytes = TRUE;
- TaskManagerSettings.ColumnSizeArray[23] = hditem.cxy;
- }
-
- LoadString(hInst, IDS_TAB_IOOTHERBYTES, szTemp, 256);
- if (_tcsicmp(text, szTemp) == 0)
- {
- TaskManagerSettings.Column_IOOtherBytes = TRUE;
- TaskManagerSettings.ColumnSizeArray[24] = hditem.cxy;
+ for (n=0; n<COLUMN_NMAX; n++) {
+ LoadString(hInst, ColumnPresets[n].dwIdsName, szTemp,
sizeof(szTemp)/sizeof(TCHAR));
+ if (_tcsicmp(text, szTemp) == 0)
+ {
+ TaskManagerSettings.Columns[n] = TRUE;
+ TaskManagerSettings.ColumnSizeArray[n] = hditem.cxy;
+ }
}
}
}
@@ -447,34 +152,10 @@
(void)ListView_DeleteColumn(hProcessPageListCtrl, i);
}
- for (i=0; i<25; i++)
+ for (i=0; i<COLUMN_NMAX; 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.ColumnSizeArray[i] = ColumnPresets[i].size;
+ }
AddColumns();
}
@@ -483,62 +164,16 @@
INT_PTR CALLBACK
ColumnsDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
+ unsigned int i;
switch (message)
{
case WM_INITDIALOG:
- if (TaskManagerSettings.Column_ImageName)
- SendMessage(GetDlgItem(hDlg, IDC_IMAGENAME), BM_SETCHECK, BST_CHECKED, 0);
- if (TaskManagerSettings.Column_PID)
- SendMessage(GetDlgItem(hDlg, IDC_PID), BM_SETCHECK, BST_CHECKED, 0);
- if (TaskManagerSettings.Column_UserName)
- SendMessage(GetDlgItem(hDlg, IDC_USERNAME), BM_SETCHECK, BST_CHECKED, 0);
- if (TaskManagerSettings.Column_SessionID)
- SendMessage(GetDlgItem(hDlg, IDC_SESSIONID), BM_SETCHECK, BST_CHECKED, 0);
- if (TaskManagerSettings.Column_CPUUsage)
- SendMessage(GetDlgItem(hDlg, IDC_CPUUSAGE), BM_SETCHECK, BST_CHECKED, 0);
- if (TaskManagerSettings.Column_CPUTime)
- SendMessage(GetDlgItem(hDlg, IDC_CPUTIME), BM_SETCHECK, BST_CHECKED, 0);
- if (TaskManagerSettings.Column_MemoryUsage)
- SendMessage(GetDlgItem(hDlg, IDC_MEMORYUSAGE), BM_SETCHECK, BST_CHECKED, 0);
- if (TaskManagerSettings.Column_PeakMemoryUsage)
- SendMessage(GetDlgItem(hDlg, IDC_PEAKMEMORYUSAGE), BM_SETCHECK, BST_CHECKED,
0);
- if (TaskManagerSettings.Column_MemoryUsageDelta)
- SendMessage(GetDlgItem(hDlg, IDC_MEMORYUSAGEDELTA), BM_SETCHECK, BST_CHECKED,
0);
- if (TaskManagerSettings.Column_PageFaults)
- SendMessage(GetDlgItem(hDlg, IDC_PAGEFAULTS), BM_SETCHECK, BST_CHECKED, 0);
- if (TaskManagerSettings.Column_PageFaultsDelta)
- SendMessage(GetDlgItem(hDlg, IDC_PAGEFAULTSDELTA), BM_SETCHECK, BST_CHECKED,
0);
- if (TaskManagerSettings.Column_VirtualMemorySize)
- SendMessage(GetDlgItem(hDlg, IDC_VIRTUALMEMORYSIZE), BM_SETCHECK,
BST_CHECKED, 0);
- if (TaskManagerSettings.Column_PagedPool)
- SendMessage(GetDlgItem(hDlg, IDC_PAGEDPOOL), BM_SETCHECK, BST_CHECKED, 0);
- if (TaskManagerSettings.Column_NonPagedPool)
- SendMessage(GetDlgItem(hDlg, IDC_NONPAGEDPOOL), BM_SETCHECK, BST_CHECKED,
0);
- if (TaskManagerSettings.Column_BasePriority)
- SendMessage(GetDlgItem(hDlg, IDC_BASEPRIORITY), BM_SETCHECK, BST_CHECKED,
0);
- if (TaskManagerSettings.Column_HandleCount)
- SendMessage(GetDlgItem(hDlg, IDC_HANDLECOUNT), BM_SETCHECK, BST_CHECKED, 0);
- if (TaskManagerSettings.Column_ThreadCount)
- SendMessage(GetDlgItem(hDlg, IDC_THREADCOUNT), BM_SETCHECK, BST_CHECKED, 0);
- if (TaskManagerSettings.Column_USERObjects)
- SendMessage(GetDlgItem(hDlg, IDC_USEROBJECTS), BM_SETCHECK, BST_CHECKED, 0);
- if (TaskManagerSettings.Column_GDIObjects)
- SendMessage(GetDlgItem(hDlg, IDC_GDIOBJECTS), BM_SETCHECK, BST_CHECKED, 0);
- if (TaskManagerSettings.Column_IOReads)
- SendMessage(GetDlgItem(hDlg, IDC_IOREADS), BM_SETCHECK, BST_CHECKED, 0);
- if (TaskManagerSettings.Column_IOWrites)
- SendMessage(GetDlgItem(hDlg, IDC_IOWRITES), BM_SETCHECK, BST_CHECKED, 0);
- if (TaskManagerSettings.Column_IOOther)
- SendMessage(GetDlgItem(hDlg, IDC_IOOTHER), BM_SETCHECK, BST_CHECKED, 0);
- if (TaskManagerSettings.Column_IOReadBytes)
- SendMessage(GetDlgItem(hDlg, IDC_IOREADBYTES), BM_SETCHECK, BST_CHECKED, 0);
- if (TaskManagerSettings.Column_IOWriteBytes)
- SendMessage(GetDlgItem(hDlg, IDC_IOWRITEBYTES), BM_SETCHECK, BST_CHECKED,
0);
- if (TaskManagerSettings.Column_IOOtherBytes)
- SendMessage(GetDlgItem(hDlg, IDC_IOOTHERBYTES), BM_SETCHECK, BST_CHECKED,
0);
-
+ for (i=0; i<COLUMN_NMAX; i++) {
+ if (TaskManagerSettings.Columns[i])
+ SendMessage(GetDlgItem(hDlg, ColumnPresets[i].dwIdcCtrl), BM_SETCHECK,
BST_CHECKED, 0);
+ }
return TRUE;
case WM_COMMAND:
@@ -551,31 +186,8 @@
if (LOWORD(wParam) == IDOK)
{
- TaskManagerSettings.Column_ImageName = (BOOL) SendMessage(GetDlgItem(hDlg,
IDC_IMAGENAME), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_PID = (BOOL) SendMessage(GetDlgItem(hDlg,
IDC_PID), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_UserName = (BOOL) SendMessage(GetDlgItem(hDlg,
IDC_USERNAME), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_SessionID = (BOOL) SendMessage(GetDlgItem(hDlg,
IDC_SESSIONID), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_CPUUsage = (BOOL) SendMessage(GetDlgItem(hDlg,
IDC_CPUUSAGE), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_CPUTime = (BOOL) SendMessage(GetDlgItem(hDlg,
IDC_CPUTIME), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_MemoryUsage = (BOOL) SendMessage(GetDlgItem(hDlg,
IDC_MEMORYUSAGE), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_PeakMemoryUsage = (BOOL)
SendMessage(GetDlgItem(hDlg, IDC_PEAKMEMORYUSAGE), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_MemoryUsageDelta = (BOOL)
SendMessage(GetDlgItem(hDlg, IDC_MEMORYUSAGEDELTA), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_PageFaults = (BOOL) SendMessage(GetDlgItem(hDlg,
IDC_PAGEFAULTS), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_PageFaultsDelta = (BOOL)
SendMessage(GetDlgItem(hDlg, IDC_PAGEFAULTSDELTA), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_VirtualMemorySize = (BOOL)
SendMessage(GetDlgItem(hDlg, IDC_VIRTUALMEMORYSIZE), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_PagedPool = (BOOL) SendMessage(GetDlgItem(hDlg,
IDC_PAGEDPOOL), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_NonPagedPool = (BOOL) SendMessage(GetDlgItem(hDlg,
IDC_NONPAGEDPOOL), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_BasePriority = (BOOL) SendMessage(GetDlgItem(hDlg,
IDC_BASEPRIORITY), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_HandleCount = (BOOL) SendMessage(GetDlgItem(hDlg,
IDC_HANDLECOUNT), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_ThreadCount = (BOOL) SendMessage(GetDlgItem(hDlg,
IDC_THREADCOUNT), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_USERObjects = (BOOL) SendMessage(GetDlgItem(hDlg,
IDC_USEROBJECTS), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_GDIObjects = (BOOL) SendMessage(GetDlgItem(hDlg,
IDC_GDIOBJECTS), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_IOReads = (BOOL) SendMessage(GetDlgItem(hDlg,
IDC_IOREADS), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_IOWrites = (BOOL) SendMessage(GetDlgItem(hDlg,
IDC_IOWRITES), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_IOOther = (BOOL) SendMessage(GetDlgItem(hDlg,
IDC_IOOTHER), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_IOReadBytes = (BOOL) SendMessage(GetDlgItem(hDlg,
IDC_IOREADBYTES), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_IOWriteBytes = (BOOL) SendMessage(GetDlgItem(hDlg,
IDC_IOWRITEBYTES), BM_GETCHECK, 0, 0);
- TaskManagerSettings.Column_IOOtherBytes = (BOOL) SendMessage(GetDlgItem(hDlg,
IDC_IOOTHERBYTES), BM_GETCHECK, 0, 0);
+ for (i=0; i<COLUMN_NMAX; i++)
+ TaskManagerSettings.Columns[i] = (BOOL) SendMessage(GetDlgItem(hDlg,
ColumnPresets[i].dwIdcCtrl), BM_GETCHECK, 0, 0);
EndDialog(hDlg, LOWORD(wParam));
return TRUE;
@@ -589,9 +201,11 @@
void UpdateColumnDataHints(void)
{
- HDITEM hditem;
- TCHAR text[260];
- ULONG Index;
+ HDITEM hditem;
+ TCHAR text[260];
+ ULONG Index;
+ TCHAR szTemp[256];
+ unsigned int i;
for (Index=0; Index<(ULONG)SendMessage(hProcessPageHeaderCtrl, HDM_GETITEMCOUNT,
0, 0); Index++)
{
@@ -603,104 +217,10 @@
SendMessage(hProcessPageHeaderCtrl, HDM_GETITEM, Index, (LPARAM) &hditem);
- LoadString(hInst, IDS_TAB_IMAGENAME, szTemp, 256);
- if (_tcsicmp(text, szTemp) == 0)
- ColumnDataHints[Index] = COLUMN_IMAGENAME;
-
- LoadString(hInst, IDS_TAB_PID, szTemp, 256);
- if (_tcsicmp(text, szTemp) == 0)
- ColumnDataHints[Index] = COLUMN_PID;
-
- LoadString(hInst, IDS_TAB_USERNAME, szTemp, 256);
- if (_tcsicmp(text, szTemp) == 0)
- ColumnDataHints[Index] = COLUMN_USERNAME;
-
- LoadString(hInst, IDS_TAB_SESSIONID, szTemp, 256);
- if (_tcsicmp(text, szTemp) == 0)
- ColumnDataHints[Index] = COLUMN_SESSIONID;
-
- LoadString(hInst, IDS_TAB_CPU, szTemp, 256);
- if (_tcsicmp(text, szTemp) == 0)
- ColumnDataHints[Index] = COLUMN_CPUUSAGE;
-
- LoadString(hInst, IDS_TAB_CPUTIME, szTemp, 256);
- if (_tcsicmp(text, szTemp) == 0)
- ColumnDataHints[Index] = COLUMN_CPUTIME;
-
- LoadString(hInst, IDS_TAB_MEMUSAGE, szTemp, 256);
- if (_tcsicmp(text, szTemp) == 0)
- ColumnDataHints[Index] = COLUMN_MEMORYUSAGE;
-
- LoadString(hInst, IDS_TAB_PEAKMEMUSAGE, szTemp, 256);
- if (_tcsicmp(text, szTemp) == 0)
- ColumnDataHints[Index] = COLUMN_PEAKMEMORYUSAGE;
-
- LoadString(hInst, IDS_TAB_MEMDELTA, szTemp, 256);
- if (_tcsicmp(text, szTemp) == 0)
- ColumnDataHints[Index] = COLUMN_MEMORYUSAGEDELTA;
-
- LoadString(hInst, IDS_TAB_PAGEFAULT, szTemp, 256);
- if (_tcsicmp(text, szTemp) == 0)
- ColumnDataHints[Index] = COLUMN_PAGEFAULTS;
-
- LoadString(hInst, IDS_TAB_PFDELTA, szTemp, 256);
- if (_tcsicmp(text, szTemp) == 0)
- ColumnDataHints[Index] = COLUMN_PAGEFAULTSDELTA;
-
- LoadString(hInst, IDS_TAB_VMSIZE, szTemp, 256);
- if (_tcsicmp(text, szTemp) == 0)
- ColumnDataHints[Index] = COLUMN_VIRTUALMEMORYSIZE;
-
- LoadString(hInst, IDS_TAB_PAGEDPOOL, szTemp, 256);
- if (_tcsicmp(text, szTemp) == 0)
- ColumnDataHints[Index] = COLUMN_PAGEDPOOL;
-
- LoadString(hInst, IDS_TAB_NPPOOL, szTemp, 256);
- if (_tcsicmp(text, szTemp) == 0)
- ColumnDataHints[Index] = COLUMN_NONPAGEDPOOL;
-
- LoadString(hInst, IDS_TAB_BASEPRI, szTemp, 256);
- if (_tcsicmp(text, szTemp) == 0)
- ColumnDataHints[Index] = COLUMN_BASEPRIORITY;
-
- LoadString(hInst, IDS_TAB_HANDLES, szTemp, 256);
- if (_tcsicmp(text, szTemp) == 0)
- ColumnDataHints[Index] = COLUMN_HANDLECOUNT;
-
- LoadString(hInst, IDS_TAB_THREADS, szTemp, 256);
- if (_tcsicmp(text, szTemp) == 0)
- ColumnDataHints[Index] = COLUMN_THREADCOUNT;
-
- LoadString(hInst, IDS_TAB_USERPBJECTS, szTemp, 256);
- if (_tcsicmp(text, szTemp) == 0)
- ColumnDataHints[Index] = COLUMN_USEROBJECTS;
-
- LoadString(hInst, IDS_TAB_GDIOBJECTS, szTemp, 256);
- if (_tcsicmp(text, szTemp) == 0)
- ColumnDataHints[Index] = COLUMN_GDIOBJECTS;
-
- LoadString(hInst, IDS_TAB_IOREADS, szTemp, 256);
- if (_tcsicmp(text, szTemp) == 0)
- ColumnDataHints[Index] = COLUMN_IOREADS;
-
- LoadString(hInst, IDS_TAB_IOWRITES, szTemp, 256);
- if (_tcsicmp(text, szTemp) == 0)
- ColumnDataHints[Index] = COLUMN_IOWRITES;
-
- LoadString(hInst, IDS_TAB_IOOTHER, szTemp, 256);
- if (_tcsicmp(text, szTemp) == 0)
- ColumnDataHints[Index] = COLUMN_IOOTHER;
-
- LoadString(hInst, IDS_TAB_IOREADBYTES, szTemp, 256);
- if (_tcsicmp(text, szTemp) == 0)
- ColumnDataHints[Index] = COLUMN_IOREADBYTES;
-
- LoadString(hInst, IDS_TAB_IOWRITESBYTES, szTemp, 256);
- if (_tcsicmp(text, szTemp) == 0)
- ColumnDataHints[Index] = COLUMN_IOWRITEBYTES;
-
- LoadString(hInst, IDS_TAB_IOOTHERBYTES, szTemp, 256);
- if (_tcsicmp(text, szTemp) == 0)
- ColumnDataHints[Index] = COLUMN_IOOTHERBYTES;
- }
-}
+ for (i=0; i<COLUMN_NMAX; i++) {
+ LoadString(hInst, ColumnPresets[i].dwIdsName, szTemp,
sizeof(szTemp)/sizeof(TCHAR));
+ if (_tcsicmp(text, szTemp) == 0)
+ ColumnDataHints[Index] = i;
+ }
+ }
+}
Modified: trunk/reactos/base/applications/taskmgr/column.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/taskmgr/…
==============================================================================
--- trunk/reactos/base/applications/taskmgr/column.h (original)
+++ trunk/reactos/base/applications/taskmgr/column.h Fri Aug 3 11:35:39 2007
@@ -24,32 +24,87 @@
#define __COLUMN_H
#define COLUMN_IMAGENAME 0
-#define COLUMN_PID 1
-#define COLUMN_USERNAME 2
+#define COLUMN_PID 1
+#define COLUMN_USERNAME 2
#define COLUMN_SESSIONID 3
-#define COLUMN_CPUUSAGE 4
-#define COLUMN_CPUTIME 5
-#define COLUMN_MEMORYUSAGE 6
-#define COLUMN_PEAKMEMORYUSAGE 7
-#define COLUMN_MEMORYUSAGEDELTA 8
-#define COLUMN_PAGEFAULTS 9
-#define COLUMN_PAGEFAULTSDELTA 10
+#define COLUMN_CPUUSAGE 4
+#define COLUMN_CPUTIME 5
+#define COLUMN_MEMORYUSAGE 6
+#define COLUMN_PEAKMEMORYUSAGE 7
+#define COLUMN_MEMORYUSAGEDELTA 8
+#define COLUMN_PAGEFAULTS 9
+#define COLUMN_PAGEFAULTSDELTA 10
#define COLUMN_VIRTUALMEMORYSIZE 11
#define COLUMN_PAGEDPOOL 12
-#define COLUMN_NONPAGEDPOOL 13
-#define COLUMN_BASEPRIORITY 14
-#define COLUMN_HANDLECOUNT 15
-#define COLUMN_THREADCOUNT 16
-#define COLUMN_USEROBJECTS 17
-#define COLUMN_GDIOBJECTS 18
-#define COLUMN_IOREADS 19
-#define COLUMN_IOWRITES 20
-#define COLUMN_IOOTHER 21
-#define COLUMN_IOREADBYTES 22
-#define COLUMN_IOWRITEBYTES 23
-#define COLUMN_IOOTHERBYTES 24
+#define COLUMN_NONPAGEDPOOL 13
+#define COLUMN_BASEPRIORITY 14
+#define COLUMN_HANDLECOUNT 15
+#define COLUMN_THREADCOUNT 16
+#define COLUMN_USEROBJECTS 17
+#define COLUMN_GDIOBJECTS 18
+#define COLUMN_IOREADS 19
+#define COLUMN_IOWRITES 20
+#define COLUMN_IOOTHER 21
+#define COLUMN_IOREADBYTES 22
+#define COLUMN_IOWRITEBYTES 23
+#define COLUMN_IOOTHERBYTES 24
+#define COLUMN_NMAX 25
-extern UINT ColumnDataHints[25];
+/*
+ * temporary fix:
+ * Some macro IDS_* have different name from IDC_*
+ * It would be better to unify thone name one day
+ */
+#define IDS_TAB_CPUUSAGE IDS_TAB_CPU
+#define IDS_TAB_MEMORYUSAGE IDS_TAB_MEMUSAGE
+#define IDS_TAB_PEAKMEMORYUSAGE IDS_TAB_PEAKMEMUSAGE
+#define IDS_TAB_MEMORYUSAGEDELTA IDS_TAB_MEMDELTA
+#define IDS_TAB_PAGEFAULTS IDS_TAB_PAGEFAULT
+#define IDS_TAB_PAGEFAULTSDELTA IDS_TAB_PFDELTA
+#define IDS_TAB_VIRTUALMEMORYSIZE IDS_TAB_VMSIZE
+#define IDS_TAB_NONPAGEDPOOL IDS_TAB_NPPOOL
+#define IDS_TAB_BASEPRIORITY IDS_TAB_BASEPRI
+#define IDS_TAB_HANDLECOUNT IDS_TAB_HANDLES
+#define IDS_TAB_THREADCOUNT IDS_TAB_THREADS
+#define IDS_TAB_USEROBJECTS IDS_TAB_USERPBJECTS
+#define IDS_TAB_IOWRITEBYTES IDS_TAB_IOWRITESBYTES
+
+typedef struct {
+ DWORD dwIdsName;
+ DWORD dwIdcCtrl;
+ int size;
+ BOOL bDefaults;
+} PresetColumnEntry;
+
+
+extern UINT ColumnDataHints[COLUMN_NMAX];
+extern const PresetColumnEntry ColumnPresets[COLUMN_NMAX];
+
+#define Column_ImageName Columns[COLUMN_IMAGENAME]
+#define Column_PID Columns[COLUMN_PID]
+#define Column_CPUUsage Columns[COLUMN_CPUUSAGE]
+#define Column_CPUTime Columns[COLUMN_CPUTIME]
+#define Column_MemoryUsage Columns[COLUMN_MEMORYUSAGE]
+#define Column_MemoryUsageDelta Columns[COLUMN_MEMORYUSAGEDELTA]
+#define Column_PeakMemoryUsage Columns[COLUMN_PEAKMEMORYUSAGE]
+#define Column_PageFaults Columns[COLUMN_PAGEFAULTS]
+#define Column_USERObjects Columns[COLUMN_USEROBJECTS]
+#define Column_IOReads Columns[COLUMN_IOREADS]
+#define Column_IOReadBytes Columns[COLUMN_IOREADBYTES]
+#define Column_SessionID Columns[COLUMN_SESSIONID]
+#define Column_UserName Columns[COLUMN_USERNAME]
+#define Column_PageFaultsDelta Columns[COLUMN_PAGEFAULTSDELTA]
+#define Column_VirtualMemorySize Columns[COLUMN_VIRTUALMEMORYSIZE]
+#define Column_PagedPool Columns[COLUMN_PAGEDPOOL]
+#define Column_NonPagedPool Columns[COLUMN_NONPAGEDPOOL]
+#define Column_BasePriority Columns[COLUMN_BASEPRIORITY]
+#define Column_HandleCount Columns[COLUMN_HANDLECOUNT]
+#define Column_ThreadCount Columns[COLUMN_THREADCOUNT]
+#define Column_GDIObjects Columns[COLUMN_GDIOBJECTS]
+#define Column_IOWrites Columns[COLUMN_IOWRITES]
+#define Column_IOWriteBytes Columns[COLUMN_IOWRITEBYTES]
+#define Column_IOOther Columns[COLUMN_IOOTHER]
+#define Column_IOOtherBytes Columns[COLUMN_IOOTHERBYTES]
void ProcessPage_OnViewSelectColumns(void);
void AddColumns(void);
Modified: trunk/reactos/base/applications/taskmgr/precomp.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/taskmgr/…
==============================================================================
--- trunk/reactos/base/applications/taskmgr/precomp.h (original)
+++ trunk/reactos/base/applications/taskmgr/precomp.h Fri Aug 3 11:35:39 2007
@@ -14,6 +14,7 @@
#include <stdio.h>
#include <ctype.h>
+#include "column.h"
#include "taskmgr.h"
#include "perfdata.h"
#include "perfpage.h"
@@ -22,7 +23,6 @@
#include "proclist.h"
#include "affinity.h"
#include "applpage.h"
-#include "column.h"
#include "dbgchnl.h"
#include "debug.h"
#include "endproc.h"
Modified: trunk/reactos/base/applications/taskmgr/taskmgr.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/taskmgr/…
==============================================================================
--- trunk/reactos/base/applications/taskmgr/taskmgr.c (original)
+++ trunk/reactos/base/applications/taskmgr/taskmgr.c Fri Aug 3 11:35:39 2007
@@ -698,60 +698,12 @@
/* 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++) {
+
+ for (i = 0; i < COLUMN_NMAX; i++) {
+ TaskManagerSettings.Columns[i] = ColumnPresets[i].bDefaults;
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.ColumnSizeArray[i] = ColumnPresets[i].size;
+ }
TaskManagerSettings.SortColumn = 1;
TaskManagerSettings.SortAscending = TRUE;
Modified: trunk/reactos/base/applications/taskmgr/taskmgr.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/taskmgr/…
==============================================================================
--- trunk/reactos/base/applications/taskmgr/taskmgr.h (original)
+++ trunk/reactos/base/applications/taskmgr/taskmgr.h Fri Aug 3 11:35:39 2007
@@ -77,34 +77,10 @@
/* Processes page settings */
BOOL ShowProcessesFromAllUsers; /* Server-only? */
- BOOL Column_ImageName;
- BOOL Column_PID;
- BOOL Column_CPUUsage;
- BOOL Column_CPUTime;
- BOOL Column_MemoryUsage;
- BOOL Column_MemoryUsageDelta;
- BOOL Column_PeakMemoryUsage;
- BOOL Column_PageFaults;
- BOOL Column_USERObjects;
- BOOL Column_IOReads;
- BOOL Column_IOReadBytes;
- BOOL Column_SessionID; /* Server-only? */
- BOOL Column_UserName; /* Server-only? */
- BOOL Column_PageFaultsDelta;
- BOOL Column_VirtualMemorySize;
- BOOL Column_PagedPool;
- BOOL Column_NonPagedPool;
- BOOL Column_BasePriority;
- BOOL Column_HandleCount;
- BOOL Column_ThreadCount;
- BOOL Column_GDIObjects;
- BOOL Column_IOWrites;
- BOOL Column_IOWriteBytes;
- BOOL Column_IOOther;
- BOOL Column_IOOtherBytes;
- int ColumnOrderArray[25];
- int ColumnSizeArray[25];
- int SortColumn;
+ BOOL Columns[COLUMN_NMAX];
+ int ColumnOrderArray[COLUMN_NMAX];
+ int ColumnSizeArray[COLUMN_NMAX];
+ int SortColumn;
BOOL SortAscending;
/* Performance page settings */