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.

svn path=/trunk/; revision=18376
This commit is contained in:
Martin Fuchs 2005-10-09 15:04:18 +00:00
parent e42612ca97
commit 8b65b69d7c
2 changed files with 31 additions and 9 deletions

View file

@ -121,7 +121,7 @@ BOOL GraphCtrl_Create(TGraphCtrl* this, HWND hWnd, HWND hParentWnd, UINT nID)
this->m_hWnd = hWnd;
GraphCtrl_Resize(this);
if (result != 0)
GraphCtrl_InvalidateCtrl(this);
GraphCtrl_InvalidateCtrl(this, FALSE);
return result;
}
@ -134,7 +134,7 @@ void GraphCtrl_SetRange(TGraphCtrl* this, double dLower, double dUpper, int nDec
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 @@ void GraphCtrl_SetGridColor(TGraphCtrl* this, COLORREF color)
{
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 @@ void GraphCtrl_SetPlotColor(TGraphCtrl* this, int plot, COLORREF color)
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 @@ void GraphCtrl_SetBackgroundColor(TGraphCtrl* this, COLORREF color)
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 @@ void GraphCtrl_InvalidateCtrl(TGraphCtrl* this)
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 @@ void GraphCtrl_InvalidateCtrl(TGraphCtrl* this)
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 @@ GraphCtrl_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
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;

View file

@ -93,7 +93,7 @@ BOOL GraphCtrl_Create(TGraphCtrl* this, HWND hWnd, HWND hParentWnd,
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);