Use localizible strings Based on patch from Michael Müller michael@fds-team.de From: Vijay Kiran Kamuju infyquest@gmail.com Signed-off-by: Vijay Kiran Kamuju infyquest@gmail.com --- programs/taskmgr/graph.c | 22 +++++-- programs/taskmgr/resource.h | 118 +++++++++++++++++++----------------- programs/taskmgr/taskmgr.rc | 3 + 3 files changed, 83 insertions(+), 60 deletions(-)
diff --git a/programs/taskmgr/graph.c b/programs/taskmgr/graph.c index 7e978e16f7a..1c35de1fe41 100644 --- a/programs/taskmgr/graph.c +++ b/programs/taskmgr/graph.c @@ -239,8 +239,8 @@ static void Graph_DrawMemUsageGraph(HDC hDC, HWND hWnd) /* Top bars that are "unused", i.e. are dark green, representing free memory */ int i;
- static const WCHAR wszFormat[] = {'%','d','K',0}; - + static WCHAR wszMemUsage[8]; + /* * Get the client area rectangle */ @@ -257,8 +257,22 @@ static void Graph_DrawMemUsageGraph(HDC hDC, HWND hWnd) CommitChargeTotal = (ULONGLONG)PerfDataGetCommitChargeTotalK(); CommitChargeLimit = (ULONGLONG)PerfDataGetCommitChargeLimitK();
- swprintf(Text, wszFormat, (int)CommitChargeTotal); - + if (CommitChargeTotal > 1048576) + { + LoadStringW(hInst, IDS_MEMORYUSAGEGB, wszMemUsage, ARRAY_SIZE(wszMemUsage)); + swprintf(Text, wszMemUsage, (float)CommitChargeTotal / 1048576); + } + else if (CommitChargeTotal > 1024) + { + LoadStringW(hInst, IDS_MEMORYUSAGEMB, wszMemUsage, ARRAY_SIZE(wszMemUsage)); + swprintf(Text, wszMemUsage, (DWORD)CommitChargeTotal / 1024); + } + else + { + LoadStringW(hInst, IDS_MEMORYUSAGEKB, wszMemUsage, ARRAY_SIZE(wszMemUsage)); + swprintf(Text, wszMemUsage, (DWORD)CommitChargeTotal); + } + /* * Draw the font text onto the graph * The bottom 20 pixels are reserved for the text diff --git a/programs/taskmgr/resource.h b/programs/taskmgr/resource.h index 4153f66c329..29f0d7dac66 100644 --- a/programs/taskmgr/resource.h +++ b/programs/taskmgr/resource.h @@ -62,69 +62,72 @@ #define IDC_MEMORYUSAGE 1026 #define IDC_TOTALS_THREAD_COUNT 1026 #define IDC_CPU8 1027 -#define IDC_MEMORYUSAGEDELTA 1027 +#define IDC_MEMORYUSAGEGB 1027 #define IDC_TOTALS_PROCESS_COUNT 1027 #define IDC_CPU9 1028 -#define IDC_PEAKMEMORYUSAGE 1028 +#define IDC_MEMORYUSAGEKB 1028 #define IDC_COMMIT_CHARGE_TOTAL 1028 #define IDC_CPU10 1029 -#define IDC_PAGEFAULTS 1029 +#define IDC_MEMORYUSAGEMB 1029 #define IDC_COMMIT_CHARGE_LIMIT 1029 #define IDC_CPU11 1030 -#define IDC_USEROBJECTS 1030 +#define IDC_MEMORYUSAGEDELTA 1030 #define IDC_COMMIT_CHARGE_PEAK 1030 #define IDC_CPU12 1031 -#define IDC_IOREADS 1031 +#define IDC_PEAKMEMORYUSAGE 1031 #define IDC_PHYSICAL_MEMORY_TOTAL 1031 #define IDC_CPU13 1032 -#define IDC_IOREADBYTES 1032 +#define IDC_PAGEFAULTS 1032 #define IDC_PHYSICAL_MEMORY_AVAILABLE 1032 #define IDC_CPU14 1033 -#define IDC_SESSIONID 1033 +#define IDC_USEROBJECTS 1033 #define IDC_PHYSICAL_MEMORY_SYSTEM_CACHE 1033 #define IDC_CPU15 1034 -#define IDC_USERNAME 1034 +#define IDC_IOREADS 1034 #define IDC_KERNEL_MEMORY_TOTAL 1034 #define IDC_CPU16 1035 -#define IDC_PAGEFAULTSDELTA 1035 +#define IDC_IOREADBYTES 1035 #define IDC_KERNEL_MEMORY_PAGED 1035 #define IDC_CPU17 1036 -#define IDC_VIRTUALMEMORYSIZE 1036 +#define IDC_SESSIONID 1036 #define IDC_KERNEL_MEMORY_NONPAGED 1036 #define IDC_CPU18 1037 -#define IDC_PAGEDPOOL 1037 +#define IDC_USERNAME 1037 #define IDC_TOTALS_FRAME 1037 #define IDC_CPU19 1038 -#define IDC_NONPAGEDPOOL 1038 +#define IDC_PAGEFAULTSDELTA 1038 #define IDC_COMMIT_CHARGE_FRAME 1038 #define IDC_CPU20 1039 -#define IDC_BASEPRIORITY 1039 +#define IDC_VIRTUALMEMORYSIZE 1039 #define IDC_KERNEL_MEMORY_FRAME 1039 #define IDC_CPU21 1040 -#define IDC_HANDLECOUNT 1040 +#define IDC_PAGEDPOOL 1040 #define IDC_PHYSICAL_MEMORY_FRAME 1040 #define IDC_CPU22 1041 -#define IDC_THREADCOUNT 1041 +#define IDC_NONPAGEDPOOL 1041 #define IDC_CPU23 1042 +#define IDC_BASEPRIORITY 1042 #define IDC_CPU24 1043 -#define IDC_GDIOBJECTS 1043 +#define IDC_HANDLECOUNT 1043 #define IDC_CPU_USAGE_FRAME 1043 #define IDC_CPU25 1044 -#define IDC_IOWRITES 1044 +#define IDC_THREADCOUNT 1044 #define IDC_MEM_USAGE_FRAME 1044 #define IDC_CPU26 1045 -#define IDC_IOWRITEBYTES 1045 +#define IDC_GDIOBJECTS 1045 #define IDC_CPU_USAGE_HISTORY_FRAME 1045 #define IDC_CPU27 1046 -#define IDC_IOOTHER 1046 +#define IDC_IOWRITES 1046 #define IDC_MEMORY_USAGE_HISTORY_FRAME 1046 #define IDC_CPU28 1047 -#define IDC_IOOTHERBYTES 1047 +#define IDC_IOWRITEBYTES 1047 #define IDC_CPU_USAGE_GRAPH 1047 #define IDC_CPU29 1048 +#define IDC_IOOTHER 1048 #define IDC_MEM_USAGE_GRAPH2 1048 #define IDC_MEM_USAGE_GRAPH 1048 #define IDC_CPU30 1049 +#define IDC_IOOTHERBYTES 1049 #define IDC_MEM_USAGE_HISTORY_GRAPH 1049 #define IDC_CPU31 1050 #define IDC_CPU_USAGE_HISTORY_GRAPH 1050 @@ -207,42 +210,45 @@ #define IDS_CPUUSAGE 32834 #define IDS_CPUTIME 32835 #define IDS_MEMORYUSAGE 32836 -#define IDS_MEMORYUSAGEDELTA 32837 -#define IDS_PEAKMEMORYUSAGE 32838 -#define IDS_PAGEFAULTS 32839 -#define IDS_USEROBJECTS 32840 -#define IDS_IOREADS 32841 -#define IDS_IOREADBYTES 32842 -#define IDS_SESSIONID 32843 -#define IDS_USERNAME 32844 -#define IDS_PAGEFAULTSDELTA 32845 -#define IDS_VIRTUALMEMORYSIZE 32846 -#define IDS_PAGEDPOOL 32847 -#define IDS_NONPAGEDPOOL 32848 -#define IDS_BASEPRIORITY 32849 -#define IDS_HANDLECOUNT 32850 -#define IDS_THREADCOUNT 32851 -#define IDS_GDIOBJECTS 32852 -#define IDS_IOWRITES 32853 -#define IDS_IOWRITEBYTES 32854 -#define IDS_IOOTHER 32855 -#define IDS_IOOTHERBYTES 32856 -#define IDS_WARNING_TITLE 32857 -#define IDS_PRIORITY_CHANGE_MESSAGE 32858 -#define IDS_PRIORITY_UNABLE2CHANGE 32859 -#define IDS_TERMINATE_MESSAGE 32860 -#define IDS_TERMINATE_UNABLE2TERMINATE 32861 -#define IDS_DEBUG_MESSAGE 32862 -#define IDS_DEBUG_UNABLE2DEBUG 32863 -#define IDS_AFFINITY_ERROR_MESSAGE 32864 -#define IDS_AFFINITY_ERROR_TITLE 32865 -#define IDS_AFFINITY_UNABLE2ACCESS 32866 -#define IDS_SYSTEM_IDLE_PROCESS 32867 -#define IDS_APPLICATION_NOT_RESPONDING 32868 -#define IDS_APPLICATION_RUNNING 32869 -#define IDS_APPLICATION_TASK 32870 -#define IDS_APPLICATION_STATUS 32871 -#define IDS_DEBUG_CHANNEL 32872 +#define IDS_MEMORYUSAGEGB 32837 +#define IDS_MEMORYUSAGEKB 32838 +#define IDS_MEMORYUSAGEMB 32839 +#define IDS_MEMORYUSAGEDELTA 32840 +#define IDS_PEAKMEMORYUSAGE 32841 +#define IDS_PAGEFAULTS 32842 +#define IDS_USEROBJECTS 32843 +#define IDS_IOREADS 32844 +#define IDS_IOREADBYTES 32845 +#define IDS_SESSIONID 32846 +#define IDS_USERNAME 32847 +#define IDS_PAGEFAULTSDELTA 32848 +#define IDS_VIRTUALMEMORYSIZE 32849 +#define IDS_PAGEDPOOL 32850 +#define IDS_NONPAGEDPOOL 32851 +#define IDS_BASEPRIORITY 32852 +#define IDS_HANDLECOUNT 32853 +#define IDS_THREADCOUNT 32854 +#define IDS_GDIOBJECTS 32855 +#define IDS_IOWRITES 32856 +#define IDS_IOWRITEBYTES 32857 +#define IDS_IOOTHER 32858 +#define IDS_IOOTHERBYTES 32859 +#define IDS_WARNING_TITLE 32860 +#define IDS_PRIORITY_CHANGE_MESSAGE 32861 +#define IDS_PRIORITY_UNABLE2CHANGE 32862 +#define IDS_TERMINATE_MESSAGE 32863 +#define IDS_TERMINATE_UNABLE2TERMINATE 32864 +#define IDS_DEBUG_MESSAGE 32865 +#define IDS_DEBUG_UNABLE2DEBUG 32866 +#define IDS_AFFINITY_ERROR_MESSAGE 32867 +#define IDS_AFFINITY_ERROR_TITLE 32868 +#define IDS_AFFINITY_UNABLE2ACCESS 32869 +#define IDS_SYSTEM_IDLE_PROCESS 32870 +#define IDS_APPLICATION_NOT_RESPONDING 32871 +#define IDS_APPLICATION_RUNNING 32872 +#define IDS_APPLICATION_TASK 32873 +#define IDS_APPLICATION_STATUS 32874 +#define IDS_DEBUG_CHANNEL 32875 #define IDC_STATIC -1
/* diff --git a/programs/taskmgr/taskmgr.rc b/programs/taskmgr/taskmgr.rc index ffd0699f80d..71ae3a38cdb 100644 --- a/programs/taskmgr/taskmgr.rc +++ b/programs/taskmgr/taskmgr.rc @@ -273,6 +273,9 @@ BEGIN IDS_CPUUSAGE "CPU" IDS_CPUTIME "CPU Time" IDS_MEMORYUSAGE "Mem Usage" + IDS_MEMORYUSAGEGB "%.1f GB" + IDS_MEMORYUSAGEKB "%u KB" + IDS_MEMORYUSAGEMB "%u MB" IDS_MEMORYUSAGEDELTA "Mem Delta" IDS_PEAKMEMORYUSAGE "Peak Mem Usage" IDS_PAGEFAULTS "Page Faults"