ReactOS  0.4.15-dev-3728-ga92304f
graphctl.c File Reference
#include "precomp.h"
#include <math.h>
Include dependency graph for graphctl.c:

Go to the source code of this file.

Functions

BOOL GraphCtrl_Create (PTM_GRAPH_CONTROL inst, HWND hWnd, HWND hParentWnd, PTM_FORMAT fmt)
 
void GraphCtrl_Dispose (PTM_GRAPH_CONTROL inst)
 
void GraphCtrl_AddPoint (PTM_GRAPH_CONTROL inst, BYTE val0, BYTE val1)
 
void GraphCtrl_RedrawBitmap (PTM_GRAPH_CONTROL inst, INT h)
 
void GraphCtrl_RedrawOnHeightChange (PTM_GRAPH_CONTROL inst, INT nh)
 
INT_PTR CALLBACK GraphCtrl_WndProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
 

Variables

WNDPROC OldGraphCtrlWndProc
 
TM_GRAPH_CONTROL PerformancePageCpuUsageHistoryGraph
 
TM_GRAPH_CONTROL PerformancePageMemUsageHistoryGraph
 
HWND hPerformancePageCpuUsageHistoryGraph
 
HWND hPerformancePageMemUsageHistoryGraph
 

Function Documentation

◆ GraphCtrl_AddPoint()

void GraphCtrl_AddPoint ( PTM_GRAPH_CONTROL  inst,
BYTE  val0,
BYTE  val1 
)

Definition at line 139 of file graphctl.c.

140 {
141  HDC hdcg;
142  PBYTE t;
143  RECT rcDirt;
144 
145  UINT Prev0, Prev1, RetainingWidth;
146  INT PrevY, CurrY, p, v;
147 
148  hdcg = inst->hdcGraph;
149  RetainingWidth = inst->BitmapWidth - PLOT_SHIFT;
150  t = inst->PointBuffer;
151  Prev0 = *(t + inst->CurrIndex);
152  Prev1 = *(t + inst->CurrIndex + inst->NumberOfPoints);
153  if (inst->CurrIndex < inst->NumberOfPoints)
154  {
155  inst->CurrIndex++;
156  }
157  else
158  {
159  inst->CurrIndex = 0;
160  }
161  *(t + inst->CurrIndex) = val0;
162  *(t + inst->CurrIndex + inst->NumberOfPoints) = val1;
163 
164  /* Drawing points, first shifting the plot left */
165  BitBlt(hdcg, 0, 0, RetainingWidth, inst->BitmapHeight, hdcg, PLOT_SHIFT, 0, SRCCOPY);
166 
167  rcDirt.left = RetainingWidth;
168  rcDirt.top = 0;
169  rcDirt.right = inst->BitmapWidth;
170  rcDirt.bottom = inst->BitmapHeight;
171  FillRect(hdcg, &rcDirt, inst->hBrushBack);
172 
173  SelectObject(hdcg, inst->hPenGrid);
174  for (p = inst->GridCellHeight - 1;
175  p < inst->BitmapHeight;
176  p += inst->GridCellHeight)
177  {
178  MoveToEx(hdcg, RetainingWidth, p, NULL);
179  LineTo(hdcg, inst->BitmapWidth, p);
180  }
181  v = inst->CurrShift + PLOT_SHIFT;
182  if (v >= inst->GridCellWidth)
183  {
184  v -= inst->GridCellWidth;
185  p = inst->BitmapWidth - v - 1;
186  MoveToEx(hdcg, p, 0, NULL);
187  LineTo(hdcg, p, inst->BitmapHeight);
188  }
189  inst->CurrShift = v;
190 
191  if (inst->DrawSecondaryPlot)
192  {
193  SelectObject(inst->hdcGraph, inst->hPen1);
194 
195  PrevY = inst->BitmapHeight - Prev1 * inst->ftPixelsPerPercent;
196  MoveToEx(inst->hdcGraph, RetainingWidth - 1, PrevY, NULL);
197  CurrY = inst->BitmapHeight - val1 * inst->ftPixelsPerPercent;
198  LineTo(inst->hdcGraph, inst->BitmapWidth - 1, CurrY);
199  }
200 
201  SelectObject(inst->hdcGraph, inst->hPen0);
202  PrevY = inst->BitmapHeight - Prev0 * inst->ftPixelsPerPercent;
203  MoveToEx(inst->hdcGraph, RetainingWidth - 1, PrevY, NULL);
204  CurrY = inst->BitmapHeight - val0 * inst->ftPixelsPerPercent;
205  LineTo(inst->hdcGraph, inst->BitmapWidth - 1, CurrY);
206 }
PBYTE PointBuffer
Definition: graphctl.h:51
UINT32 NumberOfPoints
Definition: graphctl.h:52
BOOL DrawSecondaryPlot
Definition: graphctl.h:56
static HDC
Definition: imagelist.c:92
LONG top
Definition: windef.h:307
GLdouble GLdouble t
Definition: gl.h:2047
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
BOOL WINAPI LineTo(_In_ HDC, _In_ int, _In_ int)
LONG left
Definition: windef.h:306
#define PLOT_SHIFT
Definition: graphctl.h:26
LONG right
Definition: windef.h:308
int32_t INT
Definition: typedefs.h:58
HBRUSH hBrushBack
Definition: graphctl.h:43
BOOL WINAPI MoveToEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
FLOAT ftPixelsPerPercent
Definition: graphctl.h:55
UINT32 CurrIndex
Definition: graphctl.h:53
const GLdouble * v
Definition: gl.h:2040
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
LONG bottom
Definition: windef.h:309
GLfloat GLfloat p
Definition: glext.h:8902
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
BYTE * PBYTE
Definition: pedump.c:66
#define SRCCOPY
Definition: wingdi.h:333
static VOID NTAPI BitBlt(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Width, _In_ ULONG Height, _In_reads_bytes_(Delta *Height) PUCHAR Buffer, _In_ ULONG BitsPerPixel, _In_ ULONG Delta)
Definition: common.c:49

