#include "CPluginInfo.h" #include "LArray.h" #include "T2PluginInfoTable.h" #include "T2PluginSpecifier.h" /*virtual*/ BOOL T2PluginInfoTable::Create(const char* inWindowName, DWORD inStyle, const RECT& inRect, CWnd* inParentWnd, UINT inID) { return T2DlgItemTable::Create(inWindowName, inStyle, inRect, inParentWnd, inID); } T2PluginInfoTable::T2PluginInfoTable(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette) : T2DlgItemImageTable(inDoc, inImageObj, inPalette) { mType = 0; mCellData = new LArray; InsertCols(1, 0, NULL); } /*virtual*/ T2PluginInfoTable::~T2PluginInfoTable() { } void T2PluginInfoTable::Add(CPluginInfo* inInfo) { InsertRows(1, mRows, &inInfo); mType = 1; } void T2PluginInfoTable::Add(T2PluginSpecifier* inSpecifier) { InsertRows(1, mRows, &inSpecifier); mType = 2; } /*virtual*/ void T2PluginInfoTable::DrawCellSelf(CDC* pDC, const TableCellT& inCell, BOOL inSelected) { int saveDC = pDC->SaveDC(); pDC->SelectPalette(mPalette, false); pDC->RealizePalette(); pDC->SelectObject(mFont); pDC->SetBkMode(TRANSPARENT); RECT drawRect, cellFrame, clientRect; GetClientRect(&clientRect); if (FetchLocalCellFrame(inCell, cellFrame)) { if (IntersectRect(&drawRect, &cellFrame, &clientRect)) { InflateRect(&drawRect, -1, -1); RECT textRect; if (mType == 1) { CPluginInfo *theInfo; GetCellData(inCell, &theInfo); if (theInfo) { CString name; textRect = cellFrame; textRect.right = textRect.left + 156; textRect.left += 26; theInfo->GetName(name); pDC->DrawText(name, &textRect, DT_SINGLELINE); textRect = cellFrame; textRect.right = textRect.left + 275; textRect.left += 156; theInfo->GetFileName(name); pDC->DrawText(name, &textRect, DT_SINGLELINE); } } else if (mType == 2) { T2PluginSpecifier *theSpecifier; GetCellData(inCell, &theSpecifier); textRect = cellFrame; textRect.right = textRect.left + 105; textRect.left += 26; pDC->DrawText(theSpecifier->mPluginName, &textRect, DT_SINGLELINE); textRect = cellFrame; textRect.right = textRect.left + 175; textRect.left += 106; pDC->DrawText(theSpecifier->mPath, &textRect, DT_SINGLELINE); CString str; if (theSpecifier->mIsLoaded) str = "Load"; textRect = cellFrame; textRect.left += 176; pDC->DrawText(str, &textRect, DT_SINGLELINE); } if (inSelected == 1) pDC->InvertRect(&cellFrame); } } pDC->RestoreDC(saveDC); } /*virtual*/ BOOL T2PluginInfoTable::OnT2DlgItemCreate(CREATESTRUCT* inCreateStruct) { T2DlgItemTable::OnT2DlgItemCreate(inCreateStruct); return false; } /*virtual*/ BOOL T2PluginInfoTable::OnT2DlgItemEraseBkgnd(CDC* pDC) { int theSave = pDC->SaveDC(); pDC->SelectPalette(mPalette, false); pDC->RealizePalette(); RECT clientArea; GetClientRect(&clientArea); CBrush theBrush; CBrush theBGBrush; theBGBrush.CreateSolidBrush(RGB(255, 255, 255)); pDC->FillRect(&clientArea, &theBGBrush); UINT height, width; GetTableSize(height, width); for (UINT y = 1; y <= height; y++) { for (UINT x = 1; x <= width; x++) { TableCellT cell; cell.row = y; cell.col = x; DrawCell(pDC, cell); } } pDC->RestoreDC(theSave); return true; }