summaryrefslogtreecommitdiff
path: root/src/T2DLL/T2SettingDialog.cpp
blob: 5eb6551e38a2796d60b7d70a64dccf67e16aff69 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
#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;
}