Referenced by PerformancePageRefreshThread().

◆ GraphCtrl_Create()

BOOL GraphCtrl_Create ( PTM_GRAPH_CONTROL  inst,
HWND  hWnd,
HWND  hParentWnd,
PTM_FORMAT  fmt 
)

Definition at line 16 of file graphctl.c.

17 {
18  HDC hdc, hdcg;
19  HBITMAP hbmOld;
20  UINT Size;
21  INT p;
22  RECT rc;
23 
24  inst->hParentWnd = hParentWnd;
25  inst->hWnd = hWnd;
26 
28  inst->BitmapWidth = Size;
29  Size /= PLOT_SHIFT;
31  if (!inst->PointBuffer)
32  {
33  goto fail;
34  }
35 
36  inst->NumberOfPoints = Size;
37  inst->CurrIndex = 0;
38 
39  /* Styling */
40  inst->hPenGrid = CreatePen(PS_SOLID, 0, fmt->clrGrid);
41  inst->hPen0 = CreatePen(PS_SOLID, 0, fmt->clrPlot0);
42  inst->hPen1 = CreatePen(PS_SOLID, 0, fmt->clrPlot1);
43  inst->hBrushBack = CreateSolidBrush(fmt->clrBack);
44 
45  if (!inst->hPenGrid ||
46  !inst->hPen0 ||
47  !inst->hPen1 ||
48  !inst->hBrushBack)
49  {
50  goto fail;
51  }
52 
53  if (fmt->GridCellWidth >= PLOT_SHIFT << 2)
54  inst->GridCellWidth = fmt->GridCellWidth;
55  else
56  inst->GridCellWidth = PLOT_SHIFT << 2;
57  if (fmt->GridCellHeight >= PLOT_SHIFT << 2)
58  inst->GridCellHeight = fmt->GridCellHeight;
59  else
60  inst->GridCellHeight = PLOT_SHIFT << 2;
61 
62  inst->DrawSecondaryPlot = fmt->DrawSecondaryPlot;
63 
64  GetClientRect(hWnd, &rc);
65  inst->BitmapHeight = rc.bottom;
66  inst->ftPixelsPerPercent = (FLOAT)(inst->BitmapHeight) / 100.00f;
67 
68  hdc = GetDC(hParentWnd);
69  hdcg = CreateCompatibleDC(hdc);
70  inst->hdcGraph = hdcg;
72 
73  if (!hdc ||
74  !hdcg ||
75  !inst->hbmGraph)
76  {
77  goto fail;
78  }
79 
80  ReleaseDC(hParentWnd, hdc);
81  hbmOld = (HBITMAP)SelectObject(hdcg, inst->hbmGraph);
82  DeleteObject(hbmOld);
83 
84  SetBkColor(hdcg, fmt->clrBack);
85  rc.right = inst->BitmapWidth;
86  FillRect(hdcg, &rc, inst->hBrushBack);
87 
88  inst->CurrShift = 0;
89  SelectObject(hdcg, inst->hPenGrid);
90  for (p = inst->GridCellHeight - 1;
91  p < inst->BitmapHeight;
92  p += inst->GridCellHeight)
93  {
94  MoveToEx(hdcg, 0, p, NULL);
95  LineTo(hdcg, inst->BitmapWidth, p);
96  }
97  for (p = inst->BitmapWidth - 1;
98  p > 0;
99  p -= inst->GridCellWidth)
100  {
101  MoveToEx(hdcg, p, 0, NULL);
102  LineTo(hdcg, p, inst->BitmapHeight);
103  }
104  SelectObject(hdcg, inst->hPen0);
105 
106  return TRUE;
107 
108 fail:
109  GraphCtrl_Dispose(inst);
110  return FALSE;
111 }
PBYTE PointBuffer
Definition: graphctl.h:51
HPEN WINAPI CreatePen(_In_ int, _In_ int, _In_ COLORREF)
UINT32 NumberOfPoints
Definition: graphctl.h:52
HDC WINAPI GetDC(_In_opt_ HWND)
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
BOOL DrawSecondaryPlot
Definition: graphctl.h:56
#define TRUE
Definition: types.h:120
static HDC
Definition: imagelist.c:92
HWND hWnd
Definition: settings.c:17
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
BOOL WINAPI LineTo(_In_ HDC, _In_ int, _In_ int)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
#define FLOAT
Definition: i386-dis.c:518
#define PLOT_SHIFT
Definition: graphctl.h:26
LONG right
Definition: windef.h:308
int32_t INT
Definition: typedefs.h:58
HBRUSH hBrushBack
Definition: graphctl.h:43
COLORREF WINAPI SetBkColor(_In_ HDC, _In_ COLORREF)
Definition: dc.c:999
BOOL WINAPI MoveToEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
#define PS_SOLID
Definition: wingdi.h:586
#define SM_CXSCREEN
Definition: winuser.h:953
#define FALSE
Definition: types.h:117
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
void GraphCtrl_Dispose(PTM_GRAPH_CONTROL inst)
Definition: graphctl.c:114
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
FLOAT ftPixelsPerPercent
Definition: graphctl.h:55
int WINAPI GetSystemMetrics(_In_ int)
#define NUM_PLOTS
Definition: graphctl.h:25
UINT32 CurrIndex
Definition: graphctl.h:53
HDC hdc
Definition: main.c:9
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
unsigned int UINT
Definition: ndis.h:50
#define NULL
Definition: types.h:112
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
LONG bottom
Definition: windef.h:309
static HBITMAP
Definition: button.c:44
HBITMAP hbmGraph
Definition: graphctl.h:39
GLfloat GLfloat p
Definition: glext.h:8902
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
Definition: dsound.c:943

