-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathYuanLinkDlg.cpp
119 lines (81 loc) · 2.67 KB
/
YuanLinkDlg.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
// YuanLinkDlg.cpp : implementation file
//
#include "stdafx.h"
#include "AiQi.h"
#include "YUAN_struct.h"
#include "YUAN_system.h"
#include "YuanLinkDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CYuanLinkDlg dialog
CYuanLinkDlg::CYuanLinkDlg(CWnd* pParent /*=NULL*/)
: CDialog(CYuanLinkDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CYuanLinkDlg)
select_linker_ID1_text= _T("");
m_weight = 0.0f;
select_linker_ID2_text = _T("");
m_weight2 = 0.0f;
//}}AFX_DATA_INIT
}
void CYuanLinkDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CYuanLinkDlg)
DDX_Text(pDX, IDC_YuanLinkDlg_EDIT1, select_linker_ID1_text);
DDX_Text(pDX, IDC_YuanLinkDlg_EDIT3, m_weight);
DDX_Text(pDX, IDC_YuanLinkDlg_EDIT2, select_linker_ID2_text);
DDX_Text(pDX, IDC_YuanLinkDlg_EDIT4, m_weight2);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CYuanLinkDlg, CDialog)
//{{AFX_MSG_MAP(CYuanLinkDlg)
ON_WM_CREATE()
ON_WM_SHOWWINDOW()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CYuanLinkDlg message handlers
void CYuanLinkDlg::OnOK()
{
// TODO: Add extra validation here
UpdateData();
YUAN->Set_linker_weight(select_linker_ID_1,select_linker_ID_2,m_weight);
if(select_linker_sum==2)
YUAN->Set_linker_weight(select_linker_ID_2,select_linker_ID_1,m_weight2);
UpdateData(FALSE);
CDialog::OnOK();
}
int CYuanLinkDlg::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDialog::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: Add your specialized creation code here
//³õʼ»¯Á¬½Ó1
if(select_linker_sum==1)
{
select_linker_ID1_text.Format("Á¬½Ó: %d -> %d",select_linker_ID_1,select_linker_ID_2);
m_weight = YUAN->Get_linker_weight(select_linker_ID_1,select_linker_ID_2);
select_linker_ID2_text.Format("Á¬½Ó: %d -> %d ÎÞ",select_linker_ID_2,select_linker_ID_1);
}
//³õʼ»¯Á¬½Ó2
if(select_linker_sum==2)
{
select_linker_ID1_text.Format("Á¬½Ó: %d -> %d",select_linker_ID_1,select_linker_ID_2);
m_weight = YUAN->Get_linker_weight(select_linker_ID_1,select_linker_ID_2);
select_linker_ID2_text.Format("Á¬½Ó: %d -> %d",select_linker_ID_2,select_linker_ID_1);
m_weight2 = YUAN->Get_linker_weight(select_linker_ID_2,select_linker_ID_1);
}
return 0;
}
void CYuanLinkDlg::OnShowWindow(BOOL bShow, UINT nStatus)
{
CDialog::OnShowWindow(bShow, nStatus);
// TODO: Add your message handler code here
if(select_linker_sum==1)
((CEdit*)GetDlgItem(IDC_YuanLinkDlg_EDIT4))-> EnableWindow(FALSE); //SetReadOnly(TRUE);
}