#include "DbgPeopleView.h" #include "T2People.h" #include "T2PeopleArray.h" #include "T2PeopleArrayList.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif #line 16 IMPLEMENT_DYNCREATE(DbgPeopleView, CFrameWnd) DbgPeopleView::DbgPeopleView() { mPeopleArrayList = NULL; } /*virtual*/ DbgPeopleView::~DbgPeopleView() { } BEGIN_MESSAGE_MAP(DbgPeopleView, CFrameWnd) ON_WM_ERASEBKGND() ON_WM_CREATE() ON_WM_TIMER() ON_WM_DESTROY() END_MESSAGE_MAP() void DbgPeopleView::SetPeople(T2PeopleArrayList *inList) { mPeopleArrayList = inList; } BOOL DbgPeopleView::OnEraseBkgnd(CDC *pDC) { #pragma var_order(str, font, save, height, iter, y, peopleArray, theFrameRect, brush) if (!mPeopleArrayList) return CFrameWnd::OnEraseBkgnd(pDC); int save = pDC->SaveDC(); CRect theFrameRect; GetClientRect(theFrameRect); pDC->SetTextColor(RGB(0, 0, 0)); pDC->SetBkColor(RGB(255, 255, 255)); CBrush brush; brush.CreateStockObject(WHITE_BRUSH); pDC->FillRect(theFrameRect, &brush); CFont font; font.CreateFont(-12, 0, 0, 0, FW_NORMAL, false, false, false, SHIFTJIS_CHARSET, OUT_TT_PRECIS, CLIP_TT_ALWAYS, DRAFT_QUALITY, DEFAULT_PITCH, "\x82\x6C\x82\x72 \x83\x53\x83\x56\x83\x62\x83\x4E"); pDC->SelectObject(&font); int height = pDC->GetTextExtent("A").cy + 1; pDC->SetTextAlign(TA_UPDATECP); int y = 2; CString str; LArrayIterator iter(*mPeopleArrayList); T2PeopleArray *peopleArray; while (iter.Next(&peopleArray)) { for (int i = 0; i < T2PeopleArray::kGroupSize; i++) { T2People *people = &peopleArray->mPeople[i]; if (people->IsUsed() && !people->mPrev) { pDC->MoveTo(2, y); str.Format("(%04d) %04d", people->mCurrEquipID, people->mMatterID); pDC->TextOut(0, 0, str); T2People *prevPeople = people; people = (T2People *) people->mNext; int j = 0; while (people && j < 100) { if (prevPeople == people->mPrev) pDC->SetTextColor(RGB(0, 0, 0)); else pDC->SetTextColor(RGB(255, 0, 0)); pDC->TextOut(0, 0, " \x81\xA8 "); pDC->SetTextColor(RGB(0, 0, 0)); str.Format("%04d:%02d", people->mMatterID, people->GetStatus()); pDC->TextOut(0, 0, str); prevPeople = people; people = (T2People *) people->mNext; j++; } y += height; } } } pDC->RestoreDC(save); return true; } int DbgPeopleView::OnCreate(LPCREATESTRUCT lpCreateStruct) { if (CFrameWnd::OnCreate(lpCreateStruct) == -1) return -1; SetTimer(1, 100, NULL); return 0; } void DbgPeopleView::OnTimer(UINT nIDEvent) { InvalidateRect(NULL); } void DbgPeopleView::OnDestroy() { CFrameWnd::OnDestroy(); KillTimer(1); }