Referenced by PerformancePageWndProc().

◆ GraphCtrl_Dispose()

void GraphCtrl_Dispose ( PTM_GRAPH_CONTROL  inst)

Definition at line 114 of file graphctl.c.

115 {
116  if (inst->PointBuffer)
117  HeapFree(GetProcessHeap(), 0, inst->PointBuffer);
118 
119  if (inst->hPenGrid)
120  DeleteObject(inst->hPenGrid);
121 
122  if (inst->hPen0)
123  DeleteObject(inst->hPen0);
124 
125  if (inst->hPen1)
126  DeleteObject(inst->hPen1);
127 
128  if (inst->hBrushBack)
129  DeleteObject(inst->hBrushBack);
130 
131  if (inst->hbmGraph)
132  DeleteObject(inst->hbmGraph);
133 
134  if (inst->hdcGraph)
135  DeleteObject(inst->hdcGraph);
136 }
PBYTE PointBuffer
Definition: graphctl.h:51
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
HBRUSH hBrushBack
Definition: graphctl.h:43
#define GetProcessHeap()
Definition: compat.h:595
HBITMAP hbmGraph
Definition: graphctl.h:39
#define HeapFree(x, y, z)
Definition: compat.h:594

Referenced by GraphCtrl_Create(), and PerformancePageWndProc().

