diff options
Diffstat (limited to 'src/T2.cpp')
-rw-r--r-- | src/T2.cpp | 86 |
1 files changed, 52 insertions, 34 deletions
@@ -1,16 +1,18 @@ +#include "StdAfx.h" #include "256CheckDialog.h" -#include "GlobalFunc.h" +#include "T2DLL/GlobalFunc.h" #include "T2.h" -#include "T2ClassFactory.h" -#include "T2DLL.h" -#include "T2GlobalData.h" -#include "T2MainWindow.h" -#include "T2Message.h" +#include "T2DLL/T2ClassFactory.h" +#include "T2DLL/T2DLL.h" +#include "T2DLL/T2GlobalData.h" +#include "T2DLL/T2Message.h" #include "T2OpenFileDialog.h" #include "T2OpenningWindow.h" #include "T2OpenSelectDlg.h" -#include "T2PluginLoader.h" -#include "T2PluginSpecifier.h" +#include "T2DLL/T2PluginLoader.h" +#include "T2DLL/T2PluginSpecifier.h" + +#include "T2MainWindow.h" #include "T2TowerDoc.h" #include "T2TowerMainView.h" @@ -21,10 +23,12 @@ static char THIS_FILE[] = __FILE__; #endif BEGIN_MESSAGE_MAP(CT2App, CWinApp) + //{{AFX_MSG_MAP(CT2App) ON_COMMAND(ID_APP_ABOUT, OnCmdAbout) ON_COMMAND(ID_FILE_OPEN, OnCmdOpen) - ON_COMMAND(ID_FILE_NEW, OnFileNew) - ON_COMMAND(ID_FILE_OPEN, OnFileOpen) + //}}AFX_MSG_MAP + ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew) + ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen) END_MESSAGE_MAP() CT2App::CT2App() { @@ -37,7 +41,7 @@ CT2App theApp; static void setRegValue(HKEY rootKey, const char *subKey, const char *name, const char *value); /*virtual*/ BOOL CT2App::InitInstance() { - SetRegistryKey("OPeNBooK9003"); + SetRegistryKey(_T("OPeNBooK9003")); _DC = 1; @@ -115,7 +119,7 @@ static void setRegValue(HKEY rootKey, const char *subKey, const char *name, cons ReleaseDC(NULL, hdc); if (!isPaletteMode) { - C256ColorDialog dlg(NULL); + C256CheckDialog dlg(NULL); if (dlg.DoModal() != IDOK) return false; } @@ -125,7 +129,7 @@ static void setRegValue(HKEY rootKey, const char *subKey, const char *name, cons #line 161 CDocTemplate *pDocTemplate = new CSingleDocTemplate( - 128, + IDR_MAINFRAME, RUNTIME_CLASS(T2TowerDoc), RUNTIME_CLASS(T2MainWindow), RUNTIME_CLASS(T2TowerMainView) @@ -166,17 +170,26 @@ static void setRegValue(HKEY rootKey, const char *subKey, const char *name, cons RegCloseKey(key); } -class AboutDialog : public CDialog { - DECLARE_MESSAGE_MAP(); - +class CAboutDlg : public CDialog { public: - AboutDialog(); + CAboutDlg(); -protected: + //{{AFX_DATA(CAboutDlg) + enum { IDD = IDD_ABOUTBOX }; + //}}AFX_DATA + + //{{AFX_VIRTUAL(CAboutDlg) + protected: virtual void DoDataExchange(CDataExchange *pDX); + //}}AFX_VIRTUAL + +protected: + //{{AFX_MSG(CAboutDlg) afx_msg void OnTimer(UINT nIDEvent); afx_msg void OnDestroy(); afx_msg void OnShowWindow(BOOL bShow, UINT nStatus); + //}}AFX_MSG + DECLARE_MESSAGE_MAP() int mCounter; CBitmap mBitmap; @@ -186,17 +199,20 @@ protected: BOOL mIsSetUp; }; -AboutDialog::AboutDialog() - : CDialog(100) +CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD) { + //{{AFX_DATA_INIT(CAboutDlg) + //}}AFX_DATA_INIT mIsSetUp = false; } -/*virtual*/ void AboutDialog::DoDataExchange(CDataExchange *pDX) { +/*virtual*/ void CAboutDlg::DoDataExchange(CDataExchange *pDX) { CWnd::DoDataExchange(pDX); + //{{AFX_DATA_MAP(CAboutDlg) + //}}AFX_DATA_MAP } -void AboutDialog::OnShowWindow(BOOL bShow, UINT nStatus) { +void CAboutDlg::OnShowWindow(BOOL bShow, UINT nStatus) { CWnd::OnShowWindow(bShow, nStatus); if (!mIsSetUp) { @@ -206,13 +222,13 @@ void AboutDialog::OnShowWindow(BOOL bShow, UINT nStatus) { SetTimer(1, 50, NULL); - CWnd *logoItem = GetDlgItem(1026); + CWnd *logoItem = GetDlgItem(IDC_LOGO); logoItem->SetWindowPos(NULL, 16, 16, 0, 0, SWP_NOSIZE); RECT logoRect; logoItem->GetClientRect(&logoRect); - CWnd *serialLabelItem = GetDlgItem(1027); + CWnd *serialLabelItem = GetDlgItem(IDC_SERIAL_LABEL); serialLabelItem->SetWindowPos(NULL, 16, logoRect.bottom + 32, 0, 0, SWP_NOSIZE); RECT serialLabelRect; @@ -230,22 +246,22 @@ void AboutDialog::OnShowWindow(BOOL bShow, UINT nStatus) { niceSerialNo += " - "; niceSerialNo += serialNo.Mid(12, 4); - CWnd *serialItem = GetDlgItem(1024); + CWnd *serialItem = GetDlgItem(IDC_SERIAL_NUMBER); serialItem->SetWindowText(niceSerialNo); serialItem->SetWindowPos(NULL, serialLabelRect.right + 20, logoRect.bottom + 32, 0, 0, SWP_NOSIZE); - mBitmap.LoadBitmap(224); + mBitmap.LoadBitmap(IDB_CREDITS); BITMAP bitmap; mBitmap.GetBitmap(&bitmap); - CWnd *creditsWnd = GetDlgItem(1025); + CWnd *creditsWnd = GetDlgItem(IDC_CREDITS); mCreditsWidth = bitmap.bmWidth; mCreditsViewHeight = logoRect.bottom; creditsWnd->SetWindowPos(NULL, logoRect.right + 32, 16, mCreditsWidth, mCreditsViewHeight, 0); mCreditsFullHeight = bitmap.bmHeight; - CWnd *okButton = GetDlgItem(1); + CWnd *okButton = GetDlgItem(IDOK); RECT okRect; okButton->GetClientRect(&okRect); @@ -262,19 +278,19 @@ void AboutDialog::OnShowWindow(BOOL bShow, UINT nStatus) { } } -void AboutDialog::OnDestroy() { +void CAboutDlg::OnDestroy() { KillTimer(1); mBitmap.DeleteObject(); CWnd::OnDestroy(); } -void AboutDialog::OnTimer(UINT nIDEvent) { +void CAboutDlg::OnTimer(UINT nIDEvent) { #pragma var_order(prevBitmap, dc, newDC, creditsWnd) mCounter++; if (mCounter > (mCreditsFullHeight - mCreditsViewHeight)) mCounter = 0; - CWnd *creditsWnd = GetDlgItem(1025); + CWnd *creditsWnd = GetDlgItem(IDC_CREDITS); CDC newDC; CDC *dc = creditsWnd->GetDC(); @@ -288,15 +304,17 @@ void AboutDialog::OnTimer(UINT nIDEvent) { CWnd::OnTimer(nIDEvent); } -BEGIN_MESSAGE_MAP(AboutDialog, CDialog) +BEGIN_MESSAGE_MAP(CAboutDlg, CDialog) + //{{AFX_MSG_MAP(CAboutDlg) ON_WM_TIMER() ON_WM_DESTROY() ON_WM_SHOWWINDOW() + //}}AFX_MSG_MAP END_MESSAGE_MAP() void CT2App::OnCmdAbout() { - AboutDialog dlg; - dlg.DoModal(); + CAboutDlg aboutDlg; + aboutDlg.DoModal(); } |