[TASKMGR] Allow setting each column alignment independently (#7208)

Add dwAlign attribute to the PresetColumnEntry structure to make it work.

CORE-19280
This commit is contained in:
Jose Carlos Jesus 2024-08-02 22:54:41 +01:00 committed by GitHub
parent 045333e890
commit deccfb8c9f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 30 additions and 29 deletions

View File

@ -10,36 +10,36 @@
UINT ColumnDataHints[COLUMN_NMAX];
#define DECLARE_COLUMN_PRESET(_name, _size, _state) \
{ IDS_TAB_##_name, IDC_##_name, _size, _state },
#define DECLARE_COLUMN_PRESET(_name, _size, _state, _align) \
{ IDS_TAB_##_name, IDC_##_name, _size, _state, _align },
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)
DECLARE_COLUMN_PRESET(COMMANDLINE, 450, FALSE)
DECLARE_COLUMN_PRESET(IMAGENAME, 105, TRUE, LVCFMT_LEFT)
DECLARE_COLUMN_PRESET(PID, 50, TRUE, LVCFMT_LEFT)
DECLARE_COLUMN_PRESET(USERNAME, 107, FALSE, LVCFMT_LEFT)
DECLARE_COLUMN_PRESET(SESSIONID, 70, FALSE, LVCFMT_LEFT)
DECLARE_COLUMN_PRESET(CPUUSAGE, 35, TRUE, LVCFMT_RIGHT)
DECLARE_COLUMN_PRESET(CPUTIME, 70, TRUE, LVCFMT_RIGHT)
DECLARE_COLUMN_PRESET(MEMORYUSAGE, 70, TRUE, LVCFMT_RIGHT)
DECLARE_COLUMN_PRESET(PEAKMEMORYUSAGE, 100, FALSE, LVCFMT_RIGHT)
DECLARE_COLUMN_PRESET(MEMORYUSAGEDELTA, 70, FALSE, LVCFMT_RIGHT)
DECLARE_COLUMN_PRESET(PAGEFAULTS, 70, FALSE, LVCFMT_RIGHT)
DECLARE_COLUMN_PRESET(PAGEFAULTSDELTA, 70, FALSE, LVCFMT_RIGHT)
DECLARE_COLUMN_PRESET(VIRTUALMEMORYSIZE, 70, FALSE, LVCFMT_RIGHT)
DECLARE_COLUMN_PRESET(PAGEDPOOL, 70, FALSE, LVCFMT_RIGHT)
DECLARE_COLUMN_PRESET(NONPAGEDPOOL, 70, FALSE, LVCFMT_RIGHT)
DECLARE_COLUMN_PRESET(BASEPRIORITY, 60, FALSE, LVCFMT_RIGHT)
DECLARE_COLUMN_PRESET(HANDLECOUNT, 60, FALSE, LVCFMT_RIGHT)
DECLARE_COLUMN_PRESET(THREADCOUNT, 60, FALSE, LVCFMT_RIGHT)
DECLARE_COLUMN_PRESET(USEROBJECTS, 60, FALSE, LVCFMT_RIGHT)
DECLARE_COLUMN_PRESET(GDIOBJECTS, 60, FALSE, LVCFMT_RIGHT)
DECLARE_COLUMN_PRESET(IOREADS, 70, FALSE, LVCFMT_RIGHT)
DECLARE_COLUMN_PRESET(IOWRITES, 70, FALSE, LVCFMT_RIGHT)
DECLARE_COLUMN_PRESET(IOOTHER, 70, FALSE, LVCFMT_RIGHT)
DECLARE_COLUMN_PRESET(IOREADBYTES, 70, FALSE, LVCFMT_RIGHT)
DECLARE_COLUMN_PRESET(IOWRITEBYTES, 70, FALSE, LVCFMT_RIGHT)
DECLARE_COLUMN_PRESET(IOOTHERBYTES, 70, FALSE, LVCFMT_RIGHT)
DECLARE_COLUMN_PRESET(COMMANDLINE, 450, FALSE, LVCFMT_LEFT)
};
static int InsertColumn(int nCol, LPCWSTR lpszColumnHeading, int nFormat, int nWidth, int nSubItem);
@ -54,7 +54,7 @@ void AddColumns(void)
for (n=0; n<COLUMN_NMAX; n++) {
if (TaskManagerSettings.Columns[n]) {
LoadStringW(hInst, ColumnPresets[n].dwIdsName, szTemp, _countof(szTemp));
InsertColumn(n, szTemp, LVCFMT_LEFT, TaskManagerSettings.ColumnSizeArray[n], -1);
InsertColumn(n, szTemp, ColumnPresets[n].dwAlign, TaskManagerSettings.ColumnSizeArray[n], -1);
}
}

View File

@ -60,6 +60,7 @@ typedef struct {
DWORD dwIdcCtrl;
int size;
BOOL bDefaults;
DWORD dwAlign;
} PresetColumnEntry;