//***************************************************************************************************************** // // CLASS: DISKDISPLAY // // COPYRIGHT© 2001 Microsoft Corporation and Executive Software International, Inc. // // CLASS DESCRIPTION: // Uses an array passed in from the DiskView class called the LineArray that contains the necessary // data to draw a graphical representation of a disk. Each byte in the LineArray is set to a specific // value that specifies the color of a corresponding vertical line on the screen when painted using // the DiskDisplay class. This class also handles the painting of a legend at the bottom of the display // and data about the size of the disk, etc. All the computational data for the display is done by // DiskView; DiskDisplay just paints it on the screen. // //***************************************************************************************************************** #include "stdafx.h" #include "DiskDisp.h" #include "Graphix.h" #include "ErrMacro.h" /***************************************************************************************************************** METHOD: DiskDisplay::DiskDisplay (Constructor) METHOD DESCRIPTION: Initializes class variables. RETURN: None. */ DiskDisplay::DiskDisplay() { int i; //There is not yet data to draw with, so don't execute drawing functions later on until there is data to draw. m_bReadyToDraw = FALSE; m_LineArray = NULL; m_NumLines = 0; m_SpacerHeight = SPACER_HEIGHT; m_GraphicWellWidth = 0; m_GraphicWellHeight = 0; _tcscpy(m_Label, TEXT("")); //Allocate internal arrays for the maximum number of colors of lines we will be displaying. m_ColorArray = NULL; m_PenArray = NULL; m_BrushArray = NULL; //Initialize the colors for the various lines. m_ColorArray = new int [NUM_COLORS]; EV(m_ColorArray); ChangeLineColor(SystemFileColor, GREEN); // System files ChangeLineColor(PageFileColor, YELLOW); // Pagefile ChangeLineColor(FragmentColor, RED); // Fragmented files ChangeLineColor(UsedSpaceColor, BLUE); // Contiguous files ChangeLineColor(FreeSpaceColor, LIGHTGRAY); // Free space ChangeLineColor(DirectoryColor, LIGHTBLUE); // Directories ChangeLineColor(MftZoneFreeSpaceColor, BLUE); // MFT Zone sks defrag mft changed from GREEN m_bStripeMftZone = TRUE; //Create all the pens that we'll draw with. m_PenArray = new HPEN [NUM_COLORS]; EV(m_PenArray); for(i=0; i 0 && InNumLines == m_NumLines){ //Copy the new buffer into the LineArray buffer. if (m_LineArray) { CopyMemory(m_LineArray, pInLineArray, m_NumLines); //Note that we now have data to draw with. m_bReadyToDraw = TRUE; } } } void DiskDisplay::SetReadyToDraw(IN BOOL bReadyToDraw) { m_bReadyToDraw = bReadyToDraw; } void DiskDisplay::DeleteAllData(void) { m_bReadyToDraw = FALSE; } void DiskDisplay::SetLabel(PTCHAR InLabel) { if (InLabel) { if (_tcslen(InLabel) > MAX_PATH * 2 - 3) { _tcsncpy(m_Label, InLabel, MAX_PATH * 2 - 3); m_Label[MAX_PATH * 2 - 3] = TEXT('\0'); _tcscat(m_Label, TEXT("...")); } else { _tcscpy(m_Label, InLabel); } } else { _tcscpy(m_Label, TEXT("")); } }