-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHardwareSettings.cpp
executable file
·115 lines (85 loc) · 3.24 KB
/
HardwareSettings.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
// HardwareSettings.cpp : implementation file
//
#include "stdafx.h"
#include "LaserScan.h"
#include "HardwareSettings.h"
// CHardwareSettings dialog
IMPLEMENT_DYNAMIC(CHardwareSettings, CDialog)
CHardwareSettings::CHardwareSettings(CWnd* pParent /*=NULL*/)
: CDialog(CHardwareSettings::IDD, pParent)
{
}
CHardwareSettings::~CHardwareSettings()
{
}
void CHardwareSettings::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_TREE_Hardware, m_Tree_Hardware);
}
BEGIN_MESSAGE_MAP(CHardwareSettings, CDialog)
ON_NOTIFY(TVN_SELCHANGED, IDC_TREE_Hardware, &CHardwareSettings::OnTvnSelchangedTreeHardware)
END_MESSAGE_MAP()
// CHardwareSettings message handlers
BOOL CHardwareSettings::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
//display
/*m_Tree_Hardware.DeleteAllItems();
m_Tree_Hardware.InsertItem(_T("Initialization"));
m_Tree_Hardware.InsertItem(_T("Optics"));*/
/*HTREEITEM m_hParent = m_Tree_Hardware.InsertItem(_T("Hardware Setting"),TVI_ROOT);
HTREEITEM m_hChild1 = m_Tree_Hardware.InsertItem(_T("ScanHead status"),m_hParent,TVI_LAST);
HTREEITEM m_hChild2 = m_Tree_Hardware.InsertItem(_T("Initialization"),m_hParent,TVI_LAST);
HTREEITEM m_hChild3 = m_Tree_Hardware.InsertItem(_T("Optics"),m_hParent,TVI_LAST);
Tree.SetItemData(m_hParent,0);
Tree.SetItemData(m_hChild1,1);
Tree.SetItemData(m_hChild2,2);*/
m_Tree_Hardware.DeleteAllItems();
HTREEITEM t_HardwareSettings=m_Tree_Hardware.InsertItem(_T("Hardware Settings"));
HTREEITEM t_Initialization=m_Tree_Hardware.InsertItem(_T("Initialization"),t_HardwareSettings);
HTREEITEM t_ScanHead=m_Tree_Hardware.InsertItem(_T("ScanHead status"),t_HardwareSettings);
HTREEITEM t_Optics=m_Tree_Hardware.InsertItem(_T("Optics"),t_HardwareSettings);
m_Tree_Hardware.Expand(t_HardwareSettings,TVE_EXPAND);
m_Initialization.Create(IDD_Initialization,this);
m_Optics.Create(IDD_Optics,this);
m_ScanHead.Create(IDD_HardwareSettings_ScanHead,this);
CRect r;
GetDlgItem(IDC_STATIC_Hardware)->GetWindowRect(r);
ScreenToClient(r);
m_Initialization.MoveWindow(r);
m_Optics.MoveWindow(r);
m_ScanHead.MoveWindow(r);
m_Initialization.ShowWindow(SW_HIDE);
m_Optics.ShowWindow(SW_HIDE);
m_ScanHead.ShowWindow(SW_HIDE);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CHardwareSettings::OnTvnSelchangedTreeHardware(NMHDR *pNMHDR, LRESULT *pResult)
{
LPNMTREEVIEW pNMTreeView = reinterpret_cast<LPNMTREEVIEW>(pNMHDR);
// TODO: Add your control notification handler code here
TVITEM item=pNMTreeView->itemNew;
CString str=m_Tree_Hardware.GetItemText(item.hItem);
if(str.Compare(_T("Initialization"))==0)
{
m_Initialization.ShowWindow(SW_SHOW);
m_Optics.ShowWindow(SW_HIDE);
m_ScanHead.ShowWindow(SW_HIDE);
}
else if(str.Compare(_T("Optics"))==0)
{
m_Initialization.ShowWindow(SW_HIDE);
m_Optics.ShowWindow(SW_SHOW);
m_ScanHead.ShowWindow(SW_HIDE);
}
else if (str.Compare(_T("ScanHead status"))==0)
{
m_Initialization.ShowWindow(SW_HIDE);
m_Optics.ShowWindow(SW_HIDE);
m_ScanHead.ShowWindow(SW_SHOW);
}
*pResult = 0;
}