◆ GraphCtrl_RedrawBitmap()

void GraphCtrl_RedrawBitmap ( PTM_GRAPH_CONTROL  inst,
INT  h 
)
inline

Definition at line 209 of file graphctl.c.

210 {
211  HDC hdcg;
212  PBYTE t;
213  RECT rc;
214  INT i, j, y, x, p;
215  FLOAT coef;
216 
217  hdcg = inst->hdcGraph;
218  rc.left = 0; rc.top = 0;
219  rc.right = inst->BitmapWidth; rc.bottom = h;
220  FillRect(hdcg, &rc, inst->hBrushBack);
221 
222  SelectObject(hdcg, inst->hPenGrid);
223 
224  for (p = inst->GridCellHeight - 1;
225  p < inst->BitmapHeight;
226  p += inst->GridCellHeight)
227  {
228  MoveToEx(hdcg, 0, p, NULL);
229  LineTo(hdcg, inst->BitmapWidth, p);
230  }
231 
232  for (p = inst->BitmapWidth - inst->CurrShift - 1;
233  p > 0;
234  p -= inst->GridCellWidth)
235  {
236  MoveToEx(hdcg, p, 0, NULL);
237  LineTo(hdcg, p, inst->BitmapHeight);
238  }
239 
240  coef = inst->ftPixelsPerPercent;
241 
242  if (inst->DrawSecondaryPlot)
243  {
244  SelectObject(hdcg, inst->hPen1);
245  t = inst->PointBuffer + inst->NumberOfPoints;
246  x = inst->BitmapWidth - 1;
247  j = inst->CurrIndex;
248  y = h - *(t + j) * coef;
249  MoveToEx(hdcg, x, y, NULL);
250  for (i = 0; i < inst->NumberOfPoints; i++)
251  {
252  j = (j ? j : inst->NumberOfPoints) - 1;
253  y = h - *(t + j) * coef;
254  x -= PLOT_SHIFT;
255  LineTo(hdcg, x, y);
256  }
257  }
258 
259  SelectObject(hdcg, inst->hPen0);
260  t = inst->PointBuffer;
261  x = inst->BitmapWidth - 1;
262  j = inst->CurrIndex;
263  y = h - *(t + j) * coef;
264  MoveToEx(hdcg, x, y, NULL);
265 
266  for (i = 0; i < inst->NumberOfPoints; i++)
267  {
268  j = (j ? j : inst->NumberOfPoints) - 1;
269  y = h - *(t + j) * coef;
270  x -= PLOT_SHIFT;
271  LineTo(hdcg, x, y);
272  }
273 }
PBYTE PointBuffer
Definition: graphctl.h:51
UINT32 NumberOfPoints
Definition: graphctl.h:52
BOOL DrawSecondaryPlot
Definition: graphctl.h:56
static HDC
Definition: imagelist.c:92
LONG top
Definition: windef.h:307
GLdouble GLdouble t
Definition: gl.h:2047
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
BOOL WINAPI LineTo(_In_ HDC, _In_ int, _In_ int)
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
LONG left
Definition: windef.h:306
#define PLOT_SHIFT
Definition: graphctl.h:26
LONG right
Definition: windef.h:308
int32_t INT
Definition: typedefs.h:58
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
HBRUSH hBrushBack
Definition: graphctl.h:43
BOOL WINAPI MoveToEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
FLOAT ftPixelsPerPercent
Definition: graphctl.h:55
UINT32 CurrIndex
Definition: graphctl.h:53
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define NULL
Definition: types.h:112
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
float FLOAT
Definition: typedefs.h:69
LONG bottom
Definition: windef.h:309
GLfloat GLfloat p
Definition: glext.h:8902
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
BYTE * PBYTE
Definition: pedump.c:66

