mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-09-02 12:23:31 +00:00
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
This commit is contained in:
@@ -1,53 +0,0 @@
|
||||
/*
|
||||
* ReactOS Task Manager
|
||||
*
|
||||
* font.cpp
|
||||
*
|
||||
* Copyright (C) 1999 - 2001 Brian Palmer <[email protected]>
|
||||
*
|
||||
* 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);
|
||||
}
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
/*
|
||||
* ReactOS Task Manager
|
||||
*
|
||||
* font.h
|
||||
*
|
||||
* Copyright (C) 1999 - 2001 Brian Palmer <[email protected]>
|
||||
*
|
||||
* 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 */
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 646 B |
@@ -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
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
<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>
|
||||
|
||||
Reference in New Issue
Block a user