From c920fe38a19013b99f3f74e48da9724fb053c212 Mon Sep 17 00:00:00 2001 From: Ash Wolf Date: Sun, 9 Jul 2023 20:59:16 +0100 Subject: support building from VC++ IDE, add resources --- src/T2WorldSelectDlg.cpp | 34 ++++++++++++++++++---------------- 1 file changed, 18 insertions(+), 16 deletions(-) (limited to 'src/T2WorldSelectDlg.cpp') diff --git a/src/T2WorldSelectDlg.cpp b/src/T2WorldSelectDlg.cpp index 361aadb..935578b 100644 --- a/src/T2WorldSelectDlg.cpp +++ b/src/T2WorldSelectDlg.cpp @@ -1,10 +1,12 @@ -#include "GlobalFunc.h" -#include "T2BitImage.h" -#include "T2ImageObj.h" -#include "T2PluginLoader.h" -#include "T2PluginSpecifier.h" +#include "StdAfx.h" +#include "T2DLL/GlobalFunc.h" +#include "T2DLL/T2BitImage.h" +#include "T2DLL/T2ImageObj.h" +#include "T2DLL/T2PluginLoader.h" +#include "T2DLL/T2PluginSpecifier.h" #include "T2TowerDoc.h" #include "T2WorldSelectDlg.h" +#include "Resource.h" #ifdef _DEBUG #define new DEBUG_NEW @@ -15,7 +17,7 @@ static char THIS_FILE[] = __FILE__; T2WorldSelectDlg::T2WorldSelectDlg() { mDeleteOnClose = true; - HRSRC rsrc = FindResource(AfxGetApp()->m_hInstance, MAKEINTRESOURCE(100), "PALETTE"); + HRSRC rsrc = FindResource(AfxGetApp()->m_hInstance, MAKEINTRESOURCE(IDR_DEFAULT_PALETTE), "PALETTE"); HGLOBAL theHandle = LoadResource(AfxGetApp()->m_hInstance, rsrc); void *resData = LockResource(theHandle); @@ -43,7 +45,7 @@ T2WorldSelectDlg::T2WorldSelectDlg() { free(theLogPalette); - mBitmap.LoadBitmap(170); + mBitmap.LoadBitmap(IDB_PATTERN_BRUSH); mBrush.CreatePatternBrush(&mBitmap); mPlugins = NULL; @@ -128,18 +130,18 @@ void T2WorldSelectDlg::ShowWorldSelectDlg(T2TowerDoc *inDoc, T2PluginLoader *inP T2DLGTEMPLATE tmpl; tmpl.pt = rect.CenterPoint(); tmpl.moduleHandle = instanceHandle; - tmpl.resID = 178; + tmpl.resID = kDlgResID; mDocumentAlso = NULL; #line 134 mImageObj = new T2ImageObj; - mArrowButtonImages = new T2BitImage(instanceHandle, 179, true); - mImageObj->AddObject(instanceHandle, 179, mArrowButtonImages); + mArrowButtonImages = new T2BitImage(instanceHandle, IDB_WORLD_SELECT, true); + mImageObj->AddObject(instanceHandle, IDB_WORLD_SELECT, mArrowButtonImages); Realize(this, &tmpl, mDocumentAlso, mImageObj, &mPalette, true, NULL, 0, true); - mBackButton = (CButton *) GetDescendantWindow(101); - mNextButton = (CButton *) GetDescendantWindow(102); + mBackButton = (CButton *) GetDescendantWindow(kCmdLeft); + mNextButton = (CButton *) GetDescendantWindow(kCmdRight); mBackButton->EnableWindow(false); } @@ -452,7 +454,7 @@ void T2WorldSelectDlg::GoRight() { /*virtual*/ void T2WorldSelectDlg::OnT2DlgLButtonDblClk(UINT nFlags, CPoint pt) { if (PtInRect(mRect1, pt)) { OnT2DlgLButtonDown(nFlags, pt); - OnT2DialogCommand(100, 0); + OnT2DialogCommand(kCmdOK, 0); } } @@ -674,13 +676,13 @@ void T2WorldSelectDlg::DrawWorldPreview(CDC *pDC) { WORD code = HIWORD(inWParam); WORD id = LOWORD(inWParam); - if (id == 100 && code == 0) { + if (id == kCmdOK && code == 0) { ShowWindow(SW_HIDE); mDocument->xUnkNameSelectWorld(GetSelectedPlugin()); DestroyWindow(); - } else if (id == 101 && code == 0) { + } else if (id == kCmdLeft && code == 0) { GoLeft(); - } else if (id == 102 && code == 0) { + } else if (id == kCmdRight && code == 0) { GoRight(); } else { result = T2Dialog::OnCommand(inWParam, inLParam); -- cgit v1.2.3