-
Notifications
You must be signed in to change notification settings - Fork 1
/
SetPara.cpp
188 lines (150 loc) · 5.13 KB
/
SetPara.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
182
183
184
185
186
187
188
// SetPara.cpp : implementation file
//
#include "stdafx.h"
#include "Robot.h"
#include "SetPara.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// SetPara dialog
SetPara::SetPara(CWnd* pParent /*=NULL*/)
: CDialog(SetPara::IDD, pParent)
{
//{{AFX_DATA_INIT(SetPara)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
m_Height = m_CurPara.height;
m_Width = m_CurPara.width;
m_Cross = m_CurPara.propC;
m_Mutation = m_CurPara.propM;
m_PopSize = m_CurPara.pSize;
m_GenNum = m_CurPara.T;
}
void SetPara::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(SetPara)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
DDX_Text(pDX, IDC_EDITHEIGHT, m_Height);
DDV_MinMaxInt(pDX,m_Height,1,100);
DDX_Text(pDX, IDC_EDITWIDTH, m_Width);
DDV_MinMaxInt(pDX,m_Width,1,100);
DDX_Text(pDX, IDC_EDITCROSS, m_Cross);
DDV_MinMaxDouble(pDX,m_Cross,0,1.0);
DDX_Text(pDX, IDC_EDITMUTATION, m_Mutation);
DDV_MinMaxDouble(pDX,m_Mutation,0,1.0);
DDX_Text(pDX, IDC_EDITPOP, m_PopSize);
DDV_MinMaxInt(pDX,m_PopSize,1,500);
DDX_Text(pDX, IDC_EDITGENNUM, m_GenNum);
DDV_MinMaxInt(pDX,m_GenNum,1,3000);
m_Length = ((CButton *)GetDlgItem(IDC_LENGTH))->GetCheck();
m_Smooth = ((CButton *)GetDlgItem(IDC_SMOOTH))->GetCheck();
m_Safe = ((CButton *)GetDlgItem(IDC_SAFE))->GetCheck();
}
BEGIN_MESSAGE_MAP(SetPara, CDialog)
//{{AFX_MSG_MAP(SetPara)
ON_EN_CHANGE(IDC_EDITCROSS, OnChangeEditcross)
ON_EN_CHANGE(IDC_EDITGENNUM, OnChangeEditgennum)
ON_EN_CHANGE(IDC_EDITHEIGHT, OnChangeEditheight)
ON_EN_CHANGE(IDC_EDITMUTATION, OnChangeEditmutation)
ON_EN_CHANGE(IDC_EDITPOP, OnChangeEditpop)
ON_EN_CHANGE(IDC_EDITWIDTH, OnChangeEditwidth)
//}}AFX_MSG_MAP
ON_STN_CLICKED(IDC_STATICWIDTH, &SetPara::OnStnClickedStaticwidth)
ON_STN_CLICKED(IDC_STATICMUTATION, &SetPara::OnStnClickedStaticmutation)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// SetPara message handlers
void SetPara::OnOK()
{
// TODO: Add extra validation here
CDialog::OnOK();
}
void SetPara::OnCancel()
{
// TODO: Add extra cleanup here
CDialog::OnCancel();
}
void SetPara::OnChangeEditcross()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
this->UpdateData();
}
void SetPara::OnChangeEditgennum()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
this->UpdateData();
}
void SetPara::OnChangeEditheight()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
this->UpdateData();
}
void SetPara::OnChangeEditmutation()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
this->UpdateData();
}
void SetPara::OnChangeEditpop()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
this->UpdateData();
}
void SetPara::OnChangeEditwidth()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialog::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
this->UpdateData();
}
BOOL SetPara::OnInitDialog()
{
CDialog::OnInitDialog();
if(m_CurPara.length == 1)
((CButton *)GetDlgItem(IDC_LENGTH))->SetCheck(TRUE);
else
((CButton *)GetDlgItem(IDC_LENGTH))->SetCheck(FALSE);
if(m_CurPara.smooth == 1)
((CButton *)GetDlgItem(IDC_SMOOTH))->SetCheck(TRUE);
else
((CButton *)GetDlgItem(IDC_SMOOTH))->SetCheck(FALSE);
if(m_CurPara.safe == 1)
((CButton *)GetDlgItem(IDC_SAFE))->SetCheck(TRUE);
else
((CButton *)GetDlgItem(IDC_SAFE))->SetCheck(FALSE);
return TRUE; // return TRUE unless you set the focus to a control
}
void SetPara::OnStnClickedStaticwidth()
{
// TODO: Add your control notification handler code here
}
void SetPara::OnStnClickedStaticmutation()
{
// TODO: Add your control notification handler code here
}