-
Notifications
You must be signed in to change notification settings - Fork 0
/
AlephDlg.cpp
181 lines (160 loc) · 4.76 KB
/
AlephDlg.cpp
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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
// AlephDlg.cpp : implementation file
//
#include "stdafx.h"
#include "AGM.h"
#include "IGCMap.h"
#include "ColorButton.h"
#include "AlephDlg.h"
// CAlephDlg dialog
IMPLEMENT_DYNAMIC(CAlephDlg, CDialog)
CAlephDlg::CAlephDlg(CWnd* pParent /*=NULL*/)
: CDialog(CAlephDlg::IDD, pParent)
{
bTplMode = false;
}
CAlephDlg::~CAlephDlg()
{
}
void CAlephDlg::DoDataExchange(CDataExchange* pDX)
{
CString render,name;
int radius;
if (!pDX->m_bSaveAndValidate) // data to dialog
{
name = curaleph->igcaleph.DestinationSectorName;
render = curaleph->igcaleph.renderbmp;
radius = curaleph->igcaleph.radius;
}
DDX_Check(pDX, IDC_APPLYSPIN, curaleph->bIncludeSpin);
DDX_Check(pDX, IDC_ALEPH_AUTOORIENT, curaleph->bAutoOrient);
DDX_Check(pDX, IDC_ALEPH_NOSPIN, curaleph->bNoSpin);
DDX_CBString(pDX, IDC_ALEPH_RENDER, render);
DDX_Text(pDX, IDC_A_NAME, name);
DDX_Text(pDX, IDC_ALEPH_POSX, curaleph->igcaleph.posx);
DDX_Text(pDX, IDC_ALEPH_POSY, curaleph->igcaleph.posy);
DDX_Text(pDX, IDC_ALEPH_POSZ, curaleph->igcaleph.posz);
DDX_Text(pDX, IDC_ALEPH_O1X, curaleph->igcaleph.O1x);
DDX_Text(pDX, IDC_ALEPH_O1Y, curaleph->igcaleph.O1y);
DDX_Text(pDX, IDC_ALEPH_O1Z, curaleph->igcaleph.O1z);
DDX_Text(pDX, IDC_ALEPH_SPINX, curaleph->igcaleph.spinx);
DDX_Text(pDX, IDC_ALEPH_SPINY, curaleph->igcaleph.spiny);
DDX_Text(pDX, IDC_ALEPH_SPINZ, curaleph->igcaleph.spinz);
DDX_Text(pDX, IDC_ALEPH_SPIN_SPEED, curaleph->igcaleph.spinspeed);
DDX_Text(pDX, IDC_ALEPH_SIG, curaleph->igcaleph.sig);
DDX_Text(pDX, IDC_ALEPH_RADIUS, radius);
if (pDX->m_bSaveAndValidate) // dialog to data
{
strncpy(curaleph->igcaleph.renderbmp,render,sizeof(curaleph->igcaleph.renderbmp));
strncpy(curaleph->igcaleph.DestinationSectorName,name,sizeof(curaleph->igcaleph.DestinationSectorName));
curaleph->igcaleph.radius = radius;
curaleph->OrientTo();
}
CDialog::DoDataExchange(pDX);
}
BOOL CAlephDlg::OnInitDialog(void)
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
CComboBox *cbrender = (CComboBox *) CWnd::GetDlgItem(IDC_ALEPH_RENDER);
if (bTplMode)
{
SetWindowText("Aleph defaults");
SetDlgItemText(IDOK,"Save");
cbrender->AddString("Random");
CWnd *t = CWnd::GetDlgItem(IDC_A_NAME);
t->ShowWindow(SW_HIDE);
t = CWnd::GetDlgItem(IDC_AL_Name);
t->ShowWindow(SW_HIDE);
t = CWnd::GetDlgItem(IDC_ALEPH_POSX);
t->ShowWindow(SW_HIDE);
t = CWnd::GetDlgItem(IDC_AL_x);
t->ShowWindow(SW_HIDE);
t = CWnd::GetDlgItem(IDC_ALEPH_POSY);
t->ShowWindow(SW_HIDE);
t = CWnd::GetDlgItem(IDC_AL_y);
t->ShowWindow(SW_HIDE);
t = CWnd::GetDlgItem(IDC_ALEPH_POSZ);
t->ShowWindow(SW_HIDE);
t = CWnd::GetDlgItem(IDC_AL_z);
t->ShowWindow(SW_HIDE);
t = CWnd::GetDlgItem(IDAPPLYTOSECT);
t->ShowWindow(SW_SHOWNA);
t = CWnd::GetDlgItem(IDAPPLYTOALL);
t->ShowWindow(SW_SHOWNA);
t = CWnd::GetDlgItem(IDC_APPLYSPIN);
t->ShowWindow(SW_SHOWNA);
t = CWnd::GetDlgItem(IDC_S_INCAPPLY);
t->ShowWindow(SW_SHOWNA);
t = NULL;
}
cbrender->AddString("plnt19");
cbrender->AddString("plnt42");
UpdateData(FALSE);
SetAutoCheck();
SetSpinCheck();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CAlephDlg::OnClickedApplytosect(void)
{
UpdateData(TRUE);
EndDialog(IDAPPLYTOSECT);
}
void CAlephDlg::OnClickedApplytoall(void)
{
UpdateData(TRUE);
EndDialog(IDAPPLYTOALL);
}
void CAlephDlg::SetSpinCheck(void)
{
CButton *cbc = (CButton *)CWnd::GetDlgItem(IDC_ALEPH_NOSPIN);
CWnd *cwp;
if (cbc->GetCheck()!=BST_CHECKED)
{
cwp = CWnd::GetDlgItem(IDC_ALEPH_SPINX);
cwp->EnableWindow(TRUE);
cwp = CWnd::GetDlgItem(IDC_ALEPH_SPINY);
cwp->EnableWindow(TRUE);
cwp = CWnd::GetDlgItem(IDC_ALEPH_SPINZ);
cwp->EnableWindow(TRUE);
}
else
{
cwp = CWnd::GetDlgItem(IDC_ALEPH_SPINX);
cwp->EnableWindow(FALSE);
cwp = CWnd::GetDlgItem(IDC_ALEPH_SPINY);
cwp->EnableWindow(FALSE);
cwp = CWnd::GetDlgItem(IDC_ALEPH_SPINZ);
cwp->EnableWindow(FALSE);
}
}
void CAlephDlg::SetAutoCheck(void)
{
CButton *cbc = (CButton *)CWnd::GetDlgItem(IDC_ALEPH_AUTOORIENT);
CWnd *cwp;
if (cbc->GetCheck()!=BST_CHECKED)
{
cwp = CWnd::GetDlgItem(IDC_ALEPH_O1X);
cwp->EnableWindow(TRUE);
cwp = CWnd::GetDlgItem(IDC_ALEPH_O1Y);
cwp->EnableWindow(TRUE);
cwp = CWnd::GetDlgItem(IDC_ALEPH_O1Z);
cwp->EnableWindow(TRUE);
}
else
{
cwp = CWnd::GetDlgItem(IDC_ALEPH_O1X);
cwp->EnableWindow(FALSE);
cwp = CWnd::GetDlgItem(IDC_ALEPH_O1Y);
cwp->EnableWindow(FALSE);
cwp = CWnd::GetDlgItem(IDC_ALEPH_O1Z);
cwp->EnableWindow(FALSE);
}
}
BEGIN_MESSAGE_MAP(CAlephDlg, CDialog)
ON_BN_CLICKED(IDAPPLYTOSECT, OnClickedApplytosect)
ON_BN_CLICKED(IDAPPLYTOALL, OnClickedApplytoall)
ON_BN_CLICKED(IDC_ALEPH_NOSPIN,SetSpinCheck)
ON_BN_CLICKED(IDC_ALEPH_AUTOORIENT,SetAutoCheck)
END_MESSAGE_MAP()
// CAlephDlg message handlers