qcap/tests: Add media tests for the SmartTee filter.
[wine/multimedia.git] / programs / taskmgr / graphctl.c
blob6e8341207a854aa2c579c0e1b96499330956ef79
1 /*
2 * ReactOS Task Manager
4 * graphctl.c
6 * Copyright (C) 2002 Robert Dickenson <robd@reactos.org>
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 #include <stdio.h>
24 #include <stdlib.h>
25 #include <math.h>
27 #include <windows.h>
28 #include <commctrl.h>
29 #include "graphctl.h"
30 #include "taskmgr.h"
32 WNDPROC OldGraphCtrlWndProc;
34 static void GraphCtrl_Init(TGraphCtrl* this)
36 int i;
38 this->m_hWnd = 0;
39 this->m_hParentWnd = 0;
40 this->m_dcGrid = 0;
41 this->m_dcPlot = 0;
42 this->m_bitmapOldGrid = 0;
43 this->m_bitmapOldPlot = 0;
44 this->m_bitmapGrid = 0;
45 this->m_bitmapPlot = 0;
46 this->m_brushBack = 0;
48 this->m_penPlot[0] = 0;
49 this->m_penPlot[1] = 0;
50 this->m_penPlot[2] = 0;
51 this->m_penPlot[3] = 0;
53 /* since plotting is based on a LineTo for each new point
54 * we need a starting point (i.e. a "previous" point)
55 * use 0.0 as the default first point.
56 * these are public member variables, and can be changed outside
57 * (after construction). Therefore m_dPreviousPosition could be set to
58 * a more appropriate value prior to the first call to SetPosition.
60 this->m_dPreviousPosition[0] = 0.0;
61 this->m_dPreviousPosition[1] = 0.0;
62 this->m_dPreviousPosition[2] = 0.0;
63 this->m_dPreviousPosition[3] = 0.0;
65 /* public variable for the number of decimal places on the y axis */
66 this->m_nYDecimals = 3;
68 /* set some initial values for the scaling until "SetRange" is called.
69 * these are protected variables and must be set with SetRange
70 * in order to ensure that m_dRange is updated accordingly
72 /* m_dLowerLimit = -10.0; */
73 /* m_dUpperLimit = 10.0; */
74 this->m_dLowerLimit = 0.0;
75 this->m_dUpperLimit = 100.0;
76 this->m_dRange = this->m_dUpperLimit - this->m_dLowerLimit; /* protected member variable */
78 /* m_nShiftPixels determines how much the plot shifts (in terms of pixels) */
79 /* with the addition of a new data point */
80 this->m_nShiftPixels = 4;
81 this->m_nHalfShiftPixels = this->m_nShiftPixels/2; /* protected */
82 this->m_nPlotShiftPixels = this->m_nShiftPixels + this->m_nHalfShiftPixels; /* protected */
84 /* background, grid and data colors */
85 /* these are public variables and can be set directly */
86 this->m_crBackColor = RGB( 0, 0, 0); /* see also SetBackgroundColor */
87 this->m_crGridColor = RGB( 0, 255, 255); /* see also SetGridColor */
88 this->m_crPlotColor[0] = RGB(255, 255, 255); /* see also SetPlotColor */
89 this->m_crPlotColor[1] = RGB(100, 255, 255); /* see also SetPlotColor */
90 this->m_crPlotColor[2] = RGB(255, 100, 255); /* see also SetPlotColor */
91 this->m_crPlotColor[3] = RGB(255, 255, 100); /* see also SetPlotColor */
93 /* protected variables */
94 for (i = 0; i < MAX_PLOTS; i++)
96 this->m_penPlot[i] = CreatePen(PS_SOLID, 0, this->m_crPlotColor[i]);
98 this->m_brushBack = CreateSolidBrush(this->m_crBackColor);
100 /* public member variables, can be set directly */
101 strcpy(this->m_strXUnitsString, "Samples"); /* can also be set with SetXUnits */
102 strcpy(this->m_strYUnitsString, "Y units"); /* can also be set with SetYUnits */
104 /* protected bitmaps to restore the memory DC's */
105 this->m_bitmapOldGrid = NULL;
106 this->m_bitmapOldPlot = NULL;
109 #if 0
110 TGraphCtrl::~TGraphCtrl(void)
112 /* just to be picky restore the bitmaps for the two memory dc's */
113 /* (these dc's are being destroyed so there shouldn't be any leaks) */
114 if (m_bitmapOldGrid != NULL) SelectObject(m_dcGrid, m_bitmapOldGrid);
115 if (m_bitmapOldPlot != NULL) SelectObject(m_dcPlot, m_bitmapOldPlot);
116 if (m_bitmapGrid != NULL) DeleteObject(m_bitmapGrid);
117 if (m_bitmapPlot != NULL) DeleteObject(m_bitmapPlot);
118 if (m_dcGrid != NULL) DeleteDC(m_dcGrid);
119 if (m_dcPlot != NULL) DeleteDC(m_dcPlot);
120 if (m_brushBack != NULL) DeleteObject(m_brushBack);
122 #endif
124 static void GraphCtrl_Resize(TGraphCtrl* this)
126 /* NOTE: Resize automatically gets called during the setup of the control */
127 GetClientRect(this->m_hWnd, &this->m_rectClient);
129 /* set some member variables to avoid multiple function calls */
130 this->m_nClientHeight = this->m_rectClient.bottom - this->m_rectClient.top;/* m_rectClient.Height(); */
131 this->m_nClientWidth = this->m_rectClient.right - this->m_rectClient.left;/* m_rectClient.Width(); */
133 /* the "left" coordinate and "width" will be modified in */
134 /* InvalidateCtrl to be based on the width of the y axis scaling */
135 #if 0
136 this->m_rectPlot.left = 20;
137 this->m_rectPlot.top = 10;
138 this->m_rectPlot.right = this->m_rectClient.right-10;
139 this->m_rectPlot.bottom = this->m_rectClient.bottom-25;
140 #else
141 this->m_rectPlot.left = 0;
142 this->m_rectPlot.top = -1;
143 this->m_rectPlot.right = this->m_rectClient.right-0;
144 this->m_rectPlot.bottom = this->m_rectClient.bottom-0;
145 #endif
147 /* set some member variables to avoid multiple function calls */
148 this->m_nPlotHeight = this->m_rectPlot.bottom - this->m_rectPlot.top;/* m_rectPlot.Height(); */
149 this->m_nPlotWidth = this->m_rectPlot.right - this->m_rectPlot.left;/* m_rectPlot.Width(); */
151 /* set the scaling factor for now, this can be adjusted */
152 /* in the SetRange functions */
153 this->m_dVerticalFactor = (double)this->m_nPlotHeight / this->m_dRange;
156 void GraphCtrl_Create(TGraphCtrl* this, HWND hWnd, HWND hParentWnd, UINT nID)
158 GraphCtrl_Init(this);
159 this->m_hParentWnd = hParentWnd;
160 this->m_hWnd = hWnd;
161 GraphCtrl_Resize(this);
164 static void GraphCtrl_InvalidateCtrl(TGraphCtrl* this)
166 /* There is a lot of drawing going on here - particularly in terms of */
167 /* drawing the grid. Don't panic, this is all being drawn (only once) */
168 /* to a bitmap. The result is then BitBlt'd to the control whenever needed. */
169 int i, j;
170 int nCharacters;
171 int nTopGridPix, nMidGridPix, nBottomGridPix;
173 HPEN oldPen;
174 HPEN solidPen = CreatePen(PS_SOLID, 0, this->m_crGridColor);
175 /* HFONT axisFont, yUnitFont, oldFont; */
176 /* char strTemp[50]; */
178 /* in case we haven't established the memory dc's */
179 /* CClientDC dc(this); */
180 HDC dc = GetDC(this->m_hParentWnd);
182 /* if we don't have one yet, set up a memory dc for the grid */
183 if (this->m_dcGrid == NULL)
185 this->m_dcGrid = CreateCompatibleDC(dc);
186 this->m_bitmapGrid = CreateCompatibleBitmap(dc, this->m_nClientWidth, this->m_nClientHeight);
187 this->m_bitmapOldGrid = SelectObject(this->m_dcGrid, this->m_bitmapGrid);
190 SetBkColor(this->m_dcGrid, this->m_crBackColor);
192 /* fill the grid background */
193 FillRect(this->m_dcGrid, &this->m_rectClient, this->m_brushBack);
195 /* draw the plot rectangle: */
196 /* determine how wide the y axis scaling values are */
197 nCharacters = abs((int)log10(fabs(this->m_dUpperLimit)));
198 nCharacters = max(nCharacters, abs((int)log10(fabs(this->m_dLowerLimit))));
200 /* add the units digit, decimal point and a minus sign, and an extra space */
201 /* as well as the number of decimal places to display */
202 nCharacters = nCharacters + 4 + this->m_nYDecimals;
204 /* adjust the plot rectangle dimensions */
205 /* assume 6 pixels per character (this may need to be adjusted) */
206 /* m_rectPlot.left = m_rectClient.left + 6*(nCharacters); */
207 this->m_rectPlot.left = this->m_rectClient.left;
208 this->m_nPlotWidth = this->m_rectPlot.right - this->m_rectPlot.left;/* m_rectPlot.Width(); */
210 /* draw the plot rectangle */
211 oldPen = SelectObject(this->m_dcGrid, solidPen);
212 MoveToEx(this->m_dcGrid, this->m_rectPlot.left, this->m_rectPlot.top, NULL);
213 LineTo(this->m_dcGrid, this->m_rectPlot.right+1, this->m_rectPlot.top);
214 LineTo(this->m_dcGrid, this->m_rectPlot.right+1, this->m_rectPlot.bottom+1);
215 LineTo(this->m_dcGrid, this->m_rectPlot.left, this->m_rectPlot.bottom+1);
216 /* LineTo(m_dcGrid, m_rectPlot.left, m_rectPlot.top); */
217 SelectObject(this->m_dcGrid, oldPen);
218 DeleteObject(solidPen);
220 /* draw the dotted lines,
221 * use SetPixel instead of a dotted pen - this allows for a
222 * finer dotted line and a more "technical" look
224 nMidGridPix = (this->m_rectPlot.top + this->m_rectPlot.bottom)/2;
225 nTopGridPix = nMidGridPix - this->m_nPlotHeight/4;
226 nBottomGridPix = nMidGridPix + this->m_nPlotHeight/4;
228 for (i=this->m_rectPlot.left; i<this->m_rectPlot.right; i+=2)
230 SetPixel(this->m_dcGrid, i, nTopGridPix, this->m_crGridColor);
231 SetPixel(this->m_dcGrid, i, nMidGridPix, this->m_crGridColor);
232 SetPixel(this->m_dcGrid, i, nBottomGridPix, this->m_crGridColor);
235 for (i=this->m_rectPlot.left; i<this->m_rectPlot.right; i+=10)
237 for (j=this->m_rectPlot.top; j<this->m_rectPlot.bottom; j+=2)
239 SetPixel(this->m_dcGrid, i, j, this->m_crGridColor);
240 /* SetPixel(m_dcGrid, i, j, m_crGridColor); */
241 /* SetPixel(m_dcGrid, i, j, m_crGridColor); */
245 #if 0
246 /* create some fonts (horizontal and vertical) */
247 /* use a height of 14 pixels and 300 weight */
248 /* (these may need to be adjusted depending on the display) */
249 axisFont = CreateFont (14, 0, 0, 0, 300,
250 FALSE, FALSE, 0, ANSI_CHARSET,
251 OUT_DEFAULT_PRECIS,
252 CLIP_DEFAULT_PRECIS,
253 DEFAULT_QUALITY,
254 DEFAULT_PITCH|FF_SWISS, "Arial");
255 yUnitFont = CreateFont (14, 0, 900, 0, 300,
256 FALSE, FALSE, 0, ANSI_CHARSET,
257 OUT_DEFAULT_PRECIS,
258 CLIP_DEFAULT_PRECIS,
259 DEFAULT_QUALITY,
260 DEFAULT_PITCH|FF_SWISS, "Arial");
262 /* grab the horizontal font */
263 oldFont = SelectObject(m_dcGrid, axisFont);
265 /* y max */
266 SetTextColor(m_dcGrid, m_crGridColor);
267 SetTextAlign(m_dcGrid, TA_RIGHT|TA_TOP);
268 sprintf(strTemp, "%.*lf", m_nYDecimals, m_dUpperLimit);
269 TextOut(m_dcGrid, m_rectPlot.left-4, m_rectPlot.top, strTemp, _tcslen(strTemp));
271 /* y min */
272 SetTextAlign(m_dcGrid, TA_RIGHT|TA_BASELINE);
273 sprintf(strTemp, "%.*lf", m_nYDecimals, m_dLowerLimit);
274 TextOut(m_dcGrid, m_rectPlot.left-4, m_rectPlot.bottom, strTemp, _tcslen(strTemp));
276 /* x min */
277 SetTextAlign(m_dcGrid, TA_LEFT|TA_TOP);
278 TextOut(m_dcGrid, m_rectPlot.left, m_rectPlot.bottom+4, "0", 1);
280 /* x max */
281 SetTextAlign(m_dcGrid, TA_RIGHT|TA_TOP);
282 sprintf(strTemp, "%d", m_nPlotWidth/m_nShiftPixels);
283 TextOut(m_dcGrid, m_rectPlot.right, m_rectPlot.bottom+4, strTemp, _tcslen(strTemp));
285 /* x units */
286 SetTextAlign(m_dcGrid, TA_CENTER|TA_TOP);
287 TextOut(m_dcGrid, (m_rectPlot.left+m_rectPlot.right)/2,
288 m_rectPlot.bottom+4, m_strXUnitsString, _tcslen(m_strXUnitsString));
290 /* restore the font */
291 SelectObject(m_dcGrid, oldFont);
293 /* y units */
294 oldFont = SelectObject(m_dcGrid, yUnitFont);
295 SetTextAlign(m_dcGrid, TA_CENTER|TA_BASELINE);
296 TextOut(m_dcGrid, (m_rectClient.left+m_rectPlot.left)/2,
297 (m_rectPlot.bottom+m_rectPlot.top)/2, m_strYUnitsString, _tcslen(m_strYUnitsString));
298 SelectObject(m_dcGrid, oldFont);
299 #endif
300 /* at this point we are done filling the grid bitmap, */
301 /* no more drawing to this bitmap is needed until the settings are changed */
303 /* if we don't have one yet, set up a memory dc for the plot */
304 if (this->m_dcPlot == NULL)
306 this->m_dcPlot = CreateCompatibleDC(dc);
307 this->m_bitmapPlot = CreateCompatibleBitmap(dc, this->m_nClientWidth, this->m_nClientHeight);
308 this->m_bitmapOldPlot = SelectObject(this->m_dcPlot, this->m_bitmapPlot);
311 /* make sure the plot bitmap is cleared */
312 SetBkColor(this->m_dcPlot, this->m_crBackColor);
313 FillRect(this->m_dcPlot, &this->m_rectClient, this->m_brushBack);
315 /* finally, force the plot area to redraw */
316 InvalidateRect(this->m_hParentWnd, &this->m_rectClient, TRUE);
317 ReleaseDC(this->m_hParentWnd, dc);
320 void GraphCtrl_SetRange(TGraphCtrl* this, double dLower, double dUpper, int nDecimalPlaces)
322 /* ASSERT(dUpper > dLower); */
323 this->m_dLowerLimit = dLower;
324 this->m_dUpperLimit = dUpper;
325 this->m_nYDecimals = nDecimalPlaces;
326 this->m_dRange = this->m_dUpperLimit - this->m_dLowerLimit;
327 this->m_dVerticalFactor = (double)this->m_nPlotHeight / this->m_dRange;
328 /* clear out the existing garbage, re-start with a clean plot */
329 GraphCtrl_InvalidateCtrl(this);
332 #if 0
333 void TGraphCtrl::SetXUnits(const char* string)
335 lstrcpynA(m_strXUnitsString, string, sizeof(m_strXUnitsString));
336 /* clear out the existing garbage, re-start with a clean plot */
337 InvalidateCtrl();
340 void TGraphCtrl::SetYUnits(const char* string)
342 lstrcpynA(m_strYUnitsString, string, sizeof(m_strYUnitsString));
343 /* clear out the existing garbage, re-start with a clean plot */
344 InvalidateCtrl();
346 #endif
348 void GraphCtrl_SetGridColor(TGraphCtrl* this, COLORREF color)
350 this->m_crGridColor = color;
351 /* clear out the existing garbage, re-start with a clean plot */
352 GraphCtrl_InvalidateCtrl(this);
355 void GraphCtrl_SetPlotColor(TGraphCtrl* this, int plot, COLORREF color)
357 this->m_crPlotColor[plot] = color;
358 DeleteObject(this->m_penPlot[plot]);
359 this->m_penPlot[plot] = CreatePen(PS_SOLID, 0, this->m_crPlotColor[plot]);
360 /* clear out the existing garbage, re-start with a clean plot */
361 GraphCtrl_InvalidateCtrl(this);
364 void GraphCtrl_SetBackgroundColor(TGraphCtrl* this, COLORREF color)
366 this->m_crBackColor = color;
367 DeleteObject(this->m_brushBack);
368 this->m_brushBack = CreateSolidBrush(this->m_crBackColor);
369 /* clear out the existing garbage, re-start with a clean plot */
370 GraphCtrl_InvalidateCtrl(this);
373 static void GraphCtrl_DrawPoint(TGraphCtrl* this)
375 /* this does the work of "scrolling" the plot to the left
376 * and appending a new data point all of the plotting is
377 * directed to the memory based bitmap associated with m_dcPlot
378 * the will subsequently be BitBlt'd to the client in Paint
380 int currX, prevX, currY, prevY;
381 HPEN oldPen;
382 RECT rectCleanUp;
383 int i;
385 if (this->m_dcPlot != NULL)
387 /* shift the plot by BitBlt'ing it to itself
388 * note: the m_dcPlot covers the entire client
389 * but we only shift bitmap that is the size
390 * of the plot rectangle
391 * grab the right side of the plot (excluding m_nShiftPixels on the left)
392 * move this grabbed bitmap to the left by m_nShiftPixels
394 BitBlt(this->m_dcPlot, this->m_rectPlot.left, this->m_rectPlot.top+1,
395 this->m_nPlotWidth, this->m_nPlotHeight, this->m_dcPlot,
396 this->m_rectPlot.left+this->m_nShiftPixels, this->m_rectPlot.top+1,
397 SRCCOPY);
399 /* establish a rectangle over the right side of plot */
400 /* which now needs to be cleaned up prior to adding the new point */
401 rectCleanUp = this->m_rectPlot;
402 rectCleanUp.left = rectCleanUp.right - this->m_nShiftPixels;
404 /* fill the cleanup area with the background */
405 FillRect(this->m_dcPlot, &rectCleanUp, this->m_brushBack);
407 /* draw the next line segment */
408 for (i = 0; i < MAX_PLOTS; i++)
410 /* grab the plotting pen */
411 oldPen = SelectObject(this->m_dcPlot, this->m_penPlot[i]);
413 /* move to the previous point */
414 prevX = this->m_rectPlot.right-this->m_nPlotShiftPixels;
415 prevY = this->m_rectPlot.bottom -
416 (int)((this->m_dPreviousPosition[i] - this->m_dLowerLimit) * this->m_dVerticalFactor);
417 MoveToEx(this->m_dcPlot, prevX, prevY, NULL);
419 /* draw to the current point */
420 currX = this->m_rectPlot.right-this->m_nHalfShiftPixels;
421 currY = this->m_rectPlot.bottom -
422 (int)((this->m_dCurrentPosition[i] - this->m_dLowerLimit) * this->m_dVerticalFactor);
423 LineTo(this->m_dcPlot, currX, currY);
425 /* Restore the pen */
426 SelectObject(this->m_dcPlot, oldPen);
428 /* if the data leaks over the upper or lower plot boundaries
429 * fill the upper and lower leakage with the background
430 * this will facilitate clipping on an as needed basis
431 * as opposed to always calling IntersectClipRect
433 if ((prevY <= this->m_rectPlot.top) || (currY <= this->m_rectPlot.top))
435 RECT rc;
436 rc.bottom = this->m_rectPlot.top+1;
437 rc.left = prevX;
438 rc.right = currX+1;
439 rc.top = this->m_rectClient.top;
440 FillRect(this->m_dcPlot, &rc, this->m_brushBack);
442 if ((prevY >= this->m_rectPlot.bottom) || (currY >= this->m_rectPlot.bottom))
444 RECT rc;
445 rc.bottom = this->m_rectClient.bottom+1;
446 rc.left = prevX;
447 rc.right = currX+1;
448 rc.top = this->m_rectPlot.bottom+1;
449 /* RECT rc(prevX, m_rectPlot.bottom+1, currX+1, m_rectClient.bottom+1); */
450 FillRect(this->m_dcPlot, &rc, this->m_brushBack);
453 /* store the current point for connection to the next point */
454 this->m_dPreviousPosition[i] = this->m_dCurrentPosition[i];
459 double GraphCtrl_AppendPoint(TGraphCtrl* this,
460 double dNewPoint0, double dNewPoint1,
461 double dNewPoint2, double dNewPoint3)
463 /* append a data point to the plot & return the previous point */
464 double dPrevious;
466 dPrevious = this->m_dCurrentPosition[0];
467 this->m_dCurrentPosition[0] = dNewPoint0;
468 this->m_dCurrentPosition[1] = dNewPoint1;
469 this->m_dCurrentPosition[2] = dNewPoint2;
470 this->m_dCurrentPosition[3] = dNewPoint3;
471 GraphCtrl_DrawPoint(this);
472 /* Invalidate(); */
473 return dPrevious;
476 static void GraphCtrl_Paint(TGraphCtrl* this, HWND hWnd, HDC dc)
478 HDC memDC;
479 HBITMAP memBitmap;
480 HBITMAP oldBitmap; /* bitmap originally found in CMemDC */
482 /* RECT rcClient; */
483 /* GetClientRect(hWnd, &rcClient); */
484 /* FillSolidRect(dc, &rcClient, RGB(255, 0, 255)); */
485 /* m_nClientWidth = rcClient.right - rcClient.left; */
486 /* m_nClientHeight = rcClient.bottom - rcClient.top; */
488 /* no real plotting work is performed here, */
489 /* just putting the existing bitmaps on the client */
491 /* to avoid flicker, establish a memory dc, draw to it */
492 /* and then BitBlt it to the client */
493 memDC = CreateCompatibleDC(dc);
494 memBitmap = CreateCompatibleBitmap(dc, this->m_nClientWidth, this->m_nClientHeight);
495 oldBitmap = SelectObject(memDC, memBitmap);
497 if (memDC != NULL)
499 /* first drop the grid on the memory dc */
500 BitBlt(memDC, 0, 0, this->m_nClientWidth, this->m_nClientHeight, this->m_dcGrid, 0, 0, SRCCOPY);
501 /* now add the plot on top as a "pattern" via SRCPAINT. */
502 /* works well with dark background and a light plot */
503 BitBlt(memDC, 0, 0, this->m_nClientWidth, this->m_nClientHeight, this->m_dcPlot, 0, 0, SRCPAINT); /* SRCPAINT */
504 /* finally send the result to the display */
505 BitBlt(dc, 0, 0, this->m_nClientWidth, this->m_nClientHeight, memDC, 0, 0, SRCCOPY);
507 SelectObject(memDC, oldBitmap);
508 DeleteObject(memBitmap);
509 DeleteDC(memDC);
512 #if 0
513 void TGraphCtrl::Reset(void)
515 /* to clear the existing data (in the form of a bitmap) */
516 /* simply invalidate the entire control */
517 InvalidateCtrl();
519 #endif
521 extern TGraphCtrl PerformancePageCpuUsageHistoryGraph;
522 extern TGraphCtrl PerformancePageMemUsageHistoryGraph;
523 extern HWND hPerformancePageCpuUsageHistoryGraph;
524 extern HWND hPerformancePageMemUsageHistoryGraph;
526 INT_PTR CALLBACK
527 GraphCtrl_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
529 RECT rcClient;
530 HDC hdc;
531 PAINTSTRUCT ps;
533 switch (message)
535 case WM_ERASEBKGND:
536 return TRUE;
538 * Filter out mouse & keyboard messages
540 /* case WM_APPCOMMAND: */
541 case WM_CAPTURECHANGED:
542 case WM_LBUTTONDBLCLK:
543 case WM_LBUTTONDOWN:
544 case WM_LBUTTONUP:
545 case WM_MBUTTONDBLCLK:
546 case WM_MBUTTONDOWN:
547 case WM_MBUTTONUP:
548 case WM_MOUSEACTIVATE:
549 case WM_MOUSEHOVER:
550 case WM_MOUSELEAVE:
551 case WM_MOUSEMOVE:
552 /* case WM_MOUSEWHEEL: */
553 case WM_NCHITTEST:
554 case WM_NCLBUTTONDBLCLK:
555 case WM_NCLBUTTONDOWN:
556 case WM_NCLBUTTONUP:
557 case WM_NCMBUTTONDBLCLK:
558 case WM_NCMBUTTONDOWN:
559 case WM_NCMBUTTONUP:
560 /* case WM_NCMOUSEHOVER: */
561 /* case WM_NCMOUSELEAVE: */
562 case WM_NCMOUSEMOVE:
563 case WM_NCRBUTTONDBLCLK:
564 case WM_NCRBUTTONDOWN:
565 case WM_NCRBUTTONUP:
566 /* case WM_NCXBUTTONDBLCLK: */
567 /* case WM_NCXBUTTONDOWN: */
568 /* case WM_NCXBUTTONUP: */
569 case WM_RBUTTONDBLCLK:
570 case WM_RBUTTONDOWN:
571 case WM_RBUTTONUP:
572 /* case WM_XBUTTONDBLCLK: */
573 /* case WM_XBUTTONDOWN: */
574 /* case WM_XBUTTONUP: */
575 case WM_ACTIVATE:
576 case WM_CHAR:
577 case WM_DEADCHAR:
578 case WM_GETHOTKEY:
579 case WM_HOTKEY:
580 case WM_KEYDOWN:
581 case WM_KEYUP:
582 case WM_KILLFOCUS:
583 case WM_SETFOCUS:
584 case WM_SETHOTKEY:
585 case WM_SYSCHAR:
586 case WM_SYSDEADCHAR:
587 case WM_SYSKEYDOWN:
588 case WM_SYSKEYUP:
589 return 0;
591 case WM_NCCALCSIZE:
592 return 0;
594 case WM_SIZE:
595 if (hWnd == hPerformancePageMemUsageHistoryGraph)
597 GraphCtrl_Resize(&PerformancePageMemUsageHistoryGraph);
598 GraphCtrl_InvalidateCtrl(&PerformancePageMemUsageHistoryGraph);
600 if (hWnd == hPerformancePageCpuUsageHistoryGraph)
602 GraphCtrl_Resize(&PerformancePageCpuUsageHistoryGraph);
603 GraphCtrl_InvalidateCtrl(&PerformancePageCpuUsageHistoryGraph);
605 return 0;
607 case WM_PAINT:
608 hdc = BeginPaint(hWnd, &ps);
609 GetClientRect(hWnd, &rcClient);
610 if (hWnd == hPerformancePageMemUsageHistoryGraph)
611 GraphCtrl_Paint(&PerformancePageMemUsageHistoryGraph, hWnd, hdc);
612 if (hWnd == hPerformancePageCpuUsageHistoryGraph)
613 GraphCtrl_Paint(&PerformancePageCpuUsageHistoryGraph, hWnd, hdc);
614 EndPaint(hWnd, &ps);
615 return 0;
619 * We pass on all non-handled messages
621 return CallWindowProcW(OldGraphCtrlWndProc, hWnd, message, wParam, lParam);