From e3b06b1df2d986b4a37577646e6e33a7afbce043 Mon Sep 17 00:00:00 2001 From: Thomas Bluemel Date: Thu, 12 Jan 2006 21:28:07 +0000 Subject: [PATCH] don't use a bitmap font to draw the text in the graphs. However, it currently doesn't use the shell font because the graph controls could use some serious work. svn path=/trunk/; revision=20821 --- reactos/subsys/system/taskmgr/font.c | 53 --------------------- reactos/subsys/system/taskmgr/font.h | 28 ----------- reactos/subsys/system/taskmgr/graph.c | 35 ++++++-------- reactos/subsys/system/taskmgr/precomp.h | 1 - reactos/subsys/system/taskmgr/res/font.bmp | Bin 646 -> 0 bytes reactos/subsys/system/taskmgr/resource.h | 1 - reactos/subsys/system/taskmgr/taskmgr.rc | 46 ------------------ reactos/subsys/system/taskmgr/taskmgr.xml | 1 - 8 files changed, 15 insertions(+), 150 deletions(-) delete mode 100644 reactos/subsys/system/taskmgr/font.c delete mode 100644 reactos/subsys/system/taskmgr/font.h delete mode 100644 reactos/subsys/system/taskmgr/res/font.bmp diff --git a/reactos/subsys/system/taskmgr/font.c b/reactos/subsys/system/taskmgr/font.c deleted file mode 100644 index 9a98786ae28..00000000000 --- a/reactos/subsys/system/taskmgr/font.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - * ReactOS Task Manager - * - * font.cpp - * - * Copyright (C) 1999 - 2001 Brian Palmer - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include - -void Font_DrawText(HDC hDC, LPCTSTR lpszText, int x, int y) -{ - HDC hFontDC; - HBITMAP hFontBitmap; - HBITMAP hOldBitmap; - int i; - - hFontDC = CreateCompatibleDC(hDC); - hFontBitmap = LoadBitmap(hInst, MAKEINTRESOURCE(IDB_FONT)); - hOldBitmap = (HBITMAP)SelectObject(hFontDC, hFontBitmap); - - for (i = 0; i < (int)_tcslen(lpszText); i++) { - if ((lpszText[i] >= '0') && (lpszText[i] <= '9')) { - BitBlt(hDC, x + (i * 8), y, 8, 11, hFontDC, (lpszText[i] - '0') * 8, 0, SRCCOPY); - } - else if (lpszText[i] == 'K') - { - BitBlt(hDC, x + (i * 8), y, 8, 11, hFontDC, 80, 0, SRCCOPY); - } - else if (lpszText[i] == '%') - { - BitBlt(hDC, x + (i * 8), y, 8, 11, hFontDC, 88, 0, SRCCOPY); - } - } - SelectObject(hFontDC, hOldBitmap); - DeleteObject(hFontBitmap); - DeleteDC(hFontDC); -} - diff --git a/reactos/subsys/system/taskmgr/font.h b/reactos/subsys/system/taskmgr/font.h deleted file mode 100644 index 3419d44cd5a..00000000000 --- a/reactos/subsys/system/taskmgr/font.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * ReactOS Task Manager - * - * font.h - * - * Copyright (C) 1999 - 2001 Brian Palmer - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#ifndef __FONT_H -#define __FONT_H - -void Font_DrawText(HDC hDC, LPCTSTR lpszText, int x, int y); - -#endif /* __FONT_H */ diff --git a/reactos/subsys/system/taskmgr/graph.c b/reactos/subsys/system/taskmgr/graph.c index e05a701c102..7b073682184 100644 --- a/reactos/subsys/system/taskmgr/graph.c +++ b/reactos/subsys/system/taskmgr/graph.c @@ -134,6 +134,8 @@ void Graph_DrawCpuUsageGraph(HDC hDC, HWND hWnd) RECT rcClient; RECT rcBarLeft; RECT rcBarRight; + RECT rcText; + COLORREF crPrevForeground; TCHAR Text[260]; ULONG CpuUsage; ULONG CpuKernelUsage; @@ -163,28 +165,16 @@ void Graph_DrawCpuUsageGraph(HDC hDC, HWND hWnd) if (CpuUsage < 0) CpuUsage = 0; if (CpuUsage > 100) CpuUsage = 100; - /* - * Check and see how many digits it will take - * so we get the indentation right every time. - */ - if (CpuUsage == 100) - { - _stprintf(Text, _T("%d%%"), (int)CpuUsage); - } - else if (CpuUsage < 10) - { - _stprintf(Text, _T(" %d%%"), (int)CpuUsage); - } - else - { - _stprintf(Text, _T(" %d%%"), (int)CpuUsage); - } + _stprintf(Text, _T("%d%%"), (int)CpuUsage); /* * Draw the font text onto the graph - * The bottom 20 pixels are reserved for the text */ - Font_DrawText(hDC, Text, ((rcClient.right - rcClient.left) - 32) / 2, rcClient.bottom - 11 - 5); + rcText = rcClient; + InflateRect(&rcText, -2, -2); + crPrevForeground = SetTextColor(hDC, RGB(0, 255, 0)); + DrawText(hDC, Text, -1, &rcText, DT_BOTTOM | DT_CENTER | DT_NOPREFIX | DT_SINGLELINE); + SetTextColor(hDC, crPrevForeground); /* * Now we have to draw the graph @@ -310,6 +300,8 @@ void Graph_DrawMemUsageGraph(HDC hDC, HWND hWnd) RECT rcClient; RECT rcBarLeft; RECT rcBarRight; + RECT rcText; + COLORREF crPrevForeground; TCHAR Text[260]; ULONGLONG CommitChargeTotal; ULONGLONG CommitChargeLimit; @@ -342,9 +334,12 @@ void Graph_DrawMemUsageGraph(HDC hDC, HWND hWnd) _stprintf(Text, _T("%d K"), (int)CommitChargeTotal); /* * Draw the font text onto the graph - * The bottom 20 pixels are reserved for the text */ - Font_DrawText(hDC, Text, ((rcClient.right - rcClient.left) - (_tcslen(Text) * 8)) / 2, rcClient.bottom - 11 - 5); + rcText = rcClient; + InflateRect(&rcText, -2, -2); + crPrevForeground = SetTextColor(hDC, RGB(0, 255, 0)); + DrawText(hDC, Text, -1, &rcText, DT_BOTTOM | DT_CENTER | DT_NOPREFIX | DT_SINGLELINE); + SetTextColor(hDC, crPrevForeground); /* * Now we have to draw the graph diff --git a/reactos/subsys/system/taskmgr/precomp.h b/reactos/subsys/system/taskmgr/precomp.h index a1ad48263cf..0ad6b1fd7d7 100644 --- a/reactos/subsys/system/taskmgr/precomp.h +++ b/reactos/subsys/system/taskmgr/precomp.h @@ -25,7 +25,6 @@ #include "dbgchnl.h" #include "debug.h" #include "endproc.h" -#include "font.h" #include "graph.h" #include "graphctl.h" #include "optnmenu.h" diff --git a/reactos/subsys/system/taskmgr/res/font.bmp b/reactos/subsys/system/taskmgr/res/font.bmp deleted file mode 100644 index 60cc65bb70d47715d23a1f2478a32838e94c13db..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 646 zcmZvZ!BNF93`7OP$y_Mo*TJ10sDg7&)STTDP{BcJWyN+W8Jh0C5BwDz#>$*f3kCbjU%&0kMkBt+>mWbwNqlN}K zQlhf4EEv(FF6!aAJBv8j2*~lo1C6p_v=`kzJC+ErF`eitog4_%FGPz?A}cb&uv!!0PK}{Q~&?~ diff --git a/reactos/subsys/system/taskmgr/resource.h b/reactos/subsys/system/taskmgr/resource.h index b9a0e297a3f..6f45c8fe2f0 100644 --- a/reactos/subsys/system/taskmgr/resource.h +++ b/reactos/subsys/system/taskmgr/resource.h @@ -28,7 +28,6 @@ #define IDR_PROCESS_PAGE_CONTEXT 144 #define IDB_TRAYMASK 150 #define IDB_TRAYICON 153 -#define IDB_FONT 154 #define IDD_DEBUG_CHANNELS_DIALOG 155 #define IDC_DEBUG_CHANNELS_LIST 156 diff --git a/reactos/subsys/system/taskmgr/taskmgr.rc b/reactos/subsys/system/taskmgr/taskmgr.rc index 3cc5820b756..322fe28b3b4 100644 --- a/reactos/subsys/system/taskmgr/taskmgr.rc +++ b/reactos/subsys/system/taskmgr/taskmgr.rc @@ -201,52 +201,6 @@ IDB_TRAYICON BITMAP DISCARDABLE res/trayicon.bmp '00 00 00 00 00 00' } */ -/* BINRES font.bmp */ -IDB_FONT BITMAP DISCARDABLE res/font.bmp -/* { - '42 4D 86 02 00 00 00 00 00 00 76 00 00 00 28 00' - '00 00 60 00 00 00 0B 00 00 00 01 00 04 00 00 00' - '00 00 10 02 00 00 74 12 00 00 74 12 00 00 00 00' - '00 00 00 00 00 00 00 00 00 00 00 00 80 00 00 80' - '00 00 00 80 80 00 80 00 00 00 80 00 80 00 80 80' - '00 00 C0 C0 C0 00 80 80 80 00 00 00 FF 00 00 FF' - '00 00 00 FF FF 00 FF 00 00 00 FF 00 FF 00 FF FF' - '00 00 FF FF FF 00 AA AA AA A0 00 00 0A 00 AA AA' - 'AA A0 AA AA AA A0 00 00 00 A0 AA AA AA A0 AA AA' - 'AA A0 00 00 00 A0 AA AA AA A0 AA AA AA A0 A0 00' - '00 A0 00 00 00 00 A0 00 00 A0 00 00 0A 00 A0 00' - '00 00 00 00 00 A0 00 00 00 A0 00 00 00 A0 A0 00' - '00 A0 00 00 00 A0 A0 00 00 A0 00 00 00 A0 A0 00' - '0A 00 00 00 AA 00 A0 00 00 A0 00 00 0A 00 A0 00' - '00 00 00 00 00 A0 00 00 00 A0 00 00 00 A0 A0 00' - '00 A0 00 00 00 A0 A0 00 00 A0 00 00 00 A0 A0 00' - 'A0 00 A0 0A 00 A0 A0 00 00 A0 00 00 0A 00 A0 00' - '00 00 00 00 00 A0 00 00 00 A0 00 00 00 A0 A0 00' - '00 A0 00 00 00 A0 A0 00 00 A0 00 00 00 A0 A0 0A' - '00 00 0A 00 AA 00 A0 00 00 A0 00 00 0A 00 A0 00' - '00 00 00 00 00 A0 00 00 00 A0 00 00 00 A0 A0 00' - '00 A0 00 00 00 A0 A0 00 00 A0 00 00 00 A0 A0 A0' - '00 00 00 A0 00 00 A0 00 00 A0 00 00 0A 00 AA AA' - 'AA A0 0A AA AA A0 AA AA AA A0 AA AA AA A0 AA AA' - 'AA A0 00 00 00 A0 AA AA AA A0 AA AA AA A0 AA 00' - '00 00 00 0A 00 00 A0 00 00 A0 00 00 0A 00 00 00' - '00 A0 00 00 00 A0 A0 00 00 A0 A0 00 00 00 A0 00' - '00 00 00 00 00 A0 A0 00 00 A0 A0 00 00 A0 A0 A0' - '00 00 00 00 A0 00 A0 00 00 A0 00 00 0A 00 00 00' - '00 A0 00 00 00 A0 A0 00 00 A0 A0 00 00 00 A0 00' - '00 00 00 00 00 A0 A0 00 00 A0 A0 00 00 A0 A0 0A' - '00 00 0A A0 0A 00 A0 00 00 A0 00 00 0A 00 00 00' - '00 A0 00 00 00 A0 A0 00 00 A0 A0 00 00 00 A0 00' - '00 00 00 00 00 A0 A0 00 00 A0 A0 00 00 A0 A0 00' - 'A0 00 A0 0A 00 A0 A0 00 00 A0 00 00 0A 00 00 00' - '00 A0 00 00 00 A0 A0 00 00 A0 A0 00 00 00 A0 00' - '00 00 00 00 00 A0 A0 00 00 A0 A0 00 00 A0 A0 00' - '0A 00 0A A0 00 00 AA AA AA A0 00 00 0A 00 AA AA' - 'AA A0 AA AA AA A0 A0 00 00 A0 AA AA AA A0 AA AA' - 'AA A0 AA AA AA A0 AA AA AA A0 AA AA AA A0 A0 00' - '00 A0 00 00 00 00' -} */ - #include "Cz.rc" #include "En.rc" #include "De.rc" diff --git a/reactos/subsys/system/taskmgr/taskmgr.xml b/reactos/subsys/system/taskmgr/taskmgr.xml index 98c351db140..a9ef1e22e82 100644 --- a/reactos/subsys/system/taskmgr/taskmgr.xml +++ b/reactos/subsys/system/taskmgr/taskmgr.xml @@ -17,7 +17,6 @@ dbgchnl.c debug.c endproc.c - font.c graph.c optnmenu.c perfdata.c