don't use a bitmap font to draw the text in the graphs. However, it currently doesn...
authorThomas Bluemel <thomas@reactsoft.com>
Thu, 12 Jan 2006 21:28:07 +0000 (21:28 +0000)
committerThomas Bluemel <thomas@reactsoft.com>
Thu, 12 Jan 2006 21:28:07 +0000 (21:28 +0000)
svn path=/trunk/; revision=20821

reactos/subsys/system/taskmgr/font.c [deleted file]
reactos/subsys/system/taskmgr/font.h [deleted file]
reactos/subsys/system/taskmgr/graph.c
reactos/subsys/system/taskmgr/precomp.h
reactos/subsys/system/taskmgr/res/font.bmp [deleted file]
reactos/subsys/system/taskmgr/resource.h
reactos/subsys/system/taskmgr/taskmgr.rc
reactos/subsys/system/taskmgr/taskmgr.xml

diff --git a/reactos/subsys/system/taskmgr/font.c b/reactos/subsys/system/taskmgr/font.c
deleted file mode 100644 (file)
index 9a98786..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- *  ReactOS Task Manager
- *
- *  font.cpp
- *
- *  Copyright (C) 1999 - 2001  Brian Palmer  <brianp@reactos.org>
- *
- * 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 <precomp.h>
-
-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 (file)
index 3419d44..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- *  ReactOS Task Manager
- *
- *  font.h
- *
- *  Copyright (C) 1999 - 2001  Brian Palmer  <brianp@reactos.org>
- *
- * 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 */
index e05a701..7b07368 100644 (file)
@@ -134,6 +134,8 @@ void Graph_DrawCpuUsageGraph(HDC hDC, HWND hWnd)
     RECT            rcClient;
     RECT            rcBarLeft;
     RECT            rcBarRight;
     RECT            rcClient;
     RECT            rcBarLeft;
     RECT            rcBarRight;
+    RECT            rcText;
+    COLORREF        crPrevForeground;
     TCHAR            Text[260];
     ULONG            CpuUsage;
     ULONG            CpuKernelUsage;
     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;
 
     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
 
     /*
      * 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
 
     /*
      * 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            rcClient;
     RECT            rcBarLeft;
     RECT            rcBarRight;
+    RECT            rcText;
+    COLORREF        crPrevForeground;
     TCHAR            Text[260];
     ULONGLONG        CommitChargeTotal;
     ULONGLONG        CommitChargeLimit;
     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
                _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
 
     /*
      * Now we have to draw the graph
index a1ad482..0ad6b1f 100644 (file)
@@ -25,7 +25,6 @@
 #include "dbgchnl.h"
 #include "debug.h"
 #include "endproc.h"
 #include "dbgchnl.h"
 #include "debug.h"
 #include "endproc.h"
-#include "font.h"
 #include "graph.h"
 #include "graphctl.h"
 #include "optnmenu.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 (file)
index 60cc65b..0000000
Binary files a/reactos/subsys/system/taskmgr/res/font.bmp and /dev/null differ
index b9a0e29..6f45c8f 100644 (file)
@@ -28,7 +28,6 @@
 #define IDR_PROCESS_PAGE_CONTEXT        144
 #define IDB_TRAYMASK                    150
 #define IDB_TRAYICON                    153
 #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
 
 #define IDD_DEBUG_CHANNELS_DIALOG       155
 #define IDC_DEBUG_CHANNELS_LIST         156
 
index 3cc5820..322fe28 100644 (file)
@@ -201,52 +201,6 @@ IDB_TRAYICON            BITMAP  DISCARDABLE res/trayicon.bmp
  '00 00 00 00 00 00'
 } */
 
  '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"
 #include "Cz.rc"
 #include "En.rc"
 #include "De.rc"
index 98c351d..a9ef1e2 100644 (file)
@@ -17,7 +17,6 @@
                <file>dbgchnl.c</file>
                <file>debug.c</file>
                <file>endproc.c</file>
                <file>dbgchnl.c</file>
                <file>debug.c</file>
                <file>endproc.c</file>
-               <file>font.c</file>
                <file>graph.c</file>
                <file>optnmenu.c</file>
                <file>perfdata.c</file>
                <file>graph.c</file>
                <file>optnmenu.c</file>
                <file>perfdata.c</file>