Referenced by GraphCtrl_RedrawOnHeightChange(), and PerformancePage_OnViewShowKernelTimes().

◆ GraphCtrl_RedrawOnHeightChange()

void GraphCtrl_RedrawOnHeightChange ( PTM_GRAPH_CONTROL  inst,
INT  nh 
)
inline

Definition at line 276 of file graphctl.c.

277 {
278  HDC hdc;
279  HBITMAP hbmOld;
280 
281  inst->BitmapHeight = nh;
282  inst->ftPixelsPerPercent = (FLOAT)nh / 100.00f;
283 
284  hdc = GetDC(inst->hParentWnd);
285  hbmOld = inst->hbmGraph;
286  inst->hbmGraph = CreateCompatibleBitmap(hdc, inst->BitmapWidth, nh);
287  SelectObject(inst->hdcGraph, inst->hbmGraph);
288  DeleteObject(hbmOld);
289  ReleaseDC(inst->hParentWnd, hdc);
290 
291  GraphCtrl_RedrawBitmap(inst, nh);
292 }
HDC WINAPI GetDC(_In_opt_ HWND)
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
static HDC
Definition: imagelist.c:92
void GraphCtrl_RedrawBitmap(PTM_GRAPH_CONTROL inst, INT h)
Definition: graphctl.c:209
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1539
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
#define FLOAT
Definition: i386-dis.c:518
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
GLfloat f
Definition: glext.h:7540
FLOAT ftPixelsPerPercent
Definition: graphctl.h:55
HDC hdc
Definition: main.c:9
static HBITMAP
Definition: button.c:44
HBITMAP hbmGraph
Definition: graphctl.h:39

Referenced by GraphCtrl_WndProc().

◆ GraphCtrl_WndProc()

