#include "MoverSearchDlg.h" #include "T2DlgItemListBox.h" #include "T2FloorInfo.h" #include "T2Mover.h" #include "T2MoverArrayList.h" #include "T2Name.h" #include "T2NameList.h" #include "T2TowerDoc.h" #include "T2WorldDef.h" #include "UT2Utils.h" MoverSearchDlg::MoverSearchDlg() { mDeleteOnClose = true; } /*virtual*/ MoverSearchDlg::~MoverSearchDlg() { } void MoverSearchDlg::Create(T2TowerDoc *inDoc, HINSTANCE inInstance, CWnd *inParentWnd, const POINT &inPt) { mDocument = inDoc; T2DLGTEMPLATE tmpl; tmpl.resID = 7130; tmpl.pt = inPt; tmpl.moduleHandle = inInstance; Realize(inParentWnd, &tmpl, inDoc, NULL, inDoc->mWorldDef->GetPalette(), false, inParentWnd, 112, true); ShowWindow(SW_HIDE); } void MoverSearchDlg::DoFind() { T2DlgItemListBox *theListBox = (T2DlgItemListBox *) GetDlgItem(1000); int curSel = theListBox->GetCurSel(); if (curSel == -1) return; T2Name *theName = (T2Name *) theListBox->GetItemDataPtr(curSel); mDocument->towerDoc_vf238(theName); } void MoverSearchDlg::DoDelete() { T2DlgItemListBox *theListBox = (T2DlgItemListBox *) GetDlgItem(1000); int curSel = theListBox->GetCurSel(); if (curSel == -1) return; T2Name *theName = (T2Name *) theListBox->GetItemDataPtr(curSel); mDocument->mNameDB->RemoveName(theName); theListBox->DeleteString(curSel); } /*virtual*/ void MoverSearchDlg::OnT2Create() { T2DlgItemListBox *theListBox = (T2DlgItemListBox *) GetDlgItem(1000); T2MoverArrayList *theList = mDocument->mFloorInfo->GetMoverArrayList(); if (!theListBox) return; if (!theList) return; HFONT theFont = GetFont(); if (theFont) theListBox->SetFont(theFont); theListBox->ResetContent(); T2NameList *theNameDB = mDocument->mNameDB; T2Name *theName; LArrayIterator iterator(*theNameDB); while (iterator.Next(&theName)) { int type = theName->GetType(); if (type == kMoverNameType) { CString nameStr; unsigned int moverID; theName->GetName(nameStr, moverID); int theIndex = theListBox->AddString(nameStr); theListBox->SetItemDataPtr(theIndex, theName); } } }