#include "StdAfx.h" #include "T2AdvertiseTable.h" #include "T2Dialog.h" #include "T2DlgItemAnimation.h" #include "T2DlgItemArrows.h" #include "T2DlgItemEdit.h" #include "T2DlgItemIButton.h" #include "T2DlgItemICheck.h" #include "T2DlgItemIRepeater.h" #include "T2DlgItemListBox.h" #include "T2DlgItemMerchandiseField.h" #include "T2DlgItemMovie.h" #include "T2DlgItemPeopleView.h" #include "T2DlgItemPopup.h" #include "T2DlgItemProgress.h" #include "T2DlgItemRadioButton.h" #include "T2DlgItemRadioText.h" #include "T2DlgItemSTimeTbl.h" #include "T2PluginInfoTable.h" #include "../T2TowerDoc.h" #include "T2WorldDef.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif #line 19 IMPLEMENT_DYNCREATE(T2Dialog, CWnd) T2Dialog::T2Dialog() { mInModalLoop = false; mUserCon = 0; mDeleteOnClose = false; mFontName = "\x82\x6C\x82\x72 \x82\x6F\x83\x53\x83\x56\x83\x62\x83\x4E"; for (int i = 0; i < 10; i++) mFontNums[i] = 0; } /*virtual*/ T2Dialog::~T2Dialog() { for (int i = 0; i < 10; i++) { if (mFonts[i]) delete mFonts[i]; } } void T2Dialog::Realize(void* a, T2DLGTEMPLATE* tmpl, T2TowerDoc* towerDoc, T2ImageObj* imageObj, CPalette* palette, BOOL isToolWindow, CWnd* parentWnd, UINT nID, BOOL autoShow) { mEC = a; mTowerDoc = towerDoc; mAutoShow = autoShow; mTemplate = *tmpl; mImageObj = imageObj; if (towerDoc && mTowerDoc->mWorldDef) mPalette = mTowerDoc->mWorldDef->GetPalette(); else if (palette) mPalette = palette; else mPalette = NULL; if (!parentWnd) parentWnd = AfxGetMainWnd(); for (int i = 0; i < 10; i++) mFonts[i] = NULL; mFontCount = 0; mCurrentFont = -1; RECT rect; rect.left = 0; rect.top = 0; rect.right = 100; rect.bottom = 100; CString wndClass = AfxRegisterWndClass( CS_VREDRAW | CS_HREDRAW | CS_DBLCLKS, LoadCursor(NULL, IDC_ARROW), (HBRUSH) GetStockObject(WHITE_BRUSH), NULL); CreateEx( isToolWindow ? WS_EX_TOOLWINDOW : 0, wndClass, "", isToolWindow ? (WS_POPUP | WS_CAPTION) : WS_CHILD, rect, parentWnd, nID ); } BEGIN_MESSAGE_MAP(T2Dialog, CWnd) ON_WM_CREATE() ON_WM_DESTROY() ON_WM_QUERYNEWPALETTE() ON_WM_ERASEBKGND() ON_WM_LBUTTONDBLCLK() ON_WM_LBUTTONDOWN() ON_WM_LBUTTONUP() ON_WM_ACTIVATEAPP() END_MESSAGE_MAP() int T2Dialog::OnCreate(CREATESTRUCT* cs) { if (CWnd::OnCreate(cs) == -1) return -1; HRSRC rsrc = FindResource(mTemplate.moduleHandle, MAKEINTATOM(mTemplate.resID), "T2DLG"); if (!rsrc) { // "ダイアログがありません。" - No dialog. MessageBox("\x83\x5F\x83\x43\x83\x41\x83\x8D\x83\x4F\x82\xAA\x82\xA0\x82\xE8\x82\xDC\x82\xB9\x82\xF1\x81\x42"); return 0; } #line 90 _ASSERT(rsrc); HGLOBAL theResHandle = LoadResource(mTemplate.moduleHandle, rsrc); #line 92 _ASSERT(theResHandle); void *theRes = LockResource(theResHandle); #line 94 _ASSERT(theRes); DWORD theResSize = SizeofResource(mTemplate.moduleHandle, rsrc); char *data = (char *) malloc(theResSize + 1); memcpy(data, theRes, theResSize); data[theResSize] = 0; DoOnCreate(data); free(data); OnT2Create(); if (mTowerDoc && !(GetWindowLong(m_hWnd, GWL_STYLE) & WS_CHILD)) { if (mModal != 0) mTowerDoc->towerDoc_vf1A0(true); if (mModal == 1) mTowerDoc->towerDoc_vf290(true); } if (mAutoShow && !(cs->style & WS_CHILD)) ShowWindow(SW_SHOW); return 0; } T2Dialog::T2DialogDef::T2DialogDef() : width(100) , height(100) , modal(1) , title(NULL) , center(true) , flags(WS_VISIBLE | WS_CHILD) { } /*virtual*/ T2Dialog::T2DialogDef::~T2DialogDef() { } /*virtual*/ void T2Dialog::AfterBurner(T2DialogDef& def) { mModal = def.modal; SetWindowText(def.title); CRect windowRect, clientRect, theDesktopRect; GetWindowRect(windowRect); GetClientRect(clientRect); GetDesktopWindow()->GetClientRect(theDesktopRect); def.width += (windowRect.Width() - clientRect.Width()); def.height += (windowRect.Height() - clientRect.Height()); int cx = def.center ? (mTemplate.pt.x - def.width / 2) : mTemplate.pt.x; if (cx < theDesktopRect.left) cx = theDesktopRect.left; if (cx + def.width >= theDesktopRect.right) cx = theDesktopRect.right - def.width; int cy = def.center ? (mTemplate.pt.y - def.height / 2) : mTemplate.pt.y; if (cy < theDesktopRect.top) cy = theDesktopRect.top; if (cy + def.height >= theDesktopRect.bottom) cy = theDesktopRect.bottom - def.height; SetWindowPos(NULL, cx, cy, def.width, def.height, SWP_NOZORDER); } /*virtual*/ void T2Dialog::DoOnCreate(char* data) { T2DialogDef def; CreateDlgItemLoop(def, data); AfterBurner(def); } void T2Dialog::CreateDlgItemLoop(T2DialogDef& def, char* data) { CTokenizer tokenizer(data); while (tokenizer.NextWord()) { if (tokenizer.Current()[0] == '#') tokenizer.NextString("\r\n"); else CreateDlgItem(tokenizer, def); } } /*virtual*/ void T2Dialog::CreateDlgItem(CTokenizer& inTokenizer, T2DialogDef& inDef) { const char *token = inTokenizer.Current(); if (!_stricmp(token, "WIDTH")) { inDef.width = inTokenizer.NextInteger(); } else if (!_stricmp(token, "HEIGHT")) { inDef.height = inTokenizer.NextInteger(); } else if (!_stricmp(token, "MODAL")) { inDef.modal = 1; } else if (!_stricmp(token, "MODALESS")) { inDef.modal = 0; } else if (!_stricmp(token, "TMODAL")) { inDef.modal = 2; } else if (!_stricmp(token, "TITLE")) { inDef.title = inTokenizer.NextString(); } else if (!_stricmp(token, "FONTNAME")) { mFontName = inTokenizer.NextString(); } else if (!_stricmp(token, "FONT")) { int fontNum = inTokenizer.NextInteger(); int i; for (i = 0; i < 10; i++) { if (mFonts[i] && mFontNums[i] == fontNum) break; } if (i == 10) { mFontNums[mFontCount] = fontNum; #line 228 mFonts[mFontCount] = new CFont; CString str; if (mFontName[0] == '!') { str = mFontName.Mid(1); mFonts[mFontCount]->CreateFont(-abs(fontNum), 0, 0, 0, (fontNum > 0) ? FW_NORMAL : FW_BOLD, false, false, false, SHIFTJIS_CHARSET, OUT_TT_PRECIS, CLIP_TT_ALWAYS, DRAFT_QUALITY, DEFAULT_PITCH, str); } else { mFonts[mFontCount]->CreateFont(-abs(fontNum), 0, 0, 0, (fontNum > 0) ? FW_NORMAL : FW_BOLD, false, false, false, SHIFTJIS_CHARSET, OUT_TT_PRECIS, CLIP_TT_ALWAYS, PROOF_QUALITY, DEFAULT_PITCH, mFontName); } mCurrentFont = mFontCount; mFontCount++; } else { mCurrentFont = i; } } else if (!_stricmp(token, "VISIBLE")) { inDef.flags |= WS_VISIBLE; } else if (!_stricmp(token, "INVISIBLE")) { inDef.flags &= ~WS_VISIBLE; } else if (!_stricmp(token, "CENTER")) { inDef.center = true; } else if (!_stricmp(token, "LEFTTOP")) { inDef.center = false; } else if (!_stricmp(token, "OK")) { RECT rect; rect.left = inTokenizer.NextInteger(); rect.top = inTokenizer.NextInteger(); #line 263 T2DlgItemOK *item = new T2DlgItemOK(mTowerDoc, mImageObj, mPalette); item->Create("", inDef.flags, rect, this, 1); item->CreateSubItem(NULL); if (mCurrentFont >= 0) item->SetFont(*mFonts[mCurrentFont]); } else if (!_stricmp(token, "CANCEL")) { RECT rect; rect.left = inTokenizer.NextInteger(); rect.top = inTokenizer.NextInteger(); #line 274 T2DlgItemCANCEL *item = new T2DlgItemCANCEL(mTowerDoc, mImageObj, mPalette); item->Create("", inDef.flags, rect, this, 2); item->CreateSubItem(NULL); if (mCurrentFont >= 0) item->SetFont(*mFonts[mCurrentFont]); } else if (!_stricmp(token, "BUTTON")) { UINT id = inTokenizer.NextInteger(); CString text = inTokenizer.NextString(); RECT rect; rect.left = inTokenizer.NextInteger(); rect.top = inTokenizer.NextInteger(); rect.right = inTokenizer.NextInteger(); rect.bottom = inTokenizer.NextInteger(); #line 289 T2DlgItemTButton *item = new T2DlgItemTButton(mTowerDoc, mImageObj, mPalette); item->Create(text, inDef.flags, rect, this, id); item->CreateSubItem(NULL); if (mCurrentFont >= 0) item->SetFont(*mFonts[mCurrentFont]); } else if (!_stricmp(token, "IBUTTON")) { UINT id = inTokenizer.NextInteger(); CString text = inTokenizer.NextString(); RECT rect; rect.left = inTokenizer.NextInteger(); rect.top = inTokenizer.NextInteger(); rect.right = inTokenizer.NextInteger(); rect.bottom = inTokenizer.NextInteger(); #line 304 T2DlgItemIButton *item = new T2DlgItemIButton(mTowerDoc, mImageObj, mPalette); item->Create(text, inDef.flags, rect, this, id); item->CreateSubItem(NULL); if (mCurrentFont >= 0) item->SetFont(*mFonts[mCurrentFont]); } else if (!_stricmp(token, "CHECK")) { UINT id = inTokenizer.NextInteger(); RECT rect; rect.left = inTokenizer.NextInteger(); rect.top = inTokenizer.NextInteger(); #line 316 T2DlgItemCheck *item = new T2DlgItemCheck(mTowerDoc, mImageObj, mPalette); item->Create("", inDef.flags, rect, this, id); item->CreateSubItem(NULL); if (mCurrentFont >= 0) item->SetFont(*mFonts[mCurrentFont]); } else if (!_stricmp(token, "ICHECK")) { UINT id = inTokenizer.NextInteger(); CString text = inTokenizer.NextString(); RECT rect; rect.left = inTokenizer.NextInteger(); rect.top = inTokenizer.NextInteger(); #line 329 T2DlgItemICheck *item = new T2DlgItemICheck(mTowerDoc, mImageObj, mPalette); item->Create(text, inDef.flags, rect, this, id); item->CreateSubItem(NULL); if (mCurrentFont >= 0) item->SetFont(*mFonts[mCurrentFont]); } else if (!_stricmp(token, "IREPEAT")) { UINT id = inTokenizer.NextInteger(); CString text = inTokenizer.NextString(); RECT rect; rect.left = inTokenizer.NextInteger(); rect.top = inTokenizer.NextInteger(); rect.right = inTokenizer.NextInteger(); rect.bottom = inTokenizer.NextInteger(); #line 344 T2DlgItemIRepeater *item = new T2DlgItemIRepeater(mTowerDoc, mImageObj, mPalette); item->Create(text, inDef.flags, rect, this, id); item->CreateSubItem(NULL); if (mCurrentFont >= 0) item->SetFont(*mFonts[mCurrentFont]); } else if (!_stricmp(token, "RADIO")) { UINT id = inTokenizer.NextInteger(); CString text = inTokenizer.NextString(); RECT rect; rect.left = inTokenizer.NextInteger(); rect.top = inTokenizer.NextInteger(); #line 357 T2DlgItemRadioButton *item = new T2DlgItemRadioButton(mTowerDoc, mImageObj, mPalette); item->Create(text, inDef.flags, rect, this, id); item->CreateSubItem(NULL); if (mCurrentFont >= 0) item->SetFont(*mFonts[mCurrentFont]); } else if (!_stricmp(inTokenizer.Current(), "TXRADIO")) { UINT id = inTokenizer.NextInteger(); CString text = inTokenizer.NextString(); RECT rect; rect.left = inTokenizer.NextInteger(); rect.top = inTokenizer.NextInteger(); rect.right = inTokenizer.NextInteger(); rect.bottom = inTokenizer.NextInteger(); #line 371 T2DlgItemRadioText *item = new T2DlgItemRadioText(mTowerDoc, mImageObj, mPalette); item->Create(text, inDef.flags, rect, this, id); item->CreateSubItem(NULL); if (mCurrentFont >= 0) item->SetFont(*mFonts[mCurrentFont]); } else if (!_stricmp(token, "EDIT")) { UINT id = inTokenizer.NextInteger(); RECT rect; rect.left = inTokenizer.NextInteger(); rect.top = inTokenizer.NextInteger(); rect.right = inTokenizer.NextInteger(); rect.bottom = inTokenizer.NextInteger(); int maxChars = inTokenizer.NextInteger(); #line 386 T2DlgItemEdit *item = new T2DlgItemEdit(mTowerDoc, mImageObj, mPalette); item->Create("", inDef.flags | WS_CLIPCHILDREN, rect, this, id); item->CreateSubItem(&maxChars); if (mCurrentFont >= 0) item->SetFont(*mFonts[mCurrentFont]); } else if (!_stricmp(token, "HSCROLL")) { UINT id = inTokenizer.NextInteger(); RECT rect; rect.left = inTokenizer.NextInteger(); rect.top = inTokenizer.NextInteger(); rect.right = inTokenizer.NextInteger(); rect.bottom = inTokenizer.NextInteger(); #line 400 T2DlgItemHScr *item = new T2DlgItemHScr(mTowerDoc, mImageObj, mPalette); item->Create("", inDef.flags, rect, this, id); item->CreateSubItem(NULL); if (mCurrentFont >= 0) item->SetFont(*mFonts[mCurrentFont]); } else if (!_stricmp(token, "VSCROLL")) { UINT id = inTokenizer.NextInteger(); RECT rect; rect.left = inTokenizer.NextInteger(); rect.top = inTokenizer.NextInteger(); rect.right = inTokenizer.NextInteger(); rect.bottom = inTokenizer.NextInteger(); #line 414 T2DlgItemVScr *item = new T2DlgItemVScr(mTowerDoc, mImageObj, mPalette); item->Create("", inDef.flags, rect, this, id); item->CreateSubItem(NULL); if (mCurrentFont >= 0) item->SetFont(*mFonts[mCurrentFont]); } else if (!_stricmp(token, "BOX")) { UINT id = inTokenizer.NextInteger(); RECT rect; rect.left = inTokenizer.NextInteger(); rect.top = inTokenizer.NextInteger(); rect.right = inTokenizer.NextInteger(); rect.bottom = inTokenizer.NextInteger(); #line 428 T2DlgItemBox *item = new T2DlgItemBox(mTowerDoc, mImageObj, mPalette); item->Create("", inDef.flags, rect, this, id); item->CreateSubItem(NULL); if (mCurrentFont >= 0) item->SetFont(*mFonts[mCurrentFont]); } else if (!_stricmp(token, "TEXT")) { UINT id = inTokenizer.NextInteger(); CString text = inTokenizer.NextString(); RECT rect; rect.left = inTokenizer.NextInteger(); rect.top = inTokenizer.NextInteger(); rect.right = inTokenizer.NextInteger(); rect.bottom = inTokenizer.NextInteger(); #line 443 T2DlgItemText *item = new T2DlgItemText(mTowerDoc, mImageObj, mPalette); item->Create(text, inDef.flags, rect, this, id); item->CreateSubItem(NULL); if (mCurrentFont >= 0) item->SetFont(*mFonts[mCurrentFont]); } else if (!_stricmp(token, "DIALOG")) { UINT id = inTokenizer.NextInteger(); T2DLGTEMPLATE theTemplate; theTemplate.resID = inTokenizer.NextInteger(); theTemplate.pt.x = inTokenizer.NextInteger(); theTemplate.pt.y = inTokenizer.NextInteger(); theTemplate.moduleHandle = mTemplate.moduleHandle; #line 457 T2Dialog *theDialog = new T2Dialog; theDialog->Realize(this, &theTemplate, mTowerDoc, mImageObj, NULL, false, this, id, true); } else if (!_stricmp(token, "PPVIEW")) { UINT id = inTokenizer.NextInteger(); RECT rect; rect.left = inTokenizer.NextInteger(); rect.top = inTokenizer.NextInteger(); rect.right = inTokenizer.NextInteger(); rect.bottom = inTokenizer.NextInteger(); #line 468 T2DlgItemPeopleView *item = new T2DlgItemPeopleView(mTowerDoc, mImageObj, mPalette); item->Create("", inDef.flags, rect, this, id); item->CreateSubItem(NULL); if (mCurrentFont >= 0) item->SetFont(*mFonts[mCurrentFont]); } else if (!_stricmp(token, "PGAGE")) { UINT id = inTokenizer.NextInteger(); RECT rect; rect.left = inTokenizer.NextInteger(); rect.top = inTokenizer.NextInteger(); rect.right = inTokenizer.NextInteger(); rect.bottom = inTokenizer.NextInteger(); #line 482 T2DlgItemProfitsGage *item = new T2DlgItemProfitsGage(mTowerDoc, mImageObj, mPalette); item->Create("", inDef.flags, rect, this, id); item->CreateSubItem(NULL); if (mCurrentFont >= 0) item->SetFont(*mFonts[mCurrentFont]); } else if (!_stricmp(token, "CGAGE")) { UINT id = inTokenizer.NextInteger(); RECT rect; rect.left = inTokenizer.NextInteger(); rect.top = inTokenizer.NextInteger(); rect.right = inTokenizer.NextInteger(); rect.bottom = inTokenizer.NextInteger(); #line 496 T2DlgItemCustomerGage *item = new T2DlgItemCustomerGage(mTowerDoc, mImageObj, mPalette); item->Create("", inDef.flags, rect, this, id); item->CreateSubItem(NULL); if (mCurrentFont >= 0) item->SetFont(*mFonts[mCurrentFont]); } else if (!_stricmp(token, "SGAGE")) { UINT id = inTokenizer.NextInteger(); RECT rect; rect.left = inTokenizer.NextInteger(); rect.top = inTokenizer.NextInteger(); rect.right = inTokenizer.NextInteger(); rect.bottom = inTokenizer.NextInteger(); #line 510 T2DlgItemStressGage *item = new T2DlgItemStressGage(mTowerDoc, mImageObj, mPalette); item->Create("", inDef.flags, rect, this, id); item->CreateSubItem(NULL); if (mCurrentFont >= 0) item->SetFont(*mFonts[mCurrentFont]); } else if (!_stricmp(token, "EGAGE")) { UINT id = inTokenizer.NextInteger(); RECT rect; rect.left = inTokenizer.NextInteger(); rect.top = inTokenizer.NextInteger(); rect.right = inTokenizer.NextInteger(); rect.bottom = inTokenizer.NextInteger(); #line 524 T2DlgItemPPLEvalGage *item = new T2DlgItemPPLEvalGage(mTowerDoc, mImageObj, mPalette); item->Create("", inDef.flags, rect, this, id); item->CreateSubItem(NULL); if (mCurrentFont >= 0) item->SetFont(*mFonts[mCurrentFont]); } else if (!_stricmp(token, "BGAGE")) { UINT id = inTokenizer.NextInteger(); RECT rect; rect.left = inTokenizer.NextInteger(); rect.top = inTokenizer.NextInteger(); rect.right = inTokenizer.NextInteger(); rect.bottom = inTokenizer.NextInteger(); #line 538 T2DlgItemBelongGage *item = new T2DlgItemBelongGage(mTowerDoc, mImageObj, mPalette); item->Create("", inDef.flags, rect, this, id); item->CreateSubItem(NULL); if (mCurrentFont >= 0) item->SetFont(*mFonts[mCurrentFont]); } else if (!_stricmp(token, "TABLE")) { UINT id = inTokenizer.NextInteger(); RECT rect; rect.left = inTokenizer.NextInteger(); rect.top = inTokenizer.NextInteger(); rect.right = inTokenizer.NextInteger(); rect.bottom = inTokenizer.NextInteger(); #line 552 T2DlgItemTable *item = new T2DlgItemTable(mTowerDoc, mImageObj, mPalette); item->Create("", inDef.flags, rect, this, id); item->CreateSubItem(NULL); if (mCurrentFont >= 0) item->SetFont(*mFonts[mCurrentFont]); } else if (!_stricmp(token, "POPUP")) { UINT id = inTokenizer.NextInteger(); CString text = inTokenizer.NextString(); RECT rect; rect.left = inTokenizer.NextInteger(); rect.top = inTokenizer.NextInteger(); rect.right = inTokenizer.NextInteger(); rect.bottom = inTokenizer.NextInteger(); #line 566 T2DlgItemPopup *item = new T2DlgItemPopup(mTowerDoc, mImageObj, mPalette); item->Create(text, inDef.flags, rect, this, id); item->CreateSubItem(NULL); if (mCurrentFont >= 0) item->SetFont(*mFonts[mCurrentFont]); } else if (!_stricmp(token, "PINFTBL")) { UINT id = inTokenizer.NextInteger(); RECT rect; rect.left = inTokenizer.NextInteger(); rect.top = inTokenizer.NextInteger(); rect.right = inTokenizer.NextInteger(); rect.bottom = inTokenizer.NextInteger(); #line 580 T2PluginInfoTable *item = new T2PluginInfoTable(mTowerDoc, mImageObj, mPalette); item->Create("", inDef.flags, rect, this, id); item->CreateSubItem(NULL); if (mCurrentFont >= 0) item->SetFont(*mFonts[mCurrentFont]); } else if (!_stricmp(token, "IMAGE")) { UINT id = inTokenizer.NextInteger(); CString text = inTokenizer.NextString(); RECT rect; rect.left = inTokenizer.NextInteger(); rect.top = inTokenizer.NextInteger(); rect.right = inTokenizer.NextInteger(); rect.bottom = inTokenizer.NextInteger(); #line 594 T2DlgItemImage *item = new T2DlgItemImage(mTowerDoc, mImageObj, mPalette); item->Create(text, inDef.flags, rect, this, id); item->CreateSubItem(NULL); if (mCurrentFont >= 0) item->SetFont(*mFonts[mCurrentFont]); } else if (!_stricmp(token, "MERF")) { UINT id = inTokenizer.NextInteger(); RECT rect; rect.left = inTokenizer.NextInteger(); rect.top = inTokenizer.NextInteger(); rect.right = inTokenizer.NextInteger(); rect.bottom = inTokenizer.NextInteger(); int maxChars = inTokenizer.NextInteger(); #line 608 T2DlgItemMerchandiseField *item = new T2DlgItemMerchandiseField(mTowerDoc, mImageObj, mPalette); item->Create("", inDef.flags | WS_CLIPCHILDREN, rect, this, id); item->CreateSubItem(&maxChars); if (mCurrentFont >= 0) item->SetFont(*mFonts[mCurrentFont]); } else if (!_stricmp(token, "ARROWS")) { UINT id = inTokenizer.NextInteger(); RECT rect; rect.left = inTokenizer.NextInteger(); rect.top = inTokenizer.NextInteger(); #line 619 T2DlgItemArrows *item = new T2DlgItemArrows(mTowerDoc, mImageObj, mPalette); item->Create("", inDef.flags | WS_CLIPCHILDREN, rect, this, id); item->CreateSubItem(NULL); if (mCurrentFont >= 0) item->SetFont(*mFonts[mCurrentFont]); } else if (!_stricmp(token, "LISTBOX")) { UINT id = inTokenizer.NextInteger(); RECT rect; rect.left = inTokenizer.NextInteger(); rect.top = inTokenizer.NextInteger(); rect.right = inTokenizer.NextInteger(); rect.bottom = inTokenizer.NextInteger(); #line 634 T2DlgItemListBox *item = new T2DlgItemListBox(mTowerDoc, mImageObj, mPalette); item->Create("", inDef.flags | WS_CLIPCHILDREN, rect, this, id); item->CreateSubItem(); if (mCurrentFont >= 0) item->SetFont(*mFonts[mCurrentFont]); } else if (!_stricmp(token, "TBDISABLED")) { UINT id = inTokenizer.NextInteger(); CString text = inTokenizer.NextString(); RECT rect; rect.left = inTokenizer.NextInteger(); rect.top = inTokenizer.NextInteger(); rect.right = inTokenizer.NextInteger(); rect.bottom = inTokenizer.NextInteger(); #line 649 CToggleButtonDisabled *item = new CToggleButtonDisabled(mTowerDoc, mImageObj, mPalette); item->Create(text, inDef.flags, rect, this, id); item->CreateSubItem(NULL); if (mCurrentFont >= 0) item->SetFont(*mFonts[mCurrentFont]); } else if (!_stricmp(token, "STIMETBL")) { UINT id = inTokenizer.NextInteger(); RECT rect; rect.left = inTokenizer.NextInteger(); rect.top = inTokenizer.NextInteger(); rect.right = inTokenizer.NextInteger(); rect.bottom = inTokenizer.NextInteger(); #line 662 T2DlgItemSTimeTbl *item = new T2DlgItemSTimeTbl(mTowerDoc, mImageObj, mPalette); item->Create("", inDef.flags, rect, this, id); item->CreateSubItem(NULL); if (mCurrentFont >= 0) item->SetFont(*mFonts[mCurrentFont]); } else if (!_stricmp(token, "MOVIE")) { UINT id = inTokenizer.NextInteger(); RECT rect; rect.left = inTokenizer.NextInteger(); rect.top = inTokenizer.NextInteger(); rect.right = inTokenizer.NextInteger(); rect.bottom = inTokenizer.NextInteger(); #line 676 T2DlgItemMovie *item = new T2DlgItemMovie(mTowerDoc, mImageObj, mPalette); item->Create("", inDef.flags | WS_CLIPCHILDREN, rect, this, id); item->CreateSubItem(NULL); if (mCurrentFont >= 0) item->SetFont(*mFonts[mCurrentFont]); } else if (!_stricmp(token, "MOVTBL")) { UINT id = inTokenizer.NextInteger(); RECT rect; rect.left = inTokenizer.NextInteger(); rect.top = inTokenizer.NextInteger(); rect.right = inTokenizer.NextInteger(); rect.bottom = inTokenizer.NextInteger(); #line 690 T2MovieTable *item = new T2MovieTable(mTowerDoc, mImageObj, mPalette); item->Create("", inDef.flags, rect, this, id); item->CreateSubItem(NULL); if (mCurrentFont >= 0) item->SetFont(*mFonts[mCurrentFont]); } else if (!_stricmp(token, "ANIM")) { UINT id = inTokenizer.NextInteger(); RECT rect; rect.left = inTokenizer.NextInteger(); rect.top = inTokenizer.NextInteger(); rect.right = inTokenizer.NextInteger(); rect.bottom = inTokenizer.NextInteger(); #line 705 T2DlgItemAnimation *item = new T2DlgItemAnimation(mTowerDoc, mImageObj, mPalette); item->Create("", inDef.flags | WS_CLIPCHILDREN, rect, this, id); if (mCurrentFont >= 0) item->SetFont(*mFonts[mCurrentFont]); } else if (!_stricmp(token, "PROG")) { UINT id = inTokenizer.NextInteger(); RECT rect; rect.left = inTokenizer.NextInteger(); rect.top = inTokenizer.NextInteger(); rect.right = inTokenizer.NextInteger(); rect.bottom = inTokenizer.NextInteger(); #line 719 T2DlgItemProgress *item = new T2DlgItemProgress(mTowerDoc, mImageObj, mPalette); item->Create("", inDef.flags | WS_CLIPCHILDREN, rect, this, id); item->CreateSubItem(); if (mCurrentFont >= 0) item->SetFont(*mFonts[mCurrentFont]); } else if (!_stricmp(token, "ATZTBL")) { UINT id = inTokenizer.NextInteger(); RECT rect; rect.left = inTokenizer.NextInteger(); rect.top = inTokenizer.NextInteger(); rect.right = inTokenizer.NextInteger(); rect.bottom = inTokenizer.NextInteger(); #line 733 T2AdvertiseTable *item = new T2AdvertiseTable(mTowerDoc, mImageObj, mPalette); item->Create("", inDef.flags, rect, this, id); item->CreateSubItem(NULL); if (mCurrentFont >= 0) item->SetFont(*mFonts[mCurrentFont]); } else { // "ダイアログテキスト内に見知らぬトークンがあります:" CString err = "\x83\x5F\x83\x43\x83\x41\x83\x8D\x83\x4F\x83\x65\x83\x4C\x83\x58\x83\x67\x93\xE0\x82\xC9\x8C\xA9\x92\x6D\x82\xE7\x82\xCA\x83\x67\x81\x5B\x83\x4E\x83\x93\x82\xAA\x82\xA0\x82\xE8\x82\xDC\x82\xB7\x81\x46"; err += token; MessageBox(err, NULL, MB_ICONEXCLAMATION); } } void T2Dialog::OnDestroy() { OnT2Destroy(); CWnd::OnDestroy(); if (mTowerDoc && !(GetWindowLong(m_hWnd, GWL_STYLE) & WS_CHILD)) { if (mModal != 0) mTowerDoc->towerDoc_vf1A0(false); if (mModal == 1) mTowerDoc->towerDoc_vf290(false); } } BOOL T2Dialog::OnQueryNewPalette() { return CWnd::OnQueryNewPalette(); } BOOL T2Dialog::OnEraseBkgnd(CDC* dc) { BOOL result = true; if (!OnT2PreEraseBkgnd(dc)) { int saved = dc->SaveDC(); dc->SelectPalette(mPalette, false); dc->RealizePalette(); CBrush theBrush; theBrush.CreateStockObject(LTGRAY_BRUSH); CRect rect1; GetClientRect(rect1); dc->FillRect(rect1, &theBrush); CPen pen1; pen1.CreatePen(PS_SOLID, 0, PALETTERGB(255, 255, 255)); CPen pen2; pen2.CreateStockObject(GRAY_BRUSH); // wait... that's not a pen CRect rect2; GetClientRect(rect2); dc->SelectObject(pen1); dc->MoveTo(rect2.right - 1, rect2.top); dc->LineTo(rect2.left, rect2.top); dc->LineTo(rect2.left, rect2.bottom); dc->SelectObject(pen2); dc->MoveTo(rect2.right - 1, rect2.top + 1); dc->LineTo(rect2.right - 1, rect2.bottom - 1); dc->LineTo(rect2.left, rect2.bottom - 1); dc->RestoreDC(saved); result = OnT2EraseBkgnd(dc); } return result; } /*virtual*/ BOOL T2Dialog::OnCommand(WPARAM wParam, LPARAM lParam) { BOOL result = true; WORD code = HIWORD(wParam); WORD id = LOWORD(wParam); if ((id == 1 || id == 2) && (code == 0)) { if (id == 1) OnT2OK(); else OnT2Cancel(); DoClose(id); } else { result = OnT2DialogCommand(wParam, lParam); } return result; } int T2Dialog::DoModal() { mInModalLoop = true; int result = RunModalLoop(MLF_NOIDLEMSG); if (mInModalLoop) DestroyWindow(); return result; } void T2Dialog::DoClose(int nResult) { if (mInModalLoop) EndModalLoop(nResult); else DestroyWindow(); } /*virtual*/ BOOL T2Dialog::PreTranslateMessage(MSG* msg) { return CWnd::PreTranslateMessage(msg); } /*virtual*/ BOOL T2Dialog::PreCreateWindow(CREATESTRUCT&) { return true; } void T2Dialog::MakeRadioGroup(int inBaseID, int inCount, int inSelected) { for (unsigned short i = 1; i <= inCount; i++) { unsigned short id = inBaseID + i; ((T2DlgItem *) GetDlgItem(id))->SetValue(i == inSelected); } } void T2Dialog::MakeTabPanel(int inBaseID1, int inBaseID2, int inCount, int inSelected) { for (unsigned short i = 1; i <= inCount; i++) { unsigned short id2 = inBaseID2 + i; unsigned short id1 = inBaseID1 + i; GetDlgItem(id2)->EnableWindow(i != inSelected); if (inBaseID1 != 0) GetDlgItem(id1)->ShowWindow((i != inSelected) ? SW_HIDE : SW_SHOW); } } void T2Dialog::OnLButtonDblClk(UINT nFlags, CPoint pt) { OnT2DlgLButtonDblClk(nFlags, pt); } void T2Dialog::OnLButtonDown(UINT nFlags, CPoint pt) { OnT2DlgLButtonDown(nFlags, pt); } void T2Dialog::OnLButtonUp(UINT nFlags, CPoint pt) { OnT2DlgLButtonUp(nFlags, pt); } /*virtual*/ void T2Dialog::PostNcDestroy() { if (mDeleteOnClose) delete this; else CWnd::PostNcDestroy(); } HFONT T2Dialog::GetFont() { HFONT font = NULL; if (mCurrentFont >= 0) font = *mFonts[mCurrentFont]; return font; } void T2Dialog::OnActivateApp(BOOL bActive, HTASK hTask) { CWnd::OnActivateApp(bActive, hTask); }