Author: janderwald
Date: Fri Feb 15 22:22:55 2008
New Revision: 32380
URL:
http://svn.reactos.org/svn/reactos?rev=32380&view=rev
Log:
- taskmgr improvements by Carlo Bramix
See issue #3075 for more details.
Modified:
trunk/reactos/base/applications/taskmgr/about.c
trunk/reactos/base/applications/taskmgr/affinity.c
trunk/reactos/base/applications/taskmgr/applpage.c
trunk/reactos/base/applications/taskmgr/applpage.h
trunk/reactos/base/applications/taskmgr/column.c
trunk/reactos/base/applications/taskmgr/endproc.c
trunk/reactos/base/applications/taskmgr/procpage.c
trunk/reactos/base/applications/taskmgr/taskmgr.c
trunk/reactos/base/applications/taskmgr/taskmgr.h
Modified: trunk/reactos/base/applications/taskmgr/about.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/taskmgr/…
==============================================================================
--- trunk/reactos/base/applications/taskmgr/about.c (original)
+++ trunk/reactos/base/applications/taskmgr/about.c Fri Feb 15 22:22:55 2008
@@ -1,7 +1,7 @@
/*
* ReactOS Task Manager
*
- * about.cpp
+ * about.c
*
* Copyright (C) 1999 - 2001 Brian Palmer <brianp(a)reactos.org>
*
Modified: trunk/reactos/base/applications/taskmgr/affinity.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/taskmgr/…
==============================================================================
--- trunk/reactos/base/applications/taskmgr/affinity.c (original)
+++ trunk/reactos/base/applications/taskmgr/affinity.c Fri Feb 15 22:22:55 2008
@@ -1,7 +1,7 @@
/*
* ReactOS Task Manager
*
- * affinity.cpp
+ * affinity.c
*
* Copyright (C) 1999 - 2001 Brian Palmer <brianp(a)reactos.org>
* 2005 Klemens Friedl <frik85(a)reactos.at>
@@ -24,8 +24,6 @@
#include <precomp.h>
HANDLE hProcessAffinityHandle;
-WCHAR szTemp[256];
-WCHAR szTempA[256];
static const DWORD dwCpuTable[] = {
IDC_CPU0, IDC_CPU1, IDC_CPU2, IDC_CPU3,
@@ -46,6 +44,7 @@
ULONG Index;
DWORD dwProcessId;
WCHAR strErrorText[260];
+ WCHAR szTitle[256];
for (Index=0; Index<(ULONG)ListView_GetItemCount(hProcessPageListCtrl); Index++)
{
memset(&lvitem, 0, sizeof(LV_ITEM));
@@ -62,8 +61,8 @@
hProcessAffinityHandle =
OpenProcess(PROCESS_QUERY_INFORMATION|PROCESS_SET_INFORMATION, FALSE, dwProcessId);
if (!hProcessAffinityHandle) {
GetLastErrorText(strErrorText, sizeof(strErrorText) / sizeof(WCHAR));
- LoadStringW(hInst, IDS_MSG_ACCESSPROCESSAFF, szTemp, sizeof(szTemp) /
sizeof(WCHAR));
- MessageBoxW(hMainWnd, strErrorText, szTemp, MB_OK|MB_ICONSTOP);
+ LoadStringW(hInst, IDS_MSG_ACCESSPROCESSAFF, szTitle, sizeof(szTitle) /
sizeof(WCHAR));
+ MessageBoxW(hMainWnd, strErrorText, szTitle, MB_OK|MB_ICONSTOP);
return;
}
DialogBoxW(hInst, MAKEINTRESOURCEW(IDD_AFFINITY_DIALOG), hMainWnd,
AffinityDialogWndProc);
@@ -79,6 +78,7 @@
DWORD dwProcessAffinityMask = 0;
DWORD dwSystemAffinityMask = 0;
WCHAR strErrorText[260];
+ WCHAR szTitle[256];
BYTE nCpu;
switch (message) {
@@ -91,8 +91,8 @@
if (!GetProcessAffinityMask(hProcessAffinityHandle, &dwProcessAffinityMask,
&dwSystemAffinityMask)) {
GetLastErrorText(strErrorText, sizeof(strErrorText) / sizeof(WCHAR));
EndDialog(hDlg, 0);
- LoadStringW(hInst, IDS_MSG_ACCESSPROCESSAFF, szTemp, sizeof(szTemp) /
sizeof(WCHAR));
- MessageBoxW(hMainWnd, strErrorText, szTemp, MB_OK|MB_ICONSTOP);
+ LoadStringW(hInst, IDS_MSG_ACCESSPROCESSAFF, szTitle, sizeof(szTitle) /
sizeof(WCHAR));
+ MessageBoxW(hMainWnd, strErrorText, szTitle, MB_OK|MB_ICONSTOP);
}
for (nCpu=0; nCpu<sizeof(dwCpuTable) / sizeof(dwCpuTable[0]); nCpu++) {
@@ -143,9 +143,9 @@
* of it's cpu time.
*/
if (!dwProcessAffinityMask) {
- LoadStringW(hInst, IDS_MSG_PROCESSONEPRO, szTemp, sizeof(szTemp) /
sizeof(WCHAR));
- LoadStringW(hInst, IDS_MSG_INVALIDOPTION, szTempA, sizeof(szTempA) /
sizeof(WCHAR));
- MessageBoxW(hDlg, szTemp, szTempA, MB_OK|MB_ICONSTOP);
+ LoadStringW(hInst, IDS_MSG_PROCESSONEPRO, strErrorText,
sizeof(strErrorText) / sizeof(WCHAR));
+ LoadStringW(hInst, IDS_MSG_INVALIDOPTION, szTitle, sizeof(szTitle) /
sizeof(WCHAR));
+ MessageBoxW(hDlg, strErrorText, szTitle, MB_OK|MB_ICONSTOP);
return TRUE;
}
@@ -155,8 +155,8 @@
if (!SetProcessAffinityMask(hProcessAffinityHandle, dwProcessAffinityMask))
{
GetLastErrorText(strErrorText, sizeof(strErrorText) / sizeof(WCHAR));
EndDialog(hDlg, LOWORD(wParam));
- LoadStringW(hInst, IDS_MSG_ACCESSPROCESSAFF, szTemp, sizeof(szTemp) /
sizeof(WCHAR));
- MessageBoxW(hMainWnd, strErrorText, szTemp, MB_OK|MB_ICONSTOP);
+ LoadStringW(hInst, IDS_MSG_ACCESSPROCESSAFF, szTitle, sizeof(szTitle) /
sizeof(WCHAR));
+ MessageBoxW(hMainWnd, strErrorText, szTitle, MB_OK|MB_ICONSTOP);
}
EndDialog(hDlg, LOWORD(wParam));
Modified: trunk/reactos/base/applications/taskmgr/applpage.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/taskmgr/…
==============================================================================
--- trunk/reactos/base/applications/taskmgr/applpage.c (original)
+++ trunk/reactos/base/applications/taskmgr/applpage.c Fri Feb 15 22:22:55 2008
@@ -1,7 +1,7 @@
/*
* ReactOS Task Manager
*
- * applicationpage.cpp
+ * applpage.c
*
* Copyright (C) 1999 - 2001 Brian Palmer <brianp(a)reactos.org>
* 2005 Klemens Friedl <frik85(a)reactos.at>
@@ -196,18 +196,13 @@
{
DWORD dwStyle = GetWindowLongW(hApplicationPageListCtrl, GWL_STYLE);
- dwStyle &= ~LVS_REPORT;
- dwStyle &= ~LVS_ICON;
- dwStyle &= ~LVS_LIST;
- dwStyle &= ~LVS_SMALLICON;
-
- if (TaskManagerSettings.View_LargeIcons)
- dwStyle |= LVS_ICON;
- else if (TaskManagerSettings.View_SmallIcons)
- dwStyle |= LVS_SMALLICON;
- else
- dwStyle |= LVS_REPORT;
-
+ dwStyle &= ~(LVS_REPORT | LVS_ICON | LVS_LIST | LVS_SMALLICON);
+
+ switch (TaskManagerSettings.ViewMode) {
+ case ID_VIEW_LARGE: dwStyle |= LVS_ICON; break;
+ case ID_VIEW_SMALL: dwStyle |= LVS_SMALLICON; break;
+ case ID_VIEW_DETAILS: dwStyle |= LVS_REPORT; break;
+ }
SetWindowLongW(hApplicationPageListCtrl, GWL_STYLE, dwStyle);
RefreshApplicationPage();
@@ -265,7 +260,7 @@
if (hWnd == hMainWnd)
return TRUE;
- bLargeIcon = TaskManagerSettings.View_LargeIcons ? TRUE : FALSE;
+ bLargeIcon = (TaskManagerSettings.ViewMode == ID_VIEW_LARGE);
GetWindowTextW(hWnd, szText, 260); /* Get the window text */
@@ -521,13 +516,12 @@
if (pAPLI->bHung)
{
LoadStringW( GetModuleHandleW(NULL), IDS_Not_Responding , szMsg,
sizeof(szMsg) / sizeof(szMsg[0]));
- wcsncpy(pnmdi->item.pszText, szMsg, pnmdi->item.cchTextMax);
}
else
{
LoadStringW( GetModuleHandleW(NULL), IDS_Running, (LPWSTR) szMsg,
sizeof(szMsg) / sizeof(szMsg[0]));
- wcsncpy(pnmdi->item.pszText, szMsg, pnmdi->item.cchTextMax);
}
+ wcsncpy(pnmdi->item.pszText, szMsg, pnmdi->item.cchTextMax);
}
break;
@@ -591,12 +585,7 @@
hMenu = LoadMenuW(hInst, MAKEINTRESOURCEW(IDR_APPLICATION_PAGE_CONTEXT1));
hSubMenu = GetSubMenu(hMenu, 0);
- if (TaskManagerSettings.View_LargeIcons)
- CheckMenuRadioItem(hSubMenu, ID_VIEW_LARGE, ID_VIEW_DETAILS, ID_VIEW_LARGE,
MF_BYCOMMAND);
- else if (TaskManagerSettings.View_SmallIcons)
- CheckMenuRadioItem(hSubMenu, ID_VIEW_LARGE, ID_VIEW_DETAILS, ID_VIEW_SMALL,
MF_BYCOMMAND);
- else
- CheckMenuRadioItem(hSubMenu, ID_VIEW_LARGE, ID_VIEW_DETAILS, ID_VIEW_DETAILS,
MF_BYCOMMAND);
+ CheckMenuRadioItem(hSubMenu, ID_VIEW_LARGE, ID_VIEW_DETAILS,
TaskManagerSettings.ViewMode, MF_BYCOMMAND);
TrackPopupMenu(hSubMenu, TPM_LEFTALIGN|TPM_TOPALIGN|TPM_LEFTBUTTON, pt.x, pt.y, 0,
hMainWnd, NULL);
@@ -649,7 +638,7 @@
DestroyMenu(hMenu);
}
-void ApplicationPage_OnViewLargeIcons(void)
+void ApplicationPage_OnView(DWORD dwMode)
{
HMENU hMenu;
HMENU hViewMenu;
@@ -657,47 +646,13 @@
hMenu = GetMenu(hMainWnd);
hViewMenu = GetSubMenu(hMenu, 2);
- TaskManagerSettings.View_LargeIcons = TRUE;
- TaskManagerSettings.View_SmallIcons = FALSE;
- TaskManagerSettings.View_Details = FALSE;
- CheckMenuRadioItem(hViewMenu, ID_VIEW_LARGE, ID_VIEW_DETAILS, ID_VIEW_LARGE,
MF_BYCOMMAND);
+ TaskManagerSettings.ViewMode = dwMode;
+ CheckMenuRadioItem(hViewMenu, ID_VIEW_LARGE, ID_VIEW_DETAILS, dwMode, MF_BYCOMMAND);
UpdateApplicationListControlViewSetting();
}
-void ApplicationPage_OnViewSmallIcons(void)
-{
- HMENU hMenu;
- HMENU hViewMenu;
-
- hMenu = GetMenu(hMainWnd);
- hViewMenu = GetSubMenu(hMenu, 2);
-
- TaskManagerSettings.View_LargeIcons = FALSE;
- TaskManagerSettings.View_SmallIcons = TRUE;
- TaskManagerSettings.View_Details = FALSE;
- CheckMenuRadioItem(hViewMenu, ID_VIEW_LARGE, ID_VIEW_DETAILS, ID_VIEW_SMALL,
MF_BYCOMMAND);
-
- UpdateApplicationListControlViewSetting();
-}
-
-void ApplicationPage_OnViewDetails(void)
-{
- HMENU hMenu;
- HMENU hViewMenu;
-
- hMenu = GetMenu(hMainWnd);
- hViewMenu = GetSubMenu(hMenu, 2);
-
- TaskManagerSettings.View_LargeIcons = FALSE;
- TaskManagerSettings.View_SmallIcons = FALSE;
- TaskManagerSettings.View_Details = TRUE;
- CheckMenuRadioItem(hViewMenu, ID_VIEW_LARGE, ID_VIEW_DETAILS, ID_VIEW_DETAILS,
MF_BYCOMMAND);
-
- UpdateApplicationListControlViewSetting();
-}
-
-void ApplicationPage_OnWindowsTileHorizontally(void)
+void ApplicationPage_OnWindowsTile(DWORD dwMode)
{
LPAPPLICATION_PAGE_LIST_ITEM pAPLI = NULL;
LV_ITEM item;
@@ -717,45 +672,14 @@
if (item.state & LVIS_SELECTED) {
pAPLI = (LPAPPLICATION_PAGE_LIST_ITEM)item.lParam;
-
if (pAPLI) {
hWndArray[nWndCount] = pAPLI->hWnd;
nWndCount++;
}
}
}
- TileWindows(NULL, MDITILE_HORIZONTAL, NULL, nWndCount, hWndArray);
- HeapFree(GetProcessHeap(), 0, hWndArray);
-}
-
-void ApplicationPage_OnWindowsTileVertically(void)
-{
- LPAPPLICATION_PAGE_LIST_ITEM pAPLI = NULL;
- LV_ITEM item;
- int i;
- HWND* hWndArray;
- int nWndCount;
-
- hWndArray = (HWND*)HeapAlloc(GetProcessHeap(), 0, sizeof(HWND) *
ListView_GetItemCount(hApplicationPageListCtrl));
- nWndCount = 0;
-
- for (i=0; i<ListView_GetItemCount(hApplicationPageListCtrl); i++) {
- memset(&item, 0, sizeof(LV_ITEM));
- item.mask = LVIF_STATE|LVIF_PARAM;
- item.iItem = i;
- item.stateMask = (UINT)-1;
- (void)ListView_GetItem(hApplicationPageListCtrl, &item);
-
- if (item.state & LVIS_SELECTED) {
- pAPLI = (LPAPPLICATION_PAGE_LIST_ITEM)item.lParam;
- if (pAPLI) {
- hWndArray[nWndCount] = pAPLI->hWnd;
- nWndCount++;
- }
- }
- }
-
- TileWindows(NULL, MDITILE_VERTICAL, NULL, nWndCount, hWndArray);
+
+ TileWindows(NULL, dwMode, NULL, nWndCount, hWndArray);
HeapFree(GetProcessHeap(), 0, hWndArray);
}
Modified: trunk/reactos/base/applications/taskmgr/applpage.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/taskmgr/…
==============================================================================
--- trunk/reactos/base/applications/taskmgr/applpage.h (original)
+++ trunk/reactos/base/applications/taskmgr/applpage.h Fri Feb 15 22:22:55 2008
@@ -34,11 +34,8 @@
void RefreshApplicationPage(void);
void UpdateApplicationListControlViewSetting(void);
-void ApplicationPage_OnViewLargeIcons(void);
-void ApplicationPage_OnViewSmallIcons(void);
-void ApplicationPage_OnViewDetails(void);
-void ApplicationPage_OnWindowsTileHorizontally(void);
-void ApplicationPage_OnWindowsTileVertically(void);
+void ApplicationPage_OnView(DWORD);
+void ApplicationPage_OnWindowsTile(DWORD);
void ApplicationPage_OnWindowsMinimize(void);
void ApplicationPage_OnWindowsMaximize(void);
void ApplicationPage_OnWindowsCascade(void);
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 Feb 15 22:22:55 2008
@@ -1,7 +1,7 @@
/*
* ReactOS Task Manager
*
- * column.cpp
+ * column.c
*
* Copyright (C) 1999 - 2001 Brian Palmer <brianp(a)reactos.org>
* 2005 Klemens Friedl <frik85(a)reactos.at>
@@ -24,7 +24,6 @@
#include <precomp.h>
UINT ColumnDataHints[COLUMN_NMAX];
-WCHAR szTemp[256];
#define DECLARE_COLUMN_PRESET(_name, _size, _state) \
{ IDS_TAB_##_name, IDC_##_name, _size, _state },
@@ -57,7 +56,7 @@
DECLARE_COLUMN_PRESET(IOOTHERBYTES, 70, FALSE)
};
-int InsertColumn(int nCol, LPCWSTR lpszColumnHeading, int nFormat, int
nWidth, int nSubItem);
+static int InsertColumn(int nCol, LPCWSTR lpszColumnHeading, int nFormat, int
nWidth, int nSubItem);
INT_PTR CALLBACK ColumnsDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM
lParam);
void AddColumns(void)
@@ -79,7 +78,7 @@
UpdateColumnDataHints();
}
-int InsertColumn(int nCol, LPCWSTR lpszColumnHeading, int nFormat, int nWidth, int
nSubItem)
+static int InsertColumn(int nCol, LPCWSTR lpszColumnHeading, int nFormat, int nWidth, int
nSubItem)
{
LVCOLUMN column;
@@ -107,6 +106,7 @@
HDITEM hditem;
int i, n;
WCHAR text[260];
+ WCHAR szTemp[256];
LRESULT size;
/* Reset column data */
Modified: trunk/reactos/base/applications/taskmgr/endproc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/taskmgr/…
==============================================================================
--- trunk/reactos/base/applications/taskmgr/endproc.c (original)
+++ trunk/reactos/base/applications/taskmgr/endproc.c Fri Feb 15 22:22:55 2008
@@ -23,15 +23,13 @@
#include <precomp.h>
-WCHAR szTemp[256];
-WCHAR szTempA[256];
-
void ProcessPage_OnEndProcess(void)
{
LVITEM lvitem;
ULONG Index;
DWORD dwProcessId;
HANDLE hProcess;
+ WCHAR szTitle[256];
WCHAR strErrorText[260];
for (Index=0; Index<(ULONG)ListView_GetItemCount(hProcessPageListCtrl); Index++)
@@ -53,9 +51,9 @@
if ((ListView_GetSelectedCount(hProcessPageListCtrl) != 1) || (dwProcessId == 0))
return;
- LoadStringW(hInst, IDS_MSG_WARNINGTERMINATING, szTemp, 256);
- LoadStringW(hInst, IDS_MSG_TASKMGRWARNING, szTempA, 256);
- if (MessageBoxW(hMainWnd, szTemp, szTempA, MB_YESNO|MB_ICONWARNING) != IDYES)
+ LoadStringW(hInst, IDS_MSG_WARNINGTERMINATING, strErrorText, 256);
+ LoadStringW(hInst, IDS_MSG_TASKMGRWARNING, szTitle, 256);
+ if (MessageBoxW(hMainWnd, strErrorText, szTitle, MB_YESNO|MB_ICONWARNING) != IDYES)
return;
hProcess = OpenProcess(PROCESS_TERMINATE, FALSE, dwProcessId);
@@ -63,16 +61,16 @@
if (!hProcess)
{
GetLastErrorText(strErrorText, 260);
- LoadStringW(hInst, IDS_MSG_UNABLETERMINATEPRO, szTemp, 256);
- MessageBoxW(hMainWnd, strErrorText, szTemp, MB_OK|MB_ICONSTOP);
+ LoadStringW(hInst, IDS_MSG_UNABLETERMINATEPRO, szTitle, 256);
+ MessageBoxW(hMainWnd, strErrorText, szTitle, MB_OK|MB_ICONSTOP);
return;
}
if (!TerminateProcess(hProcess, 0))
{
GetLastErrorText(strErrorText, 260);
- LoadStringW(hInst, IDS_MSG_UNABLETERMINATEPRO, szTemp, 256);
- MessageBoxW(hMainWnd, strErrorText, szTemp, MB_OK|MB_ICONSTOP);
+ LoadStringW(hInst, IDS_MSG_UNABLETERMINATEPRO, szTitle, 256);
+ MessageBoxW(hMainWnd, strErrorText, szTitle, MB_OK|MB_ICONSTOP);
}
CloseHandle(hProcess);
@@ -84,6 +82,7 @@
ULONG Index;
DWORD dwProcessId;
HANDLE hProcess;
+ WCHAR szTitle[256];
WCHAR strErrorText[260];
for (Index=0; Index<(ULONG)ListView_GetItemCount(hProcessPageListCtrl); Index++)
@@ -105,9 +104,9 @@
if ((ListView_GetSelectedCount(hProcessPageListCtrl) != 1) || (dwProcessId == 0))
return;
- LoadStringW(hInst, IDS_MSG_WARNINGTERMINATING, szTemp, 256);
- LoadStringW(hInst, IDS_MSG_TASKMGRWARNING, szTempA, 256);
- if (MessageBoxW(hMainWnd, szTemp, szTempA, MB_YESNO|MB_ICONWARNING) != IDYES)
+ LoadStringW(hInst, IDS_MSG_WARNINGTERMINATING, strErrorText, 256);
+ LoadStringW(hInst, IDS_MSG_TASKMGRWARNING, szTitle, 256);
+ if (MessageBoxW(hMainWnd, strErrorText, szTitle, MB_YESNO|MB_ICONWARNING) != IDYES)
return;
hProcess = OpenProcess(PROCESS_TERMINATE, FALSE, dwProcessId);
@@ -115,16 +114,16 @@
if (!hProcess)
{
GetLastErrorText(strErrorText, 260);
- LoadStringW(hInst, IDS_MSG_UNABLETERMINATEPRO, szTemp, 256);
- MessageBoxW(hMainWnd, strErrorText, szTemp, MB_OK|MB_ICONSTOP);
+ LoadStringW(hInst, IDS_MSG_UNABLETERMINATEPRO, szTitle, 256);
+ MessageBoxW(hMainWnd, strErrorText, szTitle, MB_OK|MB_ICONSTOP);
return;
}
if (!TerminateProcess(hProcess, 0))
{
GetLastErrorText(strErrorText, 260);
- LoadStringW(hInst, IDS_MSG_UNABLETERMINATEPRO, szTemp, 256);
- MessageBoxW(hMainWnd, strErrorText, szTemp, MB_OK|MB_ICONSTOP);
+ LoadStringW(hInst, IDS_MSG_UNABLETERMINATEPRO, szTitle, 256);
+ MessageBoxW(hMainWnd, strErrorText, szTitle, MB_OK|MB_ICONSTOP);
}
CloseHandle(hProcess);
Modified: trunk/reactos/base/applications/taskmgr/procpage.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/taskmgr/…
==============================================================================
--- trunk/reactos/base/applications/taskmgr/procpage.c (original)
+++ trunk/reactos/base/applications/taskmgr/procpage.c Fri Feb 15 22:22:55 2008
@@ -413,7 +413,6 @@
WCHAR strDebugger[260];
DWORD dwDebuggerSize;
HKEY hKey;
- UINT Idx;
memset(&si, 0, sizeof(SYSTEM_INFO));
@@ -460,9 +459,7 @@
dwDebuggerSize = 260;
if (RegQueryValueExW(hKey, L"Debugger", NULL, NULL,
(LPBYTE)strDebugger, &dwDebuggerSize) == ERROR_SUCCESS)
{
- for (Idx=0; Idx<wcslen(strDebugger); Idx++)
- strDebugger[Idx] = toupper(strDebugger[Idx]);
-
+ CharUpper(strDebugger);
if (wcsstr(strDebugger, L"DRWTSN32"))
EnableMenuItem(hSubMenu, ID_PROCESS_PAGE_DEBUG,
MF_BYCOMMAND|MF_DISABLED|MF_GRAYED);
}
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 Feb 15 22:22:55 2008
@@ -137,13 +137,9 @@
TaskManager_OnRestoreMainWindow();
break;
case ID_VIEW_LARGE:
- ApplicationPage_OnViewLargeIcons();
- break;
case ID_VIEW_SMALL:
- ApplicationPage_OnViewSmallIcons();
- break;
case ID_VIEW_DETAILS:
- ApplicationPage_OnViewDetails();
+ ApplicationPage_OnView(LOWORD(wParam));
break;
case ID_VIEW_SHOWKERNELTIMES:
PerformancePage_OnViewShowKernelTimes();
@@ -155,16 +151,10 @@
PerformancePage_OnViewCPUHistoryOneGraphPerCPU();
break;
case ID_VIEW_UPDATESPEED_HIGH:
- TaskManager_OnViewUpdateSpeedHigh();
- break;
case ID_VIEW_UPDATESPEED_NORMAL:
- TaskManager_OnViewUpdateSpeedNormal();
- break;
case ID_VIEW_UPDATESPEED_LOW:
- TaskManager_OnViewUpdateSpeedLow();
- break;
case ID_VIEW_UPDATESPEED_PAUSED:
- TaskManager_OnViewUpdateSpeedPaused();
+ TaskManager_OnViewUpdateSpeed(LOWORD(wParam));
break;
case ID_VIEW_SELECTCOLUMNS:
ProcessPage_OnViewSelectColumns();
@@ -173,10 +163,10 @@
PostMessageW(hDlg, WM_TIMER, 0, 0);
break;
case ID_WINDOWS_TILEHORIZONTALLY:
- ApplicationPage_OnWindowsTileHorizontally();
+ ApplicationPage_OnWindowsTile(MDITILE_HORIZONTAL);
break;
case ID_WINDOWS_TILEVERTICALLY:
- ApplicationPage_OnWindowsTileVertically();
+ ApplicationPage_OnWindowsTile(MDITILE_VERTICAL);
break;
case ID_WINDOWS_MINIMIZE:
ApplicationPage_OnWindowsMinimize();
@@ -413,6 +403,22 @@
lpRect->bottom - lpRect->top, clrTopLeft, clrBottomRight);
}
+static void SetUpdateSpeed(HWND hWnd)
+{
+ /* Setup update speed (pause=fall down) */
+ switch (TaskManagerSettings.UpdateSpeed) {
+ case ID_VIEW_UPDATESPEED_HIGH:
+ SetTimer(hWnd, 1, 1000, NULL);
+ break;
+ case ID_VIEW_UPDATESPEED_NORMAL:
+ SetTimer(hWnd, 1, 2000, NULL);
+ break;
+ case ID_VIEW_UPDATESPEED_LOW:
+ SetTimer(hWnd, 1, 4000, NULL);
+ break;
+ }
+}
+
BOOL OnCreate(HWND hWnd)
{
HMENU hMenu;
@@ -537,26 +543,15 @@
else
CheckMenuItem(hEditMenu, ID_OPTIONS_SHOW16BITTASKS, MF_BYCOMMAND|MF_UNCHECKED);
- if (TaskManagerSettings.View_LargeIcons)
- CheckMenuRadioItem(hViewMenu, ID_VIEW_LARGE, ID_VIEW_DETAILS, ID_VIEW_LARGE,
MF_BYCOMMAND);
- else if (TaskManagerSettings.View_SmallIcons)
- CheckMenuRadioItem(hViewMenu, ID_VIEW_LARGE, ID_VIEW_DETAILS, ID_VIEW_SMALL,
MF_BYCOMMAND);
- else
- CheckMenuRadioItem(hViewMenu, ID_VIEW_LARGE, ID_VIEW_DETAILS, ID_VIEW_DETAILS,
MF_BYCOMMAND);
+ /* Set the view mode */
+ CheckMenuRadioItem(hViewMenu, ID_VIEW_LARGE, ID_VIEW_DETAILS,
TaskManagerSettings.ViewMode, MF_BYCOMMAND);
if (TaskManagerSettings.ShowKernelTimes)
CheckMenuItem(hViewMenu, ID_VIEW_SHOWKERNELTIMES, MF_BYCOMMAND|MF_CHECKED);
else
CheckMenuItem(hViewMenu, ID_VIEW_SHOWKERNELTIMES, MF_BYCOMMAND|MF_UNCHECKED);
- if (TaskManagerSettings.UpdateSpeed == 1)
- CheckMenuRadioItem(hUpdateSpeedMenu, ID_VIEW_UPDATESPEED_HIGH,
ID_VIEW_UPDATESPEED_PAUSED, ID_VIEW_UPDATESPEED_HIGH, MF_BYCOMMAND);
- else if (TaskManagerSettings.UpdateSpeed == 2)
- CheckMenuRadioItem(hUpdateSpeedMenu, ID_VIEW_UPDATESPEED_HIGH,
ID_VIEW_UPDATESPEED_PAUSED, ID_VIEW_UPDATESPEED_NORMAL, MF_BYCOMMAND);
- else if (TaskManagerSettings.UpdateSpeed == 4)
- CheckMenuRadioItem(hUpdateSpeedMenu, ID_VIEW_UPDATESPEED_HIGH,
ID_VIEW_UPDATESPEED_PAUSED, ID_VIEW_UPDATESPEED_LOW, MF_BYCOMMAND);
- else
- CheckMenuRadioItem(hUpdateSpeedMenu, ID_VIEW_UPDATESPEED_HIGH,
ID_VIEW_UPDATESPEED_PAUSED, ID_VIEW_UPDATESPEED_PAUSED, MF_BYCOMMAND);
+ CheckMenuRadioItem(hUpdateSpeedMenu, ID_VIEW_UPDATESPEED_HIGH,
ID_VIEW_UPDATESPEED_PAUSED, TaskManagerSettings.UpdateSpeed, MF_BYCOMMAND);
if (TaskManagerSettings.CPUHistory_OneGraphPerCPU)
CheckMenuRadioItem(hCPUHistoryMenu, ID_VIEW_CPUHISTORY_ONEGRAPHALL,
ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU, ID_VIEW_CPUHISTORY_ONEGRAPHPERCPU, MF_BYCOMMAND);
@@ -569,12 +564,8 @@
TabCtrl_SetCurFocus/*Sel*/(hTabWnd, 2);
TabCtrl_SetCurFocus/*Sel*/(hTabWnd, nActivePage);
- if (TaskManagerSettings.UpdateSpeed == 1)
- SetTimer(hWnd, 1, 1000, NULL);
- else if (TaskManagerSettings.UpdateSpeed == 2)
- SetTimer(hWnd, 1, 2000, NULL);
- else if (TaskManagerSettings.UpdateSpeed == 4)
- SetTimer(hWnd, 1, 4000, NULL);
+ /* Setup update speed */
+ SetUpdateSpeed(hWnd);
/*
* Refresh the performance data
@@ -669,7 +660,7 @@
void LoadSettings(void)
{
HKEY hKey;
- WCHAR szSubKey[] = L"Software\\ReactWare\\TaskManager";
+ WCHAR szSubKey[] = L"Software\\ReactOS\\TaskManager";
int i;
DWORD dwSize;
@@ -690,12 +681,10 @@
TaskManagerSettings.Show16BitTasks = TRUE;
/* Update speed settings */
- TaskManagerSettings.UpdateSpeed = 2;
+ TaskManagerSettings.UpdateSpeed = ID_VIEW_UPDATESPEED_NORMAL;
/* Applications page settings */
- TaskManagerSettings.View_LargeIcons = FALSE;
- TaskManagerSettings.View_SmallIcons = FALSE;
- TaskManagerSettings.View_Details = TRUE;
+ TaskManagerSettings.ViewMode = ID_VIEW_DETAILS;
/* Processes page settings */
TaskManagerSettings.ShowProcessesFromAllUsers = FALSE; /* Server-only? */
@@ -735,8 +724,8 @@
{
HKEY hKey;
WCHAR szSubKey1[] = L"Software";
- WCHAR szSubKey2[] = L"Software\\ReactWare";
- WCHAR szSubKey3[] = L"Software\\ReactWare\\TaskManager";
+ WCHAR szSubKey2[] = L"Software\\ReactOS";
+ WCHAR szSubKey3[] = L"Software\\ReactOS\\TaskManager";
/* Open (or create) the key */
hKey = NULL;
@@ -819,7 +808,7 @@
SendMessageW(hStatusWnd, SB_SETTEXT, 0, (LPARAM)str);
}
-void TaskManager_OnViewUpdateSpeedHigh(void)
+void TaskManager_OnViewUpdateSpeed(DWORD dwSpeed)
{
HMENU hMenu;
HMENU hViewMenu;
@@ -829,64 +818,17 @@
hViewMenu = GetSubMenu(hMenu, 2);
hUpdateSpeedMenu = GetSubMenu(hViewMenu, 1);
- TaskManagerSettings.UpdateSpeed = 1;
- CheckMenuRadioItem(hUpdateSpeedMenu, ID_VIEW_UPDATESPEED_HIGH,
ID_VIEW_UPDATESPEED_PAUSED, ID_VIEW_UPDATESPEED_HIGH, MF_BYCOMMAND);
+ TaskManagerSettings.UpdateSpeed = dwSpeed;
+ CheckMenuRadioItem(hUpdateSpeedMenu, ID_VIEW_UPDATESPEED_HIGH,
ID_VIEW_UPDATESPEED_PAUSED, dwSpeed, MF_BYCOMMAND);
KillTimer(hMainWnd, 1);
- SetTimer(hMainWnd, 1, 500, NULL);
-}
-
-void TaskManager_OnViewUpdateSpeedNormal(void)
-{
- HMENU hMenu;
- HMENU hViewMenu;
- HMENU hUpdateSpeedMenu;
-
- hMenu = GetMenu(hMainWnd);
- hViewMenu = GetSubMenu(hMenu, 2);
- hUpdateSpeedMenu = GetSubMenu(hViewMenu, 1);
-
- TaskManagerSettings.UpdateSpeed = 2;
- CheckMenuRadioItem(hUpdateSpeedMenu, ID_VIEW_UPDATESPEED_HIGH,
ID_VIEW_UPDATESPEED_PAUSED, ID_VIEW_UPDATESPEED_NORMAL, MF_BYCOMMAND);
-
- KillTimer(hMainWnd, 1);
- SetTimer(hMainWnd, 1, 2000, NULL);
-}
-
-void TaskManager_OnViewUpdateSpeedLow(void)
-{
- HMENU hMenu;
- HMENU hViewMenu;
- HMENU hUpdateSpeedMenu;
-
- hMenu = GetMenu(hMainWnd);
- hViewMenu = GetSubMenu(hMenu, 2);
- hUpdateSpeedMenu = GetSubMenu(hViewMenu, 1);
-
- TaskManagerSettings.UpdateSpeed = 4;
- CheckMenuRadioItem(hUpdateSpeedMenu, ID_VIEW_UPDATESPEED_HIGH,
ID_VIEW_UPDATESPEED_PAUSED, ID_VIEW_UPDATESPEED_LOW, MF_BYCOMMAND);
-
- KillTimer(hMainWnd, 1);
- SetTimer(hMainWnd, 1, 4000, NULL);
+
+ SetUpdateSpeed(hMainWnd);
}
void TaskManager_OnViewRefresh(void)
{
PostMessageW(hMainWnd, WM_TIMER, 0, 0);
-}
-
-void TaskManager_OnViewUpdateSpeedPaused(void)
-{
- HMENU hMenu;
- HMENU hViewMenu;
- HMENU hUpdateSpeedMenu;
-
- hMenu = GetMenu(hMainWnd);
- hViewMenu = GetSubMenu(hMenu, 2);
- hUpdateSpeedMenu = GetSubMenu(hViewMenu, 1);
- TaskManagerSettings.UpdateSpeed = 0;
- CheckMenuRadioItem(hUpdateSpeedMenu, ID_VIEW_UPDATESPEED_HIGH,
ID_VIEW_UPDATESPEED_PAUSED, ID_VIEW_UPDATESPEED_PAUSED, MF_BYCOMMAND);
- KillTimer(hMainWnd, 1);
}
void TaskManager_OnTabWndSelChange(void)
@@ -933,12 +875,8 @@
DrawMenuBar(hMainWnd);
}
- if (TaskManagerSettings.View_LargeIcons)
- CheckMenuRadioItem(hViewMenu, ID_VIEW_LARGE, ID_VIEW_DETAILS, ID_VIEW_LARGE,
MF_BYCOMMAND);
- else if (TaskManagerSettings.View_SmallIcons)
- CheckMenuRadioItem(hViewMenu, ID_VIEW_LARGE, ID_VIEW_DETAILS, ID_VIEW_SMALL,
MF_BYCOMMAND);
- else
- CheckMenuRadioItem(hViewMenu, ID_VIEW_LARGE, ID_VIEW_DETAILS,
ID_VIEW_DETAILS, MF_BYCOMMAND);
+ CheckMenuRadioItem(hViewMenu, ID_VIEW_LARGE, ID_VIEW_DETAILS,
TaskManagerSettings.ViewMode, MF_BYCOMMAND);
+
/*
* Give the application list control focus
*/
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 Feb 15 22:22:55 2008
@@ -68,12 +68,10 @@
/* Update speed settings */
/* How many half-seconds in between updates (i.e. 0 - Paused, 1 - High, 2 - Normal, 4 -
Low) */
- int UpdateSpeed;
+ DWORD UpdateSpeed;
/* Applications page settings */
- BOOL View_LargeIcons;
- BOOL View_SmallIcons;
- BOOL View_Details;
+ DWORD ViewMode;
/* Processes page settings */
BOOL ShowProcessesFromAllUsers; /* Server-only? */
@@ -115,10 +113,7 @@
void TaskManager_OnEnterMenuLoop(HWND hWnd);
void TaskManager_OnExitMenuLoop(HWND hWnd);
void TaskManager_OnMenuSelect(HWND hWnd, UINT nItemID, UINT nFlags, HMENU hSysMenu);
-void TaskManager_OnViewUpdateSpeedHigh(void);
-void TaskManager_OnViewUpdateSpeedNormal(void);
-void TaskManager_OnViewUpdateSpeedLow(void);
-void TaskManager_OnViewUpdateSpeedPaused(void);
+void TaskManager_OnViewUpdateSpeed(DWORD);
void TaskManager_OnViewRefresh(void);
void TaskManager_OnTabWndSelChange(void);
LPTSTR GetLastErrorText( LPTSTR lpszBuf, DWORD dwSize );