#include "StdAfx.h" #include "GlobalFunc.h" #include "SoundDlg.h" #include "SpeedDlg.h" #include "T2BitImage.h" #include "T2DlgItem.h" #include "T2ImageObj.h" #include "T2SettingDialog.h" #include "WalkerDlg.h" T2SettingDialog::T2SettingDialog(T2TowerDoc* inDoc) { #pragma var_order(theRadio, rect, tmpl, theText, theModule, pt, theDlgTitle) mDocument = inDoc; CRect rect; AfxGetMainWnd()->GetWindowRect(rect); HINSTANCE theModule = GetWorldModuleHandle(); mImageObj = new T2ImageObj; mBitImage = new T2BitImage(theModule, 7000, true); #line 24 _ASSERT(mBitImage != NULL); mImageObj->AddObject(theModule, 7000, mBitImage); T2DLGTEMPLATE tmpl; tmpl.pt = rect.CenterPoint(); tmpl.moduleHandle = theModule; tmpl.resID = 7000; Realize(mDocument, &tmpl, mDocument, mImageObj, NULL, true, NULL, 0, true); mSpeedDlg = new SpeedDlg; mSoundDlg = new SoundDlg; mWalkerDlg = new WalkerDlg; POINT pt; pt.x = 70; pt.y = 30; mSpeedDlg->Setup(mTowerDoc, theModule, this, pt, mImageObj); mSoundDlg->Setup(mTowerDoc, theModule, this, pt, mImageObj); mWalkerDlg->Setup(mTowerDoc, theModule, this, pt, mImageObj); mSpeedDlg->ShowWindow(5); T2DlgItem *theRadio = GetT2DlgItem(108); theRadio->SetValue(1); T2DlgItem *theText = GetT2DlgItem(120); CString theDlgTitle; mSpeedDlg->GetWindowText(theDlgTitle); theText->SetDescriptor(theDlgTitle); } /*virtual*/ T2SettingDialog::~T2SettingDialog() { if (mImageObj) delete mImageObj; if (mBitImage) delete mBitImage; } /*virtual*/ BOOL T2SettingDialog::OnT2DialogCommand(WPARAM inWParam, LPARAM inLParam) { BOOL done = true; WORD code = HIWORD(inWParam); WORD id = LOWORD(inWParam); T2DlgItem *theSpeedTabRadio = GetT2DlgItem(108); T2DlgItem *theSoundTabRadio = GetT2DlgItem(109); T2DlgItem *theWalkerTabRadio = GetT2DlgItem(110); T2DlgItem *theHeaderText = GetT2DlgItem(120); CString theDlgTitle; switch (id) { case 108: mSoundDlg->ShowWindow(SW_HIDE); mWalkerDlg->ShowWindow(SW_HIDE); mSpeedDlg->ShowWindow(SW_SHOW); theSoundTabRadio->SetValue(0); theWalkerTabRadio->SetValue(0); mSpeedDlg->GetWindowText(theDlgTitle); theHeaderText->SetDescriptor(theDlgTitle); break; case 109: mWalkerDlg->ShowWindow(SW_HIDE); mSpeedDlg->ShowWindow(SW_HIDE); mSoundDlg->ShowWindow(SW_SHOW); theSpeedTabRadio->SetValue(0); theWalkerTabRadio->SetValue(0); mSoundDlg->GetWindowText(theDlgTitle); theHeaderText->SetDescriptor(theDlgTitle); break; case 110: mSoundDlg->ShowWindow(SW_HIDE); mSpeedDlg->ShowWindow(SW_HIDE); mWalkerDlg->ShowWindow(SW_SHOW); theSpeedTabRadio->SetValue(0); theSoundTabRadio->SetValue(0); mWalkerDlg->GetWindowText(theDlgTitle); theHeaderText->SetDescriptor(theDlgTitle); break; case 111: mSpeedDlg->Revert(); mSoundDlg->Revert(); mWalkerDlg->Revert(); break; case 112: mSpeedDlg->Save(); mSoundDlg->Save(); mWalkerDlg->Save(); OnT2OK(); DoClose(id); break; case 113: OnT2OK(); DoClose(id); break; default: done = T2Dialog::OnT2DialogCommand(inWParam, inLParam); } return done; }