summaryrefslogtreecommitdiff
path: root/src/T2DLL/T2SearchDialog.cpp
blob: 01c525351a60efadfafc232ea6b1f4e3abb8c2ca (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 "StdAfx.h"
#include "GlobalFunc.h"
#include "MoverSearchDlg.h"
#include "PeopleSearchDlg.h"
#include "T2BitImage.h"
#include "T2DlgItem.h"
#include "T2ImageObj.h"
#include "T2SearchDialog.h"
#include "../T2TowerDoc.h"
#include "TenantSearchDlg.h"

T2SearchDialog::T2SearchDialog(T2TowerDoc* inDoc) {
    mDocument = inDoc;

    CRect theRect;
    AfxGetMainWnd()->GetWindowRect(theRect);

    HMODULE moduleHandle = GetWorldModuleHandle();

    mImageObj = new T2ImageObj;
    mImage = new T2BitImage(moduleHandle, 7100, true);
#line 24
    _ASSERT(mImage != NULL);
    mImageObj->AddObject(moduleHandle, 7100, mImage);

    T2DLGTEMPLATE theTemplate;
    theTemplate.pt = theRect.CenterPoint();
    theTemplate.moduleHandle = moduleHandle;
    theTemplate.resID = 7100;
    Realize(mDocument, &theTemplate, mDocument, mImageObj, NULL, true, NULL, 0, true);

    mPeopleSearchDlg = new PeopleSearchDlg;
    mTenantSearchDlg = new TenantSearchDlg;
    mMoverSearchDlg = new MoverSearchDlg;

    POINT pt;
    pt.x = 152;
    pt.y = 128;
    mPeopleSearchDlg->Create(mTowerDoc, moduleHandle, this, pt);
    mTenantSearchDlg->Create(mTowerDoc, moduleHandle, this, pt);
    mMoverSearchDlg->Create(mTowerDoc, moduleHandle, this, pt);
    mPeopleSearchDlg->ShowWindow(SW_SHOW);

    T2DlgItem *thePeopleCheckBox = GetT2DlgItem(104);
    thePeopleCheckBox->SetValue(1);

    m108 = 1;
}

/*virtual*/ T2SearchDialog::~T2SearchDialog() {
    if (mImageObj)
        delete mImageObj;
    if (mImage)
        delete mImage;
}

/*virtual*/ BOOL T2SearchDialog::OnT2DialogCommand(WPARAM inWParam, LPARAM inLParam) {
    BOOL res = true;

    T2DlgItem *theCheck1 = GetT2DlgItem(104);
    T2DlgItem *theCheck2 = GetT2DlgItem(105);
    T2DlgItem *theCheck3 = GetT2DlgItem(106);

    WORD code = HIWORD(inWParam);
    WORD id = LOWORD(inWParam);

    switch (id) {
        case 104:
            mPeopleSearchDlg->ShowWindow(SW_SHOW);
            mTenantSearchDlg->ShowWindow(SW_HIDE);
            mMoverSearchDlg->ShowWindow(SW_HIDE);
            theCheck2->SetValue(0);
            theCheck3->SetValue(0);
            m108 = 1;
            break;
        case 105:
            mPeopleSearchDlg->ShowWindow(SW_HIDE);
            mTenantSearchDlg->ShowWindow(SW_SHOW);
            mMoverSearchDlg->ShowWindow(SW_HIDE);
            theCheck1->SetValue(0);
            theCheck3->SetValue(0);
            m108 = 2;
            break;
        case 106:
            mPeopleSearchDlg->ShowWindow(SW_HIDE);
            mTenantSearchDlg->ShowWindow(SW_HIDE);
            mMoverSearchDlg->ShowWindow(SW_SHOW);
            theCheck1->SetValue(0);
            theCheck2->SetValue(0);
            m108 = 3;
            break;
        case 107:
            switch (m108) {
                case 1:
                    mPeopleSearchDlg->DoDelete();
                    break;
                case 2:
                    mTenantSearchDlg->DoDelete();
                    break;
                case 3:
                    mMoverSearchDlg->DoDelete();
                    break;
            }
            break;
        case 108:
            ShowWindow(SW_HIDE);
            switch (m108) {
                case 1:
                    mPeopleSearchDlg->DoFind();
                    break;
                case 2:
                    mTenantSearchDlg->DoFind();
                    break;
                case 3:
                    mMoverSearchDlg->DoFind();
                    break;
            }
        case 109:
            OnT2OK();
            DoClose(id);
            break;
        default:
            res = T2Dialog::OnT2DialogCommand(inWParam, inLParam);
    }

    return res;
}