INT_PTR CALLBACK GraphCtrl_WndProc ( HWND  hWnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 300 of file graphctl.c.

301 {
302  PTM_GRAPH_CONTROL graph;
303 
304  switch (message)
305  {
306  case WM_ERASEBKGND:
307  return TRUE;
308  /*
309  * Filter out mouse & keyboard messages
310  */
311  // case WM_APPCOMMAND:
312  case WM_CAPTURECHANGED:
313  case WM_LBUTTONDBLCLK:
314  case WM_LBUTTONDOWN:
315  case WM_LBUTTONUP:
316  case WM_MBUTTONDBLCLK:
317  case WM_MBUTTONDOWN:
318  case WM_MBUTTONUP:
319  case WM_MOUSEACTIVATE:
320  case WM_MOUSEHOVER:
321  case WM_MOUSELEAVE:
322  case WM_MOUSEMOVE:
323  // case WM_MOUSEWHEEL:
324  case WM_NCHITTEST:
325  case WM_NCLBUTTONDBLCLK:
326  case WM_NCLBUTTONDOWN:
327  case WM_NCLBUTTONUP:
328  case WM_NCMBUTTONDBLCLK:
329  case WM_NCMBUTTONDOWN:
330  case WM_NCMBUTTONUP:
331  // case WM_NCMOUSEHOVER:
332  // case WM_NCMOUSELEAVE:
333  case WM_NCMOUSEMOVE:
334  case WM_NCRBUTTONDBLCLK:
335  case WM_NCRBUTTONDOWN:
336  case WM_NCRBUTTONUP:
337  // case WM_NCXBUTTONDBLCLK:
338  // case WM_NCXBUTTONDOWN:
339  // case WM_NCXBUTTONUP:
340  case WM_RBUTTONDBLCLK:
341  case WM_RBUTTONDOWN:
342  case WM_RBUTTONUP:
343  // case WM_XBUTTONDBLCLK:
344  // case WM_XBUTTONDOWN:
345  // case WM_XBUTTONUP:
346  case WM_ACTIVATE:
347  case WM_CHAR:
348  case WM_DEADCHAR:
349  case WM_GETHOTKEY:
350  case WM_HOTKEY:
351  case WM_KEYDOWN:
352  case WM_KEYUP:
353  case WM_KILLFOCUS:
354  case WM_SETFOCUS:
355  case WM_SETHOTKEY:
356  case WM_SYSCHAR:
357  case WM_SYSDEADCHAR:
358  case WM_SYSKEYDOWN:
359  case WM_SYSKEYUP:
360  return 0;
361 
362  case WM_NCCALCSIZE:
363  return 0;
364 
365  case WM_SIZE:
366  {
371  else
372  return 0;
373 
374  if (HIWORD(lParam) != graph->BitmapHeight)
375  {
377  }
379 
380  return 0;
381  }
382 
383  case WM_PAINT:
384  {
385  RECT rcClient;
386  HDC hdc;
387  PAINTSTRUCT ps;
388 
393  else
394  return 0;
395 
396  hdc = BeginPaint(hWnd, &ps);
397  GetClientRect(hWnd, &rcClient);
398  BitBlt(hdc, 0, 0,
399  rcClient.right,
400  rcClient.bottom,
401  graph->hdcGraph,
402  graph->BitmapWidth - rcClient.right,
403  0,
404  SRCCOPY);
405  EndPaint(hWnd, &ps);
406  return 0;
407  }
408  }
409 
410  /*
411  * We pass on all non-handled messages
412  */
414 }
#define WM_MBUTTONUP
Definition: winuser.h:1770
#define WM_NCLBUTTONDOWN
Definition: winuser.h:1679
#define WM_SETHOTKEY
Definition: winuser.h:1639
Definition: tftpd.h:59
#define WM_NCMBUTTONDBLCLK
Definition: winuser.h:1687
#define WM_CHAR
Definition: winuser.h:1704
#define WM_LBUTTONDOWN
Definition: winuser.h:1763
#define TRUE
Definition: types.h:120
#define WM_GETHOTKEY
Definition: winuser.h:1640
#define WM_HOTKEY
Definition: winuser.h:1866
#define WM_NCCALCSIZE
Definition: winuser.h:1672
#define WM_MOUSEHOVER
Definition: commctrl.h:4974
#define WM_CAPTURECHANGED
Definition: winuser.h:1795
static HDC
Definition: imagelist.c:92
HWND hWnd
Definition: settings.c:17
#define WM_NCRBUTTONDOWN
Definition: winuser.h:1682
#define WM_NCHITTEST
Definition: winuser.h:1673
BOOL WINAPI EndPaint(_In_ HWND, _In_ const PAINTSTRUCT *)
LONG right
Definition: windef.h:308
WPARAM wParam
Definition: combotst.c:138
#define WM_NCRBUTTONDBLCLK
Definition: winuser.h:1684
TM_GRAPH_CONTROL PerformancePageMemUsageHistoryGraph
Definition: perfpage.c:29
#define FALSE
Definition: types.h:117
#define WM_NCRBUTTONUP
Definition: winuser.h:1683
HDC WINAPI BeginPaint(_In_ HWND, _Out_ LPPAINTSTRUCT)
#define WM_MOUSELEAVE
Definition: commctrl.h:4975
#define WM_SYSCHAR
Definition: winuser.h:1708
#define WM_KEYDOWN
Definition: winuser.h:1702
#define WM_MOUSEACTIVATE
Definition: winuser.h:1624
WNDPROC OldGraphCtrlWndProc
Definition: graphctl.c:13
#define WM_RBUTTONDOWN
Definition: winuser.h:1766
#define WM_DEADCHAR
Definition: winuser.h:1705
#define WM_KILLFOCUS
Definition: winuser.h:1601
#define WM_SIZE
Definition: winuser.h:1598
#define WM_KEYUP
Definition: winuser.h:1703
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define WM_RBUTTONUP
Definition: winuser.h:1767
#define WM_PAINT
Definition: winuser.h:1607
HDC hdc
Definition: main.c:9
#define WM_NCMBUTTONUP
Definition: winuser.h:1686
#define WM_LBUTTONDBLCLK
Definition: winuser.h:1765
#define WM_MBUTTONDBLCLK
Definition: winuser.h:1771
#define WM_NCMBUTTONDOWN
Definition: winuser.h:1685
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
void GraphCtrl_RedrawOnHeightChange(PTM_GRAPH_CONTROL inst, INT nh)
Definition: graphctl.c:276
#define WM_ACTIVATE
Definition: winuser.h:1599
#define WM_SYSDEADCHAR
Definition: winuser.h:1709
#define WM_SYSKEYUP
Definition: winuser.h:1707
#define WM_LBUTTONUP
Definition: winuser.h:1764
#define WM_MBUTTONDOWN
Definition: winuser.h:1769
HWND hPerformancePageMemUsageHistoryGraph
Definition: perfpage.c:35
#define WM_MOUSEMOVE
Definition: winuser.h:1762
#define NULL
Definition: types.h:112
#define WM_RBUTTONDBLCLK
Definition: winuser.h:1768
#define WM_SYSKEYDOWN
Definition: winuser.h:1706
LRESULT WINAPI CallWindowProcW(_In_ WNDPROC, _In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_NCLBUTTONUP
Definition: winuser.h:1680
#define HIWORD(l)
Definition: typedefs.h:247
LONG bottom
Definition: windef.h:309
#define WM_ERASEBKGND
Definition: winuser.h:1612
#define WM_SETFOCUS
Definition: winuser.h:1600
LPARAM lParam
Definition: combotst.c:139
HWND hPerformancePageCpuUsageHistoryGraph
Definition: perfpage.c:34
#define SRCCOPY
Definition: wingdi.h:333
#define WM_NCMOUSEMOVE
Definition: winuser.h:1678
static VOID NTAPI BitBlt(_In_ ULONG Left, _In_ ULONG Top, _In_ ULONG Width, _In_ ULONG Height, _In_reads_bytes_(Delta *Height) PUCHAR Buffer, _In_ ULONG BitsPerPixel, _In_ ULONG Delta)
Definition: common.c:49
#define WM_NCLBUTTONDBLCLK
Definition: winuser.h:1681
TM_GRAPH_CONTROL PerformancePageCpuUsageHistoryGraph
Definition: perfpage.c:28

Referenced by PerformancePageWndProc().

Variable Documentation

◆ hPerformancePageCpuUsageHistoryGraph

HWND hPerformancePageCpuUsageHistoryGraph

◆ hPerformancePageMemUsageHistoryGraph

HWND hPerformancePageMemUsageHistoryGraph

◆ OldGraphCtrlWndProc

WNDPROC OldGraphCtrlWndProc

Definition at line 13 of file graphctl.c.

Referenced by GraphCtrl_WndProc(), and PerformancePageWndProc().

◆ PerformancePageCpuUsageHistoryGraph

TM_GRAPH_CONTROL PerformancePageCpuUsageHistoryGraph

◆ PerformancePageMemUsageHistoryGraph

TM_GRAPH_CONTROL PerformancePageMemUsageHistoryGraph