Fix from watz@gmx.net for Bugzilla Entry 862: When you resize the taskmanager window, the history graph is not updated anymore. When the window is resized back to default (smallest possible width) it draws again. Modified: trunk/reactos/subsys/system/taskmgr/graphctl.c Modified: trunk/reactos/subsys/system/taskmgr/graphctl.h _____
Modified: trunk/reactos/subsys/system/taskmgr/graphctl.c --- trunk/reactos/subsys/system/taskmgr/graphctl.c 2005-10-09 13:05:49 UTC (rev 18375) +++ trunk/reactos/subsys/system/taskmgr/graphctl.c 2005-10-09 15:04:18 UTC (rev 18376) @@ -121,7 +121,7 @@
this->m_hWnd = hWnd; GraphCtrl_Resize(this); if (result != 0) - GraphCtrl_InvalidateCtrl(this); + GraphCtrl_InvalidateCtrl(this, FALSE); return result; }
@@ -134,7 +134,7 @@ this->m_dRange = this->m_dUpperLimit - this->m_dLowerLimit; this->m_dVerticalFactor = (double)this->m_nPlotHeight / this->m_dRange; /* clear out the existing garbage, re-start with a clean plot */ - GraphCtrl_InvalidateCtrl(this); + GraphCtrl_InvalidateCtrl(this, FALSE); }
#if 0 @@ -157,7 +157,7 @@ { this->m_crGridColor = color; /* clear out the existing garbage, re-start with a clean plot */ - GraphCtrl_InvalidateCtrl(this); + GraphCtrl_InvalidateCtrl(this, FALSE); }
void GraphCtrl_SetPlotColor(TGraphCtrl* this, int plot, COLORREF color) @@ -166,7 +166,7 @@ DeleteObject(this->m_penPlot[plot]); this->m_penPlot[plot] = CreatePen(PS_SOLID, 0, this->m_crPlotColor[plot]); /* clear out the existing garbage, re-start with a clean plot */ - GraphCtrl_InvalidateCtrl(this); + GraphCtrl_InvalidateCtrl(this, FALSE); }
void GraphCtrl_SetBackgroundColor(TGraphCtrl* this, COLORREF color) @@ -175,10 +175,10 @@ DeleteObject(this->m_brushBack); this->m_brushBack = CreateSolidBrush(this->m_crBackColor); /* clear out the existing garbage, re-start with a clean plot */ - GraphCtrl_InvalidateCtrl(this); + GraphCtrl_InvalidateCtrl(this, FALSE); }
-void GraphCtrl_InvalidateCtrl(TGraphCtrl* this) +void GraphCtrl_InvalidateCtrl(TGraphCtrl* this, BOOL bResize) { /* There is a lot of drawing going on here - particularly in terms of */ /* drawing the grid. Don't panic, this is all being drawn (only once) */ @@ -203,6 +203,17 @@ this->m_bitmapGrid = CreateCompatibleBitmap(dc, this->m_nClientWidth, this->m_nClientHeight); this->m_bitmapOldGrid = (HBITMAP)SelectObject(this->m_dcGrid, this->m_bitmapGrid); } + else if(bResize) + { + // the size of the drawing area has changed + // so create a new bitmap of the appropriate size + if(this->m_bitmapGrid != NULL) + { + DeleteObject(this->m_bitmapGrid); + this->m_bitmapGrid = CreateCompatibleBitmap(dc, this->m_nClientWidth, this->m_nClientHeight); + SelectObject(this->m_dcGrid, this->m_bitmapGrid); + } + }
SetBkColor(this->m_dcGrid, this->m_crBackColor);
@@ -324,6 +335,17 @@ this->m_bitmapPlot = CreateCompatibleBitmap(dc, this->m_nClientWidth, this->m_nClientHeight); this->m_bitmapOldPlot = (HBITMAP)SelectObject(this->m_dcPlot, this->m_bitmapPlot); } + else if(bResize) + { + // the size of the drawing area has changed + // so create a new bitmap of the appropriate size + if(this->m_bitmapPlot != NULL) + { + DeleteObject(this->m_bitmapPlot); + this->m_bitmapPlot = CreateCompatibleBitmap(dc, this->m_nClientWidth, this->m_nClientHeight); + SelectObject(this->m_dcPlot, this->m_bitmapPlot); + } + }
/* make sure the plot bitmap is cleared */ SetBkColor(this->m_dcPlot, this->m_crBackColor); @@ -591,12 +613,12 @@ if (hWnd == hPerformancePageMemUsageHistoryGraph) { GraphCtrl_Resize(&PerformancePageMemUsageHistoryGraph); - GraphCtrl_InvalidateCtrl(&PerformancePageMemUsageHistoryGraph); + GraphCtrl_InvalidateCtrl(&PerformancePageMemUsageHistoryGraph, TRUE); } if (hWnd == hPerformancePageCpuUsageHistoryGraph) { GraphCtrl_Resize(&PerformancePageCpuUsageHistoryGraph); - GraphCtrl_InvalidateCtrl(&PerformancePageCpuUsageHistoryGraph); + GraphCtrl_InvalidateCtrl(&PerformancePageCpuUsageHistoryGraph, TRUE); } return 0;
_____
Modified: trunk/reactos/subsys/system/taskmgr/graphctl.h --- trunk/reactos/subsys/system/taskmgr/graphctl.h 2005-10-09 13:05:49 UTC (rev 18375) +++ trunk/reactos/subsys/system/taskmgr/graphctl.h 2005-10-09 15:04:18 UTC (rev 18376) @@ -93,7 +93,7 @@
UINT nID); void GraphCtrl_Dispose(TGraphCtrl* this); void GraphCtrl_DrawPoint(TGraphCtrl* this); -void GraphCtrl_InvalidateCtrl(TGraphCtrl* this); +void GraphCtrl_InvalidateCtrl(TGraphCtrl* this, BOOL bResize); void GraphCtrl_Paint(TGraphCtrl* this, HWND hWnd, HDC dc); void GraphCtrl_Reset(TGraphCtrl* this); void GraphCtrl_Resize(TGraphCtrl* this);