1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
#include "StdAfx.h"
#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